@oinone/kunlun-vue-admin-base 6.2.5 → 6.2.7

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.
@@ -2,7 +2,7 @@ import { ActiveRecord, ActiveRecords, Pagination, RuntimeModel, RuntimeRelationF
2
2
  import { ExpressionRunParam } from '@oinone/kunlun-expression';
3
3
  import { CallChaining, ReturnPromise } from '@oinone/kunlun-shared';
4
4
  import { SelectMode, WidgetTrigger } from '@oinone/kunlun-vue-ui-antd';
5
- import { OioTreeNode } from '@oinone/kunlun-vue-ui-common';
5
+ import { OioTreeNode, TreeSelectProperties } from '@oinone/kunlun-vue-ui-common';
6
6
  import { DebouncedFunc } from 'lodash-es';
7
7
  import { BaseFieldProps, FormFieldWidget } from '../../basic';
8
8
  import { TreeNodeResponseBody } from '../../service';
@@ -31,6 +31,7 @@ export declare abstract class AbstractTreeFieldWidget<V extends TreeData = TreeD
31
31
  protected checkedKeys: string[] | undefined;
32
32
  protected halfCheckedKeys: string[] | undefined;
33
33
  protected expandedKeys: string[] | undefined;
34
+ protected get mappingProperties(): TreeSelectProperties;
34
35
  protected get referencesModel(): RuntimeModel | undefined;
35
36
  protected get selectMode(): SelectMode;
36
37
  protected get selectable(): boolean;
@@ -1,7 +1,10 @@
1
- import { OioTreeNode, SimpleTreeSelected, TreeSelectNode, TreeSelectNodeChangeEvent } from '@oinone/kunlun-vue-ui-antd';
1
+ import { OioTreeNode, SimpleTreeSelected, TreeSelectNode, TreeSelectNodeChangeEvent, TreeSelectProperties } from '@oinone/kunlun-vue-ui-antd';
2
2
  import { PropType } from 'vue';
3
3
  import { TreeData } from '../../typing';
4
4
  declare const _default: import("vue").DefineComponent<{
5
+ mappingProperties: {
6
+ type: PropType<TreeSelectProperties>;
7
+ };
5
8
  maxTagCount: {
6
9
  type: NumberConstructor;
7
10
  };
@@ -101,6 +104,9 @@ declare const _default: import("vue").DefineComponent<{
101
104
  onClickLoadMore: (node: OioTreeNode<TreeData>) => Promise<void>;
102
105
  getTriggerContainer: (triggerNode: Node | HTMLElement) => Node | HTMLElement;
103
106
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
107
+ mappingProperties: {
108
+ type: PropType<TreeSelectProperties>;
109
+ };
104
110
  maxTagCount: {
105
111
  type: NumberConstructor;
106
112
  };
@@ -21,6 +21,7 @@ export declare class TreeUtils {
21
21
  static consumerReferenceModelField(originModel: string, modelField: RuntimeRelationField, consumer: (originFields: string[], targetFields: string[], index: number, reverse: boolean) => void, consumerBefore?: () => void): Promise<boolean>;
22
22
  static seekContentLayout(view: RuntimeView | undefined, viewType: ViewType, inline: boolean): DslDefinition | undefined;
23
23
  static mergeLayoutBySlotName(dslSlots: DslSlots, slotName: string, inline: boolean, view: RuntimeView | undefined): {
24
+ viewType: ViewType;
24
25
  targetSlot: TemplateDslDefinition;
25
26
  viewDsl: ViewDslDefinition;
26
27
  viewTemplate: DslDefinition;
@@ -1,4 +1,5 @@
1
1
  import { ExpressionRunParam } from '@oinone/kunlun-expression';
2
+ import { ViewType } from '@oinone/kunlun-meta';
2
3
  import { ReturnPromise } from '@oinone/kunlun-shared';
3
4
  import { OioTreeNode } from '@oinone/kunlun-vue-ui-common';
4
5
  import { TreeNodeResponseBody } from '../../service';
@@ -17,6 +18,7 @@ export declare abstract class AbstractTreeElementWidget<V extends TreeData = Tre
17
18
  protected get expandLevel(): string | undefined;
18
19
  protected checkedKeys: string[] | undefined;
19
20
  protected showContent: boolean;
21
+ protected contentViewType: ViewType | undefined;
20
22
  protected get searchPlaceHolder(): any;
21
23
  get checkable(): boolean | undefined;
22
24
  get autoExpandParent(): boolean | undefined;
@@ -1,3 +1,4 @@
1
+ import { ActiveRecord } from '@oinone/kunlun-engine';
1
2
  import { OioTreeNode } from '@oinone/kunlun-vue-ui-common';
2
3
  import { TreeData } from '../../typing';
3
4
  import { AbstractTreeElementWidget } from './AbstractTreeElementWidget';
@@ -8,4 +9,5 @@ export declare class TreeWidget extends AbstractTreeElementWidget {
8
9
  protected onClearSearch(): Promise<void>;
9
10
  protected onUnselected(): Promise<void>;
10
11
  protected $$mounted(): void;
12
+ protected generatorEmptyValue(): ActiveRecord[];
11
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oinone/kunlun-vue-admin-base",
3
- "version": "6.2.5",
3
+ "version": "6.2.7",
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.5",
18
- "@oinone/kunlun-vue-router": "6.2.5",
19
- "@oinone/kunlun-vue-ui": "6.2.5",
20
- "@oinone/kunlun-vue-ui-antd": "6.2.5",
21
- "@oinone/kunlun-vue-ui-common": "6.2.5",
22
- "@oinone/kunlun-vue-ui-el": "6.2.5",
23
- "@oinone/kunlun-vue-widget": "6.2.5",
17
+ "@oinone/kunlun-vue-admin-layout": "6.2.7",
18
+ "@oinone/kunlun-vue-router": "6.2.7",
19
+ "@oinone/kunlun-vue-ui": "6.2.7",
20
+ "@oinone/kunlun-vue-ui-antd": "6.2.7",
21
+ "@oinone/kunlun-vue-ui-common": "6.2.7",
22
+ "@oinone/kunlun-vue-ui-el": "6.2.7",
23
+ "@oinone/kunlun-vue-widget": "6.2.7",
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",
@@ -313,19 +313,23 @@ export class ExpressionAbstractWidget extends FormFieldWidget {
313
313
  public async initData(): Promise<IExpressionItem[]> {
314
314
  if (this.value) {
315
315
  const expression = (await this.queryExpression()) as IExpressionDefinition;
316
+
317
+ const defaultExpressionItem = createDefaultExpressionItem(this.type);
316
318
  if (expression) {
317
319
  createExpressionItemByExpressionDefinition(expression, this.createExpressionOption());
318
320
  const valueList = expression.itemList;
319
- this.setExpressionItemList(!valueList?.length ? [createDefaultExpressionItem(this.type)] : valueList);
321
+ this.setExpressionItemList(!valueList?.length ? [defaultExpressionItem] : valueList);
320
322
  this.sourceCode = this.value as string;
321
323
 
322
324
  const list = valueList || [];
323
325
 
324
- if (list.length && this.sourceCode && !list.some((v) => !!v.valueList?.find((val) => val.value))) {
326
+ const isDefaultCondition = list.length === 1 && list[0].valueList?.length === 1 && !list[0].valueList[0].value;
327
+
328
+ if (this.sourceCode && isDefaultCondition) {
325
329
  this.hasChangeSourceCode = true;
326
330
  }
327
331
  } else {
328
- this.setExpressionItemList([createDefaultExpressionItem(this.type)]);
332
+ this.setExpressionItemList([defaultExpressionItem]);
329
333
  this.sourceCode = this.value as string;
330
334
  this.hasChangeSourceCode = true;
331
335
  }
@@ -20,7 +20,7 @@ import {
20
20
  uniqueKeyGenerator
21
21
  } from '@oinone/kunlun-shared';
22
22
  import { EmptyStyle, SelectMode, WidgetTrigger } from '@oinone/kunlun-vue-ui-antd';
23
- import { OioTreeNode } from '@oinone/kunlun-vue-ui-common';
23
+ import { defaultTreeSelectProperties, OioTreeNode, TreeSelectProperties } from '@oinone/kunlun-vue-ui-common';
24
24
  import { Widget } from '@oinone/kunlun-vue-widget';
25
25
  import { debounce, DebouncedFunc, isNil, toInteger } from 'lodash-es';
26
26
  import { BaseFieldProps, FormFieldWidget } from '../../basic';
@@ -88,6 +88,15 @@ export abstract class AbstractTreeFieldWidget<
88
88
  @Widget.Reactive()
89
89
  protected expandedKeys: string[] | undefined;
90
90
 
91
+ @Widget.Reactive()
92
+ protected get mappingProperties(): TreeSelectProperties {
93
+ return {
94
+ ...defaultTreeSelectProperties,
95
+ labelProp: 'title',
96
+ valueProp: 'key'
97
+ };
98
+ }
99
+
91
100
  @Widget.Reactive()
92
101
  protected get referencesModel(): RuntimeModel | undefined {
93
102
  return this.field.referencesModel;
@@ -16,12 +16,6 @@ import { OioCommonProps, OioMetadataProps, useInjectOioDefaultFormContext } from
16
16
  import { TreeData } from '../../typing';
17
17
  import { TreeUtils } from '../../util';
18
18
 
19
- const mappingProperties: TreeSelectProperties = {
20
- ...defaultTreeSelectProperties,
21
- labelProp: 'title',
22
- valueProp: 'key'
23
- };
24
-
25
19
  export default defineComponent({
26
20
  name: 'DefaultTreeSelect',
27
21
  components: {
@@ -31,6 +25,9 @@ export default defineComponent({
31
25
  props: {
32
26
  ...OioCommonProps,
33
27
  ...OioMetadataProps,
28
+ mappingProperties: {
29
+ type: Object as PropType<TreeSelectProperties>
30
+ },
34
31
  maxTagCount: {
35
32
  type: Number
36
33
  },
@@ -189,6 +186,7 @@ export default defineComponent({
189
186
  enableLoadData,
190
187
  onlySelectedLeaf,
191
188
  maxTagCount,
189
+ mappingProperties,
192
190
 
193
191
  loadData,
194
192
  onDropdownVisibleChange,
@@ -277,7 +277,14 @@ export class TreeUtils {
277
277
  slotName: string,
278
278
  inline: boolean,
279
279
  view: RuntimeView | undefined
280
- ): { targetSlot: TemplateDslDefinition; viewDsl: ViewDslDefinition; viewTemplate: DslDefinition } | undefined {
280
+ ):
281
+ | {
282
+ viewType: ViewType;
283
+ targetSlot: TemplateDslDefinition;
284
+ viewDsl: ViewDslDefinition;
285
+ viewTemplate: DslDefinition;
286
+ }
287
+ | undefined {
281
288
  let targetSlot = dslSlots[slotName];
282
289
  if (targetSlot) {
283
290
  const viewDsl = targetSlot?.widgets?.find((v) => v.dslNodeType === DslDefinitionType.VIEW);
@@ -300,7 +307,7 @@ export class TreeUtils {
300
307
  }
301
308
  }
302
309
  dslSlots[slotName] = targetSlot;
303
- return { targetSlot, viewDsl, viewTemplate };
310
+ return { viewType: viewDsl.type, targetSlot, viewDsl, viewTemplate };
304
311
  }
305
312
  return undefined;
306
313
  }
@@ -1,5 +1,6 @@
1
1
  import { DEFAULT_SLOT_NAME } from '@oinone/kunlun-dsl';
2
2
  import { ExpressionRunParam } from '@oinone/kunlun-expression';
3
+ import { ViewType } from '@oinone/kunlun-meta';
3
4
  import { BooleanHelper, ReturnPromise, uniqueKeyGenerator } from '@oinone/kunlun-shared';
4
5
  import { OioTreeNode } from '@oinone/kunlun-vue-ui-common';
5
6
  import { Widget } from '@oinone/kunlun-vue-widget';
@@ -44,6 +45,9 @@ export abstract class AbstractTreeElementWidget<V extends TreeData = TreeData> e
44
45
  @Widget.Reactive()
45
46
  protected showContent = false;
46
47
 
48
+ @Widget.Reactive()
49
+ protected contentViewType: ViewType | undefined;
50
+
47
51
  @Widget.Reactive()
48
52
  protected get searchPlaceHolder() {
49
53
  return this.getDsl().searchPlaceholder;
@@ -99,7 +103,12 @@ export abstract class AbstractTreeElementWidget<V extends TreeData = TreeData> e
99
103
  }
100
104
  const { dslSlots, inline, view } = this;
101
105
  if (dslSlots) {
102
- TreeUtils.mergeLayoutBySlotName(dslSlots, CONTENT_SLOT_NAME, inline || false, view);
106
+ this.contentViewType = TreeUtils.mergeLayoutBySlotName(
107
+ dslSlots,
108
+ CONTENT_SLOT_NAME,
109
+ inline || false,
110
+ view
111
+ )?.viewType;
103
112
  }
104
113
 
105
114
  this.runtimeInitialed();
@@ -1,3 +1,4 @@
1
+ import { ActiveRecord } from '@oinone/kunlun-engine';
1
2
  import { ViewType } from '@oinone/kunlun-meta';
2
3
  import { SPI } from '@oinone/kunlun-spi';
3
4
  import { OioTreeNode } from '@oinone/kunlun-vue-ui-common';
@@ -29,14 +30,21 @@ export class TreeWidget extends AbstractTreeElementWidget {
29
30
  }
30
31
 
31
32
  protected async onUnselected() {
32
- const currentValue = [];
33
+ const currentValue = this.generatorEmptyValue();
33
34
  this.reloadDataSource(currentValue);
34
35
  this.reloadActiveRecords(currentValue);
35
36
  }
36
37
 
37
38
  protected $$mounted() {
38
39
  super.$$mounted();
39
- const currentValue = [];
40
+ const currentValue = this.generatorEmptyValue();
40
41
  this.reloadDataSource(currentValue);
41
42
  }
43
+
44
+ protected generatorEmptyValue(): ActiveRecord[] {
45
+ if (this.contentViewType === ViewType.Form) {
46
+ return [{}];
47
+ }
48
+ return [];
49
+ }
42
50
  }
@@ -1,13 +1,13 @@
1
- import { http } from '@oinone/kunlun-service';
2
1
  import { ModelCache } from '@oinone/kunlun-engine';
2
+ import { http } from '@oinone/kunlun-service';
3
3
 
4
4
  const getApps = async () => {
5
- const model = await ModelCache.get('apps.AppsManagementModule');
5
+ const model = await ModelCache.get('base.AppSwitcherModuleProxy');
6
6
  const bindUrlFieldExist = (model?.modelFields ?? []).filter((it) => it.data === 'urlHomePage').length > 0;
7
7
 
8
8
  const body = `{
9
9
  appSwitcherModuleProxyQuery {
10
- queryPage(page: {}, queryWrapper: {}) {
10
+ queryPage(page: { currentPage: 1, size: -1 }, queryWrapper: {}) {
11
11
  content {
12
12
  module
13
13
  like