cnhis-design-vue 3.1.30-beta.3 → 3.1.30-beta.5
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.
- package/es/components/form-render/src/components/renderer/index.js +2 -2
- package/es/components/form-render/src/components/renderer/{levelSearchCascade.d.ts → levelSearchCascader.d.ts} +1 -1
- package/es/components/form-render/src/components/renderer/{levelSearchCascade.js → levelSearchCascader.js} +2 -2
- package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
- package/es/components/form-render/src/hooks/useFieldNormalize.js +2 -1
- package/es/components/form-render/src/utils/business.js +24 -2
- package/es/components/iho-table/index.d.ts +59 -0
- package/es/components/iho-table/src/IhoTable.js +6 -6
- package/es/components/iho-table/src/IhoTable.vue.d.ts +59 -0
- package/es/components/iho-table/src/hooks/tapHooks/index.js +3 -1
- package/es/components/iho-table/src/plugins/lowCodeFieldAdaptorPlugin/index.js +2 -1
- package/es/components/iho-table/src/types/index.d.ts +4 -2
- package/es/components/iho-table/style/index.css +1 -1
- package/es/components/index.css +1 -1
- package/es/components/index.d.ts +2 -1
- package/es/components/index.js +4 -1
- package/es/components/search-cascader/index.d.ts +33 -12
- package/es/components/search-cascader/src/SearchCascader.js +26 -20
- package/es/components/search-cascader/src/SearchCascader.vue.d.ts +33 -12
- package/es/components/search-cascader/src/components/SearchMenu.d.ts +14 -9
- package/es/components/search-cascader/src/components/SearchMenu.js +77 -15
- package/es/components/search-cascader/src/constants/index.d.ts +3 -1
- package/es/components/search-cascader/src/constants/index.js +7 -1
- package/es/components/select-person/src/SelectPerson.vue_vue_type_script_setup_true_lang.js +20 -15
- package/es/shared/utils/index.d.ts +1 -0
- package/es/shared/utils/index.js +4 -1
- package/package.json +2 -2
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { defineComponent, computed, ref,
|
|
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 {
|
|
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
|
|
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
|
-
|
|
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 =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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: (
|
|
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,
|
|
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
|
|
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,
|
|
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 {
|
|
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": (
|
|
96
|
+
"search-cascader__option--active": isActive(item.data)
|
|
50
97
|
}],
|
|
51
|
-
"onClick": () => emit("nodeClick",
|
|
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
|
-
}, [
|
|
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":
|
|
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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, watch, openBlock, createBlock, unref, withCtx, createVNode, withKeys, createTextVNode, toDisplayString, createCommentVNode, createElementBlock, createElementVNode, Fragment, renderList } from 'vue';
|
|
1
|
+
import { defineComponent, ref, computed, watch, openBlock, createBlock, unref, withCtx, createVNode, withKeys, createTextVNode, toDisplayString, withDirectives, vShow, createCommentVNode, createElementBlock, createElementVNode, Fragment, renderList } from 'vue';
|
|
2
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';
|
|
@@ -90,8 +90,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
function transformTree(tree) {
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
var _a, _b;
|
|
94
|
+
for (let i = 0, len = tree.length; i < len; i++) {
|
|
95
|
+
const item = tree[i];
|
|
95
96
|
item.title = getLabelName(item);
|
|
96
97
|
if (!item.key)
|
|
97
98
|
item.key = item[props.wordbookChild.user_id_obj] || item[props.wordbook.parent_id_obj] || Date.now();
|
|
@@ -103,7 +104,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
103
104
|
}
|
|
104
105
|
if (!item.disabled && !item.children)
|
|
105
106
|
allCheckedKeys.push(item.key);
|
|
106
|
-
}
|
|
107
|
+
}
|
|
107
108
|
}
|
|
108
109
|
function setDisabled(data) {
|
|
109
110
|
var _a;
|
|
@@ -132,12 +133,13 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
132
133
|
return option[props.wordbookChild.user_name_obj] || option[props.wordbook.parent_name_obj] || option["orgName"] || option["title"] || "";
|
|
133
134
|
}
|
|
134
135
|
function setAllCheckedKeys(tree) {
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
var _a;
|
|
137
|
+
for (let i = 0, len = tree.length; i < len; i++) {
|
|
138
|
+
const item = tree[i];
|
|
137
139
|
((_a = item.children) == null ? void 0 : _a.length) && setAllCheckedKeys(item.children);
|
|
138
140
|
if (!item.disabled && !item.children)
|
|
139
141
|
allCheckedKeys.push(item.key);
|
|
140
|
-
}
|
|
142
|
+
}
|
|
141
143
|
}
|
|
142
144
|
async function searchClick() {
|
|
143
145
|
if (!isRemote.value) {
|
|
@@ -150,7 +152,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
150
152
|
}
|
|
151
153
|
}
|
|
152
154
|
function setTreeCheckd(tree, checked) {
|
|
153
|
-
tree.
|
|
155
|
+
for (let i = 0, len = tree.length; i < len; i++) {
|
|
156
|
+
const item = tree[i];
|
|
154
157
|
if (!item.disabled && (!item.children || item.isLeaf)) {
|
|
155
158
|
if (checked && !checkedKeys.value.includes(item.key)) {
|
|
156
159
|
checkedKeys.value.push(item.key);
|
|
@@ -161,20 +164,21 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
161
164
|
}
|
|
162
165
|
}
|
|
163
166
|
item.children && setTreeCheckd(item.children, checked);
|
|
164
|
-
}
|
|
167
|
+
}
|
|
165
168
|
}
|
|
166
169
|
function checkedAllChange(checked) {
|
|
167
170
|
setTreeCheckd(treeData.value, checked);
|
|
168
171
|
}
|
|
169
172
|
function setTagData(tree) {
|
|
170
|
-
|
|
171
|
-
|
|
173
|
+
var _a;
|
|
174
|
+
for (let i = 0, len = tree.length; i < len; i++) {
|
|
175
|
+
const item = tree[i];
|
|
172
176
|
checkedKeys.value.includes(item.key) && tagData.value.push({
|
|
173
177
|
key: item.key,
|
|
174
178
|
name: item.title
|
|
175
179
|
});
|
|
176
180
|
((_a = item.children) == null ? void 0 : _a.length) && setTagData(item.children);
|
|
177
|
-
}
|
|
181
|
+
}
|
|
178
182
|
}
|
|
179
183
|
function updateTreeChecked(keys) {
|
|
180
184
|
checkedKeys.value = keys;
|
|
@@ -228,14 +232,15 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
228
232
|
_: 1
|
|
229
233
|
})]),
|
|
230
234
|
_: 1
|
|
231
|
-
}), __props.multiple ? (openBlock(), createBlock(unref(NCheckbox), {
|
|
235
|
+
}), __props.multiple ? withDirectives((openBlock(), createBlock(unref(NCheckbox), {
|
|
232
236
|
key: 0,
|
|
233
237
|
checked: checkedAll.value,
|
|
234
238
|
"onUpdate:checked": [_cache[1] || (_cache[1] = ($event) => checkedAll.value = $event), checkedAllChange]
|
|
235
239
|
}, {
|
|
236
|
-
default: withCtx(() => [createTextVNode("\u5168\u9009")]),
|
|
240
|
+
default: withCtx(() => [createTextVNode(" \u5168\u9009 ")]),
|
|
237
241
|
_: 1
|
|
238
|
-
}, 8, ["checked"])) : createCommentVNode("v-if", true), createVNode(unref(NTree), {
|
|
242
|
+
}, 8, ["checked"])), [[vShow, unref(allCheckedKeys).length < 1e3]]) : createCommentVNode("v-if", true), createVNode(unref(NTree), {
|
|
243
|
+
"virtual-scroll": "",
|
|
239
244
|
class: "c-select-person__scroll",
|
|
240
245
|
"checked-keys": checkedKeys.value,
|
|
241
246
|
"expanded-keys": expandedKeys.value,
|
|
@@ -11,3 +11,4 @@ export declare function deepOmit<T extends AnyObject>(target: T, keys: Array<key
|
|
|
11
11
|
export declare function separateMetaModule<T extends AnyObject>(modules: Record<string, unknown>): T;
|
|
12
12
|
export declare function findAncestor(ele: HTMLElement | null, finder: (ele: HTMLElement) => boolean): HTMLElement | null;
|
|
13
13
|
export declare function widthAppend(value: string | number, append?: string): string;
|
|
14
|
+
export declare function vIf(solution: unknown, node: unknown): unknown;
|
package/es/shared/utils/index.js
CHANGED
|
@@ -136,5 +136,8 @@ function widthAppend(value, append = "px") {
|
|
|
136
136
|
return value.endsWith(append) ? value : `${value}${append}`;
|
|
137
137
|
throw new Error(`invalid width value ${value}, it need to be a string or number!`);
|
|
138
138
|
}
|
|
139
|
+
function vIf(solution, node) {
|
|
140
|
+
return solution ? node : null;
|
|
141
|
+
}
|
|
139
142
|
|
|
140
|
-
export { DMZ, arrayed, deepOmit, findAncestor, generateTimeFormat, getStringWidth, safeComponentRegister, separateMetaModule, traverse, uuidGenerator, widthAppend };
|
|
143
|
+
export { DMZ, arrayed, deepOmit, findAncestor, generateTimeFormat, getStringWidth, safeComponentRegister, separateMetaModule, traverse, uuidGenerator, vIf, widthAppend };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnhis-design-vue",
|
|
3
|
-
"version": "3.1.30-beta.
|
|
3
|
+
"version": "3.1.30-beta.5",
|
|
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": "
|
|
64
|
+
"gitHead": "93cc1629ddfeb69efa6e0430facd6a5f39fa98c4"
|
|
65
65
|
}
|