@topvisor/ui 1.1.0-apiClient.14 → 1.1.0-apiClient.26

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.
@@ -1,12 +1,12 @@
1
1
  import { Core as x } from "../core/app.js";
2
- import { defineComponent as L, ref as B, computed as P, createElementBlock as y, openBlock as p, normalizeClass as I, createCommentVNode as A, createElementVNode as _, toDisplayString as $, createVNode as O, withKeys as G, withModifiers as N, createBlock as w, createSlots as U, withCtx as V, createTextVNode as S, watch as E, toRef as D, mergeProps as R, mergeModels as J, useModel as Y, Fragment as z, renderList as F, withDirectives as q, vModelRadio as te, resolveDirective as oe, unref as v, renderSlot as W, resolveDynamicComponent as le } from "vue";
3
- import { w as se, _ as X, f as ae, d as re, u as ne, C as Q, x as ie, g as ue } from "../.chunks/forms-t2AEUjqg.es.js";
4
- import { TopPopup as de, TopPopupListItem as H, TopPopupWidgetInput as pe } from "../popup/popup.js";
2
+ import { defineComponent as M, ref as B, computed as R, createElementBlock as v, openBlock as d, normalizeClass as _, createCommentVNode as $, createElementVNode as S, toDisplayString as V, createVNode as D, withKeys as G, withModifiers as N, createBlock as I, createSlots as H, withCtx as w, createTextVNode as E, watch as P, toRef as O, mergeProps as U, mergeModels as J, useModel as Y, Fragment as z, renderList as q, withDirectives as Z, vModelRadio as te, resolveDirective as oe, unref as f, renderSlot as W, resolveDynamicComponent as le } from "vue";
3
+ import { w as se, _ as X, f as ae, d as re, u as ne, C as j, x as ie, g as ue } from "../.chunks/forms-t2AEUjqg.es.js";
4
+ import { TopPopup as de, TopPopupListItem as F, TopPopupWidgetInput as pe } from "../popup/popup.js";
5
5
  import { invertKeyboardLayout as ce } from "../utils/keyboard.js";
6
6
  import { _ as fe } from "../.chunks/menu.vue_vue_type_style_index_0_lang-6kqWYFuX.es.js";
7
- const ee = ["../assets/formsExt.css"].map((l) => import.meta.resolve(l));
7
+ const ee = ["../assets/formsExt.css"].map((a) => import.meta.resolve(a));
8
8
  x.insertCSSLinkToPage(ee, !0);
9
- const me = { class: "top-editArea_footer" }, ve = /* @__PURE__ */ L({
9
+ const me = { class: "top-editArea_footer" }, ve = /* @__PURE__ */ M({
10
10
  __name: "editArea",
11
11
  props: {
12
12
  defaultValue: { default: "" },
@@ -31,94 +31,94 @@ const me = { class: "top-editArea_footer" }, ve = /* @__PURE__ */ L({
31
31
  maxLength: {}
32
32
  },
33
33
  emits: ["submit", "close", "clickOnTitle"],
34
- setup(l, { emit: t }) {
35
- const s = l, o = t, d = B(s.defaultValue), a = B(s.isFocused), r = P(() => d.value !== s.defaultValue), c = (u) => {
36
- o("submit", u), d.value = s.defaultValue;
37
- }, f = () => {
38
- if (s.forceShowCloseBtn && !r.value) {
34
+ setup(a, { emit: e }) {
35
+ const l = a, o = e, u = B(l.defaultValue), s = B(l.isFocused), r = R(() => u.value !== l.defaultValue), p = (i) => {
36
+ o("submit", i), u.value = l.defaultValue;
37
+ }, c = () => {
38
+ if (l.forceShowCloseBtn && !r.value) {
39
39
  o("close");
40
40
  return;
41
41
  }
42
- d.value = s.defaultValue;
43
- }, k = () => {
44
- s.attachToKeyboard && o("clickOnTitle");
42
+ u.value = l.defaultValue;
43
+ }, C = () => {
44
+ l.attachToKeyboard && o("clickOnTitle");
45
45
  };
46
- return (u, b) => (p(), y("div", {
47
- class: I({
46
+ return (i, y) => (d(), v("div", {
47
+ class: _({
48
48
  "top-editArea": !0,
49
- "top-editArea-attachedToKeyboard": u.attachToKeyboard
49
+ "top-editArea-attachedToKeyboard": i.attachToKeyboard
50
50
  })
51
51
  }, [
52
- u.title ? (p(), y("div", {
52
+ i.title ? (d(), v("div", {
53
53
  key: 0,
54
54
  class: "top-editArea_title",
55
- onClick: b[0] || (b[0] = (i) => k())
56
- }, $(u.title), 1)) : A("", !0),
57
- _("div", {
58
- class: I({
55
+ onClick: y[0] || (y[0] = (T) => C())
56
+ }, V(i.title), 1)) : $("", !0),
57
+ S("div", {
58
+ class: _({
59
59
  "top-editArea_form": !0,
60
60
  "top-forms-focusable": !0,
61
61
  "top-as-input": !0,
62
- "top-error": u.isError,
63
- "top-focus": a.value
62
+ "top-error": i.isError,
63
+ "top-focus": s.value
64
64
  })
65
65
  }, [
66
- O(se, {
67
- modelValue: d.value,
68
- "onUpdate:modelValue": b[1] || (b[1] = (i) => d.value = i),
69
- name: u.name,
70
- placeholder: u.placeholder,
71
- rows: u.rows,
72
- minHeight: u.minHeight,
73
- expandable: u.expandable,
74
- disabled: u.disabled,
75
- readonly: u.readonly,
76
- isError: u.isError,
77
- hint: u.hint,
66
+ D(se, {
67
+ modelValue: u.value,
68
+ "onUpdate:modelValue": y[1] || (y[1] = (T) => u.value = T),
69
+ name: i.name,
70
+ placeholder: i.placeholder,
71
+ rows: i.rows,
72
+ minHeight: i.minHeight,
73
+ expandable: i.expandable,
74
+ disabled: i.disabled,
75
+ readonly: i.readonly,
76
+ isError: i.isError,
77
+ hint: i.hint,
78
78
  class: "top-editArea_element",
79
- onFocus: b[2] || (b[2] = () => a.value = !0),
80
- onBlur: b[3] || (b[3] = () => a.value = !1),
79
+ onFocus: y[2] || (y[2] = () => s.value = !0),
80
+ onBlur: y[3] || (y[3] = () => s.value = !1),
81
81
  onKeyup: [
82
- G(f, ["esc"]),
83
- b[4] || (b[4] = G(N((i) => c(d.value), ["ctrl"]), ["enter"]))
82
+ G(c, ["esc"]),
83
+ y[4] || (y[4] = G(N((T) => p(u.value), ["ctrl"]), ["enter"]))
84
84
  ]
85
85
  }, null, 8, ["modelValue", "name", "placeholder", "rows", "minHeight", "expandable", "disabled", "readonly", "isError", "hint"]),
86
- _("div", me, [
87
- r.value || u.forceShowCloseBtn ? (p(), w(X, {
86
+ S("div", me, [
87
+ r.value || i.forceShowCloseBtn ? (d(), I(X, {
88
88
  key: 0,
89
- icon: u.$core.state.isMobile ? "" : "",
89
+ icon: i.$core.state.isMobile ? "" : "",
90
90
  class: "top-editArea_button",
91
91
  color: "theme",
92
92
  styling: "soft",
93
- onClick: f
94
- }, U({ _: 2 }, [
95
- u.$core.state.isMobile ? void 0 : {
93
+ onClick: c
94
+ }, H({ _: 2 }, [
95
+ i.$core.state.isMobile ? void 0 : {
96
96
  name: "default",
97
- fn: V(() => [
98
- S($(u.cancelText), 1)
97
+ fn: w(() => [
98
+ E(V(i.cancelText), 1)
99
99
  ]),
100
100
  key: "0"
101
101
  }
102
- ]), 1032, ["icon"])) : A("", !0),
103
- r.value ? (p(), w(X, {
102
+ ]), 1032, ["icon"])) : $("", !0),
103
+ r.value ? (d(), I(X, {
104
104
  key: 1,
105
105
  class: "top-editArea_button",
106
- icon: u.$core.state.isMobile ? "" : "",
107
- onClick: b[5] || (b[5] = (i) => c(d.value))
108
- }, U({ _: 2 }, [
109
- u.$core.state.isMobile ? void 0 : {
106
+ icon: i.$core.state.isMobile ? "" : "",
107
+ onClick: y[5] || (y[5] = (T) => p(u.value))
108
+ }, H({ _: 2 }, [
109
+ i.$core.state.isMobile ? void 0 : {
110
110
  name: "default",
111
- fn: V(() => [
112
- S($(u.submitText), 1)
111
+ fn: w(() => [
112
+ E(V(i.submitText), 1)
113
113
  ]),
114
114
  key: "0"
115
115
  }
116
- ]), 1032, ["icon"])) : A("", !0)
116
+ ]), 1032, ["icon"])) : $("", !0)
117
117
  ])
118
118
  ], 2)
119
119
  ], 2));
120
120
  }
121
- }), ye = { class: "top-editInput" }, he = /* @__PURE__ */ L({
121
+ }), ye = { class: "top-editInput" }, he = /* @__PURE__ */ M({
122
122
  __name: "editInput",
123
123
  props: {
124
124
  modelValue: {},
@@ -126,32 +126,32 @@ const me = { class: "top-editArea_footer" }, ve = /* @__PURE__ */ L({
126
126
  button: {}
127
127
  },
128
128
  emits: ["update:modelValue"],
129
- setup(l, { emit: t }) {
130
- const s = l, o = B(s.modelValue);
131
- E(D(s.modelValue), () => {
132
- o.value = s.modelValue;
129
+ setup(a, { emit: e }) {
130
+ const l = a, o = B(l.modelValue);
131
+ P(O(l.modelValue), () => {
132
+ o.value = l.modelValue;
133
133
  });
134
- const d = t, a = () => {
135
- d("update:modelValue", o.value);
134
+ const u = e, s = () => {
135
+ u("update:modelValue", o.value);
136
136
  };
137
- return (r, c) => (p(), y("div", ye, [
138
- O(ae, R(r.input, {
139
- onKeydownCapture: c[0] || (c[0] = G(N((f) => o.value = r.modelValue, ["stop"]), ["esc"])),
140
- onKeydown: G(N(a, ["stop"]), ["enter"]),
137
+ return (r, p) => (d(), v("div", ye, [
138
+ D(ae, U(r.input, {
139
+ onKeydownCapture: p[0] || (p[0] = G(N((c) => o.value = r.modelValue, ["stop"]), ["esc"])),
140
+ onKeydown: G(N(s, ["stop"]), ["enter"]),
141
141
  modelValue: o.value,
142
- "onUpdate:modelValue": c[1] || (c[1] = (f) => o.value = f)
142
+ "onUpdate:modelValue": p[1] || (p[1] = (c) => o.value = c)
143
143
  }), null, 16, ["onKeydown", "modelValue"]),
144
- o.value !== r.modelValue ? (p(), w(X, R({
144
+ o.value !== r.modelValue ? (d(), I(X, U({
145
145
  key: 0,
146
146
  icon: "",
147
147
  styling: "soft"
148
- }, r.button, { onClick: a }), null, 16)) : A("", !0)
148
+ }, r.button, { onClick: s }), null, 16)) : $("", !0)
149
149
  ]));
150
150
  }
151
151
  }), be = ["data-top-icon", "onClick"], ge = {
152
152
  key: 0,
153
153
  class: "top-radioGroup_circle"
154
- }, Te = ["value", "disabled"], ke = /* @__PURE__ */ L({
154
+ }, Te = ["value", "disabled"], ke = /* @__PURE__ */ M({
155
155
  __name: "radioGroup",
156
156
  props: /* @__PURE__ */ J({
157
157
  modelValue: {},
@@ -166,51 +166,51 @@ const me = { class: "top-editArea_footer" }, ve = /* @__PURE__ */ L({
166
166
  modelModifiers: {}
167
167
  }),
168
168
  emits: ["update:modelValue"],
169
- setup(l) {
170
- const t = Y(l, "modelValue"), s = l, o = B(null);
171
- E(t, () => {
172
- var a, r, c, f, k;
173
- (a = s.radiosProps) != null && a.some((u) => u.value === t.value) || (t.value = ((c = (r = s.radiosProps) == null ? void 0 : r[0]) == null ? void 0 : c.value) ?? ""), (k = (f = o.value) == null ? void 0 : f.querySelector(".radioGroup_item-selected")) == null || k.scrollIntoView();
169
+ setup(a) {
170
+ const e = Y(a, "modelValue"), l = a, o = B(null);
171
+ P(e, () => {
172
+ var s, r, p, c, C;
173
+ (s = l.radiosProps) != null && s.some((i) => i.value === e.value) || (e.value = ((p = (r = l.radiosProps) == null ? void 0 : r[0]) == null ? void 0 : p.value) ?? ""), (C = (c = o.value) == null ? void 0 : c.querySelector(".radioGroup_item-selected")) == null || C.scrollIntoView();
174
174
  }, { immediate: !0 });
175
- const d = "radioGroup-" + Math.random();
176
- return (a, r) => (p(), y("div", {
175
+ const u = "radioGroup-" + Math.random();
176
+ return (s, r) => (d(), v("div", {
177
177
  ref_key: "elRef",
178
178
  ref: o,
179
- class: I({
179
+ class: _({
180
180
  "top-radioGroup": !0,
181
181
  "top-scrollBarXHidding": !0,
182
- ["top-size_" + a.size]: !!a.size,
183
- "top-error": a.isError
182
+ ["top-size_" + s.size]: !!s.size,
183
+ "top-error": s.isError
184
184
  })
185
185
  }, [
186
- (p(!0), y(z, null, F(a.radiosProps, (c) => (p(), y("label", {
187
- class: I({
188
- "top-radioGroup_item-selected": c.value === t.value,
186
+ (d(!0), v(z, null, q(s.radiosProps, (p) => (d(), v("label", {
187
+ class: _({
188
+ "top-radioGroup_item-selected": p.value === e.value,
189
189
  "top-radioGroup_item": !0,
190
190
  "top-forms-focusable": !0,
191
- "top-disabled": c.disabled
191
+ "top-disabled": p.disabled
192
192
  }),
193
- "data-top-icon": c.icon,
194
- onClick: (f) => t.value = c.value
193
+ "data-top-icon": p.icon,
194
+ onClick: (c) => e.value = p.value
195
195
  }, [
196
- S($(c.title) + " ", 1),
197
- a.showIndicator ? (p(), y("span", ge)) : A("", !0),
198
- q(_("input", {
199
- "onUpdate:modelValue": r[0] || (r[0] = (f) => t.value = f),
200
- name: d,
196
+ E(V(p.title) + " ", 1),
197
+ s.showIndicator ? (d(), v("span", ge)) : $("", !0),
198
+ Z(S("input", {
199
+ "onUpdate:modelValue": r[0] || (r[0] = (c) => e.value = c),
200
+ name: u,
201
201
  type: "radio",
202
- class: I({
202
+ class: _({
203
203
  "top-unvisible": !0
204
204
  }),
205
- value: c.value,
206
- disabled: c.disabled
205
+ value: p.value,
206
+ disabled: p.disabled
207
207
  }, null, 8, Te), [
208
- [te, t.value]
208
+ [te, e.value]
209
209
  ])
210
210
  ], 10, be))), 256))
211
211
  ], 2));
212
212
  }
213
- }), Ae = ["data-top-icon"], Ce = ["value", "checked", "disabled", "onChange"], $e = /* @__PURE__ */ L({
213
+ }), Ae = ["data-top-icon"], Ce = ["value", "checked", "disabled", "onChange"], $e = /* @__PURE__ */ M({
214
214
  __name: "checkboxGroup",
215
215
  props: /* @__PURE__ */ J({
216
216
  modelValue: {},
@@ -225,13 +225,13 @@ const me = { class: "top-editArea_footer" }, ve = /* @__PURE__ */ L({
225
225
  modelModifiers: {}
226
226
  }),
227
227
  emits: ["update:modelValue"],
228
- setup(l) {
229
- const t = Y(l, "modelValue"), s = (o) => {
230
- const d = [...t.value], a = d.indexOf(o);
231
- a === -1 ? d.push(o) : d.splice(a, 1), t.value = d;
228
+ setup(a) {
229
+ const e = Y(a, "modelValue"), l = (o) => {
230
+ const u = [...e.value], s = u.indexOf(o);
231
+ s === -1 ? u.push(o) : u.splice(s, 1), e.value = u;
232
232
  };
233
- return (o, d) => (p(), y("div", {
234
- class: I({
233
+ return (o, u) => (d(), v("div", {
234
+ class: _({
235
235
  "top-checkboxGroup": !0,
236
236
  ["top-checkboxGroup-" + o.styling]: !0,
237
237
  "top-scrollBarXHidding": !0,
@@ -239,137 +239,143 @@ const me = { class: "top-editArea_footer" }, ve = /* @__PURE__ */ L({
239
239
  "top-error": o.isError
240
240
  })
241
241
  }, [
242
- (p(!0), y(z, null, F(o.items, (a) => (p(), y("label", {
243
- key: a.id,
244
- class: I({
242
+ (d(!0), v(z, null, q(o.items, (s) => (d(), v("label", {
243
+ key: s.id,
244
+ class: _({
245
245
  "top-checkboxGroup_item": !0,
246
- "top-checkboxGroup_item-selected": t.value.includes(a.id),
246
+ "top-checkboxGroup_item-selected": e.value.includes(s.id),
247
247
  "top-forms-focusable": !0,
248
- "top-disabled": a.disabled
248
+ "top-disabled": s.disabled
249
249
  }),
250
- "data-top-icon": a.icon
250
+ "data-top-icon": s.icon
251
251
  }, [
252
- _("input", {
252
+ S("input", {
253
253
  type: "checkbox",
254
254
  class: "top-unvisible",
255
- value: a.id,
256
- checked: t.value.includes(a.id),
257
- disabled: a.disabled,
258
- onChange: (r) => s(a.id)
255
+ value: s.id,
256
+ checked: e.value.includes(s.id),
257
+ disabled: s.disabled,
258
+ onChange: (r) => l(s.id)
259
259
  }, null, 40, Ce),
260
- S(" " + $(a.title), 1)
260
+ E(" " + V(s.title), 1)
261
261
  ], 10, Ae))), 128))
262
262
  ], 2));
263
263
  }
264
- }), Ve = { class: "top-selector2_itemMulti top-ellipsis" }, we = /* @__PURE__ */ L({
264
+ }), Ve = { class: "top-selector2_itemMulti top-ellipsis" }, we = /* @__PURE__ */ M({
265
265
  __name: "itemMulti",
266
266
  props: {
267
267
  id: {},
268
268
  name: {}
269
269
  },
270
270
  emits: ["delete"],
271
- setup(l) {
272
- return (t, s) => (p(), y("div", Ve, [
273
- S($(t.name) + " ", 1),
274
- _("span", {
271
+ setup(a) {
272
+ return (e, l) => (d(), v("div", Ve, [
273
+ E(V(e.name) + " ", 1),
274
+ S("span", {
275
275
  class: "top-selector2_itemMultiDelete",
276
276
  "data-top-icon": "",
277
- onClick: s[0] || (s[0] = (o) => t.$emit("delete", t.id)),
278
- onMousedown: s[1] || (s[1] = N(() => {
277
+ onClick: l[0] || (l[0] = (o) => e.$emit("delete", e.id)),
278
+ onMousedown: l[1] || (l[1] = N(() => {
279
279
  }, ["stop"]))
280
280
  }, null, 32)
281
281
  ]));
282
282
  }
283
- }), Ie = (l, t, s) => {
284
- const o = B([]), d = B(!1);
285
- let a = "", r;
286
- l && !l.params.limit && (l.params.limit = 100);
287
- const c = async () => {
288
- if (!l) return;
289
- let i, C;
290
- if (s && (l.cache ??= /* @__PURE__ */ new Map(), C = JSON.stringify(l.params), i = l.cache.get(C), i))
291
- return i;
292
- if (d.value = !0, i = await l.call(), d.value = !1, i.errors) return;
293
- if (!Array.isArray(i.result)) {
294
- console.warn("В result ожидался массив");
283
+ }), Ie = (a, e, l, o) => {
284
+ const u = B([]), s = /* @__PURE__ */ new Map(), r = B(!1);
285
+ let p = "", c;
286
+ a && !a.params.limit && (a.params.limit = 100);
287
+ const C = async () => {
288
+ if (!a) return;
289
+ let h;
290
+ if (o) {
291
+ h = JSON.stringify(a.params);
292
+ const L = s.get(h);
293
+ if (L)
294
+ return L;
295
+ }
296
+ r.value = !0;
297
+ const g = await a.call();
298
+ if (r.value = !1, g.errors) return;
299
+ if (!Array.isArray(g.result)) {
300
+ console.warn("Array expected in `res.result`");
295
301
  return;
296
302
  }
297
- const M = i.result.findIndex((K) => K.id === void 0 || K.name === void 0);
298
- if (M !== -1) {
299
- console.warn(`В result[${M}] нет id или name`);
303
+ const K = g.result.findIndex((L) => L.id === void 0 || L.name === void 0);
304
+ if (K !== -1) {
305
+ console.warn(`В result[${K}] нет id или name`);
300
306
  return;
301
307
  }
302
- return s && l.cache.set(C, i), i;
303
- }, f = async () => {
304
- if (!l) return;
305
- l.params.offset = 0, l.params.search = a;
306
- const i = await c();
307
- i && (r = i.nextOffset, o.value = i.result);
308
- }, k = async () => {
309
- if (!l || !r || d.value) return;
310
- l.params.offset = r, l.params.search = a;
311
- const i = await c();
312
- i && (r = i.nextOffset, o.value = o.value.concat(i.result));
313
- }, u = re(() => f(), 200);
308
+ return h && s.set(h, g), g;
309
+ }, i = async (h) => {
310
+ if (!a) return;
311
+ if (h) {
312
+ if (!c || r.value) return;
313
+ a.params.offset = c;
314
+ } else
315
+ a.params.offset = 0;
316
+ e == null || e(p);
317
+ const g = await C();
318
+ g && (c = g.nextOffset, h ? u.value = u.value.concat(g.result) : u.value = g.result);
319
+ }, y = re(() => i(!1), 200);
314
320
  return {
315
- apiRequest: l,
316
- items: o,
317
- isLoading: d,
318
- loadAppend: k,
319
- setSearchTextAndLoad: (i, C = !0) => {
320
- l && (i.length < t || i === a && o.value.length || (a = i, C ? u() : f()));
321
+ apiRequest: a,
322
+ items: u,
323
+ isLoading: r,
324
+ load: i,
325
+ setSearchTextAndLoad: (h, g = !0) => {
326
+ a && (h.length < l || h === p && u.value.length || (p = h, g ? y() : i(!1)));
321
327
  }
322
328
  };
323
- }, Be = 0, Z = (l, t, s = !0) => s && t.id === null ? Array.isArray(l) ? l.some((o) => o.id === t.id && o.name === t.name) : t.name === l.name : Array.isArray(l) ? l.some((o) => o.id === t.id) : t.id === l.id, _e = (l, t, s, o, d, a, r, c) => {
324
- const f = B(""), k = {
325
- id: Be,
329
+ }, _e = 0, Q = (a, e, l = !0) => l && e.id === null ? Array.isArray(a) ? a.some((o) => o.id === e.id && o.name === e.name) : e.name === a.name : Array.isArray(a) ? a.some((o) => o.id === e.id) : e.id === a.id, Be = (a, e, l, o, u, s, r, p) => {
330
+ const c = B(""), C = {
331
+ id: _e,
326
332
  name: ne().Common.All
327
- }, u = () => {
328
- f.value = "", c.items.value = [];
329
- }, b = () => !(!c.apiRequest || a.value !== "inline" || f.value.length >= r), i = P(() => {
330
- var e;
331
- const h = [];
332
- return !s && o.value && h.push(k), (e = t.value) == null || e.forEach((n) => h.push({ ...n })), h;
333
- }), C = P(() => {
334
- const h = f.value.toLowerCase(), e = ce(h);
333
+ }, i = () => {
334
+ c.value = "", p.items.value = [];
335
+ }, y = () => !(!p.apiRequest || s.value !== "inline" || c.value.length >= r), T = R(() => {
336
+ var t;
337
+ const b = [];
338
+ return !l && o.value && b.push(C), (t = e.value) == null || t.forEach((n) => b.push({ ...n })), b;
339
+ }), h = R(() => {
340
+ const b = c.value.toLowerCase(), t = ce(b);
335
341
  let n = [];
336
- return i.value.forEach((g) => {
337
- const m = g.name.toLowerCase();
338
- (g.id === Number(h) || m.includes(h) || m.includes(e)) && (m === h || m === e ? n.unshift(g) : n.push(g));
339
- }), n.push(...c.items.value), d.value && f.value && (!n.length || n[0].name.toLowerCase() !== h) && n.push({
342
+ return T.value.forEach((k) => {
343
+ const m = k.name.toLowerCase();
344
+ (k.id === Number(b) || m.includes(b) || m.includes(t)) && (m === b || m === t ? n.unshift(k) : n.push(k));
345
+ }), n.push(...p.items.value), u.value && c.value && (!n.length || n[0].name.toLowerCase() !== b) && n.push({
340
346
  id: null,
341
- name: f.value
342
- }), s && (n = n.filter((g) => !Z(l.value, g))), n;
347
+ name: c.value
348
+ }), l && (n = n.filter((k) => !Q(a.value, k))), n;
343
349
  });
344
350
  return {
345
- searchText: f,
346
- resetSearch: u,
347
- genIsShort: b,
348
- items: i,
349
- itemsForShow: C,
350
- selectItem: (h) => {
351
- s && Array.isArray(l.value) ? Z(l.value, h) || (l.value = [...l.value, h]) : l.value = h;
351
+ searchText: c,
352
+ resetSearch: i,
353
+ genIsShort: y,
354
+ items: T,
355
+ itemsForShow: h,
356
+ selectItem: (b) => {
357
+ l && Array.isArray(a.value) ? Q(a.value, b) || (a.value = [...a.value, b]) : a.value = b;
352
358
  },
353
359
  selectNextItem: () => {
354
- if (!Array.isArray(l.value)) {
355
- const e = (C.value.findIndex((n) => n.id === l.value.id) + 1) % C.value.length;
356
- l.value = { ...C.value[e] };
360
+ if (!Array.isArray(a.value)) {
361
+ const t = (h.value.findIndex((n) => n.id === a.value.id) + 1) % h.value.length;
362
+ a.value = { ...h.value[t] };
357
363
  }
358
364
  },
359
- deleteItemById: async (h) => {
360
- Array.isArray(l.value) && (l.value = l.value.filter((e) => e.id !== h));
365
+ deleteItemById: async (b) => {
366
+ Array.isArray(a.value) && (a.value = a.value.filter((t) => t.id !== b));
361
367
  }
362
368
  };
363
- }, Se = {
369
+ }, Le = {
364
370
  key: 0,
365
371
  class: "top-selector2_activeItems"
366
- }, Le = {
372
+ }, Se = {
367
373
  key: 1,
368
374
  class: "top-selector2_activeName top-ellipsis"
369
375
  }, Ee = {
370
376
  key: 2,
371
377
  class: "top-selector2_placeholder top-ellipsis"
372
- }, Pe = /* @__PURE__ */ L({
378
+ }, Me = /* @__PURE__ */ M({
373
379
  __name: "selector2",
374
380
  props: /* @__PURE__ */ J({
375
381
  modelValue: {},
@@ -381,7 +387,8 @@ const me = { class: "top-editArea_footer" }, ve = /* @__PURE__ */ L({
381
387
  isError: { type: Boolean },
382
388
  searchType: { default: "popup" },
383
389
  placeholder: {},
384
- apiRequest: {},
390
+ api: {},
391
+ apiSetSearchParams: {},
385
392
  minLength: { default: 0 },
386
393
  useCache: { type: Boolean },
387
394
  appendSearchToResult: { type: Boolean },
@@ -395,39 +402,39 @@ const me = { class: "top-editArea_footer" }, ve = /* @__PURE__ */ L({
395
402
  modelModifiers: {}
396
403
  }),
397
404
  emits: ["update:modelValue"],
398
- setup(l) {
399
- const t = l, s = Y(l, "modelValue"), o = P(() => t.searchType === "inline" && t.multiselect || t.searchType === "inline" && Q.state.isMobile ? "popup" : t.searchType);
400
- let d = 0;
401
- o.value === "inline" && t.minLength && (d = t.minLength);
402
- const a = Ie(t.apiRequest, d, t.useCache), r = _e(
403
- s,
404
- D(t, "items"),
405
- t.multiselect,
406
- D(t, "appendAllValue"),
407
- D(t, "appendSearchToResult"),
405
+ setup(a) {
406
+ const e = a, l = Y(a, "modelValue"), o = R(() => e.searchType === "inline" && e.multiselect || e.searchType === "inline" && j.state.isMobile ? "popup" : e.searchType);
407
+ let u = 0;
408
+ o.value === "inline" && e.minLength && (u = e.minLength);
409
+ const s = Ie(e.api, e.apiSetSearchParams, u, e.useCache), r = Be(
410
+ l,
411
+ O(e, "items"),
412
+ e.multiselect,
413
+ O(e, "appendAllValue"),
414
+ O(e, "appendSearchToResult"),
408
415
  o,
409
- d,
410
- a
411
- ), c = P(() => t.buttonProps ? "TopButton" : o.value === "inline" ? "TopInput" : "div"), f = B(null), k = () => {
412
- var e;
413
- return (e = f.value) == null ? void 0 : e.popup;
416
+ u,
417
+ s
418
+ ), p = R(() => e.buttonProps ? "TopButton" : o.value === "inline" ? "TopInput" : "div"), c = B(null), C = () => {
419
+ var t;
420
+ return (t = c.value) == null ? void 0 : t.popup;
414
421
  };
415
- a.apiRequest && E(r.searchText, () => {
416
- var e;
417
- a.setSearchTextAndLoad(r.searchText.value), o.value === "inline" && r.genIsShort() && ((e = k()) == null || e.close());
418
- }), E(s, () => {
422
+ s.apiRequest && P(r.searchText, () => {
423
+ var t;
424
+ s.setSearchTextAndLoad(r.searchText.value), o.value === "inline" && r.genIsShort() && ((t = C()) == null || t.close());
425
+ }), P(l, () => {
419
426
  o.value === "inline" && r.resetSearch();
420
427
  });
421
- const u = P(() => {
422
- var e;
423
- return Array.isArray(s.value) || t.multiselect || !t.selectedAsPlaceholder && o.value !== "inline" ? t.placeholder : ((e = s.value) == null ? void 0 : e.name) || t.placeholder;
424
- }), b = (e) => {
425
- var m, T;
428
+ const i = R(() => {
429
+ var t;
430
+ return Array.isArray(l.value) || e.multiselect || !e.selectedAsPlaceholder && o.value !== "inline" ? e.placeholder : ((t = l.value) == null ? void 0 : t.name) || e.placeholder;
431
+ }), y = (t) => {
432
+ var m, A;
426
433
  let n = !1;
427
- switch (e.key) {
434
+ switch (t.key) {
428
435
  case "Delete":
429
436
  case "Backspace":
430
- Array.isArray(s.value) && (e.preventDefault(), e.stopPropagation(), s.value.pop());
437
+ Array.isArray(l.value) && (t.preventDefault(), t.stopPropagation(), l.value.pop());
431
438
  break;
432
439
  case "ArrowUp":
433
440
  case "ArrowRight":
@@ -441,172 +448,172 @@ const me = { class: "top-editArea_footer" }, ve = /* @__PURE__ */ L({
441
448
  o.value === "inline" && r.resetSearch();
442
449
  break;
443
450
  }
444
- const g = e.key.length === 1 && !e.ctrlKey && !e.metaKey;
445
- (o.value === "popup" || o.value === "inline") && g && (n = !0), (m = k()) != null && m.elPopup && (n = !1), n && (o.value === "popup" && (e.preventDefault(), e.stopPropagation(), g && (r.searchText.value || (r.searchText.value = e.key))), (T = e.currentTarget) == null || T.click());
451
+ const k = t.key.length === 1 && !t.ctrlKey && !t.metaKey;
452
+ (o.value === "popup" || o.value === "inline") && k && (n = !0), (m = C()) != null && m.elPopup && (n = !1), n && (o.value === "popup" && (t.preventDefault(), t.stopPropagation(), k && (r.searchText.value || (r.searchText.value = t.key))), (A = t.currentTarget) == null || A.click());
446
453
  };
447
- let i = !1;
448
- const C = (e) => {
454
+ let T = !1;
455
+ const h = (t) => {
449
456
  var n;
450
- i || o.value === "inline" && ((n = e.currentTarget) == null || n.click());
451
- }, M = (e) => {
452
- var n, g;
453
- e.preventDefault(), i = !0, (g = (n = e.currentTarget) == null ? void 0 : n.parentElement) == null || g.focus(), i = !1, r.selectNextItem();
457
+ T || o.value === "inline" && ((n = t.currentTarget) == null || n.click());
458
+ }, g = (t) => {
459
+ var n, k;
460
+ t.preventDefault(), T = !0, (k = (n = t.currentTarget) == null ? void 0 : n.parentElement) == null || k.focus(), T = !1, r.selectNextItem();
454
461
  }, K = () => {
455
- var e;
456
- if (i = !0, a.apiRequest) {
462
+ var t;
463
+ if (T = !0, s.apiRequest) {
457
464
  if (r.genIsShort()) {
458
- (e = k()) == null || e.close();
465
+ (t = C()) == null || t.close();
459
466
  return;
460
467
  }
461
- a.setSearchTextAndLoad(r.searchText.value, !1);
468
+ s.setSearchTextAndLoad(r.searchText.value, !1);
462
469
  }
463
- }, j = () => {
470
+ }, L = () => {
464
471
  setTimeout(() => {
465
- i = !1;
472
+ T = !1;
466
473
  }, 100), o.value === "popup" && r.searchText.value && r.resetSearch();
467
- }, h = (e) => {
468
- const n = e.target;
469
- n.scrollTop / (n.scrollHeight - n.offsetHeight) > 0.8 && a.loadAppend();
474
+ }, b = (t) => {
475
+ const n = t.target;
476
+ n.scrollTop / (n.scrollHeight - n.offsetHeight) > 0.8 && s.load(!0);
470
477
  };
471
- return window.__STORYBOOK_PREVIEW__ && (E(
472
- () => t.multiselect,
478
+ return window.__STORYBOOK_PREVIEW__ && (P(
479
+ () => e.multiselect,
473
480
  () => {
474
- t.multiselect ? Array.isArray(s.value) || (s.value = [
481
+ e.multiselect ? Array.isArray(l.value) || (l.value = [
475
482
  {
476
483
  id: 1,
477
484
  name: "Выбери меня"
478
485
  }
479
- ]) : Array.isArray(s.value) && (s.value = {
486
+ ]) : Array.isArray(l.value) && (l.value = {
480
487
  id: null,
481
488
  name: ""
482
489
  });
483
490
  },
484
491
  { immediate: !0 }
485
- ), E(
486
- () => t.searchType,
492
+ ), P(
493
+ () => e.searchType,
487
494
  () => {
488
495
  setTimeout(() => {
489
496
  location.reload();
490
497
  }, 500);
491
498
  }
492
- )), (e, n) => {
493
- const g = oe("top-focus");
494
- return p(), w(v(de), {
499
+ )), (t, n) => {
500
+ const k = oe("top-focus");
501
+ return d(), I(f(de), {
495
502
  ref_key: "popupRef",
496
- ref: f,
503
+ ref: c,
497
504
  onOpen: n[3] || (n[3] = (m) => K()),
498
- onClose: n[4] || (n[4] = (m) => j()),
499
- onScrollContentList: n[5] || (n[5] = (m) => e.apiRequest ? h(m) : void 0),
505
+ onClose: n[4] || (n[4] = (m) => L()),
506
+ onScrollContentList: n[5] || (n[5] = (m) => f(s) ? b(m) : void 0),
500
507
  notch: o.value !== "inline",
501
508
  transitionDuration: 0
502
- }, U({
503
- opener: V(() => [
504
- q((p(), w(le(c.value), R(e.buttonProps, {
509
+ }, H({
510
+ opener: w(() => [
511
+ Z((d(), I(le(p.value), U(t.buttonProps, {
505
512
  ref: "subcomponentSelector",
506
513
  class: {
507
514
  "top-selector2": !0,
508
- "top-selector2-multiselect": e.multiselect,
509
- ["top-selector2-" + e.modificator]: !!e.modificator,
510
- "top-as-input": !e.buttonProps,
515
+ "top-selector2-multiselect": t.multiselect,
516
+ ["top-selector2-" + t.modificator]: !!t.modificator,
517
+ "top-as-input": !t.buttonProps,
511
518
  "top-as-selector": !0,
512
- ["top-size_" + e.size]: !0,
513
- "top-disabled": e.disabled,
514
- "top-forms-focusable": !e.disabled,
515
- "top-error": e.isError
519
+ ["top-size_" + t.size]: !0,
520
+ "top-disabled": t.disabled,
521
+ "top-forms-focusable": !t.disabled,
522
+ "top-error": t.isError
516
523
  },
517
524
  tabindex: "0",
518
- onKeydown: b,
519
- placeholder: u.value,
520
- modelValue: v(r).searchText.value,
521
- "onUpdate:modelValue": n[0] || (n[0] = (m) => v(r).searchText.value = m),
522
- onFocus: C,
525
+ onKeydown: y,
526
+ placeholder: i.value,
527
+ modelValue: f(r).searchText.value,
528
+ "onUpdate:modelValue": n[0] || (n[0] = (m) => f(r).searchText.value = m),
529
+ onFocus: h,
523
530
  onBlur: n[1] || (n[1] = (m) => {
524
- var T;
525
- return (T = k()) != null && T.isClosed ? v(r).resetSearch() : "";
531
+ var A;
532
+ return (A = C()) != null && A.isClosed ? f(r).resetSearch() : "";
526
533
  })
527
534
  }), {
528
- default: V(() => [
529
- e.multiselect ? (p(), y("div", Se, [
530
- (p(!0), y(z, null, F(s.value, (m) => (p(), w(we, {
535
+ default: w(() => [
536
+ t.multiselect ? (d(), v("div", Le, [
537
+ (d(!0), v(z, null, q(l.value, (m) => (d(), I(we, {
531
538
  id: m.id,
532
539
  name: m.name,
533
- onDelete: v(r).deleteItemById
540
+ onDelete: f(r).deleteItemById
534
541
  }, null, 8, ["id", "name", "onDelete"]))), 256))
535
- ])) : A("", !0),
536
- o.value !== "inline" && !e.multiselect ? (p(), y("span", Le, $(Array.isArray(s.value) ? "" : s.value.name), 1)) : A("", !0),
537
- e.multiselect && !s.value.length ? (p(), y("span", Ee, $(u.value), 1)) : A("", !0),
538
- e.addChanger && !e.buttonProps && !e.multiselect && v(r).items.value.length > 1 && !e.disabled ? (p(), y("span", {
542
+ ])) : $("", !0),
543
+ o.value !== "inline" && !t.multiselect ? (d(), v("span", Se, V(Array.isArray(l.value) ? "" : l.value.name), 1)) : $("", !0),
544
+ t.multiselect && !l.value.length ? (d(), v("span", Ee, V(i.value), 1)) : $("", !0),
545
+ t.addChanger && !t.buttonProps && !t.multiselect && f(r).items.value.length > 1 && !t.disabled ? (d(), v("span", {
539
546
  key: 3,
540
547
  class: "top-changer top-changer-selector top-popup_widget",
541
548
  "data-top-popup-disabled": "true",
542
- onClick: M
543
- })) : A("", !0)
549
+ onClick: g
550
+ })) : $("", !0)
544
551
  ]),
545
552
  _: 1
546
553
  }, 16, ["class", "placeholder", "modelValue"])), [
547
554
  [
548
- g,
549
- e.isError,
555
+ k,
556
+ t.isError,
550
557
  void 0,
551
558
  { onupdate: !0 }
552
559
  ]
553
560
  ])
554
561
  ]),
555
- contentList: V(() => {
562
+ contentList: w(() => {
556
563
  var m;
557
564
  return [
558
- (p(!0), y(z, null, F(v(r).itemsForShow.value, (T) => (p(), w(v(H), {
559
- class: I({
560
- "top-active": !Array.isArray(s.value) && !e.multiselect && s.value.id === T.id && s.value.name === T.name
565
+ (d(!0), v(z, null, q(f(r).itemsForShow.value, (A) => (d(), I(f(F), {
566
+ class: _({
567
+ "top-active": !Array.isArray(l.value) && !t.multiselect && l.value.id === A.id && l.value.name === A.name
561
568
  }),
562
- key: T.id ?? void 0,
563
- closeByClick: !e.multiselect || v(Q).state.isMobile,
564
- onClick: (He) => v(r).selectItem(T)
569
+ key: A.id ?? void 0,
570
+ closeByClick: !t.multiselect || f(j).state.isMobile,
571
+ onClick: (qe) => f(r).selectItem(A)
565
572
  }, {
566
- default: V(() => [
567
- e.$slots.item ? W(e.$slots, "item", {
573
+ default: w(() => [
574
+ t.$slots.item ? W(t.$slots, "item", {
568
575
  key: 0,
569
- item: T
570
- }) : (p(), y(z, { key: 1 }, [
571
- S($(T.name), 1)
576
+ item: A
577
+ }) : (d(), v(z, { key: 1 }, [
578
+ E(V(A.name), 1)
572
579
  ], 64))
573
580
  ]),
574
581
  _: 2
575
582
  }, 1032, ["class", "closeByClick", "onClick"]))), 128)),
576
- !v(a).isLoading.value && !v(r).itemsForShow.value.length ? (p(), w(v(H), {
583
+ !f(s).isLoading.value && !f(r).itemsForShow.value.length ? (d(), I(f(F), {
577
584
  key: 0,
578
585
  type: "regular"
579
586
  }, {
580
- default: V(() => [
581
- S($(e.$i18n.Common.No_results), 1)
587
+ default: w(() => [
588
+ E(V(t.$i18n.Common.No_results), 1)
582
589
  ]),
583
590
  _: 1
584
- })) : A("", !0),
585
- v(a).isLoading.value && (e.searchType !== "popup" || (m = e.apiRequest) != null && m.params.offset) ? (p(), w(v(H), {
591
+ })) : $("", !0),
592
+ f(s).isLoading.value && (t.searchType !== "popup" || (m = f(s).apiRequest) != null && m.params.offset) ? (d(), I(f(F), {
586
593
  key: 1,
587
594
  type: "regular"
588
595
  }, {
589
- default: V(() => [
590
- O(v(ie), { type: "circles" })
596
+ default: w(() => [
597
+ D(f(ie), { type: "circles" })
591
598
  ]),
592
599
  _: 1
593
- })) : A("", !0)
600
+ })) : $("", !0)
594
601
  ];
595
602
  }),
596
603
  _: 2
597
604
  }, [
598
605
  o.value === "popup" ? {
599
606
  name: "widget",
600
- fn: V(() => {
607
+ fn: w(() => {
601
608
  var m;
602
609
  return [
603
- O(v(pe), {
610
+ D(f(pe), {
604
611
  title: "Поиск",
605
612
  icon: "",
606
- modelValue: v(r).searchText.value,
607
- "onUpdate:modelValue": n[2] || (n[2] = (T) => v(r).searchText.value = T),
608
- isLoading: v(a).isLoading.value && !((m = e.apiRequest) != null && m.params.offset),
609
- placeholder: u.value
613
+ modelValue: f(r).searchText.value,
614
+ "onUpdate:modelValue": n[2] || (n[2] = (A) => f(r).searchText.value = A),
615
+ isLoading: f(s).isLoading.value && !((m = f(s).apiRequest) != null && m.params.offset),
616
+ placeholder: i.value
610
617
  }, null, 8, ["modelValue", "isLoading", "placeholder"])
611
618
  ];
612
619
  }),
@@ -615,37 +622,37 @@ const me = { class: "top-editArea_footer" }, ve = /* @__PURE__ */ L({
615
622
  ]), 1032, ["notch"]);
616
623
  };
617
624
  }
618
- }), Me = ["data-top-icon"], Ke = { class: "top-info_text" }, ze = {
625
+ }), Pe = ["data-top-icon"], Re = { class: "top-info_text" }, Ke = {
619
626
  key: 0,
620
627
  class: "top-info_value"
621
- }, Oe = /* @__PURE__ */ L({
628
+ }, ze = /* @__PURE__ */ M({
622
629
  __name: "info",
623
630
  props: {
624
631
  icon: {},
625
632
  styling: { default: "default" },
626
633
  size: { default: "default" }
627
634
  },
628
- setup(l) {
629
- return (t, s) => (p(), y("div", {
630
- class: I({
635
+ setup(a) {
636
+ return (e, l) => (d(), v("div", {
637
+ class: _({
631
638
  "top-info": !0,
632
- ["top-size_" + t.size]: !0,
633
- ["top-info-styling_" + t.styling]: !0
639
+ ["top-size_" + e.size]: !0,
640
+ ["top-info-styling_" + e.styling]: !0
634
641
  }),
635
- "data-top-icon": t.icon
642
+ "data-top-icon": e.icon
636
643
  }, [
637
- _("div", Ke, [
638
- W(t.$slots, "default")
644
+ S("div", Re, [
645
+ W(e.$slots, "default")
639
646
  ]),
640
- t.$slots.additional ? (p(), y("span", ze, [
641
- W(t.$slots, "additional")
642
- ])) : A("", !0)
643
- ], 10, Me));
647
+ e.$slots.additional ? (d(), v("span", Ke, [
648
+ W(e.$slots, "additional")
649
+ ])) : $("", !0)
650
+ ], 10, Pe));
644
651
  }
645
652
  }), De = {
646
653
  key: 0,
647
654
  class: "top-policy"
648
- }, Ge = { class: "top-policy_title" }, Ne = ["innerHTML"], Fe = /* @__PURE__ */ L({
655
+ }, Oe = { class: "top-policy_title" }, Ge = ["innerHTML"], Ne = /* @__PURE__ */ M({
649
656
  __name: "policy",
650
657
  props: {
651
658
  title: {},
@@ -653,36 +660,36 @@ const me = { class: "top-editArea_footer" }, ve = /* @__PURE__ */ L({
653
660
  acceptText: {}
654
661
  },
655
662
  emits: ["accept"],
656
- setup(l, { emit: t }) {
657
- const s = t, o = B(!0), d = () => {
658
- o.value = !1, s("accept");
663
+ setup(a, { emit: e }) {
664
+ const l = e, o = B(!0), u = () => {
665
+ o.value = !1, l("accept");
659
666
  };
660
- return (a, r) => o.value ? (p(), y("div", De, [
661
- _("div", Ge, $(a.title), 1),
662
- _("div", {
667
+ return (s, r) => o.value ? (d(), v("div", De, [
668
+ S("div", Oe, V(s.title), 1),
669
+ S("div", {
663
670
  class: "top-policy_description",
664
- innerHTML: a.description
665
- }, null, 8, Ne),
666
- O(v(ue), {
671
+ innerHTML: s.description
672
+ }, null, 8, Ge),
673
+ D(f(ue), {
667
674
  size: "m",
668
- onClick: d
675
+ onClick: u
669
676
  }, {
670
- default: V(() => [
671
- S($(a.acceptText), 1)
677
+ default: w(() => [
678
+ E(V(s.acceptText), 1)
672
679
  ]),
673
680
  _: 1
674
681
  })
675
- ])) : A("", !0);
682
+ ])) : $("", !0);
676
683
  }
677
- }), je = ve, Qe = he, Ze = ke, qe = $e, xe = Pe, et = fe, tt = Oe, ot = Fe;
684
+ }), Ye = ve, je = he, Qe = ke, Ze = $e, xe = Me, et = fe, tt = ze, ot = Ne;
678
685
  export {
679
- qe as TopCheckboxGroup,
680
- je as TopEditArea,
681
- Qe as TopEditInput,
686
+ Ze as TopCheckboxGroup,
687
+ Ye as TopEditArea,
688
+ je as TopEditInput,
682
689
  tt as TopInfo,
683
690
  et as TopMenu,
684
691
  ot as TopPolicy,
685
- Ze as TopRadioGroup,
692
+ Qe as TopRadioGroup,
686
693
  xe as TopSelector2
687
694
  };
688
695
  //# sourceMappingURL=formsExt.js.map