@winchsa/ui 0.1.13 → 0.1.14

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.
@@ -39,12 +39,12 @@ declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
39
39
  triggerRefresh: typeof triggerRefresh;
40
40
  triggeredRemove: typeof triggeredRemove;
41
41
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
42
- refresh: (hideOverlay: () => void) => any;
43
42
  collapsed: (isContentCollapsed: boolean) => any;
43
+ refresh: (hideOverlay: () => void) => any;
44
44
  trash: () => any;
45
45
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
46
- onRefresh?: ((hideOverlay: () => void) => any) | undefined;
47
46
  onCollapsed?: ((isContentCollapsed: boolean) => any) | undefined;
47
+ onRefresh?: ((hideOverlay: () => void) => any) | undefined;
48
48
  onTrash?: (() => any) | undefined;
49
49
  }>, {
50
50
  title: string;
@@ -55,12 +55,12 @@ declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
55
55
  actionRemove: boolean;
56
56
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
57
57
  declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
58
- refresh: (hideOverlay: () => void) => any;
59
58
  collapsed: (isContentCollapsed: boolean) => any;
59
+ refresh: (hideOverlay: () => void) => any;
60
60
  trash: () => any;
61
61
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
62
- onRefresh?: ((hideOverlay: () => void) => any) | undefined;
63
62
  onCollapsed?: ((isContentCollapsed: boolean) => any) | undefined;
63
+ onRefresh?: ((hideOverlay: () => void) => any) | undefined;
64
64
  onTrash?: (() => any) | undefined;
65
65
  }>, {
66
66
  title: string;
@@ -550,7 +550,7 @@ declare const refSearchList: import("vue").Ref<({
550
550
  } & {
551
551
  item: unknown;
552
552
  }) => import("vue").VNodeChild) | undefined;
553
- prepend?: ((arg: {
553
+ append?: ((arg: {
554
554
  isActive: boolean;
555
555
  isSelected: boolean;
556
556
  isIndeterminate: boolean;
@@ -558,7 +558,7 @@ declare const refSearchList: import("vue").Ref<({
558
558
  } & {
559
559
  item: unknown;
560
560
  }) => import("vue").VNodeChild) | undefined;
561
- append?: ((arg: {
561
+ prepend?: ((arg: {
562
562
  isActive: boolean;
563
563
  isSelected: boolean;
564
564
  isIndeterminate: boolean;
@@ -607,7 +607,7 @@ declare const refSearchList: import("vue").Ref<({
607
607
  } & {
608
608
  item: unknown;
609
609
  }) => import("vue").VNodeChild) | undefined;
610
- prepend?: false | ((arg: {
610
+ append?: false | ((arg: {
611
611
  isActive: boolean;
612
612
  isSelected: boolean;
613
613
  isIndeterminate: boolean;
@@ -615,7 +615,7 @@ declare const refSearchList: import("vue").Ref<({
615
615
  } & {
616
616
  item: unknown;
617
617
  }) => import("vue").VNodeChild) | undefined;
618
- append?: false | ((arg: {
618
+ prepend?: false | ((arg: {
619
619
  isActive: boolean;
620
620
  isSelected: boolean;
621
621
  isIndeterminate: boolean;
@@ -664,7 +664,7 @@ declare const refSearchList: import("vue").Ref<({
664
664
  } & {
665
665
  item: unknown;
666
666
  }) => import("vue").VNodeChild) | undefined;
667
- "v-slot:prepend"?: false | ((arg: {
667
+ "v-slot:append"?: false | ((arg: {
668
668
  isActive: boolean;
669
669
  isSelected: boolean;
670
670
  isIndeterminate: boolean;
@@ -672,7 +672,7 @@ declare const refSearchList: import("vue").Ref<({
672
672
  } & {
673
673
  item: unknown;
674
674
  }) => import("vue").VNodeChild) | undefined;
675
- "v-slot:append"?: false | ((arg: {
675
+ "v-slot:prepend"?: false | ((arg: {
676
676
  isActive: boolean;
677
677
  isSelected: boolean;
678
678
  isIndeterminate: boolean;
@@ -721,7 +721,7 @@ declare const refSearchList: import("vue").Ref<({
721
721
  } & {
722
722
  item: unknown;
723
723
  }) => import("vue").VNode[];
724
- prepend: (arg: {
724
+ append: (arg: {
725
725
  isActive: boolean;
726
726
  isSelected: boolean;
727
727
  isIndeterminate: boolean;
@@ -729,7 +729,7 @@ declare const refSearchList: import("vue").Ref<({
729
729
  } & {
730
730
  item: unknown;
731
731
  }) => import("vue").VNode[];
732
- append: (arg: {
732
+ prepend: (arg: {
733
733
  isActive: boolean;
734
734
  isSelected: boolean;
735
735
  isIndeterminate: boolean;
@@ -1299,7 +1299,7 @@ declare const refSearchList: import("vue").Ref<({
1299
1299
  } & {
1300
1300
  item: unknown;
1301
1301
  }) => import("vue").VNodeChild) | undefined;
1302
- prepend?: ((arg: {
1302
+ append?: ((arg: {
1303
1303
  isActive: boolean;
1304
1304
  isSelected: boolean;
1305
1305
  isIndeterminate: boolean;
@@ -1307,7 +1307,7 @@ declare const refSearchList: import("vue").Ref<({
1307
1307
  } & {
1308
1308
  item: unknown;
1309
1309
  }) => import("vue").VNodeChild) | undefined;
1310
- append?: ((arg: {
1310
+ prepend?: ((arg: {
1311
1311
  isActive: boolean;
1312
1312
  isSelected: boolean;
1313
1313
  isIndeterminate: boolean;
@@ -1356,7 +1356,7 @@ declare const refSearchList: import("vue").Ref<({
1356
1356
  } & {
1357
1357
  item: unknown;
1358
1358
  }) => import("vue").VNodeChild) | undefined;
1359
- prepend?: false | ((arg: {
1359
+ append?: false | ((arg: {
1360
1360
  isActive: boolean;
1361
1361
  isSelected: boolean;
1362
1362
  isIndeterminate: boolean;
@@ -1364,7 +1364,7 @@ declare const refSearchList: import("vue").Ref<({
1364
1364
  } & {
1365
1365
  item: unknown;
1366
1366
  }) => import("vue").VNodeChild) | undefined;
1367
- append?: false | ((arg: {
1367
+ prepend?: false | ((arg: {
1368
1368
  isActive: boolean;
1369
1369
  isSelected: boolean;
1370
1370
  isIndeterminate: boolean;
@@ -1413,7 +1413,7 @@ declare const refSearchList: import("vue").Ref<({
1413
1413
  } & {
1414
1414
  item: unknown;
1415
1415
  }) => import("vue").VNodeChild) | undefined;
1416
- "v-slot:prepend"?: false | ((arg: {
1416
+ "v-slot:append"?: false | ((arg: {
1417
1417
  isActive: boolean;
1418
1418
  isSelected: boolean;
1419
1419
  isIndeterminate: boolean;
@@ -1421,7 +1421,7 @@ declare const refSearchList: import("vue").Ref<({
1421
1421
  } & {
1422
1422
  item: unknown;
1423
1423
  }) => import("vue").VNodeChild) | undefined;
1424
- "v-slot:append"?: false | ((arg: {
1424
+ "v-slot:prepend"?: false | ((arg: {
1425
1425
  isActive: boolean;
1426
1426
  isSelected: boolean;
1427
1427
  isIndeterminate: boolean;
@@ -1470,7 +1470,7 @@ declare const refSearchList: import("vue").Ref<({
1470
1470
  } & {
1471
1471
  item: unknown;
1472
1472
  }) => import("vue").VNode[];
1473
- prepend: (arg: {
1473
+ append: (arg: {
1474
1474
  isActive: boolean;
1475
1475
  isSelected: boolean;
1476
1476
  isIndeterminate: boolean;
@@ -1478,7 +1478,7 @@ declare const refSearchList: import("vue").Ref<({
1478
1478
  } & {
1479
1479
  item: unknown;
1480
1480
  }) => import("vue").VNode[];
1481
- append: (arg: {
1481
+ prepend: (arg: {
1482
1482
  isActive: boolean;
1483
1483
  isSelected: boolean;
1484
1484
  isIndeterminate: boolean;
@@ -12,37 +12,52 @@ const props = defineProps({
12
12
  const model = defineModel({ type: [Array, null], ...{ default: ["", "", "", ""] } });
13
13
  const LangLabel = computed(() => props.label ? t(props.label) : "");
14
14
  const allowedLetters = ["A", "B", "J", "D", "R", "S", "X", "T", "E", "G", "K", "L", "Z", "N", "H", "U", "V"];
15
- const allowedArabicLetters = ["\u0623", "\u0628", "\u062D", "\u062F", "\u0631", "\u0633", "\u0635", "\u0637", "\u0639", "\u0642", "\u0643", "\u0644", "\u0645", "\u0646", "\u0647", "\u0648", "\u064A"];
15
+ const allowedArabicLetters = ["\u0623", "\u0627", "\u0628", "\u062D", "\u062F", "\u0631", "\u0633", "\u0635", "\u0637", "\u0639", "\u0642", "\u0643", "\u0644", "\u0645", "\u0646", "\u0647", "\u0648", "\u064A"];
16
+ const normalizeInput = (input) => {
17
+ const arabicCasting = {
18
+ "\u0627": "\u0623",
19
+ "\u0622": "\u0623",
20
+ "\u0625": "\u0623",
21
+ "\u0649": "\u064A"
22
+ };
23
+ return input.split("").map((char) => arabicCasting[char] || char.toUpperCase()).join("");
24
+ };
25
+ const updateModelAt = (index, value) => {
26
+ const newModel = [...model.value ?? ["", "", "", ""]];
27
+ newModel[index] = value;
28
+ model.value = newModel;
29
+ };
16
30
  const handleInput = (e, index) => {
17
31
  const input = e.target;
18
- const value = input.value;
32
+ let value = input.value;
19
33
  if (!model.value) {
20
34
  model.value = ["", "", "", ""];
21
35
  }
22
36
  if (e.inputType === "deleteContentBackward") {
23
- model.value[index] = "";
37
+ updateModelAt(index, "");
24
38
  if (index > 0) {
25
39
  document.getElementById(`license-${props.customId || ""}-${index - 1}`)?.focus();
26
40
  }
27
41
  return;
28
42
  }
29
43
  if (index < 3) {
44
+ value = normalizeInput(value);
30
45
  if (!allowedLetters.includes(value) && !allowedArabicLetters.includes(value)) {
31
- model.value[index] = "";
46
+ updateModelAt(index, "");
32
47
  input.value = "";
33
48
  return;
34
49
  }
35
- model.value[index] = value;
50
+ updateModelAt(index, value);
36
51
  if (value) {
37
52
  document.getElementById(`license-${props.customId || ""}-${index + 1}`)?.focus();
38
53
  }
39
54
  } else {
40
55
  if (/\D/.test(value)) {
41
- model.value[index] = "";
56
+ updateModelAt(index, "");
42
57
  input.value = "";
43
58
  return;
44
59
  }
45
- model.value[index] = value;
60
+ updateModelAt(index, value);
46
61
  }
47
62
  };
48
63
  const clear = () => {
@@ -55,7 +70,6 @@ const requiredRule = (value) => {
55
70
  return true;
56
71
  };
57
72
  watch(() => model.value, (newVal) => {
58
- console.log(newVal);
59
73
  if (Array.isArray(newVal)) {
60
74
  model.value = newVal;
61
75
  } else {
@@ -92,6 +106,7 @@ watch(() => model.value, (newVal) => {
92
106
  :value="model?.[index] ?? ''"
93
107
  class="app-license-plate-input-cell"
94
108
  type="text"
109
+ autocomplete="off"
95
110
  :maxlength="index === 3 ? 4 : 1"
96
111
  :placeholder="index === 3 ? t('inputs.numbers') : t('inputs.character')"
97
112
  @input="handleInput($event, index)"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@winchsa/ui",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "publishConfig": {