@qikdev/vue-ui 0.2.389 → 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.389";
7
+ const Hh = "0.2.392";
8
8
  class pn extends Error {
9
9
  }
10
10
  class Gh extends pn {
@@ -12215,17 +12215,17 @@ 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
- syncingFromModel: !1,
12229
12229
  weekdayNames: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
12230
12230
  monthNames: [
12231
12231
  "January",
@@ -12310,30 +12310,34 @@ const zw = {
12310
12310
  { title: "AM", value: "AM" },
12311
12311
  { title: "PM", value: "PM" }
12312
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());
12313
12323
  }
12314
12324
  },
12315
12325
  watch: {
12326
+ dateAsString(e) {
12327
+ e !== this.modelValueAsString && this.$emit("update:modelValue", e);
12328
+ },
12316
12329
  modelValue: {
12317
12330
  immediate: !0,
12318
12331
  handler(e) {
12319
12332
  if (e) {
12320
12333
  const t = new Date(e);
12321
- 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));
12322
12335
  } else
12323
- this.lastValidValue = null, this.displayText = "";
12336
+ this.internalDate = null, this.displayText = "";
12324
12337
  }
12325
12338
  },
12326
12339
  displayText(e) {
12327
12340
  this.debouncedParse(e);
12328
- },
12329
- selectedHour() {
12330
- this.syncingFromModel || this.emitTimeChange();
12331
- },
12332
- selectedMinute() {
12333
- this.syncingFromModel || this.emitTimeChange();
12334
- },
12335
- selectedMeridian() {
12336
- this.syncingFromModel || this.emitTimeChange();
12337
12341
  }
12338
12342
  },
12339
12343
  methods: {
@@ -12393,7 +12397,7 @@ const zw = {
12393
12397
  var i;
12394
12398
  const e = (i = this.displayText) == null ? void 0 : i.trim();
12395
12399
  if (!e) {
12396
- this.$emit("update:modelValue", null), this.lastValidValue = null;
12400
+ this.internalDate = null;
12397
12401
  return;
12398
12402
  }
12399
12403
  const n = yd().parse(e);
@@ -12407,9 +12411,9 @@ const zw = {
12407
12411
  let a = this.selectedHour;
12408
12412
  this.selectedMeridian === "PM" && a !== 12 ? a += 12 : this.selectedMeridian === "AM" && a === 12 && (a = 0), r.setHours(a, this.selectedMinute, 0, 0);
12409
12413
  }
12410
- this.lastValidValue = r, this.displayText = this.formatDateForDisplay(r), this.$emit("update:modelValue", r.toISOString());
12414
+ this.internalDate = r, this.displayText = this.formatDateForDisplay(r);
12411
12415
  } else
12412
- this.lastValidValue ? this.displayText = this.formatDateForDisplay(this.lastValidValue) : this.displayText = "";
12416
+ this.internalDate ? this.displayText = this.formatDateForDisplay(this.internalDate) : this.displayText = "";
12413
12417
  },
12414
12418
  selectDate(e) {
12415
12419
  if (e.isDisabled) return;
@@ -12420,18 +12424,26 @@ const zw = {
12420
12424
  let n = this.selectedHour;
12421
12425
  this.selectedMeridian === "PM" && n !== 12 ? n += 12 : this.selectedMeridian === "AM" && n === 12 && (n = 0), t.setHours(n, this.selectedMinute, 0, 0);
12422
12426
  }
12423
- 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();
12424
12428
  },
12425
12429
  syncTimeFromDate(e) {
12426
- this.syncingFromModel = !0;
12427
12430
  let t = e.getHours(), n = "AM";
12428
- 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, this.syncingFromModel = !1;
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;
12432
+ },
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();
12429
12441
  },
12430
- emitTimeChange() {
12431
- if (!this.lastValidValue || this.dateOnly) return;
12432
- const e = new Date(this.lastValidValue);
12442
+ updateTimeValue() {
12443
+ if (!this.internalDate || this.dateOnly) return;
12444
+ const e = new Date(this.internalDate);
12433
12445
  let t = this.selectedHour;
12434
- 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);
12435
12447
  },
12436
12448
  openMenu() {
12437
12449
  this.menuOpen = !0;
@@ -12453,7 +12465,7 @@ const zw = {
12453
12465
  beforeUnmount() {
12454
12466
  this.parseTimeout && clearTimeout(this.parseTimeout);
12455
12467
  }
12456
- }, Nm = (e) => (je("data-v-210facd3"), e = e(), qe(), e), Ww = {
12468
+ }, Nm = (e) => (je("data-v-82a7dff8"), e = e(), qe(), e), Ww = {
12457
12469
  class: "ux-datepicker",
12458
12470
  ref: "container"
12459
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 = {
@@ -12488,7 +12500,7 @@ function ax(e, t, n, i, s, r) {
12488
12500
  c(m, {
12489
12501
  ref: "menu",
12490
12502
  modelValue: s.menuOpen,
12491
- "onUpdate:modelValue": t[11] || (t[11] = (p) => s.menuOpen = p),
12503
+ "onUpdate:modelValue": t[8] || (t[8] = (p) => s.menuOpen = p),
12492
12504
  closeOnClick: !1
12493
12505
  }, {
12494
12506
  activator: f(() => [
@@ -12497,7 +12509,7 @@ function ax(e, t, n, i, s, r) {
12497
12509
  default: f(() => [
12498
12510
  w("div", {
12499
12511
  class: "ux-datepicker-popup",
12500
- onClick: t[10] || (t[10] = z(() => {
12512
+ onClick: t[7] || (t[7] = z(() => {
12501
12513
  }, ["stop"]))
12502
12514
  }, [
12503
12515
  w("div", Jw, [
@@ -12543,7 +12555,7 @@ function ax(e, t, n, i, s, r) {
12543
12555
  default: f(() => [
12544
12556
  c(o, {
12545
12557
  modelValue: s.selectedHour,
12546
- "onUpdate:modelValue": t[7] || (t[7] = (p) => s.selectedHour = p),
12558
+ "onUpdate:modelValue": r.onHourChange,
12547
12559
  field: { minimum: 1, maximum: 1, options: r.hourOptions }
12548
12560
  }, {
12549
12561
  default: f(() => [
@@ -12556,7 +12568,7 @@ function ax(e, t, n, i, s, r) {
12556
12568
  ])
12557
12569
  ]),
12558
12570
  _: 1
12559
- }, 8, ["modelValue", "field"])
12571
+ }, 8, ["modelValue", "onUpdate:modelValue", "field"])
12560
12572
  ]),
12561
12573
  _: 1
12562
12574
  }),
@@ -12570,7 +12582,7 @@ function ax(e, t, n, i, s, r) {
12570
12582
  default: f(() => [
12571
12583
  c(o, {
12572
12584
  modelValue: s.selectedMinute,
12573
- "onUpdate:modelValue": t[8] || (t[8] = (p) => s.selectedMinute = p),
12585
+ "onUpdate:modelValue": r.onMinuteChange,
12574
12586
  field: { minimum: 1, maximum: 1, options: r.minuteOptions }
12575
12587
  }, {
12576
12588
  default: f(() => [
@@ -12583,7 +12595,7 @@ function ax(e, t, n, i, s, r) {
12583
12595
  ])
12584
12596
  ]),
12585
12597
  _: 1
12586
- }, 8, ["modelValue", "field"])
12598
+ }, 8, ["modelValue", "onUpdate:modelValue", "field"])
12587
12599
  ]),
12588
12600
  _: 1
12589
12601
  }),
@@ -12591,7 +12603,7 @@ function ax(e, t, n, i, s, r) {
12591
12603
  default: f(() => [
12592
12604
  c(o, {
12593
12605
  modelValue: s.selectedMeridian,
12594
- "onUpdate:modelValue": t[9] || (t[9] = (p) => s.selectedMeridian = p),
12606
+ "onUpdate:modelValue": r.onMeridianChange,
12595
12607
  field: { minimum: 1, maximum: 1, options: r.meridianOptions }
12596
12608
  }, {
12597
12609
  default: f(() => [
@@ -12604,7 +12616,7 @@ function ax(e, t, n, i, s, r) {
12604
12616
  ])
12605
12617
  ]),
12606
12618
  _: 1
12607
- }, 8, ["modelValue", "field"])
12619
+ }, 8, ["modelValue", "onUpdate:modelValue", "field"])
12608
12620
  ]),
12609
12621
  _: 1
12610
12622
  })
@@ -12618,7 +12630,7 @@ function ax(e, t, n, i, s, r) {
12618
12630
  }, 8, ["modelValue"])
12619
12631
  ], 512);
12620
12632
  }
12621
- const $m = /* @__PURE__ */ M(zw, [["render", ax], ["__scopeId", "data-v-210facd3"]]);
12633
+ const $m = /* @__PURE__ */ M(zw, [["render", ax], ["__scopeId", "data-v-82a7dff8"]]);
12622
12634
  function Nr(e) {
12623
12635
  var t = new Date(e);
12624
12636
  if (t instanceof Date && !isNaN(t.getTime()))