@opentiny/vue-search-box 0.1.1-alpha.3 → 0.1.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.
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/es/components/first-level-panel.vue.es.js +4 -0
- package/dist/es/components/first-level-panel.vue.es2.js +177 -0
- package/dist/es/components/second-level-panel.vue.es.js +4 -0
- package/dist/es/components/second-level-panel.vue.es2.js +466 -0
- package/dist/es/composables/use-checkbox.es.js +5 -18
- package/dist/es/composables/use-custom.es.js +1 -0
- package/dist/es/composables/use-datepicker.es.js +1 -1
- package/dist/es/composables/use-dropdown.es.js +27 -18
- package/dist/es/composables/use-edit.es.js +3 -1
- package/dist/es/composables/use-init.es.js +24 -10
- package/dist/es/composables/use-match.es.js +42 -42
- package/dist/es/composables/use-num-range.es.js +1 -1
- package/dist/es/composables/use-placeholder.es.js +2 -2
- package/dist/es/composables/use-tag.es.js +6 -1
- package/dist/es/{index-VrLZbD8H.css → index-BYxS8gdW.css} +56 -14
- package/dist/es/index.es.js +6 -0
- package/dist/es/index.vue.es2.js +150 -623
- package/dist/es/utils/dropdown.es.js +9 -5
- package/dist/es/utils/tag.es.js +2 -4
- package/dist/index.css +56 -14
- package/dist/lib/components/first-level-panel.vue.cjs.js +4 -0
- package/dist/lib/components/first-level-panel.vue.cjs2.js +177 -0
- package/dist/lib/components/second-level-panel.vue.cjs.js +4 -0
- package/dist/lib/components/second-level-panel.vue.cjs2.js +466 -0
- package/dist/lib/composables/use-checkbox.cjs.js +5 -18
- package/dist/lib/composables/use-custom.cjs.js +1 -0
- package/dist/lib/composables/use-datepicker.cjs.js +1 -1
- package/dist/lib/composables/use-dropdown.cjs.js +27 -18
- package/dist/lib/composables/use-edit.cjs.js +3 -1
- package/dist/lib/composables/use-init.cjs.js +24 -10
- package/dist/lib/composables/use-match.cjs.js +41 -41
- package/dist/lib/composables/use-num-range.cjs.js +1 -1
- package/dist/lib/composables/use-placeholder.cjs.js +2 -2
- package/dist/lib/composables/use-tag.cjs.js +6 -1
- package/dist/lib/{index-VrLZbD8H.css → index-BYxS8gdW.css} +56 -14
- package/dist/lib/index.cjs.js +6 -0
- package/dist/lib/index.vue.cjs2.js +156 -629
- package/dist/lib/utils/dropdown.cjs.js +9 -5
- package/dist/lib/utils/tag.cjs.js +1 -3
- package/dist/types/composables/use-checkbox.d.ts +0 -2
- package/dist/types/composables/use-dropdown.d.ts +1 -0
- package/package.json +1 -2
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const vue = require("vue");
|
|
4
|
+
const TinyFormItem = require("@opentiny/vue-form-item");
|
|
5
|
+
const TinyDropdownItem = require("@opentiny/vue-dropdown-item");
|
|
6
|
+
const TinyCheckbox = require("@opentiny/vue-checkbox");
|
|
7
|
+
const TinyCheckboxGroup = require("@opentiny/vue-checkbox-group");
|
|
8
|
+
const TinyDatePicker = require("@opentiny/vue-date-picker");
|
|
9
|
+
const TinyInput = require("@opentiny/vue-input");
|
|
10
|
+
const TinyButton = require("@opentiny/vue-button");
|
|
11
|
+
const Loading = require("@opentiny/vue-loading");
|
|
12
|
+
const index = require("../index.cjs.js");
|
|
13
|
+
;/* empty css */
|
|
14
|
+
const _hoisted_1 = { key: 0 };
|
|
15
|
+
const _hoisted_2 = { class: "tvp-search-box__filter-type" };
|
|
16
|
+
const _hoisted_3 = ["title"];
|
|
17
|
+
const _hoisted_4 = {
|
|
18
|
+
key: 0,
|
|
19
|
+
class: "tvp-search-box__text-highlight"
|
|
20
|
+
};
|
|
21
|
+
const _hoisted_5 = ["title"];
|
|
22
|
+
const _hoisted_6 = { class: "tvp-search-box__checkbox-wrap" };
|
|
23
|
+
const _hoisted_7 = { class: "tvp-search-box__checkbox-btn" };
|
|
24
|
+
const _hoisted_8 = {
|
|
25
|
+
key: 3,
|
|
26
|
+
class: "tvp-search-box__panel-box"
|
|
27
|
+
};
|
|
28
|
+
const _hoisted_9 = { class: "tvp-search-box__number" };
|
|
29
|
+
const _hoisted_10 = { class: "tvp-search-box__dropdown-title" };
|
|
30
|
+
const _hoisted_11 = { class: "tvp-search-box__dropdown-start" };
|
|
31
|
+
const _hoisted_12 = { class: "tvp-search-box__dropdown-end" };
|
|
32
|
+
const _hoisted_13 = { class: "tvp-search-box__bottom-btn" };
|
|
33
|
+
const _hoisted_14 = {
|
|
34
|
+
key: 4,
|
|
35
|
+
class: "tvp-search-box__panel-box"
|
|
36
|
+
};
|
|
37
|
+
const _hoisted_15 = { class: "tvp-search-box__date-wrap" };
|
|
38
|
+
const _hoisted_16 = { class: "tvp-search-box__dropdown-title" };
|
|
39
|
+
const _hoisted_17 = { class: "tvp-search-box__dropdown-start" };
|
|
40
|
+
const _hoisted_18 = { class: "tvp-search-box__dropdown-end" };
|
|
41
|
+
const _hoisted_19 = { class: "tvp-search-box__bottom-btn" };
|
|
42
|
+
const _hoisted_20 = {
|
|
43
|
+
key: 5,
|
|
44
|
+
class: "tvp-search-box__panel-box"
|
|
45
|
+
};
|
|
46
|
+
const _hoisted_21 = { class: "tvp-search-box__date-wrap" };
|
|
47
|
+
const _hoisted_22 = { class: "tvp-search-box__dropdown-title" };
|
|
48
|
+
const _hoisted_23 = { class: "tvp-search-box__dropdown-start" };
|
|
49
|
+
const _hoisted_24 = { class: "tvp-search-box__dropdown-end" };
|
|
50
|
+
const _hoisted_25 = { class: "tvp-search-box__bottom-btn" };
|
|
51
|
+
const _hoisted_26 = { key: 6 };
|
|
52
|
+
const _hoisted_27 = {
|
|
53
|
+
key: 0,
|
|
54
|
+
class: "tvp-search-box__filter-type"
|
|
55
|
+
};
|
|
56
|
+
const _hoisted_28 = {
|
|
57
|
+
key: 1,
|
|
58
|
+
class: "tvp-search-box__filter-type"
|
|
59
|
+
};
|
|
60
|
+
const _hoisted_29 = ["title"];
|
|
61
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
62
|
+
...{
|
|
63
|
+
name: "TinySearchBoxSecondLevelPanel"
|
|
64
|
+
},
|
|
65
|
+
__name: "second-level-panel",
|
|
66
|
+
props: {
|
|
67
|
+
state: {
|
|
68
|
+
type: Object,
|
|
69
|
+
default: () => ({})
|
|
70
|
+
},
|
|
71
|
+
pickerOptions: {
|
|
72
|
+
type: Function,
|
|
73
|
+
default: () => {
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
emits: ["events"],
|
|
78
|
+
setup(__props, { emit: __emit }) {
|
|
79
|
+
const props = __props;
|
|
80
|
+
const isLoading = vue.computed(() => {
|
|
81
|
+
var _a;
|
|
82
|
+
return props.state.hasBackupList && ((_a = props.state.backupList) == null ? void 0 : _a.length) === 0;
|
|
83
|
+
});
|
|
84
|
+
const vLoading = Loading.directive;
|
|
85
|
+
const emits = __emit;
|
|
86
|
+
const showCheckBoxList = vue.computed(() => {
|
|
87
|
+
var _a;
|
|
88
|
+
return (_a = props.state.backupList) == null ? void 0 : _a.find((item) => !item.isFilter);
|
|
89
|
+
});
|
|
90
|
+
const events = (eventName, p1, p2) => {
|
|
91
|
+
emits("events", eventName, p1, p2);
|
|
92
|
+
};
|
|
93
|
+
const setOperator = (e) => {
|
|
94
|
+
events("setOperator", e);
|
|
95
|
+
};
|
|
96
|
+
const selectRadioItem = (e) => {
|
|
97
|
+
events("selectRadioItem", e);
|
|
98
|
+
};
|
|
99
|
+
const selectCheckbox = (e) => {
|
|
100
|
+
events("selectCheckbox", e);
|
|
101
|
+
};
|
|
102
|
+
const sizeChange = (e) => {
|
|
103
|
+
events("sizeChange", e);
|
|
104
|
+
};
|
|
105
|
+
const onConfirmDate = (e, b) => {
|
|
106
|
+
events("onConfirmDate", e, b);
|
|
107
|
+
};
|
|
108
|
+
const selectFirstMap = (e, b) => {
|
|
109
|
+
events("selectFirstMap", e, b);
|
|
110
|
+
};
|
|
111
|
+
const handleDateShow = (e) => {
|
|
112
|
+
events("handleDateShow", e);
|
|
113
|
+
};
|
|
114
|
+
return (_ctx, _cache) => {
|
|
115
|
+
var _a;
|
|
116
|
+
return ((_a = __props.state.currentOperators) == null ? void 0 : _a.length) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
117
|
+
vue.createElementVNode("span", _hoisted_2, vue.toDisplayString(vue.unref(index.t)("tvp.tvpSearchbox.operator")), 1),
|
|
118
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.state.currentOperators, (item, index2) => {
|
|
119
|
+
return vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(TinyDropdownItem), {
|
|
120
|
+
key: item + index2,
|
|
121
|
+
class: "tvp-search-box__dropdown-item",
|
|
122
|
+
onClick: ($event) => setOperator(item)
|
|
123
|
+
}, {
|
|
124
|
+
default: vue.withCtx(() => [
|
|
125
|
+
vue.createTextVNode(vue.toDisplayString(item), 1)
|
|
126
|
+
]),
|
|
127
|
+
_: 2
|
|
128
|
+
}, 1032, ["onClick"])), [
|
|
129
|
+
[vue.vShow, item.includes(__props.state.inputValue)]
|
|
130
|
+
]);
|
|
131
|
+
}), 128))
|
|
132
|
+
])) : !__props.state.prevItem.type || __props.state.prevItem.type === "radio" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
|
|
133
|
+
key: 1,
|
|
134
|
+
class: vue.normalizeClass(["tvp-search-box__radio-wrap", isLoading.value && "tvp-search-box__loading-box"])
|
|
135
|
+
}, [
|
|
136
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.state.backupList, (item, index2) => {
|
|
137
|
+
return vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(TinyDropdownItem), {
|
|
138
|
+
key: index2 + (item.field || item.label),
|
|
139
|
+
disabled: item.isChecked,
|
|
140
|
+
class: "tvp-search-box__dropdown-item",
|
|
141
|
+
onClick: ($event) => selectRadioItem(item)
|
|
142
|
+
}, {
|
|
143
|
+
default: vue.withCtx(() => [
|
|
144
|
+
item.match ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
145
|
+
key: 0,
|
|
146
|
+
title: item.label
|
|
147
|
+
}, [
|
|
148
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(item.match, (text) => {
|
|
149
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: text }, [
|
|
150
|
+
text.toLowerCase() === item.hightlighStr ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4, vue.toDisplayString(text), 1)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
151
|
+
vue.createTextVNode(vue.toDisplayString(text), 1)
|
|
152
|
+
], 64))
|
|
153
|
+
], 64);
|
|
154
|
+
}), 128))
|
|
155
|
+
], 8, _hoisted_3)) : (vue.openBlock(), vue.createElementBlock("span", {
|
|
156
|
+
key: 1,
|
|
157
|
+
title: item.label
|
|
158
|
+
}, vue.toDisplayString(item.label), 9, _hoisted_5))
|
|
159
|
+
]),
|
|
160
|
+
_: 2
|
|
161
|
+
}, 1032, ["disabled", "onClick"])), [
|
|
162
|
+
[vue.vShow, !item.isFilter || !__props.state.inputValue]
|
|
163
|
+
]);
|
|
164
|
+
}), 128))
|
|
165
|
+
], 2)), [
|
|
166
|
+
[vue.unref(vLoading), isLoading.value]
|
|
167
|
+
]) : __props.state.prevItem.type === "checkbox" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
|
|
168
|
+
key: 2,
|
|
169
|
+
class: vue.normalizeClass(isLoading.value && "tvp-search-box__loading-box")
|
|
170
|
+
}, [
|
|
171
|
+
showCheckBoxList.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
172
|
+
vue.createElementVNode("div", _hoisted_6, [
|
|
173
|
+
vue.createVNode(vue.unref(TinyCheckboxGroup), {
|
|
174
|
+
modelValue: __props.state.checkAll,
|
|
175
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => __props.state.checkAll = $event),
|
|
176
|
+
class: "tvp-search-box__checkbox"
|
|
177
|
+
}, {
|
|
178
|
+
default: vue.withCtx(() => [
|
|
179
|
+
vue.createVNode(vue.unref(TinyDropdownItem), { class: "tvp-search-box__dropdown-item tvp-search-box__checkbox-item" }, {
|
|
180
|
+
default: vue.withCtx(() => [
|
|
181
|
+
vue.createVNode(vue.unref(TinyCheckbox), {
|
|
182
|
+
modelValue: __props.state.checkAll,
|
|
183
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.state.checkAll = $event),
|
|
184
|
+
indeterminate: __props.state.isIndeterminate
|
|
185
|
+
}, {
|
|
186
|
+
default: vue.withCtx(() => [
|
|
187
|
+
vue.createTextVNode(vue.toDisplayString(vue.unref(index.t)("tvp.tvpSearchbox.selectAll")), 1)
|
|
188
|
+
]),
|
|
189
|
+
_: 1
|
|
190
|
+
}, 8, ["modelValue", "indeterminate"])
|
|
191
|
+
]),
|
|
192
|
+
_: 1
|
|
193
|
+
})
|
|
194
|
+
]),
|
|
195
|
+
_: 1
|
|
196
|
+
}, 8, ["modelValue"]),
|
|
197
|
+
vue.createVNode(vue.unref(TinyCheckboxGroup), {
|
|
198
|
+
modelValue: __props.state.checkboxGroup,
|
|
199
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => __props.state.checkboxGroup = $event),
|
|
200
|
+
class: "tvp-search-box__checkbox"
|
|
201
|
+
}, {
|
|
202
|
+
default: vue.withCtx(() => [
|
|
203
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.state.backupList, (item, index2) => {
|
|
204
|
+
return vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(TinyDropdownItem), {
|
|
205
|
+
key: (item.field || item.label) + index2,
|
|
206
|
+
class: "tvp-search-box__dropdown-item tvp-search-box__checkbox-item"
|
|
207
|
+
}, {
|
|
208
|
+
default: vue.withCtx(() => [
|
|
209
|
+
vue.createVNode(vue.unref(TinyCheckbox), {
|
|
210
|
+
label: __props.state.prevItem.label + item.label,
|
|
211
|
+
title: item.label,
|
|
212
|
+
class: "tvp-search-box__checkbox-item-label"
|
|
213
|
+
}, {
|
|
214
|
+
default: vue.withCtx(() => [
|
|
215
|
+
vue.createTextVNode(vue.toDisplayString(item.label), 1)
|
|
216
|
+
]),
|
|
217
|
+
_: 2
|
|
218
|
+
}, 1032, ["label", "title"])
|
|
219
|
+
]),
|
|
220
|
+
_: 2
|
|
221
|
+
}, 1024)), [
|
|
222
|
+
[vue.vShow, !item.isFilter]
|
|
223
|
+
]);
|
|
224
|
+
}), 128))
|
|
225
|
+
]),
|
|
226
|
+
_: 1
|
|
227
|
+
}, 8, ["modelValue"])
|
|
228
|
+
]),
|
|
229
|
+
vue.createElementVNode("div", _hoisted_7, [
|
|
230
|
+
vue.createVNode(vue.unref(TinyButton), {
|
|
231
|
+
size: "mini",
|
|
232
|
+
onClick: _cache[3] || (_cache[3] = ($event) => selectCheckbox(false))
|
|
233
|
+
}, {
|
|
234
|
+
default: vue.withCtx(() => [
|
|
235
|
+
vue.createTextVNode(vue.toDisplayString(vue.unref(index.t)("tvp.tvpSearchbox.cancel")), 1)
|
|
236
|
+
]),
|
|
237
|
+
_: 1
|
|
238
|
+
}),
|
|
239
|
+
vue.createVNode(vue.unref(TinyButton), {
|
|
240
|
+
size: "mini",
|
|
241
|
+
onClick: _cache[4] || (_cache[4] = ($event) => selectCheckbox(true))
|
|
242
|
+
}, {
|
|
243
|
+
default: vue.withCtx(() => [
|
|
244
|
+
vue.createTextVNode(vue.toDisplayString(vue.unref(index.t)("tvp.tvpSearchbox.confirm")), 1)
|
|
245
|
+
]),
|
|
246
|
+
_: 1
|
|
247
|
+
})
|
|
248
|
+
])
|
|
249
|
+
], 64)) : vue.createCommentVNode("", true)
|
|
250
|
+
], 2)), [
|
|
251
|
+
[vue.unref(vLoading), isLoading.value]
|
|
252
|
+
]) : __props.state.prevItem.type === "numRange" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8, [
|
|
253
|
+
vue.createElementVNode("div", _hoisted_9, [
|
|
254
|
+
vue.createElementVNode("div", _hoisted_10, vue.toDisplayString(vue.unref(index.t)("tvp.tvpSearchbox.rangeNumberTitle")), 1),
|
|
255
|
+
vue.createElementVNode("div", _hoisted_11, vue.toDisplayString(vue.unref(index.t)("tvp.tvpSearchbox.minValueText")) + "(" + vue.toDisplayString(__props.state.prevItem.unit) + ") ", 1),
|
|
256
|
+
vue.createVNode(vue.unref(TinyFormItem), {
|
|
257
|
+
prop: __props.state.curMinNumVar,
|
|
258
|
+
class: "tvp-search-box__number-item",
|
|
259
|
+
"show-message": __props.state.numberShowMessage
|
|
260
|
+
}, {
|
|
261
|
+
default: vue.withCtx(() => [
|
|
262
|
+
vue.createVNode(vue.unref(TinyInput), {
|
|
263
|
+
modelValue: __props.state[__props.state.curMinNumVar],
|
|
264
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => __props.state[__props.state.curMinNumVar] = $event),
|
|
265
|
+
type: "number",
|
|
266
|
+
class: "tvp-search-box__number-input"
|
|
267
|
+
}, null, 8, ["modelValue"])
|
|
268
|
+
]),
|
|
269
|
+
_: 1
|
|
270
|
+
}, 8, ["prop", "show-message"]),
|
|
271
|
+
vue.createElementVNode("div", _hoisted_12, vue.toDisplayString(vue.unref(index.t)("tvp.tvpSearchbox.maxValueText")) + "(" + vue.toDisplayString(__props.state.prevItem.unit) + ") ", 1),
|
|
272
|
+
vue.createVNode(vue.unref(TinyFormItem), {
|
|
273
|
+
prop: __props.state.curMaxNumVar,
|
|
274
|
+
class: "tvp-search-box__number-item"
|
|
275
|
+
}, {
|
|
276
|
+
default: vue.withCtx(() => [
|
|
277
|
+
vue.createVNode(vue.unref(TinyInput), {
|
|
278
|
+
modelValue: __props.state[__props.state.curMaxNumVar],
|
|
279
|
+
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => __props.state[__props.state.curMaxNumVar] = $event),
|
|
280
|
+
type: "number",
|
|
281
|
+
class: "tvp-search-box__number-input"
|
|
282
|
+
}, null, 8, ["modelValue"])
|
|
283
|
+
]),
|
|
284
|
+
_: 1
|
|
285
|
+
}, 8, ["prop"])
|
|
286
|
+
]),
|
|
287
|
+
vue.createElementVNode("div", _hoisted_13, [
|
|
288
|
+
vue.createVNode(vue.unref(TinyButton), {
|
|
289
|
+
size: "mini",
|
|
290
|
+
onClick: _cache[7] || (_cache[7] = ($event) => sizeChange(false))
|
|
291
|
+
}, {
|
|
292
|
+
default: vue.withCtx(() => [
|
|
293
|
+
vue.createTextVNode(vue.toDisplayString(vue.unref(index.t)("tvp.tvpSearchbox.cancel")), 1)
|
|
294
|
+
]),
|
|
295
|
+
_: 1
|
|
296
|
+
}),
|
|
297
|
+
vue.createVNode(vue.unref(TinyButton), {
|
|
298
|
+
size: "mini",
|
|
299
|
+
onClick: _cache[8] || (_cache[8] = vue.withModifiers(($event) => sizeChange(true), ["stop"]))
|
|
300
|
+
}, {
|
|
301
|
+
default: vue.withCtx(() => [
|
|
302
|
+
vue.createTextVNode(vue.toDisplayString(vue.unref(index.t)("tvp.tvpSearchbox.confirm")), 1)
|
|
303
|
+
]),
|
|
304
|
+
_: 1
|
|
305
|
+
})
|
|
306
|
+
])
|
|
307
|
+
])) : __props.state.prevItem.type === "dateRange" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14, [
|
|
308
|
+
vue.createElementVNode("div", _hoisted_15, [
|
|
309
|
+
vue.createElementVNode("div", _hoisted_16, vue.toDisplayString(__props.state.prevItem.maxTimeLength > 0 ? vue.unref(index.t)("tvp.tvpSearchbox.timeLengthTitle", {
|
|
310
|
+
value: (__props.state.prevItem.maxTimeLength / 864e5).toFixed(1)
|
|
311
|
+
}) : vue.unref(index.t)("tvp.tvpSearchbox.rangeDateTitle")), 1),
|
|
312
|
+
vue.createElementVNode("div", _hoisted_17, vue.toDisplayString(vue.unref(index.t)("tvp.tvpSearchbox.rangeBeginLabel")), 1),
|
|
313
|
+
vue.createVNode(vue.unref(TinyFormItem), {
|
|
314
|
+
prop: "startDate",
|
|
315
|
+
"show-message": Boolean(__props.state.prevItem.maxTimeLength),
|
|
316
|
+
class: "tvp-search-box__date-item"
|
|
317
|
+
}, {
|
|
318
|
+
default: vue.withCtx(() => [
|
|
319
|
+
vue.createVNode(vue.unref(TinyDatePicker), {
|
|
320
|
+
modelValue: __props.state.startDate,
|
|
321
|
+
"onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => __props.state.startDate = $event),
|
|
322
|
+
format: __props.state.prevItem.format || __props.state.dateRangeFormat,
|
|
323
|
+
"value-format": __props.state.prevItem.format || __props.state.dateRangeFormat,
|
|
324
|
+
"picker-options": __props.pickerOptions(__props.state.startDate, "endDate"),
|
|
325
|
+
class: "tvp-search-box__date-picker",
|
|
326
|
+
onChange: handleDateShow,
|
|
327
|
+
onBlur: handleDateShow
|
|
328
|
+
}, null, 8, ["modelValue", "format", "value-format", "picker-options"])
|
|
329
|
+
]),
|
|
330
|
+
_: 1
|
|
331
|
+
}, 8, ["show-message"]),
|
|
332
|
+
vue.createElementVNode("div", _hoisted_18, vue.toDisplayString(vue.unref(index.t)("tvp.tvpSearchbox.rangeEndLabel")), 1),
|
|
333
|
+
vue.createVNode(vue.unref(TinyFormItem), {
|
|
334
|
+
prop: "endDate",
|
|
335
|
+
class: "tvp-search-box__date-item"
|
|
336
|
+
}, {
|
|
337
|
+
default: vue.withCtx(() => [
|
|
338
|
+
vue.createVNode(vue.unref(TinyDatePicker), {
|
|
339
|
+
modelValue: __props.state.endDate,
|
|
340
|
+
"onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => __props.state.endDate = $event),
|
|
341
|
+
format: __props.state.prevItem.format || __props.state.dateRangeFormat,
|
|
342
|
+
"value-format": __props.state.prevItem.format || __props.state.dateRangeFormat,
|
|
343
|
+
"picker-options": __props.pickerOptions(__props.state.startDate),
|
|
344
|
+
class: "tvp-search-box__date-picker",
|
|
345
|
+
onChange: handleDateShow,
|
|
346
|
+
onBlur: handleDateShow
|
|
347
|
+
}, null, 8, ["modelValue", "format", "value-format", "picker-options"])
|
|
348
|
+
]),
|
|
349
|
+
_: 1
|
|
350
|
+
})
|
|
351
|
+
]),
|
|
352
|
+
vue.createElementVNode("div", _hoisted_19, [
|
|
353
|
+
vue.createVNode(vue.unref(TinyButton), {
|
|
354
|
+
size: "mini",
|
|
355
|
+
onClick: _cache[11] || (_cache[11] = ($event) => onConfirmDate(false))
|
|
356
|
+
}, {
|
|
357
|
+
default: vue.withCtx(() => [
|
|
358
|
+
vue.createTextVNode(vue.toDisplayString(vue.unref(index.t)("tvp.tvpSearchbox.cancel")), 1)
|
|
359
|
+
]),
|
|
360
|
+
_: 1
|
|
361
|
+
}),
|
|
362
|
+
vue.createVNode(vue.unref(TinyButton), {
|
|
363
|
+
size: "mini",
|
|
364
|
+
onClick: _cache[12] || (_cache[12] = ($event) => onConfirmDate(true))
|
|
365
|
+
}, {
|
|
366
|
+
default: vue.withCtx(() => [
|
|
367
|
+
vue.createTextVNode(vue.toDisplayString(vue.unref(index.t)("tvp.tvpSearchbox.confirm")), 1)
|
|
368
|
+
]),
|
|
369
|
+
_: 1
|
|
370
|
+
})
|
|
371
|
+
])
|
|
372
|
+
])) : __props.state.prevItem.type === "datetimeRange" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_20, [
|
|
373
|
+
vue.createElementVNode("div", _hoisted_21, [
|
|
374
|
+
vue.createElementVNode("div", _hoisted_22, vue.toDisplayString(__props.state.prevItem.maxTimeLength > 0 ? vue.unref(index.t)("tvp.tvpSearchbox.timeLengthTitle", {
|
|
375
|
+
value: (__props.state.prevItem.maxTimeLength / 864e5).toFixed(1)
|
|
376
|
+
}) : vue.unref(index.t)("tvp.tvpSearchbox.rangeDateTitle")), 1),
|
|
377
|
+
vue.createElementVNode("div", _hoisted_23, vue.toDisplayString(vue.unref(index.t)("tvp.tvpSearchbox.rangeBeginLabel")), 1),
|
|
378
|
+
vue.createVNode(vue.unref(TinyFormItem), {
|
|
379
|
+
prop: "startDateTime",
|
|
380
|
+
"show-message": Boolean(__props.state.prevItem.maxTimeLength),
|
|
381
|
+
class: "tvp-search-box__date-item"
|
|
382
|
+
}, {
|
|
383
|
+
default: vue.withCtx(() => [
|
|
384
|
+
vue.createVNode(vue.unref(TinyDatePicker), {
|
|
385
|
+
modelValue: __props.state.startDateTime,
|
|
386
|
+
"onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => __props.state.startDateTime = $event),
|
|
387
|
+
type: "datetime",
|
|
388
|
+
isutc8: true,
|
|
389
|
+
format: __props.state.prevItem.format || __props.state.datetimeRangeFormat,
|
|
390
|
+
"value-format": __props.state.prevItem.format || __props.state.datetimeRangeFormat,
|
|
391
|
+
"picker-options": __props.pickerOptions(__props.state.startDateTime, "endDateTime"),
|
|
392
|
+
class: "tvp-search-box__date-picker",
|
|
393
|
+
onChange: handleDateShow,
|
|
394
|
+
onBlur: handleDateShow
|
|
395
|
+
}, null, 8, ["modelValue", "format", "value-format", "picker-options"])
|
|
396
|
+
]),
|
|
397
|
+
_: 1
|
|
398
|
+
}, 8, ["show-message"]),
|
|
399
|
+
vue.createElementVNode("div", _hoisted_24, vue.toDisplayString(vue.unref(index.t)("tvp.tvpSearchbox.rangeEndLabel")), 1),
|
|
400
|
+
vue.createVNode(vue.unref(TinyFormItem), {
|
|
401
|
+
prop: "endDateTime",
|
|
402
|
+
class: "tvp-search-box__date-item"
|
|
403
|
+
}, {
|
|
404
|
+
default: vue.withCtx(() => [
|
|
405
|
+
vue.createVNode(vue.unref(TinyDatePicker), {
|
|
406
|
+
modelValue: __props.state.endDateTime,
|
|
407
|
+
"onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => __props.state.endDateTime = $event),
|
|
408
|
+
type: "datetime",
|
|
409
|
+
isutc8: true,
|
|
410
|
+
format: __props.state.prevItem.format || __props.state.datetimeRangeFormat,
|
|
411
|
+
"value-format": __props.state.prevItem.format || __props.state.datetimeRangeFormat,
|
|
412
|
+
"picker-options": __props.pickerOptions(__props.state.startDateTime),
|
|
413
|
+
class: "tvp-search-box__date-picker",
|
|
414
|
+
onChange: handleDateShow,
|
|
415
|
+
onBlur: handleDateShow
|
|
416
|
+
}, null, 8, ["modelValue", "format", "value-format", "picker-options"])
|
|
417
|
+
]),
|
|
418
|
+
_: 1
|
|
419
|
+
})
|
|
420
|
+
]),
|
|
421
|
+
vue.createElementVNode("div", _hoisted_25, [
|
|
422
|
+
vue.createVNode(vue.unref(TinyButton), {
|
|
423
|
+
size: "mini",
|
|
424
|
+
onClick: _cache[15] || (_cache[15] = ($event) => onConfirmDate(false, true))
|
|
425
|
+
}, {
|
|
426
|
+
default: vue.withCtx(() => [
|
|
427
|
+
vue.createTextVNode(vue.toDisplayString(vue.unref(index.t)("tvp.tvpSearchbox.cancel")), 1)
|
|
428
|
+
]),
|
|
429
|
+
_: 1
|
|
430
|
+
}),
|
|
431
|
+
vue.createVNode(vue.unref(TinyButton), {
|
|
432
|
+
size: "mini",
|
|
433
|
+
onClick: _cache[16] || (_cache[16] = ($event) => onConfirmDate(true, true))
|
|
434
|
+
}, {
|
|
435
|
+
default: vue.withCtx(() => [
|
|
436
|
+
vue.createTextVNode(vue.toDisplayString(vue.unref(index.t)("tvp.tvpSearchbox.confirm")), 1)
|
|
437
|
+
]),
|
|
438
|
+
_: 1
|
|
439
|
+
})
|
|
440
|
+
])
|
|
441
|
+
])) : __props.state.prevItem.type === "map" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", _hoisted_26, [
|
|
442
|
+
__props.state.isShowTagKey ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_27, vue.toDisplayString(vue.unref(index.t)("tvp.tvpSearchbox.tagKey")), 1)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_28, vue.toDisplayString(vue.unref(index.t)("tvp.tvpSearchbox.tagValue")), 1)),
|
|
443
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.state.backupList, (item, index2) => {
|
|
444
|
+
return vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(TinyDropdownItem), {
|
|
445
|
+
key: item.label + item.value + index2,
|
|
446
|
+
disabled: item.isChecked,
|
|
447
|
+
class: "tvp-search-box__dropdown-item",
|
|
448
|
+
onClick: ($event) => selectFirstMap(item, __props.state.isShowTagKey)
|
|
449
|
+
}, {
|
|
450
|
+
default: vue.withCtx(() => [
|
|
451
|
+
vue.createElementVNode("span", {
|
|
452
|
+
title: item.label
|
|
453
|
+
}, vue.toDisplayString(item.label), 9, _hoisted_29)
|
|
454
|
+
]),
|
|
455
|
+
_: 2
|
|
456
|
+
}, 1032, ["disabled", "onClick"])), [
|
|
457
|
+
[vue.vShow, !item.isFilter]
|
|
458
|
+
]);
|
|
459
|
+
}), 128))
|
|
460
|
+
])), [
|
|
461
|
+
[vue.unref(vLoading), isLoading.value]
|
|
462
|
+
]) : vue.createCommentVNode("", true);
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
exports.default = _sfc_main;
|
|
@@ -3,11 +3,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const vue = require("vue");
|
|
4
4
|
const tag = require("../utils/tag.cjs.js");
|
|
5
5
|
const clone = require("../utils/clone.cjs.js");
|
|
6
|
+
const dropdown = require("../utils/dropdown.cjs.js");
|
|
6
7
|
function useCheckbox({ props, state, emits }) {
|
|
7
8
|
const selectCheckbox = (confirm) => {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
dropdown.showDropdown(state, false);
|
|
8
11
|
const { checkboxGroup, prevItem, propItem } = state;
|
|
9
12
|
const rest = clone.omitObj(prevItem);
|
|
10
|
-
state.hiden = true;
|
|
11
13
|
if (confirm) {
|
|
12
14
|
const tagList = [];
|
|
13
15
|
const oldValue = clone.deepClone(state.innerModelValue);
|
|
@@ -18,7 +20,7 @@ function useCheckbox({ props, state, emits }) {
|
|
|
18
20
|
const { indexMap } = state;
|
|
19
21
|
const hasTagIndex = indexMap.get(prevLabel);
|
|
20
22
|
hasTagIndex !== void 0 && state.innerModelValue.splice(hasTagIndex, 1);
|
|
21
|
-
state.backupList.forEach((item) => {
|
|
23
|
+
(_a = state.backupList) == null ? void 0 : _a.forEach((item) => {
|
|
22
24
|
const { label } = item;
|
|
23
25
|
const checkboxLabel = `${prevLabel}${label}`;
|
|
24
26
|
const hasItem = checkboxGroup.includes(checkboxLabel);
|
|
@@ -37,7 +39,7 @@ function useCheckbox({ props, state, emits }) {
|
|
|
37
39
|
} else {
|
|
38
40
|
const { valueMap } = state;
|
|
39
41
|
const indexList = [];
|
|
40
|
-
state.backupList.forEach((item) => {
|
|
42
|
+
(_b = state.backupList) == null ? void 0 : _b.forEach((item) => {
|
|
41
43
|
const { label } = item;
|
|
42
44
|
const value = `${prevLabel}${label}`;
|
|
43
45
|
const hasItem = checkboxGroup.includes(value);
|
|
@@ -63,24 +65,9 @@ function useCheckbox({ props, state, emits }) {
|
|
|
63
65
|
state.inputValue = "";
|
|
64
66
|
}
|
|
65
67
|
};
|
|
66
|
-
const isIndeterminate = vue.computed(
|
|
67
|
-
() => state.checkboxGroup.length > 0 && state.checkboxGroup.length !== state.filterList.length
|
|
68
|
-
);
|
|
69
|
-
const checkAll = vue.computed({
|
|
70
|
-
get: () => state.checkboxGroup.length && state.checkboxGroup.length === state.filterList.length,
|
|
71
|
-
set: (val) => {
|
|
72
|
-
if (val) {
|
|
73
|
-
state.checkboxGroup = state.filterList.flatMap((item) => `${state.prevItem.label}${item.label}`);
|
|
74
|
-
} else {
|
|
75
|
-
state.checkboxGroup = [];
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
68
|
const isShowClose = vue.computed(() => props.modelValue.length || state.propItem.label || state.inputValue);
|
|
80
69
|
return {
|
|
81
70
|
selectCheckbox,
|
|
82
|
-
isIndeterminate,
|
|
83
|
-
checkAll,
|
|
84
71
|
isShowClose
|
|
85
72
|
};
|
|
86
73
|
}
|
|
@@ -4,6 +4,7 @@ const tag = require("../utils/tag.cjs.js");
|
|
|
4
4
|
const dropdown = require("../utils/dropdown.cjs.js");
|
|
5
5
|
function useCustom({ state, emits }) {
|
|
6
6
|
const updateCustomValue = (customTag) => {
|
|
7
|
+
dropdown.showDropdown(state, false);
|
|
7
8
|
const { prevItem, indexMap } = state;
|
|
8
9
|
const { replace, label } = prevItem;
|
|
9
10
|
const tagList = [];
|
|
@@ -12,10 +12,10 @@ function useDatePicker({ props, state, emits }) {
|
|
|
12
12
|
}
|
|
13
13
|
const newTag = await validate.getVerifyDateTag(instance, state, props, isDateTimeType);
|
|
14
14
|
if (newTag) {
|
|
15
|
+
dropdown.showDropdown(state, false);
|
|
15
16
|
const newValue = props.modelValue.filter((prev) => prev.type !== newTag.type || prev.field !== newTag.field);
|
|
16
17
|
newValue.push(newTag);
|
|
17
18
|
tag.emitChangeModelEvent({ emits, state, newValue });
|
|
18
|
-
dropdown.showDropdown(state, false);
|
|
19
19
|
} else {
|
|
20
20
|
dropdown.showDropdown(state);
|
|
21
21
|
}
|
|
@@ -7,12 +7,11 @@ const clone = require("../utils/clone.cjs.js");
|
|
|
7
7
|
function useDropdown({ props, emits, state, t, format }) {
|
|
8
8
|
const { instance } = state;
|
|
9
9
|
const showValueItem = (item) => {
|
|
10
|
-
var _a;
|
|
10
|
+
var _a, _b, _c;
|
|
11
11
|
const { start, end, type } = item;
|
|
12
|
-
state.backupList =
|
|
12
|
+
state.backupList = item.options;
|
|
13
13
|
if (type === "numRange") {
|
|
14
14
|
validate.setStateNumRange(state, item, t);
|
|
15
|
-
state.hiden = false;
|
|
16
15
|
} else if (type === "dateRange") {
|
|
17
16
|
const { dateRangeFormat } = state;
|
|
18
17
|
if (!state.startDate && start) {
|
|
@@ -23,7 +22,6 @@ function useDropdown({ props, emits, state, t, format }) {
|
|
|
23
22
|
const newEnd = format(end, dateRangeFormat);
|
|
24
23
|
state.endDate = newEnd < state.startDate ? null : newEnd;
|
|
25
24
|
}
|
|
26
|
-
state.hiden = false;
|
|
27
25
|
} else if (type === "datetimeRange") {
|
|
28
26
|
const { datetimeRangeFormat } = state;
|
|
29
27
|
if (!state.startDateTime && start) {
|
|
@@ -34,28 +32,26 @@ function useDropdown({ props, emits, state, t, format }) {
|
|
|
34
32
|
const newEnd = format(end, datetimeRangeFormat);
|
|
35
33
|
state.endDateTime = newEnd < state.startDateTime ? null : newEnd;
|
|
36
34
|
}
|
|
37
|
-
state.hiden = false;
|
|
38
35
|
} else if (state.backupList && type === "checkbox") {
|
|
39
36
|
state.filterList = state.backupList;
|
|
40
37
|
state.checkboxGroup = [];
|
|
41
|
-
state.backupList.forEach((subItem) => {
|
|
38
|
+
(_a = state.backupList) == null ? void 0 : _a.forEach((subItem) => {
|
|
42
39
|
if (tag.hasTagItem(state, subItem.label)) {
|
|
43
40
|
state.checkboxGroup.push(`${item.label}${subItem.label}`);
|
|
44
41
|
}
|
|
45
42
|
subItem.isFilter = false;
|
|
46
43
|
});
|
|
47
|
-
state.hiden = false;
|
|
48
|
-
} else if (type === "custom") {
|
|
49
|
-
state.hiden = false;
|
|
50
44
|
}
|
|
51
|
-
if (
|
|
52
|
-
state.backupList.forEach((option) => {
|
|
45
|
+
if (type !== "checkbox" && ((_b = state.backupList) == null ? void 0 : _b.length)) {
|
|
46
|
+
(_c = state.backupList) == null ? void 0 : _c.forEach((option) => {
|
|
53
47
|
option.isFilter = false;
|
|
54
48
|
option.isChecked = tag.hasTagItem(state, option.label);
|
|
55
49
|
});
|
|
56
50
|
}
|
|
57
51
|
state.currentOperators = null;
|
|
58
|
-
if (!
|
|
52
|
+
if (!state.backupList && !["dateRange", "datetimeRange", "numRange", "custom"].includes(type)) {
|
|
53
|
+
dropdown.showDropdown(state, false);
|
|
54
|
+
} else {
|
|
59
55
|
dropdown.showDropdown(state);
|
|
60
56
|
}
|
|
61
57
|
};
|
|
@@ -70,7 +66,6 @@ function useDropdown({ props, emits, state, t, format }) {
|
|
|
70
66
|
if (operators == null ? void 0 : operators.length) {
|
|
71
67
|
state.operatorValue = "";
|
|
72
68
|
state.currentOperators = operators;
|
|
73
|
-
state.isResetFlag = true;
|
|
74
69
|
dropdown.showDropdown(state);
|
|
75
70
|
} else {
|
|
76
71
|
state.operatorValue = ":";
|
|
@@ -107,6 +102,7 @@ function useDropdown({ props, emits, state, t, format }) {
|
|
|
107
102
|
tag.resetInput(state);
|
|
108
103
|
return;
|
|
109
104
|
}
|
|
105
|
+
dropdown.showDropdown(state, false);
|
|
110
106
|
const oldValue = clone.deepClone(state.innerModelValue);
|
|
111
107
|
if ((replace || mergeTag) && index >= 0) {
|
|
112
108
|
state.innerModelValue.splice(index, 1);
|
|
@@ -115,7 +111,16 @@ function useDropdown({ props, emits, state, t, format }) {
|
|
|
115
111
|
const newValue = state.innerModelValue;
|
|
116
112
|
tag.emitChangeModelEvent({ emits, state, newValue, oldValue });
|
|
117
113
|
};
|
|
114
|
+
const selectInputValue = (val) => {
|
|
115
|
+
var _a;
|
|
116
|
+
if ((_a = state.propItem) == null ? void 0 : _a.label) {
|
|
117
|
+
selectRadioItem({ label: val });
|
|
118
|
+
} else {
|
|
119
|
+
createTag();
|
|
120
|
+
}
|
|
121
|
+
};
|
|
118
122
|
const selectRadioItem = (item, isPotential = false) => {
|
|
123
|
+
dropdown.showDropdown(state, false);
|
|
119
124
|
if (isPotential) {
|
|
120
125
|
state.prevItem = item;
|
|
121
126
|
state.backupPrevItem = item;
|
|
@@ -146,11 +151,12 @@ function useDropdown({ props, emits, state, t, format }) {
|
|
|
146
151
|
}
|
|
147
152
|
};
|
|
148
153
|
const newTagUpdateModelValue = (prevItem, propItem, tag2) => {
|
|
149
|
-
|
|
154
|
+
var _a;
|
|
155
|
+
const item = (_a = state.backupList) == null ? void 0 : _a.find((subItem) => subItem.label === tag2);
|
|
150
156
|
updateModelValue(prevItem, item, propItem.label, tag2);
|
|
151
157
|
};
|
|
152
158
|
const hasInputValueCreateTag = (inputValue, propItem, prevItem) => {
|
|
153
|
-
var _a;
|
|
159
|
+
var _a, _b;
|
|
154
160
|
if (propItem.label) {
|
|
155
161
|
const { regexp, replace, type, mergeTag } = prevItem;
|
|
156
162
|
const tagList = type !== "checkbox" && replace || type === "checkbox" && mergeTag ? [inputValue] : inputValue.split(props.splitInputValue);
|
|
@@ -167,12 +173,15 @@ function useDropdown({ props, emits, state, t, format }) {
|
|
|
167
173
|
}
|
|
168
174
|
} else {
|
|
169
175
|
const { items, defaultField } = props;
|
|
170
|
-
const currentItem =
|
|
176
|
+
const currentItem = items.find((item) => {
|
|
177
|
+
const { regexp } = item;
|
|
178
|
+
return regexp && regexp.test(state.inputValue);
|
|
179
|
+
}) || (defaultField ? items.find((item) => item.field === defaultField) : state.allTypeAttri);
|
|
171
180
|
const { replace, type, mergeTag } = currentItem;
|
|
172
181
|
const tagList = type !== "checkbox" && replace || type === "checkbox" && mergeTag ? [inputValue] : inputValue.split(props.splitInputValue);
|
|
173
182
|
if ((_a = currentItem == null ? void 0 : currentItem.options) == null ? void 0 : _a.length) {
|
|
174
183
|
state.backupList = [...currentItem.options];
|
|
175
|
-
state.backupList.forEach((item) => {
|
|
184
|
+
(_b = state.backupList) == null ? void 0 : _b.forEach((item) => {
|
|
176
185
|
const label2 = item.value || item.label;
|
|
177
186
|
if (tagList.includes(label2)) {
|
|
178
187
|
item.isChecked = true;
|
|
@@ -202,6 +211,6 @@ function useDropdown({ props, emits, state, t, format }) {
|
|
|
202
211
|
const helpClick = () => {
|
|
203
212
|
emits("help");
|
|
204
213
|
};
|
|
205
|
-
return { selectPropItem, selectRadioItem, createTag, helpClick, setOperator };
|
|
214
|
+
return { selectPropItem, selectRadioItem, selectInputValue, createTag, helpClick, setOperator };
|
|
206
215
|
}
|
|
207
216
|
exports.useDropdown = useDropdown;
|