vueless 0.0.611 → 0.0.613
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/package.json +1 -1
- package/ui.button-link/ULink.vue +2 -2
- package/ui.button-link/constants.ts +1 -1
- package/ui.button-toggle/UToggle.vue +2 -2
- package/ui.button-toggle/constants.ts +1 -1
- package/ui.button-toggle-item/UToggleItem.vue +9 -9
- package/ui.button-toggle-item/constants.ts +1 -1
- package/ui.container-accordion/UAccordion.vue +2 -2
- package/ui.container-accordion/constants.ts +1 -1
- package/ui.container-card/UCard.vue +2 -2
- package/ui.container-card/constants.ts +1 -1
- package/ui.container-col/UCol.vue +2 -2
- package/ui.container-col/constants.ts +1 -1
- package/ui.container-divider/UDivider.vue +2 -2
- package/ui.container-divider/constants.ts +1 -1
- package/ui.container-group/UGroup.vue +2 -2
- package/ui.container-group/constants.ts +1 -1
- package/ui.container-groups/UGroups.vue +2 -2
- package/ui.container-groups/constants.ts +1 -1
- package/ui.container-modal/UModal.vue +2 -2
- package/ui.container-modal/constants.ts +1 -1
- package/ui.container-modal-confirm/UModalConfirm.vue +3 -3
- package/ui.container-modal-confirm/constants.ts +1 -1
- package/ui.container-page/UPage.vue +2 -2
- package/ui.container-page/constants.ts +1 -1
- package/ui.container-row/URow.vue +2 -2
- package/ui.container-row/constants.ts +1 -1
- package/ui.data-list/UDataList.vue +3 -3
- package/ui.data-list/constants.ts +1 -1
- package/ui.data-table/UTable.vue +3 -3
- package/ui.data-table/constants.ts +1 -1
- package/ui.dropdown-badge/UDropdownBadge.vue +2 -2
- package/ui.dropdown-badge/constants.ts +1 -1
- package/ui.dropdown-button/UDropdownButton.vue +2 -2
- package/ui.dropdown-button/constants.ts +1 -1
- package/ui.dropdown-link/UDropdownLink.vue +2 -2
- package/ui.dropdown-link/constants.ts +1 -1
- package/ui.dropdown-list/UDropdownList.vue +3 -3
- package/ui.dropdown-list/constants.ts +1 -1
- package/ui.form-calendar/UCalendar.vue +3 -3
- package/ui.form-calendar/constants.ts +1 -1
- package/ui.form-calendar/storybook/stories.ts +4 -4
- package/ui.form-checkbox/UCheckbox.vue +2 -2
- package/ui.form-checkbox/constants.ts +1 -1
- package/ui.form-checkbox-group/UCheckboxGroup.vue +2 -2
- package/ui.form-checkbox-group/constants.ts +1 -1
- package/ui.form-checkbox-multi-state/UCheckboxMultiState.vue +2 -2
- package/ui.form-checkbox-multi-state/constants.ts +1 -1
- package/ui.form-color-picker/UColorPicker.vue +3 -3
- package/ui.form-color-picker/constants.ts +1 -1
- package/ui.form-date-picker/UDatePicker.vue +3 -3
- package/ui.form-date-picker/constants.ts +1 -1
- package/ui.form-date-picker/storybook/stories.ts +4 -4
- package/ui.form-date-picker-range/UDatePickerRange.vue +2 -2
- package/ui.form-date-picker-range/constants.ts +1 -1
- package/ui.form-date-picker-range/storybook/stories.ts +4 -4
- package/ui.form-date-picker-range/useLocale.ts +2 -2
- package/ui.form-input/UInput.vue +2 -2
- package/ui.form-input/constants.ts +1 -1
- package/ui.form-input-file/UInputFile.vue +3 -3
- package/ui.form-input-file/constants.ts +1 -1
- package/ui.form-input-money/UInputMoney.vue +2 -2
- package/ui.form-input-money/constants.ts +1 -1
- package/ui.form-input-money/useFormatCurrency.ts +4 -1
- package/ui.form-input-money/utilFormat.ts +9 -2
- package/ui.form-input-number/UInputNumber.vue +2 -2
- package/ui.form-input-number/constants.ts +1 -1
- package/ui.form-input-rating/UInputRating.vue +2 -2
- package/ui.form-input-rating/constants.ts +1 -1
- package/ui.form-input-search/UInputSearch.vue +2 -2
- package/ui.form-input-search/constants.ts +1 -1
- package/ui.form-label/ULabel.vue +2 -2
- package/ui.form-label/constants.ts +1 -1
- package/ui.form-radio/URadio.vue +2 -2
- package/ui.form-radio/constants.ts +1 -1
- package/ui.form-radio-group/URadioGroup.vue +2 -2
- package/ui.form-radio-group/constants.ts +1 -1
- package/ui.form-select/USelect.vue +3 -3
- package/ui.form-select/constants.ts +1 -1
- package/ui.form-switch/USwitch.vue +3 -3
- package/ui.form-switch/constants.ts +1 -1
- package/ui.form-textarea/UTextarea.vue +2 -2
- package/ui.form-textarea/constants.ts +1 -1
- package/ui.image-avatar/UAvatar.vue +2 -2
- package/ui.image-avatar/constants.ts +1 -1
- package/ui.image-icon/UIcon.vue +2 -2
- package/ui.image-icon/constants.ts +1 -1
- package/ui.loader/ULoader.vue +2 -2
- package/ui.loader/constants.ts +1 -1
- package/ui.loader-overlay/ULoaderOverlay.vue +2 -2
- package/ui.loader-overlay/constants.ts +1 -1
- package/ui.loader-progress/ULoaderProgress.vue +2 -2
- package/ui.loader-progress/constants.ts +1 -1
- package/ui.navigation-pagination/UPagination.vue +2 -2
- package/ui.navigation-pagination/constants.ts +1 -1
- package/ui.navigation-progress/UProgress.vue +2 -2
- package/ui.navigation-progress/constants.ts +1 -1
- package/ui.navigation-tab/UTab.vue +3 -3
- package/ui.navigation-tab/constants.ts +1 -1
- package/ui.navigation-tabs/UTabs.vue +2 -2
- package/ui.navigation-tabs/constants.ts +1 -1
- package/ui.other-dot/UDot.vue +2 -2
- package/ui.other-dot/constants.ts +1 -1
- package/ui.text-alert/UAlert.vue +2 -2
- package/ui.text-alert/constants.ts +1 -1
- package/ui.text-badge/UBadge.vue +2 -2
- package/ui.text-badge/constants.ts +1 -1
- package/ui.text-block/UText.vue +2 -2
- package/ui.text-block/constants.ts +1 -1
- package/ui.text-empty/UEmpty.vue +2 -2
- package/ui.text-empty/constants.ts +1 -1
- package/ui.text-file/UFile.vue +2 -2
- package/ui.text-file/constants.ts +1 -1
- package/ui.text-files/UFiles.vue +2 -2
- package/ui.text-files/constants.ts +1 -1
- package/ui.text-header/UHeader.vue +2 -2
- package/ui.text-header/constants.ts +1 -1
- package/ui.text-money/UMoney.vue +2 -2
- package/ui.text-money/constants.ts +1 -1
- package/ui.text-notify/UNotify.vue +3 -3
- package/ui.text-notify/constants.ts +1 -1
- package/utils/ui.ts +2 -2
- package/web-types.json +1 -1
|
@@ -9,7 +9,7 @@ import UIcon from "../ui.image-icon/UIcon.vue";
|
|
|
9
9
|
import ULabel from "../ui.form-label/ULabel.vue";
|
|
10
10
|
|
|
11
11
|
import defaultConfig from "./config.ts";
|
|
12
|
-
import {
|
|
12
|
+
import { COMPONENT_NAME } from "./constants.ts";
|
|
13
13
|
|
|
14
14
|
import type { UnknownObject } from "../types.ts";
|
|
15
15
|
import type { Props, IconSize, Config } from "./types.ts";
|
|
@@ -26,7 +26,7 @@ const getCheckboxGroupColor = inject("getCheckboxGroupColor", null);
|
|
|
26
26
|
const getCheckboxSize = inject("getCheckboxSize", null);
|
|
27
27
|
|
|
28
28
|
const props = withDefaults(defineProps<Props>(), {
|
|
29
|
-
...getDefaults<Props, Config>(defaultConfig,
|
|
29
|
+
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
30
30
|
modelValue: false,
|
|
31
31
|
value: "",
|
|
32
32
|
trueValue: true,
|
|
@@ -8,7 +8,7 @@ import { getDefaults } from "../utils/ui.ts";
|
|
|
8
8
|
import ULabel from "../ui.form-label/ULabel.vue";
|
|
9
9
|
import UCheckbox from "../ui.form-checkbox/UCheckbox.vue";
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { COMPONENT_NAME } from "./constants.ts";
|
|
12
12
|
import defaultConfig from "./config.ts";
|
|
13
13
|
|
|
14
14
|
import type { UnknownObject } from "../types.ts";
|
|
@@ -17,7 +17,7 @@ import type { Props, Config } from "./types.ts";
|
|
|
17
17
|
defineOptions({ inheritAttrs: false });
|
|
18
18
|
|
|
19
19
|
const props = withDefaults(defineProps<Props>(), {
|
|
20
|
-
...getDefaults<Props, Config>(defaultConfig,
|
|
20
|
+
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
21
21
|
modelValue: () => [],
|
|
22
22
|
options: () => [],
|
|
23
23
|
label: "",
|
|
@@ -8,7 +8,7 @@ import { getDefaults } from "../utils/ui.ts";
|
|
|
8
8
|
import UCheckbox from "../ui.form-checkbox/UCheckbox.vue";
|
|
9
9
|
|
|
10
10
|
import defaultConfig from "./config.ts";
|
|
11
|
-
import {
|
|
11
|
+
import { COMPONENT_NAME } from "./constants.ts";
|
|
12
12
|
|
|
13
13
|
import type { Props, Config } from "./types.ts";
|
|
14
14
|
import type { UCheckboxOption, Config as UCheckboxConfig } from "../ui.form-checkbox/types.ts";
|
|
@@ -17,7 +17,7 @@ import type { KeyAttrsWithConfig, UnknownObject } from "../types.ts";
|
|
|
17
17
|
defineOptions({ inheritAttrs: false });
|
|
18
18
|
|
|
19
19
|
const props = withDefaults(defineProps<Props>(), {
|
|
20
|
-
...getDefaults<Props, Config>(defaultConfig,
|
|
20
|
+
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
21
21
|
modelValue: false,
|
|
22
22
|
options: () => [],
|
|
23
23
|
});
|
|
@@ -8,7 +8,7 @@ import UIcon from "../ui.image-icon/UIcon.vue";
|
|
|
8
8
|
import URadio from "../ui.form-radio/URadio.vue";
|
|
9
9
|
import ULabel from "../ui.form-label/ULabel.vue";
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { COMPONENT_NAME } from "./constants.ts";
|
|
12
12
|
import defaultConfig from "./config.ts";
|
|
13
13
|
|
|
14
14
|
import type { Props, IconSize, Config } from "./types.ts";
|
|
@@ -17,9 +17,9 @@ import type { BrandColors } from "../types.ts";
|
|
|
17
17
|
defineOptions({ inheritAttrs: false });
|
|
18
18
|
|
|
19
19
|
const props = withDefaults(defineProps<Props>(), {
|
|
20
|
-
...getDefaults<Props, Config>(defaultConfig,
|
|
20
|
+
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
21
21
|
colorOptions: () =>
|
|
22
|
-
getDefaults<Props, Config>(defaultConfig,
|
|
22
|
+
getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME).colorOptions as BrandColors[],
|
|
23
23
|
modelValue: "",
|
|
24
24
|
label: "",
|
|
25
25
|
});
|
|
@@ -18,7 +18,7 @@ import { useLocale } from "../composables/useLocale.ts";
|
|
|
18
18
|
import { Direction, useAutoPosition } from "../composables/useAutoPosition.ts";
|
|
19
19
|
|
|
20
20
|
import defaultConfig from "./config.ts";
|
|
21
|
-
import {
|
|
21
|
+
import { COMPONENT_NAME } from "./constants.ts";
|
|
22
22
|
|
|
23
23
|
import { vClickOutside } from "../directives";
|
|
24
24
|
|
|
@@ -32,7 +32,7 @@ defineOptions({ inheritAttrs: false });
|
|
|
32
32
|
|
|
33
33
|
type Props = UDatePickerProps<TModelValue>;
|
|
34
34
|
const props = withDefaults(defineProps<Props>(), {
|
|
35
|
-
...getDefaults<Props, Config>(defaultConfig,
|
|
35
|
+
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
36
36
|
modelValue: undefined,
|
|
37
37
|
minDate: undefined,
|
|
38
38
|
maxDate: undefined,
|
|
@@ -56,7 +56,7 @@ const emit = defineEmits([
|
|
|
56
56
|
|
|
57
57
|
const { tm } = useLocale();
|
|
58
58
|
|
|
59
|
-
const i18nGlobal = tm(
|
|
59
|
+
const i18nGlobal = tm(COMPONENT_NAME);
|
|
60
60
|
|
|
61
61
|
const isShownCalendar = ref(false);
|
|
62
62
|
const userFormatDate = ref("");
|
|
@@ -10,7 +10,7 @@ import UDatePicker from "../../ui.form-date-picker/UDatePicker.vue";
|
|
|
10
10
|
import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
11
11
|
import URow from "../../ui.container-row/URow.vue";
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { COMPONENT_NAME } from "../constants.ts";
|
|
14
14
|
|
|
15
15
|
import type { UDatePickerProps } from "../types.ts";
|
|
16
16
|
|
|
@@ -32,11 +32,11 @@ export default {
|
|
|
32
32
|
modelValue: null,
|
|
33
33
|
},
|
|
34
34
|
argTypes: {
|
|
35
|
-
...getArgTypes(
|
|
35
|
+
...getArgTypes(COMPONENT_NAME),
|
|
36
36
|
},
|
|
37
37
|
parameters: {
|
|
38
38
|
docs: {
|
|
39
|
-
...getDocsDescription(
|
|
39
|
+
...getDocsDescription(COMPONENT_NAME),
|
|
40
40
|
story: {
|
|
41
41
|
height: "480px",
|
|
42
42
|
},
|
|
@@ -47,7 +47,7 @@ export default {
|
|
|
47
47
|
const DefaultTemplate: StoryFn<DefaultUDatePickerArgs> = (args: DefaultUDatePickerArgs) => ({
|
|
48
48
|
components: { UDatePicker, UIcon },
|
|
49
49
|
setup() {
|
|
50
|
-
const slots = getSlotNames(
|
|
50
|
+
const slots = getSlotNames(COMPONENT_NAME);
|
|
51
51
|
|
|
52
52
|
return { args, slots };
|
|
53
53
|
},
|
|
@@ -46,7 +46,7 @@ import { useUserFormat } from "./useUserFormat.ts";
|
|
|
46
46
|
|
|
47
47
|
import defaultConfig from "./config.ts";
|
|
48
48
|
import {
|
|
49
|
-
|
|
49
|
+
COMPONENT_NAME,
|
|
50
50
|
DATE_PICKER_BUTTON_TYPE,
|
|
51
51
|
DATE_PICKER_INPUT_TYPE,
|
|
52
52
|
INPUT_RANGE_FORMAT,
|
|
@@ -71,7 +71,7 @@ defineOptions({ inheritAttrs: false });
|
|
|
71
71
|
|
|
72
72
|
type Props = UDatePickerRangeProps<TModelValue>;
|
|
73
73
|
const props = withDefaults(defineProps<Props>(), {
|
|
74
|
-
...getDefaults<Props, Config>(defaultConfig,
|
|
74
|
+
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
75
75
|
customRangeButton: () => ({ range: { from: null, to: null } }),
|
|
76
76
|
modelValue: undefined,
|
|
77
77
|
minDate: undefined,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
This const is needed to prevent the issue in script setup:
|
|
3
3
|
`defineProps` is referencing locally declared variables. (vue/valid-define-props)
|
|
4
4
|
*/
|
|
5
|
-
export const
|
|
5
|
+
export const COMPONENT_NAME = "UDatePickerRange";
|
|
6
6
|
|
|
7
7
|
export const DATE_PICKER_BUTTON_TYPE = "button";
|
|
8
8
|
export const DATE_PICKER_INPUT_TYPE = "input";
|
|
@@ -13,7 +13,7 @@ import UButton from "../../ui.button/UButton.vue";
|
|
|
13
13
|
|
|
14
14
|
import { addDays } from "../../ui.form-calendar/utilDate.ts";
|
|
15
15
|
|
|
16
|
-
import {
|
|
16
|
+
import { COMPONENT_NAME } from "../constants.ts";
|
|
17
17
|
|
|
18
18
|
import type { UDatePickerRangeProps } from "../types.ts";
|
|
19
19
|
|
|
@@ -38,11 +38,11 @@ export default {
|
|
|
38
38
|
},
|
|
39
39
|
},
|
|
40
40
|
argTypes: {
|
|
41
|
-
...getArgTypes(
|
|
41
|
+
...getArgTypes(COMPONENT_NAME),
|
|
42
42
|
},
|
|
43
43
|
parameters: {
|
|
44
44
|
docs: {
|
|
45
|
-
...getDocsDescription(
|
|
45
|
+
...getDocsDescription(COMPONENT_NAME),
|
|
46
46
|
story: {
|
|
47
47
|
height: "620px",
|
|
48
48
|
},
|
|
@@ -55,7 +55,7 @@ const DefaultTemplate: StoryFn<DefaultUDatePickerRangeArgs> = (
|
|
|
55
55
|
) => ({
|
|
56
56
|
components: { UDatePickerRange, UIcon, UButton },
|
|
57
57
|
setup() {
|
|
58
|
-
const slots = getSlotNames(
|
|
58
|
+
const slots = getSlotNames(COMPONENT_NAME);
|
|
59
59
|
|
|
60
60
|
return { args, slots };
|
|
61
61
|
},
|
|
@@ -4,7 +4,7 @@ import { useLocale as useGlobalLocale } from "../composables/useLocale.ts";
|
|
|
4
4
|
|
|
5
5
|
import { getSortedLocale } from "../ui.form-calendar/utilDate.ts";
|
|
6
6
|
import { LocaleType } from "../ui.form-calendar/constants.ts";
|
|
7
|
-
import {
|
|
7
|
+
import { COMPONENT_NAME } from "./constants.ts";
|
|
8
8
|
|
|
9
9
|
import defaultConfig from "./config.ts";
|
|
10
10
|
|
|
@@ -13,7 +13,7 @@ import type { Locale, UDatePickerRangeProps } from "./types.ts";
|
|
|
13
13
|
export function useLocale(props: UDatePickerRangeProps<unknown>) {
|
|
14
14
|
const { tm } = useGlobalLocale();
|
|
15
15
|
|
|
16
|
-
const i18nGlobal = tm<Locale>(
|
|
16
|
+
const i18nGlobal = tm<Locale>(COMPONENT_NAME);
|
|
17
17
|
|
|
18
18
|
const currentLocale = computed(() =>
|
|
19
19
|
merge({}, defaultConfig.i18n, i18nGlobal, props.config?.i18n),
|
package/ui.form-input/UInput.vue
CHANGED
|
@@ -10,14 +10,14 @@ import UIcon from "../ui.image-icon/UIcon.vue";
|
|
|
10
10
|
import ULabel from "../ui.form-label/ULabel.vue";
|
|
11
11
|
|
|
12
12
|
import defaultConfig from "./config.ts";
|
|
13
|
-
import {
|
|
13
|
+
import { COMPONENT_NAME } from "./constants.ts";
|
|
14
14
|
|
|
15
15
|
import type { Props, IconSize, Config } from "./types.ts";
|
|
16
16
|
|
|
17
17
|
defineOptions({ inheritAttrs: false });
|
|
18
18
|
|
|
19
19
|
const props = withDefaults(defineProps<Props>(), {
|
|
20
|
-
...getDefaults<Props, Config>(defaultConfig,
|
|
20
|
+
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
21
21
|
modelValue: "",
|
|
22
22
|
label: "",
|
|
23
23
|
placeholder: "",
|
|
@@ -14,7 +14,7 @@ import UFiles from "../ui.text-files/UFiles.vue";
|
|
|
14
14
|
|
|
15
15
|
import { useLocale } from "../composables/useLocale.ts";
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { COMPONENT_NAME } from "./constants.ts";
|
|
18
18
|
import defaultConfig from "./config.ts";
|
|
19
19
|
|
|
20
20
|
import type { Props, ButtonSize, Config } from "./types.ts";
|
|
@@ -22,7 +22,7 @@ import type { Props, ButtonSize, Config } from "./types.ts";
|
|
|
22
22
|
defineOptions({ inheritAttrs: false });
|
|
23
23
|
|
|
24
24
|
const props = withDefaults(defineProps<Props>(), {
|
|
25
|
-
...getDefaults<Props, Config>(defaultConfig,
|
|
25
|
+
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
26
26
|
modelValue: () => [],
|
|
27
27
|
allowedFileTypes: () => [],
|
|
28
28
|
label: "",
|
|
@@ -49,7 +49,7 @@ const fileInputRef = ref<HTMLInputElement | null>(null);
|
|
|
49
49
|
|
|
50
50
|
const elementId = props.id || useId();
|
|
51
51
|
|
|
52
|
-
const i18nGlobal = tm(
|
|
52
|
+
const i18nGlobal = tm(COMPONENT_NAME);
|
|
53
53
|
const currentLocale = computed(() => merge({}, defaultConfig.i18n, i18nGlobal, props.config.i18n));
|
|
54
54
|
|
|
55
55
|
const currentFiles = computed<File | File[] | null>({
|
|
@@ -8,14 +8,14 @@ import UInput from "../ui.form-input/UInput.vue";
|
|
|
8
8
|
|
|
9
9
|
import defaultConfig from "./config.ts";
|
|
10
10
|
import useFormatCurrency from "./useFormatCurrency.ts";
|
|
11
|
-
import {
|
|
11
|
+
import { COMPONENT_NAME } from "./constants.ts";
|
|
12
12
|
|
|
13
13
|
import type { Props, Config } from "./types.ts";
|
|
14
14
|
|
|
15
15
|
defineOptions({ inheritAttrs: false });
|
|
16
16
|
|
|
17
17
|
const props = withDefaults(defineProps<Props>(), {
|
|
18
|
-
...getDefaults<Props, Config>(defaultConfig,
|
|
18
|
+
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
19
19
|
modelValue: "",
|
|
20
20
|
label: "",
|
|
21
21
|
placeholder: "",
|
|
@@ -4,7 +4,10 @@ import { getRawValue, getFormattedValue } from "./utilFormat.ts";
|
|
|
4
4
|
|
|
5
5
|
import type { FormatOptions } from "./types.ts";
|
|
6
6
|
|
|
7
|
-
export default function useFormatCurrency(
|
|
7
|
+
export default function useFormatCurrency(
|
|
8
|
+
elementId: string = "",
|
|
9
|
+
options: (() => FormatOptions) | FormatOptions,
|
|
10
|
+
) {
|
|
8
11
|
let prevValue = "";
|
|
9
12
|
let inputElement: HTMLInputElement | null = null;
|
|
10
13
|
|
|
@@ -3,6 +3,7 @@ import type { FormatOptions } from "./types.ts";
|
|
|
3
3
|
const isNumberValueRegExp = /^[\d,.\s-]+$/;
|
|
4
4
|
const rawDecimalMark = ".";
|
|
5
5
|
const comma = ",";
|
|
6
|
+
const minus = "-";
|
|
6
7
|
|
|
7
8
|
export function getRawValue(value: string | number, options: FormatOptions): string {
|
|
8
9
|
const { thousandsSeparator, decimalSeparator, prefix } = options;
|
|
@@ -44,12 +45,18 @@ export function getFormattedValue(value: string | number, options: FormatOptions
|
|
|
44
45
|
value = String(value)
|
|
45
46
|
.replace(invalidValuesRegExp, "")
|
|
46
47
|
.replace(doubleValueRegExp, "$1")
|
|
47
|
-
.replaceAll(decimalSeparator, rawDecimalMark)
|
|
48
|
+
.replaceAll(decimalSeparator, rawDecimalMark)
|
|
49
|
+
.trim();
|
|
48
50
|
|
|
49
51
|
const isNumber = isNumberValueRegExp.test(value);
|
|
50
52
|
const isFloat = value.endsWith(rawDecimalMark) || value.endsWith(".0");
|
|
53
|
+
const isMinus = value === minus;
|
|
51
54
|
|
|
52
|
-
if (
|
|
55
|
+
if (isMinus && positiveOnly) {
|
|
56
|
+
value = "";
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (!value || !isNumber || isFloat || isMinus) {
|
|
53
60
|
return `${prefix}${value.replaceAll(rawDecimalMark, decimalSeparator)}`;
|
|
54
61
|
}
|
|
55
62
|
|
|
@@ -9,14 +9,14 @@ import UButton from "../ui.button/UButton.vue";
|
|
|
9
9
|
import ULabel from "../ui.form-label/ULabel.vue";
|
|
10
10
|
|
|
11
11
|
import defaultConfig from "./config.ts";
|
|
12
|
-
import {
|
|
12
|
+
import { COMPONENT_NAME } from "./constants.ts";
|
|
13
13
|
|
|
14
14
|
import type { UInputNumberProps, Config } from "./types.ts";
|
|
15
15
|
|
|
16
16
|
defineOptions({ inheritAttrs: false });
|
|
17
17
|
|
|
18
18
|
const props = withDefaults(defineProps<UInputNumberProps>(), {
|
|
19
|
-
...getDefaults<UInputNumberProps, Config>(defaultConfig,
|
|
19
|
+
...getDefaults<UInputNumberProps, Config>(defaultConfig, COMPONENT_NAME),
|
|
20
20
|
label: "",
|
|
21
21
|
});
|
|
22
22
|
|
|
@@ -8,7 +8,7 @@ import { getDefaults } from "../utils/ui.ts";
|
|
|
8
8
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
9
9
|
import ULabel from "../ui.form-label/ULabel.vue";
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { COMPONENT_NAME } from "./constants.ts";
|
|
12
12
|
import defaultConfig from "./config.ts";
|
|
13
13
|
|
|
14
14
|
import type { Props, IconSize, Config } from "./types.ts";
|
|
@@ -16,7 +16,7 @@ import type { Props, IconSize, Config } from "./types.ts";
|
|
|
16
16
|
defineOptions({ inheritAttrs: false });
|
|
17
17
|
|
|
18
18
|
const props = withDefaults(defineProps<Props>(), {
|
|
19
|
-
...getDefaults<Props, Config>(defaultConfig,
|
|
19
|
+
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
20
20
|
label: "",
|
|
21
21
|
});
|
|
22
22
|
|
|
@@ -9,7 +9,7 @@ import UIcon from "../ui.image-icon/UIcon.vue";
|
|
|
9
9
|
import UInput from "../ui.form-input/UInput.vue";
|
|
10
10
|
import UButton from "../ui.button/UButton.vue";
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { COMPONENT_NAME } from "./constants.ts";
|
|
13
13
|
import defaultConfig from "./config.ts";
|
|
14
14
|
|
|
15
15
|
import type { Props, IconSize, ButtonSize, Config } from "./types.ts";
|
|
@@ -17,7 +17,7 @@ import type { Props, IconSize, ButtonSize, Config } from "./types.ts";
|
|
|
17
17
|
defineOptions({ inheritAttrs: false });
|
|
18
18
|
|
|
19
19
|
const props = withDefaults(defineProps<Props>(), {
|
|
20
|
-
...getDefaults<Props, Config>(defaultConfig,
|
|
20
|
+
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
21
21
|
modelValue: "",
|
|
22
22
|
label: "",
|
|
23
23
|
placeholder: "",
|
package/ui.form-label/ULabel.vue
CHANGED
|
@@ -5,14 +5,14 @@ import useUI from "../composables/useUI.ts";
|
|
|
5
5
|
import { getDefaults } from "../utils/ui.ts";
|
|
6
6
|
|
|
7
7
|
import defaultConfig from "./config.ts";
|
|
8
|
-
import {
|
|
8
|
+
import { COMPONENT_NAME, PLACEMENT } from "./constants.ts";
|
|
9
9
|
|
|
10
10
|
import type { Props, Config } from "./types.ts";
|
|
11
11
|
|
|
12
12
|
defineOptions({ inheritAttrs: false });
|
|
13
13
|
|
|
14
14
|
const props = withDefaults(defineProps<Props>(), {
|
|
15
|
-
...getDefaults<Props, Config>(defaultConfig,
|
|
15
|
+
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
16
16
|
label: "",
|
|
17
17
|
});
|
|
18
18
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
This const is needed to prevent the issue in script setup:
|
|
3
3
|
`defineProps` is referencing locally declared variables. (vue/valid-define-props)
|
|
4
4
|
*/
|
|
5
|
-
export const
|
|
5
|
+
export const COMPONENT_NAME = "ULabel";
|
|
6
6
|
|
|
7
7
|
export const PLACEMENT = {
|
|
8
8
|
topInside: "topInside",
|
package/ui.form-radio/URadio.vue
CHANGED
|
@@ -7,7 +7,7 @@ import { getDefaults } from "../utils/ui.ts";
|
|
|
7
7
|
import ULabel from "../ui.form-label/ULabel.vue";
|
|
8
8
|
|
|
9
9
|
import defaultConfig from "./config.ts";
|
|
10
|
-
import {
|
|
10
|
+
import { COMPONENT_NAME } from "./constants.ts";
|
|
11
11
|
|
|
12
12
|
import type { Props, LocalValueType, Config } from "./types.ts";
|
|
13
13
|
import type { SetRadioGroupSelectedItem } from "../ui.form-radio-group/types.ts";
|
|
@@ -24,7 +24,7 @@ const getRadioGroupSize = inject("getRadioGroupSize", null);
|
|
|
24
24
|
const getRadioGroupSelectedItem = inject("getRadioGroupSelectedItem", null);
|
|
25
25
|
|
|
26
26
|
const props = withDefaults(defineProps<Props>(), {
|
|
27
|
-
...getDefaults<Props, Config>(defaultConfig,
|
|
27
|
+
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
28
28
|
modelValue: () => ({}),
|
|
29
29
|
value: () => ({}),
|
|
30
30
|
label: "",
|
|
@@ -8,14 +8,14 @@ import ULabel from "../ui.form-label/ULabel.vue";
|
|
|
8
8
|
import URadio from "../ui.form-radio/URadio.vue";
|
|
9
9
|
|
|
10
10
|
import defaultConfig from "./config.ts";
|
|
11
|
-
import {
|
|
11
|
+
import { COMPONENT_NAME } from "./constants.ts";
|
|
12
12
|
|
|
13
13
|
import type { Props, SetRadioGroupSelectedItem, Config } from "./types.ts";
|
|
14
14
|
|
|
15
15
|
defineOptions({ inheritAttrs: false });
|
|
16
16
|
|
|
17
17
|
const props = withDefaults(defineProps<Props>(), {
|
|
18
|
-
...getDefaults<Props, Config>(defaultConfig,
|
|
18
|
+
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
19
19
|
modelValue: () => [],
|
|
20
20
|
options: () => [],
|
|
21
21
|
label: "",
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
getCurrentOption,
|
|
19
19
|
} from "./utilSelect.ts";
|
|
20
20
|
import defaultConfig from "./config.ts";
|
|
21
|
-
import {
|
|
21
|
+
import { COMPONENT_NAME, DIRECTION, KEYS } from "./constants.ts";
|
|
22
22
|
|
|
23
23
|
import { useLocale } from "../composables/useLocale.ts";
|
|
24
24
|
|
|
@@ -29,7 +29,7 @@ import type { ComponentExposed, KeyAttrsWithConfig } from "../types.ts";
|
|
|
29
29
|
defineOptions({ inheritAttrs: false });
|
|
30
30
|
|
|
31
31
|
const props = withDefaults(defineProps<Props>(), {
|
|
32
|
-
...getDefaults<Props, Config>(defaultConfig,
|
|
32
|
+
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
33
33
|
options: () => [],
|
|
34
34
|
modelValue: "",
|
|
35
35
|
label: "",
|
|
@@ -96,7 +96,7 @@ const innerWrapperRef = ref<HTMLDivElement | null>(null);
|
|
|
96
96
|
|
|
97
97
|
const elementId = props.id || useId();
|
|
98
98
|
|
|
99
|
-
const i18nGlobal = tm(
|
|
99
|
+
const i18nGlobal = tm(COMPONENT_NAME);
|
|
100
100
|
const currentLocale = computed(() => merge({}, defaultConfig.i18n, i18nGlobal, props.config.i18n));
|
|
101
101
|
|
|
102
102
|
const isTop = computed(() => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
This const is needed to prevent the issue in script setup:
|
|
3
3
|
`defineProps` is referencing locally declared variables. (vue/valid-define-props)
|
|
4
4
|
*/
|
|
5
|
-
export const
|
|
5
|
+
export const COMPONENT_NAME = "USelect";
|
|
6
6
|
|
|
7
7
|
export const DIRECTION = {
|
|
8
8
|
top: "top",
|
|
@@ -8,7 +8,7 @@ import { getDefaults } from "../utils/ui.ts";
|
|
|
8
8
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
9
9
|
import ULabel from "../ui.form-label/ULabel.vue";
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { COMPONENT_NAME } from "./constants.ts";
|
|
12
12
|
import defaultConfig from "./config.ts";
|
|
13
13
|
import { useLocale } from "../composables/useLocale.ts";
|
|
14
14
|
|
|
@@ -17,7 +17,7 @@ import type { Props, IconSize, Config } from "./types.ts";
|
|
|
17
17
|
defineOptions({ inheritAttrs: false });
|
|
18
18
|
|
|
19
19
|
const props = withDefaults(defineProps<Props>(), {
|
|
20
|
-
...getDefaults<Props, Config>(defaultConfig,
|
|
20
|
+
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
21
21
|
modelValue: false,
|
|
22
22
|
label: "",
|
|
23
23
|
});
|
|
@@ -32,7 +32,7 @@ const emit = defineEmits([
|
|
|
32
32
|
|
|
33
33
|
const { tm } = useLocale();
|
|
34
34
|
|
|
35
|
-
const i18nGlobal = tm(
|
|
35
|
+
const i18nGlobal = tm(COMPONENT_NAME);
|
|
36
36
|
const currentLocale = computed(() => merge({}, defaultConfig.i18n, i18nGlobal, props.config?.i18n));
|
|
37
37
|
|
|
38
38
|
const checkedValue = computed({
|
|
@@ -9,7 +9,7 @@ import { useMutationObserver } from "../composables/useMutationObserver.ts";
|
|
|
9
9
|
|
|
10
10
|
import ULabel from "../ui.form-label/ULabel.vue";
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { COMPONENT_NAME } from "./constants.ts";
|
|
13
13
|
import defaultConfig from "./config.ts";
|
|
14
14
|
|
|
15
15
|
import type { Props, Config } from "./types.ts";
|
|
@@ -17,7 +17,7 @@ import type { Props, Config } from "./types.ts";
|
|
|
17
17
|
defineOptions({ inheritAttrs: false });
|
|
18
18
|
|
|
19
19
|
const props = withDefaults(defineProps<Props>(), {
|
|
20
|
-
...getDefaults<Props, Config>(defaultConfig,
|
|
20
|
+
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
21
21
|
modelValue: "",
|
|
22
22
|
label: "",
|
|
23
23
|
placeholder: "",
|