@winchsa/ui 0.1.31 → 0.1.34
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/components/forms/AppCombobox.vue +8 -15
- package/dist/components/forms/AppNumberField.d.vue.ts +1 -1
- package/dist/components/forms/AppNumberField.vue +18 -24
- package/dist/components/forms/AppNumberField.vue.d.ts +1 -1
- package/dist/components/forms/AppSelect.vue +7 -14
- package/dist/components/forms/AppTextField.vue +8 -15
- package/dist/components/forms/AppTextarea.vue +8 -15
- package/dist/components/forms/DatePicker.vue +3 -11
- package/package.json +1 -1
|
@@ -7,23 +7,16 @@ defineOptions({
|
|
|
7
7
|
inheritAttrs: false
|
|
8
8
|
});
|
|
9
9
|
const { t } = useI18n();
|
|
10
|
+
const attrs = useAttrs();
|
|
11
|
+
const uid = Math.random().toString(36).slice(2, 7);
|
|
12
|
+
const label = computed(() => attrs.label);
|
|
13
|
+
const langLabel = computed(() => label.value ? t(label.value) : "");
|
|
10
14
|
const elementId = computed(() => {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
return _elementIdToken ? `app-combobox-${_elementIdToken}-${Math.random().toString(36).slice(2, 7)}` : void 0;
|
|
15
|
+
const token = attrs.id || label.value;
|
|
16
|
+
return token ? `app-combobox-${token}-${uid}` : void 0;
|
|
14
17
|
});
|
|
15
|
-
const label = computed(() => useAttrs()?.label);
|
|
16
|
-
const LangLabel = computed(() => label.value ? t(label.value) : "");
|
|
17
18
|
const placeholder = computed(() => {
|
|
18
|
-
|
|
19
|
-
return useAttrs()?.placeholder;
|
|
20
|
-
}
|
|
21
|
-
if (label.value) {
|
|
22
|
-
return t("inputs.placeholder", {
|
|
23
|
-
name: LangLabel.value
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
return "";
|
|
19
|
+
return attrs.placeholder || (label.value ? t("inputs.placeholder", { name: langLabel.value }) : "");
|
|
27
20
|
});
|
|
28
21
|
</script>
|
|
29
22
|
|
|
@@ -36,7 +29,7 @@ const placeholder = computed(() => {
|
|
|
36
29
|
v-if="label"
|
|
37
30
|
:for="elementId"
|
|
38
31
|
class="mb-2 text-body-2 text-high-emphasis"
|
|
39
|
-
:text="
|
|
32
|
+
:text="langLabel"
|
|
40
33
|
/>
|
|
41
34
|
|
|
42
35
|
<VCombobox
|
|
@@ -2,43 +2,37 @@
|
|
|
2
2
|
import { ref, watch, useAttrs, computed } from "vue";
|
|
3
3
|
import { VTextField, VLabel } from "vuetify/components";
|
|
4
4
|
import { useI18n } from "vue-i18n";
|
|
5
|
+
const { t } = useI18n();
|
|
6
|
+
const attrs = useAttrs();
|
|
5
7
|
defineOptions({
|
|
6
8
|
name: "AppTextField",
|
|
7
9
|
inheritAttrs: false
|
|
8
10
|
});
|
|
9
11
|
const props = defineProps({
|
|
10
|
-
modelValue: { type: [String, null], required: false, default: null }
|
|
12
|
+
modelValue: { type: [String, null, Number], required: false, default: null }
|
|
11
13
|
});
|
|
12
|
-
const
|
|
14
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
13
15
|
const numberValue = ref(null);
|
|
16
|
+
const uid = Math.random().toString(36).slice(2, 7);
|
|
17
|
+
const toDigits = (value) => {
|
|
18
|
+
return String(value ?? "").replace(/\D/g, "") || null;
|
|
19
|
+
};
|
|
20
|
+
const label = computed(() => attrs.label);
|
|
21
|
+
const langLabel = computed(() => label.value ? t(label.value) : "");
|
|
14
22
|
const elementId = computed(() => {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
return _elementIdToken ? `AppTextField-${_elementIdToken}-${Math.random().toString(36).slice(2, 7)}` : void 0;
|
|
23
|
+
const token = attrs.id || label.value;
|
|
24
|
+
return token ? `AppTextField-${token}-${uid}` : void 0;
|
|
18
25
|
});
|
|
19
|
-
const label = computed(() => useAttrs()?.label);
|
|
20
|
-
const LangLabel = computed(() => label.value ? t(label.value) : "");
|
|
21
|
-
const emit = defineEmits(["update:modelValue"]);
|
|
22
26
|
const placeholder = computed(() => {
|
|
23
|
-
|
|
24
|
-
return useAttrs()?.placeholder;
|
|
25
|
-
}
|
|
26
|
-
if (label.value) {
|
|
27
|
-
return t("inputs.placeholder", {
|
|
28
|
-
name: LangLabel.value
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
return "";
|
|
27
|
+
return attrs.placeholder || (label.value ? t("inputs.placeholder", { name: langLabel.value }) : "");
|
|
32
28
|
});
|
|
33
|
-
watch(() => props.modelValue, () => {
|
|
34
|
-
numberValue.value =
|
|
29
|
+
watch(() => props.modelValue, (val) => {
|
|
30
|
+
numberValue.value = toDigits(val);
|
|
35
31
|
emit("update:modelValue", numberValue.value);
|
|
36
|
-
}, {
|
|
37
|
-
immediate: true
|
|
38
|
-
});
|
|
32
|
+
}, { immediate: true });
|
|
39
33
|
const validateInput = (event) => {
|
|
40
34
|
const input = event.target;
|
|
41
|
-
numberValue.value = numberValue.value
|
|
35
|
+
numberValue.value = toDigits(numberValue.value);
|
|
42
36
|
input.value = numberValue.value ?? "";
|
|
43
37
|
emit("update:modelValue", numberValue.value);
|
|
44
38
|
};
|
|
@@ -53,7 +47,7 @@ const validateInput = (event) => {
|
|
|
53
47
|
v-if="label"
|
|
54
48
|
:for="elementId"
|
|
55
49
|
class="mb-2 text-body-2 text-high-emphasis app-font-size-13"
|
|
56
|
-
:text="
|
|
50
|
+
:text="langLabel"
|
|
57
51
|
/>
|
|
58
52
|
<VTextField
|
|
59
53
|
v-bind="{
|
|
@@ -9,22 +9,15 @@ defineOptions({
|
|
|
9
9
|
const { t } = useI18n();
|
|
10
10
|
const attrs = useAttrs();
|
|
11
11
|
const emit = defineEmits(["update:model-value"]);
|
|
12
|
+
const uid = Math.random().toString(36).slice(2, 7);
|
|
13
|
+
const label = computed(() => attrs.label);
|
|
14
|
+
const langLabel = computed(() => label.value ? t(label.value) : "");
|
|
12
15
|
const elementId = computed(() => {
|
|
13
|
-
const
|
|
14
|
-
return
|
|
16
|
+
const token = attrs.id || label.value;
|
|
17
|
+
return token ? `app-select-${token}-${uid}` : void 0;
|
|
15
18
|
});
|
|
16
|
-
const label = computed(() => attrs?.label);
|
|
17
|
-
const LangLabel = computed(() => label.value ? t(label.value) : "");
|
|
18
19
|
const placeholder = computed(() => {
|
|
19
|
-
|
|
20
|
-
return attrs?.placeholder;
|
|
21
|
-
}
|
|
22
|
-
if (label.value) {
|
|
23
|
-
return t("inputs.placeholder_select", {
|
|
24
|
-
name: LangLabel.value
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return "";
|
|
20
|
+
return attrs.placeholder || (label.value ? t("inputs.placeholder_select", { name: langLabel.value }) : "");
|
|
28
21
|
});
|
|
29
22
|
const handleMenuToggle = ($event) => {
|
|
30
23
|
const container = document.getElementsByClassName("v-overlay-container");
|
|
@@ -49,7 +42,7 @@ const handleMenuToggle = ($event) => {
|
|
|
49
42
|
v-if="label"
|
|
50
43
|
:for="elementId"
|
|
51
44
|
class="mb-2 text-body-2 text-high-emphasis app-font-size-13"
|
|
52
|
-
:text="
|
|
45
|
+
:text="langLabel"
|
|
53
46
|
/>
|
|
54
47
|
|
|
55
48
|
<VSelect
|
|
@@ -7,23 +7,16 @@ defineOptions({
|
|
|
7
7
|
inheritAttrs: false
|
|
8
8
|
});
|
|
9
9
|
const { t } = useI18n();
|
|
10
|
+
const attrs = useAttrs();
|
|
11
|
+
const uid = Math.random().toString(36).slice(2, 7);
|
|
12
|
+
const label = computed(() => attrs.label);
|
|
13
|
+
const langLabel = computed(() => label.value ? t(label.value) : "");
|
|
10
14
|
const elementId = computed(() => {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
return _elementIdToken ? `AppTextField-${_elementIdToken}-${Math.random().toString(36).slice(2, 7)}` : void 0;
|
|
15
|
+
const token = attrs.id || label.value;
|
|
16
|
+
return token ? `AppTextField-${token}-${uid}` : void 0;
|
|
14
17
|
});
|
|
15
|
-
const label = computed(() => useAttrs()?.label);
|
|
16
|
-
const LangLabel = computed(() => label.value ? t(label.value) : "");
|
|
17
18
|
const placeholder = computed(() => {
|
|
18
|
-
|
|
19
|
-
return useAttrs()?.placeholder;
|
|
20
|
-
}
|
|
21
|
-
if (label.value) {
|
|
22
|
-
return t("inputs.placeholder", {
|
|
23
|
-
name: LangLabel.value
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
return "";
|
|
19
|
+
return attrs.placeholder || (label.value ? t("inputs.placeholder", { name: langLabel.value }) : "");
|
|
27
20
|
});
|
|
28
21
|
</script>
|
|
29
22
|
|
|
@@ -36,7 +29,7 @@ const placeholder = computed(() => {
|
|
|
36
29
|
v-if="label"
|
|
37
30
|
:for="elementId"
|
|
38
31
|
class="mb-2 text-body-2 text-high-emphasis app-font-size-13"
|
|
39
|
-
:text="
|
|
32
|
+
:text="langLabel"
|
|
40
33
|
/>
|
|
41
34
|
<VTextField
|
|
42
35
|
v-bind="{
|
|
@@ -7,23 +7,16 @@ defineOptions({
|
|
|
7
7
|
inheritAttrs: false
|
|
8
8
|
});
|
|
9
9
|
const { t } = useI18n();
|
|
10
|
+
const attrs = useAttrs();
|
|
11
|
+
const uid = Math.random().toString(36).slice(2, 7);
|
|
12
|
+
const label = computed(() => attrs.label);
|
|
13
|
+
const langLabel = computed(() => label.value ? t(label.value) : "");
|
|
10
14
|
const elementId = computed(() => {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
return _elementIdToken ? `app-textarea-${_elementIdToken}-${Math.random().toString(36).slice(2, 7)}` : void 0;
|
|
15
|
+
const token = attrs.id || label.value;
|
|
16
|
+
return token ? `app-textarea-${token}-${uid}` : void 0;
|
|
14
17
|
});
|
|
15
|
-
const label = computed(() => useAttrs()?.label);
|
|
16
|
-
const LangLabel = computed(() => label.value ? t(label.value) : "");
|
|
17
18
|
const placeholder = computed(() => {
|
|
18
|
-
|
|
19
|
-
return useAttrs()?.placeholder;
|
|
20
|
-
}
|
|
21
|
-
if (label.value) {
|
|
22
|
-
return t("inputs.placeholder", {
|
|
23
|
-
name: LangLabel.value
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
return "";
|
|
19
|
+
return attrs.placeholder || (label.value ? t("inputs.placeholder", { name: langLabel.value }) : "");
|
|
27
20
|
});
|
|
28
21
|
</script>
|
|
29
22
|
|
|
@@ -36,7 +29,7 @@ const placeholder = computed(() => {
|
|
|
36
29
|
v-if="label"
|
|
37
30
|
:for="elementId"
|
|
38
31
|
class="mb-2 text-body-2 text-high-emphasis"
|
|
39
|
-
:text="
|
|
32
|
+
:text="langLabel"
|
|
40
33
|
/>
|
|
41
34
|
<VTextarea
|
|
42
35
|
v-bind="{
|
|
@@ -42,17 +42,9 @@ const elementId = computed(() => {
|
|
|
42
42
|
const _elementIdToken = attrs.id || attrs.label;
|
|
43
43
|
return _elementIdToken ? `AppTextField-${_elementIdToken}-${guid}` : `datepicker-${_elementIdToken}-${guid}`;
|
|
44
44
|
});
|
|
45
|
-
const
|
|
45
|
+
const langLabel = computed(() => props.label ? t(props.label) : "");
|
|
46
46
|
const placeholder = computed(() => {
|
|
47
|
-
|
|
48
|
-
return props.placeholder;
|
|
49
|
-
}
|
|
50
|
-
if (LangLabel.value) {
|
|
51
|
-
return t("inputs.placeholder_select", {
|
|
52
|
-
name: LangLabel.value
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
return "";
|
|
47
|
+
return props.placeholder || (langLabel.value ? t("inputs.placeholder_select", { name: langLabel.value }) : "");
|
|
56
48
|
});
|
|
57
49
|
const localeConfig = computed(() => ({
|
|
58
50
|
id: locale.value,
|
|
@@ -194,7 +186,7 @@ onBeforeUnmount(() => {
|
|
|
194
186
|
<VLabel
|
|
195
187
|
v-if="forcedLabel || label"
|
|
196
188
|
class="text-body-2 text-high-emphasis mb-2"
|
|
197
|
-
:text="forcedLabel
|
|
189
|
+
:text="forcedLabel || langLabel"
|
|
198
190
|
/>
|
|
199
191
|
<div dir="ltr" class="h-100">
|
|
200
192
|
<div :dir="locale === 'en' ? 'ltr' : 'rtl'" class="d-flex justify-center align-center gap-2 h-100">
|