golden-logic-ui 1.2.340 → 1.2.342
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref as
|
|
1
|
+
import { ref as D, computed as S, watch as ee, onMounted as te, onUnmounted as ae, createElementBlock as c, openBlock as g, Fragment as N, createCommentVNode as h, normalizeClass as w, createElementVNode as n, toDisplayString as f, withDirectives as re, renderList as z, vShow as ne } from "vue";
|
|
2
2
|
const le = {
|
|
3
3
|
key: 0,
|
|
4
4
|
class: "gl-label-form"
|
|
@@ -95,17 +95,19 @@ const le = {
|
|
|
95
95
|
},
|
|
96
96
|
emits: ["update:modelValue", "change", "blur-sm"],
|
|
97
97
|
setup(r, { expose: E, emit: A }) {
|
|
98
|
-
const o = r, y = A,
|
|
98
|
+
const o = r, y = A, k = D(null), V = D(null), p = D(!1), u = D((/* @__PURE__ */ new Date()).getMonth()), d = D((/* @__PURE__ */ new Date()).getFullYear()), $ = (t) => {
|
|
99
99
|
if (!t) return null;
|
|
100
100
|
if (t.toLowerCase() === "today")
|
|
101
101
|
return /* @__PURE__ */ new Date();
|
|
102
102
|
const e = t.match(/^([+-]?)(\d+)([dmy])$/i);
|
|
103
103
|
if (e) {
|
|
104
|
-
const
|
|
105
|
-
return
|
|
104
|
+
const s = e[1] === "-" ? -1 : 1, m = parseInt(e[2]) * s, Y = e[3].toLowerCase(), i = /* @__PURE__ */ new Date();
|
|
105
|
+
return Y === "d" ? i.setDate(i.getDate() + m) : Y === "m" ? i.setMonth(i.getMonth() + m) : Y === "y" && i.setFullYear(i.getFullYear() + m), i;
|
|
106
106
|
}
|
|
107
|
-
const a =
|
|
108
|
-
|
|
107
|
+
const a = x(t);
|
|
108
|
+
if (a) return a;
|
|
109
|
+
const l = new Date(t);
|
|
110
|
+
return isNaN(l.getTime()) ? null : l;
|
|
109
111
|
}, P = S(() => {
|
|
110
112
|
const t = [];
|
|
111
113
|
for (let e = 0; e < 12; e++) {
|
|
@@ -123,7 +125,7 @@ const le = {
|
|
|
123
125
|
}), M = (t) => {
|
|
124
126
|
if (!t) return "";
|
|
125
127
|
let e;
|
|
126
|
-
if (typeof t == "string" && (e =
|
|
128
|
+
if (typeof t == "string" && (e = x(t)), (!e || isNaN(e.getTime())) && (e = new Date(t)), isNaN(e.getTime())) return "";
|
|
127
129
|
const a = e.getFullYear(), l = String(e.getMonth() + 1).padStart(2, "0"), s = String(e.getDate()).padStart(2, "0");
|
|
128
130
|
switch (o.date_format) {
|
|
129
131
|
case "DD-MM-YYYY":
|
|
@@ -139,7 +141,7 @@ const le = {
|
|
|
139
141
|
default:
|
|
140
142
|
return `${a}-${l}-${s}`;
|
|
141
143
|
}
|
|
142
|
-
},
|
|
144
|
+
}, x = (t) => {
|
|
143
145
|
if (!t) return null;
|
|
144
146
|
let e, a, l;
|
|
145
147
|
const s = t.split(/[-/]/);
|
|
@@ -159,7 +161,7 @@ const le = {
|
|
|
159
161
|
}
|
|
160
162
|
const m = new Date(e, a, l);
|
|
161
163
|
return isNaN(m.getTime()) || m.getFullYear() !== e || m.getMonth() !== a || m.getDate() !== l ? null : m;
|
|
162
|
-
}, v =
|
|
164
|
+
}, v = D(""), C = D(!1);
|
|
163
165
|
ee(() => o.modelValue, (t) => {
|
|
164
166
|
C.value || (v.value = M(t));
|
|
165
167
|
}, { immediate: !0 });
|
|
@@ -168,32 +170,32 @@ const le = {
|
|
|
168
170
|
v.value = e, e === "" && (y("update:modelValue", ""), y("change", ""));
|
|
169
171
|
}, I = (t) => {
|
|
170
172
|
C.value = !1;
|
|
171
|
-
const e = v.value, a =
|
|
173
|
+
const e = v.value, a = x(e);
|
|
172
174
|
if (a && !isNaN(a.getTime()) && !b(a)) {
|
|
173
175
|
const l = M(a);
|
|
174
176
|
v.value = l, y("update:modelValue", l), y("change", l);
|
|
175
177
|
} else e !== "" && (v.value = M(o.modelValue));
|
|
176
178
|
y("blur-sm", t);
|
|
177
179
|
}, U = S(() => {
|
|
178
|
-
const t = new Date(d.value,
|
|
179
|
-
for (let
|
|
180
|
+
const t = new Date(d.value, u.value, 1), e = new Date(d.value, u.value + 1, 0), a = t.getDay(), l = e.getDate(), s = [], m = new Date(d.value, u.value, 0).getDate();
|
|
181
|
+
for (let i = a - 1; i >= 0; i--)
|
|
180
182
|
s.push({
|
|
181
|
-
day: m -
|
|
183
|
+
day: m - i,
|
|
182
184
|
currentMonth: !1,
|
|
183
|
-
date: new Date(d.value,
|
|
185
|
+
date: new Date(d.value, u.value - 1, m - i)
|
|
184
186
|
});
|
|
185
|
-
for (let
|
|
187
|
+
for (let i = 1; i <= l; i++)
|
|
186
188
|
s.push({
|
|
187
|
-
day:
|
|
189
|
+
day: i,
|
|
188
190
|
currentMonth: !0,
|
|
189
|
-
date: new Date(d.value,
|
|
191
|
+
date: new Date(d.value, u.value, i)
|
|
190
192
|
});
|
|
191
|
-
const
|
|
192
|
-
for (let
|
|
193
|
+
const Y = 42 - s.length;
|
|
194
|
+
for (let i = 1; i <= Y; i++)
|
|
193
195
|
s.push({
|
|
194
|
-
day:
|
|
196
|
+
day: i,
|
|
195
197
|
currentMonth: !1,
|
|
196
|
-
date: new Date(d.value,
|
|
198
|
+
date: new Date(d.value, u.value + 1, i)
|
|
197
199
|
});
|
|
198
200
|
return s;
|
|
199
201
|
}), b = (t) => {
|
|
@@ -204,7 +206,7 @@ const le = {
|
|
|
204
206
|
e.setHours(0, 0, 0, 0);
|
|
205
207
|
for (const a of o.disabled_dates) {
|
|
206
208
|
let l;
|
|
207
|
-
if (typeof a == "string" ? (l =
|
|
209
|
+
if (typeof a == "string" ? (l = x(a), (!l || isNaN(l.getTime())) && (l = new Date(a))) : a instanceof Date && (l = a), l && !isNaN(l.getTime()) && (l.setHours(0, 0, 0, 0), e.getTime() === l.getTime()))
|
|
208
210
|
return !0;
|
|
209
211
|
}
|
|
210
212
|
}
|
|
@@ -221,16 +223,16 @@ const le = {
|
|
|
221
223
|
return !1;
|
|
222
224
|
}, T = (t) => {
|
|
223
225
|
if (!o.modelValue) return !1;
|
|
224
|
-
const e =
|
|
226
|
+
const e = x(o.modelValue) || new Date(o.modelValue);
|
|
225
227
|
return t.toDateString() === e.toDateString();
|
|
226
228
|
}, W = (t) => t.toDateString() === (/* @__PURE__ */ new Date()).toDateString(), B = (t) => {
|
|
227
229
|
if (b(t.date)) return;
|
|
228
230
|
const e = M(t.date);
|
|
229
|
-
y("update:modelValue", e), y("change", e),
|
|
231
|
+
y("update:modelValue", e), y("change", e), p.value = !1;
|
|
230
232
|
}, J = () => {
|
|
231
|
-
|
|
233
|
+
u.value === 0 ? (u.value = 11, d.value--) : u.value--;
|
|
232
234
|
}, K = () => {
|
|
233
|
-
|
|
235
|
+
u.value === 11 ? (u.value = 0, d.value++) : u.value++;
|
|
234
236
|
}, Q = () => {
|
|
235
237
|
d.value--;
|
|
236
238
|
}, X = () => {
|
|
@@ -249,33 +251,33 @@ const le = {
|
|
|
249
251
|
return L[e][t] || L.en[t] || t;
|
|
250
252
|
}, j = () => {
|
|
251
253
|
const t = /* @__PURE__ */ new Date();
|
|
252
|
-
|
|
254
|
+
u.value = t.getMonth(), d.value = t.getFullYear(), B({ date: t });
|
|
253
255
|
}, O = () => {
|
|
254
|
-
v.value = "", y("update:modelValue", ""), y("change", ""),
|
|
256
|
+
v.value = "", y("update:modelValue", ""), y("change", ""), p.value = !1;
|
|
255
257
|
}, G = () => {
|
|
256
258
|
C.value = !0;
|
|
257
259
|
}, q = () => {
|
|
258
|
-
if (
|
|
259
|
-
const t =
|
|
260
|
-
isNaN(t.getTime()) || (
|
|
260
|
+
if (p.value = !p.value, p.value && o.modelValue) {
|
|
261
|
+
const t = x(o.modelValue) || new Date(o.modelValue);
|
|
262
|
+
isNaN(t.getTime()) || (u.value = t.getMonth(), d.value = t.getFullYear());
|
|
261
263
|
}
|
|
262
264
|
}, Z = (t) => {
|
|
263
|
-
V.value && !V.value.contains(t.target) && (
|
|
265
|
+
V.value && !V.value.contains(t.target) && (p.value = !1);
|
|
264
266
|
};
|
|
265
267
|
return te(() => {
|
|
266
|
-
document.addEventListener("click", Z),
|
|
268
|
+
document.addEventListener("click", Z), k.value !== null && k.value.hasAttribute("autofocus") && k.value.focus();
|
|
267
269
|
}), ae(() => {
|
|
268
270
|
document.removeEventListener("click", Z);
|
|
269
|
-
}), E({ focus: () =>
|
|
271
|
+
}), E({ focus: () => k.value?.focus() }), (t, e) => (g(), c(N, null, [
|
|
270
272
|
r.show ? (g(), c("div", {
|
|
271
273
|
key: 0,
|
|
272
274
|
class: w(r.field_name)
|
|
273
275
|
}, [
|
|
274
|
-
r.label_name ? (g(), c("label", le, f(r.label_name), 1)) :
|
|
276
|
+
r.label_name ? (g(), c("label", le, f(r.label_name), 1)) : h("", !0),
|
|
275
277
|
n("p", se, f(v.value), 1),
|
|
276
278
|
e[0] || (e[0] = n("hr", { class: "opacity-100! bg-gray-200 border-0 dark:bg-gray-700" }, null, -1))
|
|
277
|
-
], 2)) :
|
|
278
|
-
r.show ?
|
|
279
|
+
], 2)) : h("", !0),
|
|
280
|
+
r.show ? h("", !0) : (g(), c("div", {
|
|
279
281
|
key: 1,
|
|
280
282
|
class: w({
|
|
281
283
|
[r.field_name]: r.field_name && r.field_name !== "",
|
|
@@ -292,14 +294,14 @@ const le = {
|
|
|
292
294
|
required: r.is_required
|
|
293
295
|
}),
|
|
294
296
|
for: r.field_name
|
|
295
|
-
}, f(r.label_name), 11, oe)) :
|
|
297
|
+
}, f(r.label_name), 11, oe)) : h("", !0),
|
|
296
298
|
n("div", ie, [
|
|
297
299
|
r.inputGroupType ? (g(), c("div", ue, [
|
|
298
300
|
r.inputGroupType == "prepend" ? (g(), c("label", {
|
|
299
301
|
key: 0,
|
|
300
302
|
innerHTML: r.inputGroupText,
|
|
301
303
|
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"
|
|
302
|
-
}, null, 8, de)) :
|
|
304
|
+
}, null, 8, de)) : h("", !0),
|
|
303
305
|
n("div", ce, [
|
|
304
306
|
n("input", {
|
|
305
307
|
type: "text",
|
|
@@ -318,7 +320,7 @@ const le = {
|
|
|
318
320
|
onFocus: G,
|
|
319
321
|
onBlur: I,
|
|
320
322
|
ref_key: "input",
|
|
321
|
-
ref:
|
|
323
|
+
ref: k,
|
|
322
324
|
placeholder: r.placeholder
|
|
323
325
|
}, null, 42, ge),
|
|
324
326
|
n("div", {
|
|
@@ -340,8 +342,8 @@ const le = {
|
|
|
340
342
|
key: 1,
|
|
341
343
|
innerHTML: r.inputGroupText,
|
|
342
344
|
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"
|
|
343
|
-
}, null, 8, me)) :
|
|
344
|
-
])) :
|
|
345
|
+
}, null, 8, me)) : h("", !0)
|
|
346
|
+
])) : h("", !0),
|
|
345
347
|
r.inputGroupType == "" ? (g(), c("div", fe, [
|
|
346
348
|
n("input", {
|
|
347
349
|
type: "text",
|
|
@@ -358,7 +360,7 @@ const le = {
|
|
|
358
360
|
onFocus: G,
|
|
359
361
|
onBlur: I,
|
|
360
362
|
ref_key: "input",
|
|
361
|
-
ref:
|
|
363
|
+
ref: k,
|
|
362
364
|
placeholder: r.placeholder
|
|
363
365
|
}, null, 42, ye),
|
|
364
366
|
n("div", {
|
|
@@ -375,7 +377,7 @@ const le = {
|
|
|
375
377
|
n("path", { d: "M20 4a2 2 0 0 0-2-2h-2V1a1 1 0 0 0-2 0v1h-3V1a1 1 0 0 0-2 0v1H6V1a1 1 0 0 0-2 0v1H2a2 2 0 0 0-2 2v2h20V4ZM0 18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8H0v10Zm5-8h10a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Z" })
|
|
376
378
|
], -1)
|
|
377
379
|
]))
|
|
378
|
-
])) :
|
|
380
|
+
])) : h("", !0),
|
|
379
381
|
re(n("div", ve, [
|
|
380
382
|
n("div", he, [
|
|
381
383
|
n("button", {
|
|
@@ -416,7 +418,7 @@ const le = {
|
|
|
416
418
|
})
|
|
417
419
|
], -1)
|
|
418
420
|
])),
|
|
419
|
-
n("span", pe, f(P.value[
|
|
421
|
+
n("span", pe, f(P.value[u.value]) + " " + f(d.value), 1),
|
|
420
422
|
n("button", {
|
|
421
423
|
type: "button",
|
|
422
424
|
onClick: K,
|
|
@@ -494,7 +496,7 @@ const le = {
|
|
|
494
496
|
}, f(F("today")), 1)
|
|
495
497
|
])
|
|
496
498
|
], 512), [
|
|
497
|
-
[ne,
|
|
499
|
+
[ne, p.value]
|
|
498
500
|
])
|
|
499
501
|
]),
|
|
500
502
|
n("span", we, f(r.error_message), 1),
|
|
@@ -156,7 +156,7 @@ const B = {
|
|
|
156
156
|
return (t, l) => (o(), u(N, null, [
|
|
157
157
|
e.show ? (o(), u("div", {
|
|
158
158
|
key: 0,
|
|
159
|
-
class: v(e.field_name)
|
|
159
|
+
class: v(["md:col-span-2", e.field_name])
|
|
160
160
|
}, [
|
|
161
161
|
e.label_name ? (o(), u("label", B, s(e.label_name), 1)) : g("", !0),
|
|
162
162
|
m("p", j, s(e.modelValue.start) + " " + s(e.separator) + " " + s(e.modelValue.end), 1),
|
|
@@ -164,10 +164,10 @@ const B = {
|
|
|
164
164
|
], 2)) : g("", !0),
|
|
165
165
|
e.show ? g("", !0) : (o(), u("div", {
|
|
166
166
|
key: 1,
|
|
167
|
-
class: v({
|
|
167
|
+
class: v(["md:col-span-2", {
|
|
168
168
|
[e.field_name]: e.field_name && e.field_name !== "",
|
|
169
169
|
[e.container_class]: e.container_class && e.container_class !== ""
|
|
170
|
-
})
|
|
170
|
+
}])
|
|
171
171
|
}, [
|
|
172
172
|
e.label_name ? (o(), u("label", {
|
|
173
173
|
key: 0,
|
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.342",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/mrgiant/GoldenLogicUi.git"
|