Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/devui-vue/devui/anchor/src/d-anchor-box.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { setActiveLink, onScroll, randomId } from './util';
import { inBrowser } from '../../shared/util/common-var';
import { setActiveLink, onScroll, } from './utils';
import { inBrowser, randomId } from '../../shared/utils';

export default {
name: 'd-anchor-box',
// 滚动区域
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/devui/anchor/src/d-anchor-link.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { scrollToControl } from './util';
import { scrollToControl } from './utils';
interface Bind {
value: string;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/devui/anchor/src/d-anchor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {hightLightFn} from './util';
import {hightLightFn} from './utils';
interface Bind {
value: string;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,3 @@ function getAnchors(sidebarLinks: Array<HTMLAnchorElement>): Array<HTMLAnchorEle
.call(document.querySelectorAll('.box-anchor'))
.filter((anchor: HTMLAnchorElement) => sidebarLinks.some((sidebarLink: HTMLAnchorElement) => sidebarLink.hash === anchor.hash));
}


export const randomId = function(n=8): string { // 生成n位长度的字符串
const str = 'abcdefghijklmnopqrstuvwxyz0123456789'; // 可以作为常量放到random外面
let result = '';
for(let i = 0; i < n; i++) {
result += str[parseInt((Math.random() * str.length).toString())];
}
return result;
};


2 changes: 1 addition & 1 deletion packages/devui-vue/devui/breadcrumb/src/breadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
SourceConfig
} from './breadcrumb-types';
import DBreadcrumbItem from './breadcrumb-item';
import { getPropsSlot } from '../../shared/util/props-util';
import { getPropsSlot } from '../../shared/utils/props-util';
import './breadcrumb.scss';

export default defineComponent({
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/devui/drawer/src/use-drawer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { computed, onUnmounted, ref, watch } from 'vue';
import { onClickOutside } from '@vueuse/core';
import { DrawerEmit, DrawerProps, UseDrawerFn } from './drawer-types';
import { lockScroll } from '../../shared/util/lock-scroll';
import { lockScroll } from '../../shared/utils/lock-scroll';

export function useDrawer(props: DrawerProps, emit: DrawerEmit): UseDrawerFn {
const drawerRef = ref<HTMLElement>();
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/devui/dropdown/src/use-dropdown.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { watch, onMounted, onUnmounted, toRefs, computed, ref } from 'vue';
import type { Ref } from 'vue';
import { getElement } from '../../shared/util/dom';
import { getElement } from '../../shared/utils/dom';
import { UseDropdownProps, EmitEvent, DropdownProps, UseOverlayFn } from './dropdown-types';

const dropdownMap = new Map();
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/devui/modal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Header from './src/components/header';
import Body from './src/components/body';
import Footer from './src/components/footer';
import { ModalService } from './src/services/modal-service';
import { inBrowser } from '../shared/util/common-var';
import { inBrowser } from '../shared/utils/common-var';

export * from './src/modal-types';

Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/devui/overlay/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { App } from 'vue';
import { FixedOverlay } from './src/fixed-overlay';
import { FlexibleOverlay } from './src/flexible-overlay';
import { inBrowser } from '../shared/util/common-var';
import { inBrowser } from '../shared/utils/common-var';

export * from './src/fixed-overlay/fixed-overlay-types';
export * from './src/flexible-overlay/flexible-overlay-types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* <div v-clickoutside="handleClose">
*/

import { inBrowser } from '../util/common-var';
import { inBrowser } from '../utils/common-var';
import { on } from './utils';

const ctx = Symbol('@@clickoutside');
Expand Down
8 changes: 8 additions & 0 deletions packages/devui-vue/devui/shared/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export * from './class';
export * from './common-var';
export * from './debounce';
export * from './dom';
export * from './lock-scroll';
export * from './props-util';
export * from './random-id';
export * from './set-style';
9 changes: 9 additions & 0 deletions packages/devui-vue/devui/shared/utils/random-id.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export function randomId(n = 8): string {
// 生成n位长度的字符串
const str = 'abcdefghijklmnopqrstuvwxyz0123456789'; // 可以作为常量放到random外面
let result = '';
for (let i = 0; i < n; i++) {
result += str[parseInt((Math.random() * str.length).toString())];
}
return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
} from 'vue';

import DToolTip from '../../../tooltip/src/tooltip';
import { setStyle } from '../../../shared/util/set-style';
import { addClass, removeClass } from '../../../shared/util/class';
import { setStyle } from '../../../shared/utils/set-style';
import { addClass, removeClass } from '../../../shared/utils/class';
import dresize, { ResizeDirectiveProp } from '../d-resize-directive';
import type { SplitterStore, DragState, SplitterPane } from '../splitter-store';
import { splitterBarProps, SplitterBarProps } from './splitter-bar-types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
onMounted,
onUpdated,
} from 'vue';
import { addClass, hasClass, removeClass } from '../../../shared/util/class';
import { setStyle } from '../../../shared/util/set-style';
import { addClass, hasClass, removeClass } from '../../../shared/utils/class';
import { setStyle } from '../../../shared/utils/set-style';
import type { SplitterStore } from '../splitter-store';
import { splitterPaneProps, SplitterPaneProps } from './splitter-pane-types';
import './splitter-pane.scss';
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/devui/theme/core/theme.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { inBrowser } from '../../shared/util/common-var';
import { inBrowser } from '../../shared/utils/common-var';

class Theme {
static imports: any = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
CheckableRelationType,
TreeData,
} from '../tree-types';
import { flatten } from '../util';
import { flatten } from '../utils';

interface IUseChecked {
selected: Ref<SelectType>;
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/devui/tree/src/core/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { randomId } from '../../../anchor/src/util';
import { randomId } from '../../../shared/utils';
import { IInnerTreeNode, ITreeNode } from './use-tree-types';

export function flatToNested(flatTree: IInnerTreeNode[]): ITreeNode[] {
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/devui/tree/src/tree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defineComponent, reactive, ref, toRefs, provide } from 'vue';
import type { SetupContext } from 'vue';
import { treeProps, TreeProps, TreeItem, TreeRootType, Nullable } from './tree-types';
import { CHECK_CONFIG } from './config';
import { preCheckTree, deleteNode, getId } from './util';
import { preCheckTree, deleteNode, getId } from './utils';
import Loading from '../../loading/src/loading-service';
import Checkbox from '../../checkbox/src/checkbox';
import useToggle from './composables/use-toggle';
Expand Down