cnhis-design-vue 3.1.30-beta.2 → 3.1.30-beta.4

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 (47) hide show
  1. package/README.md +123 -123
  2. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  3. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
  4. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +1 -0
  5. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
  6. package/es/components/fabric-chart/src/utils/index.d.ts +6823 -0
  7. package/es/components/form-render/src/components/renderer/index.js +2 -2
  8. package/es/components/form-render/src/components/renderer/{levelSearchCascade.d.ts → levelSearchCascader.d.ts} +1 -1
  9. package/es/components/form-render/src/components/renderer/{levelSearchCascade.js → levelSearchCascader.js} +2 -2
  10. package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
  11. package/es/components/form-render/src/hooks/useFieldNormalize.js +2 -1
  12. package/es/components/iho-table/src/IhoTable.js +1 -4
  13. package/es/components/iho-table/src/plugins/lowCodeFieldAdaptorPlugin/index.js +2 -1
  14. package/es/components/iho-table/src/types/index.d.ts +1 -1
  15. package/es/components/iho-table/style/index.css +1 -1
  16. package/es/components/index.css +1 -1
  17. package/es/components/index.d.ts +2 -1
  18. package/es/components/index.js +4 -1
  19. package/es/components/search-cascader/index.d.ts +33 -12
  20. package/es/components/search-cascader/src/SearchCascader.js +26 -20
  21. package/es/components/search-cascader/src/SearchCascader.vue.d.ts +33 -12
  22. package/es/components/search-cascader/src/components/SearchMenu.d.ts +14 -9
  23. package/es/components/search-cascader/src/components/SearchMenu.js +77 -15
  24. package/es/components/search-cascader/src/constants/index.d.ts +3 -1
  25. package/es/components/search-cascader/src/constants/index.js +7 -1
  26. package/es/components/select-person/index.d.ts +0 -1
  27. package/es/components/select-person/src/SelectPerson.vue.d.ts +0 -1
  28. package/es/components/select-person/src/SelectPerson.vue_vue_type_script_setup_true_lang.js +1 -2
  29. package/es/shared/assets/img/failure.js +1 -1
  30. package/es/shared/assets/img/icon-asc.js +1 -1
  31. package/es/shared/assets/img/icon-desc.js +1 -1
  32. package/es/shared/assets/img/no-permission.js +1 -1
  33. package/es/shared/assets/img/nodata.js +1 -1
  34. package/es/shared/assets/img/notfound.js +1 -1
  35. package/es/shared/assets/img/qr.js +1 -1
  36. package/es/shared/assets/img/success.js +1 -1
  37. package/es/shared/assets/img/video.js +1 -1
  38. package/es/shared/assets/img/video_default_cover.js +1 -1
  39. package/es/shared/assets/img/video_hover.js +1 -1
  40. package/es/shared/assets/img/video_play_hover.js +1 -1
  41. package/es/shared/assets/img/xb_big.js +1 -1
  42. package/es/shared/assets/img/xb_small.js +1 -1
  43. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +86 -0
  44. package/es/shared/utils/index.d.ts +1 -0
  45. package/es/shared/utils/index.js +4 -1
  46. package/es/shared/utils/tapable/index.d.ts +139 -0
  47. package/package.json +2 -2
@@ -38,6 +38,10 @@ declare const SearchCascader: SFCWithInstall<import("vue").DefineComponent<{
38
38
  type: StringConstructor;
39
39
  default: string;
40
40
  };
41
+ checkAbleLevel: {
42
+ type: import("vue").PropType<number | "last">;
43
+ default: string;
44
+ };
41
45
  beforeSetValue: {
42
46
  type: import("vue").PropType<(value: string | import("../../../es/shared/types").AnyObject[]) => void | (string | import("../../../es/shared/types").AnyObject[]) | Promise<string | import("../../../es/shared/types").AnyObject[]>>;
43
47
  };
@@ -81,6 +85,10 @@ declare const SearchCascader: SFCWithInstall<import("vue").DefineComponent<{
81
85
  type: StringConstructor;
82
86
  default: string;
83
87
  };
88
+ checkAbleLevel: {
89
+ type: import("vue").PropType<number | "last">;
90
+ default: string;
91
+ };
84
92
  beforeSetValue: {
85
93
  type: import("vue").PropType<(value: string | import("../../../es/shared/types").AnyObject[]) => void | (string | import("../../../es/shared/types").AnyObject[]) | Promise<string | import("../../../es/shared/types").AnyObject[]>>;
86
94
  };
@@ -89,7 +97,7 @@ declare const SearchCascader: SFCWithInstall<import("vue").DefineComponent<{
89
97
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
90
98
  "onUpdate:show"?: ((...args: any[]) => any) | undefined;
91
99
  }>>;
92
- emits: (event: "update:show" | "update:value" | "focus", ...args: any[]) => void;
100
+ emit: (event: "update:show" | "update:value" | "focus", ...args: any[]) => void;
93
101
  emitValue: (value: string | import("../../../es/shared/types").AnyObject[]) => void;
94
102
  onClear: () => void;
95
103
  onClick: (evt: Event) => void;
@@ -97,7 +105,7 @@ declare const SearchCascader: SFCWithInstall<import("vue").DefineComponent<{
97
105
  '--menu-width': number;
98
106
  };
99
107
  uuid: string;
100
- show: import("vue").WritableComputedRef<boolean>;
108
+ show: import("vue").Ref<boolean> | import("vue").WritableComputedRef<boolean>;
101
109
  patternContent: import("vue").Ref<string>;
102
110
  displayValue: import("vue").WritableComputedRef<string>;
103
111
  onFocus: (focusEvt: Event) => void;
@@ -107,7 +115,10 @@ declare const SearchCascader: SFCWithInstall<import("vue").DefineComponent<{
107
115
  popoverRef: import("vue").Ref<any>;
108
116
  currentNode: import("vue").Ref<import("../../../es/shared/types").AnyObject | undefined>;
109
117
  loadingNode: import("vue").Ref<import("../../../es/shared/types").Nullable<import("../../../es/shared/types").AnyObject>>;
110
- search: (node?: import("../../../es/shared/types").AnyObject | undefined, keyword?: string | undefined) => Promise<void>;
118
+ search: (payload?: {
119
+ type: "search" | "update";
120
+ node: import("../../../es/shared/types").AnyObject;
121
+ } | undefined, keyword?: string | undefined) => Promise<void>;
111
122
  NInput: any;
112
123
  NPopover: any;
113
124
  SearchMenu: import("vue").DefineComponent<{
@@ -119,17 +130,18 @@ declare const SearchCascader: SFCWithInstall<import("vue").DefineComponent<{
119
130
  type: import("vue").PropType<import("../../../es/shared/types").AnyObject[]>;
120
131
  default: () => never[];
121
132
  };
122
- onNodeClick: {
123
- type: import("vue").PropType<import("../../../es/shared/types").Func<any[], any>>;
124
- };
125
133
  labelKey: {
126
134
  type: StringConstructor;
127
135
  default: string;
128
136
  };
137
+ valueKey: {
138
+ type: StringConstructor;
139
+ default: string;
140
+ };
129
141
  currentNode: {
130
142
  type: import("vue").PropType<import("../../../es/shared/types").AnyObject>;
131
143
  };
132
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
144
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "nodeClick"[], "nodeClick", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
133
145
  childKey: {
134
146
  type: StringConstructor;
135
147
  default: string;
@@ -138,20 +150,24 @@ declare const SearchCascader: SFCWithInstall<import("vue").DefineComponent<{
138
150
  type: import("vue").PropType<import("../../../es/shared/types").AnyObject[]>;
139
151
  default: () => never[];
140
152
  };
141
- onNodeClick: {
142
- type: import("vue").PropType<import("../../../es/shared/types").Func<any[], any>>;
143
- };
144
153
  labelKey: {
145
154
  type: StringConstructor;
146
155
  default: string;
147
156
  };
157
+ valueKey: {
158
+ type: StringConstructor;
159
+ default: string;
160
+ };
148
161
  currentNode: {
149
162
  type: import("vue").PropType<import("../../../es/shared/types").AnyObject>;
150
163
  };
151
- }>>, {
164
+ }>> & {
165
+ onNodeClick?: ((...args: any[]) => any) | undefined;
166
+ }, {
152
167
  options: import("../../../es/shared/types").AnyObject[];
153
168
  childKey: string;
154
169
  labelKey: string;
170
+ valueKey: string;
155
171
  }>;
156
172
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:show" | "update:value" | "focus")[], "focus" | "update:show" | "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
157
173
  value: {
@@ -192,6 +208,10 @@ declare const SearchCascader: SFCWithInstall<import("vue").DefineComponent<{
192
208
  type: StringConstructor;
193
209
  default: string;
194
210
  };
211
+ checkAbleLevel: {
212
+ type: import("vue").PropType<number | "last">;
213
+ default: string;
214
+ };
195
215
  beforeSetValue: {
196
216
  type: import("vue").PropType<(value: string | import("../../../es/shared/types").AnyObject[]) => void | (string | import("../../../es/shared/types").AnyObject[]) | Promise<string | import("../../../es/shared/types").AnyObject[]>>;
197
217
  };
@@ -203,10 +223,11 @@ declare const SearchCascader: SFCWithInstall<import("vue").DefineComponent<{
203
223
  show: boolean;
204
224
  options: import("../../../es/shared/types").AnyObject[];
205
225
  placeholder: string;
206
- valueKey: string;
207
226
  clearable: boolean;
208
227
  childKey: string;
209
228
  editPlaceholder: string;
210
229
  labelKey: string;
230
+ valueKey: string;
231
+ checkAbleLevel: number | "last";
211
232
  }>>;
212
233
  export default SearchCascader;
@@ -1,9 +1,10 @@
1
- import { defineComponent, computed, ref, provide, nextTick, openBlock, createBlock, unref, isRef, normalizeStyle, withCtx, createVNode, withKeys, createElementVNode, renderSlot } from 'vue';
1
+ import { defineComponent, provide, computed, ref, nextTick, openBlock, createBlock, unref, isRef, normalizeStyle, withCtx, createVNode, withKeys, createElementVNode, renderSlot } from 'vue';
2
2
  import { uuidGenerator } from '../../../shared/utils/index.js';
3
- import { onClickOutside, useDebounceFn } from '@vueuse/core';
3
+ import { NOOP } from '@vue/shared';
4
+ import { useVModel, onClickOutside, useDebounceFn } from '@vueuse/core';
4
5
  import { isString, isArray, isFunction, isObject } from 'lodash-es';
5
6
  import { NPopover, NInput } from 'naive-ui';
6
- import { InjectionSearchCascaderLoadingNode } from './constants/index.js';
7
+ import { InjectionSearchCascaderCheckAbleLevel, InjectionSearchCascaderLoadingNode, InjectionSearchCascaderValue } from './constants/index.js';
7
8
  import { useCssVariable } from './hooks/useCssVariable.js';
8
9
  import { SearchMenu } from './components/SearchMenu.js';
9
10
  import _export_sfc from '../../../_virtual/plugin-vue_export-helper.js';
@@ -22,18 +23,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22
23
  search: { type: Function },
23
24
  labelKey: { type: String, default: "label" },
24
25
  valueKey: { type: String, default: "value" },
26
+ checkAbleLevel: { type: [Number, String], default: "last" },
25
27
  beforeSetValue: { type: Function }
26
28
  },
27
29
  emits: ["update:value", "focus", "update:show"],
28
- setup(__props, { emit: emits }) {
30
+ setup(__props, { emit }) {
29
31
  const props = __props;
30
32
  function emitValue(value) {
31
33
  Promise.resolve(isFunction(props.beforeSetValue) ? props.beforeSetValue(value) : value).then(
32
- (result) => {
33
- emits("update:value", result);
34
- },
35
- () => {
36
- }
34
+ (result) => emit("update:value", result),
35
+ NOOP
37
36
  );
38
37
  }
39
38
  function onClear() {
@@ -47,14 +46,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
47
46
  }
48
47
  const cssVariable = useCssVariable();
49
48
  const uuid = uuidGenerator();
50
- const show = computed({
51
- get() {
52
- return props.show;
53
- },
54
- set(value) {
55
- emits("update:show", value);
56
- }
57
- });
49
+ const show = useVModel(props, "show", emit);
50
+ provide(
51
+ InjectionSearchCascaderCheckAbleLevel,
52
+ computed(() => props.checkAbleLevel)
53
+ );
58
54
  const patternContent = ref("");
59
55
  const displayValue = computed({
60
56
  get() {
@@ -79,7 +75,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
79
75
  }
80
76
  });
81
77
  function onFocus(focusEvt) {
82
- emits("focus", focusEvt);
78
+ emit("focus", focusEvt);
83
79
  }
84
80
  function openMenu() {
85
81
  if (show.value)
@@ -123,9 +119,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
123
119
  const currentNode = ref();
124
120
  const loadingNode = ref(null);
125
121
  provide(InjectionSearchCascaderLoadingNode, loadingNode);
126
- const search = useDebounceFn(async (node, keyword) => {
122
+ provide(
123
+ InjectionSearchCascaderValue,
124
+ computed(() => props.value)
125
+ );
126
+ const search = useDebounceFn(async (payload, keyword) => {
127
127
  var _a;
128
+ const { type, node } = payload || {};
128
129
  try {
130
+ if (type === "update") {
131
+ isFunction(props.search) && props.search({ ...node, isLeaf: true });
132
+ return;
133
+ }
129
134
  loadingNode.value = node;
130
135
  const result = await (isFunction(props.search) && props.search(node, keyword));
131
136
  currentNode.value = isObject(result) ? result : node;
@@ -167,6 +172,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
167
172
  createElementVNode("section", { id: unref(uuid) }, [
168
173
  createVNode(unref(SearchMenu), {
169
174
  "label-key": __props.labelKey,
175
+ "value-key": __props.valueKey,
170
176
  options: __props.options,
171
177
  onNodeClick: unref(search),
172
178
  "current-node": currentNode.value
@@ -175,7 +181,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
175
181
  renderSlot(_ctx.$slots, "empty")
176
182
  ]),
177
183
  _: 3
178
- }, 8, ["label-key", "options", "onNodeClick", "current-node"])
184
+ }, 8, ["label-key", "value-key", "options", "onNodeClick", "current-node"])
179
185
  ], 8, _hoisted_1)
180
186
  ]),
181
187
  _: 3
@@ -40,6 +40,10 @@ declare const _default: import("vue").DefineComponent<{
40
40
  type: StringConstructor;
41
41
  default: string;
42
42
  };
43
+ checkAbleLevel: {
44
+ type: PropType<number | "last">;
45
+ default: string;
46
+ };
43
47
  beforeSetValue: {
44
48
  type: PropType<(value: ValueType) => void | ValueType | Promise<ValueType>>;
45
49
  };
@@ -83,6 +87,10 @@ declare const _default: import("vue").DefineComponent<{
83
87
  type: StringConstructor;
84
88
  default: string;
85
89
  };
90
+ checkAbleLevel: {
91
+ type: PropType<number | "last">;
92
+ default: string;
93
+ };
86
94
  beforeSetValue: {
87
95
  type: PropType<(value: ValueType) => void | ValueType | Promise<ValueType>>;
88
96
  };
@@ -91,7 +99,7 @@ declare const _default: import("vue").DefineComponent<{
91
99
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
92
100
  "onUpdate:show"?: ((...args: any[]) => any) | undefined;
93
101
  }>>;
94
- emits: (event: "update:show" | "update:value" | "focus", ...args: any[]) => void;
102
+ emit: (event: "update:show" | "update:value" | "focus", ...args: any[]) => void;
95
103
  emitValue: (value: ValueType) => void;
96
104
  onClear: () => void;
97
105
  onClick: (evt: Event) => void;
@@ -99,7 +107,7 @@ declare const _default: import("vue").DefineComponent<{
99
107
  '--menu-width': number;
100
108
  };
101
109
  uuid: string;
102
- show: import("vue").WritableComputedRef<boolean>;
110
+ show: import("vue").Ref<boolean> | import("vue").WritableComputedRef<boolean>;
103
111
  patternContent: import("vue").Ref<string>;
104
112
  displayValue: import("vue").WritableComputedRef<string>;
105
113
  onFocus: (focusEvt: Event) => void;
@@ -109,7 +117,10 @@ declare const _default: import("vue").DefineComponent<{
109
117
  popoverRef: import("vue").Ref<any>;
110
118
  currentNode: import("vue").Ref<AnyObject | undefined>;
111
119
  loadingNode: import("vue").Ref<Nullable<AnyObject>>;
112
- search: (node?: AnyObject, keyword?: string) => Promise<void>;
120
+ search: (payload?: {
121
+ type: 'search' | 'update';
122
+ node: AnyObject;
123
+ }, keyword?: string) => Promise<void>;
113
124
  NInput: any;
114
125
  NPopover: any;
115
126
  SearchMenu: import("vue").DefineComponent<{
@@ -121,17 +132,18 @@ declare const _default: import("vue").DefineComponent<{
121
132
  type: PropType<AnyObject[]>;
122
133
  default: () => never[];
123
134
  };
124
- onNodeClick: {
125
- type: PropType<Func<any[], any>>;
126
- };
127
135
  labelKey: {
128
136
  type: StringConstructor;
129
137
  default: string;
130
138
  };
139
+ valueKey: {
140
+ type: StringConstructor;
141
+ default: string;
142
+ };
131
143
  currentNode: {
132
144
  type: PropType<AnyObject>;
133
145
  };
134
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
146
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "nodeClick"[], "nodeClick", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
135
147
  childKey: {
136
148
  type: StringConstructor;
137
149
  default: string;
@@ -140,20 +152,24 @@ declare const _default: import("vue").DefineComponent<{
140
152
  type: PropType<AnyObject[]>;
141
153
  default: () => never[];
142
154
  };
143
- onNodeClick: {
144
- type: PropType<Func<any[], any>>;
145
- };
146
155
  labelKey: {
147
156
  type: StringConstructor;
148
157
  default: string;
149
158
  };
159
+ valueKey: {
160
+ type: StringConstructor;
161
+ default: string;
162
+ };
150
163
  currentNode: {
151
164
  type: PropType<AnyObject>;
152
165
  };
153
- }>>, {
166
+ }>> & {
167
+ onNodeClick?: ((...args: any[]) => any) | undefined;
168
+ }, {
154
169
  options: AnyObject[];
155
170
  childKey: string;
156
171
  labelKey: string;
172
+ valueKey: string;
157
173
  }>;
158
174
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:show" | "update:value" | "focus")[], "focus" | "update:show" | "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
159
175
  value: {
@@ -194,6 +210,10 @@ declare const _default: import("vue").DefineComponent<{
194
210
  type: StringConstructor;
195
211
  default: string;
196
212
  };
213
+ checkAbleLevel: {
214
+ type: PropType<number | "last">;
215
+ default: string;
216
+ };
197
217
  beforeSetValue: {
198
218
  type: PropType<(value: ValueType) => void | ValueType | Promise<ValueType>>;
199
219
  };
@@ -205,10 +225,11 @@ declare const _default: import("vue").DefineComponent<{
205
225
  show: boolean;
206
226
  options: AnyObject[];
207
227
  placeholder: string;
208
- valueKey: string;
209
228
  clearable: boolean;
210
229
  childKey: string;
211
230
  editPlaceholder: string;
212
231
  labelKey: string;
232
+ valueKey: string;
233
+ checkAbleLevel: number | "last";
213
234
  }>;
214
235
  export default _default;
@@ -1,4 +1,4 @@
1
- import { AnyObject, Func } from '../../../../../es/shared/types';
1
+ import { AnyObject } from '../../../../../es/shared/types';
2
2
  import { PropType } from 'vue';
3
3
  export declare const SearchMenu: import("vue").DefineComponent<{
4
4
  childKey: {
@@ -9,17 +9,18 @@ export declare const SearchMenu: import("vue").DefineComponent<{
9
9
  type: PropType<AnyObject[]>;
10
10
  default: () => never[];
11
11
  };
12
- onNodeClick: {
13
- type: PropType<Func<any[], any>>;
14
- };
15
12
  labelKey: {
16
13
  type: StringConstructor;
17
14
  default: string;
18
15
  };
16
+ valueKey: {
17
+ type: StringConstructor;
18
+ default: string;
19
+ };
19
20
  currentNode: {
20
21
  type: PropType<AnyObject>;
21
22
  };
22
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
23
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "nodeClick"[], "nodeClick", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
23
24
  childKey: {
24
25
  type: StringConstructor;
25
26
  default: string;
@@ -28,18 +29,22 @@ export declare const SearchMenu: import("vue").DefineComponent<{
28
29
  type: PropType<AnyObject[]>;
29
30
  default: () => never[];
30
31
  };
31
- onNodeClick: {
32
- type: PropType<Func<any[], any>>;
33
- };
34
32
  labelKey: {
35
33
  type: StringConstructor;
36
34
  default: string;
37
35
  };
36
+ valueKey: {
37
+ type: StringConstructor;
38
+ default: string;
39
+ };
38
40
  currentNode: {
39
41
  type: PropType<AnyObject>;
40
42
  };
41
- }>>, {
43
+ }>> & {
44
+ onNodeClick?: ((...args: any[]) => any) | undefined;
45
+ }, {
42
46
  options: AnyObject[];
43
47
  childKey: string;
44
48
  labelKey: string;
49
+ valueKey: string;
45
50
  }>;
@@ -1,9 +1,11 @@
1
- import { defineComponent, computed, inject, createVNode, ref, createTextVNode } from 'vue';
2
- import { traverse } from '../../../../shared/utils/index.js';
1
+ import { defineComponent, computed, inject, createVNode, withModifiers, ref, createTextVNode } from 'vue';
2
+ import { vIf, traverse } from '../../../../shared/utils/index.js';
3
3
  import { Reload, ChevronForward } from '@vicons/ionicons5';
4
+ import { NOOP } from '@vue/shared';
4
5
  import { useVirtualList } from '@vueuse/core';
5
- import { isArray, isFunction } from 'lodash-es';
6
- import { InjectionSearchCascaderLoadingNode } from '../constants/index.js';
6
+ import { isNumber, isArray, isEqual, isString, isFunction } from 'lodash-es';
7
+ import { NCheckbox } from 'naive-ui';
8
+ import { InjectionSearchCascaderLoadingNode, InjectionSearchCascaderValue, InjectionSearchCascaderCheckAbleLevel } from '../constants/index.js';
7
9
 
8
10
  const SearchMenuList = defineComponent({
9
11
  props: {
@@ -15,9 +17,17 @@ const SearchMenuList = defineComponent({
15
17
  type: Array,
16
18
  default: () => []
17
19
  },
20
+ level: {
21
+ type: Number,
22
+ required: true
23
+ },
18
24
  labelKey: {
19
25
  type: String,
20
26
  default: "label"
27
+ },
28
+ valueKey: {
29
+ type: String,
30
+ default: "value"
21
31
  }
22
32
  },
23
33
  emits: ["nodeClick"],
@@ -34,6 +44,44 @@ const SearchMenuList = defineComponent({
34
44
  overscan: 5
35
45
  });
36
46
  const loadingNode = inject(InjectionSearchCascaderLoadingNode);
47
+ const valueRef = inject(InjectionSearchCascaderValue);
48
+ const checkAbleLevel = inject(InjectionSearchCascaderCheckAbleLevel);
49
+ const showCheckbox = computed(() => {
50
+ return isNumber(checkAbleLevel.value) && checkAbleLevel.value <= props.level;
51
+ });
52
+ function isActive(node) {
53
+ var _a;
54
+ return (_a = props.activeNodes) == null ? void 0 : _a.includes(node);
55
+ }
56
+ function isChecked(node) {
57
+ const nodeList = getNodeChain(node);
58
+ if (isArray(valueRef.value)) {
59
+ return isEqual(mapper(nodeList, props.valueKey), mapper(valueRef.value, props.valueKey));
60
+ }
61
+ if (isString(valueRef.value)) {
62
+ const labelList = valueRef.value.split("/").map((item) => item.trim());
63
+ return isEqual(labelList, mapper(nodeList, props.labelKey));
64
+ }
65
+ return false;
66
+ function mapper(list2, prop) {
67
+ return list2.map((item) => item[prop]);
68
+ }
69
+ function getNodeChain(node2) {
70
+ const result = [node2];
71
+ let currentNode = node2;
72
+ while (currentNode.parent) {
73
+ currentNode = currentNode.parent;
74
+ result.unshift(currentNode);
75
+ }
76
+ return result;
77
+ }
78
+ }
79
+ function updateValue(node) {
80
+ emit("nodeClick", {
81
+ type: "update",
82
+ node
83
+ });
84
+ }
37
85
  return () => {
38
86
  return createVNode("div", {
39
87
  "class": "search-cascader__optionWrapper",
@@ -43,16 +91,25 @@ const SearchMenuList = defineComponent({
43
91
  }, [createVNode("div", {
44
92
  "style": wrapperProps.value.style
45
93
  }, [list.value.map((item) => {
46
- var _a;
47
94
  return createVNode("div", {
48
95
  "class": ["search-cascader__option", {
49
- "search-cascader__option--active": (_a = props.activeNodes) == null ? void 0 : _a.includes(item.data)
96
+ "search-cascader__option--active": isActive(item.data)
50
97
  }],
51
- "onClick": () => emit("nodeClick", item.data),
98
+ "onClick": () => emit("nodeClick", {
99
+ type: "search",
100
+ node: item.data
101
+ }),
52
102
  "title": item.data[props.labelKey]
53
103
  }, [createVNode("div", {
54
104
  "class": "search-cascader__optionText"
55
- }, [item.data[props.labelKey]]), loadingNode.value === item.data ? createVNode(Reload, {
105
+ }, [vIf(showCheckbox.value, createVNode(NCheckbox, {
106
+ "style": {
107
+ marginRight: "8px"
108
+ },
109
+ "checked": isChecked(item.data),
110
+ "onClick": withModifiers(NOOP, ["stop"]),
111
+ "onUpdateChecked": (v) => v && updateValue(item.data)
112
+ }, null)), item.data[props.labelKey]]), loadingNode.value === item.data ? createVNode(Reload, {
56
113
  "class": "rotate"
57
114
  }, null) : item.data.isLeaf ? null : createVNode(ChevronForward, null, null)]);
58
115
  })])]);
@@ -69,26 +126,31 @@ const SearchMenu = defineComponent({
69
126
  type: Array,
70
127
  default: () => []
71
128
  },
72
- onNodeClick: {
73
- type: Function
74
- },
75
129
  labelKey: {
76
130
  type: String,
77
131
  default: "label"
78
132
  },
133
+ valueKey: {
134
+ type: String,
135
+ default: "value"
136
+ },
79
137
  currentNode: {
80
138
  type: Object
81
139
  }
82
140
  },
141
+ emits: ["nodeClick"],
83
142
  setup(props, {
84
- slots
143
+ slots,
144
+ emit
85
145
  }) {
86
146
  const activeNodes = ref([]);
87
- function renderList(options) {
147
+ function renderList(options, idx) {
88
148
  return createVNode(SearchMenuList, {
149
+ "level": idx + 1,
89
150
  "labelKey": props.labelKey,
151
+ "valueKey": props.valueKey,
90
152
  "activeNodes": activeNodes.value,
91
- "onNodeClick": props.onNodeClick,
153
+ "onNodeClick": (payload) => emit("nodeClick", payload),
92
154
  "options": options
93
155
  }, null);
94
156
  }
@@ -126,7 +188,7 @@ const SearchMenu = defineComponent({
126
188
  return () => {
127
189
  return createVNode("section", {
128
190
  "class": "search-cascader__menuWrapper"
129
- }, [!isArray(props.options) || !props.options.length ? renderEmpty() : !props.currentNode ? renderList(props.options) : getRenderNodeList().map(renderList)]);
191
+ }, [!isArray(props.options) || !props.options.length ? renderEmpty() : !props.currentNode ? renderList(props.options, 0) : getRenderNodeList().map(renderList)]);
130
192
  };
131
193
  }
132
194
  });
@@ -1,3 +1,5 @@
1
1
  import { AnyObject, Nullable } from '../../../../../es/shared/types';
2
- import { InjectionKey, Ref } from 'vue';
2
+ import { ComputedRef, InjectionKey, Ref } from 'vue';
3
3
  export declare const InjectionSearchCascaderLoadingNode: InjectionKey<Ref<Nullable<AnyObject>>>;
4
+ export declare const InjectionSearchCascaderValue: InjectionKey<ComputedRef<AnyObject[] | string>>;
5
+ export declare const InjectionSearchCascaderCheckAbleLevel: InjectionKey<ComputedRef<'last' | number>>;
@@ -1,5 +1,11 @@
1
1
  const InjectionSearchCascaderLoadingNode = Symbol(
2
2
  "InjectionSearchCascaderLoadingNode "
3
3
  );
4
+ const InjectionSearchCascaderValue = Symbol(
5
+ "InjectionSearchCascaderValue "
6
+ );
7
+ const InjectionSearchCascaderCheckAbleLevel = Symbol(
8
+ "InjectionSearchCascaderCheckAbleLevel"
9
+ );
4
10
 
5
- export { InjectionSearchCascaderLoadingNode };
11
+ export { InjectionSearchCascaderCheckAbleLevel, InjectionSearchCascaderLoadingNode, InjectionSearchCascaderValue };
@@ -93,7 +93,6 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
93
93
  }>> & {
94
94
  onCheck?: ((...args: any[]) => any) | undefined;
95
95
  }>>;
96
- $message: import("naive-ui").MessageApi;
97
96
  emit: (event: "check", ...args: any[]) => void;
98
97
  keyword: import("vue").Ref<string>;
99
98
  checkedAll: import("vue").Ref<boolean>;
@@ -92,7 +92,6 @@ declare const _default: import("vue").DefineComponent<{
92
92
  }>> & {
93
93
  onCheck?: ((...args: any[]) => any) | undefined;
94
94
  }>>;
95
- $message: import("naive-ui").MessageApi;
96
95
  emit: (event: "check", ...args: any[]) => void;
97
96
  keyword: import("vue").Ref<string>;
98
97
  checkedAll: import("vue").Ref<boolean>;
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, ref, computed, watch, openBlock, createBlock, unref, withCtx, createVNode, withKeys, createTextVNode, toDisplayString, createCommentVNode, createElementBlock, createElementVNode, Fragment, renderList } from 'vue';
2
- import { useMessage, NGrid, NGi, NSpace, NInputGroup, NInput, NButton, NCheckbox, NTree, NIcon, NTooltip } from 'naive-ui';
2
+ import { NGrid, NGi, NSpace, NInputGroup, NInput, NButton, NCheckbox, NTree, NIcon, NTooltip } from 'naive-ui';
3
3
  import { CloseCircleSharp } from '@vicons/ionicons5';
4
4
  import { filterTree } from './utils/index.js';
5
5
  import { cloneDeep } from 'lodash-es';
@@ -66,7 +66,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
66
66
  emit
67
67
  }) {
68
68
  const props = __props;
69
- useMessage();
70
69
  const keyword = ref("");
71
70
  const checkedAll = ref(false);
72
71
  const checkedKeys = ref([]);