@dt-frames/ui 1.0.0 → 1.0.1
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/package.json +1 -10
- 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/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 -20
- 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 -65
- package/src/components/curd/src/components/props.ts +0 -32
- package/src/components/curd/src/hooks/useCurd.tsx +0 -72
- package/src/components/curd/src/types/curd.type.ts +0 -29
- package/src/components/excel/index.ts +0 -6
- package/src/components/excel/src/export2Excel.ts +0 -44
- package/src/components/forms/index.ts +0 -12
- 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 -50
- package/src/components/forms/src/components/formItem.vue +0 -407
- 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 -247
- 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.less +0 -82
- package/src/components/forms/src/index.vue +0 -306
- 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.ts +0 -7
- package/src/components/icons/src/index.less +0 -96
- package/src/components/icons/src/pick-icon.vue +0 -117
- package/src/components/icons/src/svg-icon.vue +0 -117
- 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 -46
- package/src/components/modal/index.ts +0 -8
- package/src/components/modal/src/components/close-icon.vue +0 -47
- package/src/components/modal/src/components/modal-wrap.vue +0 -118
- 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 -27
- package/src/components/modal/src/hooks/useModal.ts +0 -177
- package/src/components/modal/src/index.less +0 -60
- 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 -70
- package/src/components/source/src/hooks/usePage.ts +0 -3
- package/src/components/source/src/hooks/useSource.ts +0 -178
- package/src/components/source/src/index.ts +0 -5
- package/src/components/source/src/types/source.type.ts +0 -68
- package/src/components/source/src/types/table.type.ts +0 -8
- 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 -77
- package/src/components/table/src/components/TableRender.vue +0 -76
- package/src/components/table/src/components/setting/Column.vue +0 -355
- 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 -319
- package/src/components/table/src/hooks/useCustomRow.ts +0 -0
- package/src/components/table/src/hooks/useDataSource.ts +0 -99
- 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 -146
- package/src/components/table/src/hooks/useRows.ts +0 -30
- package/src/components/table/src/hooks/useTable.ts +0 -77
- 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 -227
- package/src/components/table/src/index.less +0 -162
- package/src/components/table/src/index.vue +0 -198
- package/src/components/table/src/props.ts +0 -152
- package/src/components/table/src/types/table.type.ts +0 -133
- package/src/components/table/src/types/tableHeader.type.ts +0 -27
- package/src/components/type.ts +0 -0
- package/src/directives/icon.ts +0 -36
- package/src/directives/index.ts +0 -26
- package/src/directives/permission.ts +0 -21
- 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 -14
- 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 -33
- package/src/theme/header/components/menu-search.vue +0 -62
- package/src/theme/header/components/notify.vue +0 -23
- 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 -43
- package/src/theme/header/const/index.ts +0 -40
- package/src/theme/header/helper/menu-tree.ts +0 -67
- package/src/theme/header/index.less +0 -438
- 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 -147
- 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 -37
- 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 -66
- package/src/theme/theme.vue +0 -89
- package/src/theme/transition.less +0 -99
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
.table-striped td {
|
|
2
|
-
background-color: #fafafa;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.dt-table-header{
|
|
6
|
-
.dt-table-header-actions{
|
|
7
|
-
display: flex;
|
|
8
|
-
flex-direction: row;
|
|
9
|
-
justify-content: space-between;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.dt-table-header-actions__right{
|
|
13
|
-
display: flex;
|
|
14
|
-
.dt-icon{
|
|
15
|
-
margin: 0 5px;
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.column-setting{
|
|
22
|
-
&__check-item{
|
|
23
|
-
display: flex;
|
|
24
|
-
align-items: center;
|
|
25
|
-
min-width: 100%;
|
|
26
|
-
padding: 4px 16px 8px 0;
|
|
27
|
-
}
|
|
28
|
-
&__popover-title {
|
|
29
|
-
display: flex;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.column-setting__cloumn-list {
|
|
34
|
-
.ant-popover-inner-content{
|
|
35
|
-
padding: 12px 0 0 0;
|
|
36
|
-
}
|
|
37
|
-
.ant-checkbox-group {
|
|
38
|
-
width: 100%;
|
|
39
|
-
min-width: 260px;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.drag-icon{
|
|
43
|
-
margin: 0 5px;
|
|
44
|
-
cursor: move;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.ant-checkbox-wrapper{
|
|
48
|
-
flex: 1;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.dt-icon{
|
|
52
|
-
cursor: pointer;
|
|
53
|
-
display: flex;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.disabled{
|
|
57
|
-
.dt-icon{
|
|
58
|
-
cursor: not-allowed;
|
|
59
|
-
opacity: 0.5;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.active{
|
|
64
|
-
.dt-icon{
|
|
65
|
-
color: @primary-color !important;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.ant-popover-inner-content {
|
|
70
|
-
max-height: 400px;
|
|
71
|
-
overflow-y: auto;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.dt-table-action-btn{
|
|
76
|
-
width: 24px;
|
|
77
|
-
display: inline-block;
|
|
78
|
-
vertical-align: middle;
|
|
79
|
-
cursor: pointer;
|
|
80
|
-
svg{
|
|
81
|
-
display: flex;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.ant-table-fixed-left table, .ant-table-fixed-right table{
|
|
86
|
-
width: min-content;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.ant-table-cell {
|
|
90
|
-
height: 44px !important;
|
|
91
|
-
line-height: 24px !important;
|
|
92
|
-
font-size: 14px !important;
|
|
93
|
-
padding: 4px 8px !important;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.ant-table-small{
|
|
97
|
-
.ant-table-cell {
|
|
98
|
-
height: 32px !important;
|
|
99
|
-
line-height: 16px !important;
|
|
100
|
-
font-size: 12px !important;
|
|
101
|
-
padding: 2px 8px !important;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.ant-table-middle{
|
|
106
|
-
.ant-table-cell {
|
|
107
|
-
height: 38px !important;
|
|
108
|
-
line-height: 20px !important;
|
|
109
|
-
font-size: 13px !important;
|
|
110
|
-
padding: 4px 8px !important;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.dt-action-select{
|
|
115
|
-
.ant-dropdown-menu-title-content{
|
|
116
|
-
display: flex;
|
|
117
|
-
align-items: center;
|
|
118
|
-
svg{
|
|
119
|
-
display: block;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.dt-icon{
|
|
123
|
-
padding: 0 8px;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
.dt-table{
|
|
130
|
-
.ant-table-pagination{
|
|
131
|
-
margin: 0 !important;
|
|
132
|
-
padding: 10px 0;
|
|
133
|
-
border: 1px solid #f0f0f0;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.ant-table-title{
|
|
137
|
-
padding: 8px 0 !important;
|
|
138
|
-
border: none !important;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.ant-table-resize-handle{
|
|
142
|
-
right: -7px;
|
|
143
|
-
.ant-table-resize-handle-line{
|
|
144
|
-
width: 2px;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.ant-table-body {
|
|
149
|
-
position: relative;
|
|
150
|
-
table{
|
|
151
|
-
position: absolute;
|
|
152
|
-
top: 0;
|
|
153
|
-
left: 0;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.form-btns{
|
|
158
|
-
button:first-of-type {
|
|
159
|
-
margin-left: 0;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
<template>
|
|
4
|
-
<Table
|
|
5
|
-
ref="tableElRef"
|
|
6
|
-
class="dt-table"
|
|
7
|
-
v-bind="getBind"
|
|
8
|
-
:rowClassName="getRowClassName"
|
|
9
|
-
@change="handleTableChange"
|
|
10
|
-
@resizeColumn="handleResizeColumn"
|
|
11
|
-
>
|
|
12
|
-
<template #[item]="data" v-for="item in Object.keys($slots)" :key="item">
|
|
13
|
-
<slot :name="item" v-bind="data || {}"></slot>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<template #bodyCell="{ column, record, index }">
|
|
17
|
-
<template v-if="column.render">
|
|
18
|
-
<TableRender :column="column" :record="record" :index="index"></TableRender>
|
|
19
|
-
</template>
|
|
20
|
-
</template>
|
|
21
|
-
</Table>
|
|
22
|
-
</template>
|
|
23
|
-
|
|
24
|
-
<script lang="ts">
|
|
25
|
-
import { defineComponent, ref, unref, computed, ExtractPropTypes, toRaw } from "vue"
|
|
26
|
-
import { Table } from 'ant-design-vue'
|
|
27
|
-
import { TableProps } from './props'
|
|
28
|
-
import { BasicTableProps, SizeType, TableActionType } from "./types/table.type"
|
|
29
|
-
import { useRows } from './hooks/useRows'
|
|
30
|
-
import { Recordable } from "@dt-frames/core"
|
|
31
|
-
import { useLoading } from "./hooks/useLoading"
|
|
32
|
-
import { usePagination } from "./hooks/usePagination"
|
|
33
|
-
import { useDataSource } from "./hooks/useDataSource"
|
|
34
|
-
import { useRowSelection } from "./hooks/useRowSelection"
|
|
35
|
-
import TableHeader from './components/TableHeader.vue'
|
|
36
|
-
import TableRender from './components/TableRender.vue'
|
|
37
|
-
import { createTableInstance } from "./hooks/useTableInstance"
|
|
38
|
-
import { useColumns } from "./hooks/useColumns"
|
|
39
|
-
import { useTableHeader } from "./hooks/useTableHeader"
|
|
40
|
-
import { useTableScroll } from "./hooks/useTableScroll"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
export default defineComponent({
|
|
44
|
-
name: 'dt-table',
|
|
45
|
-
props: TableProps,
|
|
46
|
-
components: {
|
|
47
|
-
Table,
|
|
48
|
-
TableHeader,
|
|
49
|
-
TableRender
|
|
50
|
-
},
|
|
51
|
-
emits: [
|
|
52
|
-
'register',
|
|
53
|
-
'columns-change',
|
|
54
|
-
'selection-change'
|
|
55
|
-
],
|
|
56
|
-
setup(props, { emit, attrs, slots }) {
|
|
57
|
-
// table实例
|
|
58
|
-
const tableElRef = ref(null)
|
|
59
|
-
const tableData = ref<Recordable[]>([])
|
|
60
|
-
|
|
61
|
-
// 修改后的props属性
|
|
62
|
-
const innerPropsRef = ref<BasicTableProps>()
|
|
63
|
-
|
|
64
|
-
const getProps = computed(() => {
|
|
65
|
-
return { ...props, ...unref(innerPropsRef) } as BasicTableProps
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* 重构loading状态
|
|
71
|
-
*/
|
|
72
|
-
const { getLoading, setLoading } = useLoading( getProps )
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* 重构分页数据
|
|
77
|
-
*/
|
|
78
|
-
const { getPaginationInfo, setPagination, getPagination, getShowPagination, setShowPagination } = usePagination( getProps )
|
|
79
|
-
|
|
80
|
-
// 关于列的控制
|
|
81
|
-
const {
|
|
82
|
-
getViewColumns,
|
|
83
|
-
getColumnsRef,
|
|
84
|
-
getColumns,
|
|
85
|
-
setColumns,
|
|
86
|
-
setCacheColumnsByField,
|
|
87
|
-
getCacheColumns
|
|
88
|
-
} = useColumns(getProps, getPaginationInfo)
|
|
89
|
-
|
|
90
|
-
const {
|
|
91
|
-
getRowSelectionRef,
|
|
92
|
-
clearSelectedRowKeys,
|
|
93
|
-
getRowSelection,
|
|
94
|
-
getSelectRows,
|
|
95
|
-
getSelectRowKeys,
|
|
96
|
-
|
|
97
|
-
} = useRowSelection(getProps, emit)
|
|
98
|
-
|
|
99
|
-
// 关于滚动条的设置
|
|
100
|
-
const { getScrollRef, filterSource } = useTableScroll(
|
|
101
|
-
getProps,
|
|
102
|
-
tableElRef,
|
|
103
|
-
getColumnsRef,
|
|
104
|
-
getRowSelectionRef,
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
function setProps(props: Partial<BasicTableProps>) {
|
|
108
|
-
innerPropsRef.value = { ...unref(innerPropsRef), ...props };
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const tableAction: TableActionType = {
|
|
112
|
-
setProps,
|
|
113
|
-
setLoading,
|
|
114
|
-
getColumns,
|
|
115
|
-
setColumns,
|
|
116
|
-
getRowSelection,
|
|
117
|
-
setCacheColumnsByField,
|
|
118
|
-
getCacheColumns,
|
|
119
|
-
getSelectRows,
|
|
120
|
-
getSelectRowKeys,
|
|
121
|
-
getSize: () => {
|
|
122
|
-
return unref(getBind).size as SizeType;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const {
|
|
127
|
-
getRowClassName
|
|
128
|
-
} = useRows( getProps )
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const getBind = computed(() => {
|
|
132
|
-
return {
|
|
133
|
-
...attrs,
|
|
134
|
-
...unref(getProps),
|
|
135
|
-
...unref(getHeaderProps),
|
|
136
|
-
scroll: unref(getScrollRef),
|
|
137
|
-
loading: unref( getLoading ),
|
|
138
|
-
dataSource: toRaw(unref(filterSource)),
|
|
139
|
-
pagination: toRaw(unref(getPaginationInfo)),
|
|
140
|
-
rowSelection: unref(getRowSelectionRef),
|
|
141
|
-
rowKey: unref(getProps).rowKey,
|
|
142
|
-
columns: toRaw(unref(getViewColumns)),
|
|
143
|
-
tableLayout: 'fixed'
|
|
144
|
-
}
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
// 创建实例
|
|
148
|
-
createTableInstance({ ...tableAction, tableElRef, getBind })
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* 处理表格头部内容
|
|
152
|
-
*/
|
|
153
|
-
const handlers = {
|
|
154
|
-
onColumnsChange: (data: {
|
|
155
|
-
dataIndex: string
|
|
156
|
-
fixed: boolean | 'left' | 'right' | undefined
|
|
157
|
-
visible: boolean
|
|
158
|
-
}[]) => {
|
|
159
|
-
emit('columns-change', data)
|
|
160
|
-
|
|
161
|
-
unref(getProps).onColumnsChange?.(data)
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
const { getHeaderProps } = useTableHeader(getProps, slots, handlers)
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* 表格改变
|
|
169
|
-
*/
|
|
170
|
-
const {
|
|
171
|
-
handleTableChange
|
|
172
|
-
} = useDataSource(
|
|
173
|
-
getProps,
|
|
174
|
-
{
|
|
175
|
-
getPaginationInfo,
|
|
176
|
-
setPagination,
|
|
177
|
-
clearSelectedRowKeys
|
|
178
|
-
},
|
|
179
|
-
emit
|
|
180
|
-
)
|
|
181
|
-
|
|
182
|
-
emit('register', tableAction)
|
|
183
|
-
|
|
184
|
-
return {
|
|
185
|
-
tableElRef,
|
|
186
|
-
getBind,
|
|
187
|
-
getRowClassName,
|
|
188
|
-
handleTableChange,
|
|
189
|
-
getSelectRows,
|
|
190
|
-
handleResizeColumn: (w, col) => {
|
|
191
|
-
col.width = w;
|
|
192
|
-
setCacheColumnsByField(col.dataIndex, col)
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
})
|
|
197
|
-
</script>
|
|
198
|
-
|
|
@@ -1,152 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,133 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
}
|
package/src/components/type.ts
DELETED
|
File without changes
|
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
|
-
};
|