@opentiny/vue-search-box 0.1.6 → 2.27.1

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.
Files changed (85) hide show
  1. package/{dist/index.css → index.css} +22 -19
  2. package/index.js +2804 -0
  3. package/index.js.map +1 -0
  4. package/package.json +38 -56
  5. package/README.md +0 -134
  6. package/README.zh-CN.md +0 -135
  7. package/dist/es/components/first-level-panel.vue.es.js +0 -4
  8. package/dist/es/components/first-level-panel.vue.es2.js +0 -177
  9. package/dist/es/components/second-level-panel.vue.es.js +0 -4
  10. package/dist/es/components/second-level-panel.vue.es2.js +0 -466
  11. package/dist/es/composables/use-checkbox.es.js +0 -74
  12. package/dist/es/composables/use-custom.es.js +0 -49
  13. package/dist/es/composables/use-datepicker.es.js +0 -86
  14. package/dist/es/composables/use-dropdown.es.js +0 -216
  15. package/dist/es/composables/use-edit.es.js +0 -108
  16. package/dist/es/composables/use-init.es.js +0 -78
  17. package/dist/es/composables/use-match.es.js +0 -170
  18. package/dist/es/composables/use-num-range.es.js +0 -77
  19. package/dist/es/composables/use-placeholder.es.js +0 -41
  20. package/dist/es/composables/use-tag.es.js +0 -56
  21. package/dist/es/index-Tlzvfwv-.css +0 -401
  22. package/dist/es/index.es.js +0 -45
  23. package/dist/es/index.type.es.js +0 -1
  24. package/dist/es/index.vue.es.js +0 -4
  25. package/dist/es/index.vue.es2.js +0 -780
  26. package/dist/es/smb-theme.es.js +0 -18
  27. package/dist/es/utils/clone.es.js +0 -29
  28. package/dist/es/utils/date.es.js +0 -431
  29. package/dist/es/utils/dropdown.es.js +0 -24
  30. package/dist/es/utils/en_US.es.js +0 -45
  31. package/dist/es/utils/index.es.js +0 -13
  32. package/dist/es/utils/tag.es.js +0 -44
  33. package/dist/es/utils/type.es.js +0 -4
  34. package/dist/es/utils/validate.es.js +0 -179
  35. package/dist/es/utils/zh_CN.es.js +0 -45
  36. package/dist/lib/components/first-level-panel.vue.cjs.js +0 -4
  37. package/dist/lib/components/first-level-panel.vue.cjs2.js +0 -177
  38. package/dist/lib/components/second-level-panel.vue.cjs.js +0 -4
  39. package/dist/lib/components/second-level-panel.vue.cjs2.js +0 -466
  40. package/dist/lib/composables/use-checkbox.cjs.js +0 -74
  41. package/dist/lib/composables/use-custom.cjs.js +0 -49
  42. package/dist/lib/composables/use-datepicker.cjs.js +0 -86
  43. package/dist/lib/composables/use-dropdown.cjs.js +0 -216
  44. package/dist/lib/composables/use-edit.cjs.js +0 -108
  45. package/dist/lib/composables/use-init.cjs.js +0 -78
  46. package/dist/lib/composables/use-match.cjs.js +0 -170
  47. package/dist/lib/composables/use-num-range.cjs.js +0 -77
  48. package/dist/lib/composables/use-placeholder.cjs.js +0 -41
  49. package/dist/lib/composables/use-tag.cjs.js +0 -56
  50. package/dist/lib/index-Tlzvfwv-.css +0 -401
  51. package/dist/lib/index.cjs.js +0 -45
  52. package/dist/lib/index.type.cjs.js +0 -1
  53. package/dist/lib/index.vue.cjs.js +0 -4
  54. package/dist/lib/index.vue.cjs2.js +0 -780
  55. package/dist/lib/smb-theme.cjs.js +0 -18
  56. package/dist/lib/utils/clone.cjs.js +0 -29
  57. package/dist/lib/utils/date.cjs.js +0 -431
  58. package/dist/lib/utils/dropdown.cjs.js +0 -24
  59. package/dist/lib/utils/en_US.cjs.js +0 -45
  60. package/dist/lib/utils/index.cjs.js +0 -13
  61. package/dist/lib/utils/tag.cjs.js +0 -44
  62. package/dist/lib/utils/type.cjs.js +0 -4
  63. package/dist/lib/utils/validate.cjs.js +0 -179
  64. package/dist/lib/utils/zh_CN.cjs.js +0 -45
  65. package/dist/types/composables/use-checkbox.d.ts +0 -8
  66. package/dist/types/composables/use-custom.d.ts +0 -7
  67. package/dist/types/composables/use-datepicker.d.ts +0 -11
  68. package/dist/types/composables/use-dropdown.d.ts +0 -14
  69. package/dist/types/composables/use-edit.d.ts +0 -13
  70. package/dist/types/composables/use-init.d.ts +0 -10
  71. package/dist/types/composables/use-match.d.ts +0 -8
  72. package/dist/types/composables/use-num-range.d.ts +0 -9
  73. package/dist/types/composables/use-placeholder.d.ts +0 -8
  74. package/dist/types/composables/use-tag.d.ts +0 -9
  75. package/dist/types/smb-theme.d.ts +0 -15
  76. package/dist/types/utils/clone.d.ts +0 -12
  77. package/dist/types/utils/date.d.ts +0 -234
  78. package/dist/types/utils/dropdown.d.ts +0 -12
  79. package/dist/types/utils/en_US.d.ts +0 -43
  80. package/dist/types/utils/index.d.ts +0 -1
  81. package/dist/types/utils/tag.d.ts +0 -46
  82. package/dist/types/utils/type.d.ts +0 -6
  83. package/dist/types/utils/validate.d.ts +0 -31
  84. package/dist/types/utils/zh_CN.d.ts +0 -43
  85. /package/{dist/types → types}/index.type.d.ts +0 -0
@@ -1,780 +0,0 @@
1
- import { defineComponent, reactive, computed, getCurrentInstance, nextTick, watch, onMounted, onBeforeUnmount, createElementBlock, openBlock, withModifiers, unref, normalizeClass, createVNode, createCommentVNode, Fragment, renderList, createBlock, withCtx, createElementVNode, toDisplayString, withDirectives, vShow, withKeys, normalizeStyle, renderSlot, mergeProps, createTextVNode } from "vue";
2
- import TinyTag from "@opentiny/vue-tag";
3
- import TinyInput from "@opentiny/vue-input";
4
- import TinyDropdown from "@opentiny/vue-dropdown";
5
- import TinyDropdownMenu from "@opentiny/vue-dropdown-menu";
6
- import TinyButton from "@opentiny/vue-button";
7
- import TinyTooltip from "@opentiny/vue-tooltip";
8
- import TinyDatePicker from "@opentiny/vue-date-picker";
9
- import TinyForm from "@opentiny/vue-form";
10
- import TinyFormItem from "@opentiny/vue-form-item";
11
- import TinyPopover from "@opentiny/vue-popover";
12
- import TinySelect from "@opentiny/vue-select";
13
- import TinyOption from "@opentiny/vue-option";
14
- import { iconSearch, iconClose, iconHelpQuery } from "@opentiny/vue-icon";
15
- import { format } from "./utils/date.es.js";
16
- import { t } from "./index.es.js";
17
- import { useTag } from "./composables/use-tag.es.js";
18
- import { useDropdown } from "./composables/use-dropdown.es.js";
19
- import { useMatch } from "./composables/use-match.es.js";
20
- import { useCheckbox } from "./composables/use-checkbox.es.js";
21
- import { useDatePicker } from "./composables/use-datepicker.es.js";
22
- import { useNumRange } from "./composables/use-num-range.es.js";
23
- import { useEdit } from "./composables/use-edit.es.js";
24
- import { useCustom } from "./composables/use-custom.es.js";
25
- import { useInit } from "./composables/use-init.es.js";
26
- import { usePlaceholder } from "./composables/use-placeholder.es.js";
27
- import { showPopover, showDropdown } from "./utils/dropdown.es.js";
28
- import "./components/first-level-panel.vue.es.js";
29
- import "./components/second-level-panel.vue.es.js";
30
- /* empty css */
31
- import { deepClone } from "./utils/clone.es.js";
32
- import { resetInput } from "./utils/tag.es.js";
33
- import _sfc_main$1 from "./components/first-level-panel.vue.es2.js";
34
- import _sfc_main$2 from "./components/second-level-panel.vue.es2.js";
35
- const _hoisted_1 = { class: "tvp-search-box__tag-value" };
36
- const _hoisted_2 = {
37
- key: 0,
38
- class: "tvp-search-box__placeholder"
39
- };
40
- const _hoisted_3 = { class: "tvp-search-box__input-wrapper" };
41
- const _hoisted_4 = { class: "tvp-search-box__prop" };
42
- const _hoisted_5 = { class: "tvp-search-box__input-separator" };
43
- const _hoisted_6 = { class: "tvp-search-box__date-wrap" };
44
- const _hoisted_7 = { class: "tvp-search-box__dropdown-start" };
45
- const _hoisted_8 = {
46
- key: 0,
47
- class: "tvp-search-box__dropdown-end"
48
- };
49
- const _hoisted_9 = {
50
- key: 2,
51
- class: "tvp-search-box__dropdown-end"
52
- };
53
- const _hoisted_10 = {
54
- key: 4,
55
- class: "tvp-search-box__number"
56
- };
57
- const _hoisted_11 = { class: "tvp-search-box__dropdown-start" };
58
- const _hoisted_12 = { class: "tvp-search-box__dropdown-end" };
59
- const _hoisted_13 = {
60
- key: 5,
61
- class: "tvp-search-box__date-wrap"
62
- };
63
- const _hoisted_14 = { class: "tvp-search-box__dropdown-title" };
64
- const _hoisted_15 = { class: "tvp-search-box__dropdown-start" };
65
- const _hoisted_16 = { class: "tvp-search-box__dropdown-end" };
66
- const _hoisted_17 = {
67
- key: 6,
68
- class: "tvp-search-box__date-wrap"
69
- };
70
- const _hoisted_18 = { class: "tvp-search-box__dropdown-title" };
71
- const _hoisted_19 = { class: "tvp-search-box__dropdown-start" };
72
- const _hoisted_20 = { class: "tvp-search-box__dropdown-end" };
73
- const _hoisted_21 = { class: "tvp-search-box__bottom-btn" };
74
- const _hoisted_22 = {
75
- key: 1,
76
- class: "tvp-search-box__panel-box"
77
- };
78
- const _sfc_main = /* @__PURE__ */ defineComponent({
79
- ...{
80
- name: "TinySearchBox"
81
- },
82
- __name: "index",
83
- props: {
84
- modelValue: {
85
- type: Array,
86
- default() {
87
- return [];
88
- }
89
- },
90
- items: {
91
- type: Array,
92
- default: () => []
93
- },
94
- emptyPlaceholder: {
95
- type: String,
96
- default: ""
97
- },
98
- potentialOptions: {
99
- type: Object,
100
- default() {
101
- return null;
102
- }
103
- },
104
- // 是否显示帮助图标,新规范默认显示
105
- showHelp: {
106
- type: Boolean,
107
- default: true
108
- },
109
- // 标签标识键
110
- idMapKey: {
111
- type: String,
112
- default: "id"
113
- },
114
- // 自定义默认搜索项
115
- defaultField: {
116
- type: String,
117
- default: ""
118
- },
119
- editable: {
120
- type: Boolean,
121
- default: false
122
- },
123
- maxlength: {
124
- type: Number
125
- },
126
- // 3.18.0新增
127
- panelMaxHeight: {
128
- type: String,
129
- default: "999px"
130
- },
131
- // 3.18.0新增
132
- splitInputValue: {
133
- type: String,
134
- default: ","
135
- },
136
- // 尺寸
137
- size: {
138
- type: String,
139
- default: ""
140
- }
141
- },
142
- emits: ["update:modelValue", "change", "search", "exceed", "first-level-select", "clear"],
143
- setup(__props, { expose: __expose, emit: __emit }) {
144
- const props = __props;
145
- const emits = __emit;
146
- const state = reactive({
147
- innerModelValue: [...props.modelValue],
148
- recordItems: [],
149
- groupItems: {},
150
- inputValue: "",
151
- matchItems: {},
152
- propItem: {},
153
- backupList: [],
154
- filterList: [],
155
- checkboxGroup: [],
156
- prevItem: {},
157
- backupPrevItem: "",
158
- formRules: null,
159
- validType: "text",
160
- numberShowMessage: true,
161
- startDate: null,
162
- startDateTime: null,
163
- endDate: null,
164
- endDateTime: null,
165
- isShowTagKey: true,
166
- potentialOptions: null,
167
- dateRangeFormat: "yyyy/MM/dd",
168
- datetimeRangeFormat: "yyyy/MM/dd HH:mm:ss",
169
- indexMap: /* @__PURE__ */ new Map(),
170
- valueMap: /* @__PURE__ */ new Map(),
171
- popoverVisible: false,
172
- selectValue: "",
173
- allTypeAttri: { label: t("tvp.tvpSearchbox.rulekeyword1"), field: "tvpKeyword", type: "radio" },
174
- operatorValue: ":",
175
- // 当前操作符值
176
- inputEditValue: "",
177
- currentOperators: "",
178
- currentEditValue: "",
179
- currentModelValueIndex: -1,
180
- // 当前编辑的标签索引
181
- curMinNumVar: "",
182
- // numRange最小值变量
183
- curMaxNumVar: "",
184
- // numRange最大值变量
185
- instance: getCurrentInstance(),
186
- isMouseDown: false,
187
- currentEditSelectTags: [],
188
- // 当前编辑多选的标签值
189
- visible: false,
190
- visibleTimer: null,
191
- hasBackupList: computed(
192
- () => state.propItem.label && [void 0, "radio", "checkbox", "map"].includes(state.prevItem.type)
193
- ),
194
- isIndeterminate: computed(
195
- () => state.checkboxGroup.length > 0 && state.checkboxGroup.length !== state.filterList.length
196
- ),
197
- checkAll: computed({
198
- get: () => state.checkboxGroup.length && state.checkboxGroup.length === state.filterList.length,
199
- set: (val) => {
200
- if (val) {
201
- state.checkboxGroup = state.filterList.flatMap((item) => `${state.prevItem.label}${item.label}`);
202
- } else {
203
- state.checkboxGroup = [];
204
- }
205
- }
206
- })
207
- });
208
- const TinyIconSearch = iconSearch();
209
- const TinyIconClose = iconClose();
210
- const TinyIconHelpQuery = iconHelpQuery();
211
- const { selectPropItem, selectRadioItem, selectInputValue, createTag, helpClick, setOperator } = useDropdown({
212
- props,
213
- emits,
214
- state,
215
- t,
216
- format
217
- });
218
- const { deleteTag, clearTag, backspaceDeleteTag } = useTag({
219
- props,
220
- state,
221
- emits
222
- });
223
- const { editTag, confirmEditTag, selectPropChange, selectItemIsDisable } = useEdit({
224
- props,
225
- state,
226
- t,
227
- nextTick,
228
- format,
229
- emits
230
- });
231
- const { handleInput, selectFirstMap } = useMatch({
232
- props,
233
- state,
234
- emits
235
- });
236
- const { placeholder, setPlaceholder } = usePlaceholder({ props, state, t });
237
- const { selectCheckbox, isShowClose } = useCheckbox({
238
- props,
239
- state,
240
- emits
241
- });
242
- const { onConfirmDate, handleDateShow, pickerOptions } = useDatePicker({
243
- props,
244
- state,
245
- emits
246
- });
247
- const { sizeChange, initFormRule } = useNumRange({
248
- props,
249
- state,
250
- t,
251
- emits
252
- });
253
- const { handleConfirm, handleEditConfirm } = useCustom({ state, emits });
254
- const { initItems, watchOutsideClick, watchMouseDown, watchMouseMove, handleClick } = useInit({
255
- props,
256
- state
257
- });
258
- watch(
259
- () => props.items,
260
- (newVal) => {
261
- state.recordItems = deepClone(newVal);
262
- initItems();
263
- initFormRule();
264
- },
265
- {
266
- deep: true,
267
- immediate: true
268
- }
269
- );
270
- watch(
271
- () => state.popoverVisible,
272
- (newVal) => {
273
- if (!newVal && !state.inputEditValue.length) {
274
- state.inputEditValue = state.currentEditSelectTags;
275
- }
276
- },
277
- {
278
- immediate: true
279
- }
280
- );
281
- watch(
282
- () => props.modelValue,
283
- (newVal) => {
284
- if (newVal) {
285
- state.indexMap.clear();
286
- state.valueMap.clear();
287
- newVal.forEach((item, index) => {
288
- var _a;
289
- const value = `${item.label}${item.value}`;
290
- state.indexMap.set(item.label, index);
291
- state.valueMap.set(value, index);
292
- if (((_a = item.options) == null ? void 0 : _a.length) > 0) {
293
- item.options.forEach((option) => {
294
- const optionValue = `${item.label}${option.label}`;
295
- state.valueMap.set(optionValue, index);
296
- });
297
- }
298
- });
299
- showPopover(state, false);
300
- if (newVal.length === 0) {
301
- setPlaceholder(props.emptyPlaceholder);
302
- }
303
- if (props.editable && !state.inputEditValue.length && newVal[0]) {
304
- state.inputEditValue = newVal[0].value;
305
- }
306
- }
307
- state.innerModelValue = [...newVal];
308
- },
309
- {
310
- deep: true,
311
- immediate: true
312
- }
313
- );
314
- onMounted(() => {
315
- if (typeof document !== "undefined") {
316
- document.addEventListener("click", watchOutsideClick);
317
- document.addEventListener("mousedown", watchMouseDown);
318
- document.addEventListener("mousemove", watchMouseMove);
319
- }
320
- });
321
- onBeforeUnmount(() => {
322
- if (typeof document !== "undefined") {
323
- document.removeEventListener("click", watchOutsideClick);
324
- document.removeEventListener("mousedown", watchMouseDown);
325
- document.removeEventListener("mousemove", watchMouseMove);
326
- }
327
- });
328
- const eventsMap = {
329
- selectInputValue,
330
- selectPropItem,
331
- selectRadioItem,
332
- setOperator,
333
- selectCheckbox,
334
- sizeChange,
335
- onConfirmDate,
336
- selectFirstMap,
337
- handleDateShow
338
- };
339
- const handleEvents = (eventName, p1, p2) => {
340
- eventsMap[eventName](p1, p2);
341
- };
342
- __expose({
343
- state,
344
- handleEvents
345
- });
346
- return (_ctx, _cache) => {
347
- return openBlock(), createElementBlock("div", {
348
- class: normalizeClass(["tvp-search-box", __props.size === "small" ? "tvp-search-box--small" : ""]),
349
- onClick: _cache[21] || (_cache[21] = withModifiers(($event) => unref(showPopover)(state, false), ["stop"]))
350
- }, [
351
- createVNode(unref(TinyIconSearch), { class: "tvp-search-box__prefix" }),
352
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.modelValue, (tag, index) => {
353
- return openBlock(), createBlock(unref(TinyTag), {
354
- key: tag.field + index,
355
- closable: "",
356
- size: __props.size === "small" ? "small" : "",
357
- class: normalizeClass(["tvp-search-box__tag", __props.editable && tag.type !== "map" ? "tvp-search-box__tag-editor" : ""]),
358
- title: `${tag.label} ${tag.operator || ":"} ${tag.value}`,
359
- onClose: ($event) => unref(deleteTag)(tag),
360
- onClick: withModifiers(($event) => unref(editTag)(tag, index, $event), ["stop"])
361
- }, {
362
- default: withCtx(() => [
363
- createElementVNode("span", _hoisted_1, toDisplayString(tag.label) + " " + toDisplayString(tag.operator || ":") + " " + toDisplayString(tag.value), 1)
364
- ]),
365
- _: 2
366
- }, 1032, ["size", "class", "title", "onClose", "onClick"]);
367
- }), 128)),
368
- __props.modelValue.length ? (openBlock(), createElementBlock("span", _hoisted_2)) : createCommentVNode("", true),
369
- createVNode(unref(TinyForm), {
370
- ref: "formRef",
371
- model: state,
372
- rules: state.formRules,
373
- "validate-type": state.validType,
374
- size: __props.size === "small" ? "small" : "",
375
- "label-width": "0px",
376
- "message-type": "block",
377
- class: "tvp-search-box__form"
378
- }, {
379
- default: withCtx(() => [
380
- createElementVNode("div", _hoisted_3, [
381
- createElementVNode("section", _hoisted_4, [
382
- withDirectives(createElementVNode("span", null, toDisplayString(state.propItem.label) + " " + toDisplayString(`${state.operatorValue ? state.operatorValue : ""} `), 513), [
383
- [vShow, state.propItem.label]
384
- ]),
385
- withDirectives(createElementVNode("span", null, toDisplayString(state.propItem.value), 513), [
386
- [vShow, state.propItem.value]
387
- ])
388
- ]),
389
- createVNode(unref(TinyDropdown), {
390
- ref: "dropdownRef",
391
- visible: state.visible,
392
- "onUpdate:visible": _cache[5] || (_cache[5] = ($event) => state.visible = $event),
393
- trigger: "click",
394
- class: "tvp-search-box__dropdown",
395
- "show-icon": false,
396
- size: __props.size === "small" ? "small" : "",
397
- "lazy-show-popper": "",
398
- "close-on-click-outside": true
399
- }, {
400
- dropdown: withCtx(() => [
401
- createVNode(unref(TinyDropdownMenu), {
402
- placement: "bottom-start",
403
- "popper-class": "tvp-search-box__dropdown-menu",
404
- style: normalizeStyle({ "max-height": __props.panelMaxHeight }),
405
- onMouseup: withModifiers(() => {
406
- }, ["stop"])
407
- }, {
408
- default: withCtx(() => {
409
- var _a, _b;
410
- return [
411
- withDirectives(createElementVNode("div", null, [
412
- ((_a = state.instance) == null ? void 0 : _a.slots["first-panel"]) ? renderSlot(_ctx.$slots, "first-panel", mergeProps({ key: 0 }, {
413
- state,
414
- handleEvents
415
- }, {
416
- onClick: _cache[1] || (_cache[1] = withModifiers(() => {
417
- }, ["stop"]))
418
- })) : (openBlock(), createBlock(_sfc_main$1, {
419
- key: 1,
420
- state,
421
- onEvents: handleEvents
422
- }, null, 8, ["state"]))
423
- ], 512), [
424
- [vShow, !state.propItem.label || state.inputValue.trim()]
425
- ]),
426
- withDirectives(createElementVNode("div", null, [
427
- ((_b = state.instance) == null ? void 0 : _b.slots["second-panel"]) ? renderSlot(_ctx.$slots, "second-panel", mergeProps({ key: 0 }, {
428
- state,
429
- pickerOptions: unref(pickerOptions),
430
- handleEvents,
431
- back: () => unref(resetInput)(state)
432
- }, {
433
- onClick: _cache[2] || (_cache[2] = withModifiers(() => {
434
- }, ["stop"]))
435
- })) : state.prevItem.type !== "custom" ? (openBlock(), createBlock(_sfc_main$2, {
436
- key: 1,
437
- state,
438
- "picker-options": unref(pickerOptions),
439
- onEvents: handleEvents
440
- }, null, 8, ["state", "picker-options"])) : (openBlock(), createElementBlock("div", {
441
- key: 2,
442
- class: "tvp-search-box__panel-box",
443
- onClick: _cache[4] || (_cache[4] = ($event) => unref(showDropdown)(state))
444
- }, [
445
- renderSlot(_ctx.$slots, state.prevItem.slotName, mergeProps({
446
- showDropdown: () => unref(showDropdown)(state),
447
- onConfirm: unref(handleConfirm)
448
- }, {
449
- onClick: _cache[3] || (_cache[3] = withModifiers(() => {
450
- }, ["stop"]))
451
- }))
452
- ]))
453
- ], 512), [
454
- [vShow, state.propItem.label]
455
- ])
456
- ];
457
- }),
458
- _: 3
459
- }, 8, ["style"])
460
- ]),
461
- default: withCtx(() => [
462
- createVNode(unref(TinyInput), {
463
- ref: "inputRef",
464
- modelValue: state.inputValue,
465
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => state.inputValue = $event),
466
- class: "tvp-search-box__input",
467
- placeholder: unref(placeholder),
468
- maxlength: __props.maxlength && __props.maxlength + 1,
469
- onKeydown: [
470
- withKeys(withModifiers(unref(backspaceDeleteTag), ["stop"]), ["delete"]),
471
- withKeys(withModifiers(unref(createTag), ["stop"]), ["enter"])
472
- ],
473
- onInput: unref(handleInput),
474
- onClick: unref(handleClick)
475
- }, {
476
- suffix: withCtx(() => [
477
- withDirectives(createVNode(unref(TinyIconClose), {
478
- class: "tvp-search-box__input-close",
479
- onClick: withModifiers(unref(clearTag), ["stop"])
480
- }, null, 8, ["onClick"]), [
481
- [vShow, unref(isShowClose)]
482
- ]),
483
- withDirectives(createElementVNode("span", _hoisted_5, null, 512), [
484
- [vShow, unref(isShowClose)]
485
- ]),
486
- __props.showHelp ? (openBlock(), createBlock(unref(TinyTooltip), {
487
- key: 0,
488
- effect: "light",
489
- content: unref(t)("tvp.tvpSearchbox.help"),
490
- placement: "top"
491
- }, {
492
- default: withCtx(() => [
493
- createVNode(unref(TinyIconHelpQuery), {
494
- class: "tvp-search-box__input-help",
495
- onClick: withModifiers(unref(helpClick), ["stop"])
496
- }, null, 8, ["onClick"])
497
- ]),
498
- _: 1
499
- }, 8, ["content"])) : createCommentVNode("", true),
500
- createVNode(unref(TinyIconSearch), {
501
- class: "tvp-search-box__input-search",
502
- onClick: withModifiers(unref(createTag), ["stop"])
503
- }, null, 8, ["onClick"])
504
- ]),
505
- _: 1
506
- }, 8, ["modelValue", "placeholder", "maxlength", "onKeydown", "onInput", "onClick"])
507
- ]),
508
- _: 3
509
- }, 8, ["visible", "size"])
510
- ]),
511
- __props.editable ? (openBlock(), createBlock(unref(TinyPopover), {
512
- key: 0,
513
- ref: "popoverRef",
514
- modelValue: state.popoverVisible,
515
- "onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => state.popoverVisible = $event),
516
- placement: "bottom-start",
517
- "visible-arrow": false,
518
- trigger: "manual",
519
- "popper-class": "tvp-search-box__popover",
520
- class: "tvp-search-box__form-popover"
521
- }, {
522
- default: withCtx(() => [
523
- state.prevItem.type !== "custom" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
524
- createElementVNode("div", _hoisted_6, [
525
- createElementVNode("div", _hoisted_7, toDisplayString(unref(t)("tvp.tvpSearchbox.attributeType")), 1),
526
- createVNode(unref(TinyFormItem), { class: "tvp-search-box__number-item" }, {
527
- default: withCtx(() => [
528
- createVNode(unref(TinySelect), {
529
- modelValue: state.selectValue,
530
- "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => state.selectValue = $event),
531
- searchable: "",
532
- disabled: state.prevItem.editAttrDisabled
533
- }, {
534
- default: withCtx(() => [
535
- (openBlock(), createBlock(unref(TinyOption), {
536
- key: state.allTypeAttri.label,
537
- label: unref(t)("tvp.tvpSearchbox.allProperty"),
538
- value: state.allTypeAttri.label,
539
- disabled: unref(selectItemIsDisable)(state.allTypeAttri),
540
- onClick: _cache[6] || (_cache[6] = ($event) => unref(selectPropChange)(state.allTypeAttri, unref(selectItemIsDisable)(state.allTypeAttri)))
541
- }, null, 8, ["label", "value", "disabled"])),
542
- (openBlock(true), createElementBlock(Fragment, null, renderList(state.recordItems, (item) => {
543
- return openBlock(), createBlock(unref(TinyOption), {
544
- key: item.label,
545
- label: item.label,
546
- value: item.label,
547
- disabled: unref(selectItemIsDisable)(item),
548
- onClick: ($event) => unref(selectPropChange)(item, unref(selectItemIsDisable)(item))
549
- }, null, 8, ["label", "value", "disabled", "onClick"]);
550
- }), 128))
551
- ]),
552
- _: 1
553
- }, 8, ["modelValue", "disabled"])
554
- ]),
555
- _: 1
556
- }),
557
- state.prevItem.operators ? (openBlock(), createElementBlock("div", _hoisted_8, toDisplayString(unref(t)("tvp.tvpSearchbox.operator")), 1)) : createCommentVNode("", true),
558
- state.prevItem.operators ? (openBlock(), createBlock(unref(TinyFormItem), {
559
- key: 1,
560
- class: "tvp-search-box__number-item"
561
- }, {
562
- default: withCtx(() => [
563
- createVNode(unref(TinySelect), {
564
- modelValue: state.operatorValue,
565
- "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => state.operatorValue = $event)
566
- }, {
567
- default: withCtx(() => [
568
- (openBlock(true), createElementBlock(Fragment, null, renderList(state.currentOperators, (item) => {
569
- return openBlock(), createBlock(unref(TinyOption), {
570
- key: item,
571
- label: item,
572
- value: item
573
- }, null, 8, ["label", "value"]);
574
- }), 128))
575
- ]),
576
- _: 1
577
- }, 8, ["modelValue"])
578
- ]),
579
- _: 1
580
- })) : createCommentVNode("", true),
581
- state.prevItem.type !== "numRange" ? (openBlock(), createElementBlock("div", _hoisted_9, toDisplayString(unref(t)("tvp.tvpSearchbox.tagValue")), 1)) : createCommentVNode("", true),
582
- !["numRange", "dateRange", "datetimeRange", "custom"].includes(state.prevItem.type) ? (openBlock(), createBlock(unref(TinyFormItem), {
583
- key: 3,
584
- prop: "inputEditValue",
585
- class: "tvp-search-box__number-item"
586
- }, {
587
- default: withCtx(() => {
588
- var _a, _b;
589
- return [
590
- ((_a = state.currentEditValue) == null ? void 0 : _a.length) > 0 ? (openBlock(), createBlock(unref(TinySelect), {
591
- key: 0,
592
- modelValue: state.inputEditValue,
593
- "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => state.inputEditValue = $event),
594
- class: "tvp-search-box-select",
595
- multiple: Boolean(state.prevItem.mergeTag),
596
- "allow-create": (_b = state.prevItem) == null ? void 0 : _b.allowCreate,
597
- filterable: "",
598
- "default-first-option": "",
599
- clearable: ""
600
- }, {
601
- default: withCtx(() => [
602
- (openBlock(true), createElementBlock(Fragment, null, renderList(state.currentEditValue, (item) => {
603
- return openBlock(), createBlock(unref(TinyOption), {
604
- key: item.label,
605
- label: item.label,
606
- value: item.label
607
- }, null, 8, ["label", "value"]);
608
- }), 128))
609
- ]),
610
- _: 1
611
- }, 8, ["modelValue", "multiple", "allow-create"])) : (openBlock(), createBlock(unref(TinyInput), {
612
- key: 1,
613
- modelValue: state.inputEditValue,
614
- "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => state.inputEditValue = $event),
615
- clearable: ""
616
- }, null, 8, ["modelValue"]))
617
- ];
618
- }),
619
- _: 1
620
- })) : createCommentVNode("", true),
621
- state.prevItem.type === "numRange" ? (openBlock(), createElementBlock("div", _hoisted_10, [
622
- createElementVNode("div", _hoisted_11, toDisplayString(unref(t)("tvp.tvpSearchbox.minValueText")) + "(" + toDisplayString(state.prevItem.unit) + ") ", 1),
623
- createVNode(unref(TinyFormItem), {
624
- prop: state.curMinNumVar,
625
- class: "tvp-search-box__number-item",
626
- "show-message": state.numberShowMessage
627
- }, {
628
- default: withCtx(() => [
629
- createVNode(unref(TinyInput), {
630
- modelValue: state[state.curMinNumVar],
631
- "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => state[state.curMinNumVar] = $event),
632
- type: "number",
633
- class: "tvp-search-box__number-input"
634
- }, null, 8, ["modelValue"])
635
- ]),
636
- _: 1
637
- }, 8, ["prop", "show-message"]),
638
- createElementVNode("div", _hoisted_12, toDisplayString(unref(t)("tvp.tvpSearchbox.maxValueText")) + "(" + toDisplayString(state.prevItem.unit) + ") ", 1),
639
- createVNode(unref(TinyFormItem), {
640
- prop: state.curMaxNumVar,
641
- class: "tvp-search-box__number-item"
642
- }, {
643
- default: withCtx(() => [
644
- createVNode(unref(TinyInput), {
645
- modelValue: state[state.curMaxNumVar],
646
- "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => state[state.curMaxNumVar] = $event),
647
- type: "number",
648
- class: "tvp-search-box__number-input"
649
- }, null, 8, ["modelValue"])
650
- ]),
651
- _: 1
652
- }, 8, ["prop"])
653
- ])) : createCommentVNode("", true),
654
- state.prevItem.type === "dateRange" ? (openBlock(), createElementBlock("div", _hoisted_13, [
655
- createElementVNode("div", _hoisted_14, toDisplayString(state.prevItem.maxTimeLength > 0 ? unref(t)("tvp.tvpSearchbox.timeLengthTitle", {
656
- value: (state.prevItem.maxTimeLength / 864e5).toFixed(1)
657
- }) : unref(t)("tvp.tvpSearchbox.rangeDateTitle")), 1),
658
- createElementVNode("div", _hoisted_15, toDisplayString(unref(t)("tvp.tvpSearchbox.rangeBeginLabel")), 1),
659
- createVNode(unref(TinyFormItem), {
660
- prop: "startDate",
661
- "show-message": Boolean(state.prevItem.maxTimeLength),
662
- class: "tvp-search-box__date-item"
663
- }, {
664
- default: withCtx(() => [
665
- createVNode(unref(TinyDatePicker), {
666
- modelValue: state.startDate,
667
- "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => state.startDate = $event),
668
- format: state.prevItem.format || state.dateRangeFormat,
669
- "value-format": state.prevItem.format || state.dateRangeFormat,
670
- "picker-options": unref(pickerOptions)(state.startDate, "endDate"),
671
- class: "tvp-search-box__date-picker"
672
- }, null, 8, ["modelValue", "format", "value-format", "picker-options"])
673
- ]),
674
- _: 1
675
- }, 8, ["show-message"]),
676
- createElementVNode("div", _hoisted_16, toDisplayString(unref(t)("tvp.tvpSearchbox.rangeEndLabel")), 1),
677
- createVNode(unref(TinyFormItem), {
678
- prop: "endDate",
679
- class: "tvp-search-box__date-item"
680
- }, {
681
- default: withCtx(() => [
682
- createVNode(unref(TinyDatePicker), {
683
- modelValue: state.endDate,
684
- "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => state.endDate = $event),
685
- format: state.prevItem.format || state.dateRangeFormat,
686
- "value-format": state.prevItem.format || state.dateRangeFormat,
687
- "picker-options": unref(pickerOptions)(state.startDate),
688
- class: "tvp-search-box__date-picker"
689
- }, null, 8, ["modelValue", "format", "value-format", "picker-options"])
690
- ]),
691
- _: 1
692
- })
693
- ])) : createCommentVNode("", true),
694
- state.prevItem.type === "datetimeRange" ? (openBlock(), createElementBlock("div", _hoisted_17, [
695
- createElementVNode("div", _hoisted_18, toDisplayString(state.prevItem.maxTimeLength > 0 ? unref(t)("tvp.tvpSearchbox.timeLengthTitle", {
696
- value: (state.prevItem.maxTimeLength / 864e5).toFixed(1)
697
- }) : unref(t)("tvp.tvpSearchbox.rangeDateTitle")), 1),
698
- createElementVNode("div", _hoisted_19, toDisplayString(unref(t)("tvp.tvpSearchbox.rangeBeginLabel")), 1),
699
- createVNode(unref(TinyFormItem), {
700
- prop: "startDateTime",
701
- "show-message": Boolean(state.prevItem.maxTimeLength),
702
- class: "tvp-search-box__date-item"
703
- }, {
704
- default: withCtx(() => [
705
- createVNode(unref(TinyDatePicker), {
706
- modelValue: state.startDateTime,
707
- "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => state.startDateTime = $event),
708
- type: "datetime",
709
- isutc8: true,
710
- format: state.prevItem.format || state.datetimeRangeFormat,
711
- "value-format": state.prevItem.format || state.datetimeRangeFormat,
712
- "picker-options": unref(pickerOptions)(state.startDateTime, "endDateTime"),
713
- class: "tvp-search-box__date-picker"
714
- }, null, 8, ["modelValue", "format", "value-format", "picker-options"])
715
- ]),
716
- _: 1
717
- }, 8, ["show-message"]),
718
- createElementVNode("div", _hoisted_20, toDisplayString(unref(t)("tvp.tvpSearchbox.rangeEndLabel")), 1),
719
- createVNode(unref(TinyFormItem), {
720
- prop: "endDateTime",
721
- class: "tvp-search-box__date-item"
722
- }, {
723
- default: withCtx(() => [
724
- createVNode(unref(TinyDatePicker), {
725
- modelValue: state.endDateTime,
726
- "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => state.endDateTime = $event),
727
- type: "datetime",
728
- isutc8: true,
729
- format: state.prevItem.format || state.datetimeRangeFormat,
730
- "value-format": state.prevItem.format || state.datetimeRangeFormat,
731
- "picker-options": unref(pickerOptions)(state.startDateTime),
732
- class: "tvp-search-box__date-picker"
733
- }, null, 8, ["modelValue", "format", "value-format", "picker-options"])
734
- ]),
735
- _: 1
736
- })
737
- ])) : createCommentVNode("", true)
738
- ]),
739
- createElementVNode("div", _hoisted_21, [
740
- createVNode(unref(TinyButton), {
741
- size: "mini",
742
- onClick: _cache[17] || (_cache[17] = ($event) => unref(confirmEditTag)(false))
743
- }, {
744
- default: withCtx(() => [
745
- createTextVNode(toDisplayString(unref(t)("tvp.tvpSearchbox.cancel")), 1)
746
- ]),
747
- _: 1
748
- }),
749
- createVNode(unref(TinyButton), {
750
- size: "mini",
751
- onClick: _cache[18] || (_cache[18] = ($event) => unref(confirmEditTag)(true))
752
- }, {
753
- default: withCtx(() => [
754
- createTextVNode(toDisplayString(unref(t)("tvp.tvpSearchbox.confirm")), 1)
755
- ]),
756
- _: 1
757
- })
758
- ])
759
- ], 64)) : (openBlock(), createElementBlock("div", _hoisted_22, [
760
- renderSlot(_ctx.$slots, `${state.prevItem.slotName}-edit`, mergeProps({
761
- showDropdown: () => unref(showPopover)(state),
762
- onConfirm: unref(handleEditConfirm)
763
- }, {
764
- onClick: _cache[19] || (_cache[19] = withModifiers(() => {
765
- }, ["stop"]))
766
- }))
767
- ]))
768
- ]),
769
- _: 3
770
- }, 8, ["modelValue"])) : createCommentVNode("", true)
771
- ]),
772
- _: 3
773
- }, 8, ["model", "rules", "validate-type", "size"])
774
- ], 2);
775
- };
776
- }
777
- });
778
- export {
779
- _sfc_main as default
780
- };