@oinone/kunlun-vue-admin-base 6.2.12 → 6.3.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.
Files changed (26) hide show
  1. package/dist/oinone-kunlun-vue-admin-base.css +1 -1
  2. package/dist/oinone-kunlun-vue-admin-base.esm.js +1146 -1062
  3. package/dist/oinone-kunlun-vue-admin-base.scss +1 -1
  4. package/dist/types/src/basic/form-item/DefaultFormItem.vue.d.ts +7 -6
  5. package/dist/types/src/container/collapse/DefaultCollapse.vue.d.ts +6 -0
  6. package/dist/types/src/container/collapse/DefaultCollapseWidget.d.ts +5 -1
  7. package/dist/types/src/field/form/float/Plat.vue.d.ts +2 -2
  8. package/dist/types/src/field/form/html/expressionRichtext/ExpressionRichText.vue.d.ts +7 -0
  9. package/dist/types/src/permission/permission/field/ActionPermissionWidget.d.ts +1 -1
  10. package/dist/types/src/typing/tree.d.ts +5 -0
  11. package/dist/types/src/view/tree/AbstractTreeElementWidget.d.ts +2 -0
  12. package/dist/types/src/view/tree/DefaultTree.vue.d.ts +15 -3
  13. package/package.json +22 -22
  14. package/src/basic/form-item/DefaultFormItem.vue +1 -1
  15. package/src/basic/table/BaseTableWidget.ts +5 -2
  16. package/src/container/collapse/DefaultCollapse.vue +7 -3
  17. package/src/container/collapse/DefaultCollapseWidget.ts +19 -1
  18. package/src/field/eip/form/work-scope/service.ts +4 -2
  19. package/src/field/form/html/expressionRichtext/ExpressionRichText.vue +17 -7
  20. package/src/permission/permission/field/ActionPermissionWidget.ts +3 -1
  21. package/src/typing/tree.ts +6 -0
  22. package/src/util/tree-utils.ts +24 -17
  23. package/src/view/tree/AbstractTreeElementWidget.ts +15 -1
  24. package/src/view/tree/DefaultTree.vue +19 -18
  25. package/src/view/tree/TreeWidget.ts +9 -2
  26. 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: import("vue").PropType<import("@oinone/kunlun-vue-ui-antd").FormLayout>;
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: import("vue").PropType<string | string[]>;
38
+ type: PropType<string | string[]>;
38
39
  };
39
40
  validatorInfo: {
40
- type: import("vue").PropType<import("../../typing").ValidatorInfo>;
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: import("vue").PropType<import("@oinone/kunlun-vue-ui-antd").FormLayout>;
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: import("vue").PropType<string | string[]>;
81
+ type: PropType<string | string[]>;
81
82
  };
82
83
  validatorInfo: {
83
- type: import("vue").PropType<import("../../typing").ValidatorInfo>;
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
- private activeKey;
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-common").FormLayout>;
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-common").FormLayout>;
144
+ type: PropType<import("@oinone/kunlun-vue-ui-antd").FormLayout>;
145
145
  };
146
146
  label: {
147
147
  type: (BooleanConstructor | StringConstructor)[];
@@ -17,6 +17,9 @@ declare const _default: import("vue").DefineComponent<{
17
17
  type: PropType<string[]>;
18
18
  default: () => never[];
19
19
  };
20
+ readonly: {
21
+ type: BooleanConstructor;
22
+ };
20
23
  }, {
21
24
  editorStyle: import("vue").ComputedRef<CSSStyle>;
22
25
  editorId: string;
@@ -55,7 +58,11 @@ declare const _default: import("vue").DefineComponent<{
55
58
  type: PropType<string[]>;
56
59
  default: () => never[];
57
60
  };
61
+ readonly: {
62
+ type: BooleanConstructor;
63
+ };
58
64
  }>>, {
59
65
  richTextToolbarExcludeKeys: string[];
66
+ readonly: boolean;
60
67
  }>;
61
68
  export default _default;
@@ -33,7 +33,7 @@ interface Menu {
33
33
  module: string;
34
34
  }
35
35
  export declare class ActionPermissionWidget extends FormFieldWidget<unknown, RuntimeO2MField> {
36
- private class;
36
+ get class(): string;
37
37
  initialize(props: any): this;
38
38
  /**
39
39
  * 挂载时
@@ -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 _default: import("vue").DefineComponent<{
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
- isSameModel: import("vue").ComputedRef<boolean>;
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 _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.12",
3
+ "version": "6.3.0",
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.12",
18
- "@oinone/kunlun-vue-router": "6.2.12",
19
- "@oinone/kunlun-vue-ui": "6.2.12",
20
- "@oinone/kunlun-vue-ui-antd": "6.2.12",
21
- "@oinone/kunlun-vue-ui-common": "6.2.12",
22
- "@oinone/kunlun-vue-ui-el": "6.2.12",
23
- "@oinone/kunlun-vue-widget": "6.2.12",
17
+ "@oinone/kunlun-vue-admin-layout": "6.3.0",
18
+ "@oinone/kunlun-vue-router": "6.3.0",
19
+ "@oinone/kunlun-vue-ui": "6.3.0",
20
+ "@oinone/kunlun-vue-ui-antd": "6.3.0",
21
+ "@oinone/kunlun-vue-ui-common": "6.3.0",
22
+ "@oinone/kunlun-vue-ui-el": "6.3.0",
23
+ "@oinone/kunlun-vue-widget": "6.3.0",
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",
@@ -29,20 +29,20 @@
29
29
  "smooth-signature": "1.0.15"
30
30
  },
31
31
  "devDependencies": {
32
- "@oinone/kunlun-dsl": "~6.2.0",
33
- "@oinone/kunlun-engine": "~6.2.0",
34
- "@oinone/kunlun-environment": "~6.2.0",
35
- "@oinone/kunlun-event": "~6.2.0",
36
- "@oinone/kunlun-expression": "~6.2.0",
37
- "@oinone/kunlun-meta": "~6.2.0",
38
- "@oinone/kunlun-request": "~6.2.0",
39
- "@oinone/kunlun-router": "~6.2.0",
40
- "@oinone/kunlun-service": "~6.2.0",
41
- "@oinone/kunlun-shared": "~6.2.0",
42
- "@oinone/kunlun-spi": "~6.2.0",
43
- "@oinone/kunlun-state": "~6.2.0",
44
- "@oinone/kunlun-theme": "~6.2.0",
45
- "@oinone/kunlun-vue-expression": "~6.2.0",
32
+ "@oinone/kunlun-dsl": "~6.3.0",
33
+ "@oinone/kunlun-engine": "~6.3.0",
34
+ "@oinone/kunlun-environment": "~6.3.0",
35
+ "@oinone/kunlun-event": "~6.3.0",
36
+ "@oinone/kunlun-expression": "~6.3.0",
37
+ "@oinone/kunlun-meta": "~6.3.0",
38
+ "@oinone/kunlun-request": "~6.3.0",
39
+ "@oinone/kunlun-router": "~6.3.0",
40
+ "@oinone/kunlun-service": "~6.3.0",
41
+ "@oinone/kunlun-shared": "~6.3.0",
42
+ "@oinone/kunlun-spi": "~6.3.0",
43
+ "@oinone/kunlun-state": "~6.3.0",
44
+ "@oinone/kunlun-theme": "~6.3.0",
45
+ "@oinone/kunlun-vue-expression": "~6.3.0",
46
46
  "@types/crypto-js": "4.1.1",
47
47
  "@types/file-saver": "2.0.7",
48
48
  "@types/lodash": "4.14.182",
@@ -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
 
@@ -14,7 +14,8 @@ import {
14
14
  RuntimeO2MField,
15
15
  SubmitCacheManager,
16
16
  SubmitValue,
17
- translateValueByKey
17
+ translateValueByKey,
18
+ RelationUpdateType
18
19
  } from '@oinone/kunlun-engine';
19
20
  import { Expression, ExpressionRunParam } from '@oinone/kunlun-expression';
20
21
  import { MessageHub } from '@oinone/kunlun-request';
@@ -340,13 +341,15 @@ export class BaseTableWidget<
340
341
  return false;
341
342
  }
342
343
  const data = await this.rowEditorClosedForSubmit(context);
344
+ const useDiffUpdate = [RelationUpdateType.diff, RelationUpdateType.batch].includes(this.relationUpdateType)
343
345
  if (this.inline) {
344
346
  if (res && data) {
345
- if (this.createMode) {
347
+ if (this.createMode && useDiffUpdate) {
346
348
  this.createSubviewFieldWidget(context, data);
347
349
  } else {
348
350
  this.updateSubviewFieldWidget(context, data);
349
351
  }
352
+
350
353
  }
351
354
  } else if (data) {
352
355
  try {
@@ -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
- if (props.expandAll && !props.accordion) {
62
- const panelKeys = origin.value?.getPanelKeys();
63
- if (panelKeys) {
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
- private activeKey: string | string[] | undefined;
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
  }
@@ -1,4 +1,5 @@
1
1
  import { http } from '@oinone/kunlun-service';
2
+ import { SYSTEM_MODULE_NAME } from '@oinone/kunlun-meta';
2
3
 
3
4
  export async function queryWorkScope() {
4
5
  const body = `
@@ -11,7 +12,7 @@ export async function queryWorkScope() {
11
12
  }
12
13
  }
13
14
  `;
14
- const result = await http.mutate('base', body);
15
+ const result = await http.mutate(SYSTEM_MODULE_NAME.EIP, body);
15
16
  return result.data.eipConnGroupQuery.queryListByWrapper as unknown as any[];
16
17
  }
17
18
 
@@ -25,6 +26,7 @@ export async function queryOpenInterface() {
25
26
  }
26
27
  }
27
28
  }`;
28
- const result = await http.mutate('base', body);
29
+ const result = await http.mutate(SYSTEM_MODULE_NAME.EIP, body);
29
30
  return result.data.eipOpenInterfaceQuery.queryListByWrapper as unknown as any[];
30
31
  }
32
+
@@ -14,17 +14,17 @@
14
14
  </div>
15
15
  </template>
16
16
  <script lang="ts">
17
- import { computed, onBeforeUnmount, PropType, ref, shallowRef, watch, defineComponent } from 'vue';
17
+ import { computed, defineComponent, nextTick, onBeforeUnmount, onMounted, PropType, ref, shallowRef, watch } from 'vue';
18
18
  import { ZH_CN_CODE } from '@oinone/kunlun-vue-ui-common';
19
19
  import { translateValueByKey } from '@oinone/kunlun-engine';
20
20
  import { Editor, Toolbar } from '@wangeditor/editor-for-vue';
21
- import { DomEditor, i18nChangeLanguage } from '@wangeditor/editor';
21
+ import { i18nChangeLanguage } from '@wangeditor/editor';
22
22
  import {
23
- IVariableContextItem,
24
- ExpressionElementClass,
25
- OioWangEditExpressionModalMenuConf,
26
23
  EXPRESSION_MODAL_CLASS_NAME,
27
- EXPRESSION_MODAL_PANEL_CLASS_NAME
24
+ EXPRESSION_MODAL_PANEL_CLASS_NAME,
25
+ ExpressionElementClass,
26
+ IVariableContextItem,
27
+ OioWangEditExpressionModalMenuConf
28
28
  } from '@oinone/kunlun-vue-expression';
29
29
  import '@wangeditor/editor/dist/css/style.css';
30
30
  import { CSSStyle, uniqueKeyGenerator } from '@oinone/kunlun-shared';
@@ -47,6 +47,9 @@ export default defineComponent({
47
47
  richTextToolbarExcludeKeys: {
48
48
  type: Array as PropType<string[]>,
49
49
  default: () => []
50
+ },
51
+ readonly: {
52
+ type: Boolean
50
53
  }
51
54
  },
52
55
  setup(props) {
@@ -75,7 +78,7 @@ export default defineComponent({
75
78
  const editorConfig = computed(() => {
76
79
  return {
77
80
  placeholder: `${translateValueByKey('请输入内容')}...`,
78
- EXTEND_CONF: { contextItems: props.contextItems }
81
+ EXTEND_CONF: { contextItems: props.contextItems },
79
82
  };
80
83
  });
81
84
 
@@ -142,6 +145,13 @@ export default defineComponent({
142
145
  });
143
146
  };
144
147
 
148
+ onMounted(async () => {
149
+ await nextTick();
150
+ if (props.readonly) {
151
+ editorRef.value.disable();
152
+ }
153
+ });
154
+
145
155
  // 组件销毁时,也及时销毁编辑器
146
156
  onBeforeUnmount(() => {
147
157
  editorRef.value.destroy?.();
@@ -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
- private class = 'oio-tree';
60
+ public get class() {
61
+ return 'oio-tree';
62
+ }
61
63
 
62
64
  public initialize(props) {
63
65
  super.initialize(props);
@@ -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
  */
@@ -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
- for (const widget of widgets) {
84
- const appendWidget = (targetWidget: DslDefinition) => {
85
- if (targetWidget.dslNodeType === TreeUtils.DSL_NODES_TYPE) {
86
- const nodesWidgets = targetWidget.widgets;
87
- if (nodesWidgets) {
88
- for (const nodeWidget of nodesWidgets) {
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
- } else if (targetWidget.dslNodeType === TreeUtils.DSL_NODE_TYPE) {
93
- appendChild(targetWidget);
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 isSameModel = computed(() => {
86
- let model: string | undefined;
87
- let metadata = props.rootNode?.value?.metadata;
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 !!model;
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
- isSameModel,
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 && this.isSameModel) {
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>