@qikdev/vue-ui 0.2.388 → 0.2.392

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/lib.es.js CHANGED
@@ -4,7 +4,7 @@ var Lh = (e, t, n) => t in e ? $h(e, t, { enumerable: !0, configurable: !0, writ
4
4
  var re = (e, t, n) => Lh(e, typeof t != "symbol" ? t + "" : t, n);
5
5
  import { defineComponent as Fo, ref as bt, toRefs as of, onMounted as Ao, onBeforeUnmount as Ph, watch as ci, computed as In, createElementBlock as h, openBlock as u, createCommentVNode as _, renderSlot as H, normalizeClass as L, useSlots as Rh, reactive as fn, provide as Ci, resolveComponent as y, createVNode as c, Fragment as D, createBlock as k, unref as _t, withCtx as f, renderList as N, toDisplayString as b, createTextVNode as O, withDirectives as X, vShow as dr, withModifiers as z, createElementVNode as w, h as uo, mergeProps as mt, toHandlers as wt, normalizeStyle as Ge, resolveDirective as lf, resolveDynamicComponent as Vt, vModelSelect as Et, pushScopeId as je, popScopeId as qe, getCurrentScope as Uh, onScopeDispose as jh, getCurrentInstance as qh, Teleport as uf, Transition as Bh, withKeys as Ee, vModelText as be, TransitionGroup as zh, nextTick as df, vModelDynamic as Tr, normalizeProps as Wh } from "vue";
6
6
  import { EventDispatcher as cf } from "@qikdev/sdk";
7
- const Hh = "0.2.387";
7
+ const Hh = "0.2.392";
8
8
  class pn extends Error {
9
9
  }
10
10
  class Gh extends pn {
@@ -12215,15 +12215,16 @@ const zw = {
12215
12215
  },
12216
12216
  emits: ["update:modelValue"],
12217
12217
  data() {
12218
+ const e = this.modelValue ? new Date(this.modelValue) : null;
12218
12219
  return {
12220
+ internalDate: e,
12219
12221
  displayText: "",
12220
12222
  menuOpen: !1,
12221
- viewMonth: (/* @__PURE__ */ new Date()).getMonth(),
12222
- viewYear: (/* @__PURE__ */ new Date()).getFullYear(),
12223
+ viewMonth: e ? e.getMonth() : (/* @__PURE__ */ new Date()).getMonth(),
12224
+ viewYear: e ? e.getFullYear() : (/* @__PURE__ */ new Date()).getFullYear(),
12223
12225
  selectedHour: 12,
12224
12226
  selectedMinute: 0,
12225
12227
  selectedMeridian: "PM",
12226
- lastValidValue: null,
12227
12228
  parseTimeout: null,
12228
12229
  weekdayNames: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
12229
12230
  monthNames: [
@@ -12309,30 +12310,34 @@ const zw = {
12309
12310
  { title: "AM", value: "AM" },
12310
12311
  { title: "PM", value: "PM" }
12311
12312
  ];
12313
+ },
12314
+ dateAsString() {
12315
+ if (!this.internalDate) return null;
12316
+ const e = new Date(this.internalDate);
12317
+ return e.setSeconds(0, 0), e.toISOString();
12318
+ },
12319
+ modelValueAsString() {
12320
+ if (!this.modelValue) return null;
12321
+ const e = new Date(this.modelValue);
12322
+ return isNaN(e.getTime()) ? null : (e.setSeconds(0, 0), e.toISOString());
12312
12323
  }
12313
12324
  },
12314
12325
  watch: {
12326
+ dateAsString(e) {
12327
+ e !== this.modelValueAsString && this.$emit("update:modelValue", e);
12328
+ },
12315
12329
  modelValue: {
12316
12330
  immediate: !0,
12317
12331
  handler(e) {
12318
12332
  if (e) {
12319
12333
  const t = new Date(e);
12320
- isNaN(t.getTime()) || (this.lastValidValue = t, this.displayText = this.formatDateForDisplay(t), this.viewMonth = t.getMonth(), this.viewYear = t.getFullYear(), this.syncTimeFromDate(t));
12334
+ isNaN(t.getTime()) || (this.internalDate = t, this.displayText = this.formatDateForDisplay(t), this.viewMonth = t.getMonth(), this.viewYear = t.getFullYear(), this.syncTimeFromDate(t));
12321
12335
  } else
12322
- this.lastValidValue = null, this.displayText = "";
12336
+ this.internalDate = null, this.displayText = "";
12323
12337
  }
12324
12338
  },
12325
12339
  displayText(e) {
12326
12340
  this.debouncedParse(e);
12327
- },
12328
- selectedHour() {
12329
- this.emitTimeChange();
12330
- },
12331
- selectedMinute() {
12332
- this.emitTimeChange();
12333
- },
12334
- selectedMeridian() {
12335
- this.emitTimeChange();
12336
12341
  }
12337
12342
  },
12338
12343
  methods: {
@@ -12392,7 +12397,7 @@ const zw = {
12392
12397
  var i;
12393
12398
  const e = (i = this.displayText) == null ? void 0 : i.trim();
12394
12399
  if (!e) {
12395
- this.$emit("update:modelValue", null), this.lastValidValue = null;
12400
+ this.internalDate = null;
12396
12401
  return;
12397
12402
  }
12398
12403
  const n = yd().parse(e);
@@ -12406,9 +12411,9 @@ const zw = {
12406
12411
  let a = this.selectedHour;
12407
12412
  this.selectedMeridian === "PM" && a !== 12 ? a += 12 : this.selectedMeridian === "AM" && a === 12 && (a = 0), r.setHours(a, this.selectedMinute, 0, 0);
12408
12413
  }
12409
- this.lastValidValue = r, this.displayText = this.formatDateForDisplay(r), this.$emit("update:modelValue", r.toISOString());
12414
+ this.internalDate = r, this.displayText = this.formatDateForDisplay(r);
12410
12415
  } else
12411
- this.lastValidValue ? this.displayText = this.formatDateForDisplay(this.lastValidValue) : this.displayText = "";
12416
+ this.internalDate ? this.displayText = this.formatDateForDisplay(this.internalDate) : this.displayText = "";
12412
12417
  },
12413
12418
  selectDate(e) {
12414
12419
  if (e.isDisabled) return;
@@ -12419,17 +12424,26 @@ const zw = {
12419
12424
  let n = this.selectedHour;
12420
12425
  this.selectedMeridian === "PM" && n !== 12 ? n += 12 : this.selectedMeridian === "AM" && n === 12 && (n = 0), t.setHours(n, this.selectedMinute, 0, 0);
12421
12426
  }
12422
- this.lastValidValue = t, this.displayText = this.formatDateForDisplay(t), this.$emit("update:modelValue", t.toISOString()), this.dateOnly && this.closeMenu();
12427
+ this.internalDate = t, this.displayText = this.formatDateForDisplay(t), this.dateOnly && this.closeMenu();
12423
12428
  },
12424
12429
  syncTimeFromDate(e) {
12425
12430
  let t = e.getHours(), n = "AM";
12426
12431
  t >= 12 && (n = "PM", t > 12 && (t -= 12)), t === 0 && (t = 12), this.selectedHour = t === 12 ? 0 : t, this.selectedMinute = Math.floor(e.getMinutes() / 5) * 5, this.selectedMeridian = n;
12427
12432
  },
12428
- emitTimeChange() {
12429
- if (!this.lastValidValue || this.dateOnly) return;
12430
- const e = new Date(this.lastValidValue);
12433
+ onHourChange(e) {
12434
+ this.selectedHour = e, this.updateTimeValue();
12435
+ },
12436
+ onMinuteChange(e) {
12437
+ this.selectedMinute = e, this.updateTimeValue();
12438
+ },
12439
+ onMeridianChange(e) {
12440
+ this.selectedMeridian = e, this.updateTimeValue();
12441
+ },
12442
+ updateTimeValue() {
12443
+ if (!this.internalDate || this.dateOnly) return;
12444
+ const e = new Date(this.internalDate);
12431
12445
  let t = this.selectedHour;
12432
- this.selectedMeridian === "PM" && t !== 12 ? t += 12 : this.selectedMeridian === "AM" && t === 12 && (t = 0), this.selectedHour === 0 && (t = this.selectedMeridian === "PM" ? 12 : 0), e.setHours(t, this.selectedMinute, 0, 0), this.lastValidValue = e, this.displayText = this.formatDateForDisplay(e), this.$emit("update:modelValue", e.toISOString());
12446
+ this.selectedMeridian === "PM" && t !== 12 ? t += 12 : this.selectedMeridian === "AM" && t === 12 && (t = 0), this.selectedHour === 0 && (t = this.selectedMeridian === "PM" ? 12 : 0), e.setHours(t, this.selectedMinute, 0, 0), this.internalDate = e, this.displayText = this.formatDateForDisplay(e);
12433
12447
  },
12434
12448
  openMenu() {
12435
12449
  this.menuOpen = !0;
@@ -12451,7 +12465,7 @@ const zw = {
12451
12465
  beforeUnmount() {
12452
12466
  this.parseTimeout && clearTimeout(this.parseTimeout);
12453
12467
  }
12454
- }, Nm = (e) => (je("data-v-29a74f76"), e = e(), qe(), e), Ww = {
12468
+ }, Nm = (e) => (je("data-v-82a7dff8"), e = e(), qe(), e), Ww = {
12455
12469
  class: "ux-datepicker",
12456
12470
  ref: "container"
12457
12471
  }, Hw = { class: "ux-datepicker-input-wrap" }, Gw = ["placeholder"], Yw = /* @__PURE__ */ Nm(() => /* @__PURE__ */ w("span", null, null, -1)), Jw = { class: "ux-datepicker-calendar" }, Kw = { class: "ux-datepicker-header" }, Zw = { class: "ux-datepicker-month-year" }, Xw = { class: "ux-datepicker-weekdays" }, Qw = { class: "ux-datepicker-days" }, ex = ["disabled", "onClick"], tx = {
@@ -12486,7 +12500,7 @@ function ax(e, t, n, i, s, r) {
12486
12500
  c(m, {
12487
12501
  ref: "menu",
12488
12502
  modelValue: s.menuOpen,
12489
- "onUpdate:modelValue": t[11] || (t[11] = (p) => s.menuOpen = p),
12503
+ "onUpdate:modelValue": t[8] || (t[8] = (p) => s.menuOpen = p),
12490
12504
  closeOnClick: !1
12491
12505
  }, {
12492
12506
  activator: f(() => [
@@ -12495,7 +12509,7 @@ function ax(e, t, n, i, s, r) {
12495
12509
  default: f(() => [
12496
12510
  w("div", {
12497
12511
  class: "ux-datepicker-popup",
12498
- onClick: t[10] || (t[10] = z(() => {
12512
+ onClick: t[7] || (t[7] = z(() => {
12499
12513
  }, ["stop"]))
12500
12514
  }, [
12501
12515
  w("div", Jw, [
@@ -12541,7 +12555,7 @@ function ax(e, t, n, i, s, r) {
12541
12555
  default: f(() => [
12542
12556
  c(o, {
12543
12557
  modelValue: s.selectedHour,
12544
- "onUpdate:modelValue": t[7] || (t[7] = (p) => s.selectedHour = p),
12558
+ "onUpdate:modelValue": r.onHourChange,
12545
12559
  field: { minimum: 1, maximum: 1, options: r.hourOptions }
12546
12560
  }, {
12547
12561
  default: f(() => [
@@ -12554,7 +12568,7 @@ function ax(e, t, n, i, s, r) {
12554
12568
  ])
12555
12569
  ]),
12556
12570
  _: 1
12557
- }, 8, ["modelValue", "field"])
12571
+ }, 8, ["modelValue", "onUpdate:modelValue", "field"])
12558
12572
  ]),
12559
12573
  _: 1
12560
12574
  }),
@@ -12568,7 +12582,7 @@ function ax(e, t, n, i, s, r) {
12568
12582
  default: f(() => [
12569
12583
  c(o, {
12570
12584
  modelValue: s.selectedMinute,
12571
- "onUpdate:modelValue": t[8] || (t[8] = (p) => s.selectedMinute = p),
12585
+ "onUpdate:modelValue": r.onMinuteChange,
12572
12586
  field: { minimum: 1, maximum: 1, options: r.minuteOptions }
12573
12587
  }, {
12574
12588
  default: f(() => [
@@ -12581,7 +12595,7 @@ function ax(e, t, n, i, s, r) {
12581
12595
  ])
12582
12596
  ]),
12583
12597
  _: 1
12584
- }, 8, ["modelValue", "field"])
12598
+ }, 8, ["modelValue", "onUpdate:modelValue", "field"])
12585
12599
  ]),
12586
12600
  _: 1
12587
12601
  }),
@@ -12589,7 +12603,7 @@ function ax(e, t, n, i, s, r) {
12589
12603
  default: f(() => [
12590
12604
  c(o, {
12591
12605
  modelValue: s.selectedMeridian,
12592
- "onUpdate:modelValue": t[9] || (t[9] = (p) => s.selectedMeridian = p),
12606
+ "onUpdate:modelValue": r.onMeridianChange,
12593
12607
  field: { minimum: 1, maximum: 1, options: r.meridianOptions }
12594
12608
  }, {
12595
12609
  default: f(() => [
@@ -12602,7 +12616,7 @@ function ax(e, t, n, i, s, r) {
12602
12616
  ])
12603
12617
  ]),
12604
12618
  _: 1
12605
- }, 8, ["modelValue", "field"])
12619
+ }, 8, ["modelValue", "onUpdate:modelValue", "field"])
12606
12620
  ]),
12607
12621
  _: 1
12608
12622
  })
@@ -12616,7 +12630,7 @@ function ax(e, t, n, i, s, r) {
12616
12630
  }, 8, ["modelValue"])
12617
12631
  ], 512);
12618
12632
  }
12619
- const $m = /* @__PURE__ */ M(zw, [["render", ax], ["__scopeId", "data-v-29a74f76"]]);
12633
+ const $m = /* @__PURE__ */ M(zw, [["render", ax], ["__scopeId", "data-v-82a7dff8"]]);
12620
12634
  function Nr(e) {
12621
12635
  var t = new Date(e);
12622
12636
  if (t instanceof Date && !isNaN(t.getTime()))