golden-logic-ui 1.2.346 → 1.2.348
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/GeneralComponents/GlDateTimePicker.vue.js +193 -172
- package/dist/components/GeneralComponents/GlDateTimeRangePicker.vue.js +79 -81
- package/dist/components/GeneralComponents/GlDropdown.vue.js +22 -22
- package/dist/components/GeneralComponents/GlMultiSelectDropdown.vue.js +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
const
|
|
1
|
+
import { ref as h, computed as A, watch as le, onMounted as $e, onUnmounted as Ve, createElementBlock as g, openBlock as m, Fragment as q, createCommentVNode as b, normalizeClass as D, createElementVNode as a, toDisplayString as f, withDirectives as Ie, renderList as se, vShow as Be } from "vue";
|
|
2
|
+
const He = {
|
|
3
3
|
key: 0,
|
|
4
4
|
class: "gl-label-form"
|
|
5
|
-
},
|
|
5
|
+
}, Fe = { class: "mt-1 text-gray-900 dark:text-white" }, Pe = ["for"], Le = { class: "relative" }, Ge = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "flex items-center"
|
|
8
|
-
},
|
|
8
|
+
}, Ae = ["innerHTML"], qe = { class: "relative w-full" }, ze = ["required", "name", "id", "value", "placeholder"], Ee = ["innerHTML"], Ue = {
|
|
9
9
|
key: 1,
|
|
10
10
|
class: "relative"
|
|
11
|
-
},
|
|
11
|
+
}, Ze = ["required", "name", "id", "value", "placeholder"], Re = { class: "absolute z-50 mt-1 bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 p-4 w-full" }, We = { class: "flex items-center justify-between mb-4" }, Je = { class: "text-sm font-semibold text-gray-900 dark:text-white" }, Ke = { class: "grid grid-cols-7 gap-1 mb-2" }, Qe = { class: "grid grid-cols-7 gap-1" }, Xe = ["onClick", "disabled"], je = { class: "mt-4 pt-3 border-t border-gray-200 dark:border-gray-700" }, _e = { class: "flex items-center justify-center gap-2" }, Oe = { class: "text-xs font-medium text-gray-500 dark:text-gray-400 me-1" }, et = { class: "flex flex-col items-center" }, tt = ["value"], rt = { class: "flex flex-col items-center" }, at = ["value"], nt = { class: "flex flex-col gap-1 ms-1" }, ot = { class: "flex items-center justify-between mt-4 pt-3 border-t border-gray-200 dark:border-gray-700" }, lt = { class: "flex items-center gap-3" }, st = { class: "gl-span-form-error" }, it = { class: "block mt-1 text-sm font-normal leading-5 text-gray-500" }, dt = {
|
|
12
12
|
__name: "GlDateTimePicker",
|
|
13
13
|
props: {
|
|
14
14
|
is_required: {
|
|
@@ -62,6 +62,13 @@ const Be = {
|
|
|
62
62
|
type: Number,
|
|
63
63
|
default: 1
|
|
64
64
|
},
|
|
65
|
+
// Default time (e.g. "11:00 AM") used when a date is picked before any
|
|
66
|
+
// time has been chosen. Lets a range picker seed the end picker with the
|
|
67
|
+
// start time so a same-day selection isn't treated as earlier (midnight).
|
|
68
|
+
default_time: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: null
|
|
71
|
+
},
|
|
65
72
|
// Min and max date constraints
|
|
66
73
|
// Accepts: "YYYY-MM-DD" or relative: "+3m", "-1y", "+7d", "today"
|
|
67
74
|
min_date: {
|
|
@@ -99,8 +106,8 @@ const Be = {
|
|
|
99
106
|
}
|
|
100
107
|
},
|
|
101
108
|
emits: ["update:modelValue", "change", "blur-sm"],
|
|
102
|
-
setup(n, { expose:
|
|
103
|
-
const s = n,
|
|
109
|
+
setup(n, { expose: ie, emit: ue }) {
|
|
110
|
+
const s = n, k = ue, T = h(null), F = h(null), w = h(!1), u = h((/* @__PURE__ */ new Date()).getMonth()), c = h((/* @__PURE__ */ new Date()).getFullYear()), v = h(12), x = h(0), M = h("AM"), z = (t) => {
|
|
104
111
|
if (!t) return null;
|
|
105
112
|
if (t.toLowerCase() === "today")
|
|
106
113
|
return /* @__PURE__ */ new Date();
|
|
@@ -113,28 +120,28 @@ const Be = {
|
|
|
113
120
|
if (r) return r;
|
|
114
121
|
const o = new Date(t);
|
|
115
122
|
return isNaN(o.getTime()) ? null : o;
|
|
116
|
-
},
|
|
123
|
+
}, de = A(() => {
|
|
117
124
|
const t = [];
|
|
118
125
|
for (let e = 0; e < 12; e++) {
|
|
119
126
|
const r = new Date(2e3, e, 1);
|
|
120
127
|
t.push(r.toLocaleDateString(s.locale, { month: "long" }));
|
|
121
128
|
}
|
|
122
129
|
return t;
|
|
123
|
-
}),
|
|
130
|
+
}), ce = A(() => {
|
|
124
131
|
const t = [];
|
|
125
132
|
for (let e = 0; e < 7; e++) {
|
|
126
133
|
const r = new Date(2e3, 0, 2 + e);
|
|
127
134
|
t.push(r.toLocaleDateString(s.locale, { weekday: "short" }));
|
|
128
135
|
}
|
|
129
136
|
return t;
|
|
130
|
-
}),
|
|
137
|
+
}), E = (t, e) => {
|
|
131
138
|
let r = t % 12;
|
|
132
139
|
return e === "PM" && (r += 12), r;
|
|
133
|
-
},
|
|
140
|
+
}, P = (t) => {
|
|
134
141
|
const e = t >= 12 ? "PM" : "AM";
|
|
135
142
|
let r = t % 12;
|
|
136
143
|
return r === 0 && (r = 12), { hour: r, meridiem: e };
|
|
137
|
-
},
|
|
144
|
+
}, ge = (t) => {
|
|
138
145
|
const e = t.getFullYear(), r = String(t.getMonth() + 1).padStart(2, "0"), o = String(t.getDate()).padStart(2, "0");
|
|
139
146
|
switch (s.date_format) {
|
|
140
147
|
case "DD-MM-YYYY":
|
|
@@ -150,13 +157,13 @@ const Be = {
|
|
|
150
157
|
default:
|
|
151
158
|
return `${e}-${r}-${o}`;
|
|
152
159
|
}
|
|
153
|
-
},
|
|
154
|
-
const { hour: e, meridiem: r } =
|
|
160
|
+
}, me = (t) => {
|
|
161
|
+
const { hour: e, meridiem: r } = P(t.getHours()), o = String(e).padStart(2, "0"), l = String(t.getMinutes()).padStart(2, "0");
|
|
155
162
|
return `${o}:${l} ${r}`;
|
|
156
163
|
}, V = (t) => {
|
|
157
164
|
if (!t) return "";
|
|
158
165
|
let e;
|
|
159
|
-
return typeof t == "string" && (e =
|
|
166
|
+
return typeof t == "string" && (e = S(t)), (!e || isNaN(e.getTime())) && (e = new Date(t)), isNaN(e.getTime()) ? "" : `${ge(e)} ${me(e)}`;
|
|
160
167
|
}, U = (t) => {
|
|
161
168
|
if (!t) return null;
|
|
162
169
|
let e, r, o;
|
|
@@ -182,7 +189,7 @@ const Be = {
|
|
|
182
189
|
if (!r) return null;
|
|
183
190
|
const { year: o, month: l, day: y } = r, d = new Date(o, l, y);
|
|
184
191
|
return isNaN(d.getTime()) || d.getFullYear() !== o || d.getMonth() !== l || d.getDate() !== y ? null : d;
|
|
185
|
-
},
|
|
192
|
+
}, S = (t) => {
|
|
186
193
|
if (!t) return null;
|
|
187
194
|
const e = String(t).trim(), r = e.indexOf(" "), o = r === -1 ? e : e.slice(0, r), l = r === -1 ? "" : e.slice(r + 1).trim(), y = U(o);
|
|
188
195
|
if (!y) return null;
|
|
@@ -190,36 +197,50 @@ const Be = {
|
|
|
190
197
|
if (l) {
|
|
191
198
|
const $ = l.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)?$/i);
|
|
192
199
|
if ($) {
|
|
193
|
-
const
|
|
200
|
+
const ne = parseInt($[1]);
|
|
194
201
|
i = parseInt($[2]);
|
|
195
|
-
const
|
|
196
|
-
|
|
202
|
+
const oe = $[3] ? $[3].toUpperCase() : null;
|
|
203
|
+
oe ? d = E(ne, oe) : d = ne;
|
|
197
204
|
}
|
|
198
205
|
}
|
|
199
|
-
const { year:
|
|
200
|
-
return isNaN(N.getTime()) || N.getFullYear() !==
|
|
201
|
-
},
|
|
206
|
+
const { year: te, month: re, day: ae } = y, N = new Date(te, re, ae, d, i);
|
|
207
|
+
return isNaN(N.getTime()) || N.getFullYear() !== te || N.getMonth() !== re || N.getDate() !== ae ? null : N;
|
|
208
|
+
}, p = h(""), L = h(!1), I = (t) => {
|
|
202
209
|
if (!t) return;
|
|
203
|
-
let e = typeof t == "string" ?
|
|
210
|
+
let e = typeof t == "string" ? S(t) : null;
|
|
204
211
|
if ((!e || isNaN(e.getTime())) && (e = new Date(t)), isNaN(e.getTime())) return;
|
|
205
|
-
const { hour: r, meridiem: o } =
|
|
206
|
-
|
|
212
|
+
const { hour: r, meridiem: o } = P(e.getHours());
|
|
213
|
+
v.value = r, x.value = e.getMinutes(), M.value = o;
|
|
214
|
+
}, R = () => {
|
|
215
|
+
if (!s.default_time) return;
|
|
216
|
+
const t = String(s.default_time).trim().match(/^(\d{1,2}):(\d{2})\s*(AM|PM)?$/i);
|
|
217
|
+
if (!t) return;
|
|
218
|
+
const e = parseInt(t[1]), r = parseInt(t[2]), o = t[3] ? t[3].toUpperCase() : null;
|
|
219
|
+
if (o)
|
|
220
|
+
v.value = e === 0 ? 12 : e, M.value = o;
|
|
221
|
+
else {
|
|
222
|
+
const l = P(e);
|
|
223
|
+
v.value = l.hour, M.value = l.meridiem;
|
|
224
|
+
}
|
|
225
|
+
x.value = r;
|
|
207
226
|
};
|
|
208
|
-
|
|
209
|
-
L.value || (
|
|
210
|
-
}, { immediate: !0 })
|
|
211
|
-
|
|
227
|
+
le(() => s.modelValue, (t) => {
|
|
228
|
+
L.value || (p.value = V(t), t ? I(t) : R());
|
|
229
|
+
}, { immediate: !0 }), le(() => s.default_time, () => {
|
|
230
|
+
s.modelValue || R();
|
|
231
|
+
});
|
|
232
|
+
const W = (t) => {
|
|
212
233
|
const e = t.target.value;
|
|
213
|
-
|
|
214
|
-
},
|
|
234
|
+
p.value = e, e === "" && (k("update:modelValue", ""), k("change", ""));
|
|
235
|
+
}, J = (t) => {
|
|
215
236
|
L.value = !1;
|
|
216
|
-
const e =
|
|
217
|
-
if (r && !isNaN(r.getTime()) && !
|
|
237
|
+
const e = p.value, r = S(e);
|
|
238
|
+
if (r && !isNaN(r.getTime()) && !C(r)) {
|
|
218
239
|
const o = V(r);
|
|
219
|
-
|
|
220
|
-
} else e !== "" && (
|
|
221
|
-
|
|
222
|
-
},
|
|
240
|
+
p.value = o, I(o), k("update:modelValue", o), k("change", o);
|
|
241
|
+
} else e !== "" && (p.value = V(s.modelValue));
|
|
242
|
+
k("blur-sm", t);
|
|
243
|
+
}, fe = A(() => {
|
|
223
244
|
const t = new Date(c.value, u.value, 1), e = new Date(c.value, u.value + 1, 0), r = t.getDay(), o = e.getDate(), l = [], y = new Date(c.value, u.value, 0).getDate();
|
|
224
245
|
for (let i = r - 1; i >= 0; i--)
|
|
225
246
|
l.push({
|
|
@@ -241,7 +262,7 @@ const Be = {
|
|
|
241
262
|
date: new Date(c.value, u.value + 1, i)
|
|
242
263
|
});
|
|
243
264
|
return l;
|
|
244
|
-
}),
|
|
265
|
+
}), C = (t) => {
|
|
245
266
|
if (s.disabled_days.includes(t.getDay()))
|
|
246
267
|
return !0;
|
|
247
268
|
if (s.disabled_dates && s.disabled_dates.length > 0) {
|
|
@@ -255,66 +276,66 @@ const Be = {
|
|
|
255
276
|
}
|
|
256
277
|
const e = new Date(t);
|
|
257
278
|
if (e.setHours(0, 0, 0, 0), s.min_date) {
|
|
258
|
-
const r =
|
|
279
|
+
const r = z(s.min_date);
|
|
259
280
|
if (r && (r.setHours(0, 0, 0, 0), e < r))
|
|
260
281
|
return !0;
|
|
261
282
|
}
|
|
262
283
|
if (s.max_date) {
|
|
263
|
-
const r =
|
|
284
|
+
const r = z(s.max_date);
|
|
264
285
|
if (r && (r.setHours(0, 0, 0, 0), e > r))
|
|
265
286
|
return !0;
|
|
266
287
|
}
|
|
267
288
|
return !1;
|
|
268
289
|
}, B = (t) => {
|
|
269
290
|
if (!s.modelValue) return !1;
|
|
270
|
-
const e =
|
|
291
|
+
const e = S(s.modelValue) || new Date(s.modelValue);
|
|
271
292
|
return isNaN(e.getTime()) ? !1 : t.toDateString() === e.toDateString();
|
|
272
|
-
},
|
|
273
|
-
const e =
|
|
293
|
+
}, ye = (t) => t.toDateString() === (/* @__PURE__ */ new Date()).toDateString(), ve = (t) => {
|
|
294
|
+
const e = E(v.value, M.value);
|
|
274
295
|
return new Date(
|
|
275
296
|
t.getFullYear(),
|
|
276
297
|
t.getMonth(),
|
|
277
298
|
t.getDate(),
|
|
278
299
|
e,
|
|
279
|
-
|
|
300
|
+
x.value
|
|
280
301
|
);
|
|
281
|
-
},
|
|
282
|
-
const e =
|
|
283
|
-
|
|
284
|
-
},
|
|
285
|
-
const t =
|
|
302
|
+
}, G = (t) => {
|
|
303
|
+
const e = ve(t), r = V(e);
|
|
304
|
+
p.value = r, k("update:modelValue", r), k("change", r);
|
|
305
|
+
}, pe = () => {
|
|
306
|
+
const t = S(s.modelValue);
|
|
286
307
|
return t && !isNaN(t.getTime()) ? t : /* @__PURE__ */ new Date();
|
|
287
|
-
},
|
|
288
|
-
|
|
289
|
-
},
|
|
290
|
-
s.modelValue &&
|
|
291
|
-
}, J = (t) => {
|
|
292
|
-
C.value = t, M();
|
|
308
|
+
}, he = (t) => {
|
|
309
|
+
C(t.date) || G(t.date);
|
|
310
|
+
}, Y = () => {
|
|
311
|
+
s.modelValue && G(pe());
|
|
293
312
|
}, K = (t) => {
|
|
294
|
-
|
|
295
|
-
e > 12 && (e = 1), e < 1 && (e = 12), k.value = e, M();
|
|
313
|
+
M.value = t, Y();
|
|
296
314
|
}, Q = (t) => {
|
|
297
|
-
let e =
|
|
298
|
-
e >
|
|
299
|
-
},
|
|
300
|
-
let e =
|
|
301
|
-
|
|
302
|
-
}, he = (t) => {
|
|
303
|
-
let e = t.target.value.replace(/\D/g, "").slice(0, 2), r = parseInt(e);
|
|
304
|
-
isNaN(r) && (r = 0), r > 59 && (r = 59), r < 0 && (r = 0), t.target.value = e === "" ? "" : String(r), e !== "" && (w.value = r, M());
|
|
315
|
+
let e = v.value + t;
|
|
316
|
+
e > 12 && (e = 1), e < 1 && (e = 12), v.value = e, Y();
|
|
317
|
+
}, X = (t) => {
|
|
318
|
+
let e = x.value + t * s.minute_step;
|
|
319
|
+
e > 59 && (e = 0), e < 0 && (e = 59 - (59 - e) % 60), x.value = (e % 60 + 60) % 60, Y();
|
|
305
320
|
}, ke = (t) => {
|
|
306
|
-
|
|
321
|
+
let e = t.target.value.replace(/\D/g, "").slice(0, 2), r = parseInt(e);
|
|
322
|
+
isNaN(r) && (r = 0), r > 12 && (r = 12), e !== "" && r < 1 && (r = 1), t.target.value = e === "" ? "" : String(r), e !== "" && (v.value = r, Y());
|
|
307
323
|
}, xe = (t) => {
|
|
308
|
-
t.target.value
|
|
309
|
-
|
|
324
|
+
let e = t.target.value.replace(/\D/g, "").slice(0, 2), r = parseInt(e);
|
|
325
|
+
isNaN(r) && (r = 0), r > 59 && (r = 59), r < 0 && (r = 0), t.target.value = e === "" ? "" : String(r), e !== "" && (x.value = r, Y());
|
|
326
|
+
}, be = (t) => {
|
|
327
|
+
v.value < 1 && (v.value = 12), t.target.value = String(v.value).padStart(2, "0"), Y();
|
|
328
|
+
}, De = (t) => {
|
|
329
|
+
t.target.value = String(x.value).padStart(2, "0"), Y();
|
|
330
|
+
}, we = () => {
|
|
310
331
|
u.value === 0 ? (u.value = 11, c.value--) : u.value--;
|
|
311
|
-
},
|
|
332
|
+
}, Me = () => {
|
|
312
333
|
u.value === 11 ? (u.value = 0, c.value++) : u.value++;
|
|
313
|
-
},
|
|
334
|
+
}, Ye = () => {
|
|
314
335
|
c.value--;
|
|
315
|
-
},
|
|
336
|
+
}, Te = () => {
|
|
316
337
|
c.value++;
|
|
317
|
-
},
|
|
338
|
+
}, j = {
|
|
318
339
|
en: {
|
|
319
340
|
clear: "Clear",
|
|
320
341
|
now: "Now",
|
|
@@ -327,40 +348,40 @@ const Be = {
|
|
|
327
348
|
done: "تم",
|
|
328
349
|
time: "الوقت"
|
|
329
350
|
}
|
|
330
|
-
},
|
|
331
|
-
const e =
|
|
332
|
-
return
|
|
333
|
-
},
|
|
351
|
+
}, Se = () => s.locale && s.locale.startsWith("ar") ? "ar" : "en", H = (t) => {
|
|
352
|
+
const e = Se();
|
|
353
|
+
return j[e][t] || j.en[t] || t;
|
|
354
|
+
}, Ce = () => {
|
|
334
355
|
const t = /* @__PURE__ */ new Date();
|
|
335
|
-
u.value = t.getMonth(), c.value = t.getFullYear(), I(t),
|
|
336
|
-
},
|
|
337
|
-
|
|
338
|
-
}, j = () => {
|
|
339
|
-
L.value = !0;
|
|
356
|
+
u.value = t.getMonth(), c.value = t.getFullYear(), I(t), G(t);
|
|
357
|
+
}, Ne = () => {
|
|
358
|
+
p.value = "", k("update:modelValue", ""), k("change", ""), w.value = !1;
|
|
340
359
|
}, _ = () => {
|
|
341
|
-
|
|
342
|
-
|
|
360
|
+
L.value = !0;
|
|
361
|
+
}, O = () => {
|
|
362
|
+
if (w.value = !w.value, w.value && s.modelValue) {
|
|
363
|
+
const t = S(s.modelValue) || new Date(s.modelValue);
|
|
343
364
|
isNaN(t.getTime()) || (u.value = t.getMonth(), c.value = t.getFullYear(), I(t));
|
|
344
365
|
}
|
|
345
|
-
},
|
|
346
|
-
F.value && !F.value.contains(t.target) && (
|
|
366
|
+
}, ee = (t) => {
|
|
367
|
+
F.value && !F.value.contains(t.target) && (w.value = !1);
|
|
347
368
|
};
|
|
348
|
-
return
|
|
349
|
-
document.addEventListener("click",
|
|
350
|
-
}),
|
|
351
|
-
document.removeEventListener("click",
|
|
352
|
-
}),
|
|
369
|
+
return $e(() => {
|
|
370
|
+
document.addEventListener("click", ee), T.value !== null && T.value.hasAttribute("autofocus") && T.value.focus();
|
|
371
|
+
}), Ve(() => {
|
|
372
|
+
document.removeEventListener("click", ee);
|
|
373
|
+
}), ie({ focus: () => T.value?.focus() }), (t, e) => (m(), g(q, null, [
|
|
353
374
|
n.show ? (m(), g("div", {
|
|
354
375
|
key: 0,
|
|
355
|
-
class:
|
|
376
|
+
class: D(n.field_name)
|
|
356
377
|
}, [
|
|
357
|
-
n.label_name ? (m(), g("label",
|
|
358
|
-
a("p",
|
|
378
|
+
n.label_name ? (m(), g("label", He, f(n.label_name), 1)) : b("", !0),
|
|
379
|
+
a("p", Fe, f(p.value), 1),
|
|
359
380
|
e[7] || (e[7] = a("hr", { class: "opacity-100! bg-gray-200 border-0 dark:bg-gray-700" }, null, -1))
|
|
360
|
-
], 2)) :
|
|
361
|
-
n.show ?
|
|
381
|
+
], 2)) : b("", !0),
|
|
382
|
+
n.show ? b("", !0) : (m(), g("div", {
|
|
362
383
|
key: 1,
|
|
363
|
-
class:
|
|
384
|
+
class: D({
|
|
364
385
|
[n.field_name]: n.field_name && n.field_name !== "",
|
|
365
386
|
[n.container_class]: n.container_class && n.container_class !== ""
|
|
366
387
|
}),
|
|
@@ -369,24 +390,24 @@ const Be = {
|
|
|
369
390
|
}, [
|
|
370
391
|
n.label_name ? (m(), g("label", {
|
|
371
392
|
key: 0,
|
|
372
|
-
class:
|
|
393
|
+
class: D({
|
|
373
394
|
"gl-label-form": n.error_message == "",
|
|
374
395
|
"gl-label-form-invalid": n.error_message !== "",
|
|
375
396
|
required: n.is_required
|
|
376
397
|
}),
|
|
377
398
|
for: n.field_name
|
|
378
|
-
}, f(n.label_name), 11,
|
|
399
|
+
}, f(n.label_name), 11, Pe)) : b("", !0),
|
|
379
400
|
a("div", Le, [
|
|
380
|
-
n.inputGroupType ? (m(), g("div",
|
|
401
|
+
n.inputGroupType ? (m(), g("div", Ge, [
|
|
381
402
|
n.inputGroupType == "prepend" ? (m(), g("label", {
|
|
382
403
|
key: 0,
|
|
383
404
|
innerHTML: n.inputGroupText,
|
|
384
405
|
class: "h-10 z-10 inline-flex items-center shrink-0 px-4 text-sm font-medium text-center text-gray-500 bg-gray-100 border border-gray-300 dark:text-gray-400 rounded-s-lg focus:outline-hidden dark:bg-gray-700 dark:border-gray-600"
|
|
385
|
-
}, null, 8,
|
|
406
|
+
}, null, 8, Ae)) : b("", !0),
|
|
386
407
|
a("div", qe, [
|
|
387
408
|
a("input", {
|
|
388
409
|
type: "text",
|
|
389
|
-
class:
|
|
410
|
+
class: D(["rtl:text-right rounded-none!", {
|
|
390
411
|
"gl-input-form": n.error_message == "",
|
|
391
412
|
"gl-input-form-invalid": n.error_message !== "",
|
|
392
413
|
[n.input_class]: n.input_class && n.input_class !== "",
|
|
@@ -396,17 +417,17 @@ const Be = {
|
|
|
396
417
|
required: n.is_required,
|
|
397
418
|
name: n.field_name,
|
|
398
419
|
id: n.field_name,
|
|
399
|
-
value:
|
|
400
|
-
onInput:
|
|
401
|
-
onFocus:
|
|
402
|
-
onBlur:
|
|
420
|
+
value: p.value,
|
|
421
|
+
onInput: W,
|
|
422
|
+
onFocus: _,
|
|
423
|
+
onBlur: J,
|
|
403
424
|
ref_key: "input",
|
|
404
|
-
ref:
|
|
425
|
+
ref: T,
|
|
405
426
|
placeholder: n.placeholder
|
|
406
|
-
}, null, 42,
|
|
427
|
+
}, null, 42, ze),
|
|
407
428
|
a("div", {
|
|
408
429
|
class: "absolute inset-y-0 end-0 flex items-center pe-3 cursor-pointer",
|
|
409
|
-
onClick:
|
|
430
|
+
onClick: O
|
|
410
431
|
}, e[8] || (e[8] = [
|
|
411
432
|
a("svg", {
|
|
412
433
|
class: "w-4 h-4 text-gray-500 dark:text-gray-400",
|
|
@@ -429,12 +450,12 @@ const Be = {
|
|
|
429
450
|
key: 1,
|
|
430
451
|
innerHTML: n.inputGroupText,
|
|
431
452
|
class: "h-10 z-10 inline-flex items-center shrink-0 px-4 text-sm font-medium text-center text-gray-500 bg-gray-100 border border-gray-300 dark:text-gray-400 rounded-e-lg focus:outline-hidden dark:bg-gray-700 dark:border-gray-600"
|
|
432
|
-
}, null, 8,
|
|
433
|
-
])) :
|
|
434
|
-
n.inputGroupType == "" ? (m(), g("div",
|
|
453
|
+
}, null, 8, Ee)) : b("", !0)
|
|
454
|
+
])) : b("", !0),
|
|
455
|
+
n.inputGroupType == "" ? (m(), g("div", Ue, [
|
|
435
456
|
a("input", {
|
|
436
457
|
type: "text",
|
|
437
|
-
class:
|
|
458
|
+
class: D(["rtl:text-right pe-10", {
|
|
438
459
|
"gl-input-form": n.error_message == "",
|
|
439
460
|
"gl-input-form-invalid": n.error_message !== "",
|
|
440
461
|
[n.input_class]: n.input_class && n.input_class !== ""
|
|
@@ -442,17 +463,17 @@ const Be = {
|
|
|
442
463
|
required: n.is_required,
|
|
443
464
|
name: n.field_name,
|
|
444
465
|
id: n.field_name,
|
|
445
|
-
value:
|
|
446
|
-
onInput:
|
|
447
|
-
onFocus:
|
|
448
|
-
onBlur:
|
|
466
|
+
value: p.value,
|
|
467
|
+
onInput: W,
|
|
468
|
+
onFocus: _,
|
|
469
|
+
onBlur: J,
|
|
449
470
|
ref_key: "input",
|
|
450
|
-
ref:
|
|
471
|
+
ref: T,
|
|
451
472
|
placeholder: n.placeholder
|
|
452
|
-
}, null, 42,
|
|
473
|
+
}, null, 42, Ze),
|
|
453
474
|
a("div", {
|
|
454
475
|
class: "absolute inset-y-0 end-0 flex items-center pe-3 cursor-pointer",
|
|
455
|
-
onClick:
|
|
476
|
+
onClick: O
|
|
456
477
|
}, e[9] || (e[9] = [
|
|
457
478
|
a("svg", {
|
|
458
479
|
class: "w-4 h-4 text-gray-500 dark:text-gray-400",
|
|
@@ -470,12 +491,12 @@ const Be = {
|
|
|
470
491
|
})
|
|
471
492
|
], -1)
|
|
472
493
|
]))
|
|
473
|
-
])) :
|
|
474
|
-
|
|
475
|
-
a("div",
|
|
494
|
+
])) : b("", !0),
|
|
495
|
+
Ie(a("div", Re, [
|
|
496
|
+
a("div", We, [
|
|
476
497
|
a("button", {
|
|
477
498
|
type: "button",
|
|
478
|
-
onClick:
|
|
499
|
+
onClick: Ye,
|
|
479
500
|
class: "p-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded text-gray-500 dark:text-gray-400"
|
|
480
501
|
}, e[10] || (e[10] = [
|
|
481
502
|
a("svg", {
|
|
@@ -494,7 +515,7 @@ const Be = {
|
|
|
494
515
|
])),
|
|
495
516
|
a("button", {
|
|
496
517
|
type: "button",
|
|
497
|
-
onClick:
|
|
518
|
+
onClick: we,
|
|
498
519
|
class: "p-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded text-gray-500 dark:text-gray-400"
|
|
499
520
|
}, e[11] || (e[11] = [
|
|
500
521
|
a("svg", {
|
|
@@ -511,10 +532,10 @@ const Be = {
|
|
|
511
532
|
})
|
|
512
533
|
], -1)
|
|
513
534
|
])),
|
|
514
|
-
a("span",
|
|
535
|
+
a("span", Je, f(de.value[u.value]) + " " + f(c.value), 1),
|
|
515
536
|
a("button", {
|
|
516
537
|
type: "button",
|
|
517
|
-
onClick:
|
|
538
|
+
onClick: Me,
|
|
518
539
|
class: "p-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded text-gray-500 dark:text-gray-400"
|
|
519
540
|
}, e[12] || (e[12] = [
|
|
520
541
|
a("svg", {
|
|
@@ -533,7 +554,7 @@ const Be = {
|
|
|
533
554
|
])),
|
|
534
555
|
a("button", {
|
|
535
556
|
type: "button",
|
|
536
|
-
onClick:
|
|
557
|
+
onClick: Te,
|
|
537
558
|
class: "p-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded text-gray-500 dark:text-gray-400"
|
|
538
559
|
}, e[13] || (e[13] = [
|
|
539
560
|
a("svg", {
|
|
@@ -551,38 +572,38 @@ const Be = {
|
|
|
551
572
|
], -1)
|
|
552
573
|
]))
|
|
553
574
|
]),
|
|
554
|
-
a("div",
|
|
555
|
-
(m(!0), g(q, null,
|
|
575
|
+
a("div", Ke, [
|
|
576
|
+
(m(!0), g(q, null, se(ce.value, (r) => (m(), g("div", {
|
|
556
577
|
key: r,
|
|
557
578
|
class: "text-center text-xs font-medium text-gray-500 dark:text-gray-400 py-1"
|
|
558
579
|
}, f(r), 1))), 128))
|
|
559
580
|
]),
|
|
560
|
-
a("div",
|
|
561
|
-
(m(!0), g(q, null,
|
|
581
|
+
a("div", Qe, [
|
|
582
|
+
(m(!0), g(q, null, se(fe.value, (r, o) => (m(), g("button", {
|
|
562
583
|
key: o,
|
|
563
584
|
type: "button",
|
|
564
|
-
onClick: (l) =>
|
|
565
|
-
disabled:
|
|
566
|
-
class:
|
|
585
|
+
onClick: (l) => he(r),
|
|
586
|
+
disabled: C(r.date),
|
|
587
|
+
class: D([
|
|
567
588
|
"w-8 h-8 text-sm rounded-full flex items-center justify-center transition-colors",
|
|
568
589
|
{
|
|
569
590
|
"text-gray-400 dark:text-gray-600": !r.currentMonth,
|
|
570
|
-
"text-gray-900 dark:text-white": r.currentMonth && !B(r.date) && !
|
|
591
|
+
"text-gray-900 dark:text-white": r.currentMonth && !B(r.date) && !C(r.date),
|
|
571
592
|
"bg-primary dark:bg-primaryDark text-white hover:bg-primary/90 dark:hover:bg-primaryDark/90": B(r.date),
|
|
572
|
-
"ring-2 ring-primary dark:ring-primaryDark ring-offset-1 dark:ring-offset-gray-800":
|
|
573
|
-
"hover:bg-gray-100 dark:hover:bg-gray-700": !B(r.date) && !
|
|
574
|
-
"opacity-50 cursor-not-allowed":
|
|
593
|
+
"ring-2 ring-primary dark:ring-primaryDark ring-offset-1 dark:ring-offset-gray-800": ye(r.date) && !B(r.date),
|
|
594
|
+
"hover:bg-gray-100 dark:hover:bg-gray-700": !B(r.date) && !C(r.date),
|
|
595
|
+
"opacity-50 cursor-not-allowed": C(r.date)
|
|
575
596
|
}
|
|
576
597
|
])
|
|
577
|
-
}, f(r.day), 11,
|
|
598
|
+
}, f(r.day), 11, Xe))), 128))
|
|
578
599
|
]),
|
|
579
|
-
a("div",
|
|
580
|
-
a("div",
|
|
581
|
-
a("span",
|
|
582
|
-
a("div",
|
|
600
|
+
a("div", je, [
|
|
601
|
+
a("div", _e, [
|
|
602
|
+
a("span", Oe, f(H("time")), 1),
|
|
603
|
+
a("div", et, [
|
|
583
604
|
a("button", {
|
|
584
605
|
type: "button",
|
|
585
|
-
onClick: e[0] || (e[0] = (r) =>
|
|
606
|
+
onClick: e[0] || (e[0] = (r) => Q(1)),
|
|
586
607
|
class: "p-1 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"
|
|
587
608
|
}, e[14] || (e[14] = [
|
|
588
609
|
a("svg", {
|
|
@@ -603,14 +624,14 @@ const Be = {
|
|
|
603
624
|
type: "text",
|
|
604
625
|
inputmode: "numeric",
|
|
605
626
|
maxlength: "2",
|
|
606
|
-
value: String(
|
|
607
|
-
onInput:
|
|
608
|
-
onBlur:
|
|
627
|
+
value: String(v.value).padStart(2, "0"),
|
|
628
|
+
onInput: ke,
|
|
629
|
+
onBlur: be,
|
|
609
630
|
class: "w-12 text-center text-sm rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white py-1 focus:outline-hidden focus:ring-2 focus:ring-primary dark:focus:ring-primaryDark"
|
|
610
|
-
}, null, 40,
|
|
631
|
+
}, null, 40, tt),
|
|
611
632
|
a("button", {
|
|
612
633
|
type: "button",
|
|
613
|
-
onClick: e[1] || (e[1] = (r) =>
|
|
634
|
+
onClick: e[1] || (e[1] = (r) => Q(-1)),
|
|
614
635
|
class: "p-1 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"
|
|
615
636
|
}, e[15] || (e[15] = [
|
|
616
637
|
a("svg", {
|
|
@@ -629,10 +650,10 @@ const Be = {
|
|
|
629
650
|
]))
|
|
630
651
|
]),
|
|
631
652
|
e[18] || (e[18] = a("span", { class: "text-lg font-semibold text-gray-900 dark:text-white pb-1" }, ":", -1)),
|
|
632
|
-
a("div",
|
|
653
|
+
a("div", rt, [
|
|
633
654
|
a("button", {
|
|
634
655
|
type: "button",
|
|
635
|
-
onClick: e[2] || (e[2] = (r) =>
|
|
656
|
+
onClick: e[2] || (e[2] = (r) => X(1)),
|
|
636
657
|
class: "p-1 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"
|
|
637
658
|
}, e[16] || (e[16] = [
|
|
638
659
|
a("svg", {
|
|
@@ -653,14 +674,14 @@ const Be = {
|
|
|
653
674
|
type: "text",
|
|
654
675
|
inputmode: "numeric",
|
|
655
676
|
maxlength: "2",
|
|
656
|
-
value: String(
|
|
657
|
-
onInput:
|
|
658
|
-
onBlur:
|
|
677
|
+
value: String(x.value).padStart(2, "0"),
|
|
678
|
+
onInput: xe,
|
|
679
|
+
onBlur: De,
|
|
659
680
|
class: "w-12 text-center text-sm rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white py-1 focus:outline-hidden focus:ring-2 focus:ring-primary dark:focus:ring-primaryDark"
|
|
660
|
-
}, null, 40,
|
|
681
|
+
}, null, 40, at),
|
|
661
682
|
a("button", {
|
|
662
683
|
type: "button",
|
|
663
|
-
onClick: e[3] || (e[3] = (r) =>
|
|
684
|
+
onClick: e[3] || (e[3] = (r) => X(-1)),
|
|
664
685
|
class: "p-1 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"
|
|
665
686
|
}, e[17] || (e[17] = [
|
|
666
687
|
a("svg", {
|
|
@@ -678,55 +699,55 @@ const Be = {
|
|
|
678
699
|
], -1)
|
|
679
700
|
]))
|
|
680
701
|
]),
|
|
681
|
-
a("div",
|
|
702
|
+
a("div", nt, [
|
|
682
703
|
a("button", {
|
|
683
704
|
type: "button",
|
|
684
|
-
onClick: e[4] || (e[4] = (r) =>
|
|
685
|
-
class:
|
|
705
|
+
onClick: e[4] || (e[4] = (r) => K("AM")),
|
|
706
|
+
class: D([
|
|
686
707
|
"px-2 py-1 text-xs font-medium rounded-md transition-colors",
|
|
687
|
-
|
|
708
|
+
M.value === "AM" ? "bg-primary dark:bg-primaryDark text-white" : "bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"
|
|
688
709
|
])
|
|
689
710
|
}, " AM ", 2),
|
|
690
711
|
a("button", {
|
|
691
712
|
type: "button",
|
|
692
|
-
onClick: e[5] || (e[5] = (r) =>
|
|
693
|
-
class:
|
|
713
|
+
onClick: e[5] || (e[5] = (r) => K("PM")),
|
|
714
|
+
class: D([
|
|
694
715
|
"px-2 py-1 text-xs font-medium rounded-md transition-colors",
|
|
695
|
-
|
|
716
|
+
M.value === "PM" ? "bg-primary dark:bg-primaryDark text-white" : "bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"
|
|
696
717
|
])
|
|
697
718
|
}, " PM ", 2)
|
|
698
719
|
])
|
|
699
720
|
])
|
|
700
721
|
]),
|
|
701
|
-
a("div",
|
|
722
|
+
a("div", ot, [
|
|
702
723
|
a("button", {
|
|
703
724
|
type: "button",
|
|
704
|
-
onClick:
|
|
725
|
+
onClick: Ne,
|
|
705
726
|
class: "text-sm text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"
|
|
706
727
|
}, f(H("clear")), 1),
|
|
707
|
-
a("div",
|
|
728
|
+
a("div", lt, [
|
|
708
729
|
a("button", {
|
|
709
730
|
type: "button",
|
|
710
|
-
onClick:
|
|
731
|
+
onClick: Ce,
|
|
711
732
|
class: "text-sm text-primary dark:text-primaryDark hover:text-primary/80 dark:hover:text-primaryDark/80 font-medium"
|
|
712
733
|
}, f(H("now")), 1),
|
|
713
734
|
a("button", {
|
|
714
735
|
type: "button",
|
|
715
|
-
onClick: e[6] || (e[6] = (r) =>
|
|
736
|
+
onClick: e[6] || (e[6] = (r) => w.value = !1),
|
|
716
737
|
class: "text-sm text-primary dark:text-primaryDark hover:text-primary/80 dark:hover:text-primaryDark/80 font-medium"
|
|
717
738
|
}, f(H("done")), 1)
|
|
718
739
|
])
|
|
719
740
|
])
|
|
720
741
|
], 512), [
|
|
721
|
-
[
|
|
742
|
+
[Be, w.value]
|
|
722
743
|
])
|
|
723
744
|
]),
|
|
724
|
-
a("span",
|
|
725
|
-
a("small",
|
|
745
|
+
a("span", st, f(n.error_message), 1),
|
|
746
|
+
a("small", it, f(n.description), 1)
|
|
726
747
|
], 2))
|
|
727
748
|
], 64));
|
|
728
749
|
}
|
|
729
750
|
};
|
|
730
751
|
export {
|
|
731
|
-
|
|
752
|
+
dt as default
|
|
732
753
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
1
|
+
import { ref as w, watch as H, computed as g, createElementBlock as m, openBlock as o, Fragment as R, createCommentVNode as y, normalizeClass as v, createElementVNode as c, toDisplayString as u, createVNode as q } from "vue";
|
|
2
|
+
import N from "./GlDateTimePicker.vue.js";
|
|
3
|
+
const J = {
|
|
4
4
|
key: 0,
|
|
5
5
|
class: "gl-label-form"
|
|
6
|
-
},
|
|
6
|
+
}, K = { class: "mt-1 text-gray-900 dark:text-white" }, L = ["for"], Q = { class: "flex justify-between gap-2 flex-col md:flex-row items-center" }, W = { class: "w-full md:flex-1" }, X = { class: "text-gray-500 dark:text-gray-400 font-medium shrink-0 py-2 md:py-0" }, Z = { class: "w-full md:flex-1" }, ee = {
|
|
7
7
|
key: 1,
|
|
8
8
|
class: "text-center mt-1"
|
|
9
|
-
},
|
|
9
|
+
}, te = { class: "gl-span-form-error" }, ae = {
|
|
10
10
|
key: 2,
|
|
11
11
|
class: "block mt-1 text-sm font-normal leading-5 text-gray-500"
|
|
12
|
-
},
|
|
12
|
+
}, de = {
|
|
13
13
|
__name: "GlDateTimeRangePicker",
|
|
14
14
|
props: {
|
|
15
15
|
is_required: {
|
|
@@ -103,154 +103,152 @@ const G = {
|
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
105
|
emits: ["update:modelValue", "change"],
|
|
106
|
-
setup(e, { emit:
|
|
107
|
-
const s = e,
|
|
106
|
+
setup(e, { emit: P }) {
|
|
107
|
+
const s = e, _ = P, f = w(""), l = w({
|
|
108
108
|
start: s.modelValue.start,
|
|
109
109
|
end: s.modelValue.end
|
|
110
110
|
});
|
|
111
|
-
|
|
111
|
+
H(
|
|
112
112
|
() => s.modelValue,
|
|
113
|
-
(
|
|
114
|
-
|
|
113
|
+
(t) => {
|
|
114
|
+
t && (l.value.start = t.start, l.value.end = t.end);
|
|
115
115
|
},
|
|
116
116
|
{ immediate: !0, deep: !0 }
|
|
117
117
|
);
|
|
118
|
-
const C = (
|
|
119
|
-
let
|
|
120
|
-
return
|
|
121
|
-
}, E = (
|
|
122
|
-
if (!
|
|
123
|
-
let
|
|
124
|
-
const d =
|
|
118
|
+
const C = (t, a) => {
|
|
119
|
+
let n = t % 12;
|
|
120
|
+
return a === "PM" && (n += 12), n;
|
|
121
|
+
}, E = (t) => {
|
|
122
|
+
if (!t) return null;
|
|
123
|
+
let a, n, r;
|
|
124
|
+
const d = t.split(/[-/]/);
|
|
125
125
|
if (d.length !== 3) return null;
|
|
126
126
|
switch (s.date_format) {
|
|
127
127
|
case "DD-MM-YYYY":
|
|
128
128
|
case "DD/MM/YYYY":
|
|
129
|
-
r = parseInt(d[0]),
|
|
129
|
+
r = parseInt(d[0]), n = parseInt(d[1]) - 1, a = parseInt(d[2]);
|
|
130
130
|
break;
|
|
131
131
|
case "MM-DD-YYYY":
|
|
132
132
|
case "MM/DD/YYYY":
|
|
133
|
-
|
|
133
|
+
n = parseInt(d[0]) - 1, r = parseInt(d[1]), a = parseInt(d[2]);
|
|
134
134
|
break;
|
|
135
135
|
default:
|
|
136
|
-
|
|
136
|
+
a = parseInt(d[0]), n = parseInt(d[1]) - 1, r = parseInt(d[2]);
|
|
137
137
|
break;
|
|
138
138
|
}
|
|
139
|
-
return { year:
|
|
140
|
-
},
|
|
141
|
-
if (!
|
|
142
|
-
const
|
|
143
|
-
if (!
|
|
144
|
-
const i = new Date(
|
|
139
|
+
return { year: a, month: n, day: r };
|
|
140
|
+
}, h = (t) => {
|
|
141
|
+
if (!t) return null;
|
|
142
|
+
const a = String(t).trim(), n = a.indexOf(" "), r = n === -1 ? a : a.slice(0, n), d = n === -1 ? "" : a.slice(n + 1).trim(), M = E(r);
|
|
143
|
+
if (!M) {
|
|
144
|
+
const i = new Date(a);
|
|
145
145
|
return isNaN(i.getTime()) ? null : i;
|
|
146
146
|
}
|
|
147
|
-
let
|
|
147
|
+
let D = 0, S = 0;
|
|
148
148
|
if (d) {
|
|
149
149
|
const i = d.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)?$/i);
|
|
150
150
|
if (i) {
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
|
|
151
|
+
const V = parseInt(i[1]);
|
|
152
|
+
S = parseInt(i[2]);
|
|
153
|
+
const I = i[3] ? i[3].toUpperCase() : null;
|
|
154
|
+
D = I ? C(V, I) : V;
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
const { year:
|
|
158
|
-
return isNaN(
|
|
159
|
-
},
|
|
160
|
-
if (
|
|
161
|
-
const
|
|
162
|
-
if (
|
|
157
|
+
const { year: z, month: F, day: G } = M, k = new Date(z, F, G, D, S);
|
|
158
|
+
return isNaN(k.getTime()) ? null : k;
|
|
159
|
+
}, T = g(() => l.value.start ? l.value.start : s.min_date_end), B = g(() => l.value.end ? l.value.end : s.max_date_start), b = (t, a) => {
|
|
160
|
+
if (t && a) {
|
|
161
|
+
const n = h(t), r = h(a);
|
|
162
|
+
if (n && r && n > r)
|
|
163
163
|
return f.value = "Start date/time cannot be after end date/time.", !1;
|
|
164
164
|
}
|
|
165
165
|
return f.value = "", !0;
|
|
166
|
-
},
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
const n = { start: l.value.start, end: l.value.end };
|
|
180
|
-
b("update:modelValue", n), b("change", n);
|
|
181
|
-
}, U = v(() => s.error_message ? s.error_message : ""), j = v(() => "");
|
|
182
|
-
return (n, t) => (o(), m(F, null, [
|
|
166
|
+
}, A = (t) => {
|
|
167
|
+
l.value.start = t, b(l.value.start, l.value.end), x();
|
|
168
|
+
}, O = (t) => {
|
|
169
|
+
l.value.end = t, b(l.value.start, l.value.end), x();
|
|
170
|
+
}, Y = (t) => {
|
|
171
|
+
if (!t) return null;
|
|
172
|
+
const a = t.indexOf(" ");
|
|
173
|
+
return a === -1 ? null : t.slice(a + 1).trim();
|
|
174
|
+
}, U = g(() => Y(l.value.start)), j = g(() => Y(l.value.end)), x = () => {
|
|
175
|
+
const t = { start: l.value.start, end: l.value.end };
|
|
176
|
+
_("update:modelValue", t), _("change", t);
|
|
177
|
+
}, $ = g(() => s.error_message ? s.error_message : ""), p = g(() => "");
|
|
178
|
+
return (t, a) => (o(), m(R, null, [
|
|
183
179
|
e.show ? (o(), m("div", {
|
|
184
180
|
key: 0,
|
|
185
|
-
class:
|
|
181
|
+
class: v(["md:col-span-2", e.field_name])
|
|
186
182
|
}, [
|
|
187
|
-
e.label_name ? (o(), m("label",
|
|
188
|
-
c("p",
|
|
189
|
-
|
|
183
|
+
e.label_name ? (o(), m("label", J, u(e.label_name), 1)) : y("", !0),
|
|
184
|
+
c("p", K, u(e.modelValue.start) + " " + u(e.separator) + " " + u(e.modelValue.end), 1),
|
|
185
|
+
a[2] || (a[2] = c("hr", { class: "opacity-100! bg-gray-200 border-0 dark:bg-gray-700" }, null, -1))
|
|
190
186
|
], 2)) : y("", !0),
|
|
191
187
|
e.show ? y("", !0) : (o(), m("div", {
|
|
192
188
|
key: 1,
|
|
193
|
-
class:
|
|
189
|
+
class: v(["md:col-span-2", {
|
|
194
190
|
[e.field_name]: e.field_name && e.field_name !== "",
|
|
195
191
|
[e.container_class]: e.container_class && e.container_class !== ""
|
|
196
192
|
}])
|
|
197
193
|
}, [
|
|
198
194
|
e.label_name ? (o(), m("label", {
|
|
199
195
|
key: 0,
|
|
200
|
-
class:
|
|
196
|
+
class: v({
|
|
201
197
|
"gl-label-form": e.error_message == "" && f.value == "",
|
|
202
198
|
"gl-label-form-invalid": e.error_message !== "" || f.value !== "",
|
|
203
199
|
required: e.is_required
|
|
204
200
|
}),
|
|
205
201
|
for: e.field_name
|
|
206
|
-
}, u(e.label_name), 11,
|
|
207
|
-
c("div",
|
|
208
|
-
c("div",
|
|
209
|
-
q(
|
|
202
|
+
}, u(e.label_name), 11, L)) : y("", !0),
|
|
203
|
+
c("div", Q, [
|
|
204
|
+
c("div", W, [
|
|
205
|
+
q(N, {
|
|
210
206
|
modelValue: l.value.start,
|
|
211
|
-
"onUpdate:modelValue":
|
|
207
|
+
"onUpdate:modelValue": a[0] || (a[0] = (n) => l.value.start = n),
|
|
212
208
|
field_name: e.field_name + "_start",
|
|
213
209
|
is_required: e.is_required,
|
|
214
210
|
placeholder: e.placeholder_start,
|
|
215
211
|
date_format: e.date_format,
|
|
216
212
|
minute_step: e.minute_step,
|
|
213
|
+
default_time: j.value,
|
|
217
214
|
min_date: e.min_date_start,
|
|
218
215
|
max_date: B.value,
|
|
219
216
|
disabled_days: e.disabled_days,
|
|
220
217
|
disabled_dates: e.disabled_dates,
|
|
221
218
|
locale: e.locale,
|
|
222
|
-
error_message:
|
|
223
|
-
onChange:
|
|
224
|
-
}, null, 8, ["modelValue", "field_name", "is_required", "placeholder", "date_format", "minute_step", "min_date", "max_date", "disabled_days", "disabled_dates", "locale", "error_message"])
|
|
219
|
+
error_message: $.value,
|
|
220
|
+
onChange: A
|
|
221
|
+
}, null, 8, ["modelValue", "field_name", "is_required", "placeholder", "date_format", "minute_step", "default_time", "min_date", "max_date", "disabled_days", "disabled_dates", "locale", "error_message"])
|
|
225
222
|
]),
|
|
226
|
-
c("span",
|
|
227
|
-
c("div",
|
|
228
|
-
q(
|
|
223
|
+
c("span", X, u(e.separator), 1),
|
|
224
|
+
c("div", Z, [
|
|
225
|
+
q(N, {
|
|
229
226
|
modelValue: l.value.end,
|
|
230
|
-
"onUpdate:modelValue":
|
|
227
|
+
"onUpdate:modelValue": a[1] || (a[1] = (n) => l.value.end = n),
|
|
231
228
|
field_name: e.field_name + "_end",
|
|
232
229
|
is_required: e.is_required,
|
|
233
230
|
placeholder: e.placeholder_end,
|
|
234
231
|
date_format: e.date_format,
|
|
235
232
|
minute_step: e.minute_step,
|
|
236
|
-
|
|
233
|
+
default_time: U.value,
|
|
234
|
+
min_date: T.value,
|
|
237
235
|
max_date: e.max_date_end,
|
|
238
236
|
disabled_days: e.disabled_days,
|
|
239
237
|
disabled_dates: e.disabled_dates,
|
|
240
238
|
locale: e.locale,
|
|
241
|
-
error_message:
|
|
242
|
-
onChange:
|
|
243
|
-
}, null, 8, ["modelValue", "field_name", "is_required", "placeholder", "date_format", "minute_step", "min_date", "max_date", "disabled_days", "disabled_dates", "locale", "error_message"])
|
|
239
|
+
error_message: p.value,
|
|
240
|
+
onChange: O
|
|
241
|
+
}, null, 8, ["modelValue", "field_name", "is_required", "placeholder", "date_format", "minute_step", "default_time", "min_date", "max_date", "disabled_days", "disabled_dates", "locale", "error_message"])
|
|
244
242
|
])
|
|
245
243
|
]),
|
|
246
|
-
f.value || e.error_message ? (o(), m("div",
|
|
247
|
-
c("span",
|
|
244
|
+
f.value || e.error_message ? (o(), m("div", ee, [
|
|
245
|
+
c("span", te, u(e.error_message || f.value), 1)
|
|
248
246
|
])) : y("", !0),
|
|
249
|
-
e.description ? (o(), m("small",
|
|
247
|
+
e.description ? (o(), m("small", ae, u(e.description), 1)) : y("", !0)
|
|
250
248
|
], 2))
|
|
251
249
|
], 64));
|
|
252
250
|
}
|
|
253
251
|
};
|
|
254
252
|
export {
|
|
255
|
-
|
|
253
|
+
de as default
|
|
256
254
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ref as m, shallowRef as X, onMounted as fe, onBeforeUnmount as ve, watch as M, createElementBlock as c, openBlock as f, Fragment as Y, createCommentVNode as
|
|
2
|
-
const
|
|
1
|
+
import { ref as m, shallowRef as X, onMounted as fe, onBeforeUnmount as ve, watch as M, createElementBlock as c, openBlock as f, Fragment as Y, createCommentVNode as p, normalizeClass as E, createElementVNode as s, toDisplayString as w, withDirectives as P, withModifiers as Z, vShow as ee, vModelText as me, renderList as ge, nextTick as he } from "vue";
|
|
2
|
+
const pe = { class: "font-bold ptext-lg dark:text-white" }, ye = { class: "mt-3 mb-4" }, xe = {
|
|
3
3
|
key: 0,
|
|
4
4
|
class: "bg-blue-100 text-blue-800 text-sm font-medium mb-2 mt-2 me-2 px-2.5 py-0.5 rounded-sm dark:bg-blue-900 dark:text-blue-300"
|
|
5
5
|
}, we = ["name", "id", "value"], be = {
|
|
@@ -8,7 +8,7 @@ const he = { class: "font-bold ptext-lg dark:text-white" }, ye = { class: "mt-3
|
|
|
8
8
|
}, ke = { class: "relative focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:focus:ring-blue-500 dark:focus:border-blue-500" }, Se = { class: "relative showOptions" }, _e = ["value", "placeholder"], Ce = { class: "text-gray-700 bg-white border dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200 absolute w-full z-999999999 rounded-md mt-1 pt-1" }, De = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "border-b border-gray-200 dark:border-gray-700"
|
|
11
|
-
}, Oe = { class: "relative" }, Ee = ["id", "placeholder"], Be = { class: "flex items-center py-2 pr-4" }, $e = ["onClick", "onMousedown", "id"], Me = { class: "flex justify-between items-center py-2
|
|
11
|
+
}, Oe = { class: "relative" }, Ee = ["id", "placeholder"], Be = { class: "flex items-center py-2 pr-4" }, $e = ["onClick", "onMousedown", "id"], Me = { class: "flex justify-between items-center py-2" }, Le = ["innerHTML"], Ie = {
|
|
12
12
|
key: 0,
|
|
13
13
|
class: "flex items-center shrink-0 w-4 h-4 text-green-500 ltr:right-2 rtl:left-2 dark:text-green-400",
|
|
14
14
|
"aria-hidden": "true",
|
|
@@ -111,16 +111,16 @@ const he = { class: "font-bold ptext-lg dark:text-white" }, ye = { class: "mt-3
|
|
|
111
111
|
emits: ["update:modelValue", "selected", "selectionChanged"],
|
|
112
112
|
setup(r, { emit: te }) {
|
|
113
113
|
const o = r, b = te, a = m({}), R = m(!1), y = m(0), x = m(!1), v = m(""), g = m(""), B = m(!1), C = m(1), D = m(null), $ = m(1), i = X([]), L = X([]), T = m([]), le = m(null), F = m(null);
|
|
114
|
-
let O = !1,
|
|
114
|
+
let O = !1, h = null, U = 0, k = null;
|
|
115
115
|
const H = (e) => e?.name === "CanceledError" || e?.name === "AbortError" || typeof axios < "u" && axios.isCancel?.(e), V = async (e = "down") => {
|
|
116
116
|
if (B.value || !o.api_url) return;
|
|
117
|
-
|
|
117
|
+
h && h.abort(), h = new AbortController();
|
|
118
118
|
const t = ++U;
|
|
119
119
|
B.value = !0;
|
|
120
120
|
try {
|
|
121
121
|
const l = e === "up" ? Math.max(C.value - 1, $.value) : C.value, { data: n } = await axios.get(o.api_url, {
|
|
122
122
|
params: { search: v.value, page: l, per_page: 20 },
|
|
123
|
-
signal:
|
|
123
|
+
signal: h.signal
|
|
124
124
|
});
|
|
125
125
|
if (O || t !== U) return;
|
|
126
126
|
if (!n || !n.data) {
|
|
@@ -137,7 +137,7 @@ const he = { class: "font-bold ptext-lg dark:text-white" }, ye = { class: "mt-3
|
|
|
137
137
|
if (H(l)) return;
|
|
138
138
|
console.error("Error fetching data:", l);
|
|
139
139
|
} finally {
|
|
140
|
-
!O && t === U && (B.value = !1,
|
|
140
|
+
!O && t === U && (B.value = !1, h = null);
|
|
141
141
|
}
|
|
142
142
|
}, ne = async (e) => {
|
|
143
143
|
if (!o.api_url || e === null || e === void 0 || e === "") return null;
|
|
@@ -179,7 +179,7 @@ const he = { class: "font-bold ptext-lg dark:text-white" }, ye = { class: "mt-3
|
|
|
179
179
|
x.value = !1;
|
|
180
180
|
return;
|
|
181
181
|
}
|
|
182
|
-
v.value = "", x.value = !0, o.api_url && i.value.length === 0 && V("down"),
|
|
182
|
+
v.value = "", x.value = !0, o.api_url && i.value.length === 0 && V("down"), he(() => {
|
|
183
183
|
const e = document.getElementById(
|
|
184
184
|
`${o.field_name}search${g.value}`
|
|
185
185
|
);
|
|
@@ -207,7 +207,7 @@ const he = { class: "font-bold ptext-lg dark:text-white" }, ye = { class: "mt-3
|
|
|
207
207
|
fe(() => {
|
|
208
208
|
g.value = se(), o.show || (document.body.addEventListener("click", K), document.addEventListener("focusin", z));
|
|
209
209
|
}), ve(() => {
|
|
210
|
-
O = !0,
|
|
210
|
+
O = !0, h && (h.abort(), h = null), k && (clearTimeout(k), k = null), document.body.removeEventListener("click", K), document.removeEventListener("focusin", z);
|
|
211
211
|
});
|
|
212
212
|
function re() {
|
|
213
213
|
const e = L.value, t = o.maxItem, l = v.value;
|
|
@@ -302,7 +302,7 @@ const he = { class: "font-bold ptext-lg dark:text-white" }, ye = { class: "mt-3
|
|
|
302
302
|
}), M(
|
|
303
303
|
() => o.api_url,
|
|
304
304
|
() => {
|
|
305
|
-
|
|
305
|
+
h && (h.abort(), h = null), C.value = 1, D.value = null, $.value = 1, i.value = [];
|
|
306
306
|
},
|
|
307
307
|
{ immediate: !0 }
|
|
308
308
|
), M(
|
|
@@ -336,13 +336,13 @@ const he = { class: "font-bold ptext-lg dark:text-white" }, ye = { class: "mt-3
|
|
|
336
336
|
key: 0,
|
|
337
337
|
class: E(r.field_name)
|
|
338
338
|
}, [
|
|
339
|
-
s("h3",
|
|
339
|
+
s("h3", pe, w(r.label_name), 1),
|
|
340
340
|
s("p", ye, [
|
|
341
|
-
S(a.value) ? (f(), c("span", xe, w(a.value?.name), 1)) :
|
|
341
|
+
S(a.value) ? (f(), c("span", xe, w(a.value?.name), 1)) : p("", !0)
|
|
342
342
|
]),
|
|
343
343
|
t[6] || (t[6] = s("hr", { class: "opacity-100! bg-gray-200 border-0 dark:bg-gray-700" }, null, -1))
|
|
344
|
-
], 2)) :
|
|
345
|
-
r.show ?
|
|
344
|
+
], 2)) : p("", !0),
|
|
345
|
+
r.show ? p("", !0) : (f(), c("div", {
|
|
346
346
|
key: 1,
|
|
347
347
|
class: E(r.field_name)
|
|
348
348
|
}, [
|
|
@@ -360,7 +360,7 @@ const he = { class: "font-bold ptext-lg dark:text-white" }, ye = { class: "mt-3
|
|
|
360
360
|
"gl-label-form-invalid": r.error_message !== "",
|
|
361
361
|
required: r.is_required
|
|
362
362
|
})
|
|
363
|
-
}, w(r.label_name), 3)) :
|
|
363
|
+
}, w(r.label_name), 3)) : p("", !0),
|
|
364
364
|
s("div", ke, [
|
|
365
365
|
s("div", Se, [
|
|
366
366
|
s("input", {
|
|
@@ -423,7 +423,7 @@ const he = { class: "font-bold ptext-lg dark:text-white" }, ye = { class: "mt-3
|
|
|
423
423
|
]), 2))
|
|
424
424
|
]),
|
|
425
425
|
P(s("div", Ce, [
|
|
426
|
-
r.hide_search ?
|
|
426
|
+
r.hide_search ? p("", !0) : (f(), c("div", De, [
|
|
427
427
|
t[10] || (t[10] = s("label", {
|
|
428
428
|
for: "default-search",
|
|
429
429
|
class: "mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white"
|
|
@@ -459,7 +459,7 @@ const he = { class: "font-bold ptext-lg dark:text-white" }, ye = { class: "mt-3
|
|
|
459
459
|
s("div", Be, [
|
|
460
460
|
s("span", null, w(r.custom_option_label) + ' "' + w(v.value) + '"', 1)
|
|
461
461
|
])
|
|
462
|
-
], 32)) :
|
|
462
|
+
], 32)) : p("", !0),
|
|
463
463
|
i.value.length ? (f(!0), c(Y, { key: 1 }, ge(i.value, (l, n) => (f(), c("div", {
|
|
464
464
|
class: E([
|
|
465
465
|
"relative px-2 py-0.5 text-xs leading-4 text-gray-700 no-underline cursor-pointer dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 dark:hover:text-white hover:rounded-sm",
|
|
@@ -482,18 +482,18 @@ const he = { class: "font-bold ptext-lg dark:text-white" }, ye = { class: "mt-3
|
|
|
482
482
|
"stroke-width": "2",
|
|
483
483
|
d: "M1 5.917 5.724 10.5 15 1.5"
|
|
484
484
|
}, null, -1)
|
|
485
|
-
]))) :
|
|
485
|
+
]))) : p("", !0)
|
|
486
486
|
])
|
|
487
|
-
], 42, $e))), 128)) :
|
|
488
|
-
B.value ? (f(), c("div", Te, " Loading... ")) :
|
|
489
|
-
!B.value && i.value.length === 0 && !(r.allow_custom && v.value) ? (f(), c("div", Ue, w(r.no_results_found_placeholder), 1)) :
|
|
487
|
+
], 42, $e))), 128)) : p("", !0),
|
|
488
|
+
B.value ? (f(), c("div", Te, " Loading... ")) : p("", !0),
|
|
489
|
+
!B.value && i.value.length === 0 && !(r.allow_custom && v.value) ? (f(), c("div", Ue, w(r.no_results_found_placeholder), 1)) : p("", !0)
|
|
490
490
|
], 544)
|
|
491
491
|
], 512), [
|
|
492
492
|
[ee, x.value]
|
|
493
493
|
])
|
|
494
494
|
])
|
|
495
495
|
])
|
|
496
|
-
])) :
|
|
496
|
+
])) : p("", !0),
|
|
497
497
|
s("span", Ve, w(r.error_message), 1),
|
|
498
498
|
s("small", je, w(r.description), 1)
|
|
499
499
|
], 2))
|
|
@@ -5,7 +5,7 @@ const re = { class: "font-bold ptext-lg dark:text-white" }, le = { class: "mt-3
|
|
|
5
5
|
}, se = {
|
|
6
6
|
class: "inline-flex ml-2 rounded-md shadow-xs",
|
|
7
7
|
role: "group"
|
|
8
|
-
}, ie = { class: "relative" }, ue = ["onClick"], de = { class: "text-gray-700 bg-white border dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200 absolute w-full z-999999999 rounded-md mt-1 pt-1 showOptions" }, ce = { class: "border-b border-gray-200 dark:border-gray-700" }, fe = { class: "relative" }, ve = ["id", "placeholder"], ge = { class: "overflow-y-auto max-h-64 px-1 py-1" }, me = ["onClick", "onMousedown", "id"], pe = { class: "flex justify-between items-center py-2
|
|
8
|
+
}, ie = { class: "relative" }, ue = ["onClick"], de = { class: "text-gray-700 bg-white border dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200 absolute w-full z-999999999 rounded-md mt-1 pt-1 showOptions" }, ce = { class: "border-b border-gray-200 dark:border-gray-700" }, fe = { class: "relative" }, ve = ["id", "placeholder"], ge = { class: "overflow-y-auto max-h-64 px-1 py-1" }, me = ["onClick", "onMousedown", "id"], pe = { class: "flex justify-between items-center py-2" }, xe = ["innerHTML"], ye = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "flex items-center shrink-0 w-4 h-4 text-green-500 ltr:right-2 rtl:left-2 dark:text-green-400",
|
|
11
11
|
"aria-hidden": "true",
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "The most popular library of interactive components built with Vuejs && Tailwind CSS",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
|
-
"version": "1.2.
|
|
6
|
+
"version": "1.2.348",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/mrgiant/GoldenLogicUi.git"
|