@visactor/vue-vtable 1.25.1-alpha.0 → 1.26.0
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/cjs/components/component/menu.js +3 -3
- package/cjs/components/component/tooltip.js +3 -3
- package/cjs/components/custom/checkBox.js +3 -3
- package/cjs/components/custom/group.js +3 -3
- package/cjs/components/custom/image.js +3 -3
- package/cjs/components/custom/radio.js +3 -3
- package/cjs/components/custom/tag.js +3 -3
- package/cjs/components/custom/text.js +3 -3
- package/cjs/components/custom/vtable-vue-attribute-plugin.js +622 -408
- package/cjs/components/list/list-column.js +3 -3
- package/cjs/components/pivot/pivot-column-dimension.js +3 -3
- package/cjs/components/pivot/pivot-column-header-title.js +3 -3
- package/cjs/components/pivot/pivot-corner.js +3 -3
- package/cjs/components/pivot/pivot-indicator.js +3 -3
- package/cjs/components/pivot/pivot-row-dimension.js +3 -3
- package/cjs/components/pivot/pivot-row-header-title.js +3 -3
- package/cjs/constants.js +1 -0
- package/cjs/edit/editor.js +209 -194
- package/cjs/edit/util.js +51 -31
- package/cjs/eventsUtils.js +97 -60
- package/cjs/hooks/useCellRender.js +27 -20
- package/cjs/hooks/useEditorRender.js +75 -52
- package/cjs/index.js +5 -5
- package/cjs/tables/base-table.vue.js +266 -237
- package/cjs/tables/chartModule.js +2 -2
- package/cjs/tables/list-table.vue.js +41 -39
- package/cjs/tables/pivot-chart.vue.js +35 -37
- package/cjs/tables/pivot-table.vue.js +36 -38
- package/cjs/utils/customLayoutUtils.js +109 -96
- package/cjs/utils/slotUtils.js +85 -88
- package/cjs/utils/stringUtils.js +14 -12
- package/cjs/utils/vnodeUtils.js +3 -2
- package/dist/vue-vtable.js +1715 -1358
- package/dist/vue-vtable.min.js +1 -1
- package/es/components/component/menu.js +3 -3
- package/es/components/component/tooltip.js +3 -3
- package/es/components/custom/checkBox.js +3 -3
- package/es/components/custom/group.js +3 -3
- package/es/components/custom/image.js +3 -3
- package/es/components/custom/radio.js +3 -3
- package/es/components/custom/tag.js +3 -3
- package/es/components/custom/text.js +3 -3
- package/es/components/custom/vtable-vue-attribute-plugin.js +622 -408
- package/es/components/list/list-column.js +3 -3
- package/es/components/pivot/pivot-column-dimension.js +3 -3
- package/es/components/pivot/pivot-column-header-title.js +3 -3
- package/es/components/pivot/pivot-corner.js +3 -3
- package/es/components/pivot/pivot-indicator.js +3 -3
- package/es/components/pivot/pivot-row-dimension.js +3 -3
- package/es/components/pivot/pivot-row-header-title.js +3 -3
- package/es/constants.js +1 -0
- package/es/edit/editor.js +209 -194
- package/es/edit/util.js +51 -31
- package/es/eventsUtils.js +97 -60
- package/es/hooks/useCellRender.js +27 -20
- package/es/hooks/useEditorRender.js +75 -52
- package/es/index.js +3 -3
- package/es/tables/base-table.vue.js +266 -237
- package/es/tables/chartModule.js +2 -2
- package/es/tables/list-table.vue.js +41 -39
- package/es/tables/pivot-chart.vue.js +35 -37
- package/es/tables/pivot-table.vue.js +36 -38
- package/es/utils/customLayoutUtils.js +109 -96
- package/es/utils/slotUtils.js +85 -88
- package/es/utils/stringUtils.js +14 -12
- package/es/utils/vnodeUtils.js +3 -2
- package/package.json +5 -5
- package/cjs/components/component/menu.d.ts +0 -14
- package/cjs/components/component/tooltip.d.ts +0 -11
- package/cjs/components/custom/checkBox.d.ts +0 -20
- package/cjs/components/custom/custom-layout.d.ts +0 -20
- package/cjs/components/custom/group.d.ts +0 -6
- package/cjs/components/custom/image.d.ts +0 -6
- package/cjs/components/custom/radio.d.ts +0 -17
- package/cjs/components/custom/tag.d.ts +0 -16
- package/cjs/components/custom/text.d.ts +0 -6
- package/cjs/components/custom/vtable-vue-attribute-plugin.d.ts +0 -62
- package/cjs/components/index.d.ts +0 -15
- package/cjs/components/list/list-column.d.ts +0 -7
- package/cjs/components/pivot/pivot-column-dimension.d.ts +0 -11
- package/cjs/components/pivot/pivot-column-header-title.d.ts +0 -7
- package/cjs/components/pivot/pivot-corner.d.ts +0 -7
- package/cjs/components/pivot/pivot-indicator.d.ts +0 -7
- package/cjs/components/pivot/pivot-row-dimension.d.ts +0 -11
- package/cjs/components/pivot/pivot-row-header-title.d.ts +0 -7
- package/cjs/constants.d.ts +0 -1
- package/cjs/edit/editor.d.ts +0 -50
- package/cjs/edit/index.d.ts +0 -2
- package/cjs/edit/util.d.ts +0 -4
- package/cjs/eventsUtils.d.ts +0 -120
- package/cjs/hooks/index.d.ts +0 -2
- package/cjs/hooks/useCellRender.d.ts +0 -2
- package/cjs/hooks/useEditorRender.d.ts +0 -2
- package/cjs/index.d.ts +0 -6
- package/cjs/tables/base-table.vue.d.ts +0 -543
- package/cjs/tables/chartModule.d.ts +0 -1
- package/cjs/tables/index.d.ts +0 -5
- package/cjs/tables/list-table.vue.d.ts +0 -38
- package/cjs/tables/pivot-chart.vue.d.ts +0 -38
- package/cjs/tables/pivot-table.vue.d.ts +0 -38
- package/cjs/utils/customLayoutUtils.d.ts +0 -5
- package/cjs/utils/slotUtils.d.ts +0 -28
- package/cjs/utils/stringUtils.d.ts +0 -2
- package/cjs/utils/vnodeUtils.d.ts +0 -1
- package/cjs/utils.d.ts +0 -4
- package/es/components/component/menu.d.ts +0 -14
- package/es/components/component/tooltip.d.ts +0 -11
- package/es/components/custom/checkBox.d.ts +0 -20
- package/es/components/custom/custom-layout.d.ts +0 -20
- package/es/components/custom/group.d.ts +0 -6
- package/es/components/custom/image.d.ts +0 -6
- package/es/components/custom/radio.d.ts +0 -17
- package/es/components/custom/tag.d.ts +0 -16
- package/es/components/custom/text.d.ts +0 -6
- package/es/components/custom/vtable-vue-attribute-plugin.d.ts +0 -62
- package/es/components/index.d.ts +0 -15
- package/es/components/list/list-column.d.ts +0 -7
- package/es/components/pivot/pivot-column-dimension.d.ts +0 -11
- package/es/components/pivot/pivot-column-header-title.d.ts +0 -7
- package/es/components/pivot/pivot-corner.d.ts +0 -7
- package/es/components/pivot/pivot-indicator.d.ts +0 -7
- package/es/components/pivot/pivot-row-dimension.d.ts +0 -11
- package/es/components/pivot/pivot-row-header-title.d.ts +0 -7
- package/es/constants.d.ts +0 -1
- package/es/edit/editor.d.ts +0 -50
- package/es/edit/index.d.ts +0 -2
- package/es/edit/util.d.ts +0 -4
- package/es/eventsUtils.d.ts +0 -120
- package/es/hooks/index.d.ts +0 -2
- package/es/hooks/useCellRender.d.ts +0 -2
- package/es/hooks/useEditorRender.d.ts +0 -2
- package/es/index.d.ts +0 -6
- package/es/tables/base-table.vue.d.ts +0 -543
- package/es/tables/chartModule.d.ts +0 -1
- package/es/tables/index.d.ts +0 -5
- package/es/tables/list-table.vue.d.ts +0 -38
- package/es/tables/pivot-chart.vue.d.ts +0 -38
- package/es/tables/pivot-table.vue.d.ts +0 -38
- package/es/utils/customLayoutUtils.d.ts +0 -5
- package/es/utils/slotUtils.d.ts +0 -28
- package/es/utils/stringUtils.d.ts +0 -2
- package/es/utils/vnodeUtils.d.ts +0 -1
- package/es/utils.d.ts +0 -4
|
@@ -1,46 +1,44 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var vue = require('vue');
|
|
4
|
+
var baseTable_vue_vue_type_script_setup_true_lang = require('./base-table.vue.js');
|
|
4
5
|
var vnodeUtils = require('../utils/vnodeUtils.js');
|
|
5
|
-
require('@visactor/vtable');
|
|
6
|
-
require('@visactor/vutils');
|
|
7
6
|
var slotUtils = require('../utils/slotUtils.js');
|
|
8
|
-
var baseTable_vue_vue_type_script_setup_true_lang = require('./base-table.vue.js');
|
|
9
7
|
|
|
10
|
-
var _sfc_main = vue.defineComponent({
|
|
11
|
-
__name: 'pivot-chart',
|
|
12
|
-
props: {
|
|
13
|
-
options: { type: Object, required: true },
|
|
14
|
-
records: { type: Array, required: false },
|
|
15
|
-
width: { type: [String, Number], required: false },
|
|
16
|
-
height: { type: [String, Number], required: false }
|
|
17
|
-
},
|
|
18
|
-
setup(__props, { expose: __expose }) {
|
|
19
|
-
const props = __props;
|
|
20
|
-
const baseTableRef = vue.shallowRef(null);
|
|
21
|
-
const slots = vue.useSlots();
|
|
22
|
-
const computedOptions = vue.computed(() => {
|
|
23
|
-
var _a;
|
|
24
|
-
const flattenedSlots = vnodeUtils.flattenVNodes(((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)) || []);
|
|
25
|
-
const slotOptions = slotUtils.extractPivotSlotOptions(flattenedSlots);
|
|
26
|
-
return slotUtils.mergeSlotOptions(props.options, slotOptions);
|
|
27
|
-
});
|
|
28
|
-
__expose({ vTableInstance: vue.computed(() => { var _a; return ((_a = baseTableRef.value) === null || _a === void 0 ? void 0 : _a.vTableInstance) || null; }) });
|
|
29
|
-
return (_ctx, _cache) => {
|
|
30
|
-
return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
31
|
-
vue.createVNode(baseTable_vue_vue_type_script_setup_true_lang, vue.mergeProps({
|
|
32
|
-
type: "chart",
|
|
33
|
-
options: computedOptions.value,
|
|
34
|
-
records: __props.records,
|
|
35
|
-
width: __props.width,
|
|
36
|
-
height: __props.height,
|
|
37
|
-
ref_key: "baseTableRef",
|
|
38
|
-
ref: baseTableRef
|
|
39
|
-
}, _ctx.$attrs), null, 16
|
|
40
|
-
vue.renderSlot(_ctx.$slots, "default")
|
|
41
|
-
], 64));
|
|
42
|
-
};
|
|
43
|
-
}
|
|
8
|
+
var _sfc_main = /*@__PURE__*/ vue.defineComponent({
|
|
9
|
+
__name: 'pivot-chart',
|
|
10
|
+
props: {
|
|
11
|
+
options: { type: Object, required: true },
|
|
12
|
+
records: { type: Array, required: false },
|
|
13
|
+
width: { type: [String, Number], required: false },
|
|
14
|
+
height: { type: [String, Number], required: false }
|
|
15
|
+
},
|
|
16
|
+
setup(__props, { expose: __expose }) {
|
|
17
|
+
const props = __props;
|
|
18
|
+
const baseTableRef = vue.shallowRef(null);
|
|
19
|
+
const slots = vue.useSlots();
|
|
20
|
+
const computedOptions = vue.computed(() => {
|
|
21
|
+
var _a;
|
|
22
|
+
const flattenedSlots = vnodeUtils.flattenVNodes(((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)) || []);
|
|
23
|
+
const slotOptions = slotUtils.extractPivotSlotOptions(flattenedSlots);
|
|
24
|
+
return slotUtils.mergeSlotOptions(props.options, slotOptions);
|
|
25
|
+
});
|
|
26
|
+
__expose({ vTableInstance: vue.computed(() => { var _a; return ((_a = baseTableRef.value) === null || _a === void 0 ? void 0 : _a.vTableInstance) || null; }) });
|
|
27
|
+
return (_ctx, _cache) => {
|
|
28
|
+
return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
29
|
+
vue.createVNode(baseTable_vue_vue_type_script_setup_true_lang, vue.mergeProps({
|
|
30
|
+
type: "chart",
|
|
31
|
+
options: computedOptions.value,
|
|
32
|
+
records: __props.records,
|
|
33
|
+
width: __props.width,
|
|
34
|
+
height: __props.height,
|
|
35
|
+
ref_key: "baseTableRef",
|
|
36
|
+
ref: baseTableRef
|
|
37
|
+
}, _ctx.$attrs), null, 16 /* FULL_PROPS */, ["options", "records", "width", "height"]),
|
|
38
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
39
|
+
], 64 /* STABLE_FRAGMENT */));
|
|
40
|
+
};
|
|
41
|
+
}
|
|
44
42
|
});
|
|
45
43
|
|
|
46
44
|
module.exports = _sfc_main;
|
|
@@ -1,46 +1,44 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var vue = require('vue');
|
|
4
|
-
var vnodeUtils = require('../utils/vnodeUtils.js');
|
|
5
|
-
require('@visactor/vtable');
|
|
6
|
-
require('@visactor/vutils');
|
|
7
|
-
var slotUtils = require('../utils/slotUtils.js');
|
|
8
4
|
var baseTable_vue_vue_type_script_setup_true_lang = require('./base-table.vue.js');
|
|
5
|
+
var slotUtils = require('../utils/slotUtils.js');
|
|
6
|
+
var vnodeUtils = require('../utils/vnodeUtils.js');
|
|
9
7
|
|
|
10
|
-
var _sfc_main = vue.defineComponent({
|
|
11
|
-
__name: 'pivot-table',
|
|
12
|
-
props: {
|
|
13
|
-
options: { type: Object, required: true },
|
|
14
|
-
records: { type: Array, required: false },
|
|
15
|
-
width: { type: [String, Number], required: false },
|
|
16
|
-
height: { type: [String, Number], required: false }
|
|
17
|
-
},
|
|
18
|
-
setup(__props, { expose: __expose }) {
|
|
19
|
-
const props = __props;
|
|
20
|
-
const baseTableRef = vue.shallowRef(null);
|
|
21
|
-
const slots = vue.useSlots();
|
|
22
|
-
const computedOptions = vue.computed(() => {
|
|
23
|
-
var _a;
|
|
24
|
-
const flattenedSlots = vnodeUtils.flattenVNodes(((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)) || []);
|
|
25
|
-
const slotOptions = slotUtils.extractPivotSlotOptions(flattenedSlots);
|
|
26
|
-
return slotUtils.mergeSlotOptions(props.options, slotOptions);
|
|
27
|
-
});
|
|
28
|
-
__expose({ vTableInstance: vue.computed(() => { var _a; return ((_a = baseTableRef.value) === null || _a === void 0 ? void 0 : _a.vTableInstance) || null; }) });
|
|
29
|
-
return (_ctx, _cache) => {
|
|
30
|
-
return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
31
|
-
vue.createVNode(baseTable_vue_vue_type_script_setup_true_lang, vue.mergeProps({
|
|
32
|
-
type: "pivot",
|
|
33
|
-
options: computedOptions.value,
|
|
34
|
-
records: __props.records,
|
|
35
|
-
width: __props.width,
|
|
36
|
-
height: __props.height,
|
|
37
|
-
ref_key: "baseTableRef",
|
|
38
|
-
ref: baseTableRef
|
|
39
|
-
}, _ctx.$attrs), null, 16
|
|
40
|
-
vue.renderSlot(_ctx.$slots, "default")
|
|
41
|
-
], 64));
|
|
42
|
-
};
|
|
43
|
-
}
|
|
8
|
+
var _sfc_main = /*@__PURE__*/ vue.defineComponent({
|
|
9
|
+
__name: 'pivot-table',
|
|
10
|
+
props: {
|
|
11
|
+
options: { type: Object, required: true },
|
|
12
|
+
records: { type: Array, required: false },
|
|
13
|
+
width: { type: [String, Number], required: false },
|
|
14
|
+
height: { type: [String, Number], required: false }
|
|
15
|
+
},
|
|
16
|
+
setup(__props, { expose: __expose }) {
|
|
17
|
+
const props = __props;
|
|
18
|
+
const baseTableRef = vue.shallowRef(null);
|
|
19
|
+
const slots = vue.useSlots();
|
|
20
|
+
const computedOptions = vue.computed(() => {
|
|
21
|
+
var _a;
|
|
22
|
+
const flattenedSlots = vnodeUtils.flattenVNodes(((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)) || []);
|
|
23
|
+
const slotOptions = slotUtils.extractPivotSlotOptions(flattenedSlots);
|
|
24
|
+
return slotUtils.mergeSlotOptions(props.options, slotOptions);
|
|
25
|
+
});
|
|
26
|
+
__expose({ vTableInstance: vue.computed(() => { var _a; return ((_a = baseTableRef.value) === null || _a === void 0 ? void 0 : _a.vTableInstance) || null; }) });
|
|
27
|
+
return (_ctx, _cache) => {
|
|
28
|
+
return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
29
|
+
vue.createVNode(baseTable_vue_vue_type_script_setup_true_lang, vue.mergeProps({
|
|
30
|
+
type: "pivot",
|
|
31
|
+
options: computedOptions.value,
|
|
32
|
+
records: __props.records,
|
|
33
|
+
width: __props.width,
|
|
34
|
+
height: __props.height,
|
|
35
|
+
ref_key: "baseTableRef",
|
|
36
|
+
ref: baseTableRef
|
|
37
|
+
}, _ctx.$attrs), null, 16 /* FULL_PROPS */, ["options", "records", "width", "height"]),
|
|
38
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
39
|
+
], 64 /* STABLE_FRAGMENT */));
|
|
40
|
+
};
|
|
41
|
+
}
|
|
44
42
|
});
|
|
45
43
|
|
|
46
44
|
module.exports = _sfc_main;
|
|
@@ -24,102 +24,115 @@ function _interopNamespaceDefault(e) {
|
|
|
24
24
|
|
|
25
25
|
var VTable__namespace = /*#__PURE__*/_interopNamespaceDefault(VTable);
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
27
|
+
// 检查属性是否为事件
|
|
28
|
+
function isEventProp(key, props) {
|
|
29
|
+
return key.startsWith('on') && vutils.isFunction(props[key]);
|
|
30
|
+
}
|
|
31
|
+
// 创建自定义布局
|
|
32
|
+
function createCustomLayout(children, isHeader, args) {
|
|
33
|
+
// 组件映射
|
|
34
|
+
const componentMap = {
|
|
35
|
+
Group: VTable__namespace.CustomLayout.Group,
|
|
36
|
+
Image: VTable__namespace.CustomLayout.Image,
|
|
37
|
+
Text: VTable__namespace.CustomLayout.Text,
|
|
38
|
+
Tag: VTable__namespace.CustomLayout.Tag,
|
|
39
|
+
Radio: VTable__namespace.CustomLayout.Radio,
|
|
40
|
+
CheckBox: VTable__namespace.CustomLayout.CheckBox
|
|
41
|
+
};
|
|
42
|
+
// 创建组件的函数
|
|
43
|
+
function createComponent(child) {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
if (!child) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
const { type, children: childChildren } = child;
|
|
49
|
+
const props = stringUtils.convertPropsToCamelCase(child.props);
|
|
50
|
+
const componentName = (type === null || type === void 0 ? void 0 : type.symbol) || (type === null || type === void 0 ? void 0 : type.name);
|
|
51
|
+
const ComponentClass = componentMap[componentName];
|
|
52
|
+
if (!ComponentClass) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
// 创建组件实例
|
|
56
|
+
const component = new ComponentClass(Object.assign({}, props));
|
|
57
|
+
// 绑定组件事件
|
|
58
|
+
bindComponentEvents(component, props);
|
|
59
|
+
// 递归创建子组件
|
|
60
|
+
const subChildren = resolveChildren(childChildren);
|
|
61
|
+
if (vutils.isObject(props === null || props === void 0 ? void 0 : props.vue)) {
|
|
62
|
+
// vue 自定义节点:无需继续循环子节点
|
|
63
|
+
const { element } = props.vue;
|
|
64
|
+
let targetVNode = element !== null && element !== void 0 ? element : subChildren.find(node => (node === null || node === void 0 ? void 0 : node.type) !== Symbol.for('v-cmt'));
|
|
65
|
+
if (vue.isVNode(targetVNode)) {
|
|
66
|
+
// node 标记 key 增加唯一项标记,避免重复渲染
|
|
67
|
+
targetVNode = !targetVNode.key
|
|
68
|
+
? vue.cloneVNode(targetVNode, { key: `row_${args.row}_col_${args.col}` })
|
|
69
|
+
: targetVNode;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
targetVNode = null;
|
|
73
|
+
}
|
|
74
|
+
Object.assign(child.props.vue, {
|
|
75
|
+
element: targetVNode,
|
|
76
|
+
// 不接入外部指定
|
|
77
|
+
container: isHeader ? (_a = args === null || args === void 0 ? void 0 : args.table) === null || _a === void 0 ? void 0 : _a.headerDomContainer : (_b = args === null || args === void 0 ? void 0 : args.table) === null || _b === void 0 ? void 0 : _b.bodyDomContainer
|
|
78
|
+
});
|
|
79
|
+
return component;
|
|
80
|
+
}
|
|
81
|
+
subChildren.forEach((subChild) => {
|
|
82
|
+
const subComponent = createComponent(subChild);
|
|
83
|
+
if (subComponent) {
|
|
84
|
+
component.add(subComponent);
|
|
85
|
+
}
|
|
86
|
+
else if (subChild.type === Symbol.for('v-fgt')) {
|
|
87
|
+
subChild.children.forEach((nestedChild) => {
|
|
88
|
+
const nestedComponent = createComponent(nestedChild);
|
|
89
|
+
if (nestedComponent) {
|
|
90
|
+
component.add(nestedComponent);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
return component;
|
|
96
|
+
}
|
|
97
|
+
// 处理子节点
|
|
98
|
+
function resolveChildren(childChildren) {
|
|
99
|
+
var _a;
|
|
100
|
+
return ((_a = childChildren === null || childChildren === void 0 ? void 0 : childChildren.default) === null || _a === void 0 ? void 0 : _a.call(childChildren)) || childChildren || [];
|
|
101
|
+
}
|
|
102
|
+
// 绑定组件事件
|
|
103
|
+
function bindComponentEvents(component, props) {
|
|
104
|
+
Object.keys(props).forEach(key => {
|
|
105
|
+
if (isEventProp(key, props)) {
|
|
106
|
+
let eventName;
|
|
107
|
+
if (key.startsWith('on')) {
|
|
108
|
+
eventName = key.slice(2).toLowerCase(); // 去掉'on'前缀并转换为小写
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
eventName = stringUtils.toCamelCase(key.slice(2)).toLowerCase(); // 转换为camelCase
|
|
112
|
+
}
|
|
113
|
+
component.addEventListener(eventName, props[key]);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
// 返回root组件和refs
|
|
118
|
+
return { rootComponent: createComponent(children) };
|
|
119
|
+
}
|
|
120
|
+
function createCustomLayoutHandler(children, isHeader) {
|
|
121
|
+
return (args) => {
|
|
122
|
+
const { table, row, col, rect } = args;
|
|
123
|
+
const record = table.getCellOriginRecord(col, row);
|
|
124
|
+
const { height, width } = rect !== null && rect !== void 0 ? rect : table.getCellRect(col, row);
|
|
125
|
+
const customLayoutKey = isHeader ? 'headerCustomLayout' : 'customLayout';
|
|
126
|
+
if (!children[customLayoutKey]) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
const rootContainer = children[customLayoutKey]({ table, row, col, rect, record, height, width })[0];
|
|
130
|
+
const { rootComponent } = createCustomLayout(rootContainer, isHeader, args);
|
|
131
|
+
return {
|
|
132
|
+
rootContainer: rootComponent,
|
|
133
|
+
renderDefault: false
|
|
134
|
+
};
|
|
135
|
+
};
|
|
123
136
|
}
|
|
124
137
|
|
|
125
138
|
exports.createCustomLayout = createCustomLayout;
|
package/cjs/utils/slotUtils.js
CHANGED
|
@@ -2,96 +2,93 @@
|
|
|
2
2
|
|
|
3
3
|
var stringUtils = require('./stringUtils.js');
|
|
4
4
|
var customLayoutUtils = require('./customLayoutUtils.js');
|
|
5
|
-
require('tslib');
|
|
6
|
-
require('@visactor/vutils');
|
|
7
|
-
require('vue');
|
|
8
|
-
require('@visactor/vtable');
|
|
9
5
|
var util = require('../edit/util.js');
|
|
10
6
|
|
|
11
|
-
function extractPivotSlotOptions(vnodes) {
|
|
12
|
-
const options = {
|
|
13
|
-
columns: [],
|
|
14
|
-
columnHeaderTitle: [],
|
|
15
|
-
rows: [],
|
|
16
|
-
rowHeaderTitle: [],
|
|
17
|
-
indicators: [],
|
|
18
|
-
corner: {},
|
|
19
|
-
tooltip: {},
|
|
20
|
-
menu: {}
|
|
21
|
-
};
|
|
22
|
-
const typeMapping = {
|
|
23
|
-
PivotColumnDimension: 'columns',
|
|
24
|
-
PivotColumnHeaderTitle: 'columnHeaderTitle',
|
|
25
|
-
PivotRowDimension: 'rows',
|
|
26
|
-
PivotRowHeaderTitle: 'rowHeaderTitle',
|
|
27
|
-
PivotCorner: 'corner',
|
|
28
|
-
PivotIndicator: 'indicators',
|
|
29
|
-
Tooltip: 'tooltip',
|
|
30
|
-
Menu: 'menu'
|
|
31
|
-
};
|
|
32
|
-
vnodes.forEach(vnode => {
|
|
33
|
-
var _a, _b;
|
|
34
|
-
vnode.props = stringUtils.convertPropsToCamelCase(vnode.props);
|
|
35
|
-
const typeName = ((_a = vnode.type) === null || _a === void 0 ? void 0 : _a.symbol) || ((_b = vnode.type) === null || _b === void 0 ? void 0 : _b.name);
|
|
36
|
-
const optionKey = typeMapping[typeName];
|
|
37
|
-
if (optionKey) {
|
|
38
|
-
if (Array.isArray(options[optionKey])) {
|
|
39
|
-
if (vnode.props.hasOwnProperty('objectHandler')) {
|
|
40
|
-
options[optionKey].push(vnode.props.objectHandler);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
options[optionKey].push(vnode.props);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
options[optionKey] = vnode.props;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
return options;
|
|
52
|
-
}
|
|
53
|
-
function extractListSlotOptions(vnodes) {
|
|
54
|
-
const options = {
|
|
55
|
-
columns: [],
|
|
56
|
-
tooltip: {},
|
|
57
|
-
menu: {}
|
|
58
|
-
};
|
|
59
|
-
const typeMapping = {
|
|
60
|
-
ListColumn: 'columns',
|
|
61
|
-
Tooltip: 'tooltip',
|
|
62
|
-
Menu: 'menu'
|
|
63
|
-
};
|
|
64
|
-
vnodes.forEach(vnode => {
|
|
65
|
-
var _a, _b;
|
|
66
|
-
vnode.props = stringUtils.convertPropsToCamelCase(vnode.props);
|
|
67
|
-
const typeName = ((_a = vnode.type) === null || _a === void 0 ? void 0 : _a.symbol) || ((_b = vnode.type) === null || _b === void 0 ? void 0 : _b.name);
|
|
68
|
-
const optionKey = typeMapping[typeName];
|
|
69
|
-
if (optionKey) {
|
|
70
|
-
if (optionKey === 'columns' && vnode.children) {
|
|
71
|
-
if (vnode.children.customLayout) {
|
|
72
|
-
vnode.props.customLayout = customLayoutUtils.createCustomLayoutHandler(vnode.children);
|
|
73
|
-
}
|
|
74
|
-
if (vnode.children.headerCustomLayout) {
|
|
75
|
-
vnode.props.headerCustomLayout = customLayoutUtils.createCustomLayoutHandler(vnode.children, true);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
? slotOptions.rowHeaderTitle
|
|
94
|
-
|
|
7
|
+
function extractPivotSlotOptions(vnodes) {
|
|
8
|
+
const options = {
|
|
9
|
+
columns: [],
|
|
10
|
+
columnHeaderTitle: [],
|
|
11
|
+
rows: [],
|
|
12
|
+
rowHeaderTitle: [],
|
|
13
|
+
indicators: [],
|
|
14
|
+
corner: {},
|
|
15
|
+
tooltip: {},
|
|
16
|
+
menu: {}
|
|
17
|
+
};
|
|
18
|
+
const typeMapping = {
|
|
19
|
+
PivotColumnDimension: 'columns',
|
|
20
|
+
PivotColumnHeaderTitle: 'columnHeaderTitle',
|
|
21
|
+
PivotRowDimension: 'rows',
|
|
22
|
+
PivotRowHeaderTitle: 'rowHeaderTitle',
|
|
23
|
+
PivotCorner: 'corner',
|
|
24
|
+
PivotIndicator: 'indicators',
|
|
25
|
+
Tooltip: 'tooltip',
|
|
26
|
+
Menu: 'menu'
|
|
27
|
+
};
|
|
28
|
+
vnodes.forEach(vnode => {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
vnode.props = stringUtils.convertPropsToCamelCase(vnode.props);
|
|
31
|
+
const typeName = ((_a = vnode.type) === null || _a === void 0 ? void 0 : _a.symbol) || ((_b = vnode.type) === null || _b === void 0 ? void 0 : _b.name);
|
|
32
|
+
const optionKey = typeMapping[typeName];
|
|
33
|
+
if (optionKey) {
|
|
34
|
+
if (Array.isArray(options[optionKey])) {
|
|
35
|
+
if (vnode.props.hasOwnProperty('objectHandler')) {
|
|
36
|
+
options[optionKey].push(vnode.props.objectHandler);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
options[optionKey].push(vnode.props);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
options[optionKey] = vnode.props;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return options;
|
|
48
|
+
}
|
|
49
|
+
function extractListSlotOptions(vnodes) {
|
|
50
|
+
const options = {
|
|
51
|
+
columns: [],
|
|
52
|
+
tooltip: {},
|
|
53
|
+
menu: {}
|
|
54
|
+
};
|
|
55
|
+
const typeMapping = {
|
|
56
|
+
ListColumn: 'columns',
|
|
57
|
+
Tooltip: 'tooltip',
|
|
58
|
+
Menu: 'menu'
|
|
59
|
+
};
|
|
60
|
+
vnodes.forEach(vnode => {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
vnode.props = stringUtils.convertPropsToCamelCase(vnode.props);
|
|
63
|
+
const typeName = ((_a = vnode.type) === null || _a === void 0 ? void 0 : _a.symbol) || ((_b = vnode.type) === null || _b === void 0 ? void 0 : _b.name);
|
|
64
|
+
const optionKey = typeMapping[typeName];
|
|
65
|
+
if (optionKey) {
|
|
66
|
+
if (optionKey === 'columns' && vnode.children) {
|
|
67
|
+
if (vnode.children.customLayout) {
|
|
68
|
+
vnode.props.customLayout = customLayoutUtils.createCustomLayoutHandler(vnode.children);
|
|
69
|
+
}
|
|
70
|
+
if (vnode.children.headerCustomLayout) {
|
|
71
|
+
vnode.props.headerCustomLayout = customLayoutUtils.createCustomLayoutHandler(vnode.children, true);
|
|
72
|
+
}
|
|
73
|
+
// 校验编辑器
|
|
74
|
+
util.checkRenderEditor(vnode.props, vnode.children.edit);
|
|
75
|
+
}
|
|
76
|
+
if (Array.isArray(options[optionKey])) {
|
|
77
|
+
options[optionKey].push(vnode.props);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
options[optionKey] = vnode.props;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
return options;
|
|
85
|
+
}
|
|
86
|
+
function mergeSlotOptions(propsOptions, slotOptions) {
|
|
87
|
+
return Object.assign(Object.assign({}, propsOptions), { columns: slotOptions.columns && slotOptions.columns.length ? slotOptions.columns : propsOptions.columns, columnHeaderTitle: slotOptions.columnHeaderTitle && slotOptions.columnHeaderTitle.length
|
|
88
|
+
? slotOptions.columnHeaderTitle
|
|
89
|
+
: propsOptions.columnHeaderTitle, rows: slotOptions.rows && slotOptions.rows.length ? slotOptions.rows : propsOptions.rows, rowHeaderTitle: slotOptions.rowHeaderTitle && slotOptions.rowHeaderTitle.length
|
|
90
|
+
? slotOptions.rowHeaderTitle
|
|
91
|
+
: propsOptions.rowHeaderTitle, indicators: slotOptions.indicators && slotOptions.indicators.length ? slotOptions.indicators : propsOptions.indicators, corner: Object.keys(propsOptions.corner || {}).length ? propsOptions.corner : slotOptions.corner, tooltip: Object.keys(slotOptions.tooltip || {}).length ? slotOptions.tooltip : propsOptions.tooltip, menu: Object.keys(slotOptions.menu || {}).length ? slotOptions.menu : propsOptions.menu });
|
|
95
92
|
}
|
|
96
93
|
|
|
97
94
|
exports.extractListSlotOptions = extractListSlotOptions;
|
package/cjs/utils/stringUtils.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
// 将连字符形式的字符串转换为驼峰形式
|
|
4
|
+
function toCamelCase(str) {
|
|
5
|
+
return str.replace(/-([a-z])/g, g => g[1].toUpperCase());
|
|
6
|
+
}
|
|
7
|
+
// 将 vnode.props 中的所有属性名转换为驼峰形式
|
|
8
|
+
function convertPropsToCamelCase(props) {
|
|
9
|
+
const newProps = {};
|
|
10
|
+
for (const key in props) {
|
|
11
|
+
if (props.hasOwnProperty(key)) {
|
|
12
|
+
const camelCaseKey = toCamelCase(key);
|
|
13
|
+
newProps[camelCaseKey] = props[key];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return newProps;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
exports.convertPropsToCamelCase = convertPropsToCamelCase;
|
package/cjs/utils/vnodeUtils.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
// 展平嵌套的虚拟节点
|
|
4
|
+
function flattenVNodes(vnodes) {
|
|
5
|
+
return vnodes.flatMap(vnode => (Array.isArray(vnode.children) ? flattenVNodes(vnode.children) : vnode));
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
exports.flattenVNodes = flattenVNodes;
|