cnhis-design-vue 3.1.31-beta.9 → 3.1.32-beta.0
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/fabric-chart/index.d.ts +207 -0
- package/es/components/fabric-chart/src/FabricChart.vue.d.ts +208 -0
- package/es/components/form-render/src/components/renderer/checkbox.js +3 -5
- package/es/components/form-render/src/components/renderer/index.js +2 -0
- package/es/components/form-render/src/components/renderer/recommendSelect.d.ts +131 -0
- package/es/components/form-render/src/components/renderer/recommendSelect.js +213 -0
- package/es/components/form-render/src/components/renderer/remoteSearch.js +11 -3
- package/es/components/form-render/src/components/renderer/select.js +0 -2
- package/es/components/form-render/src/hooks/useAsyncQueue.js +2 -1
- package/es/components/form-render/src/hooks/useAutographOptions.js +3 -5
- package/es/components/form-render/src/hooks/useFieldListAdaptor.js +7 -0
- package/es/components/form-render/src/hooks/useFormRequest.d.ts +8 -1
- package/es/components/form-render/src/hooks/useFormRequest.js +24 -1
- package/es/components/form-render/style/index.css +1 -1
- package/es/components/index.css +1 -1
- package/es/components/recommend-search/index.d.ts +586 -51
- package/es/components/recommend-search/src/RecommendSearch.vue.d.ts +596 -59
- package/es/components/recommend-search/src/RecommendSearch.vue.js +36 -8
- package/es/components/recommend-search/src/components/BaseSearch.vue.d.ts +31 -16
- package/es/components/recommend-search/src/components/BaseSearch.vue.js +27 -23
- package/es/components/recommend-search/src/components/RecommendInput.vue.d.ts +136 -53
- package/es/components/recommend-search/src/components/RecommendInput.vue.js +66 -41
- package/es/components/recommend-search/src/components/RecommendMenu.vue.d.ts +14 -3
- package/es/components/recommend-search/src/components/RecommendMenu.vue.js +35 -25
- package/es/components/recommend-search/src/components/RecommendSelect.vue.d.ts +300 -1
- package/es/components/recommend-search/src/components/RecommendSelect.vue.js +81 -51
- package/es/components/recommend-search/style/index.css +1 -1
- package/package.json +2 -2
|
@@ -1,26 +1,34 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, openBlock, createElementBlock, createVNode, mergeProps, unref, isRef, withCtx, createElementVNode, Fragment, renderList, toDisplayString, renderSlot } from 'vue';
|
|
1
|
+
import { defineComponent, ref, computed, openBlock, createElementBlock, createVNode, mergeProps, unref, isRef, withCtx, createElementVNode, normalizeProps, guardReactiveProps, Fragment, renderList, normalizeClass, toDisplayString, createBlock, createCommentVNode, renderSlot } from 'vue';
|
|
2
|
+
import { Checkmark } from '@vicons/ionicons5';
|
|
2
3
|
import { useMemoize, useVModel, useVirtualList } from '@vueuse/core';
|
|
3
4
|
import { isObject } from 'lodash-es';
|
|
4
|
-
import RecommendMenu from './RecommendMenu.vue.js';
|
|
5
5
|
import BaseSearch from './BaseSearch.vue.js';
|
|
6
|
+
import { NIcon } from 'naive-ui';
|
|
6
7
|
import _export_sfc from '../../../../_virtual/plugin-vue_export-helper.js';
|
|
7
8
|
|
|
8
9
|
const _hoisted_1 = { class: "recommend-search" };
|
|
9
10
|
const _hoisted_2 = ["onClick"];
|
|
10
|
-
const _hoisted_3 =
|
|
11
|
+
const _hoisted_3 = ["title"];
|
|
12
|
+
const _hoisted_4 = /* @__PURE__ */ createElementVNode("section", { class: "recommend-search__empty" }, "\u6682\u65E0\u6570\u636E", -1);
|
|
11
13
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
14
|
__name: "RecommendSelect",
|
|
13
15
|
props: {
|
|
14
|
-
value:
|
|
15
|
-
labelKey: { default: "label" },
|
|
16
|
-
valueKey: { default: "value" },
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
value: { type: [String, Number] },
|
|
17
|
+
labelKey: { type: String, default: "label" },
|
|
18
|
+
valueKey: { type: String, default: "value" },
|
|
19
|
+
placeholder: { type: String, default: "\u8BF7\u9009\u62E9" },
|
|
20
|
+
editPlaceholder: { type: String, default: "\u8BF7\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u641C\u7D22" },
|
|
21
|
+
options: { type: Array, default: () => [] },
|
|
22
|
+
commonList: { type: Array, default: () => [] },
|
|
23
|
+
recentList: { type: Array, default: () => [] }
|
|
20
24
|
},
|
|
21
|
-
emits: ["update:value", "search", "delete", "choose"],
|
|
25
|
+
emits: ["update:value", "search", "delete", "choose", "clear", "openMenu", "closeMenu"],
|
|
22
26
|
setup(__props, { emit: emits }) {
|
|
23
27
|
const props = __props;
|
|
28
|
+
const showRef = ref(false);
|
|
29
|
+
const displayPlaceholder = computed(() => {
|
|
30
|
+
return showRef.value ? props.editPlaceholder : props.placeholder;
|
|
31
|
+
});
|
|
24
32
|
const currentOption = ref();
|
|
25
33
|
const jsonParse = useMemoize(
|
|
26
34
|
(value) => {
|
|
@@ -32,90 +40,112 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
32
40
|
},
|
|
33
41
|
{ getKey: (value) => value }
|
|
34
42
|
);
|
|
35
|
-
function
|
|
36
|
-
|
|
37
|
-
return isObject(option) ? option[props.valueKey] : null;
|
|
43
|
+
function getRecommendOption(item) {
|
|
44
|
+
return jsonParse(item.itemObj);
|
|
38
45
|
}
|
|
46
|
+
const commonOptions = computed(() => props.commonList.map(getRecommendOption));
|
|
47
|
+
const recentOptions = computed(() => props.recentList.map(getRecommendOption));
|
|
48
|
+
const optionWithoutRecommend = computed(() => {
|
|
49
|
+
return props.options.filter((option) => {
|
|
50
|
+
return commonOptions.value.every(notInList) && recentOptions.value.every(notInList);
|
|
51
|
+
function notInList(item) {
|
|
52
|
+
return item[props.valueKey] !== option[props.valueKey];
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
});
|
|
39
56
|
function getDisplayValue(item) {
|
|
40
|
-
if (isObject(item)) {
|
|
41
|
-
const option = jsonParse(item.itemObj);
|
|
42
|
-
return isObject(option) ? option[props.labelKey] : "";
|
|
43
|
-
}
|
|
44
57
|
let result = "";
|
|
45
|
-
[...
|
|
46
|
-
if (!option)
|
|
58
|
+
[...parsedOptions.value, currentOption.value].find((option) => {
|
|
59
|
+
if (!isObject(option) || option[props.valueKey] !== item)
|
|
47
60
|
return;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
result = value[props.labelKey];
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
61
|
+
result = option[props.labelKey];
|
|
62
|
+
return true;
|
|
53
63
|
});
|
|
54
64
|
return result;
|
|
55
65
|
}
|
|
56
66
|
const baseSearchRef = ref();
|
|
57
67
|
const valueRef = useVModel(props, "value", emits);
|
|
58
68
|
const parsedOptions = computed(() => {
|
|
59
|
-
return
|
|
60
|
-
return props.commonList.every(notInList) && props.recentList.every(notInList);
|
|
61
|
-
function notInList(item) {
|
|
62
|
-
return item.itemObj !== option.itemObj;
|
|
63
|
-
}
|
|
64
|
-
});
|
|
69
|
+
return [...commonOptions.value, ...recentOptions.value, ...optionWithoutRecommend.value];
|
|
65
70
|
});
|
|
66
|
-
function search(value) {
|
|
71
|
+
function search(value = "") {
|
|
67
72
|
emits("search", value);
|
|
68
73
|
}
|
|
74
|
+
function onOpenMenu() {
|
|
75
|
+
search();
|
|
76
|
+
emits("openMenu");
|
|
77
|
+
}
|
|
78
|
+
function onCloseMenu() {
|
|
79
|
+
emits("closeMenu");
|
|
80
|
+
}
|
|
69
81
|
function onClear() {
|
|
70
82
|
valueRef.value = null;
|
|
83
|
+
emits("clear");
|
|
84
|
+
}
|
|
85
|
+
function emitChoose(value) {
|
|
86
|
+
emits("choose", { value, option: { ...currentOption.value } });
|
|
71
87
|
}
|
|
72
|
-
function
|
|
88
|
+
function onChooseOption(option) {
|
|
73
89
|
var _a;
|
|
74
|
-
|
|
90
|
+
if (!isObject(option))
|
|
91
|
+
return;
|
|
92
|
+
valueRef.value = option[props.valueKey];
|
|
75
93
|
(_a = baseSearchRef.value) == null ? void 0 : _a.closeMenu();
|
|
76
|
-
currentOption.value =
|
|
77
|
-
|
|
94
|
+
currentOption.value = option;
|
|
95
|
+
emitChoose(option[props.valueKey]);
|
|
78
96
|
}
|
|
79
|
-
const { list, wrapperProps, containerProps } = useVirtualList(parsedOptions, { itemHeight: 32, overscan:
|
|
97
|
+
const { list, wrapperProps, containerProps } = useVirtualList(parsedOptions, { itemHeight: 32, overscan: 5 });
|
|
80
98
|
return (_ctx, _cache) => {
|
|
81
99
|
return openBlock(), createElementBlock("section", _hoisted_1, [
|
|
82
100
|
createVNode(BaseSearch, mergeProps({
|
|
83
101
|
ref_key: "baseSearchRef",
|
|
84
102
|
ref: baseSearchRef,
|
|
85
103
|
value: unref(valueRef),
|
|
86
|
-
"onUpdate:value": _cache[
|
|
104
|
+
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => isRef(valueRef) ? valueRef.value = $event : null),
|
|
105
|
+
show: showRef.value,
|
|
106
|
+
"onUpdate:show": _cache[1] || (_cache[1] = ($event) => showRef.value = $event),
|
|
87
107
|
"display-value": getDisplayValue(unref(valueRef)),
|
|
108
|
+
placeholder: unref(displayPlaceholder),
|
|
109
|
+
onOpenMenu,
|
|
110
|
+
onCloseMenu,
|
|
88
111
|
onSearch: search,
|
|
89
112
|
onClear
|
|
90
113
|
}, _ctx.$attrs), {
|
|
91
114
|
menu: withCtx(() => [
|
|
92
|
-
createVNode(RecommendMenu, {
|
|
93
|
-
"get-display-value": getDisplayValue,
|
|
94
|
-
"common-list": __props.commonList,
|
|
95
|
-
"recent-list": __props.recentList,
|
|
96
|
-
onDelete: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("delete", $event)),
|
|
97
|
-
onChoose
|
|
98
|
-
}, null, 8, ["common-list", "recent-list"]),
|
|
99
115
|
unref(parsedOptions).length ? (openBlock(), createElementBlock("section", mergeProps({
|
|
100
116
|
key: 0,
|
|
101
117
|
class: "recommend-search__optionContainer",
|
|
102
118
|
style: { "height": "256px" }
|
|
103
119
|
}, unref(containerProps)), [
|
|
104
|
-
createElementVNode("section",
|
|
120
|
+
createElementVNode("section", normalizeProps(guardReactiveProps(unref(wrapperProps))), [
|
|
105
121
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(list), (option) => {
|
|
106
122
|
return openBlock(), createElementBlock("div", {
|
|
107
|
-
onClick: ($event) =>
|
|
108
|
-
key: option.data.
|
|
109
|
-
class:
|
|
110
|
-
|
|
123
|
+
onClick: ($event) => onChooseOption(option.data),
|
|
124
|
+
key: option.data[__props.valueKey],
|
|
125
|
+
class: normalizeClass([
|
|
126
|
+
"recommend-search__option",
|
|
127
|
+
{
|
|
128
|
+
"is-active": option.data[__props.valueKey] === unref(valueRef)
|
|
129
|
+
}
|
|
130
|
+
])
|
|
131
|
+
}, [
|
|
132
|
+
createElementVNode("div", {
|
|
133
|
+
class: "recommend-search__optionText",
|
|
134
|
+
title: option.data.itemObj
|
|
135
|
+
}, toDisplayString(option.data[__props.labelKey]), 9, _hoisted_3),
|
|
136
|
+
option.data[__props.valueKey] === unref(valueRef) ? (openBlock(), createBlock(unref(NIcon), {
|
|
137
|
+
key: 0,
|
|
138
|
+
component: unref(Checkmark)
|
|
139
|
+
}, null, 8, ["component"])) : createCommentVNode("v-if", true)
|
|
140
|
+
], 10, _hoisted_2);
|
|
111
141
|
}), 128))
|
|
112
142
|
], 16)
|
|
113
143
|
], 16)) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
114
|
-
|
|
144
|
+
_hoisted_4
|
|
115
145
|
])
|
|
116
146
|
]),
|
|
117
147
|
_: 3
|
|
118
|
-
}, 16, ["value", "display-value"])
|
|
148
|
+
}, 16, ["value", "show", "display-value", "placeholder"])
|
|
119
149
|
]);
|
|
120
150
|
};
|
|
121
151
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.recommend-search__menuRecommendList{display:flex;flex-wrap:wrap;gap:8px;margin-top:4px}.recommend-search__menuRecommendList .n-tag{cursor:pointer}.recommend-search__recentRecommend{margin-bottom:8px}.recommend-search__recentRecommend>header{color:rgba(0,0,0,.4)}.recommend-search__commonRecommend{margin-bottom:8px}.recommend-search__commonRecommend>header{color:rgba(0,0,0,.4)}.recommend-search__option{align-items:center;border-radius:4px;cursor:pointer;display:flex;height:32px;padding:0 8px}.recommend-search__option:hover{background:rgba(0,0,0,.03)}.recommend-search__optionContainer{
|
|
1
|
+
.recommend-search__menu{min-height:100px}.recommend-search__menuRecommendList{display:flex;flex-wrap:wrap;gap:8px;margin-top:4px}.recommend-search__menuRecommendList .n-tag{cursor:pointer}.recommend-search__recentRecommend{margin-bottom:8px}.recommend-search__recentRecommend>header{align-items:center;color:rgba(0,0,0,.4);display:flex;justify-content:space-between}.recommend-search__recentRecommend>header .n-icon:hover{color:rgba(0,0,0,.6);cursor:pointer}.recommend-search__commonRecommend{margin-bottom:8px}.recommend-search__commonRecommend>header{align-items:center;color:rgba(0,0,0,.4);display:flex;justify-content:space-between}.recommend-search__commonRecommend>header .n-icon:hover{color:rgba(0,0,0,.6);cursor:pointer}.recommend-search__option{align-items:center;border-radius:4px;cursor:pointer;display:flex;height:32px;justify-content:space-between;padding:0 8px}.recommend-search__optionText{max-width:calc(100% - 24px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.recommend-search__option.is-active{color:var(--n-color)!important}.recommend-search__option.is-active .n-icon{font-size:20px}.recommend-search__option:hover{background:rgba(0,0,0,.03)}.recommend-search__optionContainer{margin:-8px -10px}.recommend-search__empty{align-items:center;color:rgba(0,0,0,.3);display:flex;height:100px;justify-content:center}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnhis-design-vue",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.32-beta.0",
|
|
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": "36839bf96f266bbc5a99b6c16eae8a8e80c80f87"
|
|
65
65
|
}
|