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

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.
@@ -16,7 +16,7 @@ export { useAnchor } from './src/hooks/useAnchor.js';
16
16
  export { useAutographOptions } from './src/hooks/useAutographOptions.js';
17
17
  export { useFormContext } from './src/hooks/useFormContext.js';
18
18
  export { useCommonInjection, useSelectOptionProps } from './src/hooks/useCommonInjection.js';
19
- export { combineExtendKey, createInputSlot, createSlot, formRenderLog, injectOrProvide, isNestedFieldType, isNestedType, mergeDeepProperties, optionMatcher, parseNumberFromMaybeString, presetRequestHandler, splitExtendKey, validateMessageParser } from './src/utils/index.js';
19
+ export { combineExtendKey, createInputSlot, createSlot, createUrlConfigParams, formRenderLog, injectOrProvide, isNestedFieldType, isNestedType, mergeDeepProperties, optionMatcher, parseNumberFromMaybeString, presetRequestHandler, splitExtendKey, validateMessageParser } from './src/utils/index.js';
20
20
  export * from '@formily/core';
21
21
  export { businessDateParser, isIdCard, isMobile, parseAge2Birthday, parseAge2FromContext, parseBirthday, parseIdCard, transformDateFormat } from './src/utils/business.js';
22
22
  export { findNextWidget, queryDecorator, queryInput } from './src/utils/dom.js';
@@ -11,6 +11,7 @@ import * as labelSelect from './labelSelect.js';
11
11
  import * as levelSearchCascade from './levelSearchCascade.js';
12
12
  import * as index$1 from './lineBar/index.js';
13
13
  import * as radio from './radio.js';
14
+ import * as remoteSearch from './remoteSearch.js';
14
15
  import * as search from './search.js';
15
16
  import * as searchCascade from './searchCascade.js';
16
17
  import * as select from './select.js';
@@ -34,6 +35,7 @@ const modules = Object.assign({
34
35
  "./levelSearchCascade.tsx": levelSearchCascade,
35
36
  "./lineBar/index.ts": index$1,
36
37
  "./radio.tsx": radio,
38
+ "./remoteSearch.tsx": remoteSearch,
37
39
  "./search.tsx": search,
38
40
  "./searchCascade.tsx": searchCascade,
39
41
  "./select.tsx": select,
@@ -1,4 +1,5 @@
1
- import { defineComponent, computed, createVNode } from 'vue';
1
+ import { defineComponent, createVNode } from 'vue';
2
+ import { useVModel } from '@vueuse/core';
2
3
  import { useCommonInjection } from '../../hooks/useCommonInjection.js';
3
4
  import { createInputSlot } from '../../utils/index.js';
4
5
  import { connect, mapProps } from '@formily/vue';
@@ -22,10 +23,7 @@ const script = defineComponent({
22
23
  setup(props, {
23
24
  emit
24
25
  }) {
25
- const valueRef = computed({
26
- get: () => props.value,
27
- set: (v) => emit("update:value", v)
28
- });
26
+ const valueRef = useVModel(props, "value", emit);
29
27
  const key = useCommonInjection().injectValueBindKey(valueRef);
30
28
  const _slots = createInputSlot(props, (v) => {
31
29
  return [createVNode("i", {
@@ -1,4 +1,5 @@
1
- import { defineComponent, computed, ref, inject, watch, createVNode } from 'vue';
1
+ import { defineComponent, ref, computed, inject, watch, createVNode } from 'vue';
2
+ import { useVModel } from '@vueuse/core';
2
3
  import { isEqual, isString, isEmpty, isFunction, omit } from 'lodash-es';
3
4
  import '../../../index.js';
4
5
  import { InjectionAsyncQueue } from '../../constants/index.js';
@@ -46,10 +47,7 @@ const script = defineComponent({
46
47
  setup(props, {
47
48
  emit
48
49
  }) {
49
- const valueRef = computed({
50
- get: () => props.value,
51
- set: (v) => emit("update:value", v)
52
- });
50
+ const valueRef = useVModel(props, "value", emit);
53
51
  const showRef = ref(false);
54
52
  const optionsRef = ref([]);
55
53
  const {
@@ -0,0 +1,47 @@
1
+ import { AnyObject, Func } from '../../../../../../es/shared/types';
2
+ import { PropType } from 'vue';
3
+ import { UrlConfig } from '../../../../../../es/components/form-render';
4
+ export declare const REMOTE_SEARCH: import("vue").DefineComponent<{
5
+ value: {
6
+ type: PropType<String | null>;
7
+ };
8
+ requestCache: {
9
+ type: BooleanConstructor;
10
+ default: boolean;
11
+ };
12
+ options: {
13
+ type: PropType<AnyObject[]>;
14
+ default: () => never[];
15
+ };
16
+ urlConfig: {
17
+ type: PropType<UrlConfig>;
18
+ };
19
+ onFocus: {
20
+ type: PropType<Func<any[], any>>;
21
+ };
22
+ onChange: {};
23
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:value"[], "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
24
+ value: {
25
+ type: PropType<String | null>;
26
+ };
27
+ requestCache: {
28
+ type: BooleanConstructor;
29
+ default: boolean;
30
+ };
31
+ options: {
32
+ type: PropType<AnyObject[]>;
33
+ default: () => never[];
34
+ };
35
+ urlConfig: {
36
+ type: PropType<UrlConfig>;
37
+ };
38
+ onFocus: {
39
+ type: PropType<Func<any[], any>>;
40
+ };
41
+ onChange: {};
42
+ }>> & {
43
+ "onUpdate:value"?: ((...args: any[]) => any) | undefined;
44
+ }, {
45
+ options: AnyObject[];
46
+ requestCache: boolean;
47
+ }>;
@@ -0,0 +1,134 @@
1
+ import { defineComponent, ref, computed, inject, watch, createVNode } from 'vue';
2
+ import { connect, mapProps } from '@formily/vue';
3
+ import { useVModel, useDebounceFn } from '@vueuse/core';
4
+ import { isString, isArray, isEqual } from 'lodash-es';
5
+ import { NSelect } from 'naive-ui';
6
+ import '../../../index.js';
7
+ import { InjectionAsyncQueue, InjectionFormItemDepsCollector } from '../../constants/index.js';
8
+ import { createUrlConfigParams, formRenderLog } from '../../utils/index.js';
9
+ import { useCommonInjection, useSelectOptionProps } from '../../hooks/useCommonInjection.js';
10
+ import { useFormField } from '../../hooks/useFormField.js';
11
+ import { visitedDecorator, assignUpdateValue, assignClearBindVisited } from '../../utils/schema.js';
12
+
13
+ const script = defineComponent({
14
+ name: "FormRemoteSearch",
15
+ props: {
16
+ value: {
17
+ type: String
18
+ },
19
+ requestCache: {
20
+ type: Boolean,
21
+ default: true
22
+ },
23
+ options: {
24
+ type: Array,
25
+ default: () => []
26
+ },
27
+ urlConfig: {
28
+ type: Object
29
+ },
30
+ onFocus: {
31
+ type: Function
32
+ },
33
+ onChange: {}
34
+ },
35
+ emits: ["update:value"],
36
+ setup(props, {
37
+ slots,
38
+ emit
39
+ }) {
40
+ const valueRef = useVModel(props, "value", emit);
41
+ const {
42
+ field,
43
+ fieldKey
44
+ } = useFormField();
45
+ const remoteOptions = ref(null);
46
+ const labelKey = computed(() => {
47
+ var _a, _b;
48
+ return (_b = (_a = props.urlConfig) == null ? void 0 : _a.nameKey) != null ? _b : "text";
49
+ });
50
+ const valueKey = computed(() => {
51
+ var _a, _b;
52
+ return (_b = (_a = props.urlConfig) == null ? void 0 : _a.valueKey) != null ? _b : "value";
53
+ });
54
+ const asyncQueue = inject(InjectionAsyncQueue);
55
+ const fetchData = useDebounceFn(async (content = "", contentType = "label") => {
56
+ if (!props.urlConfig) {
57
+ return remoteOptions.value = null;
58
+ }
59
+ try {
60
+ remoteOptions.value = await asyncQueue.addAsync(await createUrlConfigParams({
61
+ config: {
62
+ ...props.urlConfig,
63
+ params: {
64
+ ...props.urlConfig.params,
65
+ [contentType === "value" ? valueKey.value : "keyword"]: content
66
+ }
67
+ },
68
+ cache: props.requestCache,
69
+ field: field.value
70
+ }));
71
+ console.log(remoteOptions.value);
72
+ } catch (e) {
73
+ isString(e) && formRenderLog(e);
74
+ }
75
+ });
76
+ const parsedOptions = computed(() => {
77
+ if (isArray(remoteOptions.value))
78
+ return remoteOptions.value;
79
+ if (isArray(props.options))
80
+ return props.options;
81
+ return [];
82
+ });
83
+ const {
84
+ injectValueValidate,
85
+ injectValueBindKey
86
+ } = useCommonInjection();
87
+ injectValueValidate(valueRef);
88
+ const key = injectValueBindKey(valueRef);
89
+ watch(valueRef, (value) => {
90
+ if (!value || parsedOptions.value.find((option) => option[valueKey.value] === value))
91
+ return;
92
+ return fetchData(value, "value");
93
+ });
94
+ const formItemDepsCollector = inject(InjectionFormItemDepsCollector);
95
+ watch(() => props.urlConfig, (config, oldConfig) => {
96
+ if (isEqual(config, oldConfig))
97
+ return;
98
+ remoteOptions.value = null;
99
+ if (!config)
100
+ return;
101
+ formItemDepsCollector.setDeps(fieldKey.value, config.dependKey || [], async () => {
102
+ remoteOptions.value = null;
103
+ valueRef.value = null;
104
+ });
105
+ valueRef.value && fetchData(valueRef.value, "value");
106
+ }, {
107
+ immediate: true
108
+ });
109
+ const {
110
+ menuProps,
111
+ nodeProps
112
+ } = useSelectOptionProps();
113
+ return () => {
114
+ return createVNode(NSelect, {
115
+ "remote": true,
116
+ "filterable": true,
117
+ "key": key.value,
118
+ "value": valueRef.value,
119
+ "onUpdate:value": ($event) => valueRef.value = $event,
120
+ "labelField": labelKey.value,
121
+ "valueField": valueKey.value,
122
+ "menu-props": menuProps,
123
+ "node-props": nodeProps,
124
+ "onSearch": fetchData,
125
+ "onUpdate:show": (show) => show && fetchData(),
126
+ "options": parsedOptions.value,
127
+ "onFocus": visitedDecorator(field, props.onFocus)
128
+ }, slots);
129
+ };
130
+ }
131
+ });
132
+ const REMOTE_SEARCH = connect(script, mapProps(assignUpdateValue, assignClearBindVisited));
133
+
134
+ export { REMOTE_SEARCH };
@@ -1,11 +1,11 @@
1
- import { defineComponent, computed, inject, createVNode } from 'vue';
1
+ import { defineComponent, inject, createVNode } from 'vue';
2
+ import { useVModel } from '@vueuse/core';
2
3
  import { cloneDeep } from 'lodash-es';
3
4
  import { InjectionChangeContextCollector } from '../../constants/index.js';
4
5
  import '../../../../../shared/utils/index.js';
5
6
  import '../../../index.js';
6
7
  import '../../utils/index.js';
7
8
  import { useFormField } from '../../hooks/useFormField.js';
8
- import '@vueuse/core';
9
9
  import '../../../../../shared/utils/tapable/SyncHook.js';
10
10
  import '../../../../../shared/utils/tapable/SyncBailHook.js';
11
11
  import '../../../../../shared/utils/tapable/SyncWaterfallHook.js';
@@ -58,10 +58,7 @@ const script = defineComponent({
58
58
  slots,
59
59
  emit
60
60
  }) {
61
- const valueRef = computed({
62
- get: () => props.value,
63
- set: (v) => emit("update:value", v)
64
- });
61
+ const valueRef = useVModel(props, "value", emit);
65
62
  const {
66
63
  field,
67
64
  fieldKey
@@ -3,7 +3,7 @@ import { UrlConfig } from '../../types';
3
3
  import { PropType } from 'vue';
4
4
  export declare const SELECT: import("vue").DefineComponent<{
5
5
  value: {
6
- type: PropType<ArrayAble<string>>;
6
+ type: PropType<ArrayAble<string> | null>;
7
7
  };
8
8
  lazyRequest: {
9
9
  type: BooleanConstructor;
@@ -26,7 +26,7 @@ export declare const SELECT: import("vue").DefineComponent<{
26
26
  onChange: {};
27
27
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:value"[], "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
28
28
  value: {
29
- type: PropType<ArrayAble<string>>;
29
+ type: PropType<ArrayAble<string> | null>;
30
30
  };
31
31
  lazyRequest: {
32
32
  type: BooleanConstructor;
@@ -1,12 +1,11 @@
1
- import { defineComponent, computed, ref, inject, watch, createVNode } from 'vue';
2
- import { isField } from '@formily/core';
3
- import { useDebounceFn } from '@vueuse/core';
1
+ import { defineComponent, ref, computed, inject, watch, createVNode } from 'vue';
2
+ import { useVModel, useDebounceFn } from '@vueuse/core';
4
3
  import { isString, cloneDeep, isEqual } from 'lodash-es';
5
4
  import { useCommonInjection, useSelectOptionProps } from '../../hooks/useCommonInjection.js';
6
5
  import { InjectionAsyncQueue, InjectionChangeContextCollector, InjectionFormItemDepsCollector } from '../../constants/index.js';
7
6
  import '../../../../../shared/utils/index.js';
8
7
  import '../../../index.js';
9
- import { formRenderLog, optionMatcher } from '../../utils/index.js';
8
+ import { createUrlConfigParams, formRenderLog, optionMatcher } from '../../utils/index.js';
10
9
  import { useFormField } from '../../hooks/useFormField.js';
11
10
  import '../../../../../shared/utils/tapable/SyncHook.js';
12
11
  import '../../../../../shared/utils/tapable/SyncBailHook.js';
@@ -19,11 +18,12 @@ import '../../../../../shared/utils/tapable/AsyncSeriesBailHook.js';
19
18
  import '../../../../../shared/utils/tapable/AsyncSeriesLoopHook.js';
20
19
  import '../../../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js';
21
20
  import '../../hooks/useFormValidator.js';
21
+ import '@formily/core';
22
22
  import '@vue/shared';
23
23
  import { connect, mapProps } from '@formily/vue';
24
24
  import './index.js';
25
25
  import { NSelect } from 'naive-ui';
26
- import { traverseDependKey, visitedDecorator, assignUpdateValue, assignClearBindVisited } from '../../utils/schema.js';
26
+ import { visitedDecorator, assignUpdateValue, assignClearBindVisited } from '../../utils/schema.js';
27
27
 
28
28
  const script = defineComponent({
29
29
  name: "FormSelect",
@@ -56,10 +56,7 @@ const script = defineComponent({
56
56
  slots,
57
57
  emit
58
58
  }) {
59
- const valueRef = computed({
60
- get: () => props.value,
61
- set: (v) => emit("update:value", v)
62
- });
59
+ const valueRef = useVModel(props, "value", emit);
63
60
  const remoteOptions = ref(null);
64
61
  const lastSearch = ref("");
65
62
  const labelKey = computed(() => {
@@ -77,41 +74,20 @@ const script = defineComponent({
77
74
  const asyncQueue = inject(InjectionAsyncQueue);
78
75
  const fetchData = useDebounceFn(async function(content) {
79
76
  lastSearch.value = content || "";
80
- if (!configFor(props)) {
77
+ if (!props.urlConfig) {
81
78
  return remoteOptions.value = null;
82
79
  }
83
80
  if (remoteOptions.value && props.requestCache)
84
81
  return;
85
82
  try {
86
- remoteOptions.value = await asyncQueue.addAsync(await createParams(configFor(props), field.value, fieldKey.value));
83
+ remoteOptions.value = await asyncQueue.addAsync(await createUrlConfigParams({
84
+ config: props.urlConfig,
85
+ cache: props.requestCache,
86
+ field: field.value
87
+ }));
87
88
  } catch (e) {
88
89
  isString(e) && formRenderLog(e);
89
90
  }
90
- async function createParams(config, field2, key2) {
91
- const _params = {};
92
- try {
93
- traverseDependKey(config.dependKey, (dependKey, valueKey2, required) => {
94
- const _field = field2.query(dependKey).take();
95
- if (!isField(_field))
96
- return;
97
- if (required && _field.value == null) {
98
- throw `\u7F3A\u5C11\u5FC5\u987B\u7684\u53C2\u6570=>${dependKey}`;
99
- }
100
- _params[valueKey2] = _field.value;
101
- });
102
- } catch (e) {
103
- return Promise.reject(e);
104
- }
105
- return {
106
- ...config,
107
- params: Object.assign({}, config.params, _params),
108
- key: key2,
109
- cache: props.requestCache
110
- };
111
- }
112
- function configFor(target) {
113
- return target.urlConfig;
114
- }
115
91
  }, 300);
116
92
  const parsedOptions = computed(() => {
117
93
  if (remoteOptions.value)
@@ -219,6 +219,7 @@ function useFieldListAdaptor(collector) {
219
219
  ["INPUT", createInputSchema],
220
220
  ["INPUT_NUMBER", createInputNumberSchema],
221
221
  ["SELECT", createSelectSchema],
222
+ ["REMOTE_SEARCH", createSelectSchema],
222
223
  ["DATE", createDateSchema],
223
224
  ["LEVEL_SEARCH_CASCADE", createLevelSearchCascadeSchema],
224
225
  ["SEARCH_CASCADE", createSearchCascadeSchema],
@@ -1,7 +1,7 @@
1
1
  import { AnyObject, ArrayAble, Nullable } from '../../../../../es/shared/types';
2
2
  import { GeneralField } from '@formily/core';
3
3
  import { FunctionalComponent, InjectionKey, VNode } from 'vue';
4
- import { FieldItem } from '../types';
4
+ import { FieldItem, UrlConfig } from '../types';
5
5
  export * from './business';
6
6
  export * from './dom';
7
7
  export * from './schema';
@@ -22,3 +22,17 @@ export declare function combineExtendKey(fieldList: FieldItem[], values: AnyObje
22
22
  export declare function splitExtendKey(fieldList: FieldItem[], values: AnyObject): AnyObject;
23
23
  export declare function isNestedType(type?: string): boolean | "" | undefined;
24
24
  export declare function isNestedFieldType(field: FieldItem | GeneralField): boolean | "" | undefined;
25
+ export declare function createUrlConfigParams({ config, field, cache }: {
26
+ config: UrlConfig;
27
+ field: GeneralField;
28
+ cache?: boolean;
29
+ }): Promise<{
30
+ params: AnyObject;
31
+ key: string;
32
+ cache: boolean | undefined;
33
+ url: string;
34
+ method?: import("../../../../../es/components/form-render").FormRequestType | undefined;
35
+ nameKey?: string | undefined;
36
+ valueKey?: string | undefined;
37
+ dependKey?: import("../../../../../es/components/form-render").DependKeyType | undefined;
38
+ }>;
@@ -1,12 +1,15 @@
1
1
  import { inject, provide, computed, createVNode, Fragment } from 'vue';
2
2
  import { arrayed } from '../../../../shared/utils/index.js';
3
- import { isGeneralField } from '@formily/core';
3
+ import { isGeneralField, isField } from '@formily/core';
4
4
  import { Path } from '@formily/path';
5
5
  import { isObject } from '@vue/shared';
6
6
  import { useMemoize } from '@vueuse/core';
7
7
  import { isString, isFunction, omit } from 'lodash-es';
8
+ import '../../index.js';
8
9
  import { NESTED_FORM_ITEM_TYPE } from '../constants/index.js';
9
10
  import 'date-fns';
11
+ import { traverseDependKey } from './schema.js';
12
+ export { assignClearBindVisited, assignUpdateValue, assignValueBindKey, createLinebarId, createObjSchema, dotEscape, fieldKeyEscape, getParentLinebar, traverseDependKey, traverseSchema, visitedDecorator } from './schema.js';
10
13
 
11
14
  function formRenderLog(message) {
12
15
  console.warn(`[FormRender]: ${message}`);
@@ -197,5 +200,32 @@ function isNestedType(type) {
197
200
  function isNestedFieldType(field) {
198
201
  return isNestedType(isGeneralField(field) ? field.componentType : field.html_type);
199
202
  }
203
+ async function createUrlConfigParams({
204
+ config,
205
+ field,
206
+ cache
207
+ }) {
208
+ const _params = {};
209
+ const key = field.props.name.toString();
210
+ try {
211
+ traverseDependKey(config.dependKey || [], (dependKey, valueKey, required) => {
212
+ const _field = field.query(dependKey).take();
213
+ if (!isField(_field))
214
+ return;
215
+ if (required && _field.value == null) {
216
+ throw `\u7F3A\u5C11\u5FC5\u987B\u7684\u53C2\u6570=>${dependKey}`;
217
+ }
218
+ _params[valueKey] = _field.value;
219
+ });
220
+ } catch (e) {
221
+ return Promise.reject(e);
222
+ }
223
+ return {
224
+ ...config,
225
+ params: Object.assign({}, config.params, _params),
226
+ key,
227
+ cache
228
+ };
229
+ }
200
230
 
201
- export { combineExtendKey, createInputSlot, createSlot, formRenderLog, injectOrProvide, isNestedFieldType, isNestedType, mergeDeepProperties, optionMatcher, parseNumberFromMaybeString, presetRequestHandler, splitExtendKey, validateMessageParser };
231
+ export { combineExtendKey, createInputSlot, createSlot, createUrlConfigParams, formRenderLog, injectOrProvide, isNestedFieldType, isNestedType, mergeDeepProperties, optionMatcher, parseNumberFromMaybeString, presetRequestHandler, splitExtendKey, validateMessageParser };
@@ -60,7 +60,7 @@ export { useCommonInjection, useSelectOptionProps } from './form-render/src/hook
60
60
  export { businessDateParser, isIdCard, isMobile, parseAge2Birthday, parseAge2FromContext, parseBirthday, parseIdCard, transformDateFormat } from './form-render/src/utils/business.js';
61
61
  export { findNextWidget, queryDecorator, queryInput } from './form-render/src/utils/dom.js';
62
62
  export { assignClearBindVisited, assignUpdateValue, assignValueBindKey, createLinebarId, createObjSchema, dotEscape, fieldKeyEscape, getParentLinebar, traverseDependKey, traverseSchema, visitedDecorator } from './form-render/src/utils/schema.js';
63
- export { combineExtendKey, createInputSlot, createSlot, formRenderLog, injectOrProvide, isNestedFieldType, isNestedType, mergeDeepProperties, optionMatcher, parseNumberFromMaybeString, presetRequestHandler, splitExtendKey, validateMessageParser } from './form-render/src/utils/index.js';
63
+ export { combineExtendKey, createInputSlot, createSlot, createUrlConfigParams, formRenderLog, injectOrProvide, isNestedFieldType, isNestedType, mergeDeepProperties, optionMatcher, parseNumberFromMaybeString, presetRequestHandler, splitExtendKey, validateMessageParser } from './form-render/src/utils/index.js';
64
64
  export * from '@formily/core';
65
65
  export { GlobalShortcutProvider, ShortcutManager, useShortcuts } from './shortcut-provider/src/hooks/useShortcuts.js';
66
66
  export { useShortcutSignature } from './shortcut-provider/src/hooks/useShortcutSignature.js';
@@ -106,6 +106,7 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
106
106
  isRemote: import("vue").ComputedRef<boolean>;
107
107
  init: () => void;
108
108
  transformTree: (tree: any) => void;
109
+ setDisabled: (data: any) => void;
109
110
  renderLabel: ({ option }: {
110
111
  option: any;
111
112
  }) => any;
@@ -105,6 +105,7 @@ declare const _default: import("vue").DefineComponent<{
105
105
  isRemote: import("vue").ComputedRef<boolean>;
106
106
  init: () => void;
107
107
  transformTree: (tree: any) => void;
108
+ setDisabled: (data: any) => void;
108
109
  renderLabel: ({ option }: {
109
110
  option: any;
110
111
  }) => any;
@@ -98,6 +98,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
98
98
  item.key = item[props.wordbookChild.user_id_obj] || item[props.wordbook.parent_id_obj] || Date.now();
99
99
  if ((_a = item.children) == null ? void 0 : _a.length) {
100
100
  transformTree(item.children);
101
+ setDisabled(item);
101
102
  } else if (((_b = item.children) == null ? void 0 : _b.length) === 0) {
102
103
  Reflect.deleteProperty(item, "children");
103
104
  }
@@ -105,20 +106,27 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
105
106
  allCheckedKeys.push(item.key);
106
107
  });
107
108
  }
109
+ function setDisabled(data) {
110
+ var _a;
111
+ const isDisabled = (_a = data.children) == null ? void 0 : _a.every((item) => item.disabled);
112
+ if (isDisabled)
113
+ data.disabled = true;
114
+ }
108
115
  function renderLabel({
109
116
  option
110
117
  }) {
111
118
  var _a;
112
- if (option.isLeaf || !((_a = option.children) == null ? void 0 : _a.length)) {
119
+ if (((_a = option.children) == null ? void 0 : _a.length) || isRemote.value && !(option == null ? void 0 : option.isLeaf)) {
120
+ const count = props.wordbook.user_count_obj ? option[props.wordbook.user_count_obj] || "" : "";
121
+ const countText = count ? `(${count})` : "";
122
+ return createVNode("span", null, [`${option.title}${countText}`]);
123
+ } else {
113
124
  return createVNode(NTooltip, {
114
125
  "trigger": "hover"
115
126
  }, {
116
127
  default: () => createVNode("span", null, [option.title]),
117
128
  trigger: () => createVNode("span", null, [option.title])
118
129
  });
119
- } else {
120
- const count = props.wordbook.user_count_obj ? option[props.wordbook.user_count_obj] || "" : "";
121
- return createVNode("span", null, [`${option.title}${count}`]);
122
130
  }
123
131
  }
124
132
  function getLabelName(option) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.1.30-beta.0",
3
+ "version": "3.1.30-beta.2",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -61,5 +61,5 @@
61
61
  "iOS 7",
62
62
  "last 3 iOS versions"
63
63
  ],
64
- "gitHead": "514d321dab9741b96606b7dda8626a0aa56591c5"
64
+ "gitHead": "bcdfa57a1f8c8eec2a87272a30ef0d505214966c"
65
65
  }