@oinone/kunlun-vue-admin-base 6.2.12 → 6.2.13

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.
@@ -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)[];
@@ -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.2.13",
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.2.13",
18
+ "@oinone/kunlun-vue-router": "6.2.13",
19
+ "@oinone/kunlun-vue-ui": "6.2.13",
20
+ "@oinone/kunlun-vue-ui-antd": "6.2.13",
21
+ "@oinone/kunlun-vue-ui-common": "6.2.13",
22
+ "@oinone/kunlun-vue-ui-el": "6.2.13",
23
+ "@oinone/kunlun-vue-widget": "6.2.13",
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
- 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
  }
@@ -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>
@@ -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
- await this.onSelectedForQuery(node);
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>) {
@@ -92,8 +92,6 @@
92
92
 
93
93
  .oio-tree-wrapper {
94
94
  position: relative;
95
- width: 234px;
96
- flex-basis: 234px;
97
95
  }
98
96
 
99
97
  .default-tree-content {