@verdnatura/vn-front-lib 0.1.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components-C8Wdf_CB.js +1705 -0
- package/dist/{components-DH7vFPBF.cjs → components-DmGc4N0k.cjs} +2 -2
- package/dist/components.cjs +1 -1
- package/dist/components.js +2 -2
- package/dist/{composables-xGr9z2hA.js → composables-CWY0-8uj.js} +1074 -1093
- package/dist/{composables-BTfGi73U.cjs → composables-DMmrQNdc.cjs} +5 -5
- package/dist/composables.cjs +1 -1
- package/dist/composables.js +1 -1
- package/dist/rolldown-runtime-B0aSnxlc.js +20 -0
- package/dist/vn-front-lib.cjs +1 -1
- package/dist/vn-front-lib.css +1 -1
- package/dist/vn-front-lib.js +7 -7
- package/lib/components/index.js +1 -0
- package/lib/components/selects/VnSelect.vue +612 -0
- package/lib/utils/dataByOrder.js +55 -0
- package/lib/utils/index.js +1 -0
- package/package.json +1 -1
- package/dist/components-BVCHOTDW.js +0 -1227
|
@@ -0,0 +1,1705 @@
|
|
|
1
|
+
import { n as e } from "./rolldown-runtime-B0aSnxlc.js";
|
|
2
|
+
import { _ as t, g as n, h as r, m as i, p as a, t as o, u as s } from "./composables-CWY0-8uj.js";
|
|
3
|
+
import { useStateStore as c } from "./stores.js";
|
|
4
|
+
import { onBeforeSave as l } from "./filters.js";
|
|
5
|
+
import { Fragment as u, Teleport as d, Transition as f, computed as p, createBlock as m, createCommentVNode as h, createElementBlock as g, createElementVNode as _, createSlots as v, createTextVNode as y, createVNode as b, guardReactiveProps as x, mergeModels as S, mergeProps as ee, nextTick as C, normalizeClass as w, normalizeProps as T, normalizeStyle as E, onMounted as te, onUnmounted as ne, openBlock as D, ref as O, renderList as k, renderSlot as A, resolveComponent as j, toDisplayString as M, toRefs as N, unref as P, useAttrs as re, useModel as F, vShow as ie, watch as I, withCtx as L, withDirectives as R, withKeys as ae, withModifiers as oe } from "vue";
|
|
6
|
+
import * as se from "quasar";
|
|
7
|
+
import { QAvatar as ce, QBtn as z, QBtnGroup as B, QCard as le, QCardActions as V, QCardSection as H, QDate as ue, QDialog as U, QForm as de, QIcon as W, QInnerLoading as G, QInput as K, QMenu as q, QSkeleton as J, QSpace as Y, QTooltip as X, date as Z, getCssVar as fe } from "quasar";
|
|
8
|
+
import { useI18n as pe } from "vue-i18n";
|
|
9
|
+
import me from "axios";
|
|
10
|
+
import { onBeforeRouteLeave as he, useRoute as ge, useRouter as _e } from "vue-router";
|
|
11
|
+
//#region lib/components/dialogs/VnConfirm.vue?vue&type=i18n&index=0&lang.i18n
|
|
12
|
+
function Q(e) {
|
|
13
|
+
let t = e;
|
|
14
|
+
t.__i18n = t.__i18n || [], t.__i18n.push({
|
|
15
|
+
locale: "",
|
|
16
|
+
resource: { es: {
|
|
17
|
+
Confirm: {
|
|
18
|
+
t: 0,
|
|
19
|
+
b: {
|
|
20
|
+
t: 2,
|
|
21
|
+
i: [{ t: 3 }],
|
|
22
|
+
s: "Confirmar"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"Are you sure you want to continue?": {
|
|
26
|
+
t: 0,
|
|
27
|
+
b: {
|
|
28
|
+
t: 2,
|
|
29
|
+
i: [{ t: 3 }],
|
|
30
|
+
s: "¿Seguro que quieres continuar?"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
} }
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region \0plugin-vue:export-helper
|
|
38
|
+
var $ = (e, t) => {
|
|
39
|
+
let n = e.__vccOpts || e;
|
|
40
|
+
for (let [e, r] of t) n[e] = r;
|
|
41
|
+
return n;
|
|
42
|
+
}, ve = { class: "text-h6" }, ye = ["innerHTML"], be = {
|
|
43
|
+
__name: "VnConfirm",
|
|
44
|
+
props: {
|
|
45
|
+
icon: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: null
|
|
48
|
+
},
|
|
49
|
+
title: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: null
|
|
52
|
+
},
|
|
53
|
+
message: {
|
|
54
|
+
type: [String, Boolean],
|
|
55
|
+
default: null
|
|
56
|
+
},
|
|
57
|
+
data: {
|
|
58
|
+
type: Object,
|
|
59
|
+
required: !1,
|
|
60
|
+
default: null
|
|
61
|
+
},
|
|
62
|
+
promise: {
|
|
63
|
+
type: Function,
|
|
64
|
+
required: !1,
|
|
65
|
+
default: null
|
|
66
|
+
},
|
|
67
|
+
persistent: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: !1
|
|
70
|
+
},
|
|
71
|
+
closable: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: !0
|
|
74
|
+
},
|
|
75
|
+
cardClass: {
|
|
76
|
+
type: String,
|
|
77
|
+
default: null
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
emits: [
|
|
81
|
+
"confirm",
|
|
82
|
+
"cancel",
|
|
83
|
+
...se.useDialogPluginComponent.emits
|
|
84
|
+
],
|
|
85
|
+
setup(e, { expose: t, emit: n }) {
|
|
86
|
+
let { t: r } = pe(), i = e, a = n;
|
|
87
|
+
t({
|
|
88
|
+
show: () => o.value.show(),
|
|
89
|
+
hide: () => o.value.hide()
|
|
90
|
+
});
|
|
91
|
+
let { dialogRef: o, onDialogHide: s, onDialogOK: c, onDialogCancel: l } = se.useDialogPluginComponent(), u = i.title || r("Confirm"), d = i.message || i.message !== !1 && r("Are you sure you want to continue?"), f = O(!1);
|
|
92
|
+
async function p() {
|
|
93
|
+
if (f.value = !0, i.promise) try {
|
|
94
|
+
await i.promise(i.data);
|
|
95
|
+
} finally {
|
|
96
|
+
f.value = !1;
|
|
97
|
+
}
|
|
98
|
+
c(i.data);
|
|
99
|
+
}
|
|
100
|
+
function v() {
|
|
101
|
+
a("cancel"), l();
|
|
102
|
+
}
|
|
103
|
+
return (t, n) => (D(), m(P(U), {
|
|
104
|
+
ref_key: "dialogRef",
|
|
105
|
+
ref: o,
|
|
106
|
+
persistent: e.persistent,
|
|
107
|
+
onHide: P(s)
|
|
108
|
+
}, {
|
|
109
|
+
default: L(() => [b(P(le), { class: w(["q-pa-sm", e.cardClass]) }, {
|
|
110
|
+
default: L(() => [
|
|
111
|
+
b(P(H), { class: "row items-center q-pb-none" }, {
|
|
112
|
+
default: L(() => [
|
|
113
|
+
e.icon ? (D(), m(P(ce), {
|
|
114
|
+
key: 0,
|
|
115
|
+
icon: e.icon,
|
|
116
|
+
color: "primary",
|
|
117
|
+
"text-color": "white",
|
|
118
|
+
size: "xl"
|
|
119
|
+
}, null, 8, ["icon"])) : h("", !0),
|
|
120
|
+
_("span", ve, M(P(u)), 1),
|
|
121
|
+
b(P(Y)),
|
|
122
|
+
e.closable ? (D(), m(P(z), {
|
|
123
|
+
key: 1,
|
|
124
|
+
icon: "close",
|
|
125
|
+
disable: f.value,
|
|
126
|
+
flat: "",
|
|
127
|
+
round: "",
|
|
128
|
+
dense: "",
|
|
129
|
+
onClick: n[0] ||= (e) => v()
|
|
130
|
+
}, null, 8, ["disable"])) : h("", !0)
|
|
131
|
+
]),
|
|
132
|
+
_: 1
|
|
133
|
+
}),
|
|
134
|
+
b(P(H), {
|
|
135
|
+
class: "q-pb-none",
|
|
136
|
+
"data-cy": "VnConfirm_message"
|
|
137
|
+
}, {
|
|
138
|
+
default: L(() => [P(d) === !1 ? h("", !0) : (D(), g("span", {
|
|
139
|
+
key: 0,
|
|
140
|
+
innerHTML: P(d)
|
|
141
|
+
}, null, 8, ye))]),
|
|
142
|
+
_: 1
|
|
143
|
+
}),
|
|
144
|
+
b(P(H), { class: "row items-center q-pt-none" }, {
|
|
145
|
+
default: L(() => [A(t.$slots, "custom-html", {}, void 0, !0)]),
|
|
146
|
+
_: 3
|
|
147
|
+
}),
|
|
148
|
+
t.$slots.actions ? (D(), m(P(V), {
|
|
149
|
+
key: 0,
|
|
150
|
+
align: "right"
|
|
151
|
+
}, {
|
|
152
|
+
default: L(() => [A(t.$slots, "actions", { actions: {
|
|
153
|
+
confirm: p,
|
|
154
|
+
cancel: v
|
|
155
|
+
} }, void 0, !0)]),
|
|
156
|
+
_: 3
|
|
157
|
+
})) : (D(), m(P(V), {
|
|
158
|
+
key: 1,
|
|
159
|
+
align: "right"
|
|
160
|
+
}, {
|
|
161
|
+
default: L(() => [b(P(z), {
|
|
162
|
+
label: P(r)("globals.cancel"),
|
|
163
|
+
color: "primary",
|
|
164
|
+
disable: f.value,
|
|
165
|
+
flat: "",
|
|
166
|
+
onClick: n[1] ||= (e) => v(),
|
|
167
|
+
"data-cy": "VnConfirm_cancel"
|
|
168
|
+
}, null, 8, ["label", "disable"]), b(P(z), {
|
|
169
|
+
label: P(r)("globals.confirm"),
|
|
170
|
+
title: P(r)("globals.confirm"),
|
|
171
|
+
color: "primary",
|
|
172
|
+
loading: f.value,
|
|
173
|
+
onClick: n[2] ||= (e) => p(),
|
|
174
|
+
unelevated: "",
|
|
175
|
+
autofocus: "",
|
|
176
|
+
"data-cy": "VnConfirm_confirm"
|
|
177
|
+
}, null, 8, [
|
|
178
|
+
"label",
|
|
179
|
+
"title",
|
|
180
|
+
"loading"
|
|
181
|
+
])]),
|
|
182
|
+
_: 1
|
|
183
|
+
}))
|
|
184
|
+
]),
|
|
185
|
+
_: 3
|
|
186
|
+
}, 8, ["class"])]),
|
|
187
|
+
_: 3
|
|
188
|
+
}, 8, ["persistent", "onHide"]));
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
typeof Q == "function" && Q(be);
|
|
192
|
+
var xe = /*#__PURE__*/ $(be, [["__scopeId", "data-v-087d2dc1"]]), Se = { class: "row q-gutter-md q-mb-md" }, Ce = { class: "row q-gutter-md q-mb-md" }, we = { class: "row q-gutter-md q-mb-md" }, Te = {
|
|
193
|
+
__name: "VnSkeletonForm",
|
|
194
|
+
setup(e) {
|
|
195
|
+
return (e, t) => (D(), g(u, null, [
|
|
196
|
+
_("div", Se, [b(P(J), {
|
|
197
|
+
type: "QInput",
|
|
198
|
+
class: "col",
|
|
199
|
+
square: ""
|
|
200
|
+
}), b(P(J), {
|
|
201
|
+
type: "QInput",
|
|
202
|
+
class: "col",
|
|
203
|
+
square: ""
|
|
204
|
+
})]),
|
|
205
|
+
_("div", Ce, [b(P(J), {
|
|
206
|
+
type: "QInput",
|
|
207
|
+
class: "col",
|
|
208
|
+
square: ""
|
|
209
|
+
}), b(P(J), {
|
|
210
|
+
type: "QInput",
|
|
211
|
+
class: "col",
|
|
212
|
+
square: ""
|
|
213
|
+
})]),
|
|
214
|
+
_("div", we, [b(P(J), {
|
|
215
|
+
type: "QInput",
|
|
216
|
+
class: "col",
|
|
217
|
+
square: ""
|
|
218
|
+
}), b(P(J), {
|
|
219
|
+
type: "QInput",
|
|
220
|
+
class: "col",
|
|
221
|
+
square: ""
|
|
222
|
+
})])
|
|
223
|
+
], 64));
|
|
224
|
+
}
|
|
225
|
+
}, Ee = /*#__PURE__*/ $({
|
|
226
|
+
__name: "VnSpinner",
|
|
227
|
+
props: {
|
|
228
|
+
size: {
|
|
229
|
+
type: String,
|
|
230
|
+
default: "40px"
|
|
231
|
+
},
|
|
232
|
+
noTransition: {
|
|
233
|
+
type: Boolean,
|
|
234
|
+
default: !1
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
setup(e) {
|
|
238
|
+
let t = {
|
|
239
|
+
xs: "16px",
|
|
240
|
+
sm: "24px",
|
|
241
|
+
md: "40px",
|
|
242
|
+
lg: "56px",
|
|
243
|
+
xl: "72px"
|
|
244
|
+
};
|
|
245
|
+
return (n, r) => e.noTransition ? (D(), g("div", {
|
|
246
|
+
key: 1,
|
|
247
|
+
class: "vn-spinner",
|
|
248
|
+
style: E({
|
|
249
|
+
width: t[e.size] || e.size,
|
|
250
|
+
height: t[e.size] || e.size
|
|
251
|
+
})
|
|
252
|
+
}, null, 4)) : (D(), m(f, {
|
|
253
|
+
key: 0,
|
|
254
|
+
name: "vn-spinner-fade",
|
|
255
|
+
appear: ""
|
|
256
|
+
}, {
|
|
257
|
+
default: L(() => [_("div", {
|
|
258
|
+
class: "vn-spinner",
|
|
259
|
+
style: E({
|
|
260
|
+
width: t[e.size] || e.size,
|
|
261
|
+
height: t[e.size] || e.size
|
|
262
|
+
})
|
|
263
|
+
}, null, 4)]),
|
|
264
|
+
_: 1
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
267
|
+
}, [["__scopeId", "data-v-e5edebae"]]), De = /*#__PURE__*/ $({
|
|
268
|
+
__name: "VnDate",
|
|
269
|
+
props: {
|
|
270
|
+
modelValue: {
|
|
271
|
+
type: [String, Number],
|
|
272
|
+
default: ""
|
|
273
|
+
},
|
|
274
|
+
modelModifiers: {}
|
|
275
|
+
},
|
|
276
|
+
emits: ["update:modelValue"],
|
|
277
|
+
setup(e) {
|
|
278
|
+
let t = F(e, "modelValue");
|
|
279
|
+
return (e, n) => (D(), m(P(ue), {
|
|
280
|
+
modelValue: t.value,
|
|
281
|
+
"onUpdate:modelValue": n[0] ||= (e) => t.value = e,
|
|
282
|
+
"today-btn": !0,
|
|
283
|
+
options: e.$attrs.options,
|
|
284
|
+
autocomplete: "off"
|
|
285
|
+
}, null, 8, ["modelValue", "options"]));
|
|
286
|
+
}
|
|
287
|
+
}, [["__scopeId", "data-v-8338d4d1"]]);
|
|
288
|
+
//#endregion
|
|
289
|
+
//#region lib/components/inputs/VnInput.vue?vue&type=i18n&index=0&lang.i18n
|
|
290
|
+
function Oe(e) {
|
|
291
|
+
let t = e;
|
|
292
|
+
t.__i18n = t.__i18n || [], t.__i18n.push({
|
|
293
|
+
locale: "",
|
|
294
|
+
resource: {
|
|
295
|
+
en: {
|
|
296
|
+
inputMin: {
|
|
297
|
+
t: 0,
|
|
298
|
+
b: {
|
|
299
|
+
t: 2,
|
|
300
|
+
i: [{
|
|
301
|
+
t: 3,
|
|
302
|
+
v: "Must be more than "
|
|
303
|
+
}, {
|
|
304
|
+
t: 4,
|
|
305
|
+
k: "value"
|
|
306
|
+
}]
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
maxLength: {
|
|
310
|
+
t: 0,
|
|
311
|
+
b: {
|
|
312
|
+
t: 2,
|
|
313
|
+
i: [
|
|
314
|
+
{
|
|
315
|
+
t: 3,
|
|
316
|
+
v: "The value exceeds "
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
t: 4,
|
|
320
|
+
k: "value"
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
t: 3,
|
|
324
|
+
v: " characters"
|
|
325
|
+
}
|
|
326
|
+
]
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
inputMax: {
|
|
330
|
+
t: 0,
|
|
331
|
+
b: {
|
|
332
|
+
t: 2,
|
|
333
|
+
i: [{
|
|
334
|
+
t: 3,
|
|
335
|
+
v: "Must be less than "
|
|
336
|
+
}, {
|
|
337
|
+
t: 4,
|
|
338
|
+
k: "value"
|
|
339
|
+
}]
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
es: {
|
|
344
|
+
inputMin: {
|
|
345
|
+
t: 0,
|
|
346
|
+
b: {
|
|
347
|
+
t: 2,
|
|
348
|
+
i: [{
|
|
349
|
+
t: 3,
|
|
350
|
+
v: "Debe ser mayor a "
|
|
351
|
+
}, {
|
|
352
|
+
t: 4,
|
|
353
|
+
k: "value"
|
|
354
|
+
}]
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
maxLength: {
|
|
358
|
+
t: 0,
|
|
359
|
+
b: {
|
|
360
|
+
t: 2,
|
|
361
|
+
i: [
|
|
362
|
+
{
|
|
363
|
+
t: 3,
|
|
364
|
+
v: "El valor excede los "
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
t: 4,
|
|
368
|
+
k: "value"
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
t: 3,
|
|
372
|
+
v: " carácteres"
|
|
373
|
+
}
|
|
374
|
+
]
|
|
375
|
+
}
|
|
376
|
+
},
|
|
377
|
+
inputMax: {
|
|
378
|
+
t: 0,
|
|
379
|
+
b: {
|
|
380
|
+
t: 2,
|
|
381
|
+
i: [{
|
|
382
|
+
t: 3,
|
|
383
|
+
v: "Debe ser menor a "
|
|
384
|
+
}, {
|
|
385
|
+
t: 4,
|
|
386
|
+
k: "value"
|
|
387
|
+
}]
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
"Convert to uppercase": {
|
|
391
|
+
t: 0,
|
|
392
|
+
b: {
|
|
393
|
+
t: 2,
|
|
394
|
+
i: [{ t: 3 }],
|
|
395
|
+
s: "Convertir a mayúsculas"
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
Remove: {
|
|
399
|
+
t: 0,
|
|
400
|
+
b: {
|
|
401
|
+
t: 2,
|
|
402
|
+
i: [{ t: 3 }],
|
|
403
|
+
s: "Eliminar"
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
//#endregion
|
|
411
|
+
//#region lib/components/inputs/VnInput.vue
|
|
412
|
+
var ke = {
|
|
413
|
+
__name: "VnInput",
|
|
414
|
+
props: /*@__PURE__*/ S({
|
|
415
|
+
isOutlined: {
|
|
416
|
+
type: Boolean,
|
|
417
|
+
default: !1
|
|
418
|
+
},
|
|
419
|
+
info: {
|
|
420
|
+
type: String,
|
|
421
|
+
default: ""
|
|
422
|
+
},
|
|
423
|
+
clearable: {
|
|
424
|
+
type: Boolean,
|
|
425
|
+
default: !0
|
|
426
|
+
},
|
|
427
|
+
emptyToNull: {
|
|
428
|
+
type: Boolean,
|
|
429
|
+
default: !0
|
|
430
|
+
},
|
|
431
|
+
insertable: {
|
|
432
|
+
type: Boolean,
|
|
433
|
+
default: !1
|
|
434
|
+
},
|
|
435
|
+
maxlength: {
|
|
436
|
+
type: Number,
|
|
437
|
+
default: null
|
|
438
|
+
},
|
|
439
|
+
uppercase: {
|
|
440
|
+
type: Boolean,
|
|
441
|
+
default: !1
|
|
442
|
+
},
|
|
443
|
+
clearOnHover: {
|
|
444
|
+
type: Boolean,
|
|
445
|
+
default: !1
|
|
446
|
+
}
|
|
447
|
+
}, {
|
|
448
|
+
modelValue: { default: null },
|
|
449
|
+
modelModifiers: {}
|
|
450
|
+
}),
|
|
451
|
+
emits: /*@__PURE__*/ S(["remove"], ["update:modelValue"]),
|
|
452
|
+
setup(e, { expose: t, emit: r }) {
|
|
453
|
+
let i = re(), { isRequired: a, requiredFieldRule: o } = n(i), { t: s } = pe(), c = r, l = e, u = F(e, "modelValue"), d = [
|
|
454
|
+
"number",
|
|
455
|
+
"search",
|
|
456
|
+
"tel",
|
|
457
|
+
"url",
|
|
458
|
+
"password"
|
|
459
|
+
], f = (e) => {
|
|
460
|
+
let t = e;
|
|
461
|
+
l.emptyToNull && t === "" && (t = null), u.value = t;
|
|
462
|
+
}, _ = O(null), x = O(!1), S = p(() => l.isOutlined ? {
|
|
463
|
+
dense: !0,
|
|
464
|
+
outlined: !0,
|
|
465
|
+
rounded: !0
|
|
466
|
+
} : {}), w = (e) => {
|
|
467
|
+
_.value?.focus(e);
|
|
468
|
+
}, T = (e) => {
|
|
469
|
+
C(() => {
|
|
470
|
+
let t = e.target || _.value?.$el?.querySelector("input"), n = e.target.type || t?.getAttribute("type");
|
|
471
|
+
if (n !== "email") {
|
|
472
|
+
if (!d.includes(n)) {
|
|
473
|
+
if (t?.setSelectionRange) {
|
|
474
|
+
let e = t.value?.length ?? 0;
|
|
475
|
+
t.setSelectionRange(e, e);
|
|
476
|
+
}
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
t?.select?.();
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
};
|
|
483
|
+
t({
|
|
484
|
+
focus: w,
|
|
485
|
+
vnInputRef: _
|
|
486
|
+
});
|
|
487
|
+
let ne = p(() => [
|
|
488
|
+
o,
|
|
489
|
+
...i.rules ?? [],
|
|
490
|
+
(e) => {
|
|
491
|
+
let t = l.maxlength;
|
|
492
|
+
if (t && +e?.length > t) return s("maxLength", { value: t });
|
|
493
|
+
let { min: n, max: r } = i, a = n === void 0 ? void 0 : Number(n), o = r === void 0 ? void 0 : Number(r);
|
|
494
|
+
return a !== void 0 && a >= 0 && Math.floor(e) < a ? s("inputMin", { value: a }) : o !== void 0 && o > 0 && Math.floor(e) > o ? s("inputMax", { value: o }) : !0;
|
|
495
|
+
}
|
|
496
|
+
]), k = (e) => {
|
|
497
|
+
e.key !== "Backspace" && l.insertable && e.key.match(/[0-9]/) && j(e);
|
|
498
|
+
}, j = (e) => {
|
|
499
|
+
e.preventDefault();
|
|
500
|
+
let t = e.target, n = t.selectionStart, r = l.maxlength, i = u.value;
|
|
501
|
+
i ||= e.key;
|
|
502
|
+
let a = e.key;
|
|
503
|
+
a && !isNaN(a) && n < r && f(i.substring(0, n) + a + i.substring(n + 1)), C(() => {
|
|
504
|
+
t.setSelectionRange(n + 1, n + 1);
|
|
505
|
+
});
|
|
506
|
+
}, N = () => {
|
|
507
|
+
u.value = u.value?.toUpperCase() || "";
|
|
508
|
+
};
|
|
509
|
+
return te(() => {
|
|
510
|
+
i.autofocus && w();
|
|
511
|
+
}), (t, n) => (D(), g("div", {
|
|
512
|
+
onMouseover: n[1] ||= (e) => x.value = !0,
|
|
513
|
+
onMouseleave: n[2] ||= (e) => x.value = !1
|
|
514
|
+
}, [b(P(K), ee({
|
|
515
|
+
ref_key: "vnInputRef",
|
|
516
|
+
ref: _,
|
|
517
|
+
"model-value": P(u),
|
|
518
|
+
"onUpdate:modelValue": f
|
|
519
|
+
}, {
|
|
520
|
+
...P(i),
|
|
521
|
+
...S.value
|
|
522
|
+
}, {
|
|
523
|
+
class: { required: P(a) },
|
|
524
|
+
onKeydown: k,
|
|
525
|
+
onFocus: T,
|
|
526
|
+
clearable: !1,
|
|
527
|
+
rules: ne.value,
|
|
528
|
+
"lazy-rules": !0,
|
|
529
|
+
"hide-bottom-space": "",
|
|
530
|
+
"data-cy": (P(i)["data-cy"] ?? P(i).label) + "_input",
|
|
531
|
+
dense: ""
|
|
532
|
+
}), v({
|
|
533
|
+
append: L(() => [
|
|
534
|
+
R(b(P(W), {
|
|
535
|
+
name: "close",
|
|
536
|
+
size: "xs",
|
|
537
|
+
class: "cursor-pointer",
|
|
538
|
+
style: E({ visibility: x.value && P(u) && !P(i).disabled && !P(i).readonly && l.clearable ? "visible" : "hidden" }),
|
|
539
|
+
onClick: n[0] ||= () => {
|
|
540
|
+
f(null), _.value?.focus(), c("remove");
|
|
541
|
+
}
|
|
542
|
+
}, {
|
|
543
|
+
default: L(() => [b(P(X), null, {
|
|
544
|
+
default: L(() => [y(M(P(s)("Remove")), 1)]),
|
|
545
|
+
_: 1
|
|
546
|
+
})]),
|
|
547
|
+
_: 1
|
|
548
|
+
}, 8, ["style"]), [[ie, !e.clearOnHover || x.value]]),
|
|
549
|
+
!P(i).disabled && !P(i).readonly && l.uppercase ? (D(), m(P(W), {
|
|
550
|
+
key: 0,
|
|
551
|
+
name: "match_case",
|
|
552
|
+
size: "xs",
|
|
553
|
+
onClick: N,
|
|
554
|
+
class: "uppercase-icon"
|
|
555
|
+
}, {
|
|
556
|
+
default: L(() => [b(P(X), null, {
|
|
557
|
+
default: L(() => [y(M(P(s)("Convert to uppercase")), 1)]),
|
|
558
|
+
_: 1
|
|
559
|
+
})]),
|
|
560
|
+
_: 1
|
|
561
|
+
})) : h("", !0),
|
|
562
|
+
t.$slots.append && !P(i).disabled ? A(t.$slots, "append", {}, void 0, void 0, 1) : h("", !0),
|
|
563
|
+
e.info ? (D(), m(P(W), {
|
|
564
|
+
key: 2,
|
|
565
|
+
name: "info"
|
|
566
|
+
}, {
|
|
567
|
+
default: L(() => [b(P(X), { "max-width": "350px" }, {
|
|
568
|
+
default: L(() => [y(M(e.info), 1)]),
|
|
569
|
+
_: 1
|
|
570
|
+
})]),
|
|
571
|
+
_: 1
|
|
572
|
+
})) : h("", !0)
|
|
573
|
+
]),
|
|
574
|
+
_: 2
|
|
575
|
+
}, [t.$slots.hint ? {
|
|
576
|
+
name: "hint",
|
|
577
|
+
fn: L(() => [A(t.$slots, "hint")]),
|
|
578
|
+
key: "0"
|
|
579
|
+
} : void 0, t.$slots.prepend ? {
|
|
580
|
+
name: "prepend",
|
|
581
|
+
fn: L(() => [A(t.$slots, "prepend")]),
|
|
582
|
+
key: "1"
|
|
583
|
+
} : void 0]), 1040, [
|
|
584
|
+
"model-value",
|
|
585
|
+
"class",
|
|
586
|
+
"rules",
|
|
587
|
+
"data-cy"
|
|
588
|
+
])], 32));
|
|
589
|
+
}
|
|
590
|
+
};
|
|
591
|
+
typeof Oe == "function" && Oe(ke);
|
|
592
|
+
//#endregion
|
|
593
|
+
//#region lib/components/inputs/VnInputDate.vue?vue&type=i18n&index=0&lang.i18n
|
|
594
|
+
function Ae(e) {
|
|
595
|
+
let t = e;
|
|
596
|
+
t.__i18n = t.__i18n || [], t.__i18n.push({
|
|
597
|
+
locale: "",
|
|
598
|
+
resource: { es: {
|
|
599
|
+
"Open date": {
|
|
600
|
+
t: 0,
|
|
601
|
+
b: {
|
|
602
|
+
t: 2,
|
|
603
|
+
i: [{ t: 3 }],
|
|
604
|
+
s: "Abrir fecha"
|
|
605
|
+
}
|
|
606
|
+
},
|
|
607
|
+
Remove: {
|
|
608
|
+
t: 0,
|
|
609
|
+
b: {
|
|
610
|
+
t: 2,
|
|
611
|
+
i: [{ t: 3 }],
|
|
612
|
+
s: "Eliminar"
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
} }
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
//#endregion
|
|
619
|
+
//#region lib/components/inputs/VnInputDate.vue
|
|
620
|
+
var je = "DD/MM/YYYY", Me = {
|
|
621
|
+
__name: "VnInputDate",
|
|
622
|
+
props: /*@__PURE__*/ S({
|
|
623
|
+
isOutlined: {
|
|
624
|
+
type: Boolean,
|
|
625
|
+
default: !1
|
|
626
|
+
},
|
|
627
|
+
showEvent: {
|
|
628
|
+
type: Boolean,
|
|
629
|
+
default: !0
|
|
630
|
+
},
|
|
631
|
+
hideYearNavigation: {
|
|
632
|
+
type: Boolean,
|
|
633
|
+
default: !1
|
|
634
|
+
},
|
|
635
|
+
clearOnHover: {
|
|
636
|
+
type: Boolean,
|
|
637
|
+
default: !1
|
|
638
|
+
}
|
|
639
|
+
}, {
|
|
640
|
+
modelValue: { type: [
|
|
641
|
+
String,
|
|
642
|
+
Date,
|
|
643
|
+
Object
|
|
644
|
+
] },
|
|
645
|
+
modelModifiers: {}
|
|
646
|
+
}),
|
|
647
|
+
emits: ["update:modelValue"],
|
|
648
|
+
setup(e) {
|
|
649
|
+
let t = re(), { t: r } = pe(), { isRequired: i, requiredFieldRule: a } = n(t), o = F(e, "modelValue"), s = e, c = O(null), l = fe("negative"), u = O(""), d = O(), f = O(), _ = [a, ...t.rules ?? []], v = p(() => o.value?.neq || o.value?.nin || o.value), x = p(() => {
|
|
650
|
+
if (v.value) return Array.isArray(v.value) ? v.value.map((e) => Z.formatDate(new Date(e), je)).join(", ") : Z.formatDate(new Date(v.value), je);
|
|
651
|
+
}), S = p(() => {
|
|
652
|
+
let e = Array.isArray(v.value) ? v.value[0] : v.value;
|
|
653
|
+
return e && Z.formatDate(new Date(e), "YYYY/MM/DD");
|
|
654
|
+
}), w = p(() => s.isOutlined ? {
|
|
655
|
+
dense: !0,
|
|
656
|
+
outlined: !0,
|
|
657
|
+
rounded: !0
|
|
658
|
+
} : {}), T = O(""), E = t["data-cy"] ?? t.label, te = E + "_menu", ne = E + "_inputDate", k = (e) => {
|
|
659
|
+
if (!e && t.clearable) {
|
|
660
|
+
T.value = null, o.value = null;
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
T.value = e.replace(/[^0-9./-]/g, "");
|
|
664
|
+
}, A = (e) => {
|
|
665
|
+
e && (T.value = e.split("/").reverse().join("/"), j(), d.value = !1);
|
|
666
|
+
};
|
|
667
|
+
I(() => o.value, () => {
|
|
668
|
+
let e = Array.isArray(v.value) ? v.value[0] : v.value;
|
|
669
|
+
T.value = e ? Z.formatDate(new Date(e), je) : "";
|
|
670
|
+
}, { immediate: !0 }), I(d, (e) => {
|
|
671
|
+
e && s.hideYearNavigation && C(() => {
|
|
672
|
+
let e = [
|
|
673
|
+
"back",
|
|
674
|
+
"type",
|
|
675
|
+
"forward"
|
|
676
|
+
];
|
|
677
|
+
document.querySelectorAll(".q-date__navigation").forEach((t) => {
|
|
678
|
+
for (let n = 0; n < e.length; n++) t.lastElementChild && t.removeChild(t.lastElementChild);
|
|
679
|
+
});
|
|
680
|
+
});
|
|
681
|
+
});
|
|
682
|
+
let j = () => {
|
|
683
|
+
let e = T.value;
|
|
684
|
+
if (!e || e === o.value) {
|
|
685
|
+
u.value = "";
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
if (!/^([0]?[1-9]|[12][0-9]|3[01])([./-])([0]?[1-9]|1[0-2])([./-](\d{1,4}))?$/.test(e)) {
|
|
689
|
+
u.value = l;
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
e = e.replace(/[.-]/g, "/");
|
|
693
|
+
let t = e.split("/");
|
|
694
|
+
if (t.length < 2) {
|
|
695
|
+
u.value = l;
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
let [n, r, i] = t;
|
|
699
|
+
n.length === 1 && (n = "0" + n), r.length === 1 && (r = "0" + r);
|
|
700
|
+
let a = Date.vnNew().getFullYear();
|
|
701
|
+
i ||= a;
|
|
702
|
+
let s = a.toString().slice(0, 1);
|
|
703
|
+
switch (i.length) {
|
|
704
|
+
case 1:
|
|
705
|
+
i = `${s}00${i}`;
|
|
706
|
+
break;
|
|
707
|
+
case 2:
|
|
708
|
+
i = `${s}0${i}`;
|
|
709
|
+
break;
|
|
710
|
+
case 3: i = `${s}${i}`;
|
|
711
|
+
}
|
|
712
|
+
let c = `${i}/${r}/${n}`;
|
|
713
|
+
c = Z.formatDate(new Date(c).toISOString(), "YYYY-MM-DDTHH:mm:ss.SSSZ");
|
|
714
|
+
let [d, f, p] = c.split("-").map((e) => parseInt(e)), m = new Date(d, f - 1, p);
|
|
715
|
+
if (!(m instanceof Date && !isNaN(m) && m.getFullYear() === parseInt(i) && m.getMonth() === parseInt(r) - 1 && m.getDate() === parseInt(n))) {
|
|
716
|
+
u.value = l;
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
if (v.value) {
|
|
720
|
+
let e = Array.isArray(v.value) ? v.value[0] : v.value, t = e instanceof Date ? e : new Date(e);
|
|
721
|
+
m.setHours(t.getHours(), t.getMinutes(), t.getSeconds(), t.getMilliseconds());
|
|
722
|
+
}
|
|
723
|
+
let h = m.toISOString();
|
|
724
|
+
o.value?.neq ? o.value = { neq: h } : o.value?.nin ? o.value = { nin: [...o.value.nin, h] } : o.value = h, u.value = "";
|
|
725
|
+
}, N = (e) => {
|
|
726
|
+
j(), C(() => {
|
|
727
|
+
let e = new KeyboardEvent("keydown", {
|
|
728
|
+
key: "Enter",
|
|
729
|
+
code: "Enter",
|
|
730
|
+
bubbles: !0,
|
|
731
|
+
cancelable: !0
|
|
732
|
+
});
|
|
733
|
+
c.value?.$el?.dispatchEvent(e);
|
|
734
|
+
});
|
|
735
|
+
};
|
|
736
|
+
return (n, a) => (D(), g("div", {
|
|
737
|
+
onMouseover: a[8] ||= (e) => f.value = !0,
|
|
738
|
+
onMouseleave: a[9] ||= (e) => f.value = !1
|
|
739
|
+
}, [b(P(K), ee({
|
|
740
|
+
ref_key: "vnInputDateRef",
|
|
741
|
+
ref: c,
|
|
742
|
+
modelValue: T.value,
|
|
743
|
+
"onUpdate:modelValue": a[5] ||= (e) => T.value = e,
|
|
744
|
+
class: "vn-input-date",
|
|
745
|
+
placeholder: "dd/mm/aaaa"
|
|
746
|
+
}, {
|
|
747
|
+
...P(t),
|
|
748
|
+
...w.value
|
|
749
|
+
}, {
|
|
750
|
+
class: { required: P(i) },
|
|
751
|
+
rules: _,
|
|
752
|
+
clearable: !1,
|
|
753
|
+
"input-style": { color: u.value },
|
|
754
|
+
"input-class": { "text-strike": !!(o.value?.neq || o.value?.nin) },
|
|
755
|
+
title: x.value,
|
|
756
|
+
onClick: a[6] ||= (e) => d.value = !d.value,
|
|
757
|
+
onKeydown: [a[7] ||= (e) => d.value = !1, ae(oe(N, ["prevent"]), ["enter"])],
|
|
758
|
+
onFocusout: j,
|
|
759
|
+
"hide-bottom-space": "",
|
|
760
|
+
"data-cy": ne,
|
|
761
|
+
"onUpdate:modelValue": k,
|
|
762
|
+
autocomplete: "off"
|
|
763
|
+
}), {
|
|
764
|
+
append: L(() => [(P(t).clearable == null || P(t).clearable) && (!e.clearOnHover || f.value) && T.value && !P(t).disable ? (D(), m(P(W), {
|
|
765
|
+
key: 0,
|
|
766
|
+
name: "close",
|
|
767
|
+
size: "xs",
|
|
768
|
+
class: "cursor-pointer",
|
|
769
|
+
onClick: a[0] ||= (e) => {
|
|
770
|
+
c.value.focus(), T.value = null, o.value = null, d.value = !1;
|
|
771
|
+
}
|
|
772
|
+
}, {
|
|
773
|
+
default: L(() => [b(P(X), null, {
|
|
774
|
+
default: L(() => [y(M(P(r)("Remove")), 1)]),
|
|
775
|
+
_: 1
|
|
776
|
+
})]),
|
|
777
|
+
_: 1
|
|
778
|
+
})) : h("", !0)]),
|
|
779
|
+
default: L(() => [n.$q.screen.gt.xs ? (D(), m(P(q), {
|
|
780
|
+
key: 0,
|
|
781
|
+
"transition-show": "scale",
|
|
782
|
+
"transition-hide": "scale",
|
|
783
|
+
modelValue: d.value,
|
|
784
|
+
"onUpdate:modelValue": a[2] ||= (e) => d.value = e,
|
|
785
|
+
anchor: "bottom left",
|
|
786
|
+
self: "top start",
|
|
787
|
+
"no-focus": !0,
|
|
788
|
+
"no-parent-event": !0,
|
|
789
|
+
"data-cy": te
|
|
790
|
+
}, {
|
|
791
|
+
default: L(() => [b(De, {
|
|
792
|
+
modelValue: S.value,
|
|
793
|
+
"onUpdate:modelValue": [a[1] ||= (e) => S.value = e, A]
|
|
794
|
+
}, null, 8, ["modelValue"])]),
|
|
795
|
+
_: 1
|
|
796
|
+
}, 8, ["modelValue"])) : (D(), m(P(U), {
|
|
797
|
+
key: 1,
|
|
798
|
+
modelValue: d.value,
|
|
799
|
+
"onUpdate:modelValue": a[4] ||= (e) => d.value = e
|
|
800
|
+
}, {
|
|
801
|
+
default: L(() => [b(De, {
|
|
802
|
+
modelValue: S.value,
|
|
803
|
+
"onUpdate:modelValue": [a[3] ||= (e) => S.value = e, A]
|
|
804
|
+
}, null, 8, ["modelValue"])]),
|
|
805
|
+
_: 1
|
|
806
|
+
}, 8, ["modelValue"]))]),
|
|
807
|
+
_: 1
|
|
808
|
+
}, 16, [
|
|
809
|
+
"modelValue",
|
|
810
|
+
"class",
|
|
811
|
+
"input-style",
|
|
812
|
+
"input-class",
|
|
813
|
+
"title",
|
|
814
|
+
"onKeydown"
|
|
815
|
+
])], 32));
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
typeof Ae == "function" && Ae(Me);
|
|
819
|
+
//#endregion
|
|
820
|
+
//#region lib/components/models/VnFetch.vue
|
|
821
|
+
var Ne = {
|
|
822
|
+
__name: "VnFetch",
|
|
823
|
+
props: {
|
|
824
|
+
autoLoad: {
|
|
825
|
+
type: Boolean,
|
|
826
|
+
default: !1
|
|
827
|
+
},
|
|
828
|
+
url: {
|
|
829
|
+
type: String,
|
|
830
|
+
default: ""
|
|
831
|
+
},
|
|
832
|
+
filter: {
|
|
833
|
+
type: Object,
|
|
834
|
+
default: null
|
|
835
|
+
},
|
|
836
|
+
where: {
|
|
837
|
+
type: Object,
|
|
838
|
+
default: null
|
|
839
|
+
},
|
|
840
|
+
sortBy: {
|
|
841
|
+
type: String,
|
|
842
|
+
default: ""
|
|
843
|
+
},
|
|
844
|
+
limit: {
|
|
845
|
+
type: [String, Number],
|
|
846
|
+
default: ""
|
|
847
|
+
},
|
|
848
|
+
params: {
|
|
849
|
+
type: Object,
|
|
850
|
+
default: null
|
|
851
|
+
}
|
|
852
|
+
},
|
|
853
|
+
emits: ["onFetch"],
|
|
854
|
+
setup(e, { expose: t, emit: n }) {
|
|
855
|
+
let r = e, i = n;
|
|
856
|
+
t({ fetch: a }), te(async () => {
|
|
857
|
+
r.autoLoad && await a();
|
|
858
|
+
});
|
|
859
|
+
async function a(e = {}) {
|
|
860
|
+
try {
|
|
861
|
+
let t = {
|
|
862
|
+
...e,
|
|
863
|
+
...r.filter
|
|
864
|
+
};
|
|
865
|
+
r.where && !e.where && (t.where = r.where), r.sortBy && (t.order = r.sortBy), r.limit && (t.limit = r.limit);
|
|
866
|
+
let { data: n } = await me.get(r.url, { params: {
|
|
867
|
+
filter: JSON.stringify(t),
|
|
868
|
+
...r.params
|
|
869
|
+
} });
|
|
870
|
+
return i("onFetch", n), n;
|
|
871
|
+
} catch {}
|
|
872
|
+
}
|
|
873
|
+
return (e, t) => (D(), g("template"));
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
//#endregion
|
|
877
|
+
//#region lib/utils/dataByOrder.js
|
|
878
|
+
function Pe(e, t) {
|
|
879
|
+
if (typeof t == "function") return e.sort(e);
|
|
880
|
+
if (typeof t == "string" && (t = [t]), !Array.isArray(e)) return [];
|
|
881
|
+
if (Array.isArray(t)) {
|
|
882
|
+
let n = [];
|
|
883
|
+
for (let e of t) {
|
|
884
|
+
let t = e.split(/\s+/);
|
|
885
|
+
n.push({
|
|
886
|
+
field: t[0],
|
|
887
|
+
way: t[1] === "DESC" ? -1 : 1
|
|
888
|
+
});
|
|
889
|
+
}
|
|
890
|
+
return e.sort((e, t) => Fe(e, t, n));
|
|
891
|
+
}
|
|
892
|
+
return e;
|
|
893
|
+
}
|
|
894
|
+
function Fe(e, t, n) {
|
|
895
|
+
for (let { field: r, way: i } of n) {
|
|
896
|
+
let n = Ie(e[r], t[r]) * i;
|
|
897
|
+
if (n !== 0) return n;
|
|
898
|
+
}
|
|
899
|
+
return 0;
|
|
900
|
+
}
|
|
901
|
+
function Ie(e, t) {
|
|
902
|
+
if (e === t) return 0;
|
|
903
|
+
let n = typeof e;
|
|
904
|
+
if (n === typeof t) switch (n) {
|
|
905
|
+
case "string": return e.localeCompare(t);
|
|
906
|
+
case "number": return e - t;
|
|
907
|
+
case "boolean": return e ? 1 : -1;
|
|
908
|
+
case "object": if (e instanceof Date && t instanceof Date) return e.getTime() - t.getTime();
|
|
909
|
+
}
|
|
910
|
+
return e === void 0 ? -1 : t === void 0 ? 1 : e === null ? -1 : t === null || e > t ? 1 : -1;
|
|
911
|
+
}
|
|
912
|
+
//#endregion
|
|
913
|
+
//#region lib/components/models/VnForm.vue
|
|
914
|
+
var Le = {
|
|
915
|
+
class: "column items-center full-width",
|
|
916
|
+
style: { position: "relative" }
|
|
917
|
+
}, Re = ["textContent"], ze = /*#__PURE__*/ $({
|
|
918
|
+
__name: "VnForm",
|
|
919
|
+
props: {
|
|
920
|
+
url: {
|
|
921
|
+
type: String,
|
|
922
|
+
default: ""
|
|
923
|
+
},
|
|
924
|
+
model: {
|
|
925
|
+
type: String,
|
|
926
|
+
default: null
|
|
927
|
+
},
|
|
928
|
+
filter: {
|
|
929
|
+
type: Object,
|
|
930
|
+
default: null
|
|
931
|
+
},
|
|
932
|
+
urlUpdate: {
|
|
933
|
+
type: String,
|
|
934
|
+
default: null
|
|
935
|
+
},
|
|
936
|
+
urlCreate: {
|
|
937
|
+
type: String,
|
|
938
|
+
default: null
|
|
939
|
+
},
|
|
940
|
+
defaultActions: {
|
|
941
|
+
type: Boolean,
|
|
942
|
+
default: !0
|
|
943
|
+
},
|
|
944
|
+
defaultButtons: {
|
|
945
|
+
type: Object,
|
|
946
|
+
default: () => {}
|
|
947
|
+
},
|
|
948
|
+
autoLoad: {
|
|
949
|
+
type: Boolean,
|
|
950
|
+
default: !1
|
|
951
|
+
},
|
|
952
|
+
formInitialData: {
|
|
953
|
+
type: Object,
|
|
954
|
+
default: () => {}
|
|
955
|
+
},
|
|
956
|
+
observeFormChanges: {
|
|
957
|
+
type: Boolean,
|
|
958
|
+
default: !0,
|
|
959
|
+
description: "Esto se usa principalmente para permitir guardar sin hacer cambios (Útil para la feature de clonar ya que en este caso queremos poder guardar de primeras)"
|
|
960
|
+
},
|
|
961
|
+
mapper: {
|
|
962
|
+
type: Function,
|
|
963
|
+
default: l
|
|
964
|
+
},
|
|
965
|
+
clearStoreOnUnmount: {
|
|
966
|
+
type: Boolean,
|
|
967
|
+
default: !0
|
|
968
|
+
},
|
|
969
|
+
saveFn: {
|
|
970
|
+
type: Function,
|
|
971
|
+
default: null
|
|
972
|
+
},
|
|
973
|
+
goTo: {
|
|
974
|
+
type: String,
|
|
975
|
+
default: "",
|
|
976
|
+
description: "It is used for redirect on click \"save and continue\""
|
|
977
|
+
},
|
|
978
|
+
reload: {
|
|
979
|
+
type: Boolean,
|
|
980
|
+
default: !0
|
|
981
|
+
},
|
|
982
|
+
defaultTrim: {
|
|
983
|
+
type: Boolean,
|
|
984
|
+
default: !0
|
|
985
|
+
},
|
|
986
|
+
maxWidth: {
|
|
987
|
+
type: [String, Boolean],
|
|
988
|
+
default: "800px"
|
|
989
|
+
},
|
|
990
|
+
onDataSaved: {
|
|
991
|
+
type: Function,
|
|
992
|
+
default: () => {}
|
|
993
|
+
},
|
|
994
|
+
preventSubmit: {
|
|
995
|
+
type: Boolean,
|
|
996
|
+
default: !1
|
|
997
|
+
},
|
|
998
|
+
customMethod: {
|
|
999
|
+
type: String,
|
|
1000
|
+
default: null
|
|
1001
|
+
},
|
|
1002
|
+
formUrl: {
|
|
1003
|
+
type: [String, Boolean],
|
|
1004
|
+
default: "createForm"
|
|
1005
|
+
},
|
|
1006
|
+
paddingClass: {
|
|
1007
|
+
type: String,
|
|
1008
|
+
default: "q-pa-md"
|
|
1009
|
+
},
|
|
1010
|
+
showTitle: {
|
|
1011
|
+
type: Boolean,
|
|
1012
|
+
default: !1
|
|
1013
|
+
},
|
|
1014
|
+
title: {
|
|
1015
|
+
type: String,
|
|
1016
|
+
default: null
|
|
1017
|
+
}
|
|
1018
|
+
},
|
|
1019
|
+
emits: [
|
|
1020
|
+
"onFetch",
|
|
1021
|
+
"onDataSaved",
|
|
1022
|
+
"onDataSaveFail",
|
|
1023
|
+
"submit"
|
|
1024
|
+
],
|
|
1025
|
+
setup(e, { expose: n, emit: l }) {
|
|
1026
|
+
let { push: f } = _e(), v = se.useQuasar(), y = o(), x = c(), { t: S } = pe(), { validate: w, validations: T } = t(), { notify: E } = s(), k = ge(), j = O(null), N = e, re = l, F = p(() => N.model ?? `formModel_${k?.meta?.title ?? k.name}`).value, ie = O(!1), R = i(F), ae = O(!1), ce = O(!1), V = O(!N.observeFormChanges), ue = {}, U = p(() => y.get(F)), W = O(), K = p(() => j.value?.$el), q = p(() => ({
|
|
1027
|
+
save: {
|
|
1028
|
+
dataCy: "saveDefaultBtn",
|
|
1029
|
+
color: "primary",
|
|
1030
|
+
icon: "save",
|
|
1031
|
+
label: "globals.save",
|
|
1032
|
+
click: async (e) => J(e),
|
|
1033
|
+
type: "submit"
|
|
1034
|
+
},
|
|
1035
|
+
reset: {
|
|
1036
|
+
dataCy: "resetDefaultBtn",
|
|
1037
|
+
color: "primary",
|
|
1038
|
+
icon: "restart_alt",
|
|
1039
|
+
label: "globals.reset",
|
|
1040
|
+
click: () => Q()
|
|
1041
|
+
},
|
|
1042
|
+
...N.defaultButtons
|
|
1043
|
+
})), J = async (e) => {
|
|
1044
|
+
await j.value.validate() && await Z(e);
|
|
1045
|
+
};
|
|
1046
|
+
function Y() {
|
|
1047
|
+
ue = N.formUrl ? JSON.parse(k?.query[N.formUrl] ?? "{}") : void 0;
|
|
1048
|
+
}
|
|
1049
|
+
te(async () => {
|
|
1050
|
+
!R.store.url && N.url && R.setOptions({
|
|
1051
|
+
url: N.url,
|
|
1052
|
+
filter: N.filter
|
|
1053
|
+
}), Y(), C(() => ie.value = !0), N.formInitialData && ue && y.set(F, {
|
|
1054
|
+
...N.formInitialData,
|
|
1055
|
+
...ue
|
|
1056
|
+
}), N.formInitialData || (N.autoLoad && N.url ? await X() : R.store.data && ve("onFetch", { val: R.store.data })), N.observeFormChanges && I(() => W.value, (e, t) => {
|
|
1057
|
+
t && (V.value = !ce.value && JSON.stringify(e) !== JSON.stringify(U.value), ce.value = !1);
|
|
1058
|
+
}, { deep: !0 });
|
|
1059
|
+
}), N.url || I(() => R.store.data, (e) => ve("onFetch", { val: e })), I(U, async (e) => {
|
|
1060
|
+
e && (W.value = JSON.parse(JSON.stringify(e))), await C(), K.value && a(K.value);
|
|
1061
|
+
}, { immediate: !0 }), I(() => [N.url, N.filter], async () => {
|
|
1062
|
+
y.set(F, null), Q(), await X();
|
|
1063
|
+
}), N.formInitialData && I(() => N.formInitialData, (e) => {
|
|
1064
|
+
e && y.set(F, {
|
|
1065
|
+
...e,
|
|
1066
|
+
...ue
|
|
1067
|
+
});
|
|
1068
|
+
}), he((e, t, n) => {
|
|
1069
|
+
V.value && N.observeFormChanges ? v.dialog({
|
|
1070
|
+
component: xe,
|
|
1071
|
+
componentProps: {
|
|
1072
|
+
title: S("globals.unsavedPopup.title"),
|
|
1073
|
+
message: S("globals.unsavedPopup.subtitle"),
|
|
1074
|
+
promise: () => n()
|
|
1075
|
+
}
|
|
1076
|
+
}) : n();
|
|
1077
|
+
}), ne(() => {
|
|
1078
|
+
if (V.value) return y.set(F, U.value);
|
|
1079
|
+
N.clearStoreOnUnmount && y.unset(F);
|
|
1080
|
+
});
|
|
1081
|
+
async function X() {
|
|
1082
|
+
try {
|
|
1083
|
+
let e;
|
|
1084
|
+
e = N.model ? (await R.addFilter({ filter: N.filter })).response?.data : (await me.get(N.url, { params: { filter: JSON.stringify(N.filter) } })).data, Array.isArray(e) && (e = e[0] ?? {}), ve("onFetch", { val: e });
|
|
1085
|
+
} catch (e) {
|
|
1086
|
+
throw y.set(F, {}), e;
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
async function Z() {
|
|
1090
|
+
if (N.observeFormChanges && !V.value) return E("globals.noChanges", "negative");
|
|
1091
|
+
ae.value = !0;
|
|
1092
|
+
try {
|
|
1093
|
+
W.value = ye(W.value);
|
|
1094
|
+
let e = N.urlCreate ? "post" : "patch", t = e === "post" ? N.mapper(W.value) : N.mapper(W.value, U.value), n = N.urlCreate || N.urlUpdate || N.url || R.store.url, r = await Promise.resolve(N.saveFn ? N.saveFn(t) : me[N.customMethod ?? e](n, t));
|
|
1095
|
+
N.urlCreate && E("globals.dataCreated", "positive"), V.value = !1, ve("onDataSaved", {
|
|
1096
|
+
val: W.value,
|
|
1097
|
+
res: r?.data,
|
|
1098
|
+
old: U.value,
|
|
1099
|
+
rawRes: r
|
|
1100
|
+
}), N.reload && await R.fetch({});
|
|
1101
|
+
} catch (e) {
|
|
1102
|
+
throw re("onDataSaveFail", W.value), e;
|
|
1103
|
+
} finally {
|
|
1104
|
+
ae.value = !1;
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
async function fe() {
|
|
1108
|
+
await Z(!0), f({ path: N.goTo });
|
|
1109
|
+
}
|
|
1110
|
+
function Q() {
|
|
1111
|
+
W.value = JSON.parse(JSON.stringify(U.value)), ve("onFetch", { val: U.value }), N.observeFormChanges && (V.value = !1, ce.value = !0);
|
|
1112
|
+
}
|
|
1113
|
+
function $(e, t, n) {
|
|
1114
|
+
t(() => {
|
|
1115
|
+
let { options: t, filterFn: r } = n;
|
|
1116
|
+
t.value = r(t, e);
|
|
1117
|
+
}, (e) => {
|
|
1118
|
+
e.setOptionIndex(-1), e.moveOptionSelection(1, !0);
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
async function ve(e, { val: t, res: n, old: r, rawRes: i } = {
|
|
1122
|
+
val: null,
|
|
1123
|
+
res: null,
|
|
1124
|
+
old: null,
|
|
1125
|
+
rawRes: null
|
|
1126
|
+
}) {
|
|
1127
|
+
y.set(F, t), N.url || (R.store.data = t), re(e, y.get(F), n, r, W, i), K.value && a(K.value);
|
|
1128
|
+
}
|
|
1129
|
+
function ye(e) {
|
|
1130
|
+
if (!N.defaultTrim) return e;
|
|
1131
|
+
for (let t in e) typeof e[t] == "string" && (e[t] = e[t].trim());
|
|
1132
|
+
return e;
|
|
1133
|
+
}
|
|
1134
|
+
async function be(e) {
|
|
1135
|
+
if (e.key === "Enter" && !N.preventSubmit && V.value) {
|
|
1136
|
+
let t = e.target;
|
|
1137
|
+
if (t.type == "textarea" && e.shiftKey) {
|
|
1138
|
+
let { selectionStart: e, selectionEnd: n } = t;
|
|
1139
|
+
t.value = t.value.substring(0, e) + "\n" + t.value.substring(n), e = n = e + 1;
|
|
1140
|
+
return;
|
|
1141
|
+
}
|
|
1142
|
+
await j.value.submit(e);
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
return n({
|
|
1146
|
+
submitForm: J,
|
|
1147
|
+
myForm: j,
|
|
1148
|
+
save: Z,
|
|
1149
|
+
isLoading: ae,
|
|
1150
|
+
hasChanges: V,
|
|
1151
|
+
reset: Q,
|
|
1152
|
+
fetch: X,
|
|
1153
|
+
formData: W
|
|
1154
|
+
}), (t, n) => (D(), g(u, null, [_("div", Le, [b(P(G), {
|
|
1155
|
+
showing: ae.value,
|
|
1156
|
+
label: P(S)("globals.pleaseWait"),
|
|
1157
|
+
color: "primary",
|
|
1158
|
+
style: { "min-width": "100%" }
|
|
1159
|
+
}, {
|
|
1160
|
+
default: L(() => [b(P(Ee), { size: "md" })]),
|
|
1161
|
+
_: 1
|
|
1162
|
+
}, 8, ["showing", "label"]), W.value ? (D(), m(P(de), ee({
|
|
1163
|
+
key: 0,
|
|
1164
|
+
id: "vnForm"
|
|
1165
|
+
}, t.$attrs, {
|
|
1166
|
+
ref_key: "myForm",
|
|
1167
|
+
ref: j,
|
|
1168
|
+
onSubmit: oe(Z, ["prevent"]),
|
|
1169
|
+
onKeyup: oe(be, ["prevent"]),
|
|
1170
|
+
onReset: Q,
|
|
1171
|
+
class: ["full-width", [e.paddingClass]],
|
|
1172
|
+
style: {
|
|
1173
|
+
maxWidth: e.maxWidth || "none",
|
|
1174
|
+
width: "100%"
|
|
1175
|
+
}
|
|
1176
|
+
}), {
|
|
1177
|
+
default: L(() => [b(P(le), { class: "q-pa-none" }, {
|
|
1178
|
+
default: L(() => [e.showTitle ? (D(), m(P(H), {
|
|
1179
|
+
key: 0,
|
|
1180
|
+
class: "vn-basic-data__header q-px-none q-pb-none"
|
|
1181
|
+
}, {
|
|
1182
|
+
default: L(() => [_("span", {
|
|
1183
|
+
class: "text-h6",
|
|
1184
|
+
textContent: M(e.title || t.$t("globals.pageTitles.basicData"))
|
|
1185
|
+
}, null, 8, Re)]),
|
|
1186
|
+
_: 1
|
|
1187
|
+
})) : h("", !0), W.value ? A(t.$slots, "form", {
|
|
1188
|
+
data: W.value,
|
|
1189
|
+
validate: P(w),
|
|
1190
|
+
validations: P(T)(),
|
|
1191
|
+
filter: $
|
|
1192
|
+
}, void 0, !0, 1) : (D(), m(P(Te), { key: 2 }))]),
|
|
1193
|
+
_: 3
|
|
1194
|
+
})]),
|
|
1195
|
+
_: 3
|
|
1196
|
+
}, 16, ["class", "style"])) : h("", !0)]), N.defaultActions && P(x)?.isSubToolbarShown() && ie.value ? (D(), m(d, {
|
|
1197
|
+
key: 0,
|
|
1198
|
+
to: "#st-actions"
|
|
1199
|
+
}, [b(P(B), {
|
|
1200
|
+
push: "",
|
|
1201
|
+
class: "q-gutter-x-sm"
|
|
1202
|
+
}, {
|
|
1203
|
+
default: L(() => [
|
|
1204
|
+
A(t.$slots, "moreActions", {}, void 0, !0),
|
|
1205
|
+
b(P(z), {
|
|
1206
|
+
label: P(r)(q.value.reset.label),
|
|
1207
|
+
color: q.value.reset.color,
|
|
1208
|
+
icon: q.value.reset.icon,
|
|
1209
|
+
flat: "",
|
|
1210
|
+
onClick: q.value.reset.click,
|
|
1211
|
+
disable: !V.value,
|
|
1212
|
+
title: P(S)(q.value.reset.label),
|
|
1213
|
+
"data-cy": "resetDefaultBtn"
|
|
1214
|
+
}, null, 8, [
|
|
1215
|
+
"label",
|
|
1216
|
+
"color",
|
|
1217
|
+
"icon",
|
|
1218
|
+
"onClick",
|
|
1219
|
+
"disable",
|
|
1220
|
+
"title"
|
|
1221
|
+
]),
|
|
1222
|
+
b(P(z), {
|
|
1223
|
+
"data-cy": "saveDefaultBtn",
|
|
1224
|
+
label: P(r)("globals.save"),
|
|
1225
|
+
color: "primary",
|
|
1226
|
+
icon: "save",
|
|
1227
|
+
onClick: q.value.save.click,
|
|
1228
|
+
disable: !V.value,
|
|
1229
|
+
title: P(S)(q.value.save.label),
|
|
1230
|
+
flat: !!N.goTo
|
|
1231
|
+
}, null, 8, [
|
|
1232
|
+
"label",
|
|
1233
|
+
"onClick",
|
|
1234
|
+
"disable",
|
|
1235
|
+
"title",
|
|
1236
|
+
"flat"
|
|
1237
|
+
]),
|
|
1238
|
+
N.goTo ? (D(), m(P(z), {
|
|
1239
|
+
key: 0,
|
|
1240
|
+
"data-cy": "saveAndContinueDefaultBtn",
|
|
1241
|
+
onClick: fe,
|
|
1242
|
+
label: P(r)("globals.saveAndContinue") + " " + P(S)("globals." + N.goTo.split("/").pop()),
|
|
1243
|
+
title: P(S)("globals.saveAndContinue") + " " + P(S)("globals." + N.goTo.split("/").pop()),
|
|
1244
|
+
disable: !V.value,
|
|
1245
|
+
color: "primary",
|
|
1246
|
+
icon: "save"
|
|
1247
|
+
}, null, 8, [
|
|
1248
|
+
"label",
|
|
1249
|
+
"title",
|
|
1250
|
+
"disable"
|
|
1251
|
+
])) : h("", !0)
|
|
1252
|
+
]),
|
|
1253
|
+
_: 3
|
|
1254
|
+
})])) : h("", !0)], 64));
|
|
1255
|
+
}
|
|
1256
|
+
}, [["__scopeId", "data-v-addfa85d"]]);
|
|
1257
|
+
//#endregion
|
|
1258
|
+
//#region lib/components/selects/VnSelect.vue?vue&type=i18n&index=0&lang.i18n
|
|
1259
|
+
function Be(e) {
|
|
1260
|
+
let t = e;
|
|
1261
|
+
t.__i18n = t.__i18n || [], t.__i18n.push({
|
|
1262
|
+
locale: "",
|
|
1263
|
+
resource: { es: { Remove: {
|
|
1264
|
+
t: 0,
|
|
1265
|
+
b: {
|
|
1266
|
+
t: 2,
|
|
1267
|
+
i: [{ t: 3 }],
|
|
1268
|
+
s: "Eliminar"
|
|
1269
|
+
}
|
|
1270
|
+
} } }
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1273
|
+
//#endregion
|
|
1274
|
+
//#region lib/components/selects/VnSelect.vue
|
|
1275
|
+
var Ve = { key: 0 }, He = ["title", "textContent"], Ue = {
|
|
1276
|
+
key: 1,
|
|
1277
|
+
class: "no-wrap chip-scroll"
|
|
1278
|
+
}, We = ["textContent"], Ge = ["textContent"], Ke = {
|
|
1279
|
+
__name: "VnSelect",
|
|
1280
|
+
props: {
|
|
1281
|
+
modelValue: {
|
|
1282
|
+
type: [
|
|
1283
|
+
String,
|
|
1284
|
+
Number,
|
|
1285
|
+
Object
|
|
1286
|
+
],
|
|
1287
|
+
default: null
|
|
1288
|
+
},
|
|
1289
|
+
options: {
|
|
1290
|
+
type: [Array, Object],
|
|
1291
|
+
default: () => []
|
|
1292
|
+
},
|
|
1293
|
+
optionLabel: {
|
|
1294
|
+
type: [String, Function],
|
|
1295
|
+
default: "name"
|
|
1296
|
+
},
|
|
1297
|
+
optionValue: {
|
|
1298
|
+
type: String,
|
|
1299
|
+
default: "id"
|
|
1300
|
+
},
|
|
1301
|
+
optionCaption: {
|
|
1302
|
+
type: String,
|
|
1303
|
+
default: null
|
|
1304
|
+
},
|
|
1305
|
+
optionFilter: {
|
|
1306
|
+
type: String,
|
|
1307
|
+
default: null
|
|
1308
|
+
},
|
|
1309
|
+
optionFilterValue: {
|
|
1310
|
+
type: String,
|
|
1311
|
+
default: null
|
|
1312
|
+
},
|
|
1313
|
+
url: {
|
|
1314
|
+
type: String,
|
|
1315
|
+
default: null
|
|
1316
|
+
},
|
|
1317
|
+
filterOptions: {
|
|
1318
|
+
type: [Array],
|
|
1319
|
+
default: () => []
|
|
1320
|
+
},
|
|
1321
|
+
exprBuilder: {
|
|
1322
|
+
type: Function,
|
|
1323
|
+
default: null
|
|
1324
|
+
},
|
|
1325
|
+
isClearable: {
|
|
1326
|
+
type: Boolean,
|
|
1327
|
+
default: !0
|
|
1328
|
+
},
|
|
1329
|
+
fields: {
|
|
1330
|
+
type: Array,
|
|
1331
|
+
default: null
|
|
1332
|
+
},
|
|
1333
|
+
include: {
|
|
1334
|
+
type: [
|
|
1335
|
+
Object,
|
|
1336
|
+
Array,
|
|
1337
|
+
String
|
|
1338
|
+
],
|
|
1339
|
+
default: null
|
|
1340
|
+
},
|
|
1341
|
+
where: {
|
|
1342
|
+
type: Object,
|
|
1343
|
+
default: null
|
|
1344
|
+
},
|
|
1345
|
+
sortBy: {
|
|
1346
|
+
type: [String, Array],
|
|
1347
|
+
default: null
|
|
1348
|
+
},
|
|
1349
|
+
limit: {
|
|
1350
|
+
type: [Number, String],
|
|
1351
|
+
default: "30"
|
|
1352
|
+
},
|
|
1353
|
+
focusOnMount: {
|
|
1354
|
+
type: Boolean,
|
|
1355
|
+
default: !1
|
|
1356
|
+
},
|
|
1357
|
+
openOnMount: {
|
|
1358
|
+
type: Boolean,
|
|
1359
|
+
default: !1
|
|
1360
|
+
},
|
|
1361
|
+
useLike: {
|
|
1362
|
+
type: Boolean,
|
|
1363
|
+
default: !0
|
|
1364
|
+
},
|
|
1365
|
+
filterBuilder: { type: Function },
|
|
1366
|
+
params: {
|
|
1367
|
+
type: Object,
|
|
1368
|
+
default: null
|
|
1369
|
+
},
|
|
1370
|
+
noOne: {
|
|
1371
|
+
type: Boolean,
|
|
1372
|
+
default: !1
|
|
1373
|
+
},
|
|
1374
|
+
dataKey: {
|
|
1375
|
+
type: String,
|
|
1376
|
+
default: null
|
|
1377
|
+
},
|
|
1378
|
+
isOutlined: {
|
|
1379
|
+
type: Boolean,
|
|
1380
|
+
default: !1
|
|
1381
|
+
},
|
|
1382
|
+
paramsBuilder: {
|
|
1383
|
+
type: Function,
|
|
1384
|
+
default: () => ({})
|
|
1385
|
+
},
|
|
1386
|
+
sortOptions: {
|
|
1387
|
+
type: Boolean,
|
|
1388
|
+
default: !0
|
|
1389
|
+
},
|
|
1390
|
+
noWhere: {
|
|
1391
|
+
type: Boolean,
|
|
1392
|
+
default: !1
|
|
1393
|
+
}
|
|
1394
|
+
},
|
|
1395
|
+
emits: [
|
|
1396
|
+
"update:modelValue",
|
|
1397
|
+
"update:options",
|
|
1398
|
+
"remove"
|
|
1399
|
+
],
|
|
1400
|
+
setup(e, { expose: t, emit: r }) {
|
|
1401
|
+
let a = r, o = re(), { t: s } = pe(), c = p(() => n(o).isRequired), l = p(() => n(o).requiredFieldRule), d = e, f = [l, ...o.rules ?? []], { optionLabel: S, optionValue: w, optionCaption: ne, optionFilter: F, optionFilterValue: se, options: ce, modelValue: z } = N(d), B = O([]), le = O([]), V = O(/* @__PURE__ */ new Map()), H = O(), ue = O(), U = s("globals.noOne"), de = O({
|
|
1402
|
+
[w.value]: !1,
|
|
1403
|
+
[S.value]: U
|
|
1404
|
+
}), W = p(() => d.isOutlined ? {
|
|
1405
|
+
dense: !0,
|
|
1406
|
+
outlined: !0,
|
|
1407
|
+
rounded: !0
|
|
1408
|
+
} : {}), G = O(!1), K = O(!1), q = p(() => d.url), J = p({
|
|
1409
|
+
get() {
|
|
1410
|
+
return d.modelValue;
|
|
1411
|
+
},
|
|
1412
|
+
set(e) {
|
|
1413
|
+
_e(le.value), a("update:modelValue", e);
|
|
1414
|
+
}
|
|
1415
|
+
}), Y = p(() => Array.isArray(d.modelValue) || "multiple" in o || o.isAdvanced), X = d.dataKey ?? (d.url?.length > 0 ? d.url : o.name ?? o.label), Z = i(X, {
|
|
1416
|
+
url: d.url,
|
|
1417
|
+
searchUrl: !1,
|
|
1418
|
+
mapKey: o["map-key"]
|
|
1419
|
+
}), fe = O(!1), me = p(() => d.sortBy ? d.sortBy : typeof d.optionLabel == "string" ? d.optionLabel + " ASC" : "");
|
|
1420
|
+
function he(e) {
|
|
1421
|
+
return typeof d.filterBuilder == "function" ? d.filterBuilder(e) : d.useLike ? { like: `%${e}%` } : e;
|
|
1422
|
+
}
|
|
1423
|
+
I(ce, (e) => {
|
|
1424
|
+
_e(e);
|
|
1425
|
+
}), I(z, async (e) => {
|
|
1426
|
+
e = (e?.neq || e?.nin || e) ?? [], Array.isArray(e) || (e = [e]);
|
|
1427
|
+
for (let t of e) V.value.get(t) || await $(t, !0);
|
|
1428
|
+
d.noOne && B.value.unshift(de.value);
|
|
1429
|
+
}), I(() => le.value, (e) => {
|
|
1430
|
+
for (let t of e) V.value.set(t[w.value], t);
|
|
1431
|
+
}), te(() => {
|
|
1432
|
+
_e(ce.value), q.value && d.modelValue && !ge() && $(d.modelValue), (d.focusOnMount || d.openOnMount) && setTimeout(() => we(!0, d.openOnMount), 300);
|
|
1433
|
+
});
|
|
1434
|
+
function ge() {
|
|
1435
|
+
if (d.options) return Q(d.modelValue, d.options)?.length;
|
|
1436
|
+
}
|
|
1437
|
+
function _e(e) {
|
|
1438
|
+
d.sortOptions && (e = Pe(e, me.value)), B.value = JSON.parse(JSON.stringify(e)), le.value = JSON.parse(JSON.stringify(e)), a("update:options", e);
|
|
1439
|
+
}
|
|
1440
|
+
function Q(e, t) {
|
|
1441
|
+
let n = e?.toString()?.toLowerCase();
|
|
1442
|
+
return n ? t.filter((e) => {
|
|
1443
|
+
if (d.filterOptions.length) return d.filterOptions.some((t) => String(e[t]).toLowerCase().includes(n));
|
|
1444
|
+
if (!e) return;
|
|
1445
|
+
let t = String(e[d.optionValue]).toLowerCase(), r = String(e[d.optionLabel]).toLowerCase();
|
|
1446
|
+
return t.includes(n) || r.includes(n);
|
|
1447
|
+
}) : t;
|
|
1448
|
+
}
|
|
1449
|
+
async function $(e, t = !1) {
|
|
1450
|
+
if (!d.url) return;
|
|
1451
|
+
e && typeof e == "object" && (e = e.neq);
|
|
1452
|
+
let { fields: n, include: r, limit: i } = d, a = me.value, o = se.value ?? (t || (/* @__PURE__ */ new RegExp(/^\d+$/)).test(e) ? w.value : F.value ?? S.value), s = {};
|
|
1453
|
+
s = d.filterOptions.length ? d.filterOptions.reduce((t, n) => (t.or ||= [], t.or.push({ [n]: he(e) }), t), {}) : { [o]: he(e) };
|
|
1454
|
+
let c = d.noWhere ? {} : {
|
|
1455
|
+
...e ? s : {},
|
|
1456
|
+
...d.where
|
|
1457
|
+
};
|
|
1458
|
+
d.exprBuilder && Object.assign(c, d.exprBuilder(o, e));
|
|
1459
|
+
let l = {
|
|
1460
|
+
where: c,
|
|
1461
|
+
include: r,
|
|
1462
|
+
limit: i
|
|
1463
|
+
};
|
|
1464
|
+
n && (l.fields = n), a && (Z.store.order = a), K.value = !0, Z.resetPagination();
|
|
1465
|
+
let u;
|
|
1466
|
+
try {
|
|
1467
|
+
u = (await Z.applyFilter({
|
|
1468
|
+
filter: l,
|
|
1469
|
+
params: d.params ?? d.paramsBuilder?.(e)
|
|
1470
|
+
}, { updateRouter: !1 }))?.data;
|
|
1471
|
+
} finally {
|
|
1472
|
+
K.value = !1;
|
|
1473
|
+
}
|
|
1474
|
+
return _e(u), u;
|
|
1475
|
+
}
|
|
1476
|
+
async function ve(e, t) {
|
|
1477
|
+
let n;
|
|
1478
|
+
Te(e) && (e = null), !e && ue.value === e ? t() : (n = d.url && d.limit || !d.limit && Object.keys(B.value).length === 0 ? await $(e) : Q(e, le.value), t(() => {
|
|
1479
|
+
d.noOne && U.toLowerCase().includes(e.toLowerCase()) && n.unshift(de.value), B.value = n;
|
|
1480
|
+
}, (t) => {
|
|
1481
|
+
e !== "" && t.options.length > 0 && (t.setOptionIndex(-1), t.moveOptionSelection(1, !0));
|
|
1482
|
+
})), ue.value = e;
|
|
1483
|
+
}
|
|
1484
|
+
function ye(e) {
|
|
1485
|
+
return e ?? !0;
|
|
1486
|
+
}
|
|
1487
|
+
async function be({ to: e, direction: t, from: n, index: r }) {
|
|
1488
|
+
let i = B.value.length - 1;
|
|
1489
|
+
(n !== 0 || r !== 0) && (q.value || d.fetchRef) && t !== "decrease" && e === i && Z.store.hasMoreData && (await Z.loadMore(), _e(Z.store.data), H.value.scrollTo(i), await C());
|
|
1490
|
+
}
|
|
1491
|
+
t({
|
|
1492
|
+
opts: B,
|
|
1493
|
+
vnSelectRef: H,
|
|
1494
|
+
myOptionsMap: V
|
|
1495
|
+
});
|
|
1496
|
+
function xe(e) {
|
|
1497
|
+
if (ne.value !== !1) return e[ne.value] || e[w.value];
|
|
1498
|
+
}
|
|
1499
|
+
function Se(e) {
|
|
1500
|
+
Array.isArray(e) && (e = e[0]), e && typeof e == "object" && (e = e[w.value]);
|
|
1501
|
+
let t = V.value.get(e);
|
|
1502
|
+
return typeof S.value == "function" ? S.value(t ?? {}) : t?.[S.value] ?? e;
|
|
1503
|
+
}
|
|
1504
|
+
function Ce(e) {
|
|
1505
|
+
e?.code === "Enter" && (e.type === "keydown" && e.ctrlKey && Y.value ? e.stopPropagation() : e.type === "keyup" && !e.ctrlKey && (e.preventDefault(), e.stopPropagation()));
|
|
1506
|
+
}
|
|
1507
|
+
async function we(e, t) {
|
|
1508
|
+
(G.value || e) && (G.value = !1, await C(), H.value?.focus(), !fe.value && t && H.value?.showPopup());
|
|
1509
|
+
}
|
|
1510
|
+
function Te(e) {
|
|
1511
|
+
return Y.value && Array.isArray(e) && !e.length;
|
|
1512
|
+
}
|
|
1513
|
+
return (t, n) => {
|
|
1514
|
+
let r = j("QTooltip"), i = j("QIcon"), l = j("QItemSection"), d = j("QItemLabel"), p = j("QCheckbox"), te = j("QItem"), ne = j("QChip"), O = j("VnSpinner"), N = j("QSelect");
|
|
1515
|
+
return D(), m(N, ee({
|
|
1516
|
+
ref_key: "vnSelectRef",
|
|
1517
|
+
ref: H,
|
|
1518
|
+
modelValue: J.value,
|
|
1519
|
+
"onUpdate:modelValue": n[3] ||= (e) => J.value = e,
|
|
1520
|
+
for: "vnSelectFor",
|
|
1521
|
+
options: B.value,
|
|
1522
|
+
"option-label": P(S),
|
|
1523
|
+
"option-value": P(w)
|
|
1524
|
+
}, {
|
|
1525
|
+
...P(o),
|
|
1526
|
+
...W.value,
|
|
1527
|
+
hideSelected: G.value,
|
|
1528
|
+
useInput: G.value || !J.value
|
|
1529
|
+
}, {
|
|
1530
|
+
onFilter: ve,
|
|
1531
|
+
"emit-value": ye(P(o)["emit-value"]),
|
|
1532
|
+
"map-options": ye(P(o)["map-options"]),
|
|
1533
|
+
"no-option-prefetch": "",
|
|
1534
|
+
"use-input": G.value || !J.value,
|
|
1535
|
+
"fill-input": !1,
|
|
1536
|
+
"lazy-rules": "",
|
|
1537
|
+
class: [{ required: c.value }, "nowrap"],
|
|
1538
|
+
rules: f,
|
|
1539
|
+
"virtual-scroll-slice-size": "options.length",
|
|
1540
|
+
"hide-bottom-space": "",
|
|
1541
|
+
"input-debounce": q.value ? "300" : "0",
|
|
1542
|
+
loading: K.value,
|
|
1543
|
+
onVirtualScroll: be,
|
|
1544
|
+
onPopupHide: n[4] ||= async () => {
|
|
1545
|
+
fe.value = !1, K.value || await we();
|
|
1546
|
+
},
|
|
1547
|
+
onPopupShow: n[5] ||= async () => {
|
|
1548
|
+
fe.value = !0, G.value = !0, await t.$nextTick(), H.value?.$el?.querySelector("input")?.focus();
|
|
1549
|
+
},
|
|
1550
|
+
onKeyup: ae(Ce, ["enter"]),
|
|
1551
|
+
"data-cy": P(o).dataCy ?? P(o).label + "_select",
|
|
1552
|
+
"data-url": e.url,
|
|
1553
|
+
onBlur: n[6] ||= async () => {
|
|
1554
|
+
G.value = !1, await C();
|
|
1555
|
+
},
|
|
1556
|
+
"onUpdate:modelValue": n[7] ||= async (e) => {
|
|
1557
|
+
await we(), Te(e) && (J.value = null, a("remove"));
|
|
1558
|
+
},
|
|
1559
|
+
"is-required": !1,
|
|
1560
|
+
autocomplete: "off",
|
|
1561
|
+
multiple: Y.value,
|
|
1562
|
+
onKeydownCapture: Ce
|
|
1563
|
+
}), v({
|
|
1564
|
+
append: L(() => [R(b(i, {
|
|
1565
|
+
name: "close",
|
|
1566
|
+
onClick: n[0] ||= () => {
|
|
1567
|
+
J.value = null, a("remove");
|
|
1568
|
+
},
|
|
1569
|
+
class: "cursor-pointer",
|
|
1570
|
+
size: "xs",
|
|
1571
|
+
"data-cy": P(o).dataCy ?? P(o).label + "_select_clear"
|
|
1572
|
+
}, {
|
|
1573
|
+
default: L(() => [b(r, null, {
|
|
1574
|
+
default: L(() => [y(M(P(s)("Remove")), 1)]),
|
|
1575
|
+
_: 1
|
|
1576
|
+
})]),
|
|
1577
|
+
_: 1
|
|
1578
|
+
}, 8, ["data-cy"]), [[ie, e.isClearable && J.value != null && J.value !== ""]])]),
|
|
1579
|
+
option: L(({ itemProps: e, opt: t, selected: n, toggleOption: r }) => [b(te, T(x(e)), {
|
|
1580
|
+
default: L(() => [typeof P(S) == "function" ? (D(), m(l, { key: 0 }, {
|
|
1581
|
+
default: L(() => [y(M(P(S)(t)), 1)]),
|
|
1582
|
+
_: 2
|
|
1583
|
+
}, 1024)) : typeof t == "object" ? t[P(w)] == t[P(S)] ? (D(), m(l, { key: 2 }, {
|
|
1584
|
+
default: L(() => [b(d, null, {
|
|
1585
|
+
default: L(() => [y(M(t[P(S)]), 1)]),
|
|
1586
|
+
_: 2
|
|
1587
|
+
}, 1024)]),
|
|
1588
|
+
_: 2
|
|
1589
|
+
}, 1024)) : (D(), m(l, { key: 3 }, {
|
|
1590
|
+
default: L(() => [b(d, null, {
|
|
1591
|
+
default: L(() => [y(M(t[P(S)]), 1)]),
|
|
1592
|
+
_: 2
|
|
1593
|
+
}, 1024), xe(t) === !1 ? h("", !0) : (D(), m(d, {
|
|
1594
|
+
key: 0,
|
|
1595
|
+
caption: ""
|
|
1596
|
+
}, {
|
|
1597
|
+
default: L(() => [y(M(`#${xe(t)}`), 1)]),
|
|
1598
|
+
_: 2
|
|
1599
|
+
}, 1024))]),
|
|
1600
|
+
_: 2
|
|
1601
|
+
}, 1024)) : (D(), m(l, { key: 1 }, {
|
|
1602
|
+
default: L(() => [y(M(t), 1)]),
|
|
1603
|
+
_: 2
|
|
1604
|
+
}, 1024)), Y.value ? (D(), m(l, {
|
|
1605
|
+
key: 4,
|
|
1606
|
+
side: ""
|
|
1607
|
+
}, {
|
|
1608
|
+
default: L(() => [b(p, {
|
|
1609
|
+
dense: "",
|
|
1610
|
+
"model-value": n,
|
|
1611
|
+
"onUpdate:modelValue": (e) => r(t)
|
|
1612
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"])]),
|
|
1613
|
+
_: 2
|
|
1614
|
+
}, 1024)) : h("", !0)]),
|
|
1615
|
+
_: 2
|
|
1616
|
+
}, 1040)]),
|
|
1617
|
+
selected: L(() => [!Y.value && P(z) != null ? (D(), g("span", {
|
|
1618
|
+
key: 0,
|
|
1619
|
+
class: "nowrap",
|
|
1620
|
+
title: Se(P(z)),
|
|
1621
|
+
textContent: M(Se(P(z)))
|
|
1622
|
+
}, null, 8, He)) : P(z)?.length ? (D(), g("div", Ue, [b(ne, {
|
|
1623
|
+
removable: "",
|
|
1624
|
+
dense: "",
|
|
1625
|
+
class: "vn-chip",
|
|
1626
|
+
style: E({ maxWidth: P(z).length > 1 ? "100px" : "120px" }),
|
|
1627
|
+
onRemove: n[2] ||= () => {
|
|
1628
|
+
P(z).shift(), P(z).length || (J.value = null), a("remove");
|
|
1629
|
+
},
|
|
1630
|
+
title: Se(P(z)[0]),
|
|
1631
|
+
"data-cy": "vn-select_chip"
|
|
1632
|
+
}, {
|
|
1633
|
+
default: L(() => [_("span", {
|
|
1634
|
+
class: "ellipsis",
|
|
1635
|
+
textContent: M(Se(P(z)[0]))
|
|
1636
|
+
}, null, 8, We)]),
|
|
1637
|
+
_: 1
|
|
1638
|
+
}, 8, ["style", "title"]), P(z).length > 1 ? (D(), m(ne, {
|
|
1639
|
+
key: 0,
|
|
1640
|
+
dense: "",
|
|
1641
|
+
"data-cy": "vn-select_chip-counter",
|
|
1642
|
+
class: "vn-chip q-mx-none"
|
|
1643
|
+
}, {
|
|
1644
|
+
default: L(() => [y(" +" + M(P(z).length - 1) + " ", 1), b(r, null, {
|
|
1645
|
+
default: L(() => [(D(!0), g(u, null, k(P(z).slice(1), (e, t) => (D(), g("div", {
|
|
1646
|
+
key: t,
|
|
1647
|
+
textContent: M(Se(e))
|
|
1648
|
+
}, null, 8, Ge))), 128))]),
|
|
1649
|
+
_: 1
|
|
1650
|
+
})]),
|
|
1651
|
+
_: 1
|
|
1652
|
+
})) : h("", !0)])) : h("", !0)]),
|
|
1653
|
+
loading: L(() => [b(O, {
|
|
1654
|
+
size: "xs",
|
|
1655
|
+
"data-cy": "vnSelectSpinner"
|
|
1656
|
+
})]),
|
|
1657
|
+
_: 2
|
|
1658
|
+
}, [k(t.$slots, (o, c) => ({
|
|
1659
|
+
name: c,
|
|
1660
|
+
fn: L((o) => [c == "append" ? (D(), g("div", Ve, [R(b(i, {
|
|
1661
|
+
name: "close",
|
|
1662
|
+
onClick: n[1] ||= oe(() => {
|
|
1663
|
+
J.value = null, a("remove");
|
|
1664
|
+
}, ["stop"]),
|
|
1665
|
+
class: "cursor-pointer",
|
|
1666
|
+
size: "xs"
|
|
1667
|
+
}, {
|
|
1668
|
+
default: L(() => [b(r, null, {
|
|
1669
|
+
default: L(() => [y(M(P(s)("Remove")), 1)]),
|
|
1670
|
+
_: 1
|
|
1671
|
+
})]),
|
|
1672
|
+
_: 1
|
|
1673
|
+
}, 512), [[ie, e.isClearable && J.value != null && J.value !== ""]]), t.$slots.append ? A(t.$slots, "append", T(x(o ?? {})), void 0, !0, 0) : h("", !0)])) : A(t.$slots, c, ee(o ?? {}, { key: c }), void 0, !0, 1)])
|
|
1674
|
+
}))]), 1040, [
|
|
1675
|
+
"modelValue",
|
|
1676
|
+
"options",
|
|
1677
|
+
"option-label",
|
|
1678
|
+
"option-value",
|
|
1679
|
+
"emit-value",
|
|
1680
|
+
"map-options",
|
|
1681
|
+
"use-input",
|
|
1682
|
+
"class",
|
|
1683
|
+
"input-debounce",
|
|
1684
|
+
"loading",
|
|
1685
|
+
"data-cy",
|
|
1686
|
+
"data-url",
|
|
1687
|
+
"multiple"
|
|
1688
|
+
]);
|
|
1689
|
+
};
|
|
1690
|
+
}
|
|
1691
|
+
};
|
|
1692
|
+
typeof Be == "function" && Be(Ke);
|
|
1693
|
+
var qe = /*#__PURE__*/ $(Ke, [["__scopeId", "data-v-e5953317"]]), Je = /* @__PURE__ */ e({
|
|
1694
|
+
VnConfirm: () => xe,
|
|
1695
|
+
VnDate: () => De,
|
|
1696
|
+
VnFetch: () => Ne,
|
|
1697
|
+
VnForm: () => ze,
|
|
1698
|
+
VnInput: () => ke,
|
|
1699
|
+
VnInputDate: () => Me,
|
|
1700
|
+
VnSelect: () => qe,
|
|
1701
|
+
VnSkeletonForm: () => Te,
|
|
1702
|
+
VnSpinner: () => Ee
|
|
1703
|
+
});
|
|
1704
|
+
//#endregion
|
|
1705
|
+
export { Me as a, Ee as c, Ne as i, Te as l, qe as n, ke as o, ze as r, De as s, Je as t, xe as u };
|