@fewangsit/wangsvue-fats 1.0.1-alpha.45 → 1.0.1-alpha.46

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,9 +1,9 @@
1
- import { defineComponent as T, onMounted as w, ref as p, computed as v, watch as n, watchEffect as C, createBlock as x, openBlock as D, mergeProps as b, unref as F, withCtx as f, renderSlot as c, nextTick as S } from "vue";
2
- import { u as k } from "../vendor/vee-validate/dist/vee-validate.esm.es.js";
3
- import { u as I } from "../plugins/WangsVue.es.js";
4
- import { a as L } from "../utils/textFormatter.util.es.js";
5
- import { _ as O } from "../basecalendar/index.es.js";
6
- const N = /* @__PURE__ */ T({
1
+ import { defineComponent as C, onMounted as F, ref as f, computed as d, watch as s, watchEffect as S, createBlock as x, openBlock as D, mergeProps as b, unref as I, withCtx as c, renderSlot as y, nextTick as k } from "vue";
2
+ import { u as L } from "../vendor/vee-validate/dist/vee-validate.esm.es.js";
3
+ import { u as O } from "../plugins/WangsVue.es.js";
4
+ import { a as N } from "../utils/textFormatter.util.es.js";
5
+ import { _ as U } from "../basecalendar/index.es.js";
6
+ const Y = /* @__PURE__ */ C({
7
7
  __name: "Calendar",
8
8
  props: {
9
9
  modelValue: {},
@@ -33,7 +33,7 @@ const N = /* @__PURE__ */ T({
33
33
  validatorMessage: {},
34
34
  customValidation: {},
35
35
  dateFormat: { default: "dd/mm/yy" },
36
- hourFormat: { default: "24" },
36
+ hourFormat: {},
37
37
  showTime: { type: Boolean },
38
38
  timeSeparator: { default: ":" },
39
39
  stepHour: { default: 1 },
@@ -48,70 +48,75 @@ const N = /* @__PURE__ */ T({
48
48
  exactSelection: { type: Boolean }
49
49
  },
50
50
  emits: ["update:modelValue", "update:epochTimeMillis", "monthChange", "yearChange", "dateSelect"],
51
- setup(y, { emit: V }) {
52
- const e = y, r = V;
53
- w(() => {
54
- e.dateValue != null && (t.value = d(e.dateValue), o.value = t.value, u.value++), e.epochTimeMillis != null && (t.value = d(e.epochTimeMillis), o.value = t.value, u.value++);
51
+ setup(V, { emit: g }) {
52
+ const e = V, n = g;
53
+ F(() => {
54
+ e.dateValue != null && (t.value = u(e.dateValue), o.value = t.value, i.value++), e.epochTimeMillis != null && (t.value = u(e.epochTimeMillis), o.value = t.value, i.value++);
55
55
  });
56
- const { locale: M } = I("Calendar"), t = p(), u = p(0), { value: o, errorMessage: g } = e.useValidator ? k(e.fieldName ?? "date", (a) => B(a)) : {
57
- value: v({
56
+ const { locale: h } = O("Calendar"), t = f(), i = f(0), { value: o, errorMessage: M } = e.useValidator ? L(e.fieldName ?? "date", (a) => w(a)) : {
57
+ value: d({
58
58
  get: () => e.modelValue,
59
59
  set: (a) => {
60
- r("update:modelValue", a);
60
+ n("update:modelValue", a);
61
61
  }
62
62
  })
63
- }, h = v(
63
+ }, B = d(
64
64
  () => e.invalid || "errorMessage" in o && !!o.errorMessage
65
- ), B = async (a) => {
66
- var l, i;
67
- return await S(), typeof e.validatorMessage == "string" && e.invalid ? e.validatorMessage : typeof e.validatorMessage != "string" && !a && e.mandatory ? ((l = e.validatorMessage) == null ? void 0 : l.empty) ?? s() : !a && e.mandatory ? ((i = e.customValidation) == null ? void 0 : i.empty) ?? s() : !0;
68
- }, s = () => {
65
+ ), T = d(() => {
66
+ var r, v;
67
+ const a = JSON.parse(localStorage.getItem("user") || "{}"), l = (r = a == null ? void 0 : a.generalSetting) == null ? void 0 : r.timeFormat;
68
+ return e.hourFormat ? e.hourFormat : (v = l == null ? void 0 : l.toLowerCase()) != null && v.includes("pm") ? "12" : "24";
69
+ }), w = async (a) => {
70
+ var l, r;
71
+ return await k(), typeof e.validatorMessage == "string" && e.invalid ? e.validatorMessage : typeof e.validatorMessage != "string" && !a && e.mandatory ? ((l = e.validatorMessage) == null ? void 0 : l.empty) ?? m() : !a && e.mandatory ? ((r = e.customValidation) == null ? void 0 : r.empty) ?? m() : !0;
72
+ }, m = () => {
69
73
  var a;
70
- return M.emptyInvalidText.replace("{label}", e.label).replace(
74
+ return h.emptyInvalidText.replace("{label}", e.label).replace(
71
75
  "{formattedLabel}",
72
- (a = L(e.label)) == null ? void 0 : a.toLowerCase()
76
+ (a = N(e.label)) == null ? void 0 : a.toLowerCase()
73
77
  );
74
- }, m = (a, l) => {
75
- (a === e.valueFormat && e.useValidator || !e.useValidator && a === "date") && (o.value = l), a === "date" && e.useValidator && r("update:modelValue", l), a === "millis" && r("update:epochTimeMillis", l);
76
- }, d = (a) => Array.isArray(a) ? a.map((l) => l == null ? null : new Date(l)) : new Date(a);
77
- return n(
78
+ }, p = (a, l) => {
79
+ (a === e.valueFormat && e.useValidator || !e.useValidator && a === "date") && (o.value = l), a === "date" && e.useValidator && n("update:modelValue", l), a === "millis" && n("update:epochTimeMillis", l);
80
+ }, u = (a) => Array.isArray(a) ? a.map((l) => l == null ? null : new Date(l)) : new Date(a);
81
+ return s(
78
82
  () => e.dateValue,
79
83
  () => {
80
- t.value = d(e.dateValue), e.useValidator && (o.value = t.value), u.value++;
84
+ t.value = u(e.dateValue), e.useValidator && (o.value = t.value), i.value++;
81
85
  },
82
86
  {
83
87
  once: !0
84
88
  }
85
- ), n(
89
+ ), s(
86
90
  () => e.epochTimeMillis,
87
91
  () => {
88
- t.value = d(e.epochTimeMillis), e.useValidator && (o.value = t.value), u.value++;
92
+ t.value = u(e.epochTimeMillis), e.useValidator && (o.value = t.value), i.value++;
89
93
  }
90
- ), n(
94
+ ), s(
91
95
  () => e.modelValue,
92
96
  () => {
93
97
  t.value = e.modelValue, e.useValidator && (o.value = t.value);
94
98
  }
95
- ), C(() => {
96
- t.value = e.valueFormat === "date" ? o.value : o.value ? d(o.value) : o.value;
97
- }), (a, l) => (D(), x(O, b({ key: u.value }, e, {
98
- "error-message": F(g),
99
- invalid: h.value,
99
+ ), S(() => {
100
+ t.value = e.valueFormat === "date" ? o.value : o.value ? u(o.value) : o.value;
101
+ }), (a, l) => (D(), x(U, b({ key: i.value }, e, {
102
+ "error-message": I(M),
103
+ "hour-format": T.value,
104
+ invalid: B.value,
100
105
  "model-value": t.value,
101
106
  "selection-mode": a.selectionMode || a.mode,
102
- "onUpdate:epochTimeMillis": l[0] || (l[0] = (i) => m("millis", i)),
103
- "onUpdate:modelValue": l[1] || (l[1] = (i) => m("date", i))
107
+ "onUpdate:epochTimeMillis": l[0] || (l[0] = (r) => p("millis", r)),
108
+ "onUpdate:modelValue": l[1] || (l[1] = (r) => p("date", r))
104
109
  }), {
105
- default: f(({ onClick: i }) => [
106
- c(a.$slots, "default", { onClick: i })
110
+ default: c(({ onClick: r }) => [
111
+ y(a.$slots, "default", { onClick: r })
107
112
  ]),
108
- "addon-overlay": f(() => [
109
- c(a.$slots, "addon-overlay")
113
+ "addon-overlay": c(() => [
114
+ y(a.$slots, "addon-overlay")
110
115
  ]),
111
116
  _: 3
112
- }, 16, ["error-message", "invalid", "model-value", "selection-mode"]));
117
+ }, 16, ["error-message", "hour-format", "invalid", "model-value", "selection-mode"]));
113
118
  }
114
119
  });
115
120
  export {
116
- N as _
121
+ Y as _
117
122
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fewangsit/wangsvue-fats",
3
- "version": "1.0.1-alpha.45",
3
+ "version": "1.0.1-alpha.46",
4
4
  "author": "Wangsit FE Developer",
5
5
  "description": "Fixed Asset Tagsamurai VueJS Component Library",
6
6
  "type": "module",