@dt-frames/ui 1.0.1 → 1.0.4
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/README.md +1 -15
- package/es/assets/style/reset.less +0 -3
- package/es/components/iframe/index.d.ts +2 -2
- package/es/components/index.d.ts +2 -2
- package/es/index.css +1 -1
- package/es/index.js +34 -392
- package/es/style/assets/style/reset.less +0 -3
- package/es/style/components/forms/index.less +84 -0
- package/es/style/components/iframe/index.less +3 -0
- package/es/style/components/modal/index.less +63 -0
- package/es/style/components/table/index.less +162 -0
- package/es/style/theme/sider/index.less +25 -25
- package/es/style/theme/theme.less +2 -1
- package/es/theme/header/components/notify.d.ts +0 -1
- package/es/theme/header/components/user-info.d.ts +1 -1
- package/package.json +47 -40
- package/src/assets/data/icons/actions.ts +427 -0
- package/src/assets/data/icons/code.ts +10 -0
- package/src/assets/data/icons/commuticate.ts +190 -0
- package/src/assets/data/icons/currency.ts +46 -0
- package/src/assets/data/icons/devices.ts +128 -0
- package/src/assets/data/icons/edit.ts +165 -0
- package/src/assets/data/icons/file.ts +104 -0
- package/src/assets/data/icons/math.ts +53 -0
- package/src/assets/data/icons/message.ts +75 -0
- package/src/assets/data/icons/navigate.ts +181 -0
- package/src/assets/data/icons/other.ts +333 -0
- package/src/assets/data/icons.ts +58 -0
- package/src/assets/imgs/logo/logo.png +0 -0
- package/src/assets/locales/en_US.json +3 -0
- package/src/assets/locales/zh_CN.json +3 -0
- package/src/assets/style/index.less +10 -0
- package/src/assets/style/reset.less +17 -0
- package/src/components/container/index.less +85 -0
- package/src/components/container/index.ts +8 -0
- package/src/components/container/src/bar.ts +107 -0
- package/src/components/container/src/lazy-container.vue +9 -0
- package/src/components/container/src/scroll-bar.vue +117 -0
- package/src/components/container/src/scroll-container.vue +61 -0
- package/src/components/curd/index.ts +5 -0
- package/src/components/curd/src/components/dialog.vue +65 -0
- package/src/components/curd/src/components/props.ts +32 -0
- package/src/components/curd/src/hooks/useCurd.tsx +72 -0
- package/src/components/curd/src/types/curd.type.ts +29 -0
- package/src/components/excel/index.ts +6 -0
- package/src/components/excel/src/export2Excel.ts +44 -0
- package/src/components/forms/index.less +84 -0
- package/src/components/forms/index.ts +12 -0
- package/src/components/forms/src/componentMap.ts +44 -0
- package/src/components/forms/src/components/formButton.vue +150 -0
- package/src/components/forms/src/components/formIcon.vue +50 -0
- package/src/components/forms/src/components/formItem.vue +407 -0
- package/src/components/forms/src/components/radioButton.vue +58 -0
- package/src/components/forms/src/const/form.const.ts +7 -0
- package/src/components/forms/src/hooks/helper.ts +70 -0
- package/src/components/forms/src/hooks/useForm.ts +130 -0
- package/src/components/forms/src/hooks/useFormActions.ts +63 -0
- package/src/components/forms/src/hooks/useFormEvents.ts +247 -0
- package/src/components/forms/src/hooks/useFormValue.ts +49 -0
- package/src/components/forms/src/hooks/useFormValues.ts +131 -0
- package/src/components/forms/src/hooks/useLabelWidth.ts +57 -0
- package/src/components/forms/src/index.vue +306 -0
- package/src/components/forms/src/prop.ts +80 -0
- package/src/components/forms/src/types/form.type.ts +269 -0
- package/src/components/icons/index.less +96 -0
- package/src/components/icons/index.ts +7 -0
- package/src/components/icons/src/pick-icon.vue +117 -0
- package/src/components/icons/src/svg-icon.vue +117 -0
- package/src/components/iframe/index.less +3 -0
- package/src/components/iframe/index.ts +5 -0
- package/src/components/iframe/src/index.vue +38 -0
- package/src/components/index.ts +46 -0
- package/src/components/modal/index.less +63 -0
- package/src/components/modal/index.ts +8 -0
- package/src/components/modal/src/components/close-icon.vue +47 -0
- package/src/components/modal/src/components/modal-wrap.vue +118 -0
- package/src/components/modal/src/components/modal.tsx +30 -0
- package/src/components/modal/src/components/modalFooter.vue +38 -0
- package/src/components/modal/src/hooks/useDrag.ts +107 -0
- package/src/components/modal/src/hooks/useFullScreen.ts +27 -0
- package/src/components/modal/src/hooks/useModal.ts +177 -0
- package/src/components/modal/src/index.vue +173 -0
- package/src/components/modal/src/props.ts +43 -0
- package/src/components/modal/src/types/modal.type.ts +27 -0
- package/src/components/router/base-router.vue +11 -0
- package/src/components/router/index.ts +3 -0
- package/src/components/source/index.ts +1 -0
- package/src/components/source/src/hooks/useFetch.ts +70 -0
- package/src/components/source/src/hooks/usePage.ts +3 -0
- package/src/components/source/src/hooks/useSource.ts +178 -0
- package/src/components/source/src/index.ts +5 -0
- package/src/components/source/src/types/source.type.ts +68 -0
- package/src/components/source/src/types/table.type.ts +8 -0
- package/src/components/table/index.less +162 -0
- package/src/components/table/index.ts +7 -0
- package/src/components/table/src/components/TableActions.vue +108 -0
- package/src/components/table/src/components/TableHeader.vue +77 -0
- package/src/components/table/src/components/TableRender.vue +76 -0
- package/src/components/table/src/components/setting/Column.vue +355 -0
- package/src/components/table/src/components/setting/Download.vue +55 -0
- package/src/components/table/src/components/setting/Fullscreen.vue +43 -0
- package/src/components/table/src/components/setting/Size.vue +42 -0
- package/src/components/table/src/components/setting/index.vue +64 -0
- package/src/components/table/src/const.ts +13 -0
- package/src/components/table/src/hooks/useColumns.ts +319 -0
- package/{es/assets/app-antd-dark-theme-style.e3b0c442.css → src/components/table/src/hooks/useCustomRow.ts} +0 -0
- package/src/components/table/src/hooks/useDataSource.ts +99 -0
- package/src/components/table/src/hooks/useLoading.ts +29 -0
- package/src/components/table/src/hooks/usePagination.ts +76 -0
- package/src/components/table/src/hooks/useRowSelection.ts +146 -0
- package/src/components/table/src/hooks/useRows.ts +30 -0
- package/src/components/table/src/hooks/useTable.ts +77 -0
- package/src/components/table/src/hooks/useTableHeader.ts +48 -0
- package/src/components/table/src/hooks/useTableInstance.ts +29 -0
- package/src/components/table/src/hooks/useTableScroll.ts +227 -0
- package/src/components/table/src/index.vue +198 -0
- package/src/components/table/src/props.ts +152 -0
- package/src/components/table/src/types/table.type.ts +133 -0
- package/src/components/table/src/types/tableHeader.type.ts +27 -0
- package/{es/assets/app-theme-style.e3b0c442.css → src/components/type.ts} +0 -0
- package/src/directives/icon.ts +36 -0
- package/src/directives/index.ts +26 -0
- package/src/directives/permission.ts +20 -0
- package/src/global.d.ts +8 -0
- package/src/index.ts +4 -0
- package/src/theme/content/index.vue +37 -0
- package/src/theme/feature/back-top.vue +11 -0
- package/src/theme/feature/index.vue +7 -0
- package/src/theme/footer/index.less +16 -0
- package/src/theme/footer/index.vue +24 -0
- package/src/theme/header/components/bread-crumb.vue +26 -0
- package/src/theme/header/components/fullscreen.vue +12 -0
- package/src/theme/header/components/handler.ts +81 -0
- package/src/theme/header/components/index.ts +21 -0
- package/src/theme/header/components/lang-picker.vue +36 -0
- package/src/theme/header/components/logo.vue +33 -0
- package/src/theme/header/components/menu-search.vue +62 -0
- package/src/theme/header/components/notify.vue +22 -0
- package/src/theme/header/components/setting-theme.vue +123 -0
- package/src/theme/header/components/theme-drawer/enum.ts +12 -0
- package/src/theme/header/components/theme-drawer/feature.vue +75 -0
- package/src/theme/header/components/theme-drawer/index.ts +7 -0
- package/src/theme/header/components/theme-drawer/menu-type.vue +40 -0
- package/src/theme/header/components/theme-drawer/select-item.vue +46 -0
- package/src/theme/header/components/theme-drawer/switch-item.vue +39 -0
- package/src/theme/header/components/theme-drawer/theme-color.vue +26 -0
- package/src/theme/header/components/trigger.vue +14 -0
- package/src/theme/header/components/user-info.vue +43 -0
- package/src/theme/header/const/index.ts +40 -0
- package/src/theme/header/helper/menu-tree.ts +64 -0
- package/src/theme/header/index.less +438 -0
- package/src/theme/header/index.ts +0 -0
- package/src/theme/header/index.vue +96 -0
- package/src/theme/header/multiple-header.vue +67 -0
- package/src/theme/header/set-theme.less +68 -0
- package/src/theme/index.ts +3 -0
- package/src/theme/sider/components/basic-menu/basic-menu-item.vue +14 -0
- package/src/theme/sider/components/basic-menu/basic-menu.vue +122 -0
- package/src/theme/sider/components/basic-menu/basic-sub-menu-item.vue +46 -0
- package/src/theme/sider/components/basic-menu/menu-item-content.vue +13 -0
- package/src/theme/sider/components/drag-bar.vue +26 -0
- package/src/theme/sider/components/layout-menu.vue +132 -0
- package/src/theme/sider/components/props.ts +97 -0
- package/src/theme/sider/components/sider-trigger.vue +24 -0
- package/src/theme/sider/helper/sider.ts +52 -0
- package/src/theme/sider/helper/split-menu.ts +146 -0
- package/src/theme/sider/hooks/useDragLine.ts +86 -0
- package/src/theme/sider/hooks/useOpenKeys.ts +57 -0
- package/src/theme/sider/index.less +203 -0
- package/src/theme/sider/index.vue +88 -0
- package/src/theme/tabs/components/TabContent.vue +36 -0
- package/src/theme/tabs/components/TabRedo.vue +18 -0
- package/src/theme/tabs/hooks/useMultifyTabs.ts +96 -0
- package/src/theme/tabs/hooks/useTabDropdown.ts +89 -0
- package/src/theme/tabs/index.less +165 -0
- package/src/theme/tabs/index.vue +98 -0
- package/src/theme/tabs/types/tabs.type.ts +8 -0
- package/src/theme/theme.less +67 -0
- package/src/theme/theme.vue +90 -0
- package/src/theme/transition.less +99 -0
- package/es/assets/data/icon.d.ts +0 -4
- package/es/assets/data/icon.ts +0 -69
- package/es/assets/data/icon11.ts +0 -69
- package/es/assets/style/var.less +0 -42
- package/es/components/icons/pick-icon.d.ts +0 -529
- package/es/components/icons/svg-icon.d.ts +0 -44
- package/es/components/table/src/hooks/useFormat.d.ts +0 -2
- package/es/components/table/src/hooks/useVirtualScroll.d.ts +0 -5
- package/es/components/table/src/utils/format.d.ts +0 -1
- package/es/style/assets/style/var.less +0 -42
- package/es/theme/content/index.d.ts +0 -29
- package/es/theme/header/components/menu-search.d.ts +0 -528
- package/es/theme/header/components/setting-theme.d.ts +0 -2550
- package/es/theme/header/index.d.ts +0 -4369
- package/es/theme/header/multiple-header.d.ts +0 -2001
- package/es/theme/styles/hooks/changeTheme.d.ts +0 -1
- package/es/theme/styles/hooks/generate.d.ts +0 -13
- package/es/theme/styles/index.d.ts +0 -2
- package/es/theme/tabs/components/TabRedo.d.ts +0 -49
- package/es/theme/tabs/index.d.ts +0 -1399
- package/es/theme/theme/initTheme.d.ts +0 -3
- package/es/theme/theme/util.d.ts +0 -5
- package/es/theme/theme.d.ts +0 -4911
- package/es/themes/generate.ts +0 -74
- package/es/themes/index.ts +0 -10
- package/es/themes/modifyVars.ts +0 -33
- package/es/themes/themePlugiin.ts +0 -74
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { Recordable } from '@dt-frames/core'
|
|
2
|
+
import { PropType } from 'vue'
|
|
3
|
+
import { DEFAULT_SORT_FN } from './const'
|
|
4
|
+
import type { PaginationProps } from 'ant-design-vue/lib/pagination'
|
|
5
|
+
import type { TableRowSelection } from 'ant-design-vue/lib/table/interface'
|
|
6
|
+
import { ActionType, BasicColumn, BtnsType, SizeType } from './types/table.type'
|
|
7
|
+
import { ButtonProps } from '../../forms'
|
|
8
|
+
import { DownloadType } from './types/tableHeader.type'
|
|
9
|
+
|
|
10
|
+
export const TableProps = {
|
|
11
|
+
// 点击行是否选中数据
|
|
12
|
+
clickRowSelect: { type: Boolean, default: false },
|
|
13
|
+
|
|
14
|
+
// 表格设置
|
|
15
|
+
tableSetting: {type: Array, default: ['redo', 'size', 'setting', 'fullscreen']},
|
|
16
|
+
|
|
17
|
+
// 是否显示斑马条纹
|
|
18
|
+
striped: { type: Boolean, default: true },
|
|
19
|
+
|
|
20
|
+
// 是否支持拖拽排序
|
|
21
|
+
canColDrag: { type: Boolean, default: true },
|
|
22
|
+
|
|
23
|
+
// 是否支持拖拽改变列宽
|
|
24
|
+
resizable: { type: Boolean, default: true },
|
|
25
|
+
// 最小拖拽宽度
|
|
26
|
+
minWidth: { type: Number },
|
|
27
|
+
// 最大拖拽宽度
|
|
28
|
+
maxWidth: { type: Number },
|
|
29
|
+
|
|
30
|
+
// 是否需要虚拟滚动
|
|
31
|
+
virtual: { type: Boolean, default: true },
|
|
32
|
+
|
|
33
|
+
// 排序
|
|
34
|
+
sortFn: { type: Function, default: DEFAULT_SORT_FN },
|
|
35
|
+
|
|
36
|
+
// 过滤
|
|
37
|
+
filterFn: {
|
|
38
|
+
type: Function as PropType<(data: Partial<Recordable<string[]>>) => any>,
|
|
39
|
+
default: (data: Partial<Recordable<string[]>>) => {
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
// 数据的key值
|
|
45
|
+
rowKey: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: 'id'
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
// 默认的排序
|
|
51
|
+
defSort: { type: Object as PropType<Recordable>, default: null },
|
|
52
|
+
|
|
53
|
+
// 列
|
|
54
|
+
columns: { type: [Array] as PropType<BasicColumn[]>, default: () => [] },
|
|
55
|
+
|
|
56
|
+
// 超出部分是否已省略号显示
|
|
57
|
+
ellipsis: { type: Boolean, default: true },
|
|
58
|
+
|
|
59
|
+
// 需要渲染的数据
|
|
60
|
+
dataSource: { type: Array as PropType<Recordable[]>, default: null },
|
|
61
|
+
|
|
62
|
+
// 表格是否需要边框
|
|
63
|
+
bordered: { type: Boolean, default: true },
|
|
64
|
+
|
|
65
|
+
// 分页数据
|
|
66
|
+
pagination: {
|
|
67
|
+
type: [Object, Boolean] as PropType<PaginationProps | boolean>,
|
|
68
|
+
default: {}
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
// 是否处于加载中
|
|
72
|
+
loading: { type: Boolean, default: false },
|
|
73
|
+
|
|
74
|
+
// 动态定义行class
|
|
75
|
+
rowClassName: { type: Function as PropType<(record: any, index: number) => string> },
|
|
76
|
+
|
|
77
|
+
// 定义何时出现滚动条
|
|
78
|
+
scroll: {
|
|
79
|
+
type: Object as PropType<{ x?: number | true; y?: number }>,
|
|
80
|
+
default: {},
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
size: {
|
|
84
|
+
type: String as PropType<SizeType>,
|
|
85
|
+
default: 'default',
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
// 分页、排序、筛选变化时触发
|
|
89
|
+
onTableChange: {
|
|
90
|
+
type: Function,
|
|
91
|
+
default: () => {}
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
// 下载
|
|
95
|
+
onDownload: {
|
|
96
|
+
type: Function,
|
|
97
|
+
default: (excelData: DownloadType) => {}
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
// 选中的行数据
|
|
101
|
+
rowSelection: {
|
|
102
|
+
type: Object as PropType<TableRowSelection | null>,
|
|
103
|
+
default: null,
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* 设置行属性
|
|
108
|
+
* 用法:
|
|
109
|
+
* ( record ) => {
|
|
110
|
+
onClick: (event) => {},
|
|
111
|
+
onDblclick: (event) => {},
|
|
112
|
+
onContextmenu: (event) => {},
|
|
113
|
+
onMouseenter: (event) => {}, // 鼠标移入行
|
|
114
|
+
onMouseleave: (event) => {}
|
|
115
|
+
* }
|
|
116
|
+
*/
|
|
117
|
+
customRow: {
|
|
118
|
+
type: Function as PropType<( record, index ) => void>,
|
|
119
|
+
default: () => {}
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
childrenColumnName: {
|
|
123
|
+
type: String,
|
|
124
|
+
default: 'children'
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
showIndexColumn: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
default: false
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
indexColumnProps: {
|
|
133
|
+
type: [Array] as PropType<BasicColumn[]>,
|
|
134
|
+
default: () => [],
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
isTreeTable: {
|
|
138
|
+
type: Boolean,
|
|
139
|
+
default: false
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
// 操作栏
|
|
143
|
+
operations: {
|
|
144
|
+
type: Object as PropType<ActionType | BtnsType[]>,
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
// 工具栏按钮
|
|
148
|
+
toolbar: {
|
|
149
|
+
type: Array as PropType<ButtonProps[]>
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { DictType, Recordable } from '@dt-frames/core'
|
|
2
|
+
import type { ColumnProps } from 'ant-design-vue/lib/table'
|
|
3
|
+
import type { TableRowSelection as ITableRowSelection } from 'ant-design-vue/lib/table/interface'
|
|
4
|
+
import { ExtractPropTypes, VNode, DefineComponent } from 'vue'
|
|
5
|
+
import { TableProps } from '../props'
|
|
6
|
+
import { SetColumnsParams } from './tableHeader.type'
|
|
7
|
+
|
|
8
|
+
export interface TableRowSelection<T = any> extends ITableRowSelection {
|
|
9
|
+
// table选择发生改变
|
|
10
|
+
onChange?: (selectedRowKeys: string[] | number[], selectedRows: T[]) => any
|
|
11
|
+
|
|
12
|
+
// 触发一行选择
|
|
13
|
+
onSelect?: (record: T, selected: boolean, selectedRows: Object[], nativeEvent: Event) => any
|
|
14
|
+
|
|
15
|
+
// 全选
|
|
16
|
+
onSelectAll?: (selected: boolean, selectedRows: T[], changeRows: T[]) => any
|
|
17
|
+
|
|
18
|
+
// 反选
|
|
19
|
+
onSelectInvert?: (selectedRows: string[] | number[]) => any
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type TableSetting = {
|
|
23
|
+
// 表格刷新
|
|
24
|
+
redo?: boolean
|
|
25
|
+
// 表格的尺寸
|
|
26
|
+
size?: boolean
|
|
27
|
+
// 是否显示列控制
|
|
28
|
+
setting?: boolean
|
|
29
|
+
// 全屏按钮
|
|
30
|
+
fullscreen?: boolean
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type ColumnChangeParam = {
|
|
34
|
+
dataIndex: string
|
|
35
|
+
fixed: boolean | 'left' | 'right' | undefined
|
|
36
|
+
visible: boolean
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type BasicTableProps = ExtractPropTypes<typeof TableProps> & {
|
|
40
|
+
onColumnsChange?: (data: ColumnChangeParam[]) => void
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type SizeType = 'default' | 'middle' | 'small'
|
|
44
|
+
|
|
45
|
+
export type SorterResult = {
|
|
46
|
+
column: ColumnProps
|
|
47
|
+
order: 'ascend' | 'descend'
|
|
48
|
+
field: string
|
|
49
|
+
columnKey: string
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type CellFormat =
|
|
53
|
+
| ((text: string, record: Recordable, index: number) => any)
|
|
54
|
+
| { dict: DictType }
|
|
55
|
+
| { number: string }
|
|
56
|
+
| { date: string }
|
|
57
|
+
| { percent: string }
|
|
58
|
+
| { [key: string]: Recordable }
|
|
59
|
+
| VNode
|
|
60
|
+
| JSX.Element
|
|
61
|
+
|
|
62
|
+
export type BtnsType = {
|
|
63
|
+
title?: string
|
|
64
|
+
icon?: string
|
|
65
|
+
auth?: string
|
|
66
|
+
color?: string
|
|
67
|
+
type?: 'primary' | 'ghost' | 'dashed' | 'link' | 'text' | 'default'
|
|
68
|
+
size?: 'large' | 'middle' | 'small'
|
|
69
|
+
loading?: boolean
|
|
70
|
+
disabled?: boolean
|
|
71
|
+
ifShow?: boolean | ((column: BasicColumn) => boolean)
|
|
72
|
+
action?: (data: {
|
|
73
|
+
row: Recordable,
|
|
74
|
+
index: number
|
|
75
|
+
}) => void
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
export type ActionType = {
|
|
80
|
+
title?: string
|
|
81
|
+
// 操作栏宽度
|
|
82
|
+
width?: number | string
|
|
83
|
+
// 图标是否展开
|
|
84
|
+
expand?: boolean
|
|
85
|
+
// 操作栏固定位置
|
|
86
|
+
fixed?: 'left' | 'right' | 'auto'
|
|
87
|
+
// 按钮设置
|
|
88
|
+
btns?: BtnsType[]
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
export interface BasicColumn extends ColumnProps {
|
|
93
|
+
// 子元素
|
|
94
|
+
children?: BasicColumn[]
|
|
95
|
+
|
|
96
|
+
// 默认是否显示
|
|
97
|
+
defaultHidden?: boolean;
|
|
98
|
+
|
|
99
|
+
// 业务控制是否显示
|
|
100
|
+
ifShow?: boolean | ((row: Recordable) => boolean)
|
|
101
|
+
|
|
102
|
+
// 列标识
|
|
103
|
+
flag?: 'INDEX' | 'DEFAULT' | 'CHECKBOX' | 'RADIO' | 'ACTION'
|
|
104
|
+
|
|
105
|
+
// 过滤器转换
|
|
106
|
+
render?: CellFormat
|
|
107
|
+
|
|
108
|
+
edit?: boolean
|
|
109
|
+
editRow?: boolean
|
|
110
|
+
// editable?: boolean
|
|
111
|
+
|
|
112
|
+
// 是否显示序号列
|
|
113
|
+
showIndexColumn?: boolean
|
|
114
|
+
|
|
115
|
+
// 是否展开按钮组 只针对ACTION
|
|
116
|
+
expand?: boolean
|
|
117
|
+
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
// table相关的操作
|
|
122
|
+
export type TableActionType = {
|
|
123
|
+
setProps: (props: Partial<BasicTableProps>) => void
|
|
124
|
+
setLoading: ( loading: boolean ) => void
|
|
125
|
+
getColumns: (opt?: SetColumnsParams) => BasicColumn[]
|
|
126
|
+
setColumns: (columns: BasicColumn[] | string[]) => void
|
|
127
|
+
getSize: () => SizeType
|
|
128
|
+
getRowSelection: () => TableRowSelection<Recordable>
|
|
129
|
+
getCacheColumns: () => BasicColumn[]
|
|
130
|
+
setCacheColumnsByField?: (dataIndex: string | undefined, value: BasicColumn) => void
|
|
131
|
+
getSelectRows: ( ) => void
|
|
132
|
+
getSelectRowKeys: ( ) => void
|
|
133
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Recordable } from "@dt-frames/core"
|
|
2
|
+
import { BasicColumn } from "./table.type"
|
|
3
|
+
|
|
4
|
+
export type ColumnStateType = {
|
|
5
|
+
checkAll: boolean
|
|
6
|
+
isInit?: boolean
|
|
7
|
+
checkedList: string[]
|
|
8
|
+
defaultCheckList: string[]
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type ColumnOptionsType = {
|
|
12
|
+
label: string
|
|
13
|
+
value: string
|
|
14
|
+
fixed?: boolean | 'left' | 'right'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type SetColumnsParams = {
|
|
18
|
+
ignoreIndex?: boolean
|
|
19
|
+
ignoreAction?: boolean
|
|
20
|
+
sort?: boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type DownloadType = {
|
|
24
|
+
type: 'current' | 'select' | 'all',
|
|
25
|
+
columns?: BasicColumn[],
|
|
26
|
+
rows?: Recordable<any>[]
|
|
27
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
import { App } from 'vue'
|
|
3
|
+
import { authMounted } from './permission'
|
|
4
|
+
import { iconMounted } from './icon'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
const dtDirectives = [
|
|
8
|
+
{ name: 'auth', directive: authMounted },
|
|
9
|
+
{ name: 'icon', directive: iconMounted },
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// 初始化所有组件
|
|
14
|
+
export function initDirectives() {
|
|
15
|
+
return {
|
|
16
|
+
install(app: App) {
|
|
17
|
+
dtDirectives.forEach( comp => app.directive(comp.name, {
|
|
18
|
+
mounted: comp.directive
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
export * from './permission'
|
|
26
|
+
export * from './icon'
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 权限控制,不使用传统的通过css隐藏dom元素
|
|
3
|
+
* 使用方法: v-auth="'ADD'"
|
|
4
|
+
*/
|
|
5
|
+
import { CacheKey, DtCache } from '@dt-frames/core';
|
|
6
|
+
import type { DirectiveBinding } from 'vue';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
function hasAuth( el: Element, binding: any ) {
|
|
10
|
+
const value = binding.value;
|
|
11
|
+
if (!value) return;
|
|
12
|
+
|
|
13
|
+
if(!DtCache.getLocal(CacheKey.AUTHS).includes( value )) {
|
|
14
|
+
el.parentNode?.removeChild(el);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const authMounted = (el: Element, binding: DirectiveBinding<any>) => {
|
|
19
|
+
hasAuth(el, binding);
|
|
20
|
+
};
|
package/src/global.d.ts
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="dt-layout-content" :class="['dt-layout-content', getLayoutContentMode]" :loading="getPageLoading && getOpenPageLoading">
|
|
3
|
+
<LayoutContent>
|
|
4
|
+
<router-view #default="{ Component, route}">
|
|
5
|
+
<transition :name="getTransitionName(route)">
|
|
6
|
+
<keep-alive v-if="!route.meta.hideTab && getCanCache" :include="getCaches">
|
|
7
|
+
<component :is="Component" :key="route.path" />
|
|
8
|
+
</keep-alive>
|
|
9
|
+
|
|
10
|
+
<component v-else :is="Component" />
|
|
11
|
+
</transition>
|
|
12
|
+
</router-view>
|
|
13
|
+
</LayoutContent>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup lang="ts">
|
|
18
|
+
import { unref, computed } from 'vue';
|
|
19
|
+
import { LayoutContent } from 'ant-design-vue';
|
|
20
|
+
import { useTheme, useApp, RouteReuseStore, useMultipleTab } from '@dt-frames/core';
|
|
21
|
+
import { RouteRecordRaw } from 'vue-router';
|
|
22
|
+
|
|
23
|
+
const { getTransitionMode, getOpenPageLoading } = useApp()
|
|
24
|
+
const { getLayoutContentMode, getPageLoading } = useTheme()
|
|
25
|
+
const { getCanCache } = useMultipleTab()
|
|
26
|
+
|
|
27
|
+
const tabStore = RouteReuseStore()
|
|
28
|
+
|
|
29
|
+
// 返回动画name
|
|
30
|
+
function getTransitionName( route: RouteRecordRaw ): string | undefined {
|
|
31
|
+
return (route.meta.transitionName || unref(getTransitionMode)) as string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const getCaches = computed((): string[] => {
|
|
35
|
+
return tabStore.getCachedTabList
|
|
36
|
+
})
|
|
37
|
+
</script>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<BackTop v-if="getShowBackToTop" :target="getTarget" :visibilityHeight="300" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script lang="ts" setup>
|
|
6
|
+
import { BackTop } from 'ant-design-vue'
|
|
7
|
+
import { useTheme } from '@dt-frames/core'
|
|
8
|
+
|
|
9
|
+
const getTarget = () => document.getElementById('dt-layout-content')
|
|
10
|
+
const { getShowBackToTop } = useTheme()
|
|
11
|
+
</script>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.dt-theme-footer{
|
|
2
|
+
text-align: center;
|
|
3
|
+
padding: 0;
|
|
4
|
+
width: 100%;
|
|
5
|
+
display: block;
|
|
6
|
+
position: absolute;
|
|
7
|
+
right: 0;
|
|
8
|
+
bottom: 0;
|
|
9
|
+
z-index: 1;
|
|
10
|
+
background: #ebeff5;
|
|
11
|
+
color: #b5b5b5;
|
|
12
|
+
border-top: 1px solid #e7e7e7;
|
|
13
|
+
span:first-of-type{
|
|
14
|
+
padding-right: 10px;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<LayoutFooter class="dt-theme-footer" :style="footerOptions">
|
|
3
|
+
<span>{{ title }}</span>
|
|
4
|
+
<span>{{ subTitle }}</span>
|
|
5
|
+
</LayoutFooter>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
import { useTheme } from '@dt-frames/core';
|
|
10
|
+
import { LayoutFooter } from 'ant-design-vue';
|
|
11
|
+
import { computed, unref } from 'vue';
|
|
12
|
+
|
|
13
|
+
const { getFooter } = useTheme()
|
|
14
|
+
const { title, subTitle, height } = unref(getFooter) as any;
|
|
15
|
+
|
|
16
|
+
const footerOptions = computed( () => {
|
|
17
|
+
return {
|
|
18
|
+
lineHeight: `${ height }px`,
|
|
19
|
+
height: `${ height }px`,
|
|
20
|
+
padding: '0',
|
|
21
|
+
width: `100%`
|
|
22
|
+
}
|
|
23
|
+
} );
|
|
24
|
+
</script>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="dt-breadcrumb">
|
|
3
|
+
<Breadcrumb :routes="routes">
|
|
4
|
+
<template #itemRender="{ route }">
|
|
5
|
+
<span>{{ route.label || route.meta?.title }}</span>
|
|
6
|
+
</template>
|
|
7
|
+
</Breadcrumb>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script lang="ts" setup>
|
|
12
|
+
import { ref, watchEffect } from 'vue'
|
|
13
|
+
import { Breadcrumb } from 'ant-design-vue'
|
|
14
|
+
import { getBreadCrumb } from '../helper/menu-tree'
|
|
15
|
+
import { useRouter } from 'vue-router';
|
|
16
|
+
|
|
17
|
+
let routes = ref([]);
|
|
18
|
+
const { currentRoute } = useRouter();
|
|
19
|
+
|
|
20
|
+
watchEffect( () => {
|
|
21
|
+
if (currentRoute.value.path === '/') return
|
|
22
|
+
|
|
23
|
+
routes.value = getBreadCrumb( currentRoute.value.path );
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
</script>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span class="icon" @click="toggle">
|
|
3
|
+
<span v-if="!isFullscreen" v-icon="'ic:baseline-fullscreen'"></span>
|
|
4
|
+
<span v-else v-icon="'ic:baseline-fullscreen-exit'"></span>
|
|
5
|
+
</span>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script lang="ts" setup>
|
|
9
|
+
import { useFullscreen } from '@vueuse/core';
|
|
10
|
+
const { toggle, isFullscreen } = useFullscreen();
|
|
11
|
+
|
|
12
|
+
</script>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { useThemeStore, ThemeOptions } from "@dt-frames/core";
|
|
2
|
+
import { HandlerEnum } from "../const";
|
|
3
|
+
|
|
4
|
+
export function baseHandler(event: HandlerEnum, value: any) {
|
|
5
|
+
const themeStore = useThemeStore()
|
|
6
|
+
const config = handler(event, value)
|
|
7
|
+
themeStore.initThemeStore(config)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function handler(event: HandlerEnum, value: any): ThemeOptions {
|
|
11
|
+
switch(event) {
|
|
12
|
+
case HandlerEnum.CHANGE_LAYOUT:
|
|
13
|
+
const { mode, type, split, headTheme, menuTheme } = value
|
|
14
|
+
return {
|
|
15
|
+
headOptions: {
|
|
16
|
+
theme: headTheme
|
|
17
|
+
},
|
|
18
|
+
menuOptions: {
|
|
19
|
+
mode,
|
|
20
|
+
type,
|
|
21
|
+
split,
|
|
22
|
+
theme: menuTheme,
|
|
23
|
+
show: true
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
case HandlerEnum.SHOW_BREADCRUMB:
|
|
28
|
+
return {
|
|
29
|
+
headOptions: {
|
|
30
|
+
showBreadCrumb: value
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
case HandlerEnum.SHOW_SEARCH:
|
|
35
|
+
return {
|
|
36
|
+
headOptions: {
|
|
37
|
+
showSearch: value
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
case HandlerEnum.SHOW_NOTICY:
|
|
42
|
+
return {
|
|
43
|
+
headOptions: {
|
|
44
|
+
notice: value
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
case HandlerEnum.SHOW_FULL_SCREEN:
|
|
49
|
+
return {
|
|
50
|
+
headOptions: {
|
|
51
|
+
showFullScreen: value
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
case HandlerEnum.SHOW_LOCAL:
|
|
56
|
+
return {
|
|
57
|
+
headOptions: {
|
|
58
|
+
showLocaleSwitch :value
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
case HandlerEnum.SHOW_ROUTE_REUSE:
|
|
63
|
+
return {
|
|
64
|
+
routeReuse: {
|
|
65
|
+
show: value
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
case HandlerEnum.SHOW_FOOTER:
|
|
70
|
+
return {
|
|
71
|
+
footerOptions: {
|
|
72
|
+
show: value
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
case HandlerEnum.CONTENT_MODE:
|
|
77
|
+
return {
|
|
78
|
+
contentMode: value
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import DtLogo from './logo.vue'
|
|
2
|
+
import DtTrigger from './trigger.vue'
|
|
3
|
+
import DtBreadCrumb from './bread-crumb.vue'
|
|
4
|
+
import Notify from './notify.vue'
|
|
5
|
+
import FullScreen from './fullscreen.vue'
|
|
6
|
+
import UserInfo from './user-info.vue'
|
|
7
|
+
import LangPicker from './lang-picker.vue'
|
|
8
|
+
import SettingTheme from './setting-theme.vue'
|
|
9
|
+
import MenuSearch from './menu-search.vue'
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
DtLogo,
|
|
13
|
+
DtTrigger,
|
|
14
|
+
DtBreadCrumb,
|
|
15
|
+
Notify,
|
|
16
|
+
FullScreen,
|
|
17
|
+
UserInfo,
|
|
18
|
+
LangPicker,
|
|
19
|
+
SettingTheme,
|
|
20
|
+
MenuSearch
|
|
21
|
+
}
|