@dt-frames/ui 1.0.11 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/curd/src/components/dialog.d.ts +34 -25
- package/es/components/curd/src/components/props.d.ts +6 -5
- package/es/components/curd/src/hooks/useCurd.d.ts +1 -0
- package/es/components/curd/src/types/curd.type.d.ts +4 -3
- package/es/components/forms/src/components/formButton.d.ts +1 -2
- package/es/components/forms/src/components/formIcon.d.ts +16 -11
- package/es/components/forms/src/components/formInputUseDialog.d.ts +903 -0
- package/es/components/forms/src/hooks/useFormActions.d.ts +2 -2
- package/es/components/forms/src/index.d.ts +2 -2
- package/es/components/forms/src/types/form.type.d.ts +6 -18
- package/es/components/index.d.ts +2 -2
- package/es/components/modal/src/components/modal.d.ts +2 -2
- package/es/components/modal/src/components/modalFooter.d.ts +10 -5
- package/es/components/modal/src/index.d.ts +16 -11
- package/es/components/modal/src/props.d.ts +2 -1
- package/es/components/modal/src/types/modal.type.d.ts +4 -1
- package/es/components/source/src/hooks/useFetch.d.ts +1 -1
- package/es/components/table/src/hooks/useCustomRow.d.ts +19 -0
- package/es/components/table/src/hooks/useTable.d.ts +2 -2
- package/es/components/table/src/index.d.ts +24 -5
- package/es/components/table/src/props.d.ts +5 -2
- package/es/components/table/src/types/table.type.d.ts +2 -2
- package/es/components/tree/src/props.d.ts +8 -1
- package/es/components/upload/index.d.ts +1 -2
- package/es/components/upload/src/helper.d.ts +1 -0
- package/es/components/upload/src/index.d.ts +34 -11
- package/es/components/upload/src/props.d.ts +4 -1
- package/es/components/upload/src/upload.d.ts +42 -11
- package/es/index.js +356 -200
- package/es/style/components/forms/index.less +23 -0
- package/es/style/components/icons/index.less +1 -1
- package/es/style/components/upload/index.less +3 -11
- package/package.json +1 -10
- package/vite.config.js +10 -0
- package/src/assets/data/icons/actions.ts +0 -427
- package/src/assets/data/icons/code.ts +0 -10
- package/src/assets/data/icons/commuticate.ts +0 -190
- package/src/assets/data/icons/currency.ts +0 -46
- package/src/assets/data/icons/devices.ts +0 -128
- package/src/assets/data/icons/edit.ts +0 -165
- package/src/assets/data/icons/file.ts +0 -104
- package/src/assets/data/icons/math.ts +0 -53
- package/src/assets/data/icons/message.ts +0 -75
- package/src/assets/data/icons/navigate.ts +0 -181
- package/src/assets/data/icons/other.ts +0 -333
- package/src/assets/data/icons.ts +0 -58
- package/src/assets/imgs/header/avatar.png +0 -0
- package/src/assets/imgs/logo/logo.png +0 -0
- package/src/assets/locales/en_US.json +0 -3
- package/src/assets/locales/zh_CN.json +0 -3
- package/src/assets/style/index.less +0 -10
- package/src/assets/style/reset.less +0 -17
- package/src/components/container/index.less +0 -85
- package/src/components/container/index.ts +0 -8
- package/src/components/container/src/bar.ts +0 -107
- package/src/components/container/src/lazy-container.vue +0 -9
- package/src/components/container/src/scroll-bar.vue +0 -117
- package/src/components/container/src/scroll-container.vue +0 -61
- package/src/components/curd/index.ts +0 -5
- package/src/components/curd/src/components/dialog.vue +0 -73
- package/src/components/curd/src/components/props.ts +0 -32
- package/src/components/curd/src/hooks/useCurd.tsx +0 -87
- package/src/components/curd/src/types/curd.type.ts +0 -31
- package/src/components/excel/index.ts +0 -6
- package/src/components/excel/src/export2Excel.ts +0 -44
- package/src/components/forms/index.less +0 -84
- package/src/components/forms/index.ts +0 -11
- package/src/components/forms/src/componentMap.ts +0 -44
- package/src/components/forms/src/components/formButton.vue +0 -150
- package/src/components/forms/src/components/formIcon.vue +0 -51
- package/src/components/forms/src/components/formItem.vue +0 -420
- package/src/components/forms/src/components/radioButton.vue +0 -58
- package/src/components/forms/src/const/form.const.ts +0 -7
- package/src/components/forms/src/hooks/helper.ts +0 -70
- package/src/components/forms/src/hooks/useForm.ts +0 -130
- package/src/components/forms/src/hooks/useFormActions.ts +0 -63
- package/src/components/forms/src/hooks/useFormEvents.ts +0 -248
- package/src/components/forms/src/hooks/useFormValue.ts +0 -49
- package/src/components/forms/src/hooks/useFormValues.ts +0 -131
- package/src/components/forms/src/hooks/useLabelWidth.ts +0 -57
- package/src/components/forms/src/index.vue +0 -310
- package/src/components/forms/src/prop.ts +0 -80
- package/src/components/forms/src/types/form.type.ts +0 -269
- package/src/components/icons/index.less +0 -101
- package/src/components/icons/index.ts +0 -7
- package/src/components/icons/src/pick-icon.vue +0 -119
- package/src/components/icons/src/svg-icon.vue +0 -117
- package/src/components/iframe/index.less +0 -3
- package/src/components/iframe/index.ts +0 -5
- package/src/components/iframe/src/index.less +0 -3
- package/src/components/iframe/src/index.vue +0 -38
- package/src/components/index.ts +0 -54
- package/src/components/modal/index.less +0 -60
- package/src/components/modal/index.ts +0 -8
- package/src/components/modal/src/components/close-icon.vue +0 -46
- package/src/components/modal/src/components/modal-wrap.vue +0 -128
- package/src/components/modal/src/components/modal.tsx +0 -30
- package/src/components/modal/src/components/modalFooter.vue +0 -38
- package/src/components/modal/src/hooks/useDrag.ts +0 -107
- package/src/components/modal/src/hooks/useFullScreen.ts +0 -29
- package/src/components/modal/src/hooks/useModal.ts +0 -194
- package/src/components/modal/src/index.vue +0 -173
- package/src/components/modal/src/props.ts +0 -43
- package/src/components/modal/src/types/modal.type.ts +0 -27
- package/src/components/router/base-router.vue +0 -11
- package/src/components/router/index.ts +0 -3
- package/src/components/source/index.ts +0 -1
- package/src/components/source/src/hooks/useFetch.ts +0 -42
- package/src/components/source/src/hooks/usePage.ts +0 -3
- package/src/components/source/src/hooks/useSource.ts +0 -214
- package/src/components/source/src/index.ts +0 -5
- package/src/components/source/src/types/source.type.ts +0 -58
- package/src/components/source/src/types/table.type.ts +0 -8
- package/src/components/table/index.less +0 -179
- package/src/components/table/index.ts +0 -7
- package/src/components/table/src/components/TableActions.vue +0 -108
- package/src/components/table/src/components/TableHeader.vue +0 -78
- package/src/components/table/src/components/TableRender.vue +0 -76
- package/src/components/table/src/components/editable/CellComponent.ts +0 -57
- package/src/components/table/src/components/editable/EditTableCell.vue +0 -181
- package/src/components/table/src/components/editable/componentMap.ts +0 -18
- package/src/components/table/src/components/editable/index.ts +0 -58
- package/src/components/table/src/components/setting/Column.vue +0 -354
- package/src/components/table/src/components/setting/Download.vue +0 -55
- package/src/components/table/src/components/setting/Fullscreen.vue +0 -43
- package/src/components/table/src/components/setting/Size.vue +0 -42
- package/src/components/table/src/components/setting/index.vue +0 -64
- package/src/components/table/src/const.ts +0 -13
- package/src/components/table/src/hooks/useColumns.ts +0 -326
- package/src/components/table/src/hooks/useCustomRow.ts +0 -0
- package/src/components/table/src/hooks/useDataSource.ts +0 -97
- package/src/components/table/src/hooks/useHeaderCode.ts +0 -89
- package/src/components/table/src/hooks/useLoading.ts +0 -29
- package/src/components/table/src/hooks/usePagination.ts +0 -76
- package/src/components/table/src/hooks/useRowSelection.ts +0 -145
- package/src/components/table/src/hooks/useRows.ts +0 -30
- package/src/components/table/src/hooks/useTable.ts +0 -90
- package/src/components/table/src/hooks/useTableHeader.ts +0 -48
- package/src/components/table/src/hooks/useTableInstance.ts +0 -29
- package/src/components/table/src/hooks/useTableScroll.ts +0 -229
- package/src/components/table/src/index.vue +0 -200
- package/src/components/table/src/props.ts +0 -157
- package/src/components/table/src/types/table.type.ts +0 -160
- package/src/components/table/src/types/tableHeader.type.ts +0 -27
- package/src/components/tree/index.less +0 -41
- package/src/components/tree/index.ts +0 -5
- package/src/components/tree/src/components/TreeHeader.vue +0 -97
- package/src/components/tree/src/hooks/useTree.ts +0 -239
- package/src/components/tree/src/index.vue +0 -392
- package/src/components/tree/src/props.ts +0 -133
- package/src/components/tree/src/type/tree.ts +0 -105
- package/src/components/tree/src/utils/tree.ts +0 -73
- package/src/components/type.ts +0 -0
- package/src/components/upload/index.less +0 -43
- package/src/components/upload/index.ts +0 -7
- package/src/components/upload/src/helper.ts +0 -32
- package/src/components/upload/src/index.vue +0 -38
- package/src/components/upload/src/props.ts +0 -48
- package/src/components/upload/src/upload.vue +0 -166
- package/src/directives/icon.ts +0 -36
- package/src/directives/index.ts +0 -26
- package/src/directives/permission.ts +0 -20
- package/src/global.d.ts +0 -8
- package/src/index.ts +0 -4
- package/src/theme/content/index.vue +0 -37
- package/src/theme/feature/back-top.vue +0 -11
- package/src/theme/feature/index.vue +0 -7
- package/src/theme/footer/index.less +0 -16
- package/src/theme/footer/index.vue +0 -24
- package/src/theme/header/components/bread-crumb.vue +0 -26
- package/src/theme/header/components/fullscreen.vue +0 -12
- package/src/theme/header/components/handler.ts +0 -81
- package/src/theme/header/components/index.ts +0 -21
- package/src/theme/header/components/lang-picker.vue +0 -36
- package/src/theme/header/components/logo.vue +0 -35
- package/src/theme/header/components/menu-search.vue +0 -62
- package/src/theme/header/components/notify.vue +0 -22
- package/src/theme/header/components/setting-theme.vue +0 -123
- package/src/theme/header/components/theme-drawer/enum.ts +0 -12
- package/src/theme/header/components/theme-drawer/feature.vue +0 -75
- package/src/theme/header/components/theme-drawer/index.ts +0 -7
- package/src/theme/header/components/theme-drawer/menu-type.vue +0 -40
- package/src/theme/header/components/theme-drawer/select-item.vue +0 -46
- package/src/theme/header/components/theme-drawer/switch-item.vue +0 -39
- package/src/theme/header/components/theme-drawer/theme-color.vue +0 -26
- package/src/theme/header/components/trigger.vue +0 -14
- package/src/theme/header/components/user-info.vue +0 -60
- package/src/theme/header/const/index.ts +0 -40
- package/src/theme/header/helper/menu-tree.ts +0 -64
- package/src/theme/header/index.less +0 -442
- package/src/theme/header/index.ts +0 -0
- package/src/theme/header/index.vue +0 -96
- package/src/theme/header/multiple-header.vue +0 -67
- package/src/theme/header/set-theme.less +0 -68
- package/src/theme/index.ts +0 -3
- package/src/theme/sider/components/basic-menu/basic-menu-item.vue +0 -14
- package/src/theme/sider/components/basic-menu/basic-menu.vue +0 -122
- package/src/theme/sider/components/basic-menu/basic-sub-menu-item.vue +0 -46
- package/src/theme/sider/components/basic-menu/menu-item-content.vue +0 -13
- package/src/theme/sider/components/drag-bar.vue +0 -26
- package/src/theme/sider/components/layout-menu.vue +0 -132
- package/src/theme/sider/components/props.ts +0 -97
- package/src/theme/sider/components/sider-trigger.vue +0 -24
- package/src/theme/sider/helper/sider.ts +0 -52
- package/src/theme/sider/helper/split-menu.ts +0 -146
- package/src/theme/sider/hooks/useDragLine.ts +0 -86
- package/src/theme/sider/hooks/useOpenKeys.ts +0 -57
- package/src/theme/sider/index.less +0 -203
- package/src/theme/sider/index.vue +0 -88
- package/src/theme/tabs/components/TabContent.vue +0 -36
- package/src/theme/tabs/components/TabRedo.vue +0 -18
- package/src/theme/tabs/hooks/useMultifyTabs.ts +0 -96
- package/src/theme/tabs/hooks/useTabDropdown.ts +0 -89
- package/src/theme/tabs/index.less +0 -165
- package/src/theme/tabs/index.vue +0 -98
- package/src/theme/tabs/types/tabs.type.ts +0 -8
- package/src/theme/theme.less +0 -67
- package/src/theme/theme.vue +0 -90
- package/src/theme/transition.less +0 -99
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { Recordable } from "@dt-frames/core";
|
|
2
|
-
import { TreeDataItem } from "ant-design-vue/lib/tree";
|
|
3
|
-
import { PropType } from "vue";
|
|
4
|
-
import { CheckKeys, ContextMenuItem, FieldNames, TreeActionItem, TreeItem } from "./type/tree"
|
|
5
|
-
|
|
6
|
-
export const BasicProps = {
|
|
7
|
-
loading: {
|
|
8
|
-
type: Boolean,
|
|
9
|
-
default: false,
|
|
10
|
-
},
|
|
11
|
-
// 粘性选择
|
|
12
|
-
checkStrictly: Boolean,
|
|
13
|
-
// 展开的key值
|
|
14
|
-
expandedKeys: {
|
|
15
|
-
type: Array as PropType<KeyType[]>,
|
|
16
|
-
default: () => []
|
|
17
|
-
},
|
|
18
|
-
// 设置选中的key
|
|
19
|
-
selectedKeys: {
|
|
20
|
-
type: Array as PropType<KeyType[]>,
|
|
21
|
-
default: () => []
|
|
22
|
-
},
|
|
23
|
-
// 选中的节点
|
|
24
|
-
checkedKeys: {
|
|
25
|
-
type: Array as PropType<CheckKeys>,
|
|
26
|
-
default: () => []
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
// 定义树节点的lable title children 名称
|
|
30
|
-
fieldNames: {
|
|
31
|
-
type: Object as PropType<FieldNames>,
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
beforeRightClick: {
|
|
35
|
-
type: Function as PropType<(...arg: any) => ContextMenuItem[]>,
|
|
36
|
-
default: undefined,
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
rightMenuList: {
|
|
40
|
-
type: Array as PropType<ContextMenuItem[]>,
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
//
|
|
44
|
-
renderIcon: {
|
|
45
|
-
type: Function as PropType<(params: Recordable) => string>,
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
// 高亮搜索值,仅高亮具体匹配值(通过title)值为true时使用默认色值,值为#xxx时使用此值替代且高亮开启
|
|
49
|
-
highlight: {
|
|
50
|
-
type: [Boolean, String] as PropType<Boolean | String>,
|
|
51
|
-
default: false,
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
actionList: {
|
|
55
|
-
type: Array as PropType<TreeActionItem[]>,
|
|
56
|
-
default: () => [],
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
clickRowToExpand: {
|
|
60
|
-
type: Boolean,
|
|
61
|
-
default: false,
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
searchValue: {
|
|
65
|
-
type: String,
|
|
66
|
-
default: ''
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
filterFn: {
|
|
70
|
-
type: Function as PropType< (searchValue: any, node: TreeItem, fieldNames: FieldNames) => boolean >,
|
|
71
|
-
default: undefined,
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
checkable: Boolean,
|
|
75
|
-
|
|
76
|
-
// 搜索完成时自动展开结果
|
|
77
|
-
expandOnSearch: Boolean,
|
|
78
|
-
|
|
79
|
-
// 搜索完成自动选中所有结果,当且仅当 checkable===true 时生效
|
|
80
|
-
checkOnSearch: Boolean,
|
|
81
|
-
|
|
82
|
-
// 搜索完成自动select所有结果
|
|
83
|
-
selectedOnSearch: Boolean,
|
|
84
|
-
|
|
85
|
-
// 树数据
|
|
86
|
-
treeData: {
|
|
87
|
-
type: Array as PropType<TreeDataItem[]>
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
value: {
|
|
91
|
-
type: [Object, Array] as PropType<KeyType[] | CheckKeys>
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
title: {
|
|
95
|
-
type: String,
|
|
96
|
-
default: '',
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
toolbar: Boolean,
|
|
100
|
-
search: Boolean,
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export const searchProps = {
|
|
105
|
-
title: {
|
|
106
|
-
type: String,
|
|
107
|
-
default: '',
|
|
108
|
-
},
|
|
109
|
-
toolbar: {
|
|
110
|
-
type: Boolean,
|
|
111
|
-
default: false,
|
|
112
|
-
},
|
|
113
|
-
checkable: {
|
|
114
|
-
type: Boolean,
|
|
115
|
-
default: false,
|
|
116
|
-
},
|
|
117
|
-
search: {
|
|
118
|
-
type: Boolean,
|
|
119
|
-
default: false,
|
|
120
|
-
},
|
|
121
|
-
searchText: {
|
|
122
|
-
type: String,
|
|
123
|
-
default: '',
|
|
124
|
-
},
|
|
125
|
-
checkAll: {
|
|
126
|
-
type: Function,
|
|
127
|
-
default: undefined,
|
|
128
|
-
},
|
|
129
|
-
expandAll: {
|
|
130
|
-
type: Function,
|
|
131
|
-
default: undefined,
|
|
132
|
-
},
|
|
133
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { Recordable } from "@dt-frames/core";
|
|
2
|
-
import { Fn } from "@vueuse/core"
|
|
3
|
-
import { TreeDataItem } from "ant-design-vue/lib/tree"
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export enum ToolbarEnum {
|
|
7
|
-
SELECT_ALL,
|
|
8
|
-
UN_SELECT_ALL,
|
|
9
|
-
EXPAND_ALL,
|
|
10
|
-
UN_EXPAND_ALL,
|
|
11
|
-
CHECK_STRICTLY,
|
|
12
|
-
CHECK_UN_STRICTLY,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type KeyType = string | number
|
|
16
|
-
|
|
17
|
-
export type CheckKeys =
|
|
18
|
-
| KeyType[]
|
|
19
|
-
| {
|
|
20
|
-
checked: string[] | number[];
|
|
21
|
-
halfChecked: string[] | number[]
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface TreeState {
|
|
25
|
-
expandedKeys: KeyType[]
|
|
26
|
-
selectedKeys: KeyType[]
|
|
27
|
-
checkedKeys: CheckKeys
|
|
28
|
-
checkStrictly: boolean
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface FieldNames {
|
|
32
|
-
children?: string
|
|
33
|
-
title?: string
|
|
34
|
-
key?: string
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface TreeItem extends TreeDataItem {
|
|
38
|
-
icon?: any
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface CreateContextOptions {
|
|
42
|
-
event: MouseEvent
|
|
43
|
-
icon?: string
|
|
44
|
-
styles?: any
|
|
45
|
-
items?: ContextMenuItem[]
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface InsertNodeParams {
|
|
49
|
-
parentKey: string | null
|
|
50
|
-
node: TreeDataItem
|
|
51
|
-
list?: TreeDataItem[]
|
|
52
|
-
push?: 'push' | 'unshift'
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface ContextMenuItem {
|
|
56
|
-
label: string
|
|
57
|
-
icon?: string
|
|
58
|
-
hidden?: boolean
|
|
59
|
-
disabled?: boolean
|
|
60
|
-
handler?: Fn
|
|
61
|
-
divider?: boolean
|
|
62
|
-
children?: ContextMenuItem[]
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface TreeActionItem {
|
|
66
|
-
render: (record: Recordable) => any
|
|
67
|
-
show?: boolean | ((record: Recordable) => boolean)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export interface InsertNodeParams {
|
|
71
|
-
parentKey: string | null
|
|
72
|
-
node: TreeDataItem
|
|
73
|
-
list?: TreeDataItem[]
|
|
74
|
-
push?: 'push' | 'unshift'
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface TreeHelperConfig {
|
|
78
|
-
id: string;
|
|
79
|
-
children: string;
|
|
80
|
-
pid: string;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export interface TreeActionType {
|
|
84
|
-
checkAll: (checkAll: boolean) => void
|
|
85
|
-
expandAll: (expandAll: boolean) => void
|
|
86
|
-
setExpandedKeys: (keys: KeyType[]) => void
|
|
87
|
-
getExpandedKeys: () => KeyType[]
|
|
88
|
-
setSelectedKeys: (keys: KeyType[]) => void
|
|
89
|
-
getSelectedKeys: () => KeyType[]
|
|
90
|
-
setCheckedKeys: (keys: CheckKeys) => void
|
|
91
|
-
getCheckedKeys: () => CheckKeys
|
|
92
|
-
filterByLevel: (level: number) => void
|
|
93
|
-
insertNodeByKey: (opt: InsertNodeParams) => void
|
|
94
|
-
insertNodesByKey: (opt: InsertNodeParams) => void
|
|
95
|
-
deleteNodeByKey: (key: string) => void
|
|
96
|
-
updateNodeByKey: (key: string, node: Omit<TreeDataItem, 'key'>) => void
|
|
97
|
-
setSearchValue: (value: string) => void
|
|
98
|
-
getSearchValue: () => string
|
|
99
|
-
onStrictlyChange: ( strictly: boolean ) => void
|
|
100
|
-
getSelectedNode: (
|
|
101
|
-
key: KeyType,
|
|
102
|
-
treeList?: TreeItem[],
|
|
103
|
-
selectNode?: TreeItem | null,
|
|
104
|
-
) => TreeItem | null
|
|
105
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { TreeHelperConfig } from "../type/tree"
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 递归遍历树结构
|
|
5
|
-
* @param treeDatas 树数据
|
|
6
|
-
* @param callBack 回调
|
|
7
|
-
* @param parentNode 父节点
|
|
8
|
-
*/
|
|
9
|
-
export function eachTree(treeDatas: any[], callBack: Function, parentNode = {}) {
|
|
10
|
-
treeDatas.forEach( el => {
|
|
11
|
-
const newNode = callBack(el, parentNode) || el
|
|
12
|
-
|
|
13
|
-
if (el.children) {
|
|
14
|
-
eachTree( el.children, callBack, newNode )
|
|
15
|
-
}
|
|
16
|
-
} )
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// 返回true就终止遍历,避免大量节点场景下无意义循环,引起浏览器卡顿
|
|
21
|
-
export function forEach<T = any>(
|
|
22
|
-
tree: T[],
|
|
23
|
-
func: (n: T) => any,
|
|
24
|
-
config: Partial<TreeHelperConfig> = {},
|
|
25
|
-
): void {
|
|
26
|
-
const list: any[] = [...tree]
|
|
27
|
-
const { children = 'children' } = config
|
|
28
|
-
|
|
29
|
-
for (let i = 0; i < list.length; i++) {
|
|
30
|
-
if (func(list[i])) {
|
|
31
|
-
return
|
|
32
|
-
}
|
|
33
|
-
children && list[i][children] && list.splice(i + 1, 0, ...list[i][children])
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function filter<T = any>(
|
|
38
|
-
tree: T[],
|
|
39
|
-
func: (n: T) => boolean,
|
|
40
|
-
config: Partial<TreeHelperConfig> = {},
|
|
41
|
-
): T[] {
|
|
42
|
-
// 获取配置
|
|
43
|
-
const children = config.children as string || 'children';
|
|
44
|
-
|
|
45
|
-
function listFilter(list: T[]) {
|
|
46
|
-
return list
|
|
47
|
-
.map((node: any) => ({ ...node }))
|
|
48
|
-
.filter((node) => {
|
|
49
|
-
|
|
50
|
-
// 递归调用 对含有children项 进行再次调用自身函数 listFilter
|
|
51
|
-
node[children] = node[children] && listFilter(node[children]);
|
|
52
|
-
|
|
53
|
-
// 执行传入的回调 func 进行过滤
|
|
54
|
-
return func(node) || (node[children] && node[children].length);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return listFilter(tree);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function treeToList<T = any>(tree: any, config: Partial<TreeHelperConfig> = {}): T {
|
|
62
|
-
const { children = 'children' } = config
|
|
63
|
-
|
|
64
|
-
const result: any = [...tree]
|
|
65
|
-
|
|
66
|
-
for (let i = 0; i < result.length; i++) {
|
|
67
|
-
if (!result[i][children!]) continue
|
|
68
|
-
result.splice(i + 1, 0, ...result[i][children!])
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return result
|
|
72
|
-
}
|
|
73
|
-
|
package/src/components/type.ts
DELETED
|
File without changes
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
.dt-upload-wrap{
|
|
2
|
-
height: 350px;
|
|
3
|
-
padding: 10px 20px;
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-direction: column;
|
|
6
|
-
|
|
7
|
-
.ant-table-wrapper{
|
|
8
|
-
flex: 1;
|
|
9
|
-
.ant-table-body{
|
|
10
|
-
border-bottom: 1px solid #e7e7e7;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.file-header{
|
|
16
|
-
display: flex;
|
|
17
|
-
flex-direction: row;
|
|
18
|
-
justify-content: space-between;
|
|
19
|
-
&>div{
|
|
20
|
-
display: flex;
|
|
21
|
-
flex-direction: row;
|
|
22
|
-
button{
|
|
23
|
-
margin-right: 10px;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.file-type-tips{
|
|
29
|
-
line-height: 24px;
|
|
30
|
-
padding: 5px 10px;
|
|
31
|
-
font-size: 12px;
|
|
32
|
-
display: flex;
|
|
33
|
-
margin: 10px 0;
|
|
34
|
-
border: 1px dashed @primary-color;
|
|
35
|
-
cursor: inherit;
|
|
36
|
-
span i{
|
|
37
|
-
color: @primary-color;
|
|
38
|
-
margin-right: 7px;
|
|
39
|
-
}
|
|
40
|
-
i{
|
|
41
|
-
color: #666;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { computed, Ref, unref } from "vue"
|
|
2
|
-
|
|
3
|
-
export function useHelpers(
|
|
4
|
-
acceptRef: Ref<string[]>,
|
|
5
|
-
helpTextRef: Ref<string>,
|
|
6
|
-
maxNumberRef: Ref<number>,
|
|
7
|
-
maxSizeRef: Ref<number>
|
|
8
|
-
) {
|
|
9
|
-
// 文件类型
|
|
10
|
-
const getAccept = computed(() => {
|
|
11
|
-
const accept = unref(acceptRef);
|
|
12
|
-
if (accept && accept.length > 0) {
|
|
13
|
-
return accept;
|
|
14
|
-
}
|
|
15
|
-
return [];
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
const getStringAccept = computed(() => {
|
|
19
|
-
return unref(getAccept)
|
|
20
|
-
.map((item) => {
|
|
21
|
-
if (item.indexOf('/') > 0 || item.startsWith('.')) {
|
|
22
|
-
return item
|
|
23
|
-
}
|
|
24
|
-
return `.${item}`
|
|
25
|
-
})
|
|
26
|
-
.join(',')
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
return {
|
|
30
|
-
getStringAccept
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<DtModal
|
|
3
|
-
@save="handleSave()"
|
|
4
|
-
@register="register"
|
|
5
|
-
>
|
|
6
|
-
<div class="dt-upload-wrap">
|
|
7
|
-
<DtUpload ref="uploadRef" :defaultFiles="defaultFiles">
|
|
8
|
-
111
|
|
9
|
-
</DtUpload>
|
|
10
|
-
</div>
|
|
11
|
-
</DtModal>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script lang="ts" setup>
|
|
15
|
-
import { ref } from 'vue'
|
|
16
|
-
import { DtModal, useModal } from '../../modal'
|
|
17
|
-
import DtUpload from './upload.vue'
|
|
18
|
-
|
|
19
|
-
const uploadRef = ref(null)
|
|
20
|
-
const emites = defineEmits(['register'])
|
|
21
|
-
|
|
22
|
-
// 注册弹框
|
|
23
|
-
const [register] = useModal({
|
|
24
|
-
width: '700px',
|
|
25
|
-
title: '文件上传',
|
|
26
|
-
maskClosable: false,
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
const defaultFiles = [
|
|
30
|
-
{ fileName: '叮咚发票667.09.pdf', fileId: '1' }
|
|
31
|
-
]
|
|
32
|
-
|
|
33
|
-
// 保存
|
|
34
|
-
function handleSave() {
|
|
35
|
-
console.log(uploadRef.value.allFilesRef)
|
|
36
|
-
alert("s-s-s-")
|
|
37
|
-
}
|
|
38
|
-
</script>
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Fn } from "@vueuse/core"
|
|
2
|
-
import { PropType } from "vue"
|
|
3
|
-
|
|
4
|
-
export type FileType = {
|
|
5
|
-
fileName: String
|
|
6
|
-
[key: string]: any
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const basicUploadProps = {
|
|
10
|
-
// 是否显示模板下载
|
|
11
|
-
showTemplateDownload: {
|
|
12
|
-
type: Boolean,
|
|
13
|
-
default: false,
|
|
14
|
-
},
|
|
15
|
-
// 模板下载
|
|
16
|
-
templateDownload: {
|
|
17
|
-
type: Function as PropType<Fn>,
|
|
18
|
-
default: () => {}
|
|
19
|
-
},
|
|
20
|
-
helpText: {
|
|
21
|
-
type: String as PropType<string>,
|
|
22
|
-
default: '',
|
|
23
|
-
},
|
|
24
|
-
// 是否支持批量上传
|
|
25
|
-
multiple: {
|
|
26
|
-
type: Boolean as PropType<boolean>,
|
|
27
|
-
default: true,
|
|
28
|
-
},
|
|
29
|
-
// 文件支持的类型
|
|
30
|
-
accept: {
|
|
31
|
-
type: Array as PropType<string[]>,
|
|
32
|
-
default: () => [],
|
|
33
|
-
},
|
|
34
|
-
// 文件最大多少MB
|
|
35
|
-
maxSize: {
|
|
36
|
-
type: Number as PropType<number>,
|
|
37
|
-
default: 2,
|
|
38
|
-
},
|
|
39
|
-
// 最大数量的文件,Infinity不限制
|
|
40
|
-
maxNumber: {
|
|
41
|
-
type: Number as PropType<number>,
|
|
42
|
-
default: Infinity,
|
|
43
|
-
},
|
|
44
|
-
defaultFiles: {
|
|
45
|
-
type: Array as PropType<FileType[]>,
|
|
46
|
-
default: []
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="file-header">
|
|
3
|
-
<div>
|
|
4
|
-
<Upload
|
|
5
|
-
:accept="getStringAccept"
|
|
6
|
-
:multiple="multiple"
|
|
7
|
-
:before-upload="beforeUpload"
|
|
8
|
-
:show-upload-list="false"
|
|
9
|
-
>
|
|
10
|
-
<Button type="primary">
|
|
11
|
-
<span v-icon="'ic:baseline-file-upload'"></span>
|
|
12
|
-
文件上传
|
|
13
|
-
</Button>
|
|
14
|
-
</Upload>
|
|
15
|
-
<Button type="primary" v-if="showTemplateDownload" @click="templateDownload">
|
|
16
|
-
<span v-icon="'ic:baseline-file-download'"></span>
|
|
17
|
-
模板下载
|
|
18
|
-
</Button>
|
|
19
|
-
</div>
|
|
20
|
-
<slot></slot>
|
|
21
|
-
</div>
|
|
22
|
-
|
|
23
|
-
<div class="file-type-tips ant-alert-info">
|
|
24
|
-
<span v-icon="'ant-design:info-circle-outlined'"></span>
|
|
25
|
-
<i>请上传pptx、doc、jpg、jpeg、png、bmp、gif、xls、xlsx、txt、rar、zip、7z、tar、gz格式文件</i>
|
|
26
|
-
</div>
|
|
27
|
-
|
|
28
|
-
<DtTable @register="registerTable"></DtTable>
|
|
29
|
-
|
|
30
|
-
<Image
|
|
31
|
-
:width="200"
|
|
32
|
-
:style="{ display: 'none' }"
|
|
33
|
-
:preview="{
|
|
34
|
-
visible: imgVisable,
|
|
35
|
-
onVisibleChange: setImgVisible,
|
|
36
|
-
}"
|
|
37
|
-
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
|
|
38
|
-
></Image>
|
|
39
|
-
|
|
40
|
-
</template>
|
|
41
|
-
|
|
42
|
-
<script lang="ts" setup>
|
|
43
|
-
import { h, ref, toRefs, watchEffect } from 'vue'
|
|
44
|
-
import { Button, Upload, Image } from 'ant-design-vue'
|
|
45
|
-
import { DtTable, useTable } from '../../table'
|
|
46
|
-
import { basicUploadProps } from './props'
|
|
47
|
-
import { useHelpers } from './helper'
|
|
48
|
-
import { useMessage } from '@dt-frames/core'
|
|
49
|
-
import * as SparkMD5 from 'spark-md5'
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const { message } = useMessage()
|
|
53
|
-
|
|
54
|
-
const filesRef = ref([])
|
|
55
|
-
const historyFilesRef = ref([])
|
|
56
|
-
const allFilesRef = ref([])
|
|
57
|
-
|
|
58
|
-
// 控制图片预览显示隐藏
|
|
59
|
-
const imgVisable = ref( false )
|
|
60
|
-
const setImgVisible = (value) => imgVisable.value = value
|
|
61
|
-
|
|
62
|
-
const props = defineProps( basicUploadProps )
|
|
63
|
-
|
|
64
|
-
const { accept, helpText, maxNumber, maxSize } = toRefs(props)
|
|
65
|
-
const { getStringAccept } = useHelpers( accept, helpText, maxNumber, maxSize )
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const [registerTable, { }] = useTable({
|
|
69
|
-
tableSetting: false,
|
|
70
|
-
pagination: false,
|
|
71
|
-
dataSource: allFilesRef,
|
|
72
|
-
columns: [
|
|
73
|
-
{ title: '文件名称', dataIndex: 'fileName' },
|
|
74
|
-
{ title: '上传状态', dataIndex: 'fileStatue', render(row) {
|
|
75
|
-
return h('span', {
|
|
76
|
-
style: `color: ${ row.status === 0 ? 'orange' : 'green' }`,
|
|
77
|
-
}, row.fileStatue)
|
|
78
|
-
} },
|
|
79
|
-
],
|
|
80
|
-
operations: {
|
|
81
|
-
expand: true,
|
|
82
|
-
btns: [
|
|
83
|
-
{ title: '预览', icon: 'ic:baseline-remove-red-eye',
|
|
84
|
-
ifShow(row) {
|
|
85
|
-
const supportFileTypes = ['pdf', 'jpg', 'jpeg', 'png', 'bmp', 'gif']
|
|
86
|
-
return supportFileTypes.includes( row.fileName.split('.').pop() )
|
|
87
|
-
},
|
|
88
|
-
action: () => {
|
|
89
|
-
setImgVisible(true)
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
{ title: '编辑', icon: 'mdi:text-box-edit-outline' },
|
|
93
|
-
{ title: '删除', icon: 'mdi:delete-outline' }
|
|
94
|
-
]
|
|
95
|
-
}
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
watchEffect(() => {
|
|
100
|
-
historyFilesRef.value = props.defaultFiles.map(file => {
|
|
101
|
-
return {
|
|
102
|
-
...file,
|
|
103
|
-
fileName: file.fileName,
|
|
104
|
-
status: 0,
|
|
105
|
-
fileStatue: '历史上传'
|
|
106
|
-
}
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
allFilesRef.value = [...historyFilesRef.value, ...filesRef.value]
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
function beforeUpload(file: File) {
|
|
114
|
-
const { maxSize } = props
|
|
115
|
-
|
|
116
|
-
if( maxSize && file.size / 1024 / 1024 >= maxSize ) {
|
|
117
|
-
message.error(`只能上传不超过${ maxSize }MB的文件!`)
|
|
118
|
-
return false
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
addFile( file )
|
|
122
|
-
|
|
123
|
-
return false
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// 添加文件
|
|
127
|
-
function addFile(file: File) {
|
|
128
|
-
let blobSlice = File.prototype.slice || (File.prototype as any).mozSlice || (File.prototype as any).webkitSlice
|
|
129
|
-
let chunkSize = 2097152,
|
|
130
|
-
chunks = Math.ceil(file.size / chunkSize),
|
|
131
|
-
currentChunk = 0,
|
|
132
|
-
spark = new SparkMD5.ArrayBuffer(),
|
|
133
|
-
fileReader = new FileReader()
|
|
134
|
-
|
|
135
|
-
fileReader.onload = function (e) {
|
|
136
|
-
spark.append(e.target['result']);
|
|
137
|
-
currentChunk++;
|
|
138
|
-
|
|
139
|
-
if (currentChunk < chunks) {
|
|
140
|
-
loadNext();
|
|
141
|
-
} else {
|
|
142
|
-
filesRef.value.push({
|
|
143
|
-
fileName: file.name,
|
|
144
|
-
fileId: spark.end(),
|
|
145
|
-
file,
|
|
146
|
-
status: 1,
|
|
147
|
-
fileStatue: '待上传'
|
|
148
|
-
})
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
function loadNext() {
|
|
153
|
-
var start = currentChunk * chunkSize,
|
|
154
|
-
end = ((start + chunkSize) >= file.size) ? file.size : start + chunkSize
|
|
155
|
-
|
|
156
|
-
fileReader.readAsArrayBuffer(blobSlice.call(file, start, end))
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
loadNext()
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
defineExpose({
|
|
164
|
-
allFilesRef
|
|
165
|
-
})
|
|
166
|
-
</script>
|
package/src/directives/icon.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 字体图标指令,目前支持awesome、ant-design以及assets/icons/下的svg图标
|
|
3
|
-
* 使用方法: <span v-icon="'fa fa-user'" :color="'red'" :fontSize="12"></span>
|
|
4
|
-
*
|
|
5
|
-
* 动态设置ant-design 图标
|
|
6
|
-
* https://blog.csdn.net/weixin_45803990/article/details/116270387
|
|
7
|
-
*/
|
|
8
|
-
import { DirectiveBinding, h, render, VNode } from "vue";
|
|
9
|
-
import { Nullable } from '@dt-frames/core'
|
|
10
|
-
import { DtIcon } from "../components";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function setIconHTML( el: Element, binding: any, props: any ) {
|
|
14
|
-
const value = binding.value;
|
|
15
|
-
if (!value) return;
|
|
16
|
-
|
|
17
|
-
let vm: Nullable<VNode> = null;
|
|
18
|
-
|
|
19
|
-
vm = h(DtIcon, {
|
|
20
|
-
iconClass: value,
|
|
21
|
-
size: props?.size,
|
|
22
|
-
color: props?.color || null,
|
|
23
|
-
style: {
|
|
24
|
-
display: 'block'
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
if( vm ) {
|
|
29
|
-
render(vm, document.createElement('div'));
|
|
30
|
-
el.appendChild(vm.el as HTMLElement);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export const iconMounted = (el: Element, binding: DirectiveBinding<any>, props: any) => {
|
|
35
|
-
setIconHTML(el, binding, props.props);
|
|
36
|
-
};
|