@dt-frames/ui 2.0.16 → 2.0.17
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/form/index.js +25 -3
- package/es/components/form/src/props.d.ts +3 -3
- package/es/components/table/index.js +60 -133
- package/es/components/table/index.less +25 -0
- package/es/components/table/src/components/editTable/EditTableCell.d.ts +1 -0
- package/es/components/table/src/index.d.ts +0 -10
- package/es/components/table/src/props.d.ts +0 -4
- package/es/components/table/src/types/table.type.d.ts +8 -0
- package/es/components/tree/index.js +83 -73
- package/es/components/tree/index.less +13 -0
- package/es/components/tree/src/basicProps.d.ts +9 -4
- package/es/components/tree/src/components/ContextMenu.d.ts +6 -0
- package/es/components/tree/src/index.d.ts +11 -11
- package/es/components/tree/src/type/menu.d.ts +3 -0
- package/es/components/tree/src/type/tree.d.ts +0 -1
- package/es/components/upload/index.js +86 -47
- package/es/components/upload/index.less +7 -0
- package/es/components/upload/src/components/WordView.d.ts +1 -0
- package/es/components/upload/src/index.d.ts +1 -0
- package/es/theme/index.js +8 -3
- package/package.json +1 -1
|
@@ -27,6 +27,27 @@
|
|
|
27
27
|
|
|
28
28
|
.ant-table-empty {
|
|
29
29
|
border-bottom: 1px solid #f0f0f0;
|
|
30
|
+
.ant-table-cell {
|
|
31
|
+
border: none;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.ant-spin-nested-loading, .ant-spin-container {
|
|
36
|
+
height: 100%;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.ant-spin-container, .ant-table-container, .ant-table {
|
|
40
|
+
flex: 1;
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ant-table, .ant-table-container {
|
|
46
|
+
height: 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.ant-table-body {
|
|
50
|
+
flex: 1;
|
|
30
51
|
}
|
|
31
52
|
|
|
32
53
|
.dt-pagination{
|
|
@@ -108,6 +129,10 @@
|
|
|
108
129
|
}
|
|
109
130
|
}
|
|
110
131
|
}
|
|
132
|
+
|
|
133
|
+
.primary-color{
|
|
134
|
+
color: @primary-color;
|
|
135
|
+
}
|
|
111
136
|
}
|
|
112
137
|
|
|
113
138
|
.ant-table{
|
|
@@ -62,6 +62,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
62
62
|
handleChange: (e: any) => Promise<void>;
|
|
63
63
|
handleSubmitRule: () => Promise<boolean>;
|
|
64
64
|
handleOptionsChange: (options: LableValOptions) => void;
|
|
65
|
+
readonly omit: any;
|
|
65
66
|
readonly CellComponent: import("vue").FunctionalComponent<{}, {}>;
|
|
66
67
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
67
68
|
value: {
|
|
@@ -91,10 +91,6 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
91
91
|
type: BooleanConstructor;
|
|
92
92
|
default: boolean;
|
|
93
93
|
};
|
|
94
|
-
canResize: {
|
|
95
|
-
type: BooleanConstructor;
|
|
96
|
-
default: boolean;
|
|
97
|
-
};
|
|
98
94
|
pagination: {
|
|
99
95
|
type: import("vue").PropType<Boolean | import("./types/table.type").PaginationProps>;
|
|
100
96
|
default: any;
|
|
@@ -313,7 +309,6 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
313
309
|
showCheckboxColumn: boolean;
|
|
314
310
|
expandActions: boolean;
|
|
315
311
|
ellipsis: boolean;
|
|
316
|
-
canResize: boolean;
|
|
317
312
|
onTableChange: Function;
|
|
318
313
|
onDownload: Function;
|
|
319
314
|
indexColumnProps: import("./types/table.type").BasicColumn[];
|
|
@@ -494,10 +489,6 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
494
489
|
type: BooleanConstructor;
|
|
495
490
|
default: boolean;
|
|
496
491
|
};
|
|
497
|
-
canResize: {
|
|
498
|
-
type: BooleanConstructor;
|
|
499
|
-
default: boolean;
|
|
500
|
-
};
|
|
501
492
|
pagination: {
|
|
502
493
|
type: import("vue").PropType<Boolean | import("./types/table.type").PaginationProps>;
|
|
503
494
|
default: any;
|
|
@@ -611,7 +602,6 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
611
602
|
ellipsis: boolean;
|
|
612
603
|
dataSource: import("@dt-frames/core").Recordable<any>[];
|
|
613
604
|
bordered: boolean;
|
|
614
|
-
canResize: boolean;
|
|
615
605
|
pagination: any;
|
|
616
606
|
loading: boolean;
|
|
617
607
|
scroll: {};
|
|
@@ -20,6 +20,14 @@ export declare type CellFormat = ((record: Recordable, index: Number, text: stri
|
|
|
20
20
|
date: string;
|
|
21
21
|
} | {
|
|
22
22
|
percent: string;
|
|
23
|
+
} | {
|
|
24
|
+
tag: (row: Recordable) => {
|
|
25
|
+
color: string;
|
|
26
|
+
text: string | number;
|
|
27
|
+
};
|
|
28
|
+
} | {
|
|
29
|
+
link: (row: Recordable, index: number) => void;
|
|
30
|
+
text?: any;
|
|
23
31
|
} | {
|
|
24
32
|
[key: string]: Recordable;
|
|
25
33
|
} | VNode | JSX.Element;
|
|
@@ -2,9 +2,9 @@ import { Input, MenuItem, MenuDivider, Menu, Dropdown, Tree, Empty, Spin } from
|
|
|
2
2
|
import "ant-design-vue/es/spin/style";
|
|
3
3
|
import "ant-design-vue/es/empty/style";
|
|
4
4
|
import "ant-design-vue/es/tree/style";
|
|
5
|
-
import { unref, defineComponent, useSlots, ref, computed, watch, openBlock, createElementBlock, toDisplayString, createCommentVNode, renderSlot, createVNode, createBlock, withModifiers, withCtx, Fragment, renderList, normalizeProps, guardReactiveProps, createTextVNode, createElementVNode, onMounted, onUnmounted, isVNode, getCurrentInstance, render as render$2, useAttrs, reactive, toRaw, watchEffect, normalizeClass, createSlots, withDirectives, mergeProps, vShow } from "vue";
|
|
6
|
-
import { useI18n, useSlots as useSlots$1,
|
|
7
|
-
import { cloneDeep, difference, omit
|
|
5
|
+
import { unref, defineComponent, useSlots, ref, computed, watch, openBlock, createElementBlock, toDisplayString, createCommentVNode, renderSlot, createVNode, createBlock, withModifiers, withCtx, Fragment, renderList, normalizeProps, guardReactiveProps, createTextVNode, createElementVNode, onMounted, nextTick, onUnmounted, isVNode, getCurrentInstance, render as render$2, useAttrs, reactive, toRaw, watchEffect, normalizeClass, createSlots, withDirectives, mergeProps, vShow } from "vue";
|
|
6
|
+
import { useI18n, useSlots as useSlots$1, isEmpty, isBoolean, isArray, isFunction } from "@dt-frames/core";
|
|
7
|
+
import { cloneDeep, get, difference, omit } from "lodash-es";
|
|
8
8
|
import "ant-design-vue/es/dropdown/style";
|
|
9
9
|
import "ant-design-vue/es/menu/style";
|
|
10
10
|
import "ant-design-vue/es/input/style";
|
|
@@ -18,6 +18,9 @@ const BasicProps = {
|
|
|
18
18
|
defaultExpandAll: {
|
|
19
19
|
type: Boolean
|
|
20
20
|
},
|
|
21
|
+
height: {
|
|
22
|
+
type: [Number, String]
|
|
23
|
+
},
|
|
21
24
|
showIcon: {
|
|
22
25
|
type: Boolean,
|
|
23
26
|
default: false
|
|
@@ -94,9 +97,8 @@ const BasicProps = {
|
|
|
94
97
|
type: [Boolean, String],
|
|
95
98
|
default: false
|
|
96
99
|
},
|
|
97
|
-
|
|
98
|
-
type:
|
|
99
|
-
default: () => []
|
|
100
|
+
action: {
|
|
101
|
+
type: Function
|
|
100
102
|
},
|
|
101
103
|
clickRowToExpand: {
|
|
102
104
|
type: Boolean,
|
|
@@ -189,13 +191,16 @@ const rightMenuProps = {
|
|
|
189
191
|
items: {
|
|
190
192
|
type: Array,
|
|
191
193
|
default: () => []
|
|
194
|
+
},
|
|
195
|
+
node: {
|
|
196
|
+
type: Object
|
|
192
197
|
}
|
|
193
198
|
};
|
|
194
|
-
function eachTree(treeDatas, callBack, parentNode = {}) {
|
|
199
|
+
function eachTree(treeDatas, callBack, parentNode = {}, config = { children: "children" }) {
|
|
195
200
|
treeDatas.forEach((el) => {
|
|
196
201
|
const newNode = callBack(el, parentNode) || el;
|
|
197
|
-
if (el.children) {
|
|
198
|
-
eachTree(el.children, callBack, newNode);
|
|
202
|
+
if (el[config.children]) {
|
|
203
|
+
eachTree(el[config.children], callBack, newNode);
|
|
199
204
|
}
|
|
200
205
|
});
|
|
201
206
|
}
|
|
@@ -236,8 +241,8 @@ function useTree(treeDataRef, getFieldNames, emit) {
|
|
|
236
241
|
const { key: keyField, children: childrenField } = unref(getFieldNames);
|
|
237
242
|
if (!childrenField || !keyField)
|
|
238
243
|
return keys;
|
|
239
|
-
for (let
|
|
240
|
-
const node = treeData[
|
|
244
|
+
for (let index2 = 0; index2 < treeData.length; index2++) {
|
|
245
|
+
const node = treeData[index2];
|
|
241
246
|
keys.push(node[keyField]);
|
|
242
247
|
const children = node[childrenField];
|
|
243
248
|
if (children && children.length) {
|
|
@@ -252,8 +257,8 @@ function useTree(treeDataRef, getFieldNames, emit) {
|
|
|
252
257
|
const { key: keyField, children: childrenField } = unref(getFieldNames);
|
|
253
258
|
if (!childrenField || !keyField)
|
|
254
259
|
return keys;
|
|
255
|
-
for (let
|
|
256
|
-
const node = treeData[
|
|
260
|
+
for (let index2 = 0; index2 < treeData.length; index2++) {
|
|
261
|
+
const node = treeData[index2];
|
|
257
262
|
node.disabled !== true && node.selectable !== false && keys.push(node[keyField]);
|
|
258
263
|
const children = node[childrenField];
|
|
259
264
|
if (children && children.length) {
|
|
@@ -268,8 +273,8 @@ function useTree(treeDataRef, getFieldNames, emit) {
|
|
|
268
273
|
const { key: keyField, children: childrenField } = unref(getFieldNames);
|
|
269
274
|
if (!childrenField || !keyField)
|
|
270
275
|
return keys;
|
|
271
|
-
for (let
|
|
272
|
-
const node = treeData[
|
|
276
|
+
for (let index2 = 0; index2 < treeData.length; index2++) {
|
|
277
|
+
const node = treeData[index2];
|
|
273
278
|
const children = node[childrenField];
|
|
274
279
|
if (nodeKey === node[keyField]) {
|
|
275
280
|
keys.push(node[keyField]);
|
|
@@ -291,11 +296,11 @@ function useTree(treeDataRef, getFieldNames, emit) {
|
|
|
291
296
|
const { key: keyField, children: childrenField } = unref(getFieldNames);
|
|
292
297
|
if (!childrenField || !keyField)
|
|
293
298
|
return;
|
|
294
|
-
for (let
|
|
295
|
-
const element = treeData[
|
|
299
|
+
for (let index2 = 0; index2 < treeData.length; index2++) {
|
|
300
|
+
const element = treeData[index2];
|
|
296
301
|
const children = element[childrenField];
|
|
297
302
|
if (element[keyField] === key) {
|
|
298
|
-
treeData[
|
|
303
|
+
treeData[index2] = { ...treeData[index2], ...node };
|
|
299
304
|
break;
|
|
300
305
|
} else if (children && children.length) {
|
|
301
306
|
updateNodeByKey(key, node, element[childrenField]);
|
|
@@ -307,8 +312,8 @@ function useTree(treeDataRef, getFieldNames, emit) {
|
|
|
307
312
|
return [];
|
|
308
313
|
const res = [];
|
|
309
314
|
const data = list || unref(treeDataRef) || [];
|
|
310
|
-
for (let
|
|
311
|
-
const item = data[
|
|
315
|
+
for (let index2 = 0; index2 < data.length; index2++) {
|
|
316
|
+
const item = data[index2];
|
|
312
317
|
const { key: keyField, children: childrenField } = unref(getFieldNames);
|
|
313
318
|
const key = keyField ? item[keyField] : "";
|
|
314
319
|
const children = childrenField ? item[childrenField] : [];
|
|
@@ -370,11 +375,11 @@ function useTree(treeDataRef, getFieldNames, emit) {
|
|
|
370
375
|
const { key: keyField, children: childrenField } = unref(getFieldNames);
|
|
371
376
|
if (!childrenField || !keyField)
|
|
372
377
|
return;
|
|
373
|
-
for (let
|
|
374
|
-
const element = treeData[
|
|
378
|
+
for (let index2 = 0; index2 < treeData.length; index2++) {
|
|
379
|
+
const element = treeData[index2];
|
|
375
380
|
const children = element[childrenField];
|
|
376
381
|
if (element[keyField] === key) {
|
|
377
|
-
treeData.splice(
|
|
382
|
+
treeData.splice(index2, 1);
|
|
378
383
|
break;
|
|
379
384
|
} else if (children && children.length) {
|
|
380
385
|
deleteNodeByKey(key, element[childrenField]);
|
|
@@ -385,6 +390,7 @@ function useTree(treeDataRef, getFieldNames, emit) {
|
|
|
385
390
|
if (!key && key !== 0)
|
|
386
391
|
return null;
|
|
387
392
|
const treeData = list || unref(treeDataRef);
|
|
393
|
+
const { children: childrenField } = unref(getFieldNames);
|
|
388
394
|
treeData.forEach((item) => {
|
|
389
395
|
if (selectedNode?.key || selectedNode?.key === 0)
|
|
390
396
|
return selectedNode;
|
|
@@ -392,8 +398,8 @@ function useTree(treeDataRef, getFieldNames, emit) {
|
|
|
392
398
|
selectedNode = item;
|
|
393
399
|
return;
|
|
394
400
|
}
|
|
395
|
-
if (item
|
|
396
|
-
selectedNode = getSelectedNode(key, item
|
|
401
|
+
if (item[childrenField] && item[childrenField].length) {
|
|
402
|
+
selectedNode = getSelectedNode(key, item[childrenField], selectedNode);
|
|
397
403
|
}
|
|
398
404
|
});
|
|
399
405
|
return selectedNode || null;
|
|
@@ -403,36 +409,37 @@ function useTree(treeDataRef, getFieldNames, emit) {
|
|
|
403
409
|
const dragKey = info.dragNode.key;
|
|
404
410
|
const dropPos = info.node.pos.split("-");
|
|
405
411
|
const dropPosition = info.dropPosition - Number(dropPos[dropPos.length - 1]);
|
|
412
|
+
const { children: childrenField } = unref(getFieldNames);
|
|
406
413
|
const loop = (data2, key, callback) => {
|
|
407
|
-
data2.forEach((item,
|
|
414
|
+
data2.forEach((item, index2) => {
|
|
408
415
|
if (item.key === key)
|
|
409
|
-
return callback(item,
|
|
410
|
-
if (item
|
|
411
|
-
return loop(item
|
|
416
|
+
return callback(item, index2, data2);
|
|
417
|
+
if (item[childrenField])
|
|
418
|
+
return loop(item[childrenField], key, callback);
|
|
412
419
|
});
|
|
413
420
|
};
|
|
414
421
|
const data = [...treeDataRef.value];
|
|
415
422
|
let dragObj;
|
|
416
|
-
loop(data, dragKey, (item,
|
|
417
|
-
arr.splice(
|
|
423
|
+
loop(data, dragKey, (item, index2, arr) => {
|
|
424
|
+
arr.splice(index2, 1);
|
|
418
425
|
dragObj = item;
|
|
419
426
|
});
|
|
420
427
|
if (!info.dropToGap) {
|
|
421
428
|
loop(data, dropKey, (item) => {
|
|
422
|
-
item
|
|
423
|
-
item.
|
|
429
|
+
item[childrenField] = item[childrenField] || [];
|
|
430
|
+
item[childrenField].unshift(dragObj);
|
|
424
431
|
});
|
|
425
432
|
} else if ((info.node.children || []).length > 0 && info.node.expanded && dropPosition === 1) {
|
|
426
433
|
loop(data, dropKey, (item) => {
|
|
427
|
-
item
|
|
428
|
-
item.
|
|
434
|
+
item[childrenField] = item[childrenField] || [];
|
|
435
|
+
item[childrenField].unshift(dragObj);
|
|
429
436
|
});
|
|
430
437
|
} else {
|
|
431
438
|
let ar = [];
|
|
432
439
|
let i = 0;
|
|
433
|
-
loop(data, dropKey, (_item,
|
|
440
|
+
loop(data, dropKey, (_item, index2, arr) => {
|
|
434
441
|
ar = arr;
|
|
435
|
-
i =
|
|
442
|
+
i = index2;
|
|
436
443
|
});
|
|
437
444
|
dropPosition === -1 ? ar.splice(i, 0, dragObj) : ar.splice(i + 1, 0, dragObj);
|
|
438
445
|
}
|
|
@@ -537,10 +544,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
537
544
|
const _component_AMenu = Menu;
|
|
538
545
|
const _component_ADropdown = Dropdown;
|
|
539
546
|
return openBlock(), createElementBlock("div", _hoisted_1$2, [
|
|
540
|
-
_ctx.title ? (openBlock(), createElementBlock("h4", _hoisted_2$2, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true),
|
|
547
|
+
_ctx.title ? (openBlock(), createElementBlock("h4", _hoisted_2$2, toDisplayString(_ctx.title), 1)) : createCommentVNode("v-if", true),
|
|
541
548
|
_ctx.search || _ctx.toolbar ? (openBlock(), createElementBlock("div", _hoisted_3$2, [
|
|
542
549
|
_ctx.search ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
543
|
-
unref(slots).addonBefore ? renderSlot(_ctx.$slots, "addonBefore", { key: 0 }) : createCommentVNode("", true),
|
|
550
|
+
unref(slots).addonBefore ? renderSlot(_ctx.$slots, "addonBefore", { key: 0 }) : createCommentVNode("v-if", true),
|
|
544
551
|
createVNode(_component_AInput, {
|
|
545
552
|
size: "small",
|
|
546
553
|
allowClear: "",
|
|
@@ -548,8 +555,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
548
555
|
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => searchValue.value = $event),
|
|
549
556
|
placeholder: unref(t)("FILTER")
|
|
550
557
|
}, null, 8, ["value", "placeholder"]),
|
|
551
|
-
unref(slots).addonAfter ? renderSlot(_ctx.$slots, "addonAfter", { key: 1 }) : createCommentVNode("", true)
|
|
552
|
-
])) : createCommentVNode("", true),
|
|
558
|
+
unref(slots).addonAfter ? renderSlot(_ctx.$slots, "addonAfter", { key: 1 }) : createCommentVNode("v-if", true)
|
|
559
|
+
])) : createCommentVNode("v-if", true),
|
|
553
560
|
_ctx.toolbar ? (openBlock(), createBlock(_component_ADropdown, {
|
|
554
561
|
key: 1,
|
|
555
562
|
onClick: _cache[1] || (_cache[1] = withModifiers(() => {
|
|
@@ -568,7 +575,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
568
575
|
]),
|
|
569
576
|
_: 2
|
|
570
577
|
}, 1040),
|
|
571
|
-
item.divider ? (openBlock(), createBlock(_component_AMenuDivider, { key: 0 })) : createCommentVNode("", true)
|
|
578
|
+
item.divider ? (openBlock(), createBlock(_component_AMenuDivider, { key: 0 })) : createCommentVNode("v-if", true)
|
|
572
579
|
], 64);
|
|
573
580
|
}), 128))
|
|
574
581
|
]),
|
|
@@ -579,12 +586,20 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
579
586
|
_hoisted_5
|
|
580
587
|
]),
|
|
581
588
|
_: 1
|
|
582
|
-
})) : createCommentVNode("", true)
|
|
583
|
-
])) : createCommentVNode("", true)
|
|
589
|
+
})) : createCommentVNode("v-if", true)
|
|
590
|
+
])) : createCommentVNode("v-if", true)
|
|
584
591
|
]);
|
|
585
592
|
};
|
|
586
593
|
}
|
|
587
594
|
});
|
|
595
|
+
const _export_sfc = (sfc, props) => {
|
|
596
|
+
const target = sfc.__vccOpts || sfc;
|
|
597
|
+
for (const [key, val] of props) {
|
|
598
|
+
target[key] = val;
|
|
599
|
+
}
|
|
600
|
+
return target;
|
|
601
|
+
};
|
|
602
|
+
const TreeHeader = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/tree/src/components/TreeHeader.vue"]]);
|
|
588
603
|
function _isSlot(s) {
|
|
589
604
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
590
605
|
}
|
|
@@ -642,7 +657,7 @@ const _sfc_main$1 = defineComponent({
|
|
|
642
657
|
showRef.value = false;
|
|
643
658
|
e?.stopPropagation();
|
|
644
659
|
e?.preventDefault();
|
|
645
|
-
handler?.();
|
|
660
|
+
handler?.(props.node);
|
|
646
661
|
}
|
|
647
662
|
function renderMenuItem(items) {
|
|
648
663
|
const visibleItems = items.filter((item) => !item.hidden);
|
|
@@ -707,6 +722,7 @@ const _sfc_main$1 = defineComponent({
|
|
|
707
722
|
};
|
|
708
723
|
}
|
|
709
724
|
});
|
|
725
|
+
const contextMenuVue = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/tree/src/components/ContextMenu.vue"]]);
|
|
710
726
|
function useContextMenu() {
|
|
711
727
|
const menuManager = {
|
|
712
728
|
domList: [],
|
|
@@ -714,12 +730,12 @@ function useContextMenu() {
|
|
|
714
730
|
}
|
|
715
731
|
};
|
|
716
732
|
function createContextMenu(options) {
|
|
717
|
-
const { event } = options || {};
|
|
733
|
+
const { event, node } = options || {};
|
|
718
734
|
event && event?.preventDefault();
|
|
719
735
|
return new Promise((resolve) => {
|
|
720
736
|
const body = document.body;
|
|
721
737
|
const container = document.createElement("div");
|
|
722
|
-
const propsData = {};
|
|
738
|
+
const propsData = { node };
|
|
723
739
|
if (options.styles) {
|
|
724
740
|
propsData.styles = options.styles;
|
|
725
741
|
}
|
|
@@ -730,7 +746,7 @@ function useContextMenu() {
|
|
|
730
746
|
propsData.customEvent = event;
|
|
731
747
|
propsData.axis = { x: event.clientX, y: event.clientY };
|
|
732
748
|
}
|
|
733
|
-
const vm = createVNode(
|
|
749
|
+
const vm = createVNode(contextMenuVue, propsData);
|
|
734
750
|
render$2(vm, container);
|
|
735
751
|
const handleClick = function() {
|
|
736
752
|
menuManager.resolve("");
|
|
@@ -814,8 +830,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
814
830
|
t
|
|
815
831
|
} = useI18n("UI");
|
|
816
832
|
const {
|
|
817
|
-
getSlot
|
|
818
|
-
extendSlots
|
|
833
|
+
getSlot
|
|
819
834
|
} = useSlots$1();
|
|
820
835
|
const {
|
|
821
836
|
getUiSize
|
|
@@ -856,7 +871,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
856
871
|
if (!icon) {
|
|
857
872
|
if (props.renderIcon && isFunction(props.renderIcon)) {
|
|
858
873
|
return props.renderIcon(params);
|
|
859
|
-
} else if (params
|
|
874
|
+
} else if (!params?.isLeaf) {
|
|
860
875
|
return state.expandedKeys.includes(params.key) ? createVNode(ForderOpen, null, null) : createVNode(Forder, null, null);
|
|
861
876
|
}
|
|
862
877
|
}
|
|
@@ -886,13 +901,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
886
901
|
}, [createVNode("span", null, [title.substr(0, searchIdx)]), createVNode("span", {
|
|
887
902
|
"style": highlightStyle
|
|
888
903
|
}, [searchText]), createVNode("span", null, [title.substr(searchIdx + searchText.length)])]) : title;
|
|
889
|
-
item._title = item
|
|
904
|
+
item._title = item[titleField];
|
|
890
905
|
item[titleField] = createVNode("span", {
|
|
891
906
|
"class": `tree-title ${unref(activeKey) === item[keyField] ? "tree-active-node" : ""}`,
|
|
892
907
|
"onClick": handleClickNode.bind(null, item[keyField], item[childrenField], item)
|
|
893
908
|
}, [slots?.title ? getSlot(slots, "title", item) : createVNode(Fragment, null, [unref(getBindValues).showIcon && icon, titleDom, createVNode("span", {
|
|
894
909
|
"class": "tree-action"
|
|
895
910
|
}, [renderAction(item)])])]);
|
|
911
|
+
}, {}, {
|
|
912
|
+
children: unref(getFieldNames).children
|
|
896
913
|
});
|
|
897
914
|
return data;
|
|
898
915
|
});
|
|
@@ -952,30 +969,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
952
969
|
setExpandedKeys([...state.expandedKeys, key]);
|
|
953
970
|
} else {
|
|
954
971
|
const keys = [...state.expandedKeys];
|
|
955
|
-
const
|
|
956
|
-
if (
|
|
957
|
-
keys.splice(
|
|
972
|
+
const index2 = keys.findIndex((item) => item === key);
|
|
973
|
+
if (index2 !== -1) {
|
|
974
|
+
keys.splice(index2, 1);
|
|
958
975
|
}
|
|
959
976
|
setExpandedKeys(keys);
|
|
960
977
|
}
|
|
961
978
|
}
|
|
962
979
|
function renderAction(node) {
|
|
963
980
|
const {
|
|
964
|
-
|
|
981
|
+
action
|
|
965
982
|
} = props;
|
|
966
|
-
if (
|
|
967
|
-
return;
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
if (isFunction(item.show)) {
|
|
971
|
-
nodeShow = item.show?.(node);
|
|
972
|
-
} else if (isBoolean(item.show)) {
|
|
973
|
-
nodeShow = item.show;
|
|
974
|
-
}
|
|
975
|
-
if (!nodeShow)
|
|
976
|
-
return null;
|
|
977
|
-
return createVNode(Fragment, null, [item.render(node)]);
|
|
978
|
-
});
|
|
983
|
+
if (action && isFunction(action)) {
|
|
984
|
+
return createVNode(Fragment, null, [action(node)]);
|
|
985
|
+
}
|
|
986
|
+
return null;
|
|
979
987
|
}
|
|
980
988
|
function handleSearch(searchValue) {
|
|
981
989
|
if (searchValue !== searchState.searchText)
|
|
@@ -1022,7 +1030,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1022
1030
|
} = props;
|
|
1023
1031
|
let contextMenuOptions = {
|
|
1024
1032
|
event,
|
|
1025
|
-
items: []
|
|
1033
|
+
items: [],
|
|
1034
|
+
node
|
|
1026
1035
|
};
|
|
1027
1036
|
if (beforeRightClick && isFunction(beforeRightClick)) {
|
|
1028
1037
|
let result = await beforeRightClick(node, event);
|
|
@@ -1155,7 +1164,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1155
1164
|
const _component_ASpin = Spin;
|
|
1156
1165
|
return openBlock(), createElementBlock("div", {
|
|
1157
1166
|
class: normalizeClass(["dt-tree h-full flex flex-col", `dt-tree-${unref(getUiSize)}`])
|
|
1158
|
-
}, [unref(showTitle) ? (openBlock(), createBlock(
|
|
1167
|
+
}, [unref(showTitle) ? (openBlock(), createBlock(TreeHeader, {
|
|
1159
1168
|
key: 0,
|
|
1160
1169
|
title: _ctx.title,
|
|
1161
1170
|
toolbar: _ctx.toolbar,
|
|
@@ -1172,7 +1181,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1172
1181
|
name: item,
|
|
1173
1182
|
fn: withCtx(() => [renderSlot(_ctx.$slots, item)])
|
|
1174
1183
|
};
|
|
1175
|
-
})]), 1032, ["title", "toolbar", "search", "checkable", "searchText"])) : createCommentVNode("", true), createVNode(_component_ASpin, {
|
|
1184
|
+
})]), 1032, ["title", "toolbar", "search", "checkable", "searchText"])) : createCommentVNode("v-if", true), createVNode(_component_ASpin, {
|
|
1176
1185
|
spinning: _ctx.loading,
|
|
1177
1186
|
tip: unref(t)("LOADING")
|
|
1178
1187
|
}, {
|
|
@@ -1186,6 +1195,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1186
1195
|
};
|
|
1187
1196
|
}
|
|
1188
1197
|
});
|
|
1198
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/tree/src/index.vue"]]);
|
|
1189
1199
|
export {
|
|
1190
|
-
|
|
1200
|
+
index as DtTree
|
|
1191
1201
|
};
|
|
@@ -56,6 +56,13 @@
|
|
|
56
56
|
background-color: @primary-color-hover;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
+
|
|
60
|
+
.anticon-file {
|
|
61
|
+
opacity: 0.6;
|
|
62
|
+
svg{
|
|
63
|
+
width: 12px;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
59
66
|
}
|
|
60
67
|
|
|
61
68
|
.toolbar{
|
|
@@ -112,6 +119,12 @@
|
|
|
112
119
|
font-size: 14px;
|
|
113
120
|
line-height: 36px;
|
|
114
121
|
}
|
|
122
|
+
|
|
123
|
+
.anticon-file {
|
|
124
|
+
svg{
|
|
125
|
+
width: 13px;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
115
128
|
}
|
|
116
129
|
}
|
|
117
130
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSProperties, PropType } from "vue";
|
|
2
2
|
import { Recordable } from "@dt-frames/core";
|
|
3
|
-
import { KeyType, CheckKeys, FieldNames,
|
|
3
|
+
import { KeyType, CheckKeys, FieldNames, TreeItem } from './type/tree';
|
|
4
4
|
import { Axis, ContextMenuItem } from "./type/menu";
|
|
5
5
|
export declare const BasicProps: {
|
|
6
6
|
defaultExpandLevel: {
|
|
@@ -9,6 +9,9 @@ export declare const BasicProps: {
|
|
|
9
9
|
defaultExpandAll: {
|
|
10
10
|
type: BooleanConstructor;
|
|
11
11
|
};
|
|
12
|
+
height: {
|
|
13
|
+
type: PropType<String | Number>;
|
|
14
|
+
};
|
|
12
15
|
showIcon: {
|
|
13
16
|
type: BooleanConstructor;
|
|
14
17
|
default: boolean;
|
|
@@ -85,9 +88,8 @@ export declare const BasicProps: {
|
|
|
85
88
|
type: PropType<String | Boolean>;
|
|
86
89
|
default: boolean;
|
|
87
90
|
};
|
|
88
|
-
|
|
89
|
-
type: PropType<
|
|
90
|
-
default: () => any[];
|
|
91
|
+
action: {
|
|
92
|
+
type: PropType<(record: Recordable) => any>;
|
|
91
93
|
};
|
|
92
94
|
clickRowToExpand: {
|
|
93
95
|
type: BooleanConstructor;
|
|
@@ -182,4 +184,7 @@ export declare const rightMenuProps: {
|
|
|
182
184
|
type: PropType<ContextMenuItem[]>;
|
|
183
185
|
default: () => any[];
|
|
184
186
|
};
|
|
187
|
+
node: {
|
|
188
|
+
type: PropType<Recordable<any>>;
|
|
189
|
+
};
|
|
185
190
|
};
|
|
@@ -27,6 +27,9 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
27
27
|
type: import("vue").PropType<ContextMenuItem[]>;
|
|
28
28
|
default: () => any[];
|
|
29
29
|
};
|
|
30
|
+
node: {
|
|
31
|
+
type: import("vue").PropType<import("@dt-frames/core").Recordable<any>>;
|
|
32
|
+
};
|
|
30
33
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
31
34
|
width: {
|
|
32
35
|
type: NumberConstructor;
|
|
@@ -54,6 +57,9 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
54
57
|
type: import("vue").PropType<ContextMenuItem[]>;
|
|
55
58
|
default: () => any[];
|
|
56
59
|
};
|
|
60
|
+
node: {
|
|
61
|
+
type: import("vue").PropType<import("@dt-frames/core").Recordable<any>>;
|
|
62
|
+
};
|
|
57
63
|
}>>, {
|
|
58
64
|
showIcon: boolean;
|
|
59
65
|
width: number;
|
|
@@ -8,6 +8,9 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
8
8
|
defaultExpandAll: {
|
|
9
9
|
type: BooleanConstructor;
|
|
10
10
|
};
|
|
11
|
+
height: {
|
|
12
|
+
type: import("vue").PropType<String | Number>;
|
|
13
|
+
};
|
|
11
14
|
showIcon: {
|
|
12
15
|
type: BooleanConstructor;
|
|
13
16
|
default: boolean;
|
|
@@ -84,9 +87,8 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
84
87
|
type: import("vue").PropType<String | Boolean>;
|
|
85
88
|
default: boolean;
|
|
86
89
|
};
|
|
87
|
-
|
|
88
|
-
type: import("vue").PropType<
|
|
89
|
-
default: () => any[];
|
|
90
|
+
action: {
|
|
91
|
+
type: import("vue").PropType<(record: Recordable<any>) => any>;
|
|
90
92
|
};
|
|
91
93
|
clickRowToExpand: {
|
|
92
94
|
type: BooleanConstructor;
|
|
@@ -137,9 +139,6 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
137
139
|
}>, slot?: string, data?: any) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
138
140
|
[key: string]: any;
|
|
139
141
|
}>[];
|
|
140
|
-
extendSlots: (slots: Readonly<{
|
|
141
|
-
[name: string]: import("vue").Slot;
|
|
142
|
-
}>, excludeKeys?: string[]) => any;
|
|
143
142
|
getUiSize: import("vue").ComputedRef<import('../../../theme').UiSize>;
|
|
144
143
|
props: any;
|
|
145
144
|
attrs: {
|
|
@@ -6329,7 +6328,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
6329
6328
|
getBindValues: import("vue").ComputedRef<any>;
|
|
6330
6329
|
showTitle: import("vue").ComputedRef<string | true | import("vue").Slot>;
|
|
6331
6330
|
handleClickNode: (key: string, children: TreeItem[], node: TreeItem) => void;
|
|
6332
|
-
renderAction: (node: TreeItem) => JSX.Element
|
|
6331
|
+
renderAction: (node: TreeItem) => JSX.Element;
|
|
6333
6332
|
handleSearch: (searchValue: string) => void;
|
|
6334
6333
|
createContextMenu: ((options: CreateContextOptions) => Promise<unknown>) | (() => void);
|
|
6335
6334
|
handleRightClick: ({ event, node }: Recordable) => Promise<void>;
|
|
@@ -6459,6 +6458,9 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
6459
6458
|
defaultExpandAll: {
|
|
6460
6459
|
type: BooleanConstructor;
|
|
6461
6460
|
};
|
|
6461
|
+
height: {
|
|
6462
|
+
type: import("vue").PropType<String | Number>;
|
|
6463
|
+
};
|
|
6462
6464
|
showIcon: {
|
|
6463
6465
|
type: BooleanConstructor;
|
|
6464
6466
|
default: boolean;
|
|
@@ -6535,9 +6537,8 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
6535
6537
|
type: import("vue").PropType<String | Boolean>;
|
|
6536
6538
|
default: boolean;
|
|
6537
6539
|
};
|
|
6538
|
-
|
|
6539
|
-
type: import("vue").PropType<
|
|
6540
|
-
default: () => any[];
|
|
6540
|
+
action: {
|
|
6541
|
+
type: import("vue").PropType<(record: Recordable<any>) => any>;
|
|
6541
6542
|
};
|
|
6542
6543
|
clickRowToExpand: {
|
|
6543
6544
|
type: BooleanConstructor;
|
|
@@ -6606,7 +6607,6 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
6606
6607
|
checkedKeys: CheckKeys;
|
|
6607
6608
|
beforeRightClick: (...arg: any) => import("./type/menu").ContextMenuItem[];
|
|
6608
6609
|
highlight: String | Boolean;
|
|
6609
|
-
actionList: import("./type/tree").TreeActionItem[];
|
|
6610
6610
|
clickRowToExpand: boolean;
|
|
6611
6611
|
searchValue: string;
|
|
6612
6612
|
filterFn: (searchValue: any, node: TreeItem, fieldNames: FieldNames) => boolean;
|