golden-logic-ui 1.2.347 → 1.2.349

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 x, watch as C, computed as y, createElementBlock as u, openBlock as o, Fragment as N, createCommentVNode as g, normalizeClass as v, createElementVNode as m, toDisplayString as s, createVNode as D } from "vue";
1
+ import { ref as x, watch as C, computed as y, createElementBlock as i, openBlock as u, Fragment as N, createCommentVNode as g, normalizeClass as v, createElementVNode as m, toDisplayString as r, createVNode as D } from "vue";
2
2
  import M from "./GlDatePicker.vue.js";
3
3
  const B = {
4
4
  key: 0,
@@ -36,6 +36,15 @@ const B = {
36
36
  type: String,
37
37
  default: ""
38
38
  },
39
+ // Optional per-picker labels shown above the start / end fields
40
+ label_name_start: {
41
+ type: String,
42
+ default: ""
43
+ },
44
+ label_name_end: {
45
+ type: String,
46
+ default: ""
47
+ },
39
48
  description: {
40
49
  type: String,
41
50
  default: ""
@@ -98,13 +107,13 @@ const B = {
98
107
  }
99
108
  },
100
109
  emits: ["update:modelValue", "change"],
101
- setup(e, { emit: k }) {
102
- const r = e, b = k, c = x(""), a = x({
103
- start: r.modelValue.start,
104
- end: r.modelValue.end
110
+ setup(e, { emit: S }) {
111
+ const o = e, b = S, c = x(""), a = x({
112
+ start: o.modelValue.start,
113
+ end: o.modelValue.end
105
114
  });
106
115
  C(
107
- () => r.modelValue,
116
+ () => o.modelValue,
108
117
  (t) => {
109
118
  t && (a.value.start = t.start, a.value.end = t.end);
110
119
  },
@@ -112,28 +121,28 @@ const B = {
112
121
  );
113
122
  const f = (t) => {
114
123
  if (!t) return null;
115
- let l, d, i;
124
+ let l, d, s;
116
125
  const n = t.split(/[-/]/);
117
126
  if (n.length !== 3) return new Date(t);
118
- switch (r.date_format) {
127
+ switch (o.date_format) {
119
128
  case "DD-MM-YYYY":
120
129
  case "DD/MM/YYYY":
121
- i = parseInt(n[0]), d = parseInt(n[1]) - 1, l = parseInt(n[2]);
130
+ s = parseInt(n[0]), d = parseInt(n[1]) - 1, l = parseInt(n[2]);
122
131
  break;
123
132
  case "MM-DD-YYYY":
124
133
  case "MM/DD/YYYY":
125
- d = parseInt(n[0]) - 1, i = parseInt(n[1]), l = parseInt(n[2]);
134
+ d = parseInt(n[0]) - 1, s = parseInt(n[1]), l = parseInt(n[2]);
126
135
  break;
127
136
  default:
128
- l = parseInt(n[0]), d = parseInt(n[1]) - 1, i = parseInt(n[2]);
137
+ l = parseInt(n[0]), d = parseInt(n[1]) - 1, s = parseInt(n[2]);
129
138
  break;
130
139
  }
131
- const Y = new Date(l, d, i);
140
+ const Y = new Date(l, d, s);
132
141
  return isNaN(Y.getTime()) ? null : Y;
133
- }, S = y(() => a.value.start ? a.value.start : r.min_date_end), V = y(() => a.value.end ? a.value.end : r.max_date_start), _ = (t, l) => {
142
+ }, k = y(() => a.value.start ? a.value.start : o.min_date_end), V = y(() => a.value.end ? a.value.end : o.max_date_start), _ = (t, l) => {
134
143
  if (t && l) {
135
- const d = f(t), i = f(l);
136
- if (d && i && d > i)
144
+ const d = f(t), s = f(l);
145
+ if (d && s && d > s)
137
146
  return c.value = "Start date cannot be after end date.", !1;
138
147
  }
139
148
  return c.value = "", !0;
@@ -152,24 +161,24 @@ const B = {
152
161
  }, h = () => {
153
162
  const t = { start: a.value.start, end: a.value.end };
154
163
  b("update:modelValue", t), b("change", t);
155
- }, w = y(() => r.error_message ? r.error_message : ""), E = y(() => "");
156
- return (t, l) => (o(), u(N, null, [
157
- e.show ? (o(), u("div", {
164
+ }, w = y(() => ""), E = y(() => "");
165
+ return (t, l) => (u(), i(N, null, [
166
+ e.show ? (u(), i("div", {
158
167
  key: 0,
159
168
  class: v(["md:col-span-2", e.field_name])
160
169
  }, [
161
- e.label_name ? (o(), u("label", B, s(e.label_name), 1)) : g("", !0),
162
- m("p", j, s(e.modelValue.start) + " " + s(e.separator) + " " + s(e.modelValue.end), 1),
170
+ e.label_name ? (u(), i("label", B, r(e.label_name), 1)) : g("", !0),
171
+ m("p", j, r(e.modelValue.start) + " " + r(e.separator) + " " + r(e.modelValue.end), 1),
163
172
  l[2] || (l[2] = m("hr", { class: "opacity-100! bg-gray-200 border-0 dark:bg-gray-700" }, null, -1))
164
173
  ], 2)) : g("", !0),
165
- e.show ? g("", !0) : (o(), u("div", {
174
+ e.show ? g("", !0) : (u(), i("div", {
166
175
  key: 1,
167
176
  class: v(["md:col-span-2", {
168
177
  [e.field_name]: e.field_name && e.field_name !== "",
169
178
  [e.container_class]: e.container_class && e.container_class !== ""
170
179
  }])
171
180
  }, [
172
- e.label_name ? (o(), u("label", {
181
+ e.label_name ? (u(), i("label", {
173
182
  key: 0,
174
183
  class: v({
175
184
  "gl-label-form": e.error_message == "" && c.value == "",
@@ -177,13 +186,14 @@ const B = {
177
186
  required: e.is_required
178
187
  }),
179
188
  for: e.field_name
180
- }, s(e.label_name), 11, A)) : g("", !0),
189
+ }, r(e.label_name), 11, A)) : g("", !0),
181
190
  m("div", U, [
182
191
  m("div", z, [
183
192
  D(M, {
184
193
  modelValue: a.value.start,
185
194
  "onUpdate:modelValue": l[0] || (l[0] = (d) => a.value.start = d),
186
195
  field_name: e.field_name + "_start",
196
+ label_name: e.label_name_start,
187
197
  is_required: e.is_required,
188
198
  placeholder: e.placeholder_start,
189
199
  date_format: e.date_format,
@@ -194,31 +204,32 @@ const B = {
194
204
  locale: e.locale,
195
205
  error_message: w.value,
196
206
  onChange: q
197
- }, null, 8, ["modelValue", "field_name", "is_required", "placeholder", "date_format", "min_date", "max_date", "disabled_days", "disabled_dates", "locale", "error_message"])
207
+ }, null, 8, ["modelValue", "field_name", "label_name", "is_required", "placeholder", "date_format", "min_date", "max_date", "disabled_days", "disabled_dates", "locale", "error_message"])
198
208
  ]),
199
- m("span", F, s(e.separator), 1),
209
+ m("span", F, r(e.separator), 1),
200
210
  m("div", G, [
201
211
  D(M, {
202
212
  modelValue: a.value.end,
203
213
  "onUpdate:modelValue": l[1] || (l[1] = (d) => a.value.end = d),
204
214
  field_name: e.field_name + "_end",
215
+ label_name: e.label_name_end,
205
216
  is_required: e.is_required,
206
217
  placeholder: e.placeholder_end,
207
218
  date_format: e.date_format,
208
- min_date: S.value,
219
+ min_date: k.value,
209
220
  max_date: e.max_date_end,
210
221
  disabled_days: e.disabled_days,
211
222
  disabled_dates: e.disabled_dates,
212
223
  locale: e.locale,
213
224
  error_message: E.value,
214
225
  onChange: I
215
- }, null, 8, ["modelValue", "field_name", "is_required", "placeholder", "date_format", "min_date", "max_date", "disabled_days", "disabled_dates", "locale", "error_message"])
226
+ }, null, 8, ["modelValue", "field_name", "label_name", "is_required", "placeholder", "date_format", "min_date", "max_date", "disabled_days", "disabled_dates", "locale", "error_message"])
216
227
  ])
217
228
  ]),
218
- c.value || e.error_message ? (o(), u("div", O, [
219
- m("span", P, s(e.error_message || c.value), 1)
229
+ c.value || e.error_message ? (u(), i("div", O, [
230
+ m("span", P, r(e.error_message || c.value), 1)
220
231
  ])) : g("", !0),
221
- e.description ? (o(), u("small", R, s(e.description), 1)) : g("", !0)
232
+ e.description ? (u(), i("small", R, r(e.description), 1)) : g("", !0)
222
233
  ], 2))
223
234
  ], 64));
224
235
  }
@@ -1,14 +1,14 @@
1
- import { ref as p, computed as G, watch as Ce, onMounted as Ne, onUnmounted as $e, createElementBlock as g, openBlock as m, Fragment as q, createCommentVNode as x, normalizeClass as b, createElementVNode as a, toDisplayString as f, withDirectives as Ve, renderList as oe, vShow as Ie } from "vue";
2
- const Be = {
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
- }, He = { class: "mt-1 text-gray-900 dark:text-white" }, Fe = ["for"], Le = { class: "relative" }, Pe = {
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
- }, Ge = ["innerHTML"], qe = { class: "relative w-full" }, Ae = ["required", "name", "id", "value", "placeholder"], ze = ["innerHTML"], Ee = {
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
- }, Ue = ["required", "name", "id", "value", "placeholder"], Ze = { 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" }, Re = { class: "flex items-center justify-between mb-4" }, We = { class: "text-sm font-semibold text-gray-900 dark:text-white" }, Je = { class: "grid grid-cols-7 gap-1 mb-2" }, Ke = { class: "grid grid-cols-7 gap-1" }, Qe = ["onClick", "disabled"], Xe = { class: "mt-4 pt-3 border-t border-gray-200 dark:border-gray-700" }, je = { class: "flex items-center justify-center gap-2" }, _e = { class: "text-xs font-medium text-gray-500 dark:text-gray-400 me-1" }, Oe = { class: "flex flex-col items-center" }, et = ["value"], tt = { class: "flex flex-col items-center" }, rt = ["value"], at = { class: "flex flex-col gap-1 ms-1" }, nt = { class: "flex items-center justify-between mt-4 pt-3 border-t border-gray-200 dark:border-gray-700" }, ot = { class: "flex items-center gap-3" }, lt = { class: "gl-span-form-error" }, st = { class: "block mt-1 text-sm font-normal leading-5 text-gray-500" }, ut = {
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: le, emit: se }) {
103
- const s = n, h = se, Y = p(null), F = p(null), D = p(!1), u = p((/* @__PURE__ */ new Date()).getMonth()), c = p((/* @__PURE__ */ new Date()).getFullYear()), k = p(12), w = p(0), C = p("AM"), A = (t) => {
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
- }, ie = G(() => {
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
- }), ue = G(() => {
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
- }), z = (t, e) => {
137
+ }), E = (t, e) => {
131
138
  let r = t % 12;
132
139
  return e === "PM" && (r += 12), r;
133
- }, E = (t) => {
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
- }, de = (t) => {
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
- }, ce = (t) => {
154
- const { hour: e, meridiem: r } = E(t.getHours()), o = String(e).padStart(2, "0"), l = String(t.getMinutes()).padStart(2, "0");
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 = T(t)), (!e || isNaN(e.getTime())) && (e = new Date(t)), isNaN(e.getTime()) ? "" : `${de(e)} ${ce(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
- }, T = (t) => {
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 ae = parseInt($[1]);
200
+ const ne = parseInt($[1]);
194
201
  i = parseInt($[2]);
195
- const ne = $[3] ? $[3].toUpperCase() : null;
196
- ne ? d = z(ae, ne) : d = ae;
202
+ const oe = $[3] ? $[3].toUpperCase() : null;
203
+ oe ? d = E(ne, oe) : d = ne;
197
204
  }
198
205
  }
199
- const { year: ee, month: te, day: re } = y, N = new Date(ee, te, re, d, i);
200
- return isNaN(N.getTime()) || N.getFullYear() !== ee || N.getMonth() !== te || N.getDate() !== re ? null : N;
201
- }, v = p(""), L = p(!1), I = (t) => {
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" ? T(t) : null;
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 } = E(e.getHours());
206
- k.value = r, w.value = e.getMinutes(), C.value = o;
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
- Ce(() => s.modelValue, (t) => {
209
- L.value || (v.value = V(t), I(t));
210
- }, { immediate: !0 });
211
- const R = (t) => {
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
- v.value = e, e === "" && (h("update:modelValue", ""), h("change", ""));
214
- }, W = (t) => {
234
+ p.value = e, e === "" && (k("update:modelValue", ""), k("change", ""));
235
+ }, J = (t) => {
215
236
  L.value = !1;
216
- const e = v.value, r = T(e);
217
- if (r && !isNaN(r.getTime()) && !S(r)) {
237
+ const e = p.value, r = S(e);
238
+ if (r && !isNaN(r.getTime()) && !C(r)) {
218
239
  const o = V(r);
219
- v.value = o, I(o), h("update:modelValue", o), h("change", o);
220
- } else e !== "" && (v.value = V(s.modelValue));
221
- h("blur-sm", t);
222
- }, ge = G(() => {
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
- }), S = (t) => {
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 = A(s.min_date);
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 = A(s.max_date);
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 = T(s.modelValue) || new Date(s.modelValue);
291
+ const e = S(s.modelValue) || new Date(s.modelValue);
271
292
  return isNaN(e.getTime()) ? !1 : t.toDateString() === e.toDateString();
272
- }, me = (t) => t.toDateString() === (/* @__PURE__ */ new Date()).toDateString(), fe = (t) => {
273
- const e = z(k.value, C.value);
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
- w.value
300
+ x.value
280
301
  );
281
- }, P = (t) => {
282
- const e = fe(t), r = V(e);
283
- v.value = r, h("update:modelValue", r), h("change", r);
284
- }, ye = () => {
285
- const t = T(s.modelValue);
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
- }, ve = (t) => {
288
- S(t.date) || P(t.date);
289
- }, M = () => {
290
- s.modelValue && P(ye());
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
- let e = k.value + t;
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 = w.value + t * s.minute_step;
298
- e > 59 && (e = 0), e < 0 && (e = 59 - (59 - e) % 60), w.value = (e % 60 + 60) % 60, M();
299
- }, pe = (t) => {
300
- let e = t.target.value.replace(/\D/g, "").slice(0, 2), r = parseInt(e);
301
- isNaN(r) && (r = 0), r > 12 && (r = 12), e !== "" && r < 1 && (r = 1), t.target.value = e === "" ? "" : String(r), e !== "" && (k.value = r, M());
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
- k.value < 1 && (k.value = 12), t.target.value = String(k.value).padStart(2, "0"), M();
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 = String(w.value).padStart(2, "0"), M();
309
- }, be = () => {
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
- }, De = () => {
332
+ }, Me = () => {
312
333
  u.value === 11 ? (u.value = 0, c.value++) : u.value++;
313
- }, we = () => {
334
+ }, Ye = () => {
314
335
  c.value--;
315
- }, Me = () => {
336
+ }, Te = () => {
316
337
  c.value++;
317
- }, X = {
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
- }, Ye = () => s.locale && s.locale.startsWith("ar") ? "ar" : "en", H = (t) => {
331
- const e = Ye();
332
- return X[e][t] || X.en[t] || t;
333
- }, Te = () => {
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), P(t);
336
- }, Se = () => {
337
- v.value = "", h("update:modelValue", ""), h("change", ""), D.value = !1;
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
- if (D.value = !D.value, D.value && s.modelValue) {
342
- const t = T(s.modelValue) || new Date(s.modelValue);
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
- }, O = (t) => {
346
- F.value && !F.value.contains(t.target) && (D.value = !1);
366
+ }, ee = (t) => {
367
+ F.value && !F.value.contains(t.target) && (w.value = !1);
347
368
  };
348
- return Ne(() => {
349
- document.addEventListener("click", O), Y.value !== null && Y.value.hasAttribute("autofocus") && Y.value.focus();
350
- }), $e(() => {
351
- document.removeEventListener("click", O);
352
- }), le({ focus: () => Y.value?.focus() }), (t, e) => (m(), g(q, null, [
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: b(n.field_name)
376
+ class: D(n.field_name)
356
377
  }, [
357
- n.label_name ? (m(), g("label", Be, f(n.label_name), 1)) : x("", !0),
358
- a("p", He, f(v.value), 1),
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)) : x("", !0),
361
- n.show ? x("", !0) : (m(), g("div", {
381
+ ], 2)) : b("", !0),
382
+ n.show ? b("", !0) : (m(), g("div", {
362
383
  key: 1,
363
- class: b({
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: b({
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, Fe)) : x("", !0),
399
+ }, f(n.label_name), 11, Pe)) : b("", !0),
379
400
  a("div", Le, [
380
- n.inputGroupType ? (m(), g("div", Pe, [
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, Ge)) : x("", !0),
406
+ }, null, 8, Ae)) : b("", !0),
386
407
  a("div", qe, [
387
408
  a("input", {
388
409
  type: "text",
389
- class: b(["rtl:text-right rounded-none!", {
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: v.value,
400
- onInput: R,
401
- onFocus: j,
402
- onBlur: W,
420
+ value: p.value,
421
+ onInput: W,
422
+ onFocus: _,
423
+ onBlur: J,
403
424
  ref_key: "input",
404
- ref: Y,
425
+ ref: T,
405
426
  placeholder: n.placeholder
406
- }, null, 42, Ae),
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, ze)) : x("", !0)
433
- ])) : x("", !0),
434
- n.inputGroupType == "" ? (m(), g("div", Ee, [
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: b(["rtl:text-right pe-10", {
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: v.value,
446
- onInput: R,
447
- onFocus: j,
448
- onBlur: W,
466
+ value: p.value,
467
+ onInput: W,
468
+ onFocus: _,
469
+ onBlur: J,
449
470
  ref_key: "input",
450
- ref: Y,
471
+ ref: T,
451
472
  placeholder: n.placeholder
452
- }, null, 42, Ue),
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
- ])) : x("", !0),
474
- Ve(a("div", Ze, [
475
- a("div", Re, [
494
+ ])) : b("", !0),
495
+ Ie(a("div", Re, [
496
+ a("div", We, [
476
497
  a("button", {
477
498
  type: "button",
478
- onClick: we,
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: be,
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", We, f(ie.value[u.value]) + " " + f(c.value), 1),
535
+ a("span", Je, f(de.value[u.value]) + " " + f(c.value), 1),
515
536
  a("button", {
516
537
  type: "button",
517
- onClick: De,
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: Me,
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", Je, [
555
- (m(!0), g(q, null, oe(ue.value, (r) => (m(), g("div", {
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", Ke, [
561
- (m(!0), g(q, null, oe(ge.value, (r, o) => (m(), g("button", {
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) => ve(r),
565
- disabled: S(r.date),
566
- class: b([
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) && !S(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": me(r.date) && !B(r.date),
573
- "hover:bg-gray-100 dark:hover:bg-gray-700": !B(r.date) && !S(r.date),
574
- "opacity-50 cursor-not-allowed": S(r.date)
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, Qe))), 128))
598
+ }, f(r.day), 11, Xe))), 128))
578
599
  ]),
579
- a("div", Xe, [
580
- a("div", je, [
581
- a("span", _e, f(H("time")), 1),
582
- a("div", Oe, [
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) => K(1)),
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(k.value).padStart(2, "0"),
607
- onInput: pe,
608
- onBlur: ke,
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, et),
631
+ }, null, 40, tt),
611
632
  a("button", {
612
633
  type: "button",
613
- onClick: e[1] || (e[1] = (r) => K(-1)),
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", tt, [
653
+ a("div", rt, [
633
654
  a("button", {
634
655
  type: "button",
635
- onClick: e[2] || (e[2] = (r) => Q(1)),
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(w.value).padStart(2, "0"),
657
- onInput: he,
658
- onBlur: xe,
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, rt),
681
+ }, null, 40, at),
661
682
  a("button", {
662
683
  type: "button",
663
- onClick: e[3] || (e[3] = (r) => Q(-1)),
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", at, [
702
+ a("div", nt, [
682
703
  a("button", {
683
704
  type: "button",
684
- onClick: e[4] || (e[4] = (r) => J("AM")),
685
- class: b([
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
- C.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"
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) => J("PM")),
693
- class: b([
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
- C.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"
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", nt, [
722
+ a("div", ot, [
702
723
  a("button", {
703
724
  type: "button",
704
- onClick: Se,
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", ot, [
728
+ a("div", lt, [
708
729
  a("button", {
709
730
  type: "button",
710
- onClick: Te,
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) => D.value = !1),
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
- [Ie, D.value]
742
+ [Be, w.value]
722
743
  ])
723
744
  ]),
724
- a("span", lt, f(n.error_message), 1),
725
- a("small", st, f(n.description), 1)
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
- ut as default
752
+ dt as default
732
753
  };
@@ -1,15 +1,15 @@
1
- import { ref as I, watch as z, computed as v, createElementBlock as m, openBlock as o, Fragment as F, createCommentVNode as y, normalizeClass as h, createElementVNode as c, toDisplayString as u, createVNode as q } from "vue";
2
- import w from "./GlDateTimePicker.vue.js";
3
- const G = {
1
+ import { ref as w, watch as R, computed as g, createElementBlock as m, openBlock as u, Fragment as J, createCommentVNode as y, normalizeClass as _, createElementVNode as o, toDisplayString as i, createVNode as q } from "vue";
2
+ import N from "./GlDateTimePicker.vue.js";
3
+ const K = {
4
4
  key: 0,
5
5
  class: "gl-label-form"
6
- }, H = { class: "mt-1 text-gray-900 dark:text-white" }, R = ["for"], J = { class: "flex justify-between gap-2 flex-col md:flex-row items-center" }, K = { class: "w-full md:flex-1" }, L = { class: "text-gray-500 dark:text-gray-400 font-medium shrink-0 py-2 md:py-0" }, Q = { class: "w-full md:flex-1" }, W = {
6
+ }, L = { class: "mt-1 text-gray-900 dark:text-white" }, Q = ["for"], W = { class: "flex justify-between gap-2 flex-col md:flex-row items-center" }, X = { class: "w-full md:flex-1" }, Z = { class: "text-gray-500 dark:text-gray-400 font-medium shrink-0 py-2 md:py-0" }, p = { class: "w-full md:flex-1" }, ee = {
7
7
  key: 1,
8
8
  class: "text-center mt-1"
9
- }, X = { class: "gl-span-form-error" }, Z = {
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
- }, ae = {
12
+ }, de = {
13
13
  __name: "GlDateTimeRangePicker",
14
14
  props: {
15
15
  is_required: {
@@ -36,6 +36,15 @@ const G = {
36
36
  type: String,
37
37
  default: ""
38
38
  },
39
+ // Optional per-picker labels shown above the start / end fields
40
+ label_name_start: {
41
+ type: String,
42
+ default: ""
43
+ },
44
+ label_name_end: {
45
+ type: String,
46
+ default: ""
47
+ },
39
48
  description: {
40
49
  type: String,
41
50
  default: ""
@@ -103,154 +112,154 @@ const G = {
103
112
  }
104
113
  },
105
114
  emits: ["update:modelValue", "change"],
106
- setup(e, { emit: N }) {
107
- const s = e, b = N, f = I(""), l = I({
108
- start: s.modelValue.start,
109
- end: s.modelValue.end
115
+ setup(e, { emit: P }) {
116
+ const c = e, b = P, f = w(""), l = w({
117
+ start: c.modelValue.start,
118
+ end: c.modelValue.end
110
119
  });
111
- z(
112
- () => s.modelValue,
113
- (n) => {
114
- n && (l.value.start = n.start, l.value.end = n.end);
120
+ R(
121
+ () => c.modelValue,
122
+ (t) => {
123
+ t && (l.value.start = t.start, l.value.end = t.end);
115
124
  },
116
125
  { immediate: !0, deep: !0 }
117
126
  );
118
- const C = (n, t) => {
119
- let a = n % 12;
120
- return t === "PM" && (a += 12), a;
121
- }, E = (n) => {
122
- if (!n) return null;
123
- let t, a, r;
124
- const d = n.split(/[-/]/);
127
+ const C = (t, a) => {
128
+ let n = t % 12;
129
+ return a === "PM" && (n += 12), n;
130
+ }, E = (t) => {
131
+ if (!t) return null;
132
+ let a, n, r;
133
+ const d = t.split(/[-/]/);
125
134
  if (d.length !== 3) return null;
126
- switch (s.date_format) {
135
+ switch (c.date_format) {
127
136
  case "DD-MM-YYYY":
128
137
  case "DD/MM/YYYY":
129
- r = parseInt(d[0]), a = parseInt(d[1]) - 1, t = parseInt(d[2]);
138
+ r = parseInt(d[0]), n = parseInt(d[1]) - 1, a = parseInt(d[2]);
130
139
  break;
131
140
  case "MM-DD-YYYY":
132
141
  case "MM/DD/YYYY":
133
- a = parseInt(d[0]) - 1, r = parseInt(d[1]), t = parseInt(d[2]);
142
+ n = parseInt(d[0]) - 1, r = parseInt(d[1]), a = parseInt(d[2]);
134
143
  break;
135
144
  default:
136
- t = parseInt(d[0]), a = parseInt(d[1]) - 1, r = parseInt(d[2]);
145
+ a = parseInt(d[0]), n = parseInt(d[1]) - 1, r = parseInt(d[2]);
137
146
  break;
138
147
  }
139
- return { year: t, month: a, day: r };
140
- }, g = (n) => {
141
- if (!n) return null;
142
- const t = String(n).trim(), a = t.indexOf(" "), r = a === -1 ? t : t.slice(0, a), d = a === -1 ? "" : t.slice(a + 1).trim(), x = E(r);
143
- if (!x) {
144
- const i = new Date(t);
145
- return isNaN(i.getTime()) ? null : i;
148
+ return { year: a, month: n, day: r };
149
+ }, v = (t) => {
150
+ 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 = E(r);
152
+ if (!M) {
153
+ const s = new Date(a);
154
+ return isNaN(s.getTime()) ? null : s;
146
155
  }
147
- let M = 0, D = 0;
156
+ let S = 0, D = 0;
148
157
  if (d) {
149
- const i = d.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)?$/i);
150
- if (i) {
151
- const k = parseInt(i[1]);
152
- D = parseInt(i[2]);
153
- const V = i[3] ? i[3].toUpperCase() : null;
154
- M = V ? C(k, V) : k;
158
+ const s = d.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)?$/i);
159
+ if (s) {
160
+ const V = parseInt(s[1]);
161
+ D = parseInt(s[2]);
162
+ const I = s[3] ? s[3].toUpperCase() : null;
163
+ S = I ? C(V, I) : V;
155
164
  }
156
165
  }
157
- const { year: O, month: $, day: p } = x, S = new Date(O, $, p, M, D);
158
- return isNaN(S.getTime()) ? null : S;
159
- }, P = v(() => l.value.start ? l.value.start : s.min_date_end), B = v(() => l.value.end ? l.value.end : s.max_date_start), _ = (n, t) => {
160
- if (n && t) {
161
- const a = g(n), r = g(t);
162
- if (a && r && a > r)
166
+ const { year: F, month: G, day: H } = M, k = new Date(F, G, H, S, D);
167
+ return isNaN(k.getTime()) ? null : k;
168
+ }, T = g(() => l.value.start ? l.value.start : c.min_date_end), B = g(() => l.value.end ? l.value.end : c.max_date_start), h = (t, a) => {
169
+ if (t && a) {
170
+ const n = v(t), r = v(a);
171
+ if (n && r && n > r)
163
172
  return f.value = "Start date/time cannot be after end date/time.", !1;
164
173
  }
165
174
  return f.value = "", !0;
166
- }, T = (n) => {
167
- if (l.value.start = n, l.value.end) {
168
- const t = g(n), a = g(l.value.end);
169
- t && a && t > a && (l.value.end = "");
170
- }
171
- _(l.value.start, l.value.end), Y();
172
- }, A = (n) => {
173
- if (l.value.end = n, l.value.start) {
174
- const t = g(l.value.start), a = g(n);
175
- t && a && t > a && (l.value.start = "");
176
- }
177
- _(l.value.start, l.value.end), Y();
178
- }, Y = () => {
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, [
183
- e.show ? (o(), m("div", {
175
+ }, A = (t) => {
176
+ l.value.start = t, h(l.value.start, l.value.end), x();
177
+ }, O = (t) => {
178
+ l.value.end = t, h(l.value.start, l.value.end), x();
179
+ }, Y = (t) => {
180
+ if (!t) return null;
181
+ const a = t.indexOf(" ");
182
+ return a === -1 ? null : t.slice(a + 1).trim();
183
+ }, U = g(() => Y(l.value.start)), j = g(() => Y(l.value.end)), x = () => {
184
+ const t = { start: l.value.start, end: l.value.end };
185
+ b("update:modelValue", t), b("change", t);
186
+ }, $ = g(() => ""), z = g(() => "");
187
+ return (t, a) => (u(), m(J, null, [
188
+ e.show ? (u(), m("div", {
184
189
  key: 0,
185
- class: h(["md:col-span-2", e.field_name])
190
+ class: _(["md:col-span-2", e.field_name])
186
191
  }, [
187
- e.label_name ? (o(), m("label", G, u(e.label_name), 1)) : y("", !0),
188
- c("p", H, u(e.modelValue.start) + " " + u(e.separator) + " " + u(e.modelValue.end), 1),
189
- t[2] || (t[2] = c("hr", { class: "opacity-100! bg-gray-200 border-0 dark:bg-gray-700" }, null, -1))
192
+ e.label_name ? (u(), m("label", K, i(e.label_name), 1)) : y("", !0),
193
+ o("p", L, i(e.modelValue.start) + " " + i(e.separator) + " " + i(e.modelValue.end), 1),
194
+ a[2] || (a[2] = o("hr", { class: "opacity-100! bg-gray-200 border-0 dark:bg-gray-700" }, null, -1))
190
195
  ], 2)) : y("", !0),
191
- e.show ? y("", !0) : (o(), m("div", {
196
+ e.show ? y("", !0) : (u(), m("div", {
192
197
  key: 1,
193
- class: h(["md:col-span-2", {
198
+ class: _(["md:col-span-2", {
194
199
  [e.field_name]: e.field_name && e.field_name !== "",
195
200
  [e.container_class]: e.container_class && e.container_class !== ""
196
201
  }])
197
202
  }, [
198
- e.label_name ? (o(), m("label", {
203
+ e.label_name ? (u(), m("label", {
199
204
  key: 0,
200
- class: h({
205
+ class: _({
201
206
  "gl-label-form": e.error_message == "" && f.value == "",
202
207
  "gl-label-form-invalid": e.error_message !== "" || f.value !== "",
203
208
  required: e.is_required
204
209
  }),
205
210
  for: e.field_name
206
- }, u(e.label_name), 11, R)) : y("", !0),
207
- c("div", J, [
208
- c("div", K, [
209
- q(w, {
211
+ }, i(e.label_name), 11, Q)) : y("", !0),
212
+ o("div", W, [
213
+ o("div", X, [
214
+ q(N, {
210
215
  modelValue: l.value.start,
211
- "onUpdate:modelValue": t[0] || (t[0] = (a) => l.value.start = a),
216
+ "onUpdate:modelValue": a[0] || (a[0] = (n) => l.value.start = n),
212
217
  field_name: e.field_name + "_start",
218
+ label_name: e.label_name_start,
213
219
  is_required: e.is_required,
214
220
  placeholder: e.placeholder_start,
215
221
  date_format: e.date_format,
216
222
  minute_step: e.minute_step,
223
+ default_time: j.value,
217
224
  min_date: e.min_date_start,
218
225
  max_date: B.value,
219
226
  disabled_days: e.disabled_days,
220
227
  disabled_dates: e.disabled_dates,
221
228
  locale: e.locale,
222
- error_message: U.value,
223
- onChange: T
224
- }, null, 8, ["modelValue", "field_name", "is_required", "placeholder", "date_format", "minute_step", "min_date", "max_date", "disabled_days", "disabled_dates", "locale", "error_message"])
229
+ error_message: $.value,
230
+ onChange: A
231
+ }, 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"])
225
232
  ]),
226
- c("span", L, u(e.separator), 1),
227
- c("div", Q, [
228
- q(w, {
233
+ o("span", Z, i(e.separator), 1),
234
+ o("div", p, [
235
+ q(N, {
229
236
  modelValue: l.value.end,
230
- "onUpdate:modelValue": t[1] || (t[1] = (a) => l.value.end = a),
237
+ "onUpdate:modelValue": a[1] || (a[1] = (n) => l.value.end = n),
231
238
  field_name: e.field_name + "_end",
239
+ label_name: e.label_name_end,
232
240
  is_required: e.is_required,
233
241
  placeholder: e.placeholder_end,
234
242
  date_format: e.date_format,
235
243
  minute_step: e.minute_step,
236
- min_date: P.value,
244
+ default_time: U.value,
245
+ min_date: T.value,
237
246
  max_date: e.max_date_end,
238
247
  disabled_days: e.disabled_days,
239
248
  disabled_dates: e.disabled_dates,
240
249
  locale: e.locale,
241
- error_message: j.value,
242
- onChange: A
243
- }, null, 8, ["modelValue", "field_name", "is_required", "placeholder", "date_format", "minute_step", "min_date", "max_date", "disabled_days", "disabled_dates", "locale", "error_message"])
250
+ error_message: z.value,
251
+ onChange: O
252
+ }, 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"])
244
253
  ])
245
254
  ]),
246
- f.value || e.error_message ? (o(), m("div", W, [
247
- c("span", X, u(e.error_message || f.value), 1)
255
+ f.value || e.error_message ? (u(), m("div", ee, [
256
+ o("span", te, i(e.error_message || f.value), 1)
248
257
  ])) : y("", !0),
249
- e.description ? (o(), m("small", Z, u(e.description), 1)) : y("", !0)
258
+ e.description ? (u(), m("small", ae, i(e.description), 1)) : y("", !0)
250
259
  ], 2))
251
260
  ], 64));
252
261
  }
253
262
  };
254
263
  export {
255
- ae as default
264
+ de as default
256
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.347",
6
+ "version": "1.2.349",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/mrgiant/GoldenLogicUi.git"