cnhis-design-vue 3.1.23-beta.0 → 3.1.23-beta.11
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/README.md +123 -123
- package/es/components/big-table/index.d.ts +0 -3
- package/es/components/big-table/src/BigTable.vue.d.ts +0 -3
- package/es/components/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +9 -20
- package/es/components/big-table/src/utils.d.ts +1 -1
- package/es/components/big-table/src/utils2.js +11 -37
- package/es/components/fabric-chart/src/components/PopupMenu.js +7 -2
- package/es/components/fabric-chart/src/hooks/useCenter2.js +9 -5
- package/es/components/fabric-chart/src/hooks/useEvent2.js +40 -8
- package/es/components/field-set/index.d.ts +1 -0
- package/es/components/field-set/src/FieldSet.js +16 -10
- package/es/components/field-set/src/FieldSet.vue.d.ts +1 -0
- package/es/components/form-config/index.d.ts +6 -0
- package/es/components/form-config/src/FormConfig.vue.d.ts +6 -0
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +6 -0
- package/es/components/form-render/index2.js +2 -1
- package/es/components/form-render/src/components/renderer/index.d.ts +2 -1
- package/es/components/form-render/src/components/renderer/index.js +2 -1
- package/es/components/form-render/src/components/renderer/index2.js +2 -1
- package/es/components/form-render/src/components/renderer/levelSearchCascade.d.ts +86 -0
- package/es/components/form-render/src/components/renderer/levelSearchCascade.js +229 -0
- package/es/components/form-render/src/components/renderer/search.d.ts +13 -1
- package/es/components/form-render/src/components/renderer/search.js +2 -1
- package/es/components/form-render/src/components/renderer/{cascader.d.ts → searchCascade.d.ts} +0 -0
- package/es/components/form-render/src/components/renderer/{cascader.js → searchCascade.js} +1 -0
- package/es/components/form-render/src/components/renderer/select.js +2 -1
- package/es/components/form-render/src/hooks/useAsyncQueue2.js +4 -4
- package/es/components/form-render/src/hooks/useFieldListAdaptor2.js +11 -4
- package/es/components/form-render/src/hooks/useFormRequest.d.ts +2 -0
- package/es/components/form-render/src/hooks/useFormRequest2.js +1 -1
- package/es/components/form-render/src/types/fieldItem.d.ts +6 -0
- package/es/components/form-render/src/utils/schema2.js +1 -4
- package/es/components/iho-table/index.d.ts +270 -101
- package/es/components/iho-table/src/IhoTable.vue.d.ts +270 -101
- package/es/components/iho-table/src/constants/index.d.ts +5 -3
- package/es/components/iho-table/src/constants/index.js +1 -1
- package/es/components/iho-table/src/constants/index2.js +9 -7
- package/es/components/iho-table/src/hooks/tapHooks/index.d.ts +2 -2
- package/es/components/iho-table/src/plugins/index.js +4 -1
- package/es/components/iho-table/src/plugins/index2.js +4 -1
- package/es/components/iho-table/src/plugins/lowCodeFieldAdaptorPlugin/index2.js +11 -8
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/editDate.d.ts +31 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/editDate.js +205 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/index.d.ts +1 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/index.js +39 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/hooks/useCommon.js +1 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/hooks/useCommon2.js +17 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/index.d.ts +4 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/index.js +4 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/inputRendererPlugin.d.ts +1 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/{inputRendererPlugins.js → inputRendererPlugin.js} +4 -4
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.d.ts +31 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +60 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/index.d.ts +1 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/index.js +40 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/selectUtils.d.ts +2 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/selectUtils.js +1 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/selectUtils2.js +20 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/{edit-separate.js → editSeparate.js} +20 -22
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/{edit-separate.vue.d.ts → editSeparate.vue.d.ts} +1 -17
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/index.js +13 -9
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/{separate-utils.d.ts → separateUtils.d.ts} +0 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/{separate-utils.js → separateUtils.js} +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/{separate-utils2.js → separateUtils2.js} +4 -4
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.d.ts +31 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.js +60 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/index.d.ts +1 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/index.js +39 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/index.js +4 -1
- package/es/components/iho-table/src/plugins/rowGroupSettingPlugin/index2.js +1 -46
- package/es/components/iho-table/src/plugins/rowGroupSettingPlugin/rowGroupUtils.d.ts +11 -0
- package/es/components/iho-table/src/plugins/rowGroupSettingPlugin/rowGroupUtils.js +1 -0
- package/es/components/iho-table/src/plugins/rowGroupSettingPlugin/rowGroupUtils2.js +50 -0
- package/es/components/iho-table/src/types/index.d.ts +0 -3
- package/es/components/index.css +1 -1
- package/es/components/scale-view/src/hooks/use-component.d.ts +1 -0
- package/es/components/search-cascader/index.d.ts +196 -0
- package/es/components/search-cascader/index.js +1 -0
- package/es/components/search-cascader/index2.js +10 -0
- package/es/components/search-cascader/src/SearchCascader.js +168 -0
- package/es/components/search-cascader/src/SearchCascader.vue.d.ts +198 -0
- package/es/components/search-cascader/src/components/SearchMenu.d.ts +45 -0
- package/es/components/search-cascader/src/components/SearchMenu.js +134 -0
- package/es/components/search-cascader/src/components/index.d.ts +1 -0
- package/es/components/search-cascader/src/components/index.js +1 -0
- package/es/components/search-cascader/src/constants/index.d.ts +3 -0
- package/es/components/search-cascader/src/constants/index.js +1 -0
- package/es/components/search-cascader/src/constants/index2.js +3 -0
- package/es/components/search-cascader/src/hooks/index.d.ts +1 -0
- package/es/components/search-cascader/src/hooks/index.js +1 -0
- package/es/components/search-cascader/src/hooks/useCssVariable.d.ts +3 -0
- package/es/components/search-cascader/src/hooks/useCssVariable.js +1 -0
- package/es/components/search-cascader/src/hooks/useCssVariable2.js +7 -0
- package/es/components/search-cascader/src/utils/index.d.ts +2 -0
- package/es/components/search-cascader/src/utils/index.js +1 -0
- package/es/components/search-cascader/src/utils/index2.js +11 -0
- package/es/components/search-cascader/style/index.css +1 -0
- package/es/components/select-label/index.d.ts +1 -0
- package/es/components/select-label/src/SelectLabel.vue.d.ts +1 -0
- package/es/components/select-label/src/SelectLabel.vue_vue_type_script_setup_true_lang.js +16 -4
- package/es/components/select-person/index.d.ts +41 -0
- package/es/components/select-person/src/SelectPerson.vue.d.ts +41 -0
- package/es/components/select-person/src/SelectPerson.vue_vue_type_script_setup_true_lang.js +45 -10
- package/es/components/select-person/style/index.css +1 -1
- package/es/components/shortcut-provider/src/ShortcutProvider.js +2 -1
- package/es/components/shortcut-setter/index.d.ts +6 -0
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +6 -0
- package/es/shared/components/no-data/NoData.js +74 -0
- package/es/shared/components/no-data/NoData.vue.d.ts +51 -0
- package/es/shared/components/no-data/index.d.ts +2 -0
- package/es/shared/components/no-data/index.js +1 -0
- package/es/shared/components/no-data/index2.js +2 -0
- package/es/shared/utils/index.d.ts +1 -1
- package/es/shared/utils/index2.js +14 -5
- package/package.json +2 -2
- package/es/components/big-table/src/components/edit-form/useCommon.d.ts +0 -4
- package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
- package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
- package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
- package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
- package/es/components/fabric-chart/src/utils/index.d.ts +0 -6823
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/inputRendererPlugins.d.ts +0 -1
- package/es/shared/utils/tapable/index.d.ts +0 -139
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, provide, nextTick, openBlock, createBlock, unref, normalizeStyle, withCtx, createVNode, isRef, createElementVNode, renderSlot } from 'vue';
|
|
2
|
+
import { uuidGenerator } from '../../../shared/utils/index2.js';
|
|
3
|
+
import { onClickOutside, useDebounceFn } from '@vueuse/core';
|
|
4
|
+
import { isString, isArray, isFunction } from 'lodash-es';
|
|
5
|
+
import { NPopover, NInput } from 'naive-ui';
|
|
6
|
+
import { InjectionSearchCascaderLoadingNode } from './constants/index2.js';
|
|
7
|
+
import { useCssVariable } from './hooks/useCssVariable2.js';
|
|
8
|
+
import { SearchMenu } from './components/SearchMenu.js';
|
|
9
|
+
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.js';
|
|
10
|
+
|
|
11
|
+
const _hoisted_1 = ["id"];
|
|
12
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
13
|
+
__name: "SearchCascader",
|
|
14
|
+
props: {
|
|
15
|
+
value: { type: [String, Array] },
|
|
16
|
+
clearable: { type: Boolean, default: false },
|
|
17
|
+
childKey: { type: String, default: "children" },
|
|
18
|
+
placeholder: { type: String, default: "\u8BF7\u9009\u62E9" },
|
|
19
|
+
editPlaceholder: { type: String, default: "\u8BF7\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u641C\u7D22" },
|
|
20
|
+
options: { type: Array, default: () => [] },
|
|
21
|
+
search: { type: Function },
|
|
22
|
+
labelKey: { type: String, default: "label" },
|
|
23
|
+
valueKey: { type: String, default: "value" },
|
|
24
|
+
beforeSetValue: { type: Function }
|
|
25
|
+
},
|
|
26
|
+
emits: ["update:value", "focus"],
|
|
27
|
+
setup(__props, { emit: emits }) {
|
|
28
|
+
const props = __props;
|
|
29
|
+
function emitValue(value) {
|
|
30
|
+
Promise.resolve(isFunction(props.beforeSetValue) ? props.beforeSetValue(value) : value).then((result) => {
|
|
31
|
+
emits("update:value", result);
|
|
32
|
+
}, () => {
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function onClear() {
|
|
36
|
+
emitValue([]);
|
|
37
|
+
}
|
|
38
|
+
const cssVariable = useCssVariable();
|
|
39
|
+
const uuid = uuidGenerator();
|
|
40
|
+
const show = ref(false);
|
|
41
|
+
const patternContent = ref("");
|
|
42
|
+
const displayValue = computed({
|
|
43
|
+
get() {
|
|
44
|
+
if (show.value)
|
|
45
|
+
return patternContent.value;
|
|
46
|
+
if (isString(props.value))
|
|
47
|
+
return props.value;
|
|
48
|
+
if (isArray(props.value))
|
|
49
|
+
return arrayOptionsToString(props.value);
|
|
50
|
+
return "";
|
|
51
|
+
function arrayOptionsToString(optionList) {
|
|
52
|
+
return optionList.reduce((res, item, idx) => {
|
|
53
|
+
if (idx === 0)
|
|
54
|
+
return item[props.labelKey];
|
|
55
|
+
return res + " / " + item[props.labelKey];
|
|
56
|
+
}, "");
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
set(value) {
|
|
60
|
+
patternContent.value = value;
|
|
61
|
+
search(void 0, value);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
function onFocus(focusEvt) {
|
|
65
|
+
emits("focus", focusEvt);
|
|
66
|
+
openMenu();
|
|
67
|
+
}
|
|
68
|
+
function openMenu() {
|
|
69
|
+
if (show.value)
|
|
70
|
+
return;
|
|
71
|
+
show.value = true;
|
|
72
|
+
patternContent.value = "";
|
|
73
|
+
search();
|
|
74
|
+
}
|
|
75
|
+
async function closeMenu() {
|
|
76
|
+
var _a;
|
|
77
|
+
show.value = false;
|
|
78
|
+
(_a = inputRef.value) == null ? void 0 : _a.blur();
|
|
79
|
+
}
|
|
80
|
+
const inputRef = ref();
|
|
81
|
+
onClickOutside(inputRef, (evt) => {
|
|
82
|
+
var _a;
|
|
83
|
+
if (!show.value)
|
|
84
|
+
return;
|
|
85
|
+
if (!evt.target)
|
|
86
|
+
return closeMenu();
|
|
87
|
+
if (isInPopper(evt.target)) {
|
|
88
|
+
(_a = inputRef.value) == null ? void 0 : _a.focus();
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
closeMenu();
|
|
92
|
+
function isInPopper(targetEle) {
|
|
93
|
+
let result = false;
|
|
94
|
+
let current = targetEle;
|
|
95
|
+
while (current) {
|
|
96
|
+
if (current.id === uuid) {
|
|
97
|
+
result = true;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
current = current.parentElement;
|
|
101
|
+
}
|
|
102
|
+
return result;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
const popoverRef = ref();
|
|
106
|
+
const currentNode = ref();
|
|
107
|
+
const loadingNode = ref(null);
|
|
108
|
+
provide(InjectionSearchCascaderLoadingNode, loadingNode);
|
|
109
|
+
const search = useDebounceFn(async (node, keyword) => {
|
|
110
|
+
var _a;
|
|
111
|
+
try {
|
|
112
|
+
loadingNode.value = node;
|
|
113
|
+
await (isFunction(props.search) && props.search(node, keyword));
|
|
114
|
+
currentNode.value = node;
|
|
115
|
+
} finally {
|
|
116
|
+
loadingNode.value = null;
|
|
117
|
+
await nextTick();
|
|
118
|
+
(_a = popoverRef.value) == null ? void 0 : _a.syncPosition();
|
|
119
|
+
}
|
|
120
|
+
}, 400);
|
|
121
|
+
return (_ctx, _cache) => {
|
|
122
|
+
return openBlock(), createBlock(unref(NPopover), {
|
|
123
|
+
class: "search-cascader",
|
|
124
|
+
trigger: "manual",
|
|
125
|
+
show: show.value,
|
|
126
|
+
"onUpdate:show": _cache[1] || (_cache[1] = ($event) => show.value = $event),
|
|
127
|
+
"show-arrow": false,
|
|
128
|
+
placement: "bottom-start",
|
|
129
|
+
style: normalizeStyle(unref(cssVariable)),
|
|
130
|
+
width: __props.options.length ? void 0 : "trigger",
|
|
131
|
+
ref_key: "popoverRef",
|
|
132
|
+
ref: popoverRef
|
|
133
|
+
}, {
|
|
134
|
+
trigger: withCtx(() => [
|
|
135
|
+
createVNode(unref(NInput), {
|
|
136
|
+
placeholder: show.value ? __props.editPlaceholder : __props.placeholder,
|
|
137
|
+
clearable: __props.clearable,
|
|
138
|
+
onClear,
|
|
139
|
+
value: unref(displayValue),
|
|
140
|
+
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => isRef(displayValue) ? displayValue.value = $event : null),
|
|
141
|
+
ref_key: "inputRef",
|
|
142
|
+
ref: inputRef,
|
|
143
|
+
onFocus
|
|
144
|
+
}, null, 8, ["placeholder", "clearable", "value"])
|
|
145
|
+
]),
|
|
146
|
+
default: withCtx(() => [
|
|
147
|
+
createElementVNode("section", { id: unref(uuid) }, [
|
|
148
|
+
createVNode(unref(SearchMenu), {
|
|
149
|
+
"label-key": __props.labelKey,
|
|
150
|
+
options: __props.options,
|
|
151
|
+
onNodeClick: unref(search),
|
|
152
|
+
"current-node": currentNode.value
|
|
153
|
+
}, {
|
|
154
|
+
empty: withCtx(() => [
|
|
155
|
+
renderSlot(_ctx.$slots, "empty")
|
|
156
|
+
]),
|
|
157
|
+
_: 3
|
|
158
|
+
}, 8, ["label-key", "options", "onNodeClick", "current-node"])
|
|
159
|
+
], 8, _hoisted_1)
|
|
160
|
+
]),
|
|
161
|
+
_: 3
|
|
162
|
+
}, 8, ["show", "style", "width"]);
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
var script = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "SearchCascader.vue"]]);
|
|
167
|
+
|
|
168
|
+
export { script as default };
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { AnyObject, Func, Nullable } from '../../../../es/shared/types';
|
|
2
|
+
import { PropType } from 'vue';
|
|
3
|
+
declare type ValueType = string | AnyObject[];
|
|
4
|
+
declare const _default: import("vue").DefineComponent<{
|
|
5
|
+
value: {
|
|
6
|
+
type: PropType<ValueType>;
|
|
7
|
+
};
|
|
8
|
+
clearable: {
|
|
9
|
+
type: BooleanConstructor;
|
|
10
|
+
default: boolean;
|
|
11
|
+
};
|
|
12
|
+
childKey: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
default: string;
|
|
15
|
+
};
|
|
16
|
+
placeholder: {
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
20
|
+
editPlaceholder: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
default: string;
|
|
23
|
+
};
|
|
24
|
+
options: {
|
|
25
|
+
type: PropType<AnyObject[]>;
|
|
26
|
+
default: () => never[];
|
|
27
|
+
};
|
|
28
|
+
search: {
|
|
29
|
+
type: PropType<Func<any[], any>>;
|
|
30
|
+
};
|
|
31
|
+
labelKey: {
|
|
32
|
+
type: StringConstructor;
|
|
33
|
+
default: string;
|
|
34
|
+
};
|
|
35
|
+
valueKey: {
|
|
36
|
+
type: StringConstructor;
|
|
37
|
+
default: string;
|
|
38
|
+
};
|
|
39
|
+
beforeSetValue: {
|
|
40
|
+
type: PropType<(value: ValueType) => void | ValueType | Promise<ValueType>>;
|
|
41
|
+
};
|
|
42
|
+
}, {
|
|
43
|
+
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
44
|
+
value: {
|
|
45
|
+
type: PropType<ValueType>;
|
|
46
|
+
};
|
|
47
|
+
clearable: {
|
|
48
|
+
type: BooleanConstructor;
|
|
49
|
+
default: boolean;
|
|
50
|
+
};
|
|
51
|
+
childKey: {
|
|
52
|
+
type: StringConstructor;
|
|
53
|
+
default: string;
|
|
54
|
+
};
|
|
55
|
+
placeholder: {
|
|
56
|
+
type: StringConstructor;
|
|
57
|
+
default: string;
|
|
58
|
+
};
|
|
59
|
+
editPlaceholder: {
|
|
60
|
+
type: StringConstructor;
|
|
61
|
+
default: string;
|
|
62
|
+
};
|
|
63
|
+
options: {
|
|
64
|
+
type: PropType<AnyObject[]>;
|
|
65
|
+
default: () => never[];
|
|
66
|
+
};
|
|
67
|
+
search: {
|
|
68
|
+
type: PropType<Func<any[], any>>;
|
|
69
|
+
};
|
|
70
|
+
labelKey: {
|
|
71
|
+
type: StringConstructor;
|
|
72
|
+
default: string;
|
|
73
|
+
};
|
|
74
|
+
valueKey: {
|
|
75
|
+
type: StringConstructor;
|
|
76
|
+
default: string;
|
|
77
|
+
};
|
|
78
|
+
beforeSetValue: {
|
|
79
|
+
type: PropType<(value: ValueType) => void | ValueType | Promise<ValueType>>;
|
|
80
|
+
};
|
|
81
|
+
}>> & {
|
|
82
|
+
onFocus?: ((...args: any[]) => any) | undefined;
|
|
83
|
+
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
84
|
+
}>>;
|
|
85
|
+
emits: (event: "update:value" | "focus", ...args: any[]) => void;
|
|
86
|
+
emitValue: (value: ValueType) => void;
|
|
87
|
+
onClear: () => void;
|
|
88
|
+
cssVariable: {
|
|
89
|
+
'--menu-width': number;
|
|
90
|
+
};
|
|
91
|
+
uuid: string;
|
|
92
|
+
show: import("vue").Ref<boolean>;
|
|
93
|
+
patternContent: import("vue").Ref<string>;
|
|
94
|
+
displayValue: import("vue").WritableComputedRef<string>;
|
|
95
|
+
onFocus: (focusEvt: Event) => void;
|
|
96
|
+
openMenu: () => void;
|
|
97
|
+
closeMenu: () => Promise<void>;
|
|
98
|
+
inputRef: import("vue").Ref<any>;
|
|
99
|
+
popoverRef: import("vue").Ref<any>;
|
|
100
|
+
currentNode: import("vue").Ref<AnyObject | undefined>;
|
|
101
|
+
loadingNode: import("vue").Ref<Nullable<AnyObject>>;
|
|
102
|
+
search: (node?: AnyObject, keyword?: string) => Promise<void>;
|
|
103
|
+
NInput: any;
|
|
104
|
+
NPopover: any;
|
|
105
|
+
SearchMenu: import("vue").DefineComponent<{
|
|
106
|
+
childKey: {
|
|
107
|
+
type: StringConstructor;
|
|
108
|
+
default: string;
|
|
109
|
+
};
|
|
110
|
+
options: {
|
|
111
|
+
type: PropType<AnyObject[]>;
|
|
112
|
+
default: () => never[];
|
|
113
|
+
};
|
|
114
|
+
onNodeClick: {
|
|
115
|
+
type: PropType<Func<any[], any>>;
|
|
116
|
+
};
|
|
117
|
+
labelKey: {
|
|
118
|
+
type: StringConstructor;
|
|
119
|
+
default: string;
|
|
120
|
+
};
|
|
121
|
+
currentNode: {
|
|
122
|
+
type: PropType<AnyObject>;
|
|
123
|
+
};
|
|
124
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
125
|
+
childKey: {
|
|
126
|
+
type: StringConstructor;
|
|
127
|
+
default: string;
|
|
128
|
+
};
|
|
129
|
+
options: {
|
|
130
|
+
type: PropType<AnyObject[]>;
|
|
131
|
+
default: () => never[];
|
|
132
|
+
};
|
|
133
|
+
onNodeClick: {
|
|
134
|
+
type: PropType<Func<any[], any>>;
|
|
135
|
+
};
|
|
136
|
+
labelKey: {
|
|
137
|
+
type: StringConstructor;
|
|
138
|
+
default: string;
|
|
139
|
+
};
|
|
140
|
+
currentNode: {
|
|
141
|
+
type: PropType<AnyObject>;
|
|
142
|
+
};
|
|
143
|
+
}>>, {
|
|
144
|
+
options: AnyObject[];
|
|
145
|
+
childKey: string;
|
|
146
|
+
labelKey: string;
|
|
147
|
+
}>;
|
|
148
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "focus")[], "focus" | "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
149
|
+
value: {
|
|
150
|
+
type: PropType<ValueType>;
|
|
151
|
+
};
|
|
152
|
+
clearable: {
|
|
153
|
+
type: BooleanConstructor;
|
|
154
|
+
default: boolean;
|
|
155
|
+
};
|
|
156
|
+
childKey: {
|
|
157
|
+
type: StringConstructor;
|
|
158
|
+
default: string;
|
|
159
|
+
};
|
|
160
|
+
placeholder: {
|
|
161
|
+
type: StringConstructor;
|
|
162
|
+
default: string;
|
|
163
|
+
};
|
|
164
|
+
editPlaceholder: {
|
|
165
|
+
type: StringConstructor;
|
|
166
|
+
default: string;
|
|
167
|
+
};
|
|
168
|
+
options: {
|
|
169
|
+
type: PropType<AnyObject[]>;
|
|
170
|
+
default: () => never[];
|
|
171
|
+
};
|
|
172
|
+
search: {
|
|
173
|
+
type: PropType<Func<any[], any>>;
|
|
174
|
+
};
|
|
175
|
+
labelKey: {
|
|
176
|
+
type: StringConstructor;
|
|
177
|
+
default: string;
|
|
178
|
+
};
|
|
179
|
+
valueKey: {
|
|
180
|
+
type: StringConstructor;
|
|
181
|
+
default: string;
|
|
182
|
+
};
|
|
183
|
+
beforeSetValue: {
|
|
184
|
+
type: PropType<(value: ValueType) => void | ValueType | Promise<ValueType>>;
|
|
185
|
+
};
|
|
186
|
+
}>> & {
|
|
187
|
+
onFocus?: ((...args: any[]) => any) | undefined;
|
|
188
|
+
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
189
|
+
}, {
|
|
190
|
+
options: AnyObject[];
|
|
191
|
+
placeholder: string;
|
|
192
|
+
valueKey: string;
|
|
193
|
+
clearable: boolean;
|
|
194
|
+
childKey: string;
|
|
195
|
+
editPlaceholder: string;
|
|
196
|
+
labelKey: string;
|
|
197
|
+
}>;
|
|
198
|
+
export default _default;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { AnyObject, Func } from '../../../../../es/shared/types';
|
|
2
|
+
import { PropType } from 'vue';
|
|
3
|
+
export declare const SearchMenu: import("vue").DefineComponent<{
|
|
4
|
+
childKey: {
|
|
5
|
+
type: StringConstructor;
|
|
6
|
+
default: string;
|
|
7
|
+
};
|
|
8
|
+
options: {
|
|
9
|
+
type: PropType<AnyObject[]>;
|
|
10
|
+
default: () => never[];
|
|
11
|
+
};
|
|
12
|
+
onNodeClick: {
|
|
13
|
+
type: PropType<Func<any[], any>>;
|
|
14
|
+
};
|
|
15
|
+
labelKey: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
currentNode: {
|
|
20
|
+
type: PropType<AnyObject>;
|
|
21
|
+
};
|
|
22
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
23
|
+
childKey: {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
default: string;
|
|
26
|
+
};
|
|
27
|
+
options: {
|
|
28
|
+
type: PropType<AnyObject[]>;
|
|
29
|
+
default: () => never[];
|
|
30
|
+
};
|
|
31
|
+
onNodeClick: {
|
|
32
|
+
type: PropType<Func<any[], any>>;
|
|
33
|
+
};
|
|
34
|
+
labelKey: {
|
|
35
|
+
type: StringConstructor;
|
|
36
|
+
default: string;
|
|
37
|
+
};
|
|
38
|
+
currentNode: {
|
|
39
|
+
type: PropType<AnyObject>;
|
|
40
|
+
};
|
|
41
|
+
}>>, {
|
|
42
|
+
options: AnyObject[];
|
|
43
|
+
childKey: string;
|
|
44
|
+
labelKey: string;
|
|
45
|
+
}>;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { defineComponent, computed, inject, createVNode, ref, createTextVNode } from 'vue';
|
|
2
|
+
import { traverse } from '../../../../shared/utils/index2.js';
|
|
3
|
+
import { Reload, ChevronForward } from '@vicons/ionicons5';
|
|
4
|
+
import { useVirtualList } from '@vueuse/core';
|
|
5
|
+
import { isArray, isFunction } from 'lodash-es';
|
|
6
|
+
import { InjectionSearchCascaderLoadingNode } from '../constants/index2.js';
|
|
7
|
+
|
|
8
|
+
const SearchMenuList = defineComponent({
|
|
9
|
+
props: {
|
|
10
|
+
options: {
|
|
11
|
+
type: Array,
|
|
12
|
+
default: () => []
|
|
13
|
+
},
|
|
14
|
+
activeNodes: {
|
|
15
|
+
type: Array,
|
|
16
|
+
default: () => []
|
|
17
|
+
},
|
|
18
|
+
labelKey: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: "label"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
emits: ["nodeClick"],
|
|
24
|
+
setup(props, {
|
|
25
|
+
emit
|
|
26
|
+
}) {
|
|
27
|
+
const optionsRef = computed(() => props.options);
|
|
28
|
+
const {
|
|
29
|
+
list,
|
|
30
|
+
containerProps,
|
|
31
|
+
wrapperProps
|
|
32
|
+
} = useVirtualList(optionsRef, {
|
|
33
|
+
itemHeight: 32,
|
|
34
|
+
overscan: 5
|
|
35
|
+
});
|
|
36
|
+
const loadingNode = inject(InjectionSearchCascaderLoadingNode);
|
|
37
|
+
return () => {
|
|
38
|
+
return createVNode("div", {
|
|
39
|
+
"class": "search-cascader__optionWrapper",
|
|
40
|
+
"ref": containerProps.ref,
|
|
41
|
+
"style": containerProps.style,
|
|
42
|
+
"onScroll": containerProps.onScroll
|
|
43
|
+
}, [createVNode("div", {
|
|
44
|
+
"style": wrapperProps.value.style
|
|
45
|
+
}, [list.value.map((item) => {
|
|
46
|
+
var _a;
|
|
47
|
+
return createVNode("div", {
|
|
48
|
+
"class": ["search-cascader__option", {
|
|
49
|
+
"search-cascader__option--active": (_a = props.activeNodes) == null ? void 0 : _a.includes(item.data)
|
|
50
|
+
}],
|
|
51
|
+
"onClick": () => emit("nodeClick", item.data),
|
|
52
|
+
"title": item.data[props.labelKey]
|
|
53
|
+
}, [createVNode("div", {
|
|
54
|
+
"class": "search-cascader__optionText"
|
|
55
|
+
}, [item.data[props.labelKey]]), loadingNode.value === item.data ? createVNode(Reload, {
|
|
56
|
+
"class": "rotate"
|
|
57
|
+
}, null) : item.data.isLeaf ? null : createVNode(ChevronForward, null, null)]);
|
|
58
|
+
})])]);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
const SearchMenu = defineComponent({
|
|
63
|
+
props: {
|
|
64
|
+
childKey: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: "children"
|
|
67
|
+
},
|
|
68
|
+
options: {
|
|
69
|
+
type: Array,
|
|
70
|
+
default: () => []
|
|
71
|
+
},
|
|
72
|
+
onNodeClick: {
|
|
73
|
+
type: Function
|
|
74
|
+
},
|
|
75
|
+
labelKey: {
|
|
76
|
+
type: String,
|
|
77
|
+
default: "label"
|
|
78
|
+
},
|
|
79
|
+
currentNode: {
|
|
80
|
+
type: Object
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
setup(props, {
|
|
84
|
+
slots
|
|
85
|
+
}) {
|
|
86
|
+
const activeNodes = ref([]);
|
|
87
|
+
function renderList(options) {
|
|
88
|
+
return createVNode(SearchMenuList, {
|
|
89
|
+
"labelKey": props.labelKey,
|
|
90
|
+
"activeNodes": activeNodes.value,
|
|
91
|
+
"onNodeClick": props.onNodeClick,
|
|
92
|
+
"options": options
|
|
93
|
+
}, null);
|
|
94
|
+
}
|
|
95
|
+
function renderEmpty() {
|
|
96
|
+
return createVNode("section", {
|
|
97
|
+
"class": "search-cascader__emptyWrapper"
|
|
98
|
+
}, [isFunction(slots.empty) ? slots.empty() : createVNode("section", null, [createTextVNode("empty")])]);
|
|
99
|
+
}
|
|
100
|
+
function isNodeExpand(node) {
|
|
101
|
+
let result = false;
|
|
102
|
+
traverse(node, (n, stop) => {
|
|
103
|
+
if (n !== props.currentNode)
|
|
104
|
+
return;
|
|
105
|
+
result = true;
|
|
106
|
+
stop();
|
|
107
|
+
}, ["children"]);
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
function getRenderNodeList() {
|
|
111
|
+
if (!isArray(props.options) || !props.currentNode)
|
|
112
|
+
return [];
|
|
113
|
+
const result = [props.options];
|
|
114
|
+
let _options = props.options;
|
|
115
|
+
activeNodes.value.length = 0;
|
|
116
|
+
while (isArray(_options)) {
|
|
117
|
+
const expandNode = _options.find(isNodeExpand);
|
|
118
|
+
if (!expandNode)
|
|
119
|
+
break;
|
|
120
|
+
activeNodes.value.push(expandNode);
|
|
121
|
+
_options = expandNode[props.childKey];
|
|
122
|
+
result.push(_options);
|
|
123
|
+
}
|
|
124
|
+
return result;
|
|
125
|
+
}
|
|
126
|
+
return () => {
|
|
127
|
+
return createVNode("section", {
|
|
128
|
+
"class": "search-cascader__menuWrapper"
|
|
129
|
+
}, [!isArray(props.options) || !props.options.length ? renderEmpty() : !props.currentNode ? renderList(props.options) : getRenderNodeList().map(renderList)]);
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
export { SearchMenu };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SearchMenu';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SearchMenu } from './SearchMenu.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { InjectionSearchCascaderLoadingNode } from './index2.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useCssVariable';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useCssVariable } from './useCssVariable2.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useCssVariable } from './useCssVariable2.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getParentNodeList } from './index2.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.search-cascader__menuWrapper{display:flex;flex-wrap:nowrap;margin:-8px -14px}.search-cascader__option{align-items:center;border-radius:4px;box-sizing:border-box;display:flex;height:32px;justify-content:space-between;padding:0 8px 0 16px;width:100%}.search-cascader__option--active{background:#f8f8f8}.search-cascader__option:hover{background:#f5f5f5;cursor:pointer}.search-cascader__optionWrapper{background:#fff;height:256px;overflow-x:auto;width:calc(var(--menu-width)*1px)}.search-cascader__optionWrapper:not(:last-of-type){border:solid #e5e5e5;border-width:0 1px 0 0}.search-cascader__optionText{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:calc(100% - 20px)}.search-cascader__option svg{color:#bfbfbf;flex-shrink:0;font-size:12px;width:20px}.search-cascader__option svg.rotate{animation:rotate 1s linear infinite}.search-cascader__emptyWrapper{align-items:center;background:#fff;box-sizing:border-box;display:flex;height:300px;justify-content:center;padding:16px;width:100%}@keyframes rotate{0%{transform:rotate(0)}to{transform:rotate(1turn)}}
|
|
@@ -170,6 +170,7 @@ declare const SelectLabel: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
170
170
|
NIcon: any;
|
|
171
171
|
NModal: any;
|
|
172
172
|
NSpace: any;
|
|
173
|
+
NTooltip: any;
|
|
173
174
|
AddCircleOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
174
175
|
labelFormContent: import("vue").DefineComponent<{
|
|
175
176
|
item: {
|
|
@@ -170,6 +170,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
170
170
|
NIcon: any;
|
|
171
171
|
NModal: any;
|
|
172
172
|
NSpace: any;
|
|
173
|
+
NTooltip: any;
|
|
173
174
|
AddCircleOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
174
175
|
labelFormContent: import("vue").DefineComponent<{
|
|
175
176
|
item: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent, ref, reactive, computed, onMounted, watch, openBlock, createElementBlock, Fragment, createElementVNode, createVNode, unref, withCtx, renderList, createBlock, normalizeStyle,
|
|
2
|
-
import { NSpace, NTag, NIcon, NModal } from 'naive-ui';
|
|
1
|
+
import { defineComponent, ref, reactive, computed, onMounted, watch, openBlock, createElementBlock, Fragment, createElementVNode, createVNode, unref, withCtx, renderList, createBlock, normalizeStyle, toDisplayString, withDirectives, normalizeClass, vShow, createCommentVNode, mergeProps, createTextVNode, nextTick } from 'vue';
|
|
2
|
+
import { NSpace, NTag, NTooltip, NIcon, NModal } from 'naive-ui';
|
|
3
3
|
import { AddCircleOutline } from '@vicons/ionicons5';
|
|
4
4
|
import script from '../../../shared/components/SvgIcon/SvgIcon.js';
|
|
5
5
|
import scriptFormContent from './LabelFormContent.js';
|
|
@@ -357,7 +357,13 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
357
357
|
onClose: ($event) => closeTag(v),
|
|
358
358
|
size: "small"
|
|
359
359
|
}, {
|
|
360
|
-
default: withCtx(() => [
|
|
360
|
+
default: withCtx(() => [createVNode(unref(NTooltip), {
|
|
361
|
+
placement: "top-start"
|
|
362
|
+
}, {
|
|
363
|
+
trigger: withCtx(() => [createElementVNode("span", null, toDisplayString(v.labelName), 1)]),
|
|
364
|
+
default: withCtx(() => [createElementVNode("span", null, toDisplayString(v.labelName), 1)]),
|
|
365
|
+
_: 2
|
|
366
|
+
}, 1024)]),
|
|
361
367
|
_: 2
|
|
362
368
|
}, 1032, ["style", "closable", "onClose"]);
|
|
363
369
|
}), 128)), !__props.explicit ? withDirectives((openBlock(), createElementBlock("span", {
|
|
@@ -385,7 +391,13 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
385
391
|
style: normalizeStyle(unref(handleLabelColor)(item)),
|
|
386
392
|
size: "small"
|
|
387
393
|
}, {
|
|
388
|
-
default: withCtx(() => [
|
|
394
|
+
default: withCtx(() => [createVNode(unref(NTooltip), {
|
|
395
|
+
placement: "top-start"
|
|
396
|
+
}, {
|
|
397
|
+
trigger: withCtx(() => [createElementVNode("span", null, toDisplayString(item.labelName), 1)]),
|
|
398
|
+
default: withCtx(() => [createElementVNode("span", null, toDisplayString(item.labelName), 1)]),
|
|
399
|
+
_: 2
|
|
400
|
+
}, 1024)]),
|
|
389
401
|
_: 2
|
|
390
402
|
}, 1032, ["checked", "onUpdate:checked", "style"]);
|
|
391
403
|
}), 128))]),
|