@opentiny/vue-search-box 2.27.0 → 2.27.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/es/index.es.js DELETED
@@ -1,2772 +0,0 @@
1
- import { defineComponent as X, $prefix as pe, $props as J, setup as ue } from "@opentiny/vue-common";
2
- import Pe from "@opentiny/vue-tag";
3
- import _e from "@opentiny/vue-input";
4
- import Oe from "@opentiny/vue-dropdown";
5
- import Fe from "@opentiny/vue-dropdown-menu";
6
- import ye from "@opentiny/vue-button";
7
- import Ae from "@opentiny/vue-tooltip";
8
- import xe from "@opentiny/vue-date-picker";
9
- import Be from "@opentiny/vue-form";
10
- import we from "@opentiny/vue-form-item";
11
- import ze from "@opentiny/vue-popover";
12
- import je from "@opentiny/vue-select";
13
- import He from "@opentiny/vue-option";
14
- import { iconSearch as Ge, iconClose as Ke, iconHelpQuery as Ue } from "@opentiny/vue-icon";
15
- import Ie from "@opentiny/vue-dropdown-item";
16
- import qe from "@opentiny/vue-checkbox";
17
- import Ze from "@opentiny/vue-checkbox-group";
18
- import Ye from "@opentiny/vue-loading";
19
- const We = (a, e, t, s = "0") => {
20
- if (typeof a == "string" && typeof s == "string" && ke(e)) {
21
- let n = a.length - e;
22
- if (n > 0)
23
- return t ? a.substr(0, e) : a.substr(n, e);
24
- {
25
- const r = [];
26
- for (n = Math.abs(n) / s.length; n > 0; n--)
27
- r.push(s);
28
- const p = r.join("");
29
- return t ? a + p : p + a;
30
- }
31
- }
32
- }, Qe = Object.prototype.toString, Xe = Object.prototype.hasOwnProperty, Je = Xe.toString;
33
- Je.call(Object);
34
- const et = {
35
- "[object Error]": "error",
36
- "[object Object]": "object",
37
- "[object RegExp]": "regExp",
38
- "[object Date]": "date",
39
- "[object Array]": "array",
40
- "[object Function]": "function",
41
- "[object AsyncFunction]": "asyncFunction",
42
- "[object String]": "string",
43
- "[object Number]": "number",
44
- "[object Boolean]": "boolean"
45
- }, tt = (a) => a == null, at = (a) => tt(a) ? String(a) : et[Qe.call(a)] || "object", ke = (a) => typeof a == "number" && isFinite(a), nt = (a) => at(a) === "date", Ce = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], st = new RegExp(
46
- "^(\\d{4})(/|-)(((0)?[1-9])|(1[0-2]))((/|-)(((0)?[1-9])|([1-2][0-9])|(3[0-1])))?( ((0)?[0-9]|1[0-9]|20|21|22|23):([0-5]?[0-9])((:([0-5]?[0-9]))?(.([0-9]{1,6}))?)?)?$"
47
- ), rt = new RegExp(
48
- "^(((0)?[1-9])|(1[0-2]))(/|-)(((0)?[1-9])|([1-2][0-9])|(3[0-1]))?(/|-)?(\\d{4})( ((0)?[0-9]|1[0-9]|20|21|22|23):([0-5]?[0-9])((:([0-5]?[0-9]))?(.([0-9]{1,6}))?)?)?$"
49
- ), ot = new RegExp(
50
- "^(\\d{4})-(((0)?[1-9])|(1[0-2]))-(((0)?[1-9])|([1-2][0-9])|(3[0-1]))T(((0)?[0-9]|1[0-9]|20|21|22|23):([0-5]?[0-9])((:([0-5]?[0-9]))?(.([0-9]{1,6}))?)?)?(Z|([+-])((0)?[0-9]|1[0-9]|20|21|22|23):?([0-5]?[0-9]))$"
51
- ), lt = {
52
- "y{1,4}": /y{1,4}/,
53
- "M{1,2}": /M{1,2}/,
54
- "d{1,2}": /d{1,2}/,
55
- "h{1,2}": /h{1,2}/,
56
- "H{1,2}": /H{1,2}/,
57
- "m{1,2}": /m{1,2}/,
58
- "s{1,2}": /s{1,2}/,
59
- "S{1,3}": /S{1,3}/,
60
- "Z{1,1}": /Z{1,1}/
61
- }, z = {
62
- YEAR: 9999,
63
- MONTH: 11,
64
- DATE: 31,
65
- HOUR: 23,
66
- MINUTE: 59,
67
- SECOND: 59,
68
- MILLISECOND: 999
69
- }, it = "-12:00,-11:00,-10:00,-09:30,-08:00,-07:00,-06:00,-05:00,-04:30,-04:00,-03:30,-02:00,-01:00", ct = "-00:00,+00:00,+01:00,+02:00,+03:00,+03:30,+04:00,+04:30,+05:00,+05:30,+05:45,+06:00", pt = "+06:30,+07:00,+08:00,+09:00,+10:00,+10:30,+11:00,+11:30,+12:00,+12:45,+13:00,+14:00", ut = [].concat(it.split(","), ct.split(","), pt.split(",")), dt = (a) => {
70
- const e = 0 - a.getTimezoneOffset() / 60;
71
- let t;
72
- return e === 0 ? t = "Z" : e > 0 ? t = "+" + (e > 10 ? e : "0" + e) + "00" : t = (e < -10 ? e : "-0" + -e) + "00", t;
73
- }, Ve = (a) => a % 400 === 0 || a % 4 === 0 && a % 100 !== 0, Te = (a) => a > z.MILLISECOND ? Number(String(a).substring(0, 3)) : a, de = ({ year: a, month: e, date: t, hours: s, minutes: n, seconds: r, milliseconds: p }) => {
74
- let c = Ce[e];
75
- if (Ve(a) && e === 1 && (c += 1), t <= c)
76
- return new Date(a, e, t, s, n, r, Te(p));
77
- }, mt = (a) => {
78
- if (a.length === 23) {
79
- const e = Number(a[1]), t = a[3] - 1, s = Number(a[9] || 1), n = a[15] || 0, r = a[17] || 0, p = a[20] || 0, c = a[22] || 0;
80
- return de({
81
- date: s,
82
- year: e,
83
- hours: n,
84
- month: t,
85
- seconds: p,
86
- minutes: r,
87
- milliseconds: c
88
- });
89
- }
90
- }, ft = (a) => {
91
- if (a.length === 22) {
92
- const e = Number(a[12]), t = a[1] - 1, s = Number(a[6] || 1), n = a[14] || 0, r = a[16] || 0, p = a[19] || 0, c = a[21] || 0;
93
- return de({
94
- year: e,
95
- month: t,
96
- date: s,
97
- hours: n,
98
- minutes: r,
99
- seconds: p,
100
- milliseconds: c
101
- });
102
- }
103
- }, ht = (a) => {
104
- if (a.length !== 25)
105
- return;
106
- const e = Number(a[1]), t = a[2] - 1, s = Number(a[6]), n = new Date(e, t, s).getTimezoneOffset(), r = a[12] || 0, p = a[14] || 0, c = a[17] || 0, i = a[19] || 0;
107
- let m = a[20];
108
- const u = a[21], o = a[22] || 0, l = a[24] || 0;
109
- let f = Ce[t], d, v;
110
- if (Ve(e) && t === 1 && (f += 1), s <= f) {
111
- if (m === "Z")
112
- d = r - n / 60, v = p;
113
- else {
114
- if (m.includes(":") || (m = m.substr(0, 3) + ":" + m.substr(3)), !ut.includes(m))
115
- return;
116
- d = u === "+" ? r - o - n / 60 : Number(r) + Number(o) - n / 60, v = u === "+" ? p - l : Number(p) + Number(l);
117
- }
118
- return new Date(e, t, s, d, v, c, Te(i));
119
- }
120
- }, re = [
121
- [st, mt],
122
- [rt, ft],
123
- [ot, ht]
124
- ], vt = (a) => {
125
- for (let e = 0, t = re.length; e < t; e++) {
126
- const s = re[e][0].exec(a);
127
- if (s && s.length > 0)
128
- return re[e][1](s);
129
- }
130
- }, bt = (a, e, t) => {
131
- if (t)
132
- switch (t) {
133
- case "yyyy":
134
- case "yy":
135
- a[0] = e;
136
- break;
137
- case "M":
138
- case "MM":
139
- a[1] = e - 1;
140
- break;
141
- case "d":
142
- case "dd":
143
- a[2] = e;
144
- break;
145
- case "h":
146
- case "hh":
147
- a[3] = e;
148
- break;
149
- case "m":
150
- case "mm":
151
- a[4] = e;
152
- break;
153
- case "s":
154
- case "ss":
155
- a[5] = e;
156
- break;
157
- case "S":
158
- case "SS":
159
- case "SSS":
160
- a[6] = e;
161
- break;
162
- }
163
- }, gt = (a, e) => {
164
- const t = [0, -1, 0, 0, 0, 0];
165
- if (a.length !== e.length)
166
- return t;
167
- let s = 0, n = 0;
168
- for (let r = 0, p = a.length; r < p; r++) {
169
- const c = a.substr(r, 1), i = isNaN(Number(c)) || c.trim() === "";
170
- if (i && c === e.substr(r, 1) || r === p - 1) {
171
- let m, u;
172
- if (i) {
173
- m = a.substring(s, r), s = r + 1;
174
- const o = e.indexOf(c, n);
175
- u = e.substring(n, o === -1 ? e.length : o), n = o + 1;
176
- } else
177
- m = a.substring(s, p), u = e.substring(n, p);
178
- (m.length === u.length || m) && bt(t, m, u);
179
- }
180
- }
181
- return t;
182
- }, U = (a, e, t) => isNaN(a) || a < e || a > t, _t = ({ year: a, month: e, date: t, hours: s, minutes: n, seconds: r, milliseconds: p }) => U(a, 0, z.YEAR) || U(e, 0, z.MONTH) || U(t, 0, z.DATE) || U(s, 0, z.HOUR) || U(n, 0, z.MINUTE) || U(r, 0, z.SECOND) || U(p, 0, z.MILLISECOND), yt = (a, e) => {
183
- if (typeof e == "string") {
184
- const t = gt(a, e), s = Number(t[0]), n = Number(t[1]), r = Number(t[2] || 1), p = Number(t[3] || 0), c = Number(t[4] || 0), i = Number(t[5] || 0), m = Number(t[6] || 0);
185
- return _t({
186
- year: s,
187
- month: n,
188
- date: r,
189
- hours: p,
190
- minutes: c,
191
- seconds: i,
192
- milliseconds: m
193
- }) ? void 0 : de({
194
- year: s,
195
- date: r,
196
- month: n,
197
- minutes: c,
198
- hours: p,
199
- milliseconds: m,
200
- seconds: i
201
- });
202
- } else
203
- return vt(a);
204
- }, Se = (a, e, t) => {
205
- let s;
206
- if (ke(a) ? s = new Date(a) : typeof a == "string" && (s = yt(a, e)), t) {
207
- const n = t && Se(t) || new Date(1, 1, 1, 0, 0, 0);
208
- return s && s < n ? n : s;
209
- }
210
- return s;
211
- }, le = function(a, e = "yyyy/MM/dd hh:mm:ss") {
212
- if (nt(a)) {
213
- if (typeof e == "string") {
214
- const t = {
215
- "y{1,4}": a.getFullYear(),
216
- "M{1,2}": a.getMonth() + 1,
217
- "d{1,2}": a.getDate(),
218
- "h{1,2}": a.getHours(),
219
- "H{1,2}": a.getHours(),
220
- "m{1,2}": a.getMinutes(),
221
- "s{1,2}": a.getSeconds(),
222
- "S{1,3}": a.getMilliseconds(),
223
- "Z{1,1}": dt(a)
224
- };
225
- return Object.keys(t).forEach((s) => {
226
- const n = e.match(lt[s]);
227
- s && n && n.length && (e = e.replace(n[0], s === "Z{1,1}" ? t[s] : We(t[s].toString(), n[0].length)));
228
- }), e;
229
- }
230
- } else if (typeof a == "string" && arguments.length >= 2) {
231
- let t = e;
232
- arguments.length === 2 ? e = void 0 : t = arguments[2];
233
- const s = Se(a, e);
234
- return s ? le(s, t) : "";
235
- }
236
- }, C = (a, e = !0) => {
237
- e ? a.visibleTimer = setTimeout(() => {
238
- a.visible = !0;
239
- }, 0) : (clearTimeout(a.visibleTimer), a.visibleTimer = null, a.visible = !1);
240
- }, Q = (a, e = !0) => {
241
- if (!a.instance)
242
- return;
243
- a.popoverVisible = e;
244
- const { dropdownRef: t } = a.instance;
245
- e && t.state.visible && (clearTimeout(Number(t.state.timeout)), t.state.timeout = null, t.state.visible = !1);
246
- }, xt = (a, e = 200) => {
247
- let t = null;
248
- const s = function(...n) {
249
- t && clearTimeout(t), t = setTimeout(() => {
250
- a.apply(this, n), t = null;
251
- }, e);
252
- };
253
- return s.cancel = () => {
254
- t && (clearTimeout(t), t = null);
255
- }, s;
256
- }, A = (a) => parseFloat(a).toString() !== "NaN", j = (a) => {
257
- const e = Array.isArray(a) ? [] : {};
258
- if (a && typeof a == "object") {
259
- const t = Object.keys(a);
260
- if (t.length)
261
- t.forEach((s) => {
262
- a[s] && typeof a[s] == "object" ? e[s] = j(a[s]) : e[s] = a[s];
263
- });
264
- else
265
- return a;
266
- }
267
- return e;
268
- }, ee = (a, e = ["mergeTag", "options", "idMapKey"]) => {
269
- const t = { ...a };
270
- return e.forEach((s) => {
271
- delete t[s];
272
- }), t;
273
- }, P = (a, e, t = "") => {
274
- const { valueMap: s, prevItem: n } = a, r = (n.label || t) + e;
275
- return s.has(r);
276
- }, te = (a) => {
277
- a.propItem = {}, a.inputValue = "";
278
- }, R = ({ emit: a, state: e, nextTick: t, ...s }) => {
279
- Q(e, !1);
280
- const { tagList: n = null, index: r = -1, newTag: p = null, newValue: c = null, oldValue: i = null, isEdit: m } = s;
281
- if (m || te(e), !n && r === -1 && !c)
282
- return;
283
- const u = i || j(e.innerModelValue);
284
- let o = [];
285
- c ? o = [...c] : r !== -1 ? (o = [...e.innerModelValue], p ? o.splice(r, 1, p) : o.splice(r, 1)) : o = [...e.innerModelValue, ...n], e.innerModelValue = o, a("update:modelValue", j(o)), a("change", j(o), u);
286
- }, H = (a) => a, G = (a, e, t) => {
287
- const s = e.idMapKey || a.idMapKey;
288
- return t && t[s] !== void 0 ? { [s]: t[s] } : null;
289
- };
290
- function wt({ props: a, state: e, emit: t, nextTick: s }) {
291
- let n = j(e.inputValue);
292
- const r = (m) => {
293
- if (m) {
294
- const u = e.recordItems.find((o) => o.label === m.label);
295
- if (u && u.options) {
296
- const o = u.options.find((l) => l.label === m.value);
297
- o && (o.isChecked = !1);
298
- }
299
- }
300
- };
301
- return {
302
- deleteTag: (m) => {
303
- C(e, !1), r(m);
304
- const u = a.modelValue.filter((o) => o !== m);
305
- R({ emit: t, state: e, nextTick: s, newValue: u });
306
- },
307
- clearTag: () => {
308
- C(e, !1), a.modelValue.forEach((m) => r(m)), e.propItem = {}, e.inputValue = "", R({ emit: t, state: e, nextTick: s, newValue: [] }), t("clear");
309
- },
310
- backspaceDeleteTag: () => {
311
- var m, u, o;
312
- if (!e.inputValue) {
313
- if (e.propItem.label) {
314
- e.propItem = {};
315
- return;
316
- }
317
- if (n === "" && e.inputValue === "") {
318
- C(e, !1);
319
- const l = a.modelValue.length - 1;
320
- r(a.modelValue[l]);
321
- const f = e.innerModelValue.slice(0, a.modelValue.length - 1);
322
- R({ emit: t, state: e, nextTick: s, newValue: f });
323
- }
324
- n = e.inputValue, (o = (u = (m = e == null ? void 0 : e.instance) == null ? void 0 : m.refs) == null ? void 0 : u.inputRef) != null && o.$el && e.instance.refs.inputRef.$el.click();
325
- }
326
- }
327
- };
328
- }
329
- const It = async (a, e, t) => {
330
- const { prevItem: s, inputEditValue: n } = e, { operators: r } = s, p = ee(s);
331
- let c = null, i = !0;
332
- if (await a.$refs.formRef.validateField(["inputEditValue"], (m) => {
333
- m && (i = !1);
334
- }), i) {
335
- let m = null;
336
- const u = e.operatorValue && r ? { operator: e.operatorValue } : null;
337
- let o = n;
338
- const l = {};
339
- if (Array.isArray(n))
340
- l.options = [], o = "", n.forEach((f) => {
341
- const d = e.currentEditValue.find((h) => h.label === f), v = (d == null ? void 0 : d.label) || f;
342
- if (o = o ? `${o} | ${v}` : v, d) {
343
- const h = G(t, s, d);
344
- l.options.push({ label: v, ...h });
345
- } else
346
- l.options.push({ label: v });
347
- });
348
- else if (Array.isArray(e.currentEditValue)) {
349
- const f = e.currentEditValue.find((d) => d.label === o);
350
- m = G(t, s, f);
351
- }
352
- c = H({ ...p, label: e.selectValue, ...u, value: o, ...m, ...l });
353
- }
354
- return c;
355
- }, De = async (a, e, t) => {
356
- const { prevItem: s } = e, n = `min${s.field}`, r = `max${s.field}`, p = e[n], c = e[r], i = [n, r];
357
- let m = !0, u = null;
358
- if (await a.$refs.formRef.validateField(i, (o) => {
359
- o && (m = !1);
360
- }), m) {
361
- const { field: o, label: l, unit: f, type: d, operators: v } = s, h = f ? `${l}(${f})` : l;
362
- let b = "";
363
- p && c ? b = `${p}-${c}` : b = p ? `≥${p}` : `≤${c}`;
364
- const w = G(t, s, s), k = e.operatorValue && v ? { operator: e.operatorValue } : null;
365
- u = H({ type: d, field: o, label: h, value: b, ...w, start: p, end: c, ...k });
366
- }
367
- return u;
368
- }, ie = async (a, e, t, s) => {
369
- const { prevItem: n, startDate: r, endDate: p, startDateTime: c, endDateTime: i } = e;
370
- let m = null, u = null, o = !0, l = null, f = null;
371
- if (s ? (m = c, u = i, f = ["startDateTime", "endDateTime"]) : (m = r, u = p, f = ["startDate", "endDate"]), await a.$refs.formRef.validateField(f, (d) => {
372
- d && (o = !1);
373
- }), o) {
374
- const { operators: d } = n, v = ee(n);
375
- let h = "";
376
- if (m && u) {
377
- if (m > u)
378
- return;
379
- m === u ? h = m : h = `${m}-${u}`;
380
- } else
381
- h = m ? `≥${m}` : `≤${u}`;
382
- const b = G(t, n, n), w = e.operatorValue && d ? { operator: e.operatorValue } : null;
383
- l = H({ ...v, value: h, start: m, end: u, ...b, ...w });
384
- }
385
- return l;
386
- }, Me = (a, e, t) => {
387
- const { prevItem: s } = a, { field: n, start: r, end: p, min: c = s.min, max: i = s.max } = e, m = `min${n}`, u = `max${n}`;
388
- (a.curMinNumVar !== m || a.curMaxNumVar !== u) && (delete a[a.curMinNumVar], delete a[a.curMaxNumVar], delete a.formRules[a.curMinNumVar], delete a.formRules[a.curMaxNumVar], a.curMinNumVar = m, a.curMaxNumVar = u), a[a.curMinNumVar] = r, a[a.curMaxNumVar] = p;
389
- const { curMinNumVar: o, curMaxNumVar: l } = a, f = A(c), d = A(i);
390
- f || d ? (a.formRules[o] = {
391
- validator: (v, h, b) => {
392
- const w = A(h);
393
- !w && A(a[l]) || w && (f && !d && h >= c || !f && d && h <= i || h >= c && h <= i) ? b() : (a.numberShowMessage = !!(h || a[l]), b(new Error(t("tvp.tvpSearchbox.rangeMinErr", [c, i]))));
394
- }
395
- }, a.formRules[l] = {
396
- validator: (v, h, b) => {
397
- const w = A(a[o]), k = w && c < a[o] ? Number(a[o]) : c, g = A(k), _ = A(h);
398
- !_ && w || _ && (g && !d && h >= k || !g && d && h <= i || h >= k && h <= i) ? b() : b(!_ && !w ? new Error(t("tvp.tvpSearchbox.rangeNumberTitle")) : new Error(t("tvp.tvpSearchbox.rangeMaxErr")));
399
- }
400
- }) : a.formRules[l] = {
401
- validator: (v, h, b) => {
402
- const w = a[o], k = A(h), g = A(w);
403
- k && !g || !k && g || k && g && h >= Number(w) ? b() : b(!k && !g ? new Error(t("tvp.tvpSearchbox.rangeNumberTitle")) : new Error(t("tvp.tvpSearchbox.rangeMaxErr")));
404
- }
405
- };
406
- };
407
- function kt({ props: a, emit: e, state: t, t: s, format: n, nextTick: r, vm: p, cancelHandleInput: c }) {
408
- const i = p || t.instance, m = (g) => {
409
- var x, T, M;
410
- const { start: _, end: y, type: I } = g;
411
- if (t.backupList = g.options, I === "numRange")
412
- Me(t, g, s);
413
- else if (I === "dateRange") {
414
- const { dateRangeFormat: V } = t;
415
- if (!t.startDate && _) {
416
- const S = n(_, V);
417
- t.startDate = t.endDate < S ? null : S;
418
- }
419
- if (!t.endDate && y) {
420
- const S = n(y, V);
421
- t.endDate = S < t.startDate ? null : S;
422
- }
423
- } else if (I === "datetimeRange") {
424
- const { datetimeRangeFormat: V } = t;
425
- if (!t.startDateTime && _) {
426
- const S = n(_, V);
427
- t.startDateTime = t.endDateTime < S ? null : S;
428
- }
429
- if (!t.endDateTime && y) {
430
- const S = n(y, V);
431
- t.endDateTime = S < t.startDateTime ? null : S;
432
- }
433
- } else
434
- t.backupList && I === "checkbox" && (t.filterList = t.backupList, t.checkboxGroup = [], (x = t.backupList) == null || x.forEach((V) => {
435
- P(t, V.label) && t.checkboxGroup.push(`${g.label}${V.label}`), V.isFilter = !1;
436
- }));
437
- I !== "checkbox" && ((T = t.backupList) != null && T.length) && ((M = t.backupList) == null || M.forEach((V) => {
438
- V.isFilter = !1, V.isChecked = P(t, V.label);
439
- })), t.currentOperators = null, !t.backupList && !["dateRange", "datetimeRange", "numRange", "custom"].includes(I) ? C(t, !1) : C(t);
440
- }, u = (g) => {
441
- var T;
442
- const { field: _, label: y } = g;
443
- t.propItem = { ...t.propItem, label: y }, e("first-level-select", _);
444
- const I = (T = i.$refs) == null ? void 0 : T.inputRef;
445
- t.prevItem = g, t.backupPrevItem = g;
446
- const { operators: x } = g;
447
- x != null && x.length ? (t.operatorValue = "", t.currentOperators = x, C(t)) : (t.operatorValue = ":", m(g)), t.inputValue = "", I.focus();
448
- }, o = (g) => {
449
- t.operatorValue = g, m(t.prevItem);
450
- }, l = (g, _, y, I) => {
451
- const { replace: x, operators: T, mergeTag: M } = g, V = ee(g), { indexMap: S } = t, D = S.get(y), L = G(a, g, _), B = t.operatorValue && T ? { operator: t.operatorValue } : null;
452
- let F = null;
453
- if (M) {
454
- const K = { label: I, ...L };
455
- if (D >= 0) {
456
- const ae = `${t.innerModelValue[D].value} | ${I}`, ne = [...t.innerModelValue[D].options, K];
457
- F = H({ ...t.innerModelValue[D], value: ae, options: ne });
458
- } else
459
- F = H({ ...V, label: y, value: I, options: [K] });
460
- } else
461
- F = H({ ...V, label: y, value: I, ...L, ...B });
462
- if (P(t, I, y)) {
463
- te(t);
464
- return;
465
- }
466
- C(t, !1);
467
- const $ = j(t.innerModelValue);
468
- let O = [];
469
- if ((x || M) && D >= 0) {
470
- const K = [...t.innerModelValue];
471
- K.splice(D, 1), O = [...K, F];
472
- } else
473
- O = [...t.innerModelValue, F];
474
- R({ emit: e, state: t, newValue: O, oldValue: $ });
475
- }, f = (g) => {
476
- var _;
477
- (_ = t.propItem) != null && _.label ? d({ label: g }) : w();
478
- }, d = (g, _ = !1) => {
479
- var T;
480
- C(t, !1), _ && (t.prevItem = g, t.backupPrevItem = g);
481
- const { prevItem: y } = t, I = g.value || g.label, x = (T = i.$refs) == null ? void 0 : T.inputRef;
482
- if (!P(t, I)) {
483
- const M = t.propItem.label || g.label;
484
- l(y, g, M, I);
485
- }
486
- x.focus();
487
- }, v = (g, _) => {
488
- if (g.label) {
489
- if (!_.options)
490
- return;
491
- if (!a.modelValue.find((I) => I.value === _.options[0].label)) {
492
- const I = _.label, x = _.options && _.options[0].label;
493
- l(_, _.options[0], I, x);
494
- return;
495
- }
496
- } else
497
- e("search", t.innerModelValue);
498
- }, h = (g, _, y) => {
499
- var x;
500
- const I = (x = t.backupList) == null ? void 0 : x.find((T) => T.label === y);
501
- l(g, I, _.label, y);
502
- }, b = (g, _, y) => {
503
- var I, x;
504
- if (_.label) {
505
- const { regexp: T, replace: M, type: V, mergeTag: S } = y, D = V !== "checkbox" && M || V === "checkbox" && S ? [g] : g.split(a.splitInputValue);
506
- if (T)
507
- for (const L of D)
508
- T.test(L) && h(y, _, L);
509
- else
510
- for (const L of D)
511
- h(y, _, L);
512
- } else {
513
- const { items: T, defaultField: M } = a, V = T.find(($) => {
514
- const { regexp: O } = $;
515
- return O && O.test(t.inputValue);
516
- }) || (M ? T.find(($) => $.field === M) : t.allTypeAttri), { replace: S, type: D, mergeTag: L } = V, B = D !== "checkbox" && S || D === "checkbox" && L ? [g] : g.split(a.splitInputValue);
517
- (I = V == null ? void 0 : V.options) != null && I.length && (t.backupList = [...V.options], (x = t.backupList) == null || x.forEach(($) => {
518
- const O = $.value || $.label;
519
- B.includes(O) && ($.isChecked = !0);
520
- }));
521
- const F = V.label;
522
- for (const $ of B)
523
- l(V, {}, F, $);
524
- }
525
- }, w = () => {
526
- const { inputValue: g, propItem: _, prevItem: y } = t;
527
- if (c && c(), C(t, !1), !g)
528
- v(_, y);
529
- else {
530
- const { maxlength: I } = a;
531
- if (I && I < g.length) {
532
- e("exceed", I);
533
- return;
534
- }
535
- b(g, _, y);
536
- }
537
- };
538
- return { selectPropItem: u, selectRadioItem: d, selectInputValue: f, createTag: w, helpClick: () => {
539
- e("help");
540
- }, setOperator: o };
541
- }
542
- const Ct = (a) => a.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), oe = (a, e) => {
543
- const t = [];
544
- let s = 0, n;
545
- for (; (n = a.exec(e)) !== null; ) {
546
- const r = n.index, p = a.lastIndex;
547
- r > s && t.push(e.slice(s, r)), t.push(e.slice(r, p)), s = p;
548
- }
549
- return s < e.length && t.push(e.slice(s)), t;
550
- };
551
- function Vt({ props: a, state: e, emit: t, nextTick: s }) {
552
- const n = async (u) => {
553
- e.potentialOptions = await a.potentialOptions.getMatchList(u), C(e, !0);
554
- }, p = xt((u) => {
555
- var _, y, I;
556
- const { recordItems: o, propItem: l } = e, f = typeof u == "string" ? u : u && u.target && typeof u.target.value == "string" ? u.target.value : e.inputValue || "", d = String(f).trim(), { maxlength: v } = a;
557
- if (v && v < d.length) {
558
- t("exceed", v);
559
- return;
560
- }
561
- if (d.length === 0) {
562
- C(e);
563
- return;
564
- }
565
- Object.keys(e.matchItems).forEach((x) => {
566
- e.matchItems[x].attr = [], e.matchItems[x].attrValue = [];
567
- });
568
- const h = Ct(d), b = new RegExp(h, "i"), w = l.label || !h ? null : o.find((x) => x.type === "map" && b.test(x.label));
569
- if (w) {
570
- e.propItem = { ...e.propItem, label: w.label }, e.inputValue = "", e.prevItem = w, e.backupPrevItem = w, e.backupList = w.options || [];
571
- return;
572
- }
573
- e.filterList = (_ = e.backupList) == null ? void 0 : _.filter((x) => b.test(x.label) ? (delete x.isFilter, P(e, x.label) && e.checkboxGroup.push(`${e.prevItem.label}${x.label}`), !0) : (x.isFilter = !0, !1));
574
- const k = new RegExp(h, "ig"), g = d.toLowerCase();
575
- if (e.propItem.label) {
576
- (y = e.backupList) == null || y.forEach((x) => {
577
- x.hightlighStr = g;
578
- const T = x.label;
579
- b.test(T) ? (x.match = oe(k, T), x.isFilter = !1) : x.isFilter = !0;
580
- }), (I = e.backupList) != null && I.length || d ? C(e) : C(e, !1);
581
- return;
582
- }
583
- for (const x of o) {
584
- const { options: T = [], groupKey: M = "0", ...V } = x, S = V.label;
585
- if (b.test(S)) {
586
- const D = oe(k, S);
587
- e.matchItems[M].attr.push({ ...x, match: D, hightlighStr: g });
588
- }
589
- for (const D of T) {
590
- const L = e.propItem.label ? S : `${S}:${D.label}`;
591
- if (b.test(L)) {
592
- const B = oe(k, L);
593
- e.matchItems[M].attrValue.push({
594
- ...D,
595
- ...V,
596
- options: T,
597
- hightlighStr: g,
598
- value: D.label,
599
- match: B
600
- });
601
- }
602
- }
603
- }
604
- h && a.potentialOptions && a.potentialOptions.getMatchList ? n(h) : C(e);
605
- }, 500), c = () => {
606
- p.cancel && p.cancel();
607
- }, i = () => {
608
- var u;
609
- (u = e.backupList) == null || u.forEach((o) => o.isFilter && delete o.isFilter);
610
- };
611
- return {
612
- handleInput: p,
613
- selectFirstMap: (u, o) => {
614
- var v;
615
- const { options: l } = u, { prevItem: f, propItem: d } = e;
616
- if (l)
617
- C(e, !1), e.propItem = { ...e.propItem, value: `${u.label}=` }, e.isShowTagKey = !1, e.inputValue = "", e.backupList = u.options || [], i(), (v = e.backupList) == null || v.forEach((h) => {
618
- const b = d.value + h.label;
619
- h.isChecked = P(e, b);
620
- });
621
- else {
622
- if (u.isChecked)
623
- return;
624
- C(e, !1), e.isShowTagKey = !0, i();
625
- const { field: h, type: b } = f, w = d.value + u.label, k = G(a, f, u), _ = [H({ type: b, field: h, label: d.label, value: w, ...k })];
626
- R({ emit: t, state: e, nextTick: s, tagList: _ });
627
- }
628
- o && C(e);
629
- },
630
- cancelHandleInput: c
631
- };
632
- }
633
- function Tt({ props: a, state: e, emit: t, nextTick: s }) {
634
- return {
635
- selectCheckbox: (r) => {
636
- var u, o;
637
- C(e, !1);
638
- const { checkboxGroup: p, prevItem: c, propItem: i } = e, m = ee(c);
639
- if (r) {
640
- const l = [], f = j(e.innerModelValue), { mergeTag: d, operators: v, label: h } = c;
641
- if (d) {
642
- let b = "";
643
- const w = [], { indexMap: k } = e, g = k.get(h);
644
- if (g !== void 0 && e.innerModelValue.splice(g, 1), (u = e.backupList) == null || u.forEach((_) => {
645
- const { label: y } = _, I = `${h}${y}`;
646
- if (p.includes(I)) {
647
- delete _.isFilter;
648
- const T = G(a, c, _), M = { label: _.label, ...T };
649
- b += b ? ` | ${y}` : y, w.push(M);
650
- }
651
- }), w.length > 0) {
652
- const _ = { ...m, value: b, options: w };
653
- l.push(_);
654
- }
655
- } else {
656
- const { valueMap: b } = e, w = [];
657
- if ((o = e.backupList) == null || o.forEach((k) => {
658
- const { label: g } = k, _ = `${h}${g}`, y = p.includes(_);
659
- if (y && !P(e, g)) {
660
- const I = G(a, c, k), x = e.operatorValue && v ? { operator: e.operatorValue } : null, T = H({ ...m, label: i.label, value: g, ...I, ...x });
661
- l.push(T), k.isChecked = !0;
662
- } else if (!y && P(e, g)) {
663
- k.isChecked = !1;
664
- const I = b.get(_);
665
- w.push(I);
666
- }
667
- }), w.length) {
668
- const k = e.innerModelValue.filter((g, _) => g && !w.includes(_));
669
- R({ emit: t, state: e, nextTick: s, newValue: k, oldValue: f });
670
- return;
671
- }
672
- }
673
- R({ emit: t, state: e, nextTick: s, tagList: l, oldValue: f });
674
- } else
675
- e.propItem = { ...i, label: "" }, e.inputValue = "";
676
- }
677
- };
678
- }
679
- function St({ props: a, state: e, emit: t, nextTick: s, vm: n }) {
680
- const r = n || e.instance;
681
- return {
682
- onConfirmDate: async (m, u = !1) => {
683
- if (!m) {
684
- e.propItem = { label: "" };
685
- return;
686
- }
687
- const o = await ie(r, e, a, u);
688
- if (o) {
689
- C(e, !1);
690
- const l = a.modelValue.filter((f) => f.type !== o.type || f.field !== o.field);
691
- l.push(o), R({ emit: t, state: e, nextTick: s, newValue: l });
692
- } else
693
- C(e);
694
- },
695
- handleDateShow: () => C(e),
696
- pickerOptions: (m, u = "") => ({
697
- disabledDate(o) {
698
- const { maxTimeLength: l = 0, min: f, max: d } = e.prevItem, v = e[u], h = o.getTime();
699
- if (l > 0)
700
- if (f || d)
701
- if (u && v) {
702
- const b = new Date(v).getTime(), w = !f && d ? b - l : Math.max(f.getTime(), b - l);
703
- return h < w || h > b;
704
- } else if (!u && m) {
705
- const b = new Date(m).getTime(), w = f && !d ? b + l : Math.min(d.getTime(), b + l);
706
- return h < b || h > w;
707
- } else
708
- return f && h < f.getTime() || d && h > d.getTime();
709
- else if (u && v) {
710
- const b = new Date(v).getTime(), w = b - l;
711
- return h < w || h > b;
712
- } else if (!u && m) {
713
- const b = new Date(m).getTime(), w = b + l;
714
- return h < b || h > w;
715
- } else
716
- return !1;
717
- else if (f || d)
718
- if (u && v) {
719
- const b = new Date(v).getTime();
720
- return f && h < f.getTime() || h > b;
721
- } else if (!u && m) {
722
- const b = new Date(m).getTime();
723
- return h < b || d && h > d.getTime();
724
- } else
725
- return h < f || h > d;
726
- else if (u && v) {
727
- const b = new Date(v).getTime();
728
- return h > b;
729
- } else if (!u && m) {
730
- const b = new Date(m).getTime();
731
- return h < b;
732
- } else
733
- return !1;
734
- }
735
- })
736
- };
737
- }
738
- function Dt({ props: a, state: e, t, emit: s, nextTick: n, vm: r }) {
739
- const p = r || e.instance, c = async (u) => {
740
- if (!u) {
741
- e.propItem = { ...e.propItem, label: "" };
742
- return;
743
- }
744
- const o = await De(p, e, a);
745
- if (o) {
746
- C(e, !1);
747
- const l = a.modelValue.filter((f) => f.type !== o.type || f.field !== o.field);
748
- l.push(o), R({ emit: s, state: e, nextTick: n, newValue: l });
749
- } else
750
- C(e);
751
- }, i = (u, o, l) => {
752
- const { maxTimeLength: f = 0 } = u;
753
- return {
754
- [o]: {
755
- validator: (d, v, h) => {
756
- f > 0 && !v ? h(new Error(t("tvp.tvpSearchbox.notBeNull"))) : !v && !e[l] ? h(new Error(t("tvp.tvpSearchbox.rangeDateTitle"))) : h();
757
- }
758
- },
759
- [l]: {
760
- validator: (d, v, h) => {
761
- f > 0 && !v ? h(new Error(t("tvp.tvpSearchbox.notBeNull"))) : !v && !e[o] ? h(new Error(t("tvp.tvpSearchbox.rangeDateTitle"))) : h();
762
- }
763
- }
764
- };
765
- };
766
- return {
767
- initFormRule: () => {
768
- let u = {}, o = {};
769
- a.items.forEach((l) => {
770
- l.type === "dateRange" && (u = i(l, "startDate", "endDate")), l.type === "datetimeRange" && (o = i(l, "startDateTime", "endDateTime"));
771
- }), e.formRules = {
772
- ...u,
773
- ...o
774
- }, a.editable && (e.formRules.inputEditValue = {
775
- required: !0,
776
- message: t("tvp.tvpSearchbox.notBeNull"),
777
- trigger: ["change", "blur"]
778
- });
779
- },
780
- sizeChange: c
781
- };
782
- }
783
- function Mt({ props: a, state: e, t, nextTick: s, format: n, emit: r, vm: p }) {
784
- const c = (l) => {
785
- var _;
786
- const { operator: f, value: d, start: v, end: h } = l, { options: b, operators: w, type: k, mergeTag: g } = e.prevItem;
787
- if (k !== "custom") {
788
- if (k === "numRange")
789
- Me(e, l, t);
790
- else if (k === "dateRange") {
791
- const { dateRangeFormat: y } = e;
792
- e.startDate = n(v, y), e.endDate = n(h, y);
793
- } else if (k === "datetimeRange") {
794
- const { datetimeRangeFormat: y } = e;
795
- e.startDateTime = n(v, y), e.endDateTime = n(h, y);
796
- } else {
797
- if (g) {
798
- const y = ((_ = l.options) == null ? void 0 : _.flatMap((I) => I.label)) || [];
799
- e.inputEditValue = y, e.currentEditSelectTags = y;
800
- } else
801
- e.inputEditValue = Array.isArray(d) ? d.join(",") : d || "";
802
- e.currentEditValue = b;
803
- }
804
- e.operatorValue = f, e.currentOperators = w;
805
- }
806
- };
807
- return {
808
- editTag: (l, f, d) => {
809
- if (!a.editable || l.type && l.type === "map")
810
- return;
811
- C(e, !1), e.popoverVisible = !1;
812
- const v = d.target.classList.contains("tiny-tag") ? d.target : d.srcElement.parentElement;
813
- s(() => {
814
- const { popoverRef: h } = e.instance.$refs;
815
- h.state.referenceElm = v, h.state.popperElm && (h.state.popperElm.style.display = "none"), h.doDestroy(), e.popoverVisible = !0;
816
- }), e.prevItem = e.recordItems.find((h) => h.field === l.field), !e.prevItem && (e.prevItem = l), e.selectValue = l.label, e.currentModelValueIndex = f, r("tagClick", l), c(l);
817
- },
818
- confirmEditTag: async (l) => {
819
- if (!l) {
820
- e.popoverVisible = !1;
821
- return;
822
- }
823
- const { prevItem: f, currentModelValueIndex: d } = e;
824
- let v = null;
825
- f.type === "numRange" ? v = await De(e.instance, e, a) : f.type === "dateRange" ? v = await ie(e.instance, e, a, !1) : f.type === "datetimeRange" ? v = await ie(e.instance, e, a, !0) : v = await It(e.instance, e, a), v ? (C(e, !1), e.popoverVisible = !1, R({ emit: r, state: e, nextTick: s, index: d, newTag: v, isEdit: !0 })) : e.popoverVisible = !0, e.currentEditValue = [];
826
- },
827
- selectPropChange: (l, f) => {
828
- f || (e.prevItem = l, c(l));
829
- },
830
- selectItemIsDisable: (l) => {
831
- var d, v, h, b;
832
- if (l.type && l.type === "map")
833
- return !0;
834
- if ((d = e.prevItem) != null && d.operators || l.operators)
835
- return ((v = e.prevItem.operators) == null ? void 0 : v.length) !== ((h = l.operators) == null ? void 0 : h.length);
836
- const f = ["radio", "checkbox"];
837
- return e.prevItem.type && f.includes(e.prevItem.type) ? l.type ? !f.includes(l.type) : !1 : ((b = e.prevItem) == null ? void 0 : b.type) !== l.type;
838
- }
839
- };
840
- }
841
- function Et({ state: a, emit: e, nextTick: t }) {
842
- const s = (p) => {
843
- C(a, !1);
844
- const { prevItem: c, indexMap: i } = a, { replace: m, label: u } = c, o = [];
845
- if (m && i.has(u)) {
846
- const l = i.get(u), f = { ...c, ...p };
847
- R({ emit: e, state: a, nextTick: t, newTag: f, index: l });
848
- return;
849
- } else
850
- !m && Array.isArray(p) ? p.forEach((l) => {
851
- P(a, l.value) || o.push({ ...c, ...l });
852
- }) : P(a, p.value) || o.push({ ...c, ...p });
853
- R({ emit: e, state: a, nextTick: t, tagList: o });
854
- };
855
- return {
856
- handleConfirm: (p) => {
857
- if (!p) {
858
- te(a), C(a, !1);
859
- return;
860
- }
861
- s(p);
862
- },
863
- handleEditConfirm: (p) => {
864
- if (!p) {
865
- Q(a, !1);
866
- return;
867
- }
868
- s(p);
869
- }
870
- };
871
- }
872
- function Lt({ props: a, state: e }) {
873
- return {
874
- initItems: () => {
875
- e.groupItems = {}, e.recordItems.forEach((c) => {
876
- var m;
877
- const { groupKey: i = "0" } = c;
878
- if (e.groupItems[i] ? e.groupItems[i].push({ ...c }) : (e.groupItems[i] = [{ ...c }], e.matchItems[i] = { attr: [], attrValue: [] }), e.prevItem && c.field === e.prevItem.field && c !== e.prevItem) {
879
- const { options: u, type: o } = c;
880
- e.prevItem = c, u != null && u.length && (e.backupList = u), o === "checkbox" && (e.filterList = e.backupList, e.checkboxGroup = [], (m = e.backupList) == null || m.forEach((l) => {
881
- const { label: f } = l;
882
- P(e, f) && e.checkboxGroup.push(`${c.label}${f}`), l.isFilter = !1;
883
- })), C(e, c.field === e.prevItem.field && c !== e.prevItem);
884
- }
885
- });
886
- },
887
- watchOutsideClick: () => {
888
- a.editable && Q(e, !1), e.isMouseDown = !1, C(e, !1);
889
- },
890
- watchMouseDown: () => {
891
- e.isMouseDown = !0;
892
- },
893
- watchMouseMove: () => {
894
- e.isMouseDown && (e.isMouseDown = !1);
895
- },
896
- handleClick: (c) => {
897
- var u;
898
- const { backupPrevItem: i, prevItem: m } = e;
899
- c.stopPropagation(), a.editable && (e.popoverVisible = !1, e.currentEditValue = [], e.propItem.label && i && i !== m && (e.prevItem = i)), e.hasBackupList && (((u = e.backupList) == null ? void 0 : u.length) === 0 || !e.backupList) && !e.inputValue || a.items.length === 0 ? C(e, !1) : C(e);
900
- }
901
- };
902
- }
903
- const Ee = {
904
- tvp: {
905
- tvpSearchbox: {
906
- defaultPlaceholder: "请选择属性筛选,或输入关键字",
907
- addPlaceholder: "添加筛选条件",
908
- tagPlaceholder: "请选择标签键/值搜索,或输入“键=值”搜索",
909
- dynamicPlaceholder: "请选择{newValue}搜索",
910
- attributeType: "属性类型",
911
- propertyValue: "{0}的值",
912
- matched: "潜在匹配项",
913
- allValues: "所有值",
914
- allProperty: "全部属性",
915
- operator: "运算符",
916
- clearAll: "清空",
917
- emptyValue: "空 值",
918
- help: "点击查看帮助",
919
- switchText: "切换到默认搜索项",
920
- tagKey: "键",
921
- tagValue: "值",
922
- minValueText: "最小值",
923
- maxValueText: "最大值",
924
- rangeMinErr: "输入值必须在{0}~{1}之间",
925
- rangeMaxErr: "最大值必须大于等于最小值,或者为空",
926
- rangeNumberTitle: "请至少输入一个值",
927
- rangeDateTitle: "请至少输入一个日期",
928
- timeLengthTitle: "可选时间跨度为{value}天内",
929
- rangeBeginLabel: "开始日期",
930
- rangeEndLabel: "结束日期",
931
- rulekeyword1: "关键字",
932
- notBeNull: "值不能为空",
933
- noData: "暂无匹配数据...",
934
- selectAll: "全选",
935
- confirm: "确定",
936
- cancel: "取消",
937
- equal: "等于",
938
- notEqual: "不等于",
939
- contain: "包含",
940
- notContain: "不包含",
941
- initUse: "搜索"
942
- }
943
- }
944
- }, Le = {
945
- tvp: {
946
- tvpSearchbox: {
947
- defaultPlaceholder: "Select attribute filtering or enter keywords",
948
- addPlaceholder: "Add filtering criteria",
949
- tagPlaceholder: 'Please select tag key/value search, or enter "key=value" to search',
950
- dynamicPlaceholder: "Please select {newValue} to search",
951
- attributeType: "Attribute Type",
952
- propertyValue: "The value of {0}",
953
- matched: "Potential matching items",
954
- allValues: "All values",
955
- allProperty: "All Properties",
956
- operator: "Operator",
957
- clearAll: "Clear",
958
- emptyValue: "Empty value",
959
- help: "Click to view help",
960
- switchText: "Switch to default search terms",
961
- tagKey: "Key",
962
- tagValue: "Value",
963
- minValueText: "Minimum value",
964
- maxValueText: "Maximum value",
965
- rangeMinErr: "The input value must be between {0} and {1}",
966
- rangeMaxErr: "The maximum value must be greater than or equal to the minimum value, or empty",
967
- rangeNumberTitle: "Please enter at least one value",
968
- rangeDateTitle: "Please enter at least one date",
969
- timeLengthTitle: "The optional time span is within {value} days",
970
- rangeBeginLabel: "Start date",
971
- rangeEndLabel: "End date",
972
- rulekeyword1: "Keywords",
973
- notBeNull: "The value cannot be empty",
974
- noData: "There is currently no matching data available ..",
975
- selectAll: "Select All",
976
- confirm: "Confirm",
977
- cancel: "Cancel",
978
- equal: "Equal",
979
- notEqual: "Not equal",
980
- contain: "Contain",
981
- notContain: "Does not contain",
982
- initUse: "Search"
983
- }
984
- }
985
- }, W = "zh-CN", q = {
986
- "zh-CN": Ee,
987
- "en-US": Le
988
- };
989
- let E = null;
990
- const $t = (a) => {
991
- E = a;
992
- }, me = () => {
993
- var a, e, t, s, n;
994
- if ((t = (e = (a = E == null ? void 0 : E.config) == null ? void 0 : a.globalProperties) == null ? void 0 : e.$i18n) != null && t.locale)
995
- return E.config.globalProperties.$i18n.locale;
996
- if ((s = E == null ? void 0 : E.$i18n) != null && s.locale)
997
- return E.$i18n.locale;
998
- if (typeof navigator < "u") {
999
- const r = navigator.language || ((n = navigator.languages) == null ? void 0 : n[0]);
1000
- if (r)
1001
- return r.startsWith("zh") ? "zh-CN" : "en-US";
1002
- }
1003
- return W;
1004
- }, ce = (a) => q[a] || q[W], N = (a, e = {}) => {
1005
- var p, c;
1006
- if (!a)
1007
- return "";
1008
- if ((c = (p = E == null ? void 0 : E.config) == null ? void 0 : p.globalProperties) != null && c.$t)
1009
- try {
1010
- const i = E.config.globalProperties.$t(a, e);
1011
- if (i && i !== a)
1012
- return i;
1013
- } catch (i) {
1014
- console.warn("[TinySearchBox] i18n translation failed:", i);
1015
- }
1016
- if (E != null && E.$t)
1017
- try {
1018
- const i = E.$t(a, e);
1019
- if (i && i !== a)
1020
- return i;
1021
- } catch (i) {
1022
- console.warn("[TinySearchBox] i18n translation failed:", i);
1023
- }
1024
- const t = me(), s = ce(t), n = a.split(".");
1025
- let r = s;
1026
- for (const i of n)
1027
- if (r && typeof r == "object" && i in r)
1028
- r = r[i];
1029
- else {
1030
- if (t !== W) {
1031
- r = ce(W);
1032
- for (const u of n)
1033
- if (r && typeof r == "object" && u in r)
1034
- r = r[u];
1035
- else {
1036
- r = a;
1037
- break;
1038
- }
1039
- } else
1040
- r = a;
1041
- break;
1042
- }
1043
- return typeof r == "string" && Object.keys(e).length > 0 ? r.replace(/\{(\w+)\}/g, (i, m) => e[m] !== void 0 ? e[m] : i) : typeof r == "string" ? r : a;
1044
- }, Nt = (a, e = {}) => a.map((t) => N(t, e)), Rt = (a) => a in q, Pt = () => Object.keys(q), Ot = (a, e) => {
1045
- q[a] = e;
1046
- }, Ft = (a) => {
1047
- a !== W && delete q[a];
1048
- }, At = {
1049
- t: N,
1050
- zhCN: Ee,
1051
- enUS: Le,
1052
- tArray: Nt,
1053
- setGlobalApp: $t,
1054
- getCurrentLocale: me,
1055
- getLocaleMessages: ce,
1056
- isLocaleSupported: Rt,
1057
- getSupportedLocales: Pt,
1058
- addLocale: Ot,
1059
- removeLocale: Ft
1060
- }, Bt = [
1061
- "t",
1062
- "state",
1063
- "isShowClose",
1064
- "showHelp",
1065
- "maxlength",
1066
- "panelMaxHeight",
1067
- "editable",
1068
- "emptyPlaceholder",
1069
- "deleteTag",
1070
- "editTag",
1071
- "backspaceDeleteTag",
1072
- "createTag",
1073
- "clearTag",
1074
- "helpClick",
1075
- "handleInput",
1076
- "handleClick",
1077
- "handleEvents",
1078
- "pickerOptions",
1079
- "resetInput",
1080
- "selectItemIsDisable",
1081
- "selectPropChange",
1082
- "confirmEditTag",
1083
- "handleConfirm",
1084
- "handleEditConfirm",
1085
- "showDropdown",
1086
- "showPopover"
1087
- ], zt = ({ reactive: a, computed: e, api: t, i18n: s, watch: n, props: r, emit: p, vm: c }) => {
1088
- const i = a({
1089
- innerModelValue: [...r.modelValue],
1090
- placeholder: r.emptyPlaceholder || N("tvp.tvpSearchbox.addPlaceholder"),
1091
- emitter: p,
1092
- recordItems: [],
1093
- groupItems: {},
1094
- inputValue: "",
1095
- matchItems: {},
1096
- propItem: {},
1097
- backupList: [],
1098
- filterList: [],
1099
- checkboxGroup: [],
1100
- prevItem: {},
1101
- backupPrevItem: "",
1102
- formRules: null,
1103
- validType: "text",
1104
- numberShowMessage: !0,
1105
- startDate: null,
1106
- startDateTime: null,
1107
- endDate: null,
1108
- endDateTime: null,
1109
- isShowTagKey: !0,
1110
- potentialOptions: null,
1111
- dateRangeFormat: "yyyy/MM/dd",
1112
- datetimeRangeFormat: "yyyy/MM/dd HH:mm:ss",
1113
- indexMap: /* @__PURE__ */ new Map(),
1114
- valueMap: /* @__PURE__ */ new Map(),
1115
- popoverVisible: !1,
1116
- selectValue: "",
1117
- allTypeAttri: { label: N("tvp.tvpSearchbox.rulekeyword1"), field: "tvpKeyword", type: "radio" },
1118
- operatorValue: ":",
1119
- inputEditValue: "",
1120
- currentOperators: "",
1121
- currentEditValue: "",
1122
- currentModelValueIndex: -1,
1123
- curMinNumVar: "",
1124
- curMaxNumVar: "",
1125
- instance: null,
1126
- isMouseDown: !1,
1127
- currentEditSelectTags: [],
1128
- visible: !1,
1129
- visibleTimer: null,
1130
- hasBackupList: e(() => i.propItem.label && [void 0, "radio", "checkbox", "map"].includes(i.prevItem.type)),
1131
- isIndeterminate: e(() => i.checkboxGroup.length > 0 && i.checkboxGroup.length !== i.filterList.length),
1132
- checkAll: e({
1133
- get: () => i.checkboxGroup.length && i.checkboxGroup.length === i.filterList.length,
1134
- set: (m) => {
1135
- m ? i.checkboxGroup = i.filterList.flatMap((u) => `${i.prevItem.label}${u.label}`) : i.checkboxGroup = [];
1136
- }
1137
- })
1138
- });
1139
- return i;
1140
- }, jt = (a, { getCurrentInstance: e, onMounted: t, onBeforeUnmount: s, computed: n, reactive: r, watch: p }, { emit: c, nextTick: i, refs: m, vm: u }) => {
1141
- const o = {}, l = a.emitter ? a.emitter.emit : c, f = zt({ reactive: r, computed: n, api: o, i18n: At, watch: p, props: a, emit: l, vm: u });
1142
- return Ht({ api: o, state: f, t: N, props: a, emit: l, nextTick: i, vm: u, computed: n }), Gt({ watch: p, state: f, props: a, api: o, nextTick: i, vm: u }), f.instance = u, t(() => {
1143
- typeof document < "u" && (document.addEventListener("click", o.watchOutsideClick), document.addEventListener("mousedown", o.watchMouseDown), document.addEventListener("mousemove", o.watchMouseMove));
1144
- }), s(() => {
1145
- typeof document < "u" && (document.removeEventListener("click", o.watchOutsideClick), document.removeEventListener("mousedown", o.watchMouseDown), document.removeEventListener("mousemove", o.watchMouseMove), f.localeCheckInterval && (clearInterval(f.localeCheckInterval), f.localeCheckInterval = null));
1146
- }), o;
1147
- }, Ht = ({ api: a, state: e, t, props: s, emit: n, nextTick: r, vm: p, computed: c }) => {
1148
- const { deleteTag: i, clearTag: m, backspaceDeleteTag: u } = wt({ props: s, state: e, emit: n, nextTick: r }), { editTag: o, confirmEditTag: l, selectPropChange: f, selectItemIsDisable: d } = Mt({ props: s, state: e, t, nextTick: r, format: le, emit: n, vm: p }), { handleInput: v, selectFirstMap: h, cancelHandleInput: b } = Vt({ props: s, state: e, emit: n, nextTick: r }), { selectPropItem: w, selectRadioItem: k, selectInputValue: g, createTag: _, helpClick: y, setOperator: I } = kt({ props: s, emit: n, state: e, t, format: le, nextTick: r, vm: p, cancelHandleInput: b }), { selectCheckbox: x } = Tt({ props: s, state: e, emit: n, nextTick: r }), { onConfirmDate: T, handleDateShow: M, pickerOptions: V } = St({ props: s, state: e, emit: n, nextTick: r, vm: p }), { sizeChange: S, initFormRule: D } = Dt({ props: s, state: e, t, emit: n, nextTick: r, vm: p }), { handleConfirm: L, handleEditConfirm: B } = Et({ state: e, emit: n, nextTick: r }), { initItems: F, watchOutsideClick: $, watchMouseDown: O, watchMouseMove: K, handleClick: ae } = Lt({ props: s, state: e }), ne = c(() => s.modelValue.length || e.propItem.label || e.inputValue), $e = () => ({
1149
- selectInputValue: g,
1150
- selectPropItem: w,
1151
- selectRadioItem: k,
1152
- setOperator: I,
1153
- selectCheckbox: x,
1154
- sizeChange: S,
1155
- onConfirmDate: T,
1156
- selectFirstMap: h,
1157
- handleDateShow: M
1158
- }), se = (Z) => {
1159
- e.placeholder = Z;
1160
- };
1161
- s.modelValue.length > 0, se(t("tvp.tvpSearchbox.addPlaceholder")), Object.assign(a, {
1162
- t,
1163
- state: e,
1164
- isShowClose: ne,
1165
- deleteTag: i,
1166
- editTag: o,
1167
- backspaceDeleteTag: u,
1168
- createTag: _,
1169
- clearTag: m,
1170
- helpClick: y,
1171
- handleInput: v,
1172
- handleClick: ae,
1173
- handleEvents: (Z, Ne, Re) => {
1174
- const he = $e();
1175
- typeof he[Z] == "function" ? he[Z](Ne, Re) : console.warn(`[TinySearchBox] Unknown event: ${Z}`);
1176
- },
1177
- pickerOptions: V,
1178
- resetInput: te,
1179
- selectItemIsDisable: d,
1180
- selectPropChange: f,
1181
- confirmEditTag: l,
1182
- handleConfirm: L,
1183
- handleEditConfirm: B,
1184
- showDropdown: C,
1185
- showPopover: Q,
1186
- setPlaceholder: se,
1187
- initItems: F,
1188
- initFormRule: D,
1189
- watchOutsideClick: $,
1190
- watchMouseDown: O,
1191
- watchMouseMove: K
1192
- });
1193
- }, Gt = ({ watch: a, state: e, props: t, api: s, nextTick: n, vm: r }) => {
1194
- var u;
1195
- const p = () => {
1196
- var o;
1197
- if (e.propItem.label) {
1198
- const { placeholder: l, type: f } = e.prevItem;
1199
- l ? s.setPlaceholder(l) : f === "map" ? s.setPlaceholder(N("tvp.tvpSearchbox.tagPlaceholder")) : (o = e.backupList) != null && o.length ? s.setPlaceholder(N("tvp.tvpSearchbox.dynamicPlaceholder", { newValue: e.propItem.label })) : s.setPlaceholder(N("tvp.tvpSearchbox.addPlaceholder"));
1200
- } else
1201
- s.setPlaceholder(N("tvp.tvpSearchbox.addPlaceholder"));
1202
- }, c = () => {
1203
- var o, l, f;
1204
- return (o = r == null ? void 0 : r.$i18n) != null && o.locale ? r.$i18n.locale : (f = (l = r == null ? void 0 : r.proxy) == null ? void 0 : l.$i18n) != null && f.locale ? r.proxy.$i18n.locale : me();
1205
- };
1206
- let i = c();
1207
- if (r != null && r.$i18n)
1208
- try {
1209
- r.$watch(
1210
- () => r.$i18n.locale,
1211
- (o) => {
1212
- o !== i && (i = o, p());
1213
- },
1214
- { immediate: !1 }
1215
- );
1216
- } catch (o) {
1217
- console.warn("[TinySearchBox] Unable to watch i18n.locale via vm.$watch:", o);
1218
- }
1219
- if ((u = r == null ? void 0 : r.proxy) != null && u.$i18n)
1220
- try {
1221
- a(
1222
- () => r.proxy.$i18n.locale,
1223
- (o) => {
1224
- o !== i && (i = o, p());
1225
- },
1226
- { immediate: !1 }
1227
- );
1228
- } catch (o) {
1229
- console.warn("[TinySearchBox] Unable to watch i18n.locale via watch:", o);
1230
- }
1231
- const m = () => {
1232
- const o = c();
1233
- o !== i && (i = o, p());
1234
- };
1235
- typeof window < "u" && (e.localeCheckInterval = setInterval(m, 200)), a(
1236
- () => t.modelValue,
1237
- () => {
1238
- m();
1239
- }
1240
- ), a(
1241
- () => t.items,
1242
- (o) => {
1243
- const l = e.visible, f = e.prevItem && e.prevItem.field;
1244
- e.recordItems = j(o), s.initItems(), s.initFormRule(), n(() => {
1245
- if (s.initItems(), s.initFormRule(), l && e.propItem.label) {
1246
- const d = e.recordItems.find((v) => v.field === f) || e.prevItem;
1247
- e.prevItem = d || {}, e.backupList = d && d.options ? [...d.options] : [], e.filterList = e.backupList ? [...e.backupList] : [], C(e);
1248
- }
1249
- });
1250
- },
1251
- {
1252
- deep: !0,
1253
- immediate: !0
1254
- }
1255
- ), a(
1256
- () => e.inputValue,
1257
- (o) => {
1258
- !o && !e.propItem.type && (e.visible = !1);
1259
- },
1260
- {
1261
- immediate: !0
1262
- }
1263
- ), a(
1264
- () => e.popoverVisible,
1265
- (o) => {
1266
- !o && !e.inputEditValue.length && (e.prevItem && e.prevItem.mergeTag ? e.inputEditValue = Array.isArray(e.currentEditSelectTags) ? e.currentEditSelectTags : [] : e.inputEditValue = Array.isArray(e.currentEditSelectTags) ? e.currentEditSelectTags.join(",") : e.currentEditSelectTags || "");
1267
- },
1268
- {
1269
- immediate: !0
1270
- }
1271
- ), a(
1272
- () => e.propItem.label,
1273
- (o) => {
1274
- p();
1275
- }
1276
- ), a(
1277
- () => t.modelValue,
1278
- (o) => {
1279
- if (o) {
1280
- if (e.indexMap.clear(), e.valueMap.clear(), o.forEach((l, f) => {
1281
- var v;
1282
- const d = `${l.label}${l.value}`;
1283
- e.indexMap.set(l.label, f), e.valueMap.set(d, f), ((v = l.options) == null ? void 0 : v.length) > 0 && l.options.forEach((h) => {
1284
- const b = `${l.label}${h.label}`;
1285
- e.valueMap.set(b, f);
1286
- });
1287
- }), Q(e, !1), o.length === 0 && s.setPlaceholder(N("tvp.tvpSearchbox.addPlaceholder")), t.editable && !e.inputEditValue.length && o[0]) {
1288
- const l = o[0];
1289
- if ((e.recordItems.find((d) => d.field === l.field) || l).mergeTag && l.options) {
1290
- const d = l.options.flatMap((v) => v.label) || [];
1291
- e.inputEditValue = d, e.currentEditSelectTags = d;
1292
- } else {
1293
- const d = l.value;
1294
- e.inputEditValue = Array.isArray(d) ? d.join(",") : d || "";
1295
- }
1296
- }
1297
- e.innerModelValue = [...o];
1298
- }
1299
- },
1300
- {
1301
- deep: !0,
1302
- immediate: !0
1303
- }
1304
- );
1305
- };
1306
- var Kt = function() {
1307
- var a = this, e = a.$createElement, t = a._self._c || e;
1308
- return t("div", {
1309
- attrs: {
1310
- tiny_mode: "pc"
1311
- }
1312
- }, [t("tiny-dropdown-item", {
1313
- directives: [{
1314
- name: "show",
1315
- rawName: "v-show",
1316
- value: a.state.inputValue.trim(),
1317
- expression: "state.inputValue.trim()"
1318
- }],
1319
- staticClass: "tvp-search-box__filter-item tvp-search-box__dropdown-item tvp-search-box__dropdown-item-init",
1320
- attrs: {
1321
- "item-data": {
1322
- label: a.state.inputValue
1323
- }
1324
- },
1325
- on: {
1326
- "item-click": function() {
1327
- return a.selectInputValue(a.state.inputValue);
1328
- }
1329
- }
1330
- }, [t("span", [a._v(" " + a._s(a.t("tvp.tvpSearchbox.initUse")) + """ + a._s(a.state.inputValue) + """)])]), t("div", {
1331
- directives: [{
1332
- name: "show",
1333
- rawName: "v-show",
1334
- value: !a.state.propItem.label && a.state.inputValue.trim(),
1335
- expression: "!state.propItem.label && state.inputValue.trim()"
1336
- }]
1337
- }, [a._l(a.state.matchItems, function(s, n) {
1338
- return t("div", {
1339
- key: n
1340
- }, [s.attr.length ? t("div", [t("span", {
1341
- staticClass: "tvp-search-box__filter-type"
1342
- }, [a._v(a._s(n === "0" ? a.t("tvp.tvpSearchbox.attributeType") : n))]), a._l(s.attr, function(r, p) {
1343
- return t("tiny-dropdown-item", {
1344
- key: r.label + p,
1345
- staticClass: "tvp-search-box__filter-item tvp-search-box__dropdown-item",
1346
- attrs: {
1347
- "item-data": r
1348
- },
1349
- on: {
1350
- "item-click": function() {
1351
- return a.selectPropItem(r);
1352
- }
1353
- }
1354
- }, [t("span", a._l(r.match, function(c) {
1355
- return t("span", {
1356
- key: c
1357
- }, [c.toLowerCase() === r.hightlighStr ? t("span", {
1358
- staticClass: "tvp-search-box__text-highlight"
1359
- }, [a._v(a._s(c))]) : t("span", [a._v(a._s(c))])]);
1360
- }), 0)]);
1361
- })], 2) : a._e(), s.attrValue.length ? [t("span", {
1362
- staticClass: "tvp-search-box__filter-type"
1363
- }, [a._v(a._s(a.t("tvp.tvpSearchbox.propertyValue", [n === "0" ? a.t("tvp.tvpSearchbox.attributeType") : n])))]), a._l(s.attrValue, function(r, p) {
1364
- return t("tiny-dropdown-item", {
1365
- key: r.label + p,
1366
- staticClass: "tvp-search-box__filter-item tvp-search-box__dropdown-item",
1367
- attrs: {
1368
- disabled: r.isChecked,
1369
- "item-data": r
1370
- },
1371
- on: {
1372
- "item-click": function() {
1373
- return a.selectRadioItem(r, !0);
1374
- }
1375
- }
1376
- }, [t("span", a._l(r.match, function(c) {
1377
- return t("span", {
1378
- key: c
1379
- }, [c.toLowerCase() === r.hightlighStr ? t("span", {
1380
- staticClass: "tvp-search-box__text-highlight"
1381
- }, [a._v(a._s(c))]) : t("span", [a._v(a._s(c))])]);
1382
- }), 0)]);
1383
- })] : a._e()], 2);
1384
- }), t("div", {
1385
- directives: [{
1386
- name: "show",
1387
- rawName: "v-show",
1388
- value: a.state.potentialOptions,
1389
- expression: "state.potentialOptions"
1390
- }]
1391
- }, [t("span", {
1392
- staticClass: "tvp-search-box__filter-type"
1393
- }, [a._v(a._s(a.t("tvp.tvpSearchbox.matched")))]), t("div", {
1394
- staticClass: "tvp-search-box__potential-box",
1395
- attrs: {
1396
- id: "potential-loading"
1397
- }
1398
- }, [a.state.potentialOptions ? t("div", a._l(a.state.potentialOptions, function(s, n) {
1399
- return t("tiny-dropdown-item", {
1400
- key: s.label + n,
1401
- staticClass: "tvp-search-box__filter-item tvp-search-box__dropdown-item",
1402
- attrs: {
1403
- "item-data": s
1404
- },
1405
- on: {
1406
- "item-click": function() {
1407
- return a.selectRadioItem(s, !0);
1408
- }
1409
- }
1410
- }, [a._v(" " + a._s(s.label) + ": "), t("span", {
1411
- staticClass: "tvp-search-box__text-highlight"
1412
- }, [a._v(a._s(s.value))])]);
1413
- }), 1) : a._e()])])], 2), t("div", {
1414
- directives: [{
1415
- name: "show",
1416
- rawName: "v-show",
1417
- value: a.state.visible && !a.state.propItem.label && !a.state.inputValue.trim(),
1418
- expression: "state.visible && !state.propItem.label && !state.inputValue.trim()"
1419
- }],
1420
- staticClass: "tvp-search-box__first-panel"
1421
- }, a._l(a.state.groupItems, function(s, n) {
1422
- return t("div", {
1423
- key: n
1424
- }, [s.length ? t("span", {
1425
- staticClass: "tvp-search-box__filter-type"
1426
- }, [a._v(a._s(n === "0" ? a.t("tvp.tvpSearchbox.attributeType") : n))]) : a._e(), a._l(s, function(r, p) {
1427
- return t("tiny-dropdown-item", {
1428
- key: (r.field || r.label) + p,
1429
- staticClass: "tvp-search-box__dropdown-item",
1430
- attrs: {
1431
- "item-data": r
1432
- },
1433
- on: {
1434
- "item-click": function() {
1435
- return a.selectPropItem(r);
1436
- }
1437
- }
1438
- }, [t("span", {
1439
- attrs: {
1440
- title: r.label
1441
- }
1442
- }, [a._v(a._s(r.label))])]);
1443
- })], 2);
1444
- }), 0)], 1);
1445
- }, Ut = [];
1446
- function fe(a, e, t, s, n, r, p, c) {
1447
- var i = typeof a == "function" ? a.options : a;
1448
- e && (i.render = e, i.staticRenderFns = t, i._compiled = !0), s && (i.functional = !0), r && (i._scopeId = "data-v-" + r);
1449
- var m;
1450
- if (p ? (m = function(l) {
1451
- l = l || // cached call
1452
- this.$vnode && this.$vnode.ssrContext || // stateful
1453
- this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !l && typeof __VUE_SSR_CONTEXT__ < "u" && (l = __VUE_SSR_CONTEXT__), n && n.call(this, l), l && l._registeredComponents && l._registeredComponents.add(p);
1454
- }, i._ssrRegister = m) : n && (m = c ? function() {
1455
- n.call(
1456
- this,
1457
- (i.functional ? this.parent : this).$root.$options.shadowRoot
1458
- );
1459
- } : n), m)
1460
- if (i.functional) {
1461
- i._injectStyles = m;
1462
- var u = i.render;
1463
- i.render = function(f, d) {
1464
- return m.call(d), u(f, d);
1465
- };
1466
- } else {
1467
- var o = i.beforeCreate;
1468
- i.beforeCreate = o ? [].concat(o, m) : [m];
1469
- }
1470
- return {
1471
- exports: a,
1472
- options: i
1473
- };
1474
- }
1475
- const qt = (a, e, { emit: t }) => {
1476
- const s = a.handleEvents || a.events || ((c, i, m) => {
1477
- t("events", c, i, m);
1478
- });
1479
- return {
1480
- selectInputValue: (c) => {
1481
- s("selectInputValue", c);
1482
- },
1483
- selectPropItem: (c) => {
1484
- s("selectPropItem", c);
1485
- },
1486
- selectRadioItem: (c, i) => {
1487
- s("selectRadioItem", c, i);
1488
- },
1489
- t: N
1490
- };
1491
- }, Zt = ["selectInputValue", "selectPropItem", "selectRadioItem", "t"], Yt = X({
1492
- name: pe + "SearchBoxFirstLevelPanel",
1493
- components: {
1494
- TinyDropdownItem: Ie
1495
- },
1496
- props: {
1497
- ...J,
1498
- state: {
1499
- type: Object,
1500
- default: () => ({})
1501
- },
1502
- potentialOptions: {
1503
- type: Array,
1504
- default: () => []
1505
- },
1506
- events: {
1507
- type: Function,
1508
- default: null
1509
- },
1510
- handleEvents: {
1511
- type: Function,
1512
- default: null
1513
- }
1514
- },
1515
- emits: ["events"],
1516
- setup(a, e) {
1517
- return ue({ props: a, context: e, renderless: qt, api: Zt });
1518
- }
1519
- }), ve = {};
1520
- var Wt = /* @__PURE__ */ fe(
1521
- Yt,
1522
- Kt,
1523
- Ut,
1524
- !1,
1525
- Qt,
1526
- null,
1527
- null,
1528
- null
1529
- );
1530
- function Qt(a) {
1531
- for (let e in ve)
1532
- this[e] = ve[e];
1533
- }
1534
- const Xt = /* @__PURE__ */ function() {
1535
- return Wt.exports;
1536
- }();
1537
- var Jt = function() {
1538
- var a, e = this, t = e.$createElement, s = e._self._c || t;
1539
- return s("div", {
1540
- attrs: {
1541
- tiny_mode: "pc"
1542
- }
1543
- }, [(a = e.state.currentOperators) !== null && a !== void 0 && a.length ? s("div", [s("span", {
1544
- staticClass: "tvp-search-box__filter-type"
1545
- }, [e._v(e._s(e.t("tvp.tvpSearchbox.operator")))]), e._l(e.state.currentOperators, function(n, r) {
1546
- return s("tiny-dropdown-item", {
1547
- directives: [{
1548
- name: "show",
1549
- rawName: "v-show",
1550
- value: n.includes(e.state.inputValue),
1551
- expression: "item.includes(state.inputValue)"
1552
- }],
1553
- key: n + r,
1554
- staticClass: "tvp-search-box__dropdown-item",
1555
- attrs: {
1556
- "item-data": {
1557
- label: n
1558
- }
1559
- },
1560
- on: {
1561
- "item-click": function() {
1562
- return e.setOperator(n);
1563
- }
1564
- }
1565
- }, [e._v(" " + e._s(n) + " ")]);
1566
- })], 2) : !e.state.prevItem.type || e.state.prevItem.type === "radio" ? s("div", {
1567
- directives: [{
1568
- name: "loading",
1569
- rawName: "v-loading",
1570
- value: e.isLoading,
1571
- expression: "isLoading"
1572
- }],
1573
- class: ["tvp-search-box__radio-wrap", e.isLoading && "tvp-search-box__loading-box"]
1574
- }, e._l(e.state.backupList, function(n, r) {
1575
- return s("tiny-dropdown-item", {
1576
- directives: [{
1577
- name: "show",
1578
- rawName: "v-show",
1579
- value: !n.isFilter || !e.state.inputValue,
1580
- expression: "!item.isFilter || !state.inputValue"
1581
- }],
1582
- key: r + (n.field || n.label),
1583
- staticClass: "tvp-search-box__dropdown-item",
1584
- attrs: {
1585
- disabled: n.isChecked,
1586
- "item-data": n
1587
- },
1588
- on: {
1589
- "item-click": function() {
1590
- return e.selectRadioItem(n);
1591
- }
1592
- }
1593
- }, [n.match ? s("span", {
1594
- attrs: {
1595
- title: n.label
1596
- }
1597
- }, e._l(n.match, function(p) {
1598
- return s("span", {
1599
- key: p
1600
- }, [p.toLowerCase() === n.hightlighStr ? s("span", {
1601
- staticClass: "tvp-search-box__text-highlight"
1602
- }, [e._v(e._s(p))]) : s("span", [e._v(e._s(p))])]);
1603
- }), 0) : s("span", {
1604
- attrs: {
1605
- title: n.label
1606
- }
1607
- }, [e._v(e._s(n.label))])]);
1608
- }), 1) : e.state.prevItem.type === "checkbox" ? s("div", {
1609
- directives: [{
1610
- name: "loading",
1611
- rawName: "v-loading",
1612
- value: e.isLoading,
1613
- expression: "isLoading"
1614
- }],
1615
- class: e.isLoading && "tvp-search-box__loading-box"
1616
- }, [e.showCheckBoxList ? s("div", [s("div", {
1617
- staticClass: "tvp-search-box__checkbox-wrap"
1618
- }, [s("tiny-checkbox-group", {
1619
- staticClass: "tvp-search-box__checkbox",
1620
- model: {
1621
- value: e.state.checkAll,
1622
- callback: function(n) {
1623
- e.$set(e.state, "checkAll", n);
1624
- },
1625
- expression: "state.checkAll"
1626
- }
1627
- }, [s("tiny-dropdown-item", {
1628
- staticClass: "tvp-search-box__dropdown-item tvp-search-box__checkbox-item"
1629
- }, [s("tiny-checkbox", {
1630
- attrs: {
1631
- indeterminate: e.state.isIndeterminate
1632
- },
1633
- model: {
1634
- value: e.state.checkAll,
1635
- callback: function(n) {
1636
- e.$set(e.state, "checkAll", n);
1637
- },
1638
- expression: "state.checkAll"
1639
- }
1640
- }, [e._v(" " + e._s(e.t("tvp.tvpSearchbox.selectAll")) + " ")])], 1)], 1), s("tiny-checkbox-group", {
1641
- staticClass: "tvp-search-box__checkbox",
1642
- model: {
1643
- value: e.state.checkboxGroup,
1644
- callback: function(n) {
1645
- e.$set(e.state, "checkboxGroup", n);
1646
- },
1647
- expression: "state.checkboxGroup"
1648
- }
1649
- }, e._l(e.state.backupList, function(n, r) {
1650
- return s("tiny-dropdown-item", {
1651
- directives: [{
1652
- name: "show",
1653
- rawName: "v-show",
1654
- value: !n.isFilter,
1655
- expression: "!item.isFilter"
1656
- }],
1657
- key: (n.field || n.label) + r,
1658
- staticClass: "tvp-search-box__dropdown-item tvp-search-box__checkbox-item"
1659
- }, [s("tiny-checkbox", {
1660
- staticClass: "tvp-search-box__checkbox-item-label",
1661
- attrs: {
1662
- label: e.state.prevItem.label + n.label,
1663
- title: n.label
1664
- }
1665
- }, [e._v(" " + e._s(n.label) + " ")])], 1);
1666
- }), 1)], 1), s("div", {
1667
- staticClass: "tvp-search-box__checkbox-btn"
1668
- }, [s("tiny-button", {
1669
- attrs: {
1670
- size: "mini"
1671
- },
1672
- on: {
1673
- click: function(n) {
1674
- return e.selectCheckbox(!1);
1675
- }
1676
- }
1677
- }, [e._v(" " + e._s(e.t("tvp.tvpSearchbox.cancel")) + " ")]), s("tiny-button", {
1678
- attrs: {
1679
- size: "mini"
1680
- },
1681
- on: {
1682
- click: function(n) {
1683
- return e.selectCheckbox(!0);
1684
- }
1685
- }
1686
- }, [e._v(" " + e._s(e.t("tvp.tvpSearchbox.confirm")) + " ")])], 1)]) : e._e()]) : e.state.prevItem.type === "numRange" ? s("div", {
1687
- staticClass: "tvp-search-box__panel-box"
1688
- }, [s("div", {
1689
- staticClass: "tvp-search-box__number"
1690
- }, [s("div", {
1691
- staticClass: "tvp-search-box__dropdown-title"
1692
- }, [e._v(" " + e._s(e.t("tvp.tvpSearchbox.rangeNumberTitle")) + " ")]), s("div", {
1693
- staticClass: "tvp-search-box__dropdown-start"
1694
- }, [e._v(" " + e._s(e.t("tvp.tvpSearchbox.minValueText")) + "(" + e._s(e.state.prevItem.unit) + ") ")]), s("tiny-form-item", {
1695
- staticClass: "tvp-search-box__number-item",
1696
- attrs: {
1697
- prop: e.state.curMinNumVar,
1698
- "show-message": e.state.numberShowMessage
1699
- }
1700
- }, [s("tiny-input", {
1701
- staticClass: "tvp-search-box__number-input",
1702
- attrs: {
1703
- type: "number"
1704
- },
1705
- model: {
1706
- value: e.state[e.state.curMinNumVar],
1707
- callback: function(n) {
1708
- e.$set(e.state, e.state.curMinNumVar, n);
1709
- },
1710
- expression: "state[state.curMinNumVar]"
1711
- }
1712
- })], 1), s("div", {
1713
- staticClass: "tvp-search-box__dropdown-end"
1714
- }, [e._v(" " + e._s(e.t("tvp.tvpSearchbox.maxValueText")) + "(" + e._s(e.state.prevItem.unit) + ") ")]), s("tiny-form-item", {
1715
- staticClass: "tvp-search-box__number-item",
1716
- attrs: {
1717
- prop: e.state.curMaxNumVar
1718
- }
1719
- }, [s("tiny-input", {
1720
- staticClass: "tvp-search-box__number-input",
1721
- attrs: {
1722
- type: "number"
1723
- },
1724
- model: {
1725
- value: e.state[e.state.curMaxNumVar],
1726
- callback: function(n) {
1727
- e.$set(e.state, e.state.curMaxNumVar, n);
1728
- },
1729
- expression: "state[state.curMaxNumVar]"
1730
- }
1731
- })], 1)], 1), s("div", {
1732
- staticClass: "tvp-search-box__bottom-btn"
1733
- }, [s("tiny-button", {
1734
- attrs: {
1735
- size: "mini"
1736
- },
1737
- on: {
1738
- click: function(n) {
1739
- return e.sizeChange(!1);
1740
- }
1741
- }
1742
- }, [e._v(e._s(e.t("tvp.tvpSearchbox.cancel")))]), s("tiny-button", {
1743
- attrs: {
1744
- size: "mini"
1745
- },
1746
- on: {
1747
- click: function(n) {
1748
- return n.stopPropagation(), e.sizeChange(!0);
1749
- }
1750
- }
1751
- }, [e._v(" " + e._s(e.t("tvp.tvpSearchbox.confirm")) + " ")])], 1)]) : e.state.prevItem.type === "dateRange" ? s("div", {
1752
- staticClass: "tvp-search-box__panel-box"
1753
- }, [s("div", {
1754
- staticClass: "tvp-search-box__date-wrap"
1755
- }, [s("div", {
1756
- staticClass: "tvp-search-box__dropdown-title"
1757
- }, [e._v(" " + e._s(e.state.prevItem.maxTimeLength > 0 ? e.t("tvp.tvpSearchbox.timeLengthTitle", {
1758
- value: (e.state.prevItem.maxTimeLength / 864e5).toFixed(1)
1759
- }) : e.t("tvp.tvpSearchbox.rangeDateTitle")) + " ")]), s("div", {
1760
- staticClass: "tvp-search-box__dropdown-start"
1761
- }, [e._v(" " + e._s(e.t("tvp.tvpSearchbox.rangeBeginLabel")) + " ")]), s("tiny-form-item", {
1762
- staticClass: "tvp-search-box__date-item",
1763
- attrs: {
1764
- prop: "startDate",
1765
- "show-message": !!e.state.prevItem.maxTimeLength
1766
- }
1767
- }, [s("tiny-date-picker", {
1768
- staticClass: "tvp-search-box__date-picker",
1769
- attrs: {
1770
- format: e.state.prevItem.format || e.state.dateRangeFormat,
1771
- "value-format": e.state.prevItem.format || e.state.dateRangeFormat,
1772
- "picker-options": e.pickerOptions(e.state.startDate, "endDate")
1773
- },
1774
- on: {
1775
- "visible-change": e.handleDateShow
1776
- },
1777
- model: {
1778
- value: e.state.startDate,
1779
- callback: function(n) {
1780
- e.$set(e.state, "startDate", n);
1781
- },
1782
- expression: "state.startDate"
1783
- }
1784
- })], 1), s("div", {
1785
- staticClass: "tvp-search-box__dropdown-end"
1786
- }, [e._v(" " + e._s(e.t("tvp.tvpSearchbox.rangeEndLabel")) + " ")]), s("tiny-form-item", {
1787
- staticClass: "tvp-search-box__date-item",
1788
- attrs: {
1789
- prop: "endDate"
1790
- }
1791
- }, [s("tiny-date-picker", {
1792
- staticClass: "tvp-search-box__date-picker",
1793
- attrs: {
1794
- format: e.state.prevItem.format || e.state.dateRangeFormat,
1795
- "value-format": e.state.prevItem.format || e.state.dateRangeFormat,
1796
- "picker-options": e.pickerOptions(e.state.startDate)
1797
- },
1798
- on: {
1799
- change: e.handleDateShow,
1800
- blur: e.handleDateShow
1801
- },
1802
- model: {
1803
- value: e.state.endDate,
1804
- callback: function(n) {
1805
- e.$set(e.state, "endDate", n);
1806
- },
1807
- expression: "state.endDate"
1808
- }
1809
- })], 1)], 1), s("div", {
1810
- staticClass: "tvp-search-box__bottom-btn"
1811
- }, [s("tiny-button", {
1812
- attrs: {
1813
- size: "mini"
1814
- },
1815
- on: {
1816
- click: function(n) {
1817
- return e.onConfirmDate(!1);
1818
- }
1819
- }
1820
- }, [e._v(" " + e._s(e.t("tvp.tvpSearchbox.cancel")) + " ")]), s("tiny-button", {
1821
- attrs: {
1822
- size: "mini"
1823
- },
1824
- on: {
1825
- click: function(n) {
1826
- return e.onConfirmDate(!0);
1827
- }
1828
- }
1829
- }, [e._v(" " + e._s(e.t("tvp.tvpSearchbox.confirm")) + " ")])], 1)]) : e.state.prevItem.type === "datetimeRange" ? s("div", {
1830
- staticClass: "tvp-search-box__panel-box"
1831
- }, [s("div", {
1832
- staticClass: "tvp-search-box__date-wrap"
1833
- }, [s("div", {
1834
- staticClass: "tvp-search-box__dropdown-title"
1835
- }, [e._v(" " + e._s(e.state.prevItem.maxTimeLength > 0 ? e.t("tvp.tvpSearchbox.timeLengthTitle", {
1836
- value: (e.state.prevItem.maxTimeLength / 864e5).toFixed(1)
1837
- }) : e.t("tvp.tvpSearchbox.rangeDateTitle")) + " ")]), s("div", {
1838
- staticClass: "tvp-search-box__dropdown-start"
1839
- }, [e._v(" " + e._s(e.t("tvp.tvpSearchbox.rangeBeginLabel")) + " ")]), s("tiny-form-item", {
1840
- staticClass: "tvp-search-box__date-item",
1841
- attrs: {
1842
- prop: "startDateTime",
1843
- "show-message": !!e.state.prevItem.maxTimeLength
1844
- }
1845
- }, [s("tiny-date-picker", {
1846
- staticClass: "tvp-search-box__date-picker",
1847
- attrs: {
1848
- type: "datetime",
1849
- isutc8: !0,
1850
- format: e.state.prevItem.format || e.state.datetimeRangeFormat,
1851
- "value-format": e.state.prevItem.format || e.state.datetimeRangeFormat,
1852
- "picker-options": e.pickerOptions(e.state.startDateTime, "endDateTime")
1853
- },
1854
- on: {
1855
- change: e.handleDateShow,
1856
- blur: e.handleDateShow
1857
- },
1858
- model: {
1859
- value: e.state.startDateTime,
1860
- callback: function(n) {
1861
- e.$set(e.state, "startDateTime", n);
1862
- },
1863
- expression: "state.startDateTime"
1864
- }
1865
- })], 1), s("div", {
1866
- staticClass: "tvp-search-box__dropdown-end"
1867
- }, [e._v(" " + e._s(e.t("tvp.tvpSearchbox.rangeEndLabel")) + " ")]), s("tiny-form-item", {
1868
- staticClass: "tvp-search-box__date-item",
1869
- attrs: {
1870
- prop: "endDateTime"
1871
- }
1872
- }, [s("tiny-date-picker", {
1873
- staticClass: "tvp-search-box__date-picker",
1874
- attrs: {
1875
- type: "datetime",
1876
- isutc8: !0,
1877
- format: e.state.prevItem.format || e.state.datetimeRangeFormat,
1878
- "value-format": e.state.prevItem.format || e.state.datetimeRangeFormat,
1879
- "picker-options": e.pickerOptions(e.state.startDateTime)
1880
- },
1881
- on: {
1882
- change: e.handleDateShow,
1883
- blur: e.handleDateShow
1884
- },
1885
- model: {
1886
- value: e.state.endDateTime,
1887
- callback: function(n) {
1888
- e.$set(e.state, "endDateTime", n);
1889
- },
1890
- expression: "state.endDateTime"
1891
- }
1892
- })], 1)], 1), s("div", {
1893
- staticClass: "tvp-search-box__bottom-btn"
1894
- }, [s("tiny-button", {
1895
- attrs: {
1896
- size: "mini"
1897
- },
1898
- on: {
1899
- click: function(n) {
1900
- return e.onConfirmDate(!1, !0);
1901
- }
1902
- }
1903
- }, [e._v(" " + e._s(e.t("tvp.tvpSearchbox.cancel")) + " ")]), s("tiny-button", {
1904
- attrs: {
1905
- size: "mini"
1906
- },
1907
- on: {
1908
- click: function(n) {
1909
- return e.onConfirmDate(!0, !0);
1910
- }
1911
- }
1912
- }, [e._v(" " + e._s(e.t("tvp.tvpSearchbox.confirm")) + " ")])], 1)]) : e.state.prevItem.type === "map" ? s("div", {
1913
- directives: [{
1914
- name: "loading",
1915
- rawName: "v-loading",
1916
- value: e.isLoading,
1917
- expression: "isLoading"
1918
- }]
1919
- }, [e.state.isShowTagKey ? s("span", {
1920
- staticClass: "tvp-search-box__filter-type"
1921
- }, [e._v(e._s(e.t("tvp.tvpSearchbox.tagKey")))]) : s("span", {
1922
- staticClass: "tvp-search-box__filter-type"
1923
- }, [e._v(e._s(e.t("tvp.tvpSearchbox.tagValue")))]), e._l(e.state.backupList, function(n, r) {
1924
- return s("tiny-dropdown-item", {
1925
- directives: [{
1926
- name: "show",
1927
- rawName: "v-show",
1928
- value: !n.isFilter,
1929
- expression: "!item.isFilter"
1930
- }],
1931
- key: n.label + n.value + r,
1932
- staticClass: "tvp-search-box__dropdown-item",
1933
- attrs: {
1934
- disabled: n.isChecked,
1935
- "item-data": n
1936
- },
1937
- on: {
1938
- "item-click": function() {
1939
- return e.selectFirstMap(n, e.state.isShowTagKey);
1940
- }
1941
- }
1942
- }, [s("span", {
1943
- attrs: {
1944
- title: n.label
1945
- }
1946
- }, [e._v(e._s(n.label))])]);
1947
- })], 2) : e._e()]);
1948
- }, ea = [];
1949
- const ta = (a, e, { emit: t }) => {
1950
- const { computed: s } = e, n = a.handleEvents || a.events || ((d, v, h) => {
1951
- t("events", d, v, h);
1952
- }), r = (d) => {
1953
- n("setOperator", d);
1954
- }, p = (d) => {
1955
- n("selectRadioItem", d);
1956
- }, c = (d) => {
1957
- n("selectCheckbox", d);
1958
- }, i = (d) => {
1959
- n("sizeChange", d);
1960
- }, m = (d, v) => {
1961
- n("onConfirmDate", d, v);
1962
- }, u = (d, v) => {
1963
- n("selectFirstMap", d, v);
1964
- }, o = (d) => {
1965
- n("handleDateShow", d);
1966
- }, l = s(() => {
1967
- var d;
1968
- return a.state.hasBackupList && ((d = a.state.backupList) == null ? void 0 : d.length) === 0;
1969
- }), f = s(() => {
1970
- var d;
1971
- return (d = a.state.backupList) == null ? void 0 : d.find((v) => !v.isFilter);
1972
- });
1973
- return {
1974
- setOperator: r,
1975
- selectRadioItem: p,
1976
- selectCheckbox: c,
1977
- sizeChange: i,
1978
- onConfirmDate: m,
1979
- selectFirstMap: u,
1980
- handleDateShow: o,
1981
- isLoading: l,
1982
- showCheckBoxList: f,
1983
- t: N
1984
- };
1985
- }, aa = [
1986
- "setOperator",
1987
- "selectRadioItem",
1988
- "selectCheckbox",
1989
- "sizeChange",
1990
- "onConfirmDate",
1991
- "selectFirstMap",
1992
- "handleDateShow",
1993
- "isLoading",
1994
- "showCheckBoxList",
1995
- "t"
1996
- ], na = X({
1997
- name: pe + "SearchBoxSecondLevelPanel",
1998
- emits: ["events"],
1999
- components: {
2000
- TinyFormItem: we,
2001
- TinyDropdownItem: Ie,
2002
- TinyCheckbox: qe,
2003
- TinyCheckboxGroup: Ze,
2004
- TinyDatePicker: xe,
2005
- TinyInput: _e,
2006
- TinyButton: ye
2007
- },
2008
- directives: {
2009
- loading: Ye.directive
2010
- },
2011
- props: {
2012
- ...J,
2013
- state: {
2014
- type: Object,
2015
- default: () => ({})
2016
- },
2017
- pickerOptions: {
2018
- type: Function,
2019
- default: () => {
2020
- }
2021
- },
2022
- events: {
2023
- type: Function,
2024
- default: null
2025
- },
2026
- handleEvents: {
2027
- type: Function,
2028
- default: null
2029
- }
2030
- },
2031
- setup(a, e) {
2032
- return ue({ props: a, context: e, renderless: ta, api: aa });
2033
- }
2034
- }), be = {};
2035
- var sa = /* @__PURE__ */ fe(
2036
- na,
2037
- Jt,
2038
- ea,
2039
- !1,
2040
- ra,
2041
- null,
2042
- null,
2043
- null
2044
- );
2045
- function ra(a) {
2046
- for (let e in be)
2047
- this[e] = be[e];
2048
- }
2049
- const oa = /* @__PURE__ */ function() {
2050
- return sa.exports;
2051
- }();
2052
- const la = X({
2053
- model: {
2054
- prop: "modelValue",
2055
- event: "update:modelValue"
2056
- },
2057
- props: {
2058
- ...J,
2059
- tiny_mode: {
2060
- type: String,
2061
- default: "pc"
2062
- },
2063
- modelValue: {
2064
- type: Array,
2065
- default: () => []
2066
- },
2067
- items: {
2068
- type: Array,
2069
- default: () => []
2070
- },
2071
- emptyPlaceholder: {
2072
- type: String,
2073
- default: ""
2074
- },
2075
- potentialOptions: {
2076
- type: Object,
2077
- default: () => null
2078
- },
2079
- showHelp: {
2080
- type: Boolean,
2081
- default: !0
2082
- },
2083
- idMapKey: {
2084
- type: String,
2085
- default: "id"
2086
- },
2087
- defaultField: {
2088
- type: String,
2089
- default: ""
2090
- },
2091
- editable: {
2092
- type: Boolean,
2093
- default: !1
2094
- },
2095
- maxlength: {
2096
- type: Number,
2097
- default: void 0
2098
- },
2099
- panelMaxHeight: {
2100
- type: String,
2101
- default: "999px"
2102
- },
2103
- splitInputValue: {
2104
- type: String,
2105
- default: ","
2106
- },
2107
- // 尺寸
2108
- size: {
2109
- type: String,
2110
- default: ""
2111
- }
2112
- },
2113
- emits: [
2114
- "update:modelValue",
2115
- "change",
2116
- "search",
2117
- "exceed",
2118
- "first-level-select",
2119
- "clear"
2120
- ],
2121
- components: {
2122
- TinyTag: Pe,
2123
- TinyInput: _e,
2124
- TinyDropdown: Oe,
2125
- TinyDropdownMenu: Fe,
2126
- TinyButton: ye,
2127
- TinyTooltip: Ae,
2128
- TinyDatePicker: xe,
2129
- TinyForm: Be,
2130
- TinyFormItem: we,
2131
- TinyPopover: ze,
2132
- TinySelect: je,
2133
- TinyOption: He,
2134
- TinySearchBoxFirstLevelPanel: Xt,
2135
- TinySearchBoxSecondLevelPanel: oa,
2136
- // 图标组件
2137
- TinyIconSearch: Ge(),
2138
- TinyIconClose: Ke(),
2139
- TinyIconHelpQuery: Ue()
2140
- },
2141
- setup(a, e) {
2142
- return ue({ props: a, context: e, renderless: jt, api: Bt });
2143
- }
2144
- });
2145
- var ia = function() {
2146
- var a, e, t = this, s = t.$createElement, n = t._self._c || s;
2147
- return n("div", {
2148
- class: ["tvp-search-box", t.size === "small" ? "tvp-search-box--small" : ""],
2149
- on: {
2150
- click: function(r) {
2151
- return r.stopPropagation(), t.showPopover(t.state, !1);
2152
- }
2153
- }
2154
- }, [n("tiny-icon-search", {
2155
- staticClass: "tvp-search-box__prefix"
2156
- }), t._l(t.modelValue, function(r, p) {
2157
- return n("tiny-tag", {
2158
- key: r.field + p,
2159
- staticClass: "tvp-search-box__tag",
2160
- class: t.editable && r.type !== "map" ? "tvp-search-box__tag-editor" : "",
2161
- attrs: {
2162
- closable: "",
2163
- title: `${r.label} ${r.operator || ":"} ${r.value}`
2164
- },
2165
- on: {
2166
- close: function(c) {
2167
- return t.deleteTag(r);
2168
- },
2169
- click: function(c) {
2170
- return c.stopPropagation(), t.editTag(r, p, c);
2171
- }
2172
- }
2173
- }, [n("span", {
2174
- staticClass: "tvp-search-box__tag-value"
2175
- }, [t._v(t._s(r.label) + " " + t._s(r.operator || ":") + " " + t._s(r.value) + " ")])]);
2176
- }), t.modelValue.length ? n("span", {
2177
- staticClass: "tvp-search-box__placeholder"
2178
- }) : t._e(), n("tiny-form", {
2179
- ref: "formRef",
2180
- staticClass: "tvp-search-box__form",
2181
- attrs: {
2182
- model: t.state,
2183
- rules: t.state.formRules,
2184
- "validate-type": t.state.validType,
2185
- size: t.size === "small" ? "small" : "",
2186
- "label-width": "0px",
2187
- "message-type": "block"
2188
- }
2189
- }, [n("div", {
2190
- staticClass: "tvp-search-box__input-wrapper"
2191
- }, [n("section", {
2192
- staticClass: "tvp-search-box__prop"
2193
- }, [n("span", {
2194
- directives: [{
2195
- name: "show",
2196
- rawName: "v-show",
2197
- value: t.state.propItem.label,
2198
- expression: "state.propItem.label"
2199
- }]
2200
- }, [t._v(t._s(t.state.propItem.label) + " " + t._s(`${t.state.operatorValue ? t.state.operatorValue : ""} `))]), n("span", {
2201
- directives: [{
2202
- name: "show",
2203
- rawName: "v-show",
2204
- value: t.state.propItem.value,
2205
- expression: "state.propItem.value"
2206
- }]
2207
- }, [t._v(t._s(t.state.propItem.value))])]), n("tiny-dropdown", {
2208
- ref: "dropdownRef",
2209
- staticClass: "tvp-search-box__dropdown",
2210
- attrs: {
2211
- trigger: "click",
2212
- "show-icon": !1,
2213
- size: t.size === "small" ? "small" : "",
2214
- "lazy-show-popper": "",
2215
- "close-on-click-outside": !0
2216
- },
2217
- scopedSlots: t._u([{
2218
- key: "dropdown",
2219
- fn: function() {
2220
- var r, p;
2221
- return [n("tiny-dropdown-menu", {
2222
- style: {
2223
- "max-height": t.panelMaxHeight
2224
- },
2225
- attrs: {
2226
- placement: "bottom-start",
2227
- "popper-class": "tvp-search-box__dropdown-menu"
2228
- },
2229
- on: {
2230
- mouseup: function(c) {
2231
- return c.stopPropagation(), (function() {
2232
- }).apply(null, arguments);
2233
- }
2234
- }
2235
- }, [n("div", {
2236
- directives: [{
2237
- name: "show",
2238
- rawName: "v-show",
2239
- value: !t.state.propItem.label || t.state.inputValue.trim(),
2240
- expression: "!state.propItem.label || state.inputValue.trim()"
2241
- }]
2242
- }, [(r = t.state.instance) !== null && r !== void 0 && r.slots["first-panel"] ? t._t("first-panel", null, null, {
2243
- state: t.state,
2244
- handleEvents: t.handleEvents
2245
- }) : n("TinySearchBoxFirstLevelPanel", {
2246
- attrs: {
2247
- state: t.state,
2248
- handleEvents: t.handleEvents
2249
- }
2250
- })], 2), n("div", {
2251
- directives: [{
2252
- name: "show",
2253
- rawName: "v-show",
2254
- value: t.state.propItem.label,
2255
- expression: "state.propItem.label"
2256
- }]
2257
- }, [(p = t.state.instance) !== null && p !== void 0 && p.slots["second-panel"] ? t._t("second-panel", null, null, {
2258
- state: t.state,
2259
- pickerOptions: t.pickerOptions,
2260
- handleEvents: t.handleEvents,
2261
- back: function() {
2262
- return t.resetInput(t.state);
2263
- }
2264
- }) : t.state.prevItem.type !== "custom" ? n("TinySearchBoxSecondLevelPanel", {
2265
- attrs: {
2266
- state: t.state,
2267
- "picker-options": t.pickerOptions
2268
- },
2269
- on: {
2270
- events: t.handleEvents
2271
- }
2272
- }) : n("div", {
2273
- staticClass: "tvp-search-box__panel-box",
2274
- on: {
2275
- click: function(c) {
2276
- return t.showDropdown(t.state);
2277
- }
2278
- }
2279
- }, [t._t(t.state.prevItem.slotName, null, null, {
2280
- showDropdown: function() {
2281
- return t.showDropdown(t.state);
2282
- },
2283
- onConfirm: t.handleConfirm
2284
- })], 2)], 2)])];
2285
- },
2286
- proxy: !0
2287
- }], null, !0),
2288
- model: {
2289
- value: t.state.visible,
2290
- callback: function(r) {
2291
- t.$set(t.state, "visible", r);
2292
- },
2293
- expression: "state.visible"
2294
- }
2295
- }, [n("tiny-input", {
2296
- ref: "inputRef",
2297
- staticClass: "tvp-search-box__input",
2298
- attrs: {
2299
- placeholder: t.state.placeholder,
2300
- maxlength: t.maxlength && t.maxlength + 1
2301
- },
2302
- on: {
2303
- keydown: [function(r) {
2304
- return !r.type.indexOf("key") && t._k(r.keyCode, "delete", [8, 46], r.key, ["Backspace", "Delete", "Del"]) ? null : (r.stopPropagation(), t.backspaceDeleteTag.apply(null, arguments));
2305
- }, function(r) {
2306
- return !r.type.indexOf("key") && t._k(r.keyCode, "enter", 13, r.key, "Enter") ? null : (r.stopPropagation(), t.createTag.apply(null, arguments));
2307
- }],
2308
- input: t.handleInput,
2309
- click: t.handleClick
2310
- },
2311
- scopedSlots: t._u([{
2312
- key: "suffix",
2313
- fn: function() {
2314
- return [n("tiny-icon-close", {
2315
- directives: [{
2316
- name: "show",
2317
- rawName: "v-show",
2318
- value: t.isShowClose,
2319
- expression: "isShowClose"
2320
- }],
2321
- staticClass: "tvp-search-box__input-close",
2322
- on: {
2323
- click: function(r) {
2324
- return r.stopPropagation(), t.clearTag.apply(null, arguments);
2325
- }
2326
- }
2327
- }), n("span", {
2328
- directives: [{
2329
- name: "show",
2330
- rawName: "v-show",
2331
- value: t.isShowClose,
2332
- expression: "isShowClose"
2333
- }],
2334
- staticClass: "tvp-search-box__input-separator"
2335
- }), t.showHelp ? n("tiny-tooltip", {
2336
- attrs: {
2337
- effect: "light",
2338
- content: t.t("tvp.tvpSearchbox.help"),
2339
- placement: "top"
2340
- }
2341
- }, [n("tiny-icon-help-query", {
2342
- staticClass: "tvp-search-box__input-help",
2343
- on: {
2344
- click: function(r) {
2345
- return r.stopPropagation(), t.helpClick.apply(null, arguments);
2346
- }
2347
- }
2348
- })], 1) : t._e(), n("tiny-icon-search", {
2349
- staticClass: "tvp-search-box__input-search",
2350
- on: {
2351
- click: function(r) {
2352
- return r.stopPropagation(), t.createTag.apply(null, arguments);
2353
- }
2354
- }
2355
- })];
2356
- },
2357
- proxy: !0
2358
- }]),
2359
- model: {
2360
- value: t.state.inputValue,
2361
- callback: function(r) {
2362
- t.$set(t.state, "inputValue", r);
2363
- },
2364
- expression: "state.inputValue"
2365
- }
2366
- })], 1)], 1), t.editable ? [n("tiny-popover", {
2367
- ref: "popoverRef",
2368
- staticClass: "tvp-search-box__form-popover",
2369
- attrs: {
2370
- placement: "bottom-start",
2371
- "visible-arrow": !1,
2372
- trigger: "manual",
2373
- "popper-class": "tvp-search-box__popover"
2374
- },
2375
- model: {
2376
- value: t.state.popoverVisible,
2377
- callback: function(r) {
2378
- t.$set(t.state, "popoverVisible", r);
2379
- },
2380
- expression: "state.popoverVisible"
2381
- }
2382
- }, [t.state.prevItem.type !== "custom" ? [n("div", {
2383
- staticClass: "tvp-search-box__date-wrap"
2384
- }, [n("div", {
2385
- staticClass: "tvp-search-box__dropdown-start"
2386
- }, [t._v(" " + t._s(t.t("tvp.tvpSearchbox.attributeType")) + " ")]), n("tiny-form-item", {
2387
- staticClass: "tvp-search-box__number-item"
2388
- }, [n("tiny-select", {
2389
- attrs: {
2390
- searchable: "",
2391
- disabled: t.state.prevItem.editAttrDisabled
2392
- },
2393
- model: {
2394
- value: t.state.selectValue,
2395
- callback: function(r) {
2396
- t.$set(t.state, "selectValue", r);
2397
- },
2398
- expression: "state.selectValue"
2399
- }
2400
- }, [n("tiny-option", {
2401
- key: t.state.allTypeAttri.label,
2402
- attrs: {
2403
- label: t.t("tvp.tvpSearchbox.allProperty"),
2404
- value: t.state.allTypeAttri.label,
2405
- disabled: t.selectItemIsDisable(t.state.allTypeAttri)
2406
- },
2407
- on: {
2408
- click: function(r) {
2409
- t.selectPropChange(t.state.allTypeAttri, t.selectItemIsDisable(t.state.allTypeAttri));
2410
- }
2411
- }
2412
- }), t._l(t.state.recordItems, function(r) {
2413
- return n("tiny-option", {
2414
- key: r.label,
2415
- attrs: {
2416
- label: r.label,
2417
- value: r.label,
2418
- disabled: t.selectItemIsDisable(r)
2419
- },
2420
- on: {
2421
- click: function(p) {
2422
- t.selectPropChange(r, t.selectItemIsDisable(r));
2423
- }
2424
- }
2425
- });
2426
- })], 2)], 1), t.state.prevItem.operators ? n("div", {
2427
- staticClass: "tvp-search-box__dropdown-end"
2428
- }, [t._v(" " + t._s(t.t("tvp.tvpSearchbox.operator")) + " ")]) : t._e(), t.state.prevItem.operators ? n("tiny-form-item", {
2429
- staticClass: "tvp-search-box__number-item"
2430
- }, [n("tiny-select", {
2431
- model: {
2432
- value: t.state.operatorValue,
2433
- callback: function(r) {
2434
- t.$set(t.state, "operatorValue", r);
2435
- },
2436
- expression: "state.operatorValue"
2437
- }
2438
- }, t._l(t.state.currentOperators, function(r) {
2439
- return n("tiny-option", {
2440
- key: r,
2441
- attrs: {
2442
- label: r,
2443
- value: r
2444
- }
2445
- });
2446
- }), 1)], 1) : t._e(), t.state.prevItem.type !== "numRange" ? n("div", {
2447
- staticClass: "tvp-search-box__dropdown-end"
2448
- }, [t._v(" " + t._s(t.t("tvp.tvpSearchbox.tagValue")) + " ")]) : t._e(), ["numRange", "dateRange", "datetimeRange", "custom"].includes(t.state.prevItem.type) ? t._e() : n("tiny-form-item", {
2449
- staticClass: "tvp-search-box__number-item",
2450
- attrs: {
2451
- prop: "inputEditValue"
2452
- }
2453
- }, [((a = t.state.currentEditValue) === null || a === void 0 ? void 0 : a.length) > 0 ? n("tiny-select", {
2454
- staticClass: "tvp-search-box-select",
2455
- attrs: {
2456
- multiple: !!t.state.prevItem.mergeTag,
2457
- "allow-create": (e = t.state.prevItem) === null || e === void 0 ? void 0 : e.allowCreate,
2458
- filterable: "",
2459
- "default-first-option": "",
2460
- clearable: ""
2461
- },
2462
- model: {
2463
- value: t.state.inputEditValue,
2464
- callback: function(r) {
2465
- t.$set(t.state, "inputEditValue", r);
2466
- },
2467
- expression: "state.inputEditValue"
2468
- }
2469
- }, t._l(t.state.currentEditValue, function(r) {
2470
- return n("tiny-option", {
2471
- key: r.label,
2472
- attrs: {
2473
- label: r.label,
2474
- value: r.label
2475
- }
2476
- });
2477
- }), 1) : n("tiny-input", {
2478
- attrs: {
2479
- clearable: ""
2480
- },
2481
- model: {
2482
- value: t.state.inputEditValue,
2483
- callback: function(r) {
2484
- t.$set(t.state, "inputEditValue", r);
2485
- },
2486
- expression: "state.inputEditValue"
2487
- }
2488
- })], 1), t.state.prevItem.type === "numRange" ? n("div", {
2489
- staticClass: "tvp-search-box__number"
2490
- }, [n("div", {
2491
- staticClass: "tvp-search-box__dropdown-start"
2492
- }, [t._v(" " + t._s(t.t("tvp.tvpSearchbox.minValueText")) + "(" + t._s(t.state.prevItem.unit) + ") ")]), n("tiny-form-item", {
2493
- staticClass: "tvp-search-box__number-item",
2494
- attrs: {
2495
- prop: t.state.curMinNumVar,
2496
- "show-message": t.state.numberShowMessage
2497
- }
2498
- }, [n("tiny-input", {
2499
- staticClass: "tvp-search-box__number-input",
2500
- attrs: {
2501
- type: "number"
2502
- },
2503
- model: {
2504
- value: t.state[t.state.curMinNumVar],
2505
- callback: function(r) {
2506
- t.$set(t.state, t.state.curMinNumVar, r);
2507
- },
2508
- expression: "state[state.curMinNumVar]"
2509
- }
2510
- })], 1), n("div", {
2511
- staticClass: "tvp-search-box__dropdown-end"
2512
- }, [t._v(" " + t._s(t.t("tvp.tvpSearchbox.maxValueText")) + "(" + t._s(t.state.prevItem.unit) + ") ")]), n("tiny-form-item", {
2513
- staticClass: "tvp-search-box__number-item",
2514
- attrs: {
2515
- prop: t.state.curMaxNumVar
2516
- }
2517
- }, [n("tiny-input", {
2518
- staticClass: "tvp-search-box__number-input",
2519
- attrs: {
2520
- type: "number"
2521
- },
2522
- model: {
2523
- value: t.state[t.state.curMaxNumVar],
2524
- callback: function(r) {
2525
- t.$set(t.state, t.state.curMaxNumVar, r);
2526
- },
2527
- expression: "state[state.curMaxNumVar]"
2528
- }
2529
- })], 1)], 1) : t._e(), t.state.prevItem.type === "dateRange" ? n("div", {
2530
- staticClass: "tvp-search-box__date-wrap"
2531
- }, [n("div", {
2532
- staticClass: "tvp-search-box__dropdown-title"
2533
- }, [t._v(" " + t._s(t.state.prevItem.maxTimeLength > 0 ? t.t("tvp.tvpSearchbox.timeLengthTitle", {
2534
- value: (t.state.prevItem.maxTimeLength / 864e5).toFixed(1)
2535
- }) : t.t("tvp.tvpSearchbox.rangeDateTitle")) + " ")]), n("div", {
2536
- staticClass: "tvp-search-box__dropdown-start"
2537
- }, [t._v(" " + t._s(t.t("tvp.tvpSearchbox.rangeBeginLabel")) + " ")]), n("tiny-form-item", {
2538
- staticClass: "tvp-search-box__date-item",
2539
- attrs: {
2540
- prop: "startDate",
2541
- "show-message": !!t.state.prevItem.maxTimeLength
2542
- }
2543
- }, [n("tiny-date-picker", {
2544
- staticClass: "tvp-search-box__date-picker",
2545
- attrs: {
2546
- format: t.state.prevItem.format || t.state.dateRangeFormat,
2547
- "value-format": t.state.prevItem.format || t.state.dateRangeFormat,
2548
- "picker-options": t.pickerOptions(t.state.startDate, "endDate")
2549
- },
2550
- model: {
2551
- value: t.state.startDate,
2552
- callback: function(r) {
2553
- t.$set(t.state, "startDate", r);
2554
- },
2555
- expression: "state.startDate"
2556
- }
2557
- })], 1), n("div", {
2558
- staticClass: "tvp-search-box__dropdown-end"
2559
- }, [t._v(" " + t._s(t.t("tvp.tvpSearchbox.rangeEndLabel")) + " ")]), n("tiny-form-item", {
2560
- staticClass: "tvp-search-box__date-item",
2561
- attrs: {
2562
- prop: "endDate"
2563
- }
2564
- }, [n("tiny-date-picker", {
2565
- staticClass: "tvp-search-box__date-picker",
2566
- attrs: {
2567
- format: t.state.prevItem.format || t.state.dateRangeFormat,
2568
- "value-format": t.state.prevItem.format || t.state.dateRangeFormat,
2569
- "picker-options": t.pickerOptions(t.state.startDate)
2570
- },
2571
- model: {
2572
- value: t.state.endDate,
2573
- callback: function(r) {
2574
- t.$set(t.state, "endDate", r);
2575
- },
2576
- expression: "state.endDate"
2577
- }
2578
- })], 1)], 1) : t._e(), t.state.prevItem.type === "datetimeRange" ? n("div", {
2579
- staticClass: "tvp-search-box__date-wrap"
2580
- }, [n("div", {
2581
- staticClass: "tvp-search-box__dropdown-title"
2582
- }, [t._v(" " + t._s(t.state.prevItem.maxTimeLength > 0 ? t.t("tvp.tvpSearchbox.timeLengthTitle", {
2583
- value: (t.state.prevItem.maxTimeLength / 864e5).toFixed(1)
2584
- }) : t.t("tvp.tvpSearchbox.rangeDateTitle")) + " ")]), n("div", {
2585
- staticClass: "tvp-search-box__dropdown-start"
2586
- }, [t._v(" " + t._s(t.t("tvp.tvpSearchbox.rangeBeginLabel")) + " ")]), n("tiny-form-item", {
2587
- staticClass: "tvp-search-box__date-item",
2588
- attrs: {
2589
- prop: "startDateTime",
2590
- "show-message": !!t.state.prevItem.maxTimeLength
2591
- }
2592
- }, [n("tiny-date-picker", {
2593
- staticClass: "tvp-search-box__date-picker",
2594
- attrs: {
2595
- type: "datetime",
2596
- isutc8: !0,
2597
- format: t.state.prevItem.format || t.state.datetimeRangeFormat,
2598
- "value-format": t.state.prevItem.format || t.state.datetimeRangeFormat,
2599
- "picker-options": t.pickerOptions(t.state.startDateTime, "endDateTime")
2600
- },
2601
- model: {
2602
- value: t.state.startDateTime,
2603
- callback: function(r) {
2604
- t.$set(t.state, "startDateTime", r);
2605
- },
2606
- expression: "state.startDateTime"
2607
- }
2608
- })], 1), n("div", {
2609
- staticClass: "tvp-search-box__dropdown-end"
2610
- }, [t._v(" " + t._s(t.t("tvp.tvpSearchbox.rangeEndLabel")) + " ")]), n("tiny-form-item", {
2611
- staticClass: "tvp-search-box__date-item",
2612
- attrs: {
2613
- prop: "endDateTime"
2614
- }
2615
- }, [n("tiny-date-picker", {
2616
- staticClass: "tvp-search-box__date-picker",
2617
- attrs: {
2618
- type: "datetime",
2619
- isutc8: !0,
2620
- format: t.state.prevItem.format || t.state.datetimeRangeFormat,
2621
- "value-format": t.state.prevItem.format || t.state.datetimeRangeFormat,
2622
- "picker-options": t.pickerOptions(t.state.startDateTime)
2623
- },
2624
- model: {
2625
- value: t.state.endDateTime,
2626
- callback: function(r) {
2627
- t.$set(t.state, "endDateTime", r);
2628
- },
2629
- expression: "state.endDateTime"
2630
- }
2631
- })], 1)], 1) : t._e()], 1), n("div", {
2632
- staticClass: "tvp-search-box__bottom-btn"
2633
- }, [n("tiny-button", {
2634
- attrs: {
2635
- size: "mini"
2636
- },
2637
- on: {
2638
- click: function(r) {
2639
- return t.confirmEditTag(!1);
2640
- }
2641
- }
2642
- }, [t._v(" " + t._s(t.t("tvp.tvpSearchbox.cancel")) + " ")]), n("tiny-button", {
2643
- attrs: {
2644
- size: "mini"
2645
- },
2646
- on: {
2647
- click: function(r) {
2648
- return t.confirmEditTag(!0);
2649
- }
2650
- }
2651
- }, [t._v(" " + t._s(t.t("tvp.tvpSearchbox.confirm")) + " ")])], 1)] : n("div", {
2652
- staticClass: "tvp-search-box__panel-box"
2653
- }, [t._t(`${t.state.prevItem.slotName}-edit`, null, null, {
2654
- showDropdown: function() {
2655
- return t.showPopover(t.state);
2656
- },
2657
- onConfirm: t.handleEditConfirm
2658
- })], 2)], 2)] : t._e()], 2)], 2);
2659
- }, ca = [];
2660
- const ge = {};
2661
- var pa = /* @__PURE__ */ fe(
2662
- la,
2663
- ia,
2664
- ca,
2665
- !1,
2666
- ua,
2667
- null,
2668
- null,
2669
- null
2670
- );
2671
- function ua(a) {
2672
- for (let e in ge)
2673
- this[e] = ge[e];
2674
- }
2675
- const da = /* @__PURE__ */ function() {
2676
- return pa.exports;
2677
- }(), ma = {
2678
- ...J,
2679
- tiny_mode: {
2680
- type: String,
2681
- default: "pc"
2682
- },
2683
- /** 搜索框的值,支持v-model */
2684
- modelValue: {
2685
- type: Array,
2686
- default: () => []
2687
- },
2688
- /** 搜索项配置数组 */
2689
- items: {
2690
- type: Array,
2691
- default: () => []
2692
- },
2693
- /** 空状态时的占位符文本 */
2694
- emptyPlaceholder: {
2695
- type: String,
2696
- default: ""
2697
- },
2698
- /** 潜在选项配置 */
2699
- potentialOptions: {
2700
- type: Object,
2701
- default: () => null
2702
- },
2703
- /** 是否显示帮助按钮 */
2704
- showHelp: {
2705
- type: Boolean,
2706
- default: !0
2707
- },
2708
- /** ID映射键名 */
2709
- idMapKey: {
2710
- type: String,
2711
- default: "id"
2712
- },
2713
- /** 默认字段 */
2714
- defaultField: {
2715
- type: String,
2716
- default: ""
2717
- },
2718
- /** 是否可编辑 */
2719
- editable: {
2720
- type: Boolean,
2721
- default: !1
2722
- },
2723
- /** 最大长度限制 */
2724
- maxlength: {
2725
- type: Number,
2726
- default: void 0
2727
- },
2728
- /** 面板最大高度 */
2729
- panelMaxHeight: {
2730
- type: String,
2731
- default: "999px"
2732
- },
2733
- /** 输入值分隔符 */
2734
- splitInputValue: {
2735
- type: String,
2736
- default: ","
2737
- },
2738
- /** 自定义类名 */
2739
- customClass: {
2740
- type: String,
2741
- default: ""
2742
- },
2743
- /** 自定义样式 */
2744
- customStyle: {
2745
- type: Object,
2746
- default: () => ({})
2747
- },
2748
- /** 组件尺寸 */
2749
- size: {
2750
- type: String,
2751
- default: ""
2752
- }
2753
- }, Y = X({
2754
- name: pe + "SearchBox",
2755
- props: ma,
2756
- ...da
2757
- }), fa = "3.27.0";
2758
- Y.install = function(a) {
2759
- a.component(Y.name, Y);
2760
- };
2761
- Y.version = fa;
2762
- window && typeof window < "u" && window.Vue && Y.install(window.Vue);
2763
- export {
2764
- Xt as TinySearchBoxFirstLevelPanel,
2765
- oa as TinySearchBoxSecondLevelPanel,
2766
- Y as default,
2767
- Le as enUS,
2768
- $t as setGlobalApp,
2769
- N as t,
2770
- Ee as zhCN
2771
- };
2772
- //# sourceMappingURL=index.es.js.map