tsv2-library 0.2.97 → 0.2.99

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.
@@ -90,6 +90,10 @@ export interface InputTextProps {
90
90
  * Specify classes for label.
91
91
  */
92
92
  labelClass?: string;
93
+ /**
94
+ * Auto blur while input value has reached the max length.
95
+ */
96
+ blurOnReachMax?: boolean;
93
97
  }
94
98
 
95
99
  /**
@@ -63146,7 +63146,7 @@ const Hg = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI1IiBoZWlnaHQ9IjEyNSIgdm
63146
63146
  { label: "RFID", value: "RFID" },
63147
63147
  { label: "QR", value: "QR" },
63148
63148
  { label: "RFID & QR", value: "RFID & QR" },
63149
- { label: "Non-TAG", value: "Non-TAG" }
63149
+ { label: "Non TAG", value: "Non TAG" }
63150
63150
  ];
63151
63151
  break;
63152
63152
  }
@@ -74974,41 +74974,46 @@ const s2e = uu, l2e = {
74974
74974
  fieldInfo: {},
74975
74975
  inputClass: {},
74976
74976
  inputContainerClass: {},
74977
- labelClass: {}
74977
+ labelClass: {},
74978
+ blurOnReachMax: { type: Boolean }
74978
74979
  },
74979
74980
  emits: ["blur", "input", "update:modelValue"],
74980
74981
  setup(e, { emit: t }) {
74981
- var l;
74982
- const n = e, r = t, i = Xt({
74983
- value: (l = n.modelValue) == null ? void 0 : l.trim()
74984
- }), a = he(() => n.invalid || !!i.errorMessage);
74982
+ var d;
74983
+ const n = e, r = t, i = ae(0), a = Xt({
74984
+ value: (d = n.modelValue) == null ? void 0 : d.trim()
74985
+ }), o = he(() => a.value), s = he(() => n.invalid || !!a.errorMessage);
74985
74986
  xt(() => {
74986
- var c;
74987
+ var f;
74987
74988
  n.useValidator && (Object.assign(
74988
- i,
74989
- Hn(n.fieldName ?? "textInput", (u) => s(u == null ? void 0 : u.trim()))
74990
- ), n.value != null && (i.value = (c = n.value) == null ? void 0 : c.trim()));
74989
+ a,
74990
+ Hn(n.fieldName ?? "textInput", (h) => c(h == null ? void 0 : h.trim()))
74991
+ ), n.value != null && (a.value = (f = n.value) == null ? void 0 : f.trim()));
74991
74992
  });
74992
- const o = he(
74993
+ const l = he(
74993
74994
  () => n.placeholder ?? `Enter ${n.label ? n.label.toLowerCase() : n.type ?? "text"}`
74994
- ), s = async (c) => (await Ft(), n.validatorMessage && n.invalid ? n.validatorMessage : !c && n.mandatory ? `${n.label} must not be empty` : (c == null ? void 0 : c.length) > n.maxLength && n.type === "text" ? "Max. " + n.maxLength + " characters" : c && n.type === "email" ? /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/.test(c) ? !0 : "Email format is incorrect" : c && n.type === "url" ? new RegExp(
74995
+ ), c = async (f) => (await Ft(), n.validatorMessage && n.invalid ? n.validatorMessage : !f && n.mandatory ? `${n.label} must not be empty` : (f == null ? void 0 : f.length) > n.maxLength && n.type === "text" ? "Max. " + n.maxLength + " characters" : f && n.type === "email" ? /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/.test(f) ? !0 : "Email format is incorrect" : f && n.type === "url" ? new RegExp(
74995
74996
  "^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$",
74996
74997
  "i"
74997
74998
  // Fragment locator
74998
- ).test(c) ? !0 : "URL format is incorrect" : !0);
74999
+ ).test(f) ? !0 : "URL format is incorrect" : !0), u = (f) => {
75000
+ a.value = String(f).slice(0, n.maxLength), r("update:modelValue", a.value), i.value++;
75001
+ };
74999
75002
  return et(
75000
75003
  () => n.value,
75001
- (c) => {
75002
- i.value = c == null ? void 0 : c.trim();
75004
+ (f) => {
75005
+ a.value = f == null ? void 0 : f.trim();
75003
75006
  },
75004
75007
  { once: !0 }
75005
75008
  ), et(
75006
75009
  () => n.modelValue,
75007
- (c) => {
75008
- i.value = c == null ? void 0 : c.trim();
75010
+ (f) => {
75011
+ a.value = f == null ? void 0 : f.trim();
75009
75012
  }
75010
- ), (c, u) => (g(), C(lr, {
75011
- info: c.fieldInfo,
75013
+ ), et(o, (f) => {
75014
+ f && (f == null ? void 0 : f.length) > n.maxLength && n.blurOnReachMax && u(f);
75015
+ }), (f, h) => (g(), C(lr, {
75016
+ info: f.fieldInfo,
75012
75017
  label: n.label,
75013
75018
  "label-class": n.labelClass,
75014
75019
  mandatory: n.mandatory
@@ -75019,46 +75024,47 @@ const s2e = uu, l2e = {
75019
75024
  n.inputContainerClass ?? [
75020
75025
  "grid ",
75021
75026
  {
75022
- "grid-cols-[max-content,1fr,max-content]": c.$slots["addon-left"] && c.$slots["addon-right"],
75023
- "grid-cols-[1fr,max-content]": !c.$slots["addon-left"] && c.$slots["addon-right"],
75024
- "grid-cols-[max-content,1fr]": c.$slots["addon-left"] && !c.$slots["addon-right"]
75027
+ "grid-cols-[max-content,1fr,max-content]": f.$slots["addon-left"] && f.$slots["addon-right"],
75028
+ "grid-cols-[1fr,max-content]": !f.$slots["addon-left"] && f.$slots["addon-right"],
75029
+ "grid-cols-[max-content,1fr]": f.$slots["addon-left"] && !f.$slots["addon-right"]
75025
75030
  }
75026
75031
  ]
75027
75032
  ),
75028
75033
  disabled: n.disabled,
75029
- invalid: a.value && !n.manualInvalidContainer
75034
+ invalid: s.value && !n.manualInvalidContainer
75030
75035
  }, {
75031
75036
  default: z(() => [
75032
- c.$slots["addon-left"] ? (g(), C(M(hi), {
75037
+ f.$slots["addon-left"] ? (g(), C(M(hi), {
75033
75038
  key: 0,
75034
75039
  disabled: n.disabled
75035
75040
  }, {
75036
75041
  default: z(() => [
75037
- ne(c.$slots, "addon-left")
75042
+ ne(f.$slots, "addon-left")
75038
75043
  ]),
75039
75044
  _: 3
75040
75045
  }, 8, ["disabled"])) : P("", !0),
75041
- A(M(na), {
75042
- modelValue: i.value,
75046
+ (g(), C(M(na), {
75047
+ key: i.value,
75048
+ modelValue: a.value,
75043
75049
  "onUpdate:modelValue": [
75044
- u[0] || (u[0] = (d) => i.value = d),
75045
- u[3] || (u[3] = (d) => r("update:modelValue", d))
75050
+ h[0] || (h[0] = (m) => a.value = m),
75051
+ h[3] || (h[3] = (m) => r("update:modelValue", m))
75046
75052
  ],
75047
- class: q(["ts-inputtext", c.inputClass]),
75048
- disabled: c.disabled,
75049
- invalid: a.value,
75050
- placeholder: o.value,
75051
- onBlur: u[1] || (u[1] = (d) => r("blur", d.target.value)),
75052
- onInput: u[2] || (u[2] = (d) => r("input", d.target.value))
75053
- }, null, 8, ["modelValue", "class", "disabled", "invalid", "placeholder"]),
75054
- c.$slots["addon-right"] ? (g(), C(M(hi), {
75053
+ class: q(["ts-inputtext", f.inputClass]),
75054
+ disabled: f.disabled,
75055
+ invalid: s.value,
75056
+ placeholder: l.value,
75057
+ onBlur: h[1] || (h[1] = (m) => r("blur", m.target.value)),
75058
+ onInput: h[2] || (h[2] = (m) => r("input", m.target.value))
75059
+ }, null, 8, ["modelValue", "class", "disabled", "invalid", "placeholder"])),
75060
+ f.$slots["addon-right"] ? (g(), C(M(hi), {
75055
75061
  key: 1,
75056
75062
  class: q({
75057
75063
  "!text-general-200 !dark:text-general-200": n.disabled
75058
75064
  })
75059
75065
  }, {
75060
75066
  default: z(() => [
75061
- ne(c.$slots, "addon-right")
75067
+ ne(f.$slots, "addon-right")
75062
75068
  ]),
75063
75069
  _: 3
75064
75070
  }, 8, ["class"])) : P("", !0)
@@ -75067,7 +75073,7 @@ const s2e = uu, l2e = {
75067
75073
  }, 8, ["class", "disabled", "invalid"]),
75068
75074
  A(tr, {
75069
75075
  class: q(n.validatorMessageClass),
75070
- message: i.errorMessage ?? n.validatorMessage
75076
+ message: a.errorMessage ?? n.validatorMessage
75071
75077
  }, null, 8, ["class", "message"])
75072
75078
  ]),
75073
75079
  _: 3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsv2-library",
3
- "version": "0.2.97",
3
+ "version": "0.2.99",
4
4
  "author": "fixedassetv2-fe",
5
5
  "license": "ISC",
6
6
  "homepage": "https://github.com/fixedassetv2-fe/tsv2-library#readme",
@@ -90,6 +90,10 @@ export interface InputTextProps {
90
90
  * Specify classes for label.
91
91
  */
92
92
  labelClass?: string;
93
+ /**
94
+ * Auto blur while input value has reached the max length.
95
+ */
96
+ blurOnReachMax?: boolean;
93
97
  }
94
98
 
95
99
  /**