@ditari/bsui 1.1.48 → 1.1.50
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/CHANGELOG.md +8 -2
- package/dist/cjs/layout/Show.vue2.cjs.map +1 -1
- package/dist/cjs/menu/Menu.cjs +7 -1
- package/dist/cjs/menu/Menu.cjs.map +1 -1
- package/dist/css/index.css +1 -1
- package/dist/css/layout/style/index.css +1 -1
- package/dist/css/layout/style/main.css +1 -1
- package/dist/esm/layout/Show.vue2.mjs.map +1 -1
- package/dist/esm/menu/Menu.mjs +7 -1
- package/dist/esm/menu/Menu.mjs.map +1 -1
- package/dist/style/layout/style/main.scss +0 -1
- package/package.json +5 -1
- package/example/index.html +0 -13
- package/example/node_modules/.vite/deps/@ant-design_icons-vue.js +0 -29406
- package/example/node_modules/.vite/deps/@ant-design_icons-vue.js.map +0 -7
- package/example/node_modules/.vite/deps/@vueuse_core.js +0 -8255
- package/example/node_modules/.vite/deps/@vueuse_core.js.map +0 -7
- package/example/node_modules/.vite/deps/_metadata.json +0 -80
- package/example/node_modules/.vite/deps/ant-design-vue.js +0 -62756
- package/example/node_modules/.vite/deps/ant-design-vue.js.map +0 -7
- package/example/node_modules/.vite/deps/axios.js +0 -2126
- package/example/node_modules/.vite/deps/axios.js.map +0 -7
- package/example/node_modules/.vite/deps/chunk-5WWUZCGV.js +0 -36
- package/example/node_modules/.vite/deps/chunk-5WWUZCGV.js.map +0 -7
- package/example/node_modules/.vite/deps/chunk-D36HXFYL.js +0 -25
- package/example/node_modules/.vite/deps/chunk-D36HXFYL.js.map +0 -7
- package/example/node_modules/.vite/deps/chunk-EBDM3ESC.js +0 -161
- package/example/node_modules/.vite/deps/chunk-EBDM3ESC.js.map +0 -7
- package/example/node_modules/.vite/deps/chunk-EKNPBJBG.js +0 -3600
- package/example/node_modules/.vite/deps/chunk-EKNPBJBG.js.map +0 -7
- package/example/node_modules/.vite/deps/chunk-GK7Q6YQN.js +0 -10796
- package/example/node_modules/.vite/deps/chunk-GK7Q6YQN.js.map +0 -7
- package/example/node_modules/.vite/deps/chunk-TDI2FIXO.js +0 -19
- package/example/node_modules/.vite/deps/chunk-TDI2FIXO.js.map +0 -7
- package/example/node_modules/.vite/deps/package.json +0 -3
- package/example/node_modules/.vite/deps/pinia-plugin-persistedstate.js +0 -125
- package/example/node_modules/.vite/deps/pinia-plugin-persistedstate.js.map +0 -7
- package/example/node_modules/.vite/deps/pinia.js +0 -1519
- package/example/node_modules/.vite/deps/pinia.js.map +0 -7
- package/example/node_modules/.vite/deps/vue-request.js +0 -1191
- package/example/node_modules/.vite/deps/vue-request.js.map +0 -7
- package/example/node_modules/.vite/deps/vue-router.js +0 -2667
- package/example/node_modules/.vite/deps/vue-router.js.map +0 -7
- package/example/node_modules/.vite/deps/vue.js +0 -314
- package/example/node_modules/.vite/deps/vue.js.map +0 -7
- package/example/package.json +0 -17
- package/example/src/App.vue +0 -7
- package/example/src/api/list.ts +0 -22
- package/example/src/api/user.ts +0 -13
- package/example/src/components/AppMain.vue +0 -113
- package/example/src/hooks.ts +0 -103
- package/example/src/main.ts +0 -22
- package/example/src/router/form/index.route.ts +0 -23
- package/example/src/router/index.ts +0 -61
- package/example/src/router/table/index.route.ts +0 -39
- package/example/src/views/Demo.vue +0 -49
- package/example/src/views/DemoBk.vue +0 -34
- package/example/src/views/Login.vue +0 -79
- package/example/src/views/form/List.vue +0 -16
- package/example/src/views/form/List2.vue +0 -74
- package/example/src/views/form/QueryFormDemo.vue +0 -49
- package/example/src/views/form/dyn/List.vue +0 -121
- package/example/src/views/table/Add.vue +0 -379
- package/example/src/views/table/Demo.vue +0 -15
- package/example/src/views/table/Demo2.vue +0 -12
- package/example/src/views/table/Edit.vue +0 -10
- package/example/src/views/table/List.vue +0 -415
- package/example/src/views/table/Test.tsx +0 -42
- package/example/src/views/table/TestModal.vue +0 -64
- package/example/src/views/table/WorkStatusRound.vue +0 -31
- package/example/src/views/table/components/AddForm.vue +0 -44
- package/example/src/views/table/hooks.ts +0 -106
- package/example/src/views/task/Todo.vue +0 -6
- package/example/tsconfig.json +0 -16
- package/example/utils/http.ts +0 -107
- package/example/vite-env.d.ts +0 -8
- package/example/vite.config.ts +0 -10
- package/src/_utils/html.ts +0 -17
- package/src/_utils/install.ts +0 -12
- package/src/components.ts +0 -10
- package/src/config/Config.vue +0 -8
- package/src/date/RangePicker.tsx +0 -93
- package/src/date/index.ts +0 -9
- package/src/desensitize/Desensitize.tsx +0 -97
- package/src/desensitize/index.ts +0 -9
- package/src/desensitize/style/index.scss +0 -8
- package/src/dic/DicReplace.tsx +0 -63
- package/src/dic/index.ts +0 -8
- package/src/dic/replace.worker.ts +0 -25
- package/src/form/DQueryForm.tsx +0 -258
- package/src/form/index.ts +0 -9
- package/src/form/style/index.less +0 -0
- package/src/grid/Grid.tsx +0 -83
- package/src/grid/GridItem.tsx +0 -15
- package/src/grid/index.md +0 -4
- package/src/grid/index.ts +0 -16
- package/src/grid/style/index.scss +0 -70
- package/src/index.scss +0 -19
- package/src/index.ts +0 -49
- package/src/json-scheme-render/JsonSchemeRender.tsx +0 -101
- package/src/json-scheme-render/index.ts +0 -9
- package/src/layout/Breadcrumb.vue +0 -39
- package/src/layout/FuckMain.vue +0 -90
- package/src/layout/List.vue +0 -145
- package/src/layout/Main.vue +0 -97
- package/src/layout/NavTabs.vue +0 -129
- package/src/layout/Show.vue +0 -136
- package/src/layout/index.ts +0 -24
- package/src/layout/style/breadcrumb.scss +0 -61
- package/src/layout/style/fuckmain.scss +0 -21
- package/src/layout/style/index.scss +0 -35
- package/src/layout/style/list.scss +0 -26
- package/src/layout/style/main.scss +0 -75
- package/src/layout/style/navtab.scss +0 -146
- package/src/layout/style/show.scss +0 -50
- package/src/menu/Menu.tsx +0 -181
- package/src/menu/style/index.scss +0 -26
- package/src/modal/Modal.tsx +0 -83
- package/src/modal/index.ts +0 -9
- package/src/modal/style/index.scss +0 -74
- package/src/select/Select.vue +0 -177
- package/src/select/dic.worker.ts +0 -32
- package/src/select/index.ts +0 -9
- package/src/table/Field.vue +0 -44
- package/src/table/Table.tsx +0 -515
- package/src/table/index.md +0 -1
- package/src/table/index.ts +0 -9
- package/src/table/interface/table.ts +0 -64
- package/src/table/style/index.scss +0 -10
- package/src/theme/index.ts +0 -1
- package/src/theme/theme.scss +0 -1
- package/src/theme/variable.scss +0 -67
package/src/table/Table.tsx
DELETED
|
@@ -1,515 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
computed,
|
|
3
|
-
defineComponent,
|
|
4
|
-
nextTick,
|
|
5
|
-
onBeforeUnmount,
|
|
6
|
-
onDeactivated,
|
|
7
|
-
PropType,
|
|
8
|
-
reactive,
|
|
9
|
-
ref,
|
|
10
|
-
watch
|
|
11
|
-
// watchEffect
|
|
12
|
-
} from "vue";
|
|
13
|
-
import { Pagination, Space, Table } from "ant-design-vue";
|
|
14
|
-
import { useEleHeight } from "../_utils/html";
|
|
15
|
-
import { prefixName } from "../theme";
|
|
16
|
-
|
|
17
|
-
import type { TableProps, Key } from "./interface/table";
|
|
18
|
-
/**
|
|
19
|
-
* 表格组件 基于TSX封装ATable
|
|
20
|
-
*/
|
|
21
|
-
const tableProps = () => {
|
|
22
|
-
return {
|
|
23
|
-
data: {
|
|
24
|
-
type: Object as PropType<TableProps["data"]>,
|
|
25
|
-
required: true
|
|
26
|
-
},
|
|
27
|
-
height: {
|
|
28
|
-
type: Number as PropType<TableProps["height"]>,
|
|
29
|
-
default: 300
|
|
30
|
-
},
|
|
31
|
-
keys: Array as PropType<TableProps["keys"]>,
|
|
32
|
-
rowKey: {
|
|
33
|
-
type: String as PropType<TableProps["rowKey"]>,
|
|
34
|
-
default: "id"
|
|
35
|
-
},
|
|
36
|
-
loading: {
|
|
37
|
-
type: Boolean as PropType<TableProps["loading"]>,
|
|
38
|
-
default: false
|
|
39
|
-
},
|
|
40
|
-
pagination: {
|
|
41
|
-
type: Object as PropType<TableProps["pagination"]>,
|
|
42
|
-
default: () => ({})
|
|
43
|
-
},
|
|
44
|
-
config: {
|
|
45
|
-
type: Object as PropType<TableProps["config"]>,
|
|
46
|
-
default: () => ({})
|
|
47
|
-
},
|
|
48
|
-
expandedRowKeys: {
|
|
49
|
-
type: Object as PropType<TableProps["expandedRowKeys"]>,
|
|
50
|
-
default: () => []
|
|
51
|
-
},
|
|
52
|
-
defaultExpandAllRows: {
|
|
53
|
-
type: Boolean as PropType<TableProps["defaultExpandAllRows"]>,
|
|
54
|
-
default: () => true
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
// 使用有问题
|
|
60
|
-
// const tableEmits = defineEmits<{
|
|
61
|
-
// "update:keys": (keys: []) => void;
|
|
62
|
-
// }>();
|
|
63
|
-
// interface MyEvents {
|
|
64
|
-
// [key: string]: (...args: any[]) => void;
|
|
65
|
-
// "update:keys": (keys: []) => void;
|
|
66
|
-
// }
|
|
67
|
-
|
|
68
|
-
//分页class名称
|
|
69
|
-
const basePageClassName = `${prefixName}-pagination`;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* 表格组件定义
|
|
73
|
-
*/
|
|
74
|
-
const DXTable = defineComponent({
|
|
75
|
-
name: "DTable",
|
|
76
|
-
inheritAttrs: false,
|
|
77
|
-
props: tableProps(),
|
|
78
|
-
// emits: { "update:keys": (keys: []) => void }
|
|
79
|
-
// TODO 需要做调整
|
|
80
|
-
emits: ["update:keys"],
|
|
81
|
-
setup: function (props, { emit, slots, attrs }) {
|
|
82
|
-
//分页默认配置
|
|
83
|
-
const paginationConfig = reactive({
|
|
84
|
-
defaultPageSize: 20,
|
|
85
|
-
hideOnSinglePage: false,
|
|
86
|
-
pageSizeOptions: ["10", "20", "30", "40"],
|
|
87
|
-
responsive: true,
|
|
88
|
-
showQuickJumper: true,
|
|
89
|
-
showLessItems: true,
|
|
90
|
-
showTotal: (total: number) => {
|
|
91
|
-
return `总共 ${total} 条`;
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
// 保存选中的唯一id
|
|
96
|
-
const selectedRowKeys = ref<any>(props.keys || []);
|
|
97
|
-
// 数据源
|
|
98
|
-
const dataSource = computed(() => props.data);
|
|
99
|
-
// 表格列
|
|
100
|
-
const columns = computed(() => props.config?.columns ?? []);
|
|
101
|
-
const paginationState = computed(
|
|
102
|
-
() => props.config?.pagination ?? ({} as any)
|
|
103
|
-
);
|
|
104
|
-
// 展开行
|
|
105
|
-
// eslint-disable-next-line vue/no-setup-props-destructure
|
|
106
|
-
const expandedKeys = ref<any>(props.expandedRowKeys);
|
|
107
|
-
// 分页条数配置
|
|
108
|
-
paginationConfig.pageSizeOptions =
|
|
109
|
-
props.config?.pageOption?.sizeOptions ?? paginationConfig.pageSizeOptions;
|
|
110
|
-
// 默认条数
|
|
111
|
-
paginationConfig.defaultPageSize =
|
|
112
|
-
props.config?.pageOption?.defaultSize ?? paginationConfig.defaultPageSize;
|
|
113
|
-
|
|
114
|
-
//TODO 后续改进
|
|
115
|
-
// watchEffect(() => {
|
|
116
|
-
// const { expandedRowKeys } = props;
|
|
117
|
-
// expandedKeys.value = expandedRowKeys;
|
|
118
|
-
// });
|
|
119
|
-
|
|
120
|
-
// 初始化表格
|
|
121
|
-
const {
|
|
122
|
-
tableRef,
|
|
123
|
-
tableRootRef,
|
|
124
|
-
tableHeight,
|
|
125
|
-
onPageChange,
|
|
126
|
-
onRowClassName
|
|
127
|
-
} = useTable();
|
|
128
|
-
|
|
129
|
-
function useTable() {
|
|
130
|
-
const {
|
|
131
|
-
rowClassName,
|
|
132
|
-
keepSelected,
|
|
133
|
-
onPageChange: onChange
|
|
134
|
-
} = props.config;
|
|
135
|
-
|
|
136
|
-
const selection = props.config.selection ?? "N";
|
|
137
|
-
const isInit = ref(false);
|
|
138
|
-
// 表格根div
|
|
139
|
-
const tableRootRef = ref<HTMLElement>();
|
|
140
|
-
// 表格组件对象
|
|
141
|
-
const tableRef = ref<any>(null);
|
|
142
|
-
// 表格计算出来的高度
|
|
143
|
-
const tableHeight = ref<number>();
|
|
144
|
-
// 表格body对象
|
|
145
|
-
const antTableBodyRef = ref<any>(null);
|
|
146
|
-
// 计算高度
|
|
147
|
-
const playHeight = (height: number) => {
|
|
148
|
-
try {
|
|
149
|
-
const tableEl = tableRef?.value?.$el;
|
|
150
|
-
const headerHeight = useEleHeight(
|
|
151
|
-
tableEl.getElementsByClassName("ant-table-header")[0]
|
|
152
|
-
);
|
|
153
|
-
isInit.value = true;
|
|
154
|
-
// 获取分页组件高度
|
|
155
|
-
let paginationHeight = 0;
|
|
156
|
-
if (props.config.pagination) {
|
|
157
|
-
const paginationEl =
|
|
158
|
-
tableRootRef.value?.getElementsByClassName(basePageClassName)[0];
|
|
159
|
-
paginationHeight = useEleHeight(paginationEl as any) ?? 0;
|
|
160
|
-
}
|
|
161
|
-
tableHeight.value = height - (headerHeight + paginationHeight);
|
|
162
|
-
|
|
163
|
-
// 设置body高度
|
|
164
|
-
tableEl.getElementsByClassName("ant-table-body")[0].style.height =
|
|
165
|
-
tableHeight.value + "px";
|
|
166
|
-
// 表格body对象 用于切换页码后滚动条置顶
|
|
167
|
-
antTableBodyRef.value =
|
|
168
|
-
tableEl.getElementsByClassName("ant-table-body")[0];
|
|
169
|
-
} catch (e) {
|
|
170
|
-
console.warn(e);
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
//监听传入的height的变化 默认组件创建的时候会执行一次
|
|
174
|
-
// watchEffect(() => {
|
|
175
|
-
// if (props.height !== 0) {
|
|
176
|
-
// nextTick(() => {
|
|
177
|
-
// if (isInit.value) {
|
|
178
|
-
// playHeight(props.height);
|
|
179
|
-
// } else {
|
|
180
|
-
// // 必须在组件挂载成功后 执行计算高度 否则无法正确获取元素的高度
|
|
181
|
-
// setTimeout(() => {
|
|
182
|
-
// playHeight(props.height);
|
|
183
|
-
// // 如果表格头有很多列的情况下,获取到的头部高度不对,需要延迟执行获取高度方法
|
|
184
|
-
// }, 100);
|
|
185
|
-
// }
|
|
186
|
-
// });
|
|
187
|
-
// }
|
|
188
|
-
// });
|
|
189
|
-
|
|
190
|
-
let playTimeout: any = null;
|
|
191
|
-
watch(
|
|
192
|
-
() => props.height,
|
|
193
|
-
(val) => {
|
|
194
|
-
if (val !== 0) {
|
|
195
|
-
nextTick(() => {
|
|
196
|
-
if (isInit.value) {
|
|
197
|
-
playHeight(props.height);
|
|
198
|
-
} else {
|
|
199
|
-
// 必须在组件挂载成功后 执行计算高度 否则无法正确获取元素的高度
|
|
200
|
-
playTimeout = setTimeout(() => {
|
|
201
|
-
playHeight(props.height);
|
|
202
|
-
// 如果表格头有很多列的情况下,获取到的头部高度不对,需要延迟执行获取高度方法
|
|
203
|
-
}, 100);
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
immediate: true
|
|
210
|
-
}
|
|
211
|
-
);
|
|
212
|
-
|
|
213
|
-
onBeforeUnmount(() => {
|
|
214
|
-
playTimeout && clearTimeout(playTimeout);
|
|
215
|
-
});
|
|
216
|
-
onDeactivated(() => {
|
|
217
|
-
playTimeout && clearTimeout(playTimeout);
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
// 监听分页组件
|
|
221
|
-
const onPageChange = (page: number, size: number) => {
|
|
222
|
-
onChange ? onChange({ page: page === 0 ? 1 : page, size }) : null;
|
|
223
|
-
// 切换分页的时候,表体滚动到顶部
|
|
224
|
-
antTableBodyRef.value.scrollTop = 0;
|
|
225
|
-
// 如果当前为单选或未开启分页保留数据选中的数据都会被清除
|
|
226
|
-
// 清空历史选中数据
|
|
227
|
-
if (selection === "S" || !keepSelected) {
|
|
228
|
-
selectedRowKeys.value = [];
|
|
229
|
-
emit("update:keys", selectedRowKeys.value);
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
//自定义样式
|
|
233
|
-
const onRowClassName = (record: any, index: number) => {
|
|
234
|
-
return rowClassName ? rowClassName(record, index) : undefined;
|
|
235
|
-
};
|
|
236
|
-
return {
|
|
237
|
-
tableRef,
|
|
238
|
-
tableRootRef,
|
|
239
|
-
tableHeight,
|
|
240
|
-
onPageChange,
|
|
241
|
-
onRowClassName
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
//表格选中配置
|
|
246
|
-
const rowSelection = useRowSelection();
|
|
247
|
-
|
|
248
|
-
function useRowSelection() {
|
|
249
|
-
const {
|
|
250
|
-
rowKey,
|
|
251
|
-
config: { getCheckboxProps }
|
|
252
|
-
} = props;
|
|
253
|
-
|
|
254
|
-
let localSelection = props.config.selection ?? "N";
|
|
255
|
-
//if (selection === "N") return undefined;
|
|
256
|
-
|
|
257
|
-
const onSelect = (record: any, selected: any) => {
|
|
258
|
-
if (localSelection === "S") {
|
|
259
|
-
selectedRowKeys.value = [];
|
|
260
|
-
selectedRowKeys.value = selected ? [record[rowKey]] : [];
|
|
261
|
-
} else {
|
|
262
|
-
selectedRowKeys.value = selected
|
|
263
|
-
? selectedRowKeys.value.concat(record[rowKey])
|
|
264
|
-
: selectedRowKeys.value.filter(
|
|
265
|
-
(key: Key) => key !== record[rowKey]
|
|
266
|
-
);
|
|
267
|
-
}
|
|
268
|
-
emit("update:keys", selectedRowKeys.value);
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
const onSelectAll = (
|
|
272
|
-
selected: any,
|
|
273
|
-
selectedRows: any,
|
|
274
|
-
changeRows: any
|
|
275
|
-
) => {
|
|
276
|
-
const _ids = changeRows.map((record: any) => record[rowKey]);
|
|
277
|
-
selectedRowKeys.value = selected
|
|
278
|
-
? selectedRowKeys.value.concat(_ids)
|
|
279
|
-
: selectedRowKeys.value.filter((key: Key) => !_ids.includes(key));
|
|
280
|
-
|
|
281
|
-
emit("update:keys", selectedRowKeys.value);
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
// 监听父组件手动改变keys 重新赋值给 表格选中变量selectedRowKeys
|
|
285
|
-
// 否则父组件 改变keys后当前selectedRowKeys还是原来的值
|
|
286
|
-
watch(
|
|
287
|
-
() => props.keys,
|
|
288
|
-
(val) => {
|
|
289
|
-
selectedRowKeys.value = val;
|
|
290
|
-
}
|
|
291
|
-
);
|
|
292
|
-
|
|
293
|
-
const rowSelection = ref<any>(undefined);
|
|
294
|
-
|
|
295
|
-
watch(
|
|
296
|
-
() => props.config.selection,
|
|
297
|
-
(val) => {
|
|
298
|
-
localSelection = val as any;
|
|
299
|
-
if (localSelection !== "N") {
|
|
300
|
-
rowSelection.value = {
|
|
301
|
-
selectedRowKeys,
|
|
302
|
-
onSelect,
|
|
303
|
-
onSelectAll,
|
|
304
|
-
fixed: true,
|
|
305
|
-
columnTitle: localSelection === "S" ? "选择" : null,
|
|
306
|
-
columnWidth: localSelection === "S" ? 60 : 40,
|
|
307
|
-
getCheckboxProps: getCheckboxProps
|
|
308
|
-
};
|
|
309
|
-
} else {
|
|
310
|
-
rowSelection.value = undefined;
|
|
311
|
-
}
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
immediate: true
|
|
315
|
-
}
|
|
316
|
-
);
|
|
317
|
-
|
|
318
|
-
// return {
|
|
319
|
-
// selectedRowKeys,
|
|
320
|
-
// onSelect,
|
|
321
|
-
// onSelectAll,
|
|
322
|
-
// fixed: true,
|
|
323
|
-
// columnTitle: localSelection === "S" ? "选择" : null,
|
|
324
|
-
// columnWidth: localSelection === "S" ? 60 : 40,
|
|
325
|
-
// getCheckboxProps: getCheckboxProps
|
|
326
|
-
// };
|
|
327
|
-
return rowSelection;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
const customRow = useCustomRow();
|
|
331
|
-
|
|
332
|
-
//表格行配置
|
|
333
|
-
function useCustomRow() {
|
|
334
|
-
return (record: any, index: any) => {
|
|
335
|
-
// 用于存储 在某个事件内双击两次 则取消单击事件业务
|
|
336
|
-
let clickTimeout: any = undefined;
|
|
337
|
-
const {
|
|
338
|
-
rowKey,
|
|
339
|
-
config: { click, dbClick, selection, getCheckboxProps }
|
|
340
|
-
} = props as any;
|
|
341
|
-
|
|
342
|
-
// 当前点击行的唯一ID,通过rowKey从record中取值
|
|
343
|
-
const id = record[rowKey];
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* 处理单击事件业务
|
|
347
|
-
* @param record 当前点击行数据
|
|
348
|
-
*/
|
|
349
|
-
const onClick = () => {
|
|
350
|
-
// 获取getCheckboxProps方法,如果不等于undefined,则执行方法获取disabled的值
|
|
351
|
-
// 否则checkEnable为false
|
|
352
|
-
const checkEnable =
|
|
353
|
-
getCheckboxProps === undefined
|
|
354
|
-
? false
|
|
355
|
-
: getCheckboxProps(record).disabled;
|
|
356
|
-
|
|
357
|
-
if (selection === "N" || checkEnable) {
|
|
358
|
-
// 1. 未开启复选框 则不处理数据选中操作
|
|
359
|
-
// 2. 如果当前点击的行 包含在禁用的数据项目里面 则不进行选中操作
|
|
360
|
-
// 3. checkEnable 用来判断复选框属性的值,如果当前的数据满足getCheckboxProps这个
|
|
361
|
-
// 方法返回的disabled为true就不执行
|
|
362
|
-
// 复选框选中的操作
|
|
363
|
-
return;
|
|
364
|
-
}
|
|
365
|
-
const haveState = selectedRowKeys.value.some(
|
|
366
|
-
(key: Key) => key === id
|
|
367
|
-
);
|
|
368
|
-
if (haveState) {
|
|
369
|
-
//如果 当前点击行的ID 已存在 那么直接过滤掉当前的id
|
|
370
|
-
selectedRowKeys.value = selectedRowKeys.value.filter(
|
|
371
|
-
(key: Key) => key !== id
|
|
372
|
-
);
|
|
373
|
-
} else {
|
|
374
|
-
if (selection === "S") {
|
|
375
|
-
//单选的时候 清空选中的数据 再赋值新的ID
|
|
376
|
-
selectedRowKeys.value = [];
|
|
377
|
-
selectedRowKeys.value.push(id);
|
|
378
|
-
} else {
|
|
379
|
-
//多选直接追加ID
|
|
380
|
-
selectedRowKeys.value.push(id);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
emit("update:keys", selectedRowKeys.value);
|
|
384
|
-
};
|
|
385
|
-
|
|
386
|
-
function onClickSelectedBg(event: any) {
|
|
387
|
-
const { clickSelectedClassName } = props.config;
|
|
388
|
-
if (!clickSelectedClassName) return;
|
|
389
|
-
const curEl = event.target;
|
|
390
|
-
// 找到父元素
|
|
391
|
-
const parentElement = curEl.parentNode;
|
|
392
|
-
// 判断父元素是否有某个 class
|
|
393
|
-
if (!parentElement.classList.contains(clickSelectedClassName)) {
|
|
394
|
-
// 如果父元素没有指定的 class,则添加 class
|
|
395
|
-
parentElement.classList.add(clickSelectedClassName);
|
|
396
|
-
} else {
|
|
397
|
-
// 如果父元素已经有指定的 class,则移除 class
|
|
398
|
-
parentElement.classList.remove(clickSelectedClassName);
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
return {
|
|
403
|
-
onClick: (event: any) => {
|
|
404
|
-
clearTimeout(clickTimeout);
|
|
405
|
-
clickTimeout = setTimeout(() => {
|
|
406
|
-
// 处理背景激活逻辑
|
|
407
|
-
onClickSelectedBg(event);
|
|
408
|
-
// 处理单击事件业务
|
|
409
|
-
onClick();
|
|
410
|
-
// 回传数据 自定义单击后的业务
|
|
411
|
-
click ? click(record, index) : undefined;
|
|
412
|
-
}, 200);
|
|
413
|
-
}, // 点击行
|
|
414
|
-
onDblclick: () => {
|
|
415
|
-
clearTimeout(clickTimeout);
|
|
416
|
-
// 回传数据 自定义单击后的业务
|
|
417
|
-
dbClick ? dbClick(record, index) : undefined;
|
|
418
|
-
}
|
|
419
|
-
};
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
const actionStop = (event: MouseEvent) => {
|
|
424
|
-
event.stopPropagation();
|
|
425
|
-
};
|
|
426
|
-
|
|
427
|
-
const expandRowByClick = computed(() => {
|
|
428
|
-
const { selection } = props.config;
|
|
429
|
-
return selection === "N";
|
|
430
|
-
});
|
|
431
|
-
const tableSlots: any = {};
|
|
432
|
-
if (slots.expandedRowRender) {
|
|
433
|
-
tableSlots.expandedRowRender = (record: any) => {
|
|
434
|
-
return (
|
|
435
|
-
<>{slots.expandedRowRender && slots.expandedRowRender(record)}</>
|
|
436
|
-
);
|
|
437
|
-
};
|
|
438
|
-
}
|
|
439
|
-
const summary = () => {
|
|
440
|
-
return <>{slots.summary && slots.summary()}</>;
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* 展开行事件
|
|
445
|
-
* @param expanded
|
|
446
|
-
* @param record
|
|
447
|
-
*/
|
|
448
|
-
const onExpand = (expanded: any, record: any) => {
|
|
449
|
-
props.config.onExpand && props.config.onExpand({ expanded, record });
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
return () => (
|
|
453
|
-
<div ref={tableRootRef}>
|
|
454
|
-
<Table
|
|
455
|
-
ref={tableRef}
|
|
456
|
-
row-key={props.rowKey}
|
|
457
|
-
bordered={props.config.bordered}
|
|
458
|
-
{...attrs}
|
|
459
|
-
columns={columns.value}
|
|
460
|
-
dataSource={dataSource.value}
|
|
461
|
-
loading={props.loading}
|
|
462
|
-
size={props.config?.size ?? "small"}
|
|
463
|
-
scroll={{
|
|
464
|
-
scrollToFirstRowOnChange: true,
|
|
465
|
-
x: "100%",
|
|
466
|
-
y: tableHeight.value + "px"
|
|
467
|
-
}}
|
|
468
|
-
v-model:expandedRowKeys={expandedKeys.value}
|
|
469
|
-
expandRowByClick={expandRowByClick.value}
|
|
470
|
-
defaultExpandAllRows={props.defaultExpandAllRows}
|
|
471
|
-
pagination={false}
|
|
472
|
-
customRow={customRow}
|
|
473
|
-
rowSelection={rowSelection.value}
|
|
474
|
-
rowClassName={onRowClassName}
|
|
475
|
-
onExpand={onExpand}
|
|
476
|
-
>
|
|
477
|
-
{{
|
|
478
|
-
bodyCell: ({ column, record, index }: any) => {
|
|
479
|
-
if (column.slot === "action") {
|
|
480
|
-
return (
|
|
481
|
-
<div onClick={actionStop} onDblclick={actionStop}>
|
|
482
|
-
<Space>
|
|
483
|
-
{slots.action && slots.action({ record, index })}
|
|
484
|
-
</Space>
|
|
485
|
-
</div>
|
|
486
|
-
);
|
|
487
|
-
}
|
|
488
|
-
},
|
|
489
|
-
...tableSlots,
|
|
490
|
-
// 总结栏插槽
|
|
491
|
-
summary: summary
|
|
492
|
-
}}
|
|
493
|
-
</Table>
|
|
494
|
-
<Pagination
|
|
495
|
-
v-show={props.config.pagination}
|
|
496
|
-
class={[basePageClassName]}
|
|
497
|
-
v-model:current={paginationState.value.current}
|
|
498
|
-
v-model:pageSize={paginationState.value.pageSize}
|
|
499
|
-
disabled={props.loading}
|
|
500
|
-
show-size-changer
|
|
501
|
-
size={"default"}
|
|
502
|
-
hide-on-single-page={paginationConfig.hideOnSinglePage}
|
|
503
|
-
show-quick-jumper={paginationConfig.showQuickJumper}
|
|
504
|
-
default-page-size={paginationConfig.defaultPageSize}
|
|
505
|
-
page-size-options={paginationConfig.pageSizeOptions}
|
|
506
|
-
show-total={paginationConfig.showTotal}
|
|
507
|
-
total={paginationState.value.total}
|
|
508
|
-
onChange={onPageChange}
|
|
509
|
-
/>
|
|
510
|
-
</div>
|
|
511
|
-
);
|
|
512
|
-
}
|
|
513
|
-
});
|
|
514
|
-
|
|
515
|
-
export default DXTable;
|
package/src/table/index.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# XI-Table 表格
|
package/src/table/index.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
export type Key = string | number;
|
|
2
|
-
export type SelectionType = "N" | "S" | "M"; // 无选择/单选/多选
|
|
3
|
-
export type SizeType = "small" | "middle" | "middle";
|
|
4
|
-
|
|
5
|
-
//表格配置
|
|
6
|
-
export interface Config {
|
|
7
|
-
[key: string]: any;
|
|
8
|
-
// 是否开启边框
|
|
9
|
-
bordered?: boolean;
|
|
10
|
-
//表格列配置
|
|
11
|
-
columns?: any;
|
|
12
|
-
// 表格大小
|
|
13
|
-
size?: SizeType;
|
|
14
|
-
// 复选框
|
|
15
|
-
selection?: SelectionType;
|
|
16
|
-
// 是开启页码切换的时候保留选中的数据
|
|
17
|
-
keepSelected?: boolean;
|
|
18
|
-
// 分页
|
|
19
|
-
pagination?: Pagination;
|
|
20
|
-
// 分页事件
|
|
21
|
-
onPageChange?: (paging: { page: number; size: number }) => void;
|
|
22
|
-
// 自定义行样式
|
|
23
|
-
rowClassName?: (record: any, index: number) => any;
|
|
24
|
-
// 单击
|
|
25
|
-
click?: (record: unknown) => void;
|
|
26
|
-
// 双击
|
|
27
|
-
dbClick?: (record: any) => void;
|
|
28
|
-
// 选择框的默认属性配置
|
|
29
|
-
getCheckboxProps?: (record: any) => any;
|
|
30
|
-
// 点击激活背景色的class
|
|
31
|
-
clickSelectedClassName?: string;
|
|
32
|
-
// 分页配置
|
|
33
|
-
pageOption: {
|
|
34
|
-
sizeOptions: string[];
|
|
35
|
-
defaultSize: number;
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface Pagination {
|
|
40
|
-
total: number;
|
|
41
|
-
current: number;
|
|
42
|
-
pageSize: number;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface TableProps {
|
|
46
|
-
// 保留
|
|
47
|
-
keys?: Key[];
|
|
48
|
-
//数据源
|
|
49
|
-
data: any;
|
|
50
|
-
//主键id
|
|
51
|
-
rowKey: string;
|
|
52
|
-
// 展开行的ID
|
|
53
|
-
expandedRowKeys?: string[];
|
|
54
|
-
// 是否默认展开全部
|
|
55
|
-
defaultExpandAllRows?: boolean;
|
|
56
|
-
//加载状态
|
|
57
|
-
loading?: false;
|
|
58
|
-
//表格高度
|
|
59
|
-
height: number;
|
|
60
|
-
//分页
|
|
61
|
-
pagination?: any;
|
|
62
|
-
// 配置
|
|
63
|
-
config: Config;
|
|
64
|
-
}
|
package/src/theme/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const prefixName = "ditari-bsui";
|
package/src/theme/theme.scss
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@import "./variable";
|
package/src/theme/variable.scss
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
// class 前缀
|
|
2
|
-
$prefix-name: ditari-bsui;
|
|
3
|
-
// 页面背景颜色
|
|
4
|
-
$bg-color: #f0f2f5;
|
|
5
|
-
//左侧logo高度
|
|
6
|
-
$logo-height: 240px !default;
|
|
7
|
-
// 左侧菜单底部图片
|
|
8
|
-
$footer-slogan: 0px!default;
|
|
9
|
-
/******======网格变量======******/
|
|
10
|
-
//网格边框颜色
|
|
11
|
-
$grid-border-color: #4e4e4e !default;
|
|
12
|
-
// 网格里面输入框获取焦点时的边框颜色
|
|
13
|
-
$grid-input-focus-border-color: #1890ff !default;
|
|
14
|
-
//输入框校验不通过时候的颜色
|
|
15
|
-
$grid-input-error-border-color: #ff4d4f !default;
|
|
16
|
-
// 网格输入框边框宽度
|
|
17
|
-
$grid-input-border-width: 2px !default;
|
|
18
|
-
// 网格边框宽度
|
|
19
|
-
$gird-border-width: 1px !default;
|
|
20
|
-
// 网格里的输入框校验结果是否显示
|
|
21
|
-
$gird-error-display: block !default;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/******======左侧菜单======******/
|
|
25
|
-
// 左侧菜单
|
|
26
|
-
$logo-height: 40px !default;
|
|
27
|
-
//左侧菜单北京颜色
|
|
28
|
-
$side-bg-color: #162157 !default;
|
|
29
|
-
//子菜单展开后的背景颜色
|
|
30
|
-
$side-menu-sub-bg-color: #101847 !default;
|
|
31
|
-
|
|
32
|
-
/******======多标签======******/
|
|
33
|
-
// 背景色
|
|
34
|
-
$nav-tab-bg-color: linear-gradient(270deg, #019cfe 0%, #0165fe 100%) !default;
|
|
35
|
-
//分割符颜色
|
|
36
|
-
$nav-tab-dividers-color: #fff !default;
|
|
37
|
-
// 字体颜色
|
|
38
|
-
$nav-tab-text-color: #fff !default;
|
|
39
|
-
// 悬浮的背景色
|
|
40
|
-
$nav-tab-hover-bg-color: #065de1 !default;
|
|
41
|
-
// 激活时的字体颜色
|
|
42
|
-
$nav-tab-active-txt-color: #0065b3!default;
|
|
43
|
-
// 关闭按钮悬浮背景色
|
|
44
|
-
$nav-tab-close-hover-bg-color: #63aeff!default;
|
|
45
|
-
// 关闭按钮悬浮时候的字体颜色
|
|
46
|
-
$nav-tab-close-hover-color: #fff!default;
|
|
47
|
-
// 关闭按钮颜色
|
|
48
|
-
$nav-tab-close-color: #fff!default;
|
|
49
|
-
// 激活时的背景色
|
|
50
|
-
$nav-tab-active-bg-color: #fff !default;
|
|
51
|
-
|
|
52
|
-
/******======详情页,返回导航距离======******/
|
|
53
|
-
$show-header-top: 84px!default;
|
|
54
|
-
// show头部阴影
|
|
55
|
-
$box-shadow-color: #e0e0e0 !default;
|
|
56
|
-
|
|
57
|
-
/******======面包屑======******/
|
|
58
|
-
// 背景色
|
|
59
|
-
$bread-bg-color: #f0f2f5!default;
|
|
60
|
-
// 链接字体颜色
|
|
61
|
-
$bread-link-txt-color: #2589ff!default;
|
|
62
|
-
// 面包屑文本颜色
|
|
63
|
-
$bread-txt-color: #333;
|
|
64
|
-
|
|
65
|
-
/******======FUCK MAIN======******/
|
|
66
|
-
// 菜单收缩颜色
|
|
67
|
-
$fuck-main-collapsed-color: #fff!default;
|