@oinone/kunlun-vue-admin-base 6.2.12 → 6.2.14
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/dist/oinone-kunlun-vue-admin-base.css +1 -1
- package/dist/oinone-kunlun-vue-admin-base.esm.js +1190 -1106
- package/dist/oinone-kunlun-vue-admin-base.scss +1 -1
- package/dist/types/src/basic/form-item/DefaultFormItem.vue.d.ts +7 -6
- package/dist/types/src/container/collapse/DefaultCollapse.vue.d.ts +6 -0
- package/dist/types/src/container/collapse/DefaultCollapseWidget.d.ts +5 -1
- package/dist/types/src/field/form/float/Plat.vue.d.ts +2 -2
- package/dist/types/src/file/excel/typing/index.d.ts +3 -1
- package/dist/types/src/permission/permission/field/ActionPermissionWidget.d.ts +1 -1
- package/dist/types/src/typing/tree.d.ts +5 -0
- package/dist/types/src/view/tree/AbstractTreeElementWidget.d.ts +2 -0
- package/dist/types/src/view/tree/DefaultTree.vue.d.ts +15 -3
- package/package.json +8 -8
- package/src/basic/form-item/DefaultFormItem.vue +1 -1
- package/src/container/collapse/DefaultCollapse.vue +7 -3
- package/src/container/collapse/DefaultCollapseWidget.ts +19 -1
- package/src/field/transfer/ExportFieldTransfer.ts +4 -2
- package/src/file/excel/action/ExportWorkbookActionWidget.ts +18 -4
- package/src/file/excel/typing/index.ts +1 -1
- package/src/permission/permission/field/ActionPermissionWidget.ts +3 -1
- package/src/typing/tree.ts +6 -0
- package/src/util/tree-utils.ts +24 -17
- package/src/view/tree/AbstractTreeElementWidget.ts +15 -1
- package/src/view/tree/DefaultTree.vue +19 -18
- package/src/view/tree/TreeWidget.ts +9 -2
- package/src/view/tree/style/index.scss +0 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
1
2
|
declare const _default: import("vue").DefineComponent<{
|
|
2
3
|
itemName: {
|
|
3
4
|
type: StringConstructor;
|
|
@@ -17,7 +18,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
17
18
|
default: boolean;
|
|
18
19
|
};
|
|
19
20
|
layout: {
|
|
20
|
-
type:
|
|
21
|
+
type: PropType<import("@oinone/kunlun-vue-ui-antd").FormLayout>;
|
|
21
22
|
};
|
|
22
23
|
label: {
|
|
23
24
|
type: (BooleanConstructor | StringConstructor)[];
|
|
@@ -34,10 +35,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
34
35
|
default: undefined;
|
|
35
36
|
};
|
|
36
37
|
validateTrigger: {
|
|
37
|
-
type:
|
|
38
|
+
type: PropType<string | string[]>;
|
|
38
39
|
};
|
|
39
40
|
validatorInfo: {
|
|
40
|
-
type:
|
|
41
|
+
type: PropType<import("../../typing").ValidatorInfo>;
|
|
41
42
|
};
|
|
42
43
|
}, {
|
|
43
44
|
required: import("vue").ComputedRef<boolean>;
|
|
@@ -60,7 +61,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
60
61
|
default: boolean;
|
|
61
62
|
};
|
|
62
63
|
layout: {
|
|
63
|
-
type:
|
|
64
|
+
type: PropType<import("@oinone/kunlun-vue-ui-antd").FormLayout>;
|
|
64
65
|
};
|
|
65
66
|
label: {
|
|
66
67
|
type: (BooleanConstructor | StringConstructor)[];
|
|
@@ -77,10 +78,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
77
78
|
default: undefined;
|
|
78
79
|
};
|
|
79
80
|
validateTrigger: {
|
|
80
|
-
type:
|
|
81
|
+
type: PropType<string | string[]>;
|
|
81
82
|
};
|
|
82
83
|
validatorInfo: {
|
|
83
|
-
type:
|
|
84
|
+
type: PropType<import("../../typing").ValidatorInfo>;
|
|
84
85
|
};
|
|
85
86
|
}>>, {
|
|
86
87
|
required: boolean;
|
|
@@ -11,6 +11,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
11
11
|
onActiveKeyChange: {
|
|
12
12
|
type: PropType<(key: string | string[]) => void>;
|
|
13
13
|
};
|
|
14
|
+
setAllKeys: {
|
|
15
|
+
type: PropType<(keys: string[]) => void>;
|
|
16
|
+
};
|
|
14
17
|
type: {
|
|
15
18
|
type: PropType<OioCollapseType | "bordered" | "stripe" | "simple" | "ghost">;
|
|
16
19
|
default: OioCollapseType;
|
|
@@ -59,6 +62,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
59
62
|
onActiveKeyChange: {
|
|
60
63
|
type: PropType<(key: string | string[]) => void>;
|
|
61
64
|
};
|
|
65
|
+
setAllKeys: {
|
|
66
|
+
type: PropType<(keys: string[]) => void>;
|
|
67
|
+
};
|
|
62
68
|
type: {
|
|
63
69
|
type: PropType<OioCollapseType | "bordered" | "stripe" | "simple" | "ghost">;
|
|
64
70
|
default: OioCollapseType;
|
|
@@ -2,7 +2,9 @@ import { BasePackWidget } from '../../basic';
|
|
|
2
2
|
export declare class DefaultCollapseWidget extends BasePackWidget {
|
|
3
3
|
protected defaultAllInvisible: boolean;
|
|
4
4
|
initialize(props: any): this;
|
|
5
|
-
|
|
5
|
+
protected allKeys: string[] | undefined;
|
|
6
|
+
setAllKeys(keys: string[]): void;
|
|
7
|
+
protected activeKey: string | string[] | undefined;
|
|
6
8
|
getActiveKey(): string | string[] | undefined;
|
|
7
9
|
setActiveKey(key: string | string[] | undefined): void;
|
|
8
10
|
onActiveKeyChange(key: string | string[]): void;
|
|
@@ -12,4 +14,6 @@ export declare class DefaultCollapseWidget extends BasePackWidget {
|
|
|
12
14
|
protected get collapseMethod(): string;
|
|
13
15
|
get accordion(): boolean | undefined;
|
|
14
16
|
protected get expandIconPosition(): any;
|
|
17
|
+
onExpandAll(): void;
|
|
18
|
+
onCollapseAll(): void;
|
|
15
19
|
}
|
|
@@ -47,7 +47,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
47
47
|
default: boolean;
|
|
48
48
|
};
|
|
49
49
|
layout: {
|
|
50
|
-
type: PropType<import("@oinone/kunlun-vue-ui-
|
|
50
|
+
type: PropType<import("@oinone/kunlun-vue-ui-antd").FormLayout>;
|
|
51
51
|
};
|
|
52
52
|
label: {
|
|
53
53
|
type: (BooleanConstructor | StringConstructor)[];
|
|
@@ -141,7 +141,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
141
141
|
default: boolean;
|
|
142
142
|
};
|
|
143
143
|
layout: {
|
|
144
|
-
type: PropType<import("@oinone/kunlun-vue-ui-
|
|
144
|
+
type: PropType<import("@oinone/kunlun-vue-ui-antd").FormLayout>;
|
|
145
145
|
};
|
|
146
146
|
label: {
|
|
147
147
|
type: (BooleanConstructor | StringConstructor)[];
|
|
@@ -7,7 +7,9 @@ export interface ExcelExportTask extends IdModel {
|
|
|
7
7
|
workbookDefinition?: ExcelWorkDefinition;
|
|
8
8
|
conditionWrapper?: QueryWrapper;
|
|
9
9
|
exportMethod?: ExcelExportMethodEnum;
|
|
10
|
-
selectedFields?: IModelField
|
|
10
|
+
selectedFields?: (IModelField & {
|
|
11
|
+
optionLabel?: string;
|
|
12
|
+
})[];
|
|
11
13
|
requestId?: string;
|
|
12
14
|
sync?: boolean;
|
|
13
15
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DslDefinition } from '@oinone/kunlun-dsl';
|
|
1
2
|
import { ActiveRecord, Pagination, RefreshCallChainingParameters } from '@oinone/kunlun-engine';
|
|
2
3
|
import { TreeNode } from '@oinone/kunlun-shared';
|
|
3
4
|
import { Slot } from 'vue';
|
|
@@ -61,6 +62,10 @@ export interface TreeNodeMetadata {
|
|
|
61
62
|
* 行内按钮插槽
|
|
62
63
|
*/
|
|
63
64
|
rowActionsSlot?: Slot;
|
|
65
|
+
/**
|
|
66
|
+
* 当配置了 nodes 节点时,根元数据节点具有该属性
|
|
67
|
+
*/
|
|
68
|
+
nodes?: DslDefinition;
|
|
64
69
|
/**
|
|
65
70
|
* 图标 iconfont/https
|
|
66
71
|
*/
|
|
@@ -26,6 +26,8 @@ export declare abstract class AbstractTreeElementWidget<V extends TreeData = Tre
|
|
|
26
26
|
get checkAll(): boolean | undefined;
|
|
27
27
|
get checkAllLabel(): any;
|
|
28
28
|
get searchRemote(): any;
|
|
29
|
+
get viewModel(): string | undefined;
|
|
30
|
+
get width(): string | undefined;
|
|
29
31
|
initialize(props: any): this;
|
|
30
32
|
protected runtimeInitialed(): void;
|
|
31
33
|
protected generatorRootNode(metadata: TreeNodeMetadata): OioTreeNode<V>;
|
|
@@ -3,13 +3,19 @@ import { ViewType } from '@oinone/kunlun-meta';
|
|
|
3
3
|
import { OioTreeNode } from '@oinone/kunlun-vue-ui-antd';
|
|
4
4
|
import { PropType } from 'vue';
|
|
5
5
|
import { TreeData } from '../../typing';
|
|
6
|
-
declare const
|
|
6
|
+
declare const __default__: import("vue").DefineComponent<{
|
|
7
7
|
viewType: {
|
|
8
8
|
type: PropType<ViewType>;
|
|
9
9
|
};
|
|
10
|
+
viewModel: {
|
|
11
|
+
type: StringConstructor;
|
|
12
|
+
};
|
|
10
13
|
template: {
|
|
11
14
|
type: PropType<DslDefinition>;
|
|
12
15
|
};
|
|
16
|
+
width: {
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
};
|
|
13
19
|
autoExpandParent: {
|
|
14
20
|
type: BooleanConstructor;
|
|
15
21
|
};
|
|
@@ -139,7 +145,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
139
145
|
};
|
|
140
146
|
}, {
|
|
141
147
|
treeData: import("vue").ComputedRef<OioTreeNode<TreeData>[]>;
|
|
142
|
-
|
|
148
|
+
width: import("vue").ComputedRef<string>;
|
|
143
149
|
internalExpandedKeys: import("vue").Ref<string[]>;
|
|
144
150
|
selectedKeys: import("vue").WritableComputedRef<string[]>;
|
|
145
151
|
expandedKeys: import("vue").WritableComputedRef<string[]>;
|
|
@@ -161,9 +167,15 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
161
167
|
viewType: {
|
|
162
168
|
type: PropType<ViewType>;
|
|
163
169
|
};
|
|
170
|
+
viewModel: {
|
|
171
|
+
type: StringConstructor;
|
|
172
|
+
};
|
|
164
173
|
template: {
|
|
165
174
|
type: PropType<DslDefinition>;
|
|
166
175
|
};
|
|
176
|
+
width: {
|
|
177
|
+
type: StringConstructor;
|
|
178
|
+
};
|
|
167
179
|
autoExpandParent: {
|
|
168
180
|
type: BooleanConstructor;
|
|
169
181
|
};
|
|
@@ -309,4 +321,4 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
309
321
|
enableSearch: boolean;
|
|
310
322
|
searchPlaceHolder: string;
|
|
311
323
|
}>;
|
|
312
|
-
export default
|
|
324
|
+
export default __default__;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oinone/kunlun-vue-admin-base",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.14",
|
|
4
4
|
"main": "index.ts",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prebuild": "rimraf dist",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"doc": "typedoc --out docs src/index.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@oinone/kunlun-vue-admin-layout": "6.2.
|
|
18
|
-
"@oinone/kunlun-vue-router": "6.2.
|
|
19
|
-
"@oinone/kunlun-vue-ui": "6.2.
|
|
20
|
-
"@oinone/kunlun-vue-ui-antd": "6.2.
|
|
21
|
-
"@oinone/kunlun-vue-ui-common": "6.2.
|
|
22
|
-
"@oinone/kunlun-vue-ui-el": "6.2.
|
|
23
|
-
"@oinone/kunlun-vue-widget": "6.2.
|
|
17
|
+
"@oinone/kunlun-vue-admin-layout": "6.2.14",
|
|
18
|
+
"@oinone/kunlun-vue-router": "6.2.14",
|
|
19
|
+
"@oinone/kunlun-vue-ui": "6.2.14",
|
|
20
|
+
"@oinone/kunlun-vue-ui-antd": "6.2.14",
|
|
21
|
+
"@oinone/kunlun-vue-ui-common": "6.2.14",
|
|
22
|
+
"@oinone/kunlun-vue-ui-el": "6.2.14",
|
|
23
|
+
"@oinone/kunlun-vue-widget": "6.2.14",
|
|
24
24
|
"@wangeditor/editor": "5.1.23",
|
|
25
25
|
"@wangeditor/editor-for-vue": "5.1.11",
|
|
26
26
|
"@wangeditor/plugin-upload-attachment": "1.1.0",
|
|
@@ -4,7 +4,7 @@ import { translateValueByKey } from '@oinone/kunlun-engine';
|
|
|
4
4
|
import { BooleanHelper } from '@oinone/kunlun-shared';
|
|
5
5
|
import { OioFormItem, PropRecordHelper } from '@oinone/kunlun-vue-ui-antd';
|
|
6
6
|
import { Tooltip as ATooltip } from 'ant-design-vue';
|
|
7
|
-
import { computed, createVNode, defineComponent, Slot, VNode, vShow, withDirectives } from 'vue';
|
|
7
|
+
import { computed, createVNode, defineComponent, PropType, Slot, VNode, vShow, withDirectives } from 'vue';
|
|
8
8
|
import { ValidatorStatus } from '../../typing';
|
|
9
9
|
import { BaseFormItemProps } from './props';
|
|
10
10
|
|
|
@@ -29,6 +29,9 @@ export default defineComponent({
|
|
|
29
29
|
onActiveKeyChange: {
|
|
30
30
|
type: Function as PropType<(key: string | string[]) => void>
|
|
31
31
|
},
|
|
32
|
+
setAllKeys: {
|
|
33
|
+
type: Function as PropType<(keys: string[]) => void>
|
|
34
|
+
},
|
|
32
35
|
type: {
|
|
33
36
|
type: String as PropType<OioCollapseType | keyof typeof OioCollapseType>,
|
|
34
37
|
default: OioCollapseType.bordered
|
|
@@ -58,9 +61,10 @@ export default defineComponent({
|
|
|
58
61
|
};
|
|
59
62
|
|
|
60
63
|
onMounted(() => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
const panelKeys = origin.value?.getPanelKeys();
|
|
65
|
+
if (panelKeys) {
|
|
66
|
+
props.setAllKeys?.(panelKeys);
|
|
67
|
+
if (props.expandAll && !props.accordion) {
|
|
64
68
|
onUpdateActiveKey(panelKeys);
|
|
65
69
|
}
|
|
66
70
|
}
|
|
@@ -17,7 +17,15 @@ export class DefaultCollapseWidget extends BasePackWidget {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
@Widget.Reactive()
|
|
20
|
-
|
|
20
|
+
protected allKeys: string[] | undefined;
|
|
21
|
+
|
|
22
|
+
@Widget.Method()
|
|
23
|
+
public setAllKeys(keys: string[]) {
|
|
24
|
+
this.allKeys = keys;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@Widget.Reactive()
|
|
28
|
+
protected activeKey: string | string[] | undefined;
|
|
21
29
|
|
|
22
30
|
public getActiveKey() {
|
|
23
31
|
return this.activeKey;
|
|
@@ -69,4 +77,14 @@ export class DefaultCollapseWidget extends BasePackWidget {
|
|
|
69
77
|
protected get expandIconPosition() {
|
|
70
78
|
return this.getDsl()?.expandIconPosition?.toLowerCase() || OioCollapseExpandIconPosition.right;
|
|
71
79
|
}
|
|
80
|
+
|
|
81
|
+
@Widget.Method()
|
|
82
|
+
public onExpandAll() {
|
|
83
|
+
this.setActiveKey(this.allKeys);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@Widget.Method()
|
|
87
|
+
public onCollapseAll() {
|
|
88
|
+
this.setActiveKey([]);
|
|
89
|
+
}
|
|
72
90
|
}
|
|
@@ -30,7 +30,8 @@ export class ExportFieldTransfer extends FormTransferFieldWidget {
|
|
|
30
30
|
return {
|
|
31
31
|
...target,
|
|
32
32
|
displayName: f.label || target.displayName,
|
|
33
|
-
invisible: f.invisible
|
|
33
|
+
invisible: f.invisible,
|
|
34
|
+
optionLabel: f.template?.optionLabel
|
|
34
35
|
};
|
|
35
36
|
})
|
|
36
37
|
.filter((v) => !!v && BooleanHelper.isFalse(v.invisible));
|
|
@@ -50,7 +51,8 @@ export class ExportFieldTransfer extends FormTransferFieldWidget {
|
|
|
50
51
|
}
|
|
51
52
|
return {
|
|
52
53
|
...o,
|
|
53
|
-
displayName: target.label || o.displayName
|
|
54
|
+
displayName: target.label || o.displayName,
|
|
55
|
+
optionLabel: target.template?.optionLabel
|
|
54
56
|
};
|
|
55
57
|
})
|
|
56
58
|
);
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ModelCache,
|
|
3
|
+
RuntimeContext,
|
|
4
|
+
RuntimeRelationField,
|
|
5
|
+
RuntimeServerAction,
|
|
6
|
+
SubmitValue
|
|
7
|
+
} from '@oinone/kunlun-engine';
|
|
2
8
|
import { ModelDefaultActionName } from '@oinone/kunlun-meta';
|
|
3
9
|
import { Condition, getSessionPath, GQL } from '@oinone/kunlun-request';
|
|
4
10
|
import { DEFAULT_TRUE_CONDITION } from '@oinone/kunlun-service';
|
|
@@ -25,7 +31,7 @@ export class ExportWorkbookActionWidget extends AbstractTaskAction<ExcelExportTa
|
|
|
25
31
|
return BooleanHelper.isTrue(this.metadataRuntimeContext.viewAction?.template?.sync);
|
|
26
32
|
}
|
|
27
33
|
|
|
28
|
-
protected generatorGQLByTask(task: ExcelExportTask, condition: string | Condition): Promise<string> {
|
|
34
|
+
protected async generatorGQLByTask(task: ExcelExportTask, condition: string | Condition): Promise<string> {
|
|
29
35
|
let queryData = '{}';
|
|
30
36
|
let rsql = condition;
|
|
31
37
|
if (condition instanceof Condition) {
|
|
@@ -43,6 +49,11 @@ export class ExportWorkbookActionWidget extends AbstractTaskAction<ExcelExportTa
|
|
|
43
49
|
: undefined;
|
|
44
50
|
|
|
45
51
|
const modelName = this.model.name || 'excelExportTask';
|
|
52
|
+
const excelExportTaskModel = await ModelCache.get('file.ExcelExportTask');
|
|
53
|
+
const selectedFieldsField = excelExportTaskModel?.modelFields.find(
|
|
54
|
+
(v) => v.data === 'selectedFields'
|
|
55
|
+
) as RuntimeRelationField;
|
|
56
|
+
const hasOptionLabel = selectedFieldsField.references === 'file.ExcelModelField';
|
|
46
57
|
return GQL.mutation(`${modelName}Mutation`, 'createExportTask')
|
|
47
58
|
.buildRequest((builder) => {
|
|
48
59
|
builder.buildObjectParameter('data', (builder) => {
|
|
@@ -65,8 +76,11 @@ export class ExportWorkbookActionWidget extends AbstractTaskAction<ExcelExportTa
|
|
|
65
76
|
}
|
|
66
77
|
if (selectedFields?.length) {
|
|
67
78
|
builder.buildArrayParameter('selectedFields', selectedFields, (builder, value) => {
|
|
68
|
-
builder.stringParameter('field', value.
|
|
79
|
+
builder.stringParameter('field', value.data);
|
|
69
80
|
builder.stringParameter('displayName', value.displayName);
|
|
81
|
+
if (hasOptionLabel) {
|
|
82
|
+
builder.stringParameter('optionLabel', value.optionLabel);
|
|
83
|
+
}
|
|
70
84
|
});
|
|
71
85
|
}
|
|
72
86
|
});
|
|
@@ -115,7 +129,7 @@ export class ExportWorkbookActionWidget extends AbstractTaskAction<ExcelExportTa
|
|
|
115
129
|
workbookDefinition: {
|
|
116
130
|
id: workbookId
|
|
117
131
|
}
|
|
118
|
-
};
|
|
132
|
+
} as ExcelExportTask;
|
|
119
133
|
break;
|
|
120
134
|
}
|
|
121
135
|
case ExcelExportMethodEnum.SELECT_TEMPLATE_FIELD: {
|
|
@@ -9,7 +9,7 @@ export interface ExcelExportTask extends IdModel {
|
|
|
9
9
|
workbookDefinition?: ExcelWorkDefinition;
|
|
10
10
|
conditionWrapper?: QueryWrapper;
|
|
11
11
|
exportMethod?: ExcelExportMethodEnum;
|
|
12
|
-
selectedFields?: IModelField[];
|
|
12
|
+
selectedFields?: (IModelField & { optionLabel?: string })[];
|
|
13
13
|
requestId?: string;
|
|
14
14
|
sync?: boolean;
|
|
15
15
|
}
|
|
@@ -57,7 +57,9 @@ let counter = 0;
|
|
|
57
57
|
@SPI.ClassFactory(FormFieldWidget.Token({ widget: 'action-permission' }))
|
|
58
58
|
export class ActionPermissionWidget extends FormFieldWidget<unknown, RuntimeO2MField> {
|
|
59
59
|
@Widget.Reactive()
|
|
60
|
-
|
|
60
|
+
public get class() {
|
|
61
|
+
return 'oio-tree';
|
|
62
|
+
}
|
|
61
63
|
|
|
62
64
|
public initialize(props) {
|
|
63
65
|
super.initialize(props);
|
package/src/typing/tree.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DslDefinition } from '@oinone/kunlun-dsl';
|
|
1
2
|
import { ActiveRecord, Pagination, RefreshCallChainingParameters } from '@oinone/kunlun-engine';
|
|
2
3
|
import { TreeNode } from '@oinone/kunlun-shared';
|
|
3
4
|
import { Slot } from 'vue';
|
|
@@ -64,6 +65,11 @@ export interface TreeNodeMetadata {
|
|
|
64
65
|
*/
|
|
65
66
|
rowActionsSlot?: Slot;
|
|
66
67
|
|
|
68
|
+
/**
|
|
69
|
+
* 当配置了 nodes 节点时,根元数据节点具有该属性
|
|
70
|
+
*/
|
|
71
|
+
nodes?: DslDefinition;
|
|
72
|
+
|
|
67
73
|
/**
|
|
68
74
|
* 图标 iconfont/https
|
|
69
75
|
*/
|
package/src/util/tree-utils.ts
CHANGED
|
@@ -44,6 +44,7 @@ export class TreeUtils {
|
|
|
44
44
|
}
|
|
45
45
|
let root: TreeNodeMetadata | undefined;
|
|
46
46
|
let parent: TreeNodeMetadata | undefined;
|
|
47
|
+
let nodes: DslDefinition | undefined;
|
|
47
48
|
const appendChild = (widget: DslDefinition) => {
|
|
48
49
|
const { model, title, label, labelFields, searchFields, references, selfReferences, filter, search, icon } =
|
|
49
50
|
widget;
|
|
@@ -80,28 +81,34 @@ export class TreeUtils {
|
|
|
80
81
|
}
|
|
81
82
|
parent = metadata;
|
|
82
83
|
};
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (
|
|
88
|
-
|
|
89
|
-
appendChild(nodeWidget);
|
|
90
|
-
}
|
|
84
|
+
const appendWidget = (targetWidget: DslDefinition) => {
|
|
85
|
+
if (targetWidget.dslNodeType === TreeUtils.DSL_NODES_TYPE) {
|
|
86
|
+
const nodesWidgets = targetWidget.widgets;
|
|
87
|
+
if (nodesWidgets) {
|
|
88
|
+
if (!nodes) {
|
|
89
|
+
nodes = targetWidget;
|
|
91
90
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
} else if (DslDefinitionHelper.isTemplate(targetWidget) && targetWidget.slot === DEFAULT_SLOT_NAME) {
|
|
95
|
-
const nodesWidgets = targetWidget.widgets;
|
|
96
|
-
if (nodesWidgets) {
|
|
97
|
-
for (const nodeWidget of nodesWidgets) {
|
|
98
|
-
appendWidget(nodeWidget);
|
|
99
|
-
}
|
|
91
|
+
for (const nodeWidget of nodesWidgets) {
|
|
92
|
+
appendChild(nodeWidget);
|
|
100
93
|
}
|
|
101
94
|
}
|
|
102
|
-
}
|
|
95
|
+
} else if (targetWidget.dslNodeType === TreeUtils.DSL_NODE_TYPE) {
|
|
96
|
+
appendChild(targetWidget);
|
|
97
|
+
} else if (DslDefinitionHelper.isTemplate(targetWidget) && targetWidget.slot === DEFAULT_SLOT_NAME) {
|
|
98
|
+
const nodesWidgets = targetWidget.widgets;
|
|
99
|
+
if (nodesWidgets) {
|
|
100
|
+
for (const nodeWidget of nodesWidgets) {
|
|
101
|
+
appendWidget(nodeWidget);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
for (const widget of widgets) {
|
|
103
107
|
appendWidget(widget);
|
|
104
108
|
}
|
|
109
|
+
if (root) {
|
|
110
|
+
root.nodes = nodes;
|
|
111
|
+
}
|
|
105
112
|
return root;
|
|
106
113
|
}
|
|
107
114
|
|
|
@@ -2,7 +2,7 @@ import { DEFAULT_SLOT_NAME } from '@oinone/kunlun-dsl';
|
|
|
2
2
|
import { ExpressionRunParam } from '@oinone/kunlun-expression';
|
|
3
3
|
import { ViewType } from '@oinone/kunlun-meta';
|
|
4
4
|
import { BooleanHelper, ReturnPromise, uniqueKeyGenerator } from '@oinone/kunlun-shared';
|
|
5
|
-
import { OioTreeNode } from '@oinone/kunlun-vue-ui-common';
|
|
5
|
+
import { OioTreeNode, StyleHelper } from '@oinone/kunlun-vue-ui-common';
|
|
6
6
|
import { Widget } from '@oinone/kunlun-vue-widget';
|
|
7
7
|
import { TreeNodeResponseBody, TreeService } from '../../service';
|
|
8
8
|
import { TreeData, TreeNodeMetadata } from '../../typing';
|
|
@@ -83,6 +83,20 @@ export abstract class AbstractTreeElementWidget<V extends TreeData = TreeData> e
|
|
|
83
83
|
return this.getDsl().searchRemote ?? true;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
@Widget.Reactive()
|
|
87
|
+
public get viewModel(): string | undefined {
|
|
88
|
+
return this.model.model;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@Widget.Reactive()
|
|
92
|
+
public get width(): string | undefined {
|
|
93
|
+
let { width } = this.getDsl();
|
|
94
|
+
if (width == null) {
|
|
95
|
+
width = this.treeDefinition?.nodes?.width;
|
|
96
|
+
}
|
|
97
|
+
return StyleHelper.px(width);
|
|
98
|
+
}
|
|
99
|
+
|
|
86
100
|
public initialize(props) {
|
|
87
101
|
if (!props.slotNames) {
|
|
88
102
|
props.slotNames = [DEFAULT_SLOT_NAME, CONTENT_SLOT_NAME, 'rowActions'];
|
|
@@ -44,9 +44,15 @@ export default defineComponent({
|
|
|
44
44
|
viewType: {
|
|
45
45
|
type: String as PropType<ViewType>
|
|
46
46
|
},
|
|
47
|
+
viewModel: {
|
|
48
|
+
type: String
|
|
49
|
+
},
|
|
47
50
|
template: {
|
|
48
51
|
type: Object as PropType<DslDefinition>
|
|
49
52
|
},
|
|
53
|
+
width: {
|
|
54
|
+
type: String
|
|
55
|
+
},
|
|
50
56
|
autoExpandParent: {
|
|
51
57
|
type: Boolean
|
|
52
58
|
},
|
|
@@ -82,23 +88,11 @@ export default defineComponent({
|
|
|
82
88
|
return treeNodeList;
|
|
83
89
|
});
|
|
84
90
|
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
while (metadata) {
|
|
89
|
-
const nodeModel = metadata.model;
|
|
90
|
-
if (nodeModel) {
|
|
91
|
-
if (model) {
|
|
92
|
-
if (model !== nodeModel) {
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
} else {
|
|
96
|
-
model = nodeModel;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
metadata = metadata.child;
|
|
91
|
+
const width = computed(() => {
|
|
92
|
+
if (props.width == null) {
|
|
93
|
+
return '234px';
|
|
100
94
|
}
|
|
101
|
-
return
|
|
95
|
+
return props.width;
|
|
102
96
|
});
|
|
103
97
|
|
|
104
98
|
const internalExpandedKeys = ref<string[]>([]);
|
|
@@ -182,7 +176,7 @@ export default defineComponent({
|
|
|
182
176
|
|
|
183
177
|
return {
|
|
184
178
|
treeData,
|
|
185
|
-
|
|
179
|
+
width,
|
|
186
180
|
|
|
187
181
|
internalExpandedKeys,
|
|
188
182
|
selectedKeys,
|
|
@@ -196,6 +190,7 @@ export default defineComponent({
|
|
|
196
190
|
};
|
|
197
191
|
},
|
|
198
192
|
render() {
|
|
193
|
+
const { viewModel } = this;
|
|
199
194
|
const treeComponent = createVNode(
|
|
200
195
|
OioTree,
|
|
201
196
|
{
|
|
@@ -241,7 +236,7 @@ export default defineComponent({
|
|
|
241
236
|
];
|
|
242
237
|
}
|
|
243
238
|
let rowActionsSlot = dataRef.value?.metadata?.rowActionsSlot;
|
|
244
|
-
if (!rowActionsSlot &&
|
|
239
|
+
if (!rowActionsSlot && dataRef.value?.metadata?.model === viewModel) {
|
|
245
240
|
rowActionsSlot = this.$slots.rowActions;
|
|
246
241
|
}
|
|
247
242
|
if (rowActionsSlot) {
|
|
@@ -331,3 +326,9 @@ export default defineComponent({
|
|
|
331
326
|
}
|
|
332
327
|
});
|
|
333
328
|
</script>
|
|
329
|
+
<style lang="scss">
|
|
330
|
+
.default-tree.default-tree-content-wrapper .oio-tree-wrapper {
|
|
331
|
+
width: v-bind('width');
|
|
332
|
+
flex-basis: v-bind('width');
|
|
333
|
+
}
|
|
334
|
+
</style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActiveRecord } from '@oinone/kunlun-engine';
|
|
1
|
+
import { ActiveRecord, ExperimentalConfigManager } from '@oinone/kunlun-engine';
|
|
2
2
|
import { ViewType } from '@oinone/kunlun-meta';
|
|
3
3
|
import { SPI } from '@oinone/kunlun-spi';
|
|
4
4
|
import { OioTreeNode } from '@oinone/kunlun-vue-ui-common';
|
|
@@ -18,7 +18,14 @@ export class TreeWidget extends AbstractTreeElementWidget {
|
|
|
18
18
|
protected showContent = true;
|
|
19
19
|
|
|
20
20
|
protected async onNodeSelected(node: OioTreeNode<TreeData>) {
|
|
21
|
-
|
|
21
|
+
if (ExperimentalConfigManager.treeWidgetNext()) {
|
|
22
|
+
const nodeModel = node.value.metadata?.model;
|
|
23
|
+
if (nodeModel === this.model.model) {
|
|
24
|
+
await this.onSelectedForQuery(node);
|
|
25
|
+
}
|
|
26
|
+
} else {
|
|
27
|
+
await this.onSelectedForQuery(node);
|
|
28
|
+
}
|
|
22
29
|
}
|
|
23
30
|
|
|
24
31
|
protected async onNodeUnselected(node: OioTreeNode<TreeData>) {
|