golden-logic-ui 1.2.365 → 1.2.366
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,15 +1,15 @@
|
|
|
1
|
-
import { ref as x,
|
|
1
|
+
import { ref as x, computed as y, watch as N, createElementBlock as m, openBlock as u, Fragment as B, createCommentVNode as g, normalizeClass as b, createElementVNode as o, toDisplayString as s, createVNode as D } from "vue";
|
|
2
2
|
import M from "./GlDatePicker.vue.js";
|
|
3
|
-
const
|
|
3
|
+
const j = {
|
|
4
4
|
key: 0,
|
|
5
5
|
class: "gl-label-form"
|
|
6
|
-
},
|
|
6
|
+
}, A = { class: "mt-1 text-gray-900 dark:text-white" }, F = ["for"], U = { class: "flex justify-between gap-2 flex-col md:flex-row items-center md:items-start" }, z = { class: "w-full md:flex-1" }, G = { class: "w-full md:flex-1" }, L = {
|
|
7
7
|
key: 1,
|
|
8
8
|
class: "text-center mt-1"
|
|
9
|
-
},
|
|
9
|
+
}, O = { class: "gl-span-form-error" }, P = {
|
|
10
10
|
key: 2,
|
|
11
11
|
class: "block mt-1 text-sm font-normal leading-5 text-gray-500"
|
|
12
|
-
},
|
|
12
|
+
}, $ = {
|
|
13
13
|
__name: "GlDateRangePicker",
|
|
14
14
|
props: {
|
|
15
15
|
is_required: {
|
|
@@ -108,12 +108,14 @@ const B = {
|
|
|
108
108
|
},
|
|
109
109
|
emits: ["update:modelValue", "change"],
|
|
110
110
|
setup(e, { emit: S }) {
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
const r = e, v = S, c = x(""), k = y(
|
|
112
|
+
() => !!(r.label_name_start || r.label_name_end)
|
|
113
|
+
), a = x({
|
|
114
|
+
start: r.modelValue.start,
|
|
115
|
+
end: r.modelValue.end
|
|
114
116
|
});
|
|
115
|
-
|
|
116
|
-
() =>
|
|
117
|
+
N(
|
|
118
|
+
() => r.modelValue,
|
|
117
119
|
(t) => {
|
|
118
120
|
t && (a.value.start = t.start, a.value.end = t.end);
|
|
119
121
|
},
|
|
@@ -121,38 +123,38 @@ const B = {
|
|
|
121
123
|
);
|
|
122
124
|
const f = (t) => {
|
|
123
125
|
if (!t) return null;
|
|
124
|
-
let l, d,
|
|
126
|
+
let l, d, i;
|
|
125
127
|
const n = t.split(/[-/]/);
|
|
126
128
|
if (n.length !== 3) return new Date(t);
|
|
127
|
-
switch (
|
|
129
|
+
switch (r.date_format) {
|
|
128
130
|
case "DD-MM-YYYY":
|
|
129
131
|
case "DD/MM/YYYY":
|
|
130
|
-
|
|
132
|
+
i = parseInt(n[0]), d = parseInt(n[1]) - 1, l = parseInt(n[2]);
|
|
131
133
|
break;
|
|
132
134
|
case "MM-DD-YYYY":
|
|
133
135
|
case "MM/DD/YYYY":
|
|
134
|
-
d = parseInt(n[0]) - 1,
|
|
136
|
+
d = parseInt(n[0]) - 1, i = parseInt(n[1]), l = parseInt(n[2]);
|
|
135
137
|
break;
|
|
136
138
|
default:
|
|
137
|
-
l = parseInt(n[0]), d = parseInt(n[1]) - 1,
|
|
139
|
+
l = parseInt(n[0]), d = parseInt(n[1]) - 1, i = parseInt(n[2]);
|
|
138
140
|
break;
|
|
139
141
|
}
|
|
140
|
-
const Y = new Date(l, d,
|
|
142
|
+
const Y = new Date(l, d, i);
|
|
141
143
|
return isNaN(Y.getTime()) ? null : Y;
|
|
142
|
-
},
|
|
144
|
+
}, V = y(() => a.value.start ? a.value.start : r.min_date_end), q = y(() => a.value.end ? a.value.end : r.max_date_start), _ = (t, l) => {
|
|
143
145
|
if (t && l) {
|
|
144
|
-
const d = f(t),
|
|
145
|
-
if (d &&
|
|
146
|
+
const d = f(t), i = f(l);
|
|
147
|
+
if (d && i && d > i)
|
|
146
148
|
return c.value = "Start date cannot be after end date.", !1;
|
|
147
149
|
}
|
|
148
150
|
return c.value = "", !0;
|
|
149
|
-
},
|
|
151
|
+
}, I = (t) => {
|
|
150
152
|
if (a.value.start = t, a.value.end) {
|
|
151
153
|
const l = f(t), d = f(a.value.end);
|
|
152
154
|
l && d && l > d && (a.value.end = "");
|
|
153
155
|
}
|
|
154
156
|
_(a.value.start, a.value.end), h();
|
|
155
|
-
},
|
|
157
|
+
}, w = (t) => {
|
|
156
158
|
if (a.value.end = t, a.value.start) {
|
|
157
159
|
const l = f(a.value.start), d = f(t);
|
|
158
160
|
l && d && l > d && (a.value.start = "");
|
|
@@ -160,35 +162,35 @@ const B = {
|
|
|
160
162
|
_(a.value.start, a.value.end), h();
|
|
161
163
|
}, h = () => {
|
|
162
164
|
const t = { start: a.value.start, end: a.value.end };
|
|
163
|
-
|
|
164
|
-
},
|
|
165
|
-
return (t, l) => (u(),
|
|
166
|
-
e.show ? (u(),
|
|
165
|
+
v("update:modelValue", t), v("change", t);
|
|
166
|
+
}, C = y(() => ""), E = y(() => "");
|
|
167
|
+
return (t, l) => (u(), m(B, null, [
|
|
168
|
+
e.show ? (u(), m("div", {
|
|
167
169
|
key: 0,
|
|
168
|
-
class:
|
|
170
|
+
class: b(["md:col-span-2", e.field_name])
|
|
169
171
|
}, [
|
|
170
|
-
e.label_name ? (u(),
|
|
171
|
-
|
|
172
|
-
l[2] || (l[2] =
|
|
172
|
+
e.label_name ? (u(), m("label", j, s(e.label_name), 1)) : g("", !0),
|
|
173
|
+
o("p", A, s(e.modelValue.start) + " " + s(e.separator) + " " + s(e.modelValue.end), 1),
|
|
174
|
+
l[2] || (l[2] = o("hr", { class: "opacity-100! bg-gray-200 border-0 dark:bg-gray-700" }, null, -1))
|
|
173
175
|
], 2)) : g("", !0),
|
|
174
|
-
e.show ? g("", !0) : (u(),
|
|
176
|
+
e.show ? g("", !0) : (u(), m("div", {
|
|
175
177
|
key: 1,
|
|
176
|
-
class:
|
|
178
|
+
class: b(["md:col-span-2", {
|
|
177
179
|
[e.field_name]: e.field_name && e.field_name !== "",
|
|
178
180
|
[e.container_class]: e.container_class && e.container_class !== ""
|
|
179
181
|
}])
|
|
180
182
|
}, [
|
|
181
|
-
e.label_name ? (u(),
|
|
183
|
+
e.label_name ? (u(), m("label", {
|
|
182
184
|
key: 0,
|
|
183
|
-
class:
|
|
185
|
+
class: b({
|
|
184
186
|
"gl-label-form": e.error_message == "" && c.value == "",
|
|
185
187
|
"gl-label-form-invalid": e.error_message !== "" || c.value !== "",
|
|
186
188
|
required: e.is_required
|
|
187
189
|
}),
|
|
188
190
|
for: e.field_name
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
|
|
191
|
+
}, s(e.label_name), 11, F)) : g("", !0),
|
|
192
|
+
o("div", U, [
|
|
193
|
+
o("div", z, [
|
|
192
194
|
D(M, {
|
|
193
195
|
modelValue: a.value.start,
|
|
194
196
|
"onUpdate:modelValue": l[0] || (l[0] = (d) => a.value.start = d),
|
|
@@ -198,16 +200,18 @@ const B = {
|
|
|
198
200
|
placeholder: e.placeholder_start,
|
|
199
201
|
date_format: e.date_format,
|
|
200
202
|
min_date: e.min_date_start,
|
|
201
|
-
max_date:
|
|
203
|
+
max_date: q.value,
|
|
202
204
|
disabled_days: e.disabled_days,
|
|
203
205
|
disabled_dates: e.disabled_dates,
|
|
204
206
|
locale: e.locale,
|
|
205
|
-
error_message:
|
|
206
|
-
onChange:
|
|
207
|
+
error_message: C.value,
|
|
208
|
+
onChange: I
|
|
207
209
|
}, null, 8, ["modelValue", "field_name", "label_name", "is_required", "placeholder", "date_format", "min_date", "max_date", "disabled_days", "disabled_dates", "locale", "error_message"])
|
|
208
210
|
]),
|
|
209
|
-
|
|
210
|
-
|
|
211
|
+
o("span", {
|
|
212
|
+
class: b(["text-gray-500 dark:text-gray-400 font-medium shrink-0 py-2 md:py-0 md:flex md:items-center md:h-10", { "md:mt-7": k.value }])
|
|
213
|
+
}, s(e.separator), 3),
|
|
214
|
+
o("div", G, [
|
|
211
215
|
D(M, {
|
|
212
216
|
modelValue: a.value.end,
|
|
213
217
|
"onUpdate:modelValue": l[1] || (l[1] = (d) => a.value.end = d),
|
|
@@ -216,24 +220,24 @@ const B = {
|
|
|
216
220
|
is_required: e.is_required,
|
|
217
221
|
placeholder: e.placeholder_end,
|
|
218
222
|
date_format: e.date_format,
|
|
219
|
-
min_date:
|
|
223
|
+
min_date: V.value,
|
|
220
224
|
max_date: e.max_date_end,
|
|
221
225
|
disabled_days: e.disabled_days,
|
|
222
226
|
disabled_dates: e.disabled_dates,
|
|
223
227
|
locale: e.locale,
|
|
224
|
-
error_message:
|
|
225
|
-
onChange:
|
|
228
|
+
error_message: E.value,
|
|
229
|
+
onChange: w
|
|
226
230
|
}, null, 8, ["modelValue", "field_name", "label_name", "is_required", "placeholder", "date_format", "min_date", "max_date", "disabled_days", "disabled_dates", "locale", "error_message"])
|
|
227
231
|
])
|
|
228
232
|
]),
|
|
229
|
-
c.value || e.error_message ? (u(),
|
|
230
|
-
|
|
233
|
+
c.value || e.error_message ? (u(), m("div", L, [
|
|
234
|
+
o("span", O, s(e.error_message || c.value), 1)
|
|
231
235
|
])) : g("", !0),
|
|
232
|
-
e.description ? (u(),
|
|
236
|
+
e.description ? (u(), m("small", P, s(e.description), 1)) : g("", !0)
|
|
233
237
|
], 2))
|
|
234
238
|
], 64));
|
|
235
239
|
}
|
|
236
240
|
};
|
|
237
241
|
export {
|
|
238
|
-
|
|
242
|
+
$ as default
|
|
239
243
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { computed as u, ref as w, watch as R, createElementBlock as o, openBlock as c, Fragment as J, createCommentVNode as y, normalizeClass as _, createElementVNode as f, toDisplayString as m, createVNode as q } from "vue";
|
|
2
2
|
import N from "./GlDateTimePicker.vue.js";
|
|
3
3
|
const K = {
|
|
4
4
|
key: 0,
|
|
5
5
|
class: "gl-label-form"
|
|
6
|
-
},
|
|
6
|
+
}, Q = { class: "mt-1 text-gray-900 dark:text-white" }, W = ["for"], X = { class: "flex justify-between gap-2 flex-col md:flex-row items-center md:items-start" }, Z = { class: "w-full md:flex-1" }, p = { 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 = {
|
|
@@ -113,26 +113,28 @@ const K = {
|
|
|
113
113
|
},
|
|
114
114
|
emits: ["update:modelValue", "change"],
|
|
115
115
|
setup(e, { emit: P }) {
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
const s = e, b = P, C = u(
|
|
117
|
+
() => !!(s.label_name_start || s.label_name_end)
|
|
118
|
+
), g = w(""), l = w({
|
|
119
|
+
start: s.modelValue.start,
|
|
120
|
+
end: s.modelValue.end
|
|
119
121
|
});
|
|
120
122
|
R(
|
|
121
|
-
() =>
|
|
123
|
+
() => s.modelValue,
|
|
122
124
|
(t) => {
|
|
123
125
|
t && (l.value.start = t.start, l.value.end = t.end);
|
|
124
126
|
},
|
|
125
127
|
{ immediate: !0, deep: !0 }
|
|
126
128
|
);
|
|
127
|
-
const
|
|
129
|
+
const T = (t, a) => {
|
|
128
130
|
let n = t % 12;
|
|
129
131
|
return a === "PM" && (n += 12), n;
|
|
130
|
-
},
|
|
132
|
+
}, E = (t) => {
|
|
131
133
|
if (!t) return null;
|
|
132
134
|
let a, n, r;
|
|
133
135
|
const d = t.split(/[-/]/);
|
|
134
136
|
if (d.length !== 3) return null;
|
|
135
|
-
switch (
|
|
137
|
+
switch (s.date_format) {
|
|
136
138
|
case "DD-MM-YYYY":
|
|
137
139
|
case "DD/MM/YYYY":
|
|
138
140
|
r = parseInt(d[0]), n = parseInt(d[1]) - 1, a = parseInt(d[2]);
|
|
@@ -148,69 +150,69 @@ const K = {
|
|
|
148
150
|
return { year: a, month: n, day: r };
|
|
149
151
|
}, v = (t) => {
|
|
150
152
|
if (!t) return null;
|
|
151
|
-
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 =
|
|
153
|
+
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);
|
|
152
154
|
if (!M) {
|
|
153
|
-
const
|
|
154
|
-
return isNaN(
|
|
155
|
+
const i = new Date(a);
|
|
156
|
+
return isNaN(i.getTime()) ? null : i;
|
|
155
157
|
}
|
|
156
158
|
let D = 0, S = 0;
|
|
157
159
|
if (d) {
|
|
158
|
-
const
|
|
159
|
-
if (
|
|
160
|
-
const V = parseInt(
|
|
161
|
-
S = parseInt(
|
|
162
|
-
const I =
|
|
163
|
-
D = I ?
|
|
160
|
+
const i = d.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)?$/i);
|
|
161
|
+
if (i) {
|
|
162
|
+
const V = parseInt(i[1]);
|
|
163
|
+
S = parseInt(i[2]);
|
|
164
|
+
const I = i[3] ? i[3].toUpperCase() : null;
|
|
165
|
+
D = I ? T(V, I) : V;
|
|
164
166
|
}
|
|
165
167
|
}
|
|
166
|
-
const { year:
|
|
168
|
+
const { year: G, month: H, day: L } = M, k = new Date(G, H, L, D, S);
|
|
167
169
|
return isNaN(k.getTime()) ? null : k;
|
|
168
|
-
},
|
|
170
|
+
}, B = u(() => l.value.start ? l.value.start : s.min_date_end), A = u(() => l.value.end ? l.value.end : s.max_date_start), h = (t, a) => {
|
|
169
171
|
if (t && a) {
|
|
170
172
|
const n = v(t), r = v(a);
|
|
171
173
|
if (n && r && n > r)
|
|
172
|
-
return
|
|
174
|
+
return g.value = "Start date/time cannot be after end date/time.", !1;
|
|
173
175
|
}
|
|
174
|
-
return
|
|
175
|
-
}, A = (t) => {
|
|
176
|
-
l.value.start = t, h(l.value.start, l.value.end), x();
|
|
176
|
+
return g.value = "", !0;
|
|
177
177
|
}, O = (t) => {
|
|
178
|
+
l.value.start = t, h(l.value.start, l.value.end), x();
|
|
179
|
+
}, U = (t) => {
|
|
178
180
|
l.value.end = t, h(l.value.start, l.value.end), x();
|
|
179
181
|
}, Y = (t) => {
|
|
180
182
|
if (!t) return null;
|
|
181
183
|
const a = t.indexOf(" ");
|
|
182
184
|
return a === -1 ? null : t.slice(a + 1).trim();
|
|
183
|
-
},
|
|
185
|
+
}, j = u(() => Y(l.value.start)), F = u(() => Y(l.value.end)), x = () => {
|
|
184
186
|
const t = { start: l.value.start, end: l.value.end };
|
|
185
187
|
b("update:modelValue", t), b("change", t);
|
|
186
|
-
}, $ =
|
|
187
|
-
return (t, a) => (
|
|
188
|
-
e.show ? (
|
|
188
|
+
}, $ = u(() => ""), z = u(() => "");
|
|
189
|
+
return (t, a) => (c(), o(J, null, [
|
|
190
|
+
e.show ? (c(), o("div", {
|
|
189
191
|
key: 0,
|
|
190
192
|
class: _(["md:col-span-2", e.field_name])
|
|
191
193
|
}, [
|
|
192
|
-
e.label_name ? (
|
|
193
|
-
|
|
194
|
-
a[2] || (a[2] =
|
|
194
|
+
e.label_name ? (c(), o("label", K, m(e.label_name), 1)) : y("", !0),
|
|
195
|
+
f("p", Q, m(e.modelValue.start) + " " + m(e.separator) + " " + m(e.modelValue.end), 1),
|
|
196
|
+
a[2] || (a[2] = f("hr", { class: "opacity-100! bg-gray-200 border-0 dark:bg-gray-700" }, null, -1))
|
|
195
197
|
], 2)) : y("", !0),
|
|
196
|
-
e.show ? y("", !0) : (
|
|
198
|
+
e.show ? y("", !0) : (c(), o("div", {
|
|
197
199
|
key: 1,
|
|
198
200
|
class: _(["md:col-span-2", {
|
|
199
201
|
[e.field_name]: e.field_name && e.field_name !== "",
|
|
200
202
|
[e.container_class]: e.container_class && e.container_class !== ""
|
|
201
203
|
}])
|
|
202
204
|
}, [
|
|
203
|
-
e.label_name ? (
|
|
205
|
+
e.label_name ? (c(), o("label", {
|
|
204
206
|
key: 0,
|
|
205
207
|
class: _({
|
|
206
|
-
"gl-label-form": e.error_message == "" &&
|
|
207
|
-
"gl-label-form-invalid": e.error_message !== "" ||
|
|
208
|
+
"gl-label-form": e.error_message == "" && g.value == "",
|
|
209
|
+
"gl-label-form-invalid": e.error_message !== "" || g.value !== "",
|
|
208
210
|
required: e.is_required
|
|
209
211
|
}),
|
|
210
212
|
for: e.field_name
|
|
211
|
-
},
|
|
212
|
-
|
|
213
|
-
|
|
213
|
+
}, m(e.label_name), 11, W)) : y("", !0),
|
|
214
|
+
f("div", X, [
|
|
215
|
+
f("div", Z, [
|
|
214
216
|
q(N, {
|
|
215
217
|
modelValue: l.value.start,
|
|
216
218
|
"onUpdate:modelValue": a[0] || (a[0] = (n) => l.value.start = n),
|
|
@@ -220,18 +222,20 @@ const K = {
|
|
|
220
222
|
placeholder: e.placeholder_start,
|
|
221
223
|
date_format: e.date_format,
|
|
222
224
|
minute_step: e.minute_step,
|
|
223
|
-
default_time:
|
|
225
|
+
default_time: F.value,
|
|
224
226
|
min_date: e.min_date_start,
|
|
225
|
-
max_date:
|
|
227
|
+
max_date: A.value,
|
|
226
228
|
disabled_days: e.disabled_days,
|
|
227
229
|
disabled_dates: e.disabled_dates,
|
|
228
230
|
locale: e.locale,
|
|
229
231
|
error_message: $.value,
|
|
230
|
-
onChange:
|
|
232
|
+
onChange: O
|
|
231
233
|
}, null, 8, ["modelValue", "field_name", "label_name", "is_required", "placeholder", "date_format", "minute_step", "default_time", "min_date", "max_date", "disabled_days", "disabled_dates", "locale", "error_message"])
|
|
232
234
|
]),
|
|
233
|
-
|
|
234
|
-
|
|
235
|
+
f("span", {
|
|
236
|
+
class: _(["text-gray-500 dark:text-gray-400 font-medium shrink-0 py-2 md:py-0 md:flex md:items-center md:h-10", { "md:mt-7": C.value }])
|
|
237
|
+
}, m(e.separator), 3),
|
|
238
|
+
f("div", p, [
|
|
235
239
|
q(N, {
|
|
236
240
|
modelValue: l.value.end,
|
|
237
241
|
"onUpdate:modelValue": a[1] || (a[1] = (n) => l.value.end = n),
|
|
@@ -241,21 +245,21 @@ const K = {
|
|
|
241
245
|
placeholder: e.placeholder_end,
|
|
242
246
|
date_format: e.date_format,
|
|
243
247
|
minute_step: e.minute_step,
|
|
244
|
-
default_time:
|
|
245
|
-
min_date:
|
|
248
|
+
default_time: j.value,
|
|
249
|
+
min_date: B.value,
|
|
246
250
|
max_date: e.max_date_end,
|
|
247
251
|
disabled_days: e.disabled_days,
|
|
248
252
|
disabled_dates: e.disabled_dates,
|
|
249
253
|
locale: e.locale,
|
|
250
254
|
error_message: z.value,
|
|
251
|
-
onChange:
|
|
255
|
+
onChange: U
|
|
252
256
|
}, null, 8, ["modelValue", "field_name", "label_name", "is_required", "placeholder", "date_format", "minute_step", "default_time", "min_date", "max_date", "disabled_days", "disabled_dates", "locale", "error_message"])
|
|
253
257
|
])
|
|
254
258
|
]),
|
|
255
|
-
|
|
256
|
-
|
|
259
|
+
g.value || e.error_message ? (c(), o("div", ee, [
|
|
260
|
+
f("span", te, m(e.error_message || g.value), 1)
|
|
257
261
|
])) : y("", !0),
|
|
258
|
-
e.description ? (
|
|
262
|
+
e.description ? (c(), o("small", ae, m(e.description), 1)) : y("", !0)
|
|
259
263
|
], 2))
|
|
260
264
|
], 64));
|
|
261
265
|
}
|
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.366",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/mrgiant/GoldenLogicUi.git"
|