cnhis-design-vue 3.1.22-beta.8 → 3.1.22-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -123
- package/es/components/big-table/index.d.ts +0 -8
- package/es/components/big-table/src/BigTable.vue.d.ts +0 -8
- package/es/components/big-table/src/components/edit-form/useCommon.d.ts +4 -0
- package/es/components/big-table/style/index.css +1 -1
- package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
- package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
- package/es/components/bpmn-workflow/types/ModelingModule.d.ts +1 -0
- package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
- package/es/components/fabric-chart/src/utils/index.d.ts +6823 -0
- package/es/components/form-render/src/components/renderer/cascader.js +10 -7
- package/es/components/form-render/src/components/renderer/date.js +11 -4
- package/es/components/form-render/src/components/renderer/input.js +2 -2
- package/es/components/form-render/src/components/renderer/inputNumber.js +2 -2
- package/es/components/form-render/src/components/renderer/search.js +3 -3
- package/es/components/form-render/src/components/renderer/select.js +3 -3
- package/es/components/form-render/src/components/renderer/textarea.js +2 -2
- package/es/components/form-render/src/hooks/useCommonInjection2.js +6 -2
- package/es/components/form-render/src/utils/schema.d.ts +4 -1
- package/es/components/form-render/src/utils/schema.js +1 -1
- package/es/components/form-render/src/utils/schema2.js +9 -2
- package/es/components/iho-table/index.d.ts +229 -446
- package/es/components/iho-table/src/IhoTable.js +8 -5
- package/es/components/iho-table/src/IhoTable.vue.d.ts +229 -446
- package/es/components/iho-table/src/components/IhoTableColumn.js +2 -1
- package/es/components/iho-table/src/constants/index.d.ts +4 -2
- package/es/components/iho-table/src/constants/index.js +1 -1
- package/es/components/iho-table/src/constants/index2.js +15 -2
- package/es/components/iho-table/src/hooks/index.js +1 -1
- package/es/components/iho-table/src/hooks/tapHooks/index.d.ts +2 -2
- package/es/components/iho-table/src/hooks/tapHooks/index.js +1 -1
- package/es/components/iho-table/src/hooks/tapHooks/index2.js +42 -27
- package/es/components/iho-table/src/hooks/tapHooks/useFieldHooks.d.ts +4 -1
- package/es/components/iho-table/src/hooks/tapHooks/useFieldHooks2.js +4 -1
- package/es/components/iho-table/src/plugins/defaultConfigPlugin/index2.js +2 -1
- package/es/components/iho-table/src/plugins/index.d.ts +1 -0
- package/es/components/iho-table/src/plugins/index.js +1 -0
- package/es/components/iho-table/src/plugins/index2.js +1 -0
- package/es/components/iho-table/src/plugins/lowCodeFieldAdaptorPlugin/index2.js +10 -6
- package/es/components/iho-table/src/plugins/rowGroupSettingPlugin/index.d.ts +1 -0
- package/es/components/iho-table/src/plugins/rowGroupSettingPlugin/index.js +1 -0
- package/es/components/iho-table/src/plugins/rowGroupSettingPlugin/index2.js +72 -0
- package/es/components/iho-table/src/types/index.d.ts +23 -9
- package/es/components/iho-table/src/types/pluginType.d.ts +4 -1
- package/es/components/iho-table/src/utils/index.d.ts +2 -0
- package/es/components/iho-table/src/utils/index.js +1 -1
- package/es/components/iho-table/src/utils/index2.js +5 -1
- package/es/components/index.css +1 -1
- package/es/shared/utils/tapable/index.d.ts +139 -0
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineComponent, resolveComponent, createVNode } from 'vue';
|
|
2
|
+
import { omit } from 'lodash-es';
|
|
2
3
|
|
|
3
4
|
const ColumnComponent = defineComponent({
|
|
4
5
|
name: "IhoTableColumn",
|
|
@@ -15,7 +16,7 @@ const ColumnComponent = defineComponent({
|
|
|
15
16
|
return createVNode(VxeColumn, field, null);
|
|
16
17
|
}
|
|
17
18
|
function renderColumnGroup(group, children) {
|
|
18
|
-
return createVNode(VxeColumnGroup, group, {
|
|
19
|
+
return createVNode(VxeColumnGroup, omit(group, ["children"]), {
|
|
19
20
|
default: () => children.map((child) => createVNode(ColumnComponent, {
|
|
20
21
|
"field": child
|
|
21
22
|
}, null))
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Nullable } from '../../../../../es/shared/types';
|
|
2
2
|
import { InjectionKey, Ref } from 'vue';
|
|
3
3
|
import { VxeTableEventProps } from 'vxe-table/types/table';
|
|
4
|
-
import { IhoTableConfig } from '../../../../../es/components/iho-table';
|
|
4
|
+
import { IhoTableConfig, UnionToTuple } from '../../../../../es/components/iho-table';
|
|
5
5
|
export declare enum WIDGET_TYPE {
|
|
6
6
|
DEFAULT = "DEFAULT",
|
|
7
7
|
PICTURE = "PICTURE",
|
|
@@ -37,7 +37,9 @@ export declare enum WIDGET_TYPE {
|
|
|
37
37
|
BANK_CARD = "BANK_CARD",
|
|
38
38
|
SEQUENCE = "SEQUENCE"
|
|
39
39
|
}
|
|
40
|
-
export declare const
|
|
40
|
+
export declare const VxeEventListenerNameList: Readonly<UnionToTuple<keyof VxeTableEventProps>>;
|
|
41
|
+
export declare const IhoTableRowGroupSequence: readonly ["firstRowGroup", "secondRowGroup", "thirdRowGroup", "fourthRowGroup", "fifthRowGroup", "sixthRowGroup", "seventhRowGroup", "eighthRowGroup", "ninthRowGroup", "tenthRowGroup"];
|
|
42
|
+
export declare const HIGHEST_PRIORITY: number;
|
|
41
43
|
export declare enum INPUT_TYPE {
|
|
42
44
|
INPUT = "INPUT"
|
|
43
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { INPUT_TYPE,
|
|
1
|
+
export { HIGHEST_PRIORITY, INPUT_TYPE, IhoTableRowGroupSequence, InjectionIhoTableConfig, InjectionIhoTableEmits, VxeEventListenerNameList, WIDGET_TYPE } from './index2.js';
|
|
@@ -34,7 +34,7 @@ var WIDGET_TYPE = /* @__PURE__ */ ((WIDGET_TYPE2) => {
|
|
|
34
34
|
WIDGET_TYPE2["SEQUENCE"] = "SEQUENCE";
|
|
35
35
|
return WIDGET_TYPE2;
|
|
36
36
|
})(WIDGET_TYPE || {});
|
|
37
|
-
const
|
|
37
|
+
const VxeEventListenerNameList = Object.freeze([
|
|
38
38
|
"onKeydownStart",
|
|
39
39
|
"onKeydown",
|
|
40
40
|
"onKeydownEnd",
|
|
@@ -95,6 +95,19 @@ const IhoEventNameList = Object.freeze([
|
|
|
95
95
|
"onActiveCellChangeStart",
|
|
96
96
|
"onActiveCellChangeEnd"
|
|
97
97
|
]);
|
|
98
|
+
const IhoTableRowGroupSequence = [
|
|
99
|
+
"firstRowGroup",
|
|
100
|
+
"secondRowGroup",
|
|
101
|
+
"thirdRowGroup",
|
|
102
|
+
"fourthRowGroup",
|
|
103
|
+
"fifthRowGroup",
|
|
104
|
+
"sixthRowGroup",
|
|
105
|
+
"seventhRowGroup",
|
|
106
|
+
"eighthRowGroup",
|
|
107
|
+
"ninthRowGroup",
|
|
108
|
+
"tenthRowGroup"
|
|
109
|
+
];
|
|
110
|
+
const HIGHEST_PRIORITY = -Infinity;
|
|
98
111
|
var INPUT_TYPE = /* @__PURE__ */ ((INPUT_TYPE2) => {
|
|
99
112
|
INPUT_TYPE2["INPUT"] = "INPUT";
|
|
100
113
|
return INPUT_TYPE2;
|
|
@@ -102,4 +115,4 @@ var INPUT_TYPE = /* @__PURE__ */ ((INPUT_TYPE2) => {
|
|
|
102
115
|
const InjectionIhoTableConfig = Symbol("injectionIhoTableConfig ");
|
|
103
116
|
const InjectionIhoTableEmits = Symbol("InjectionIhoTableEmits ");
|
|
104
117
|
|
|
105
|
-
export { INPUT_TYPE,
|
|
118
|
+
export { HIGHEST_PRIORITY, INPUT_TYPE, IhoTableRowGroupSequence, InjectionIhoTableConfig, InjectionIhoTableEmits, VxeEventListenerNameList, WIDGET_TYPE };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { applyTableConfigHooks,
|
|
1
|
+
export { applyTableConfigHooks, applyTableFieldHooks, createTableEventHandlers, createTableHooks } from './tapHooks/index2.js';
|
|
2
2
|
export { defineTablePlugin, useTablePlugin } from './useTablePlugin2.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Nullable } from '../../../../../../es/shared/types';
|
|
1
|
+
import { Func, Nullable } from '../../../../../../es/shared/types';
|
|
2
2
|
import { MaybeRef } from '@vueuse/core';
|
|
3
3
|
import { VxeTableInstance } from 'vxe-table';
|
|
4
4
|
import { VxeTableEventProps } from 'vxe-table/types/table';
|
|
@@ -10,4 +10,4 @@ export declare const createTableHooks: () => Readonly<{
|
|
|
10
10
|
}>;
|
|
11
11
|
export declare function applyTableConfigHooks(hooks: TableHooks, config: IhoTableConfig): IhoTableConfig;
|
|
12
12
|
export declare function applyTableFieldHooks(hooks: TableHooks, fieldList: IhoTableFieldItem[], config: IhoTableConfig): IhoTableFieldItem[];
|
|
13
|
-
export declare function
|
|
13
|
+
export declare function createTableEventHandlers(hooks: TableHooks, config: MaybeRef<IhoTableConfig>, $table: MaybeRef<Nullable<VxeTableInstance>>, emits: Func): Record<keyof VxeTableEventProps, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { applyTableConfigHooks,
|
|
1
|
+
export { applyTableConfigHooks, applyTableFieldHooks, createTableEventHandlers, createTableHooks } from './index2.js';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { arrayed } from '../../../../../shared/utils/index2.js';
|
|
2
2
|
import { unref } from 'vue';
|
|
3
|
-
import { cloneDeep } from 'lodash-es';
|
|
4
|
-
import {
|
|
3
|
+
import { cloneDeep, isArray } from 'lodash-es';
|
|
4
|
+
import { VxeEventListenerNameList } from '../../constants/index2.js';
|
|
5
5
|
import { useEventHooks } from './useEventHooks2.js';
|
|
6
|
+
import { getEventName } from '../../utils/index2.js';
|
|
6
7
|
import { useConfigHooks } from './useConfigHooks2.js';
|
|
7
8
|
import { useFieldHooks } from './useFieldHooks2.js';
|
|
8
9
|
|
|
@@ -46,37 +47,51 @@ function applyTableConfigHooks(hooks, config) {
|
|
|
46
47
|
return result;
|
|
47
48
|
}
|
|
48
49
|
function applyTableFieldHooks(hooks, fieldList, config) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
50
|
+
hooks.fieldHooks.fieldStart.promise(config);
|
|
51
|
+
let result = traverseFieldList(cloneDeep(fieldList));
|
|
52
|
+
result = hooks.fieldHooks.fieldList.call(result, config);
|
|
53
|
+
hooks.fieldHooks.fieldEnd.promise(config);
|
|
54
|
+
return result;
|
|
55
|
+
function traverseFieldList(fieldList2) {
|
|
56
|
+
return fieldList2.reduce((finFieldList, field, index) => {
|
|
57
|
+
const before = [];
|
|
58
|
+
const after = [];
|
|
59
|
+
let removed = false;
|
|
60
|
+
field = hooks.fieldHooks.field.call(field, {
|
|
61
|
+
index,
|
|
62
|
+
remove() {
|
|
63
|
+
removed = true;
|
|
64
|
+
},
|
|
65
|
+
insertAfter(field2) {
|
|
66
|
+
after.push(...arrayed(field2));
|
|
67
|
+
},
|
|
68
|
+
insertBefore(field2) {
|
|
69
|
+
before.push(...arrayed(field2));
|
|
70
|
+
}
|
|
71
|
+
}, config);
|
|
72
|
+
finFieldList = finFieldList.concat(before);
|
|
73
|
+
if (!removed) {
|
|
74
|
+
finFieldList.push(field);
|
|
75
|
+
if (isArray(field.children)) {
|
|
76
|
+
field.children = traverseFieldList(field.children);
|
|
77
|
+
}
|
|
63
78
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return finFieldList;
|
|
69
|
-
}, []);
|
|
79
|
+
finFieldList = finFieldList.concat(after);
|
|
80
|
+
return finFieldList;
|
|
81
|
+
}, []);
|
|
82
|
+
}
|
|
70
83
|
}
|
|
71
|
-
function
|
|
72
|
-
const handler = (
|
|
84
|
+
function createTableEventHandlers(hooks, config, $table, emits) {
|
|
85
|
+
const handler = (eventListenerName, payload) => {
|
|
73
86
|
var _a;
|
|
74
|
-
(
|
|
87
|
+
if (VxeEventListenerNameList.includes(eventListenerName))
|
|
88
|
+
emits(getEventName(eventListenerName), payload);
|
|
89
|
+
(_a = hooks.eventHooks[eventListenerName]) == null ? void 0 : _a.promise(payload, unref(config), unref($table));
|
|
75
90
|
};
|
|
76
|
-
return
|
|
91
|
+
return VxeEventListenerNameList.reduce((result, eventName) => {
|
|
77
92
|
result[eventName] = (payload) => handler(eventName, payload);
|
|
78
93
|
return result;
|
|
79
94
|
}, {});
|
|
80
95
|
}
|
|
81
96
|
|
|
82
|
-
export { applyTableConfigHooks,
|
|
97
|
+
export { applyTableConfigHooks, applyTableFieldHooks, createTableEventHandlers, createTableHooks };
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { SyncWaterfallHook } from '../../../../../../es/shared/utils/tapable';
|
|
1
|
+
import { AsyncParallelHook, SyncWaterfallHook } from '../../../../../../es/shared/utils/tapable';
|
|
2
2
|
import { FieldHookContext, IhoTableFieldItem } from '../../../../../../es/components/iho-table/src/types';
|
|
3
3
|
import { AbstractFieldHooks } from '../../../../../../es/components/iho-table/src/types';
|
|
4
4
|
declare class FieldHooks extends AbstractFieldHooks {
|
|
5
|
+
readonly fieldStart: AsyncParallelHook<[import("../../../../../../es/components/iho-table/src/types").IhoTableConfig], import("../../../../../../es/shared/utils/tapable").UnsetAdditionalOptions>;
|
|
5
6
|
readonly field: SyncWaterfallHook<[IhoTableFieldItem, FieldHookContext, import("../../../../../../es/components/iho-table/src/types").IhoTableConfig], import("../../../../../../es/shared/utils/tapable").UnsetAdditionalOptions>;
|
|
7
|
+
readonly fieldList: SyncWaterfallHook<[IhoTableFieldItem[], import("../../../../../../es/components/iho-table/src/types").IhoTableConfig], import("../../../../../../es/shared/utils/tapable").UnsetAdditionalOptions>;
|
|
8
|
+
readonly fieldEnd: AsyncParallelHook<[import("../../../../../../es/components/iho-table/src/types").IhoTableConfig], import("../../../../../../es/shared/utils/tapable").UnsetAdditionalOptions>;
|
|
6
9
|
}
|
|
7
10
|
export declare function useFieldHooks(): {
|
|
8
11
|
create: () => FieldHooks;
|
|
@@ -2,7 +2,7 @@ import '../../../../../shared/utils/tapable/SyncHook.js';
|
|
|
2
2
|
import '../../../../../shared/utils/tapable/SyncBailHook.js';
|
|
3
3
|
import SyncWaterfallHook from '../../../../../shared/utils/tapable/SyncWaterfallHook.js';
|
|
4
4
|
import '../../../../../shared/utils/tapable/SyncLoopHook.js';
|
|
5
|
-
import '../../../../../shared/utils/tapable/AsyncParallelHook.js';
|
|
5
|
+
import AsyncParallelHook from '../../../../../shared/utils/tapable/AsyncParallelHook.js';
|
|
6
6
|
import '../../../../../shared/utils/tapable/AsyncParallelBailHook.js';
|
|
7
7
|
import '../../../../../shared/utils/tapable/AsyncSeriesHook.js';
|
|
8
8
|
import '../../../../../shared/utils/tapable/AsyncSeriesBailHook.js';
|
|
@@ -13,11 +13,14 @@ import { AbstractFieldHooks } from '../../types/pluginType2.js';
|
|
|
13
13
|
class FieldHooks extends AbstractFieldHooks {
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments);
|
|
16
|
+
this.fieldStart = new AsyncParallelHook(["config"]);
|
|
16
17
|
this.field = new SyncWaterfallHook([
|
|
17
18
|
"fieldItem",
|
|
18
19
|
"context",
|
|
19
20
|
"config"
|
|
20
21
|
]);
|
|
22
|
+
this.fieldList = new SyncWaterfallHook(["fieldList", "config"]);
|
|
23
|
+
this.fieldEnd = new AsyncParallelHook(["config"]);
|
|
21
24
|
}
|
|
22
25
|
}
|
|
23
26
|
function useFieldHooks() {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { mergeWith } from 'lodash-es';
|
|
2
|
+
import { HIGHEST_PRIORITY } from '../../constants/index2.js';
|
|
2
3
|
import { defineTablePlugin } from '../../hooks/useTablePlugin2.js';
|
|
3
4
|
|
|
4
5
|
function defaultConfigPlugin() {
|
|
@@ -6,7 +7,7 @@ function defaultConfigPlugin() {
|
|
|
6
7
|
return defineTablePlugin({
|
|
7
8
|
name: pluginName,
|
|
8
9
|
apply(hooks) {
|
|
9
|
-
hooks.configHooks.config.tap({ name: pluginName, stage:
|
|
10
|
+
hooks.configHooks.config.tap({ name: pluginName, stage: HIGHEST_PRIORITY }, (config) => {
|
|
10
11
|
return mergeWith({
|
|
11
12
|
height: "100%",
|
|
12
13
|
border: true,
|
|
@@ -7,3 +7,4 @@ export { seqRendererPlugin } from './rendererPlugins/widgets/seqRendererPlugin.j
|
|
|
7
7
|
export { checkRendererPlugin } from './rendererPlugins/widgets/checkRendererPlugin.js';
|
|
8
8
|
export { pictureRendererPlugin } from './rendererPlugins/widgets/pictureRendererPlugin.js';
|
|
9
9
|
export { inputRendererPlugins } from './rendererPlugins/inputs/inputRendererPlugins.js';
|
|
10
|
+
export { rowGroupSettingPlugin } from './rowGroupSettingPlugin/index2.js';
|
|
@@ -7,3 +7,4 @@ export { seqRendererPlugin } from './rendererPlugins/widgets/seqRendererPlugin.j
|
|
|
7
7
|
export { checkRendererPlugin } from './rendererPlugins/widgets/checkRendererPlugin.js';
|
|
8
8
|
export { pictureRendererPlugin } from './rendererPlugins/widgets/pictureRendererPlugin.js';
|
|
9
9
|
export { inputRendererPlugins } from './rendererPlugins/inputs/inputRendererPlugins.js';
|
|
10
|
+
export { rowGroupSettingPlugin } from './rowGroupSettingPlugin/index2.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { pick } from 'lodash-es';
|
|
2
|
-
import { WIDGET_TYPE } from '../../constants/index2.js';
|
|
2
|
+
import { HIGHEST_PRIORITY, WIDGET_TYPE } from '../../constants/index2.js';
|
|
3
3
|
import { defineTablePlugin } from '../../hooks/useTablePlugin2.js';
|
|
4
4
|
|
|
5
5
|
function lowCodeFieldAdaptorPlugin() {
|
|
@@ -7,7 +7,7 @@ function lowCodeFieldAdaptorPlugin() {
|
|
|
7
7
|
return defineTablePlugin({
|
|
8
8
|
name: pluginName,
|
|
9
9
|
apply(hooks) {
|
|
10
|
-
hooks.fieldHooks.field.tap({ name: pluginName, stage:
|
|
10
|
+
hooks.fieldHooks.field.tap({ name: pluginName, stage: HIGHEST_PRIORITY }, (field) => {
|
|
11
11
|
const _field = field;
|
|
12
12
|
const result = {
|
|
13
13
|
field: _field.columnName,
|
|
@@ -15,14 +15,18 @@ function lowCodeFieldAdaptorPlugin() {
|
|
|
15
15
|
showOverflow: "tooltip",
|
|
16
16
|
...pick(_field, ["title"])
|
|
17
17
|
};
|
|
18
|
-
|
|
19
|
-
result.editRender = { name: _field.settingObj.attr || "DEFAULT" };
|
|
20
|
-
result.editRender.enabled = !Reflect.get(WIDGET_TYPE, result.editRender.name);
|
|
21
|
-
}
|
|
18
|
+
settingObjAdaptor(_field.settingObj, result);
|
|
22
19
|
return result;
|
|
23
20
|
});
|
|
24
21
|
}
|
|
25
22
|
});
|
|
26
23
|
}
|
|
24
|
+
function settingObjAdaptor(settingObj, fieldItem) {
|
|
25
|
+
if (!settingObj)
|
|
26
|
+
return;
|
|
27
|
+
fieldItem.editRender = { name: settingObj.attr || "DEFAULT" };
|
|
28
|
+
fieldItem.editRender.enabled = !Reflect.get(WIDGET_TYPE, fieldItem.editRender.name);
|
|
29
|
+
fieldItem.visible = settingObj.isHide !== "1";
|
|
30
|
+
}
|
|
27
31
|
|
|
28
32
|
export { lowCodeFieldAdaptorPlugin };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function rowGroupSettingPlugin(): import("../../../../../../es/components/iho-table").TablePlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { rowGroupSettingPlugin } from './index2.js';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { isObject } from '@vue/shared';
|
|
2
|
+
import { isArray, isString } from 'lodash-es';
|
|
3
|
+
import '../../../index2.js';
|
|
4
|
+
import { IhoTableRowGroupSequence } from '../../constants/index2.js';
|
|
5
|
+
import { defineTablePlugin } from '../../hooks/useTablePlugin2.js';
|
|
6
|
+
|
|
7
|
+
function rowGroupSettingPlugin() {
|
|
8
|
+
const pluginName = "rowGroupSettingPlugin";
|
|
9
|
+
return defineTablePlugin({
|
|
10
|
+
name: pluginName,
|
|
11
|
+
apply(hooks) {
|
|
12
|
+
hooks.fieldHooks.fieldList.tap(pluginName, (fieldList, config) => {
|
|
13
|
+
if (!isObject(config.rowGroupSetting))
|
|
14
|
+
return fieldList;
|
|
15
|
+
return groupTraverser(createRowGroupList(config.rowGroupSetting, fieldList), (fieldName, isBlock) => {
|
|
16
|
+
if (isBlock)
|
|
17
|
+
return { field: fieldName, title: fieldName };
|
|
18
|
+
return fieldSearcher(fieldName, fieldList);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function fieldSearcher(fieldName, fieldList) {
|
|
25
|
+
return fieldList.find((field) => field.field === fieldName);
|
|
26
|
+
}
|
|
27
|
+
function createRowGroupList(rowGroupSetting, fieldList) {
|
|
28
|
+
const result = fieldList.map((field) => field.field);
|
|
29
|
+
IhoTableRowGroupSequence.some((sequence) => {
|
|
30
|
+
const currentLevelGroup = rowGroupSetting[sequence];
|
|
31
|
+
if (!isArray(currentLevelGroup))
|
|
32
|
+
return true;
|
|
33
|
+
currentLevelGroup.forEach((groupSetting) => {
|
|
34
|
+
if (!isArray(groupSetting.list) || !groupSetting.list.length)
|
|
35
|
+
return;
|
|
36
|
+
const children = [];
|
|
37
|
+
groupSetting.list.forEach((fieldName, idx) => {
|
|
38
|
+
const groupIdx = groupIndexSearcher(fieldName, result);
|
|
39
|
+
if (!~groupIdx)
|
|
40
|
+
return;
|
|
41
|
+
children.push(result[groupIdx]);
|
|
42
|
+
if (idx === 0) {
|
|
43
|
+
result.splice(groupIdx, 1, { fieldName: groupSetting.title, children });
|
|
44
|
+
} else {
|
|
45
|
+
result.splice(groupIdx, 1);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
return result;
|
|
51
|
+
function groupIndexSearcher(fieldName, groupList) {
|
|
52
|
+
return groupList.findIndex((group) => (isObject(group) ? group.fieldName : group) === fieldName);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function groupTraverser(groupList, replacer) {
|
|
56
|
+
return groupList.reduce((result, group) => {
|
|
57
|
+
if (isString(group)) {
|
|
58
|
+
const item = replacer(group);
|
|
59
|
+
item && result.push(item);
|
|
60
|
+
}
|
|
61
|
+
if (isObject(group) && group.children) {
|
|
62
|
+
const item = replacer(group.fieldName, true);
|
|
63
|
+
if (item) {
|
|
64
|
+
item.children = groupTraverser(group.children, replacer);
|
|
65
|
+
result.push(item);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
69
|
+
}, []);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export { rowGroupSettingPlugin };
|
|
@@ -1,20 +1,33 @@
|
|
|
1
1
|
import { AnyObject } from '../../../../../es/shared/types';
|
|
2
2
|
import { VxeTableProps, VxeTableDefines } from 'vxe-table';
|
|
3
|
+
import { IhoTableRowGroupSequence } from '../../../../../es/components/iho-table/src/constants';
|
|
3
4
|
export * from './pluginType';
|
|
4
|
-
export interface
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
[K: string]: unknown;
|
|
5
|
+
export interface IhoTableRowGroupItem {
|
|
6
|
+
groupName: string;
|
|
7
|
+
title: string;
|
|
8
|
+
list: string[];
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
declare type TupleToUnion<T extends readonly any[]> = T extends readonly [infer L, ...infer R] ? L | TupleToUnion<R> : never;
|
|
11
|
+
declare type UnionToIntersectionFn<U> = (U extends unknown ? (k: () => U) => void : never) extends (k: infer I) => void ? I : never;
|
|
12
|
+
declare type GetUnionLast<U> = UnionToIntersectionFn<U> extends () => infer I ? I : never;
|
|
13
|
+
declare type Prepend<Tuple extends unknown[], First> = [First, ...Tuple];
|
|
14
|
+
export declare type UnionToTuple<Union, T extends unknown[] = [], Last = GetUnionLast<Union>> = [Union] extends [never] ? T : UnionToTuple<Exclude<Union, Last>, Prepend<T, Last>>;
|
|
15
|
+
export declare type IhoTableConfig = VxeTableProps & Partial<{
|
|
16
|
+
showSeq: boolean;
|
|
17
|
+
selectType: Exclude<VxeTableDefines.ColumnInfo['type'], 'seq' | 'expand' | 'html'>;
|
|
18
|
+
rowGroupSetting: Partial<Record<TupleToUnion<typeof IhoTableRowGroupSequence>, IhoTableRowGroupItem[]>>;
|
|
19
|
+
[K: string]: unknown;
|
|
20
|
+
}>;
|
|
21
|
+
export declare type IhoTableFieldItem = {
|
|
22
|
+
[K in keyof VxeTableDefines.ColumnInfo]?: K extends 'children' ? IhoTableFieldItem[] : K extends keyof VxeTableDefines.ColumnInfo ? VxeTableDefines.ColumnInfo[K] : never;
|
|
23
|
+
} & {
|
|
12
24
|
[K: string]: unknown;
|
|
13
25
|
};
|
|
14
|
-
|
|
26
|
+
declare type LowCodeTableSettingObj = Partial<{
|
|
15
27
|
attr: string;
|
|
28
|
+
isHide: '0' | '1';
|
|
16
29
|
[K: string]: unknown;
|
|
17
|
-
}
|
|
30
|
+
}>;
|
|
18
31
|
export declare type LowCodeTableFieldItem = {
|
|
19
32
|
columnName: string;
|
|
20
33
|
[K: string]: unknown;
|
|
@@ -30,3 +43,4 @@ export declare type IhoFormChangePayload = {
|
|
|
30
43
|
value: unknown;
|
|
31
44
|
index: number;
|
|
32
45
|
};
|
|
46
|
+
export declare type EventListenerToEventName<T extends string> = T extends `on${infer R}` ? R extends `${infer F}${infer L}` ? `${Lowercase<F>}${L}` : never : never;
|
|
@@ -22,7 +22,7 @@ export declare type TableHooks = Readonly<{
|
|
|
22
22
|
fieldHooks: AbstractFieldHooks;
|
|
23
23
|
eventHooks: AbstractEventHooks;
|
|
24
24
|
}>;
|
|
25
|
-
export declare type WithTableConfig<T> = T extends any[] ? [...T, IhoTableConfig] : [T, IhoTableConfig];
|
|
25
|
+
export declare type WithTableConfig<T = []> = T extends any[] ? [...T, IhoTableConfig] : [T, IhoTableConfig];
|
|
26
26
|
export declare abstract class AbstractConfigHooks {
|
|
27
27
|
abstract readonly config: SyncWaterfallHook<IhoTableConfig>;
|
|
28
28
|
abstract readonly rowConfig: SyncWaterfallHook<WithTableConfig<IhoTableConfig['rowConfig']>>;
|
|
@@ -50,7 +50,10 @@ export interface FieldHookContext {
|
|
|
50
50
|
insertAfter(field: ArrayAble<IhoTableFieldItem>): void;
|
|
51
51
|
}
|
|
52
52
|
export declare abstract class AbstractFieldHooks {
|
|
53
|
+
abstract readonly fieldStart: AsyncParallelHook<WithTableConfig>;
|
|
53
54
|
abstract readonly field: SyncWaterfallHook<WithTableConfig<[IhoTableFieldItem, FieldHookContext]>>;
|
|
55
|
+
abstract readonly fieldList: SyncWaterfallHook<WithTableConfig<[IhoTableFieldItem[]]>>;
|
|
56
|
+
abstract readonly fieldEnd: AsyncParallelHook<WithTableConfig>;
|
|
54
57
|
}
|
|
55
58
|
export declare type WithIhoEventContext<T> = T extends any[] ? [...T, IhoTableConfig, Nullable<VxeTableInstance>] : [T, IhoTableConfig, Nullable<VxeTableInstance>];
|
|
56
59
|
declare type VxeEventTypes = Required<{
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { EventListenerToEventName } from '../../../../../es/components/iho-table';
|
|
1
2
|
export declare function IhoTableLog(message: string): void;
|
|
2
3
|
export declare function IhoTableWarn(message: string): void;
|
|
3
4
|
export declare function getRowHeight(): number;
|
|
5
|
+
export declare function getEventName<T extends string>(eventListenerName: T): EventListenerToEventName<T>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { IhoTableLog, IhoTableWarn, getRowHeight } from './index2.js';
|
|
1
|
+
export { IhoTableLog, IhoTableWarn, getEventName, getRowHeight } from './index2.js';
|
|
@@ -15,5 +15,9 @@ function getRowHeight() {
|
|
|
15
15
|
}
|
|
16
16
|
return (_c = (_b = (_a = config == null ? void 0 : config.value) == null ? void 0 : _a.rowConfig) == null ? void 0 : _b.height) != null ? _c : 32;
|
|
17
17
|
}
|
|
18
|
+
function getEventName(eventListenerName) {
|
|
19
|
+
const eventName = eventListenerName.slice(2);
|
|
20
|
+
return `${eventName[0].toLowerCase()}${eventName.slice(1)}`;
|
|
21
|
+
}
|
|
18
22
|
|
|
19
|
-
export { IhoTableLog, IhoTableWarn, getRowHeight };
|
|
23
|
+
export { IhoTableLog, IhoTableWarn, getEventName, getRowHeight };
|