vueless 0.0.555 → 0.0.556
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/composables/useUI.ts +11 -78
- package/constants.js +19 -1
- package/index.d.ts +8 -1
- package/index.ts +1 -1
- package/package.json +1 -1
- package/types.ts +4 -10
- package/ui.button/UButton.vue +21 -7
- package/ui.button-link/ULink.vue +14 -2
- package/ui.button-link/config.ts +6 -1
- package/ui.button-link/useAttrs.ts +8 -39
- package/ui.button-toggle/useAttrs.ts +2 -8
- package/ui.button-toggle-item/config.ts +9 -11
- package/ui.button-toggle-item/useAttrs.ts +4 -18
- package/ui.container-accordion/config.ts +3 -1
- package/ui.container-accordion/useAttrs.ts +6 -17
- package/ui.container-card/UCard.vue +2 -1
- package/ui.container-card/useAttrs.ts +2 -8
- package/ui.container-col/useAttrs.ts +2 -8
- package/ui.container-divider/useAttrs.ts +2 -8
- package/ui.container-group/useAttrs.ts +2 -8
- package/ui.container-groups/useAttrs.ts +2 -8
- package/ui.container-modal/UModal.vue +1 -1
- package/ui.container-modal/useAttrs.ts +2 -12
- package/ui.container-modal-confirm/UModalConfirm.vue +3 -7
- package/ui.container-modal-confirm/useAttrs.ts +2 -8
- package/ui.container-page/UPage.vue +4 -5
- package/ui.container-page/useAttrs.ts +3 -32
- package/ui.container-row/useAttrs.ts +2 -8
- package/ui.data-list/UDataList.vue +3 -2
- package/ui.data-list/config.js +1 -1
- package/ui.data-list/useAttrs.js +2 -18
- package/ui.data-table/UTable.vue +6 -6
- package/ui.data-table/UTableRow.vue +1 -5
- package/ui.data-table/config.ts +28 -13
- package/ui.data-table/useAttrs.ts +10 -75
- package/ui.dropdown-badge/config.ts +10 -2
- package/ui.dropdown-badge/useAttrs.ts +8 -21
- package/ui.dropdown-button/config.ts +6 -6
- package/ui.dropdown-button/useAttrs.ts +6 -19
- package/ui.dropdown-link/config.ts +8 -2
- package/ui.dropdown-link/useAttrs.ts +10 -20
- package/ui.dropdown-list/config.ts +3 -2
- package/ui.dropdown-list/useAttrs.ts +2 -25
- package/ui.form-calendar/useAttrs.ts +2 -8
- package/ui.form-checkbox/useAttrs.ts +2 -8
- package/ui.form-checkbox-group/useAttrs.ts +2 -8
- package/ui.form-checkbox-multi-state/useAttrs.ts +2 -6
- package/ui.form-color-picker/useAttrs.js +2 -8
- package/ui.form-date-picker/useAttrs.ts +2 -6
- package/ui.form-date-picker-range/UDatePickerRange.vue +28 -28
- package/ui.form-date-picker-range/config.ts +30 -16
- package/ui.form-date-picker-range/useAttrs.ts +9 -70
- package/ui.form-input/UInput.vue +1 -1
- package/ui.form-input/useAttrs.js +2 -8
- package/ui.form-input-file/UInputFile.vue +3 -4
- package/ui.form-input-file/useAttrs.js +2 -8
- package/ui.form-input-money/useAttrs.js +2 -8
- package/ui.form-input-number/useAttrs.js +2 -8
- package/ui.form-input-rating/UInputRating.vue +5 -11
- package/ui.form-input-rating/useAttrs.js +2 -8
- package/ui.form-input-search/useAttrs.js +2 -8
- package/ui.form-label/useAttrs.js +2 -8
- package/ui.form-radio/useAttrs.ts +2 -8
- package/ui.form-radio-group/useAttrs.ts +2 -8
- package/ui.form-select/USelect.vue +37 -38
- package/ui.form-select/config.js +30 -11
- package/ui.form-select/useAttrs.js +6 -50
- package/ui.form-switch/useAttrs.js +2 -8
- package/ui.form-textarea/UTextarea.vue +5 -9
- package/ui.form-textarea/useAttrs.js +2 -8
- package/ui.image-avatar/useAttrs.ts +2 -8
- package/ui.image-icon/useAttrs.ts +2 -8
- package/ui.loader/config.ts +4 -1
- package/ui.loader/useAttrs.ts +2 -17
- package/ui.loader-overlay/useAttrs.ts +2 -12
- package/ui.loader-progress/ULoaderProgress.vue +2 -2
- package/ui.loader-progress/config.ts +8 -2
- package/ui.loader-progress/types.ts +5 -0
- package/ui.loader-progress/useAttrs.ts +3 -27
- package/ui.navigation-pagination/config.ts +6 -6
- package/ui.navigation-pagination/useAttrs.ts +2 -34
- package/ui.navigation-progress/config.ts +3 -1
- package/ui.navigation-progress/useAttrs.ts +5 -17
- package/ui.navigation-tab/config.ts +3 -1
- package/ui.navigation-tab/useAttrs.ts +4 -18
- package/ui.navigation-tabs/useAttrs.ts +2 -8
- package/ui.other-dot/useAttrs.ts +2 -8
- package/ui.text-alert/UAlert.vue +2 -1
- package/ui.text-alert/useAttrs.ts +2 -8
- package/ui.text-badge/useAttrs.ts +3 -8
- package/ui.text-block/UText.vue +2 -1
- package/ui.text-block/useAttrs.ts +2 -8
- package/ui.text-empty/useAttrs.ts +2 -8
- package/ui.text-file/useAttrs.ts +2 -8
- package/ui.text-files/useAttrs.ts +2 -8
- package/ui.text-header/useAttrs.ts +2 -8
- package/ui.text-money/UMoney.vue +1 -1
- package/ui.text-money/useAttrs.ts +2 -8
- package/ui.text-notify/useAttrs.ts +2 -8
- package/utils/helper.ts +29 -0
- package/utils/ui.ts +0 -2
- package/web-types.json +17 -1
- package/ui.button/useAttrs.ts +0 -26
|
@@ -1,36 +1,26 @@
|
|
|
1
|
-
import { computed
|
|
1
|
+
import { computed } from "vue";
|
|
2
2
|
import useUI from "../composables/useUI.ts";
|
|
3
3
|
|
|
4
4
|
import defaultConfig from "./config.ts";
|
|
5
5
|
|
|
6
|
+
import type { Ref } from "vue";
|
|
6
7
|
import type { Config, UDropdownLinkProps } from "./types.ts";
|
|
7
8
|
import type { UseAttrs } from "../types.ts";
|
|
8
9
|
|
|
9
|
-
interface
|
|
10
|
+
interface ComponentState {
|
|
10
11
|
isShownOptions: Ref<boolean>;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export default function useAttrs(
|
|
14
15
|
props: UDropdownLinkProps,
|
|
15
|
-
{ isShownOptions }:
|
|
16
|
+
{ isShownOptions }: ComponentState,
|
|
16
17
|
): UseAttrs<Config> {
|
|
17
|
-
const { config, getKeysAttrs
|
|
18
|
-
defaultConfig,
|
|
19
|
-
() => props.config,
|
|
20
|
-
);
|
|
18
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
21
19
|
|
|
22
|
-
const
|
|
23
|
-
|
|
20
|
+
const mutatedProps = computed(() => ({
|
|
21
|
+
/* component state, not a props */
|
|
22
|
+
opened: isShownOptions.value,
|
|
23
|
+
}));
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
wrapper: {
|
|
27
|
-
extend: computed(() => [isShownOptions.value && extendingKeysClasses.wrapperActive.value]),
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
config,
|
|
33
|
-
...keysAttrs,
|
|
34
|
-
hasSlotContent,
|
|
35
|
-
};
|
|
25
|
+
return { config, ...getKeysAttrs(mutatedProps) };
|
|
36
26
|
}
|
|
@@ -39,12 +39,13 @@ export default /*tw*/ {
|
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
41
|
group: `
|
|
42
|
+
{>groupBase}
|
|
42
43
|
border-t border-gray-100 group-first/item:border-none
|
|
43
44
|
mt-1.5 group-first/item:mt-0
|
|
44
45
|
pt-4 group-first/item:pt-2
|
|
45
46
|
`,
|
|
46
|
-
subGroup: "pt-2",
|
|
47
|
-
addOptionLabelWrapper: "-mb-[1.375rem] active:bg-brand-100",
|
|
47
|
+
subGroup: "{>groupBase} pt-2",
|
|
48
|
+
addOptionLabelWrapper: "{>option} -mb-[1.375rem] active:bg-brand-100",
|
|
48
49
|
addOptionLabel: "leading-none font-medium",
|
|
49
50
|
addOptionLabelHotkey: "text-gray-500",
|
|
50
51
|
addOptionButton: "{UButton} !leading-none sticky left-[calc(100%-2.15rem)] bottom-2 p-1",
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { computed } from "vue";
|
|
2
1
|
import useUI from "../composables/useUI.ts";
|
|
3
2
|
|
|
4
3
|
import defaultConfig from "./config.ts";
|
|
@@ -7,29 +6,7 @@ import type { Config, UDropdownListProps } from "./types.ts";
|
|
|
7
6
|
import type { UseAttrs } from "../types.ts";
|
|
8
7
|
|
|
9
8
|
export default function useAttrs(props: UDropdownListProps): UseAttrs<Config> {
|
|
10
|
-
const { config, getKeysAttrs
|
|
11
|
-
defaultConfig,
|
|
12
|
-
() => props.config,
|
|
13
|
-
);
|
|
9
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
const extendingKeysClasses = getExtendingKeysClasses(extendingKeys);
|
|
17
|
-
|
|
18
|
-
const keysAttrs = getKeysAttrs({}, [], {
|
|
19
|
-
addOptionLabelWrapper: {
|
|
20
|
-
base: computed(() => [extendingKeysClasses.option.value]),
|
|
21
|
-
},
|
|
22
|
-
group: {
|
|
23
|
-
base: computed(() => [extendingKeysClasses.groupBase.value]),
|
|
24
|
-
},
|
|
25
|
-
subGroup: {
|
|
26
|
-
base: computed(() => [extendingKeysClasses.groupBase.value]),
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
return {
|
|
31
|
-
config,
|
|
32
|
-
...keysAttrs,
|
|
33
|
-
hasSlotContent,
|
|
34
|
-
};
|
|
11
|
+
return { config, ...getKeysAttrs() };
|
|
35
12
|
}
|
|
@@ -6,13 +6,7 @@ import type { UseAttrs } from "../types.ts";
|
|
|
6
6
|
import type { UCalendarProps, Config } from "./types.ts";
|
|
7
7
|
|
|
8
8
|
export default function useAttrs(props: UCalendarProps<unknown>): UseAttrs<Config> {
|
|
9
|
-
const { config, getKeysAttrs
|
|
9
|
+
const { config, getKeysAttrs } = useUI<Config>(defaultConfig, () => props.config);
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return {
|
|
14
|
-
config,
|
|
15
|
-
...keysAttrs,
|
|
16
|
-
hasSlotContent,
|
|
17
|
-
};
|
|
11
|
+
return { config, ...getKeysAttrs() };
|
|
18
12
|
}
|
|
@@ -16,7 +16,7 @@ export default function useAttrs(
|
|
|
16
16
|
props: UCheckboxProps,
|
|
17
17
|
{ checkboxColor, checkboxSize }: ComponentState,
|
|
18
18
|
): UseAttrs<Config> {
|
|
19
|
-
const { config, getKeysAttrs
|
|
19
|
+
const { config, getKeysAttrs } = useUI<Config>(defaultConfig, () => props.config);
|
|
20
20
|
|
|
21
21
|
const mutatedProps = computed(() => ({
|
|
22
22
|
color: checkboxColor.value,
|
|
@@ -25,11 +25,5 @@ export default function useAttrs(
|
|
|
25
25
|
error: Boolean(props.error),
|
|
26
26
|
}));
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return {
|
|
31
|
-
config,
|
|
32
|
-
...keysAttrs,
|
|
33
|
-
hasSlotContent,
|
|
34
|
-
};
|
|
28
|
+
return { config, ...getKeysAttrs(mutatedProps) };
|
|
35
29
|
}
|
|
@@ -6,13 +6,7 @@ import type { UseAttrs } from "../types.ts";
|
|
|
6
6
|
import type { UCheckboxGroupProps, Config } from "./types.ts";
|
|
7
7
|
|
|
8
8
|
export default function useAttrs(props: UCheckboxGroupProps): UseAttrs<Config> {
|
|
9
|
-
const { config, getKeysAttrs
|
|
9
|
+
const { config, getKeysAttrs } = useUI<Config>(defaultConfig, () => props.config);
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return {
|
|
14
|
-
config,
|
|
15
|
-
...keysAttrs,
|
|
16
|
-
hasSlotContent,
|
|
17
|
-
};
|
|
11
|
+
return { config, ...getKeysAttrs() };
|
|
18
12
|
}
|
|
@@ -15,7 +15,7 @@ export default function useAttrs(
|
|
|
15
15
|
props: UCheckboxMultiStateProps,
|
|
16
16
|
{ selected }: ComponentState,
|
|
17
17
|
): UseAttrs<Config> {
|
|
18
|
-
const { config, getKeysAttrs
|
|
18
|
+
const { config, getKeysAttrs } = useUI<Config>(defaultConfig, () => props.config);
|
|
19
19
|
const keysAttrs = getKeysAttrs();
|
|
20
20
|
|
|
21
21
|
const checkboxAttrs = keysAttrs.multiStateCheckboxAttrs as Ref<{
|
|
@@ -33,9 +33,5 @@ export default function useAttrs(
|
|
|
33
33
|
return checkboxAttrs.value;
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
-
return {
|
|
37
|
-
config,
|
|
38
|
-
...keysAttrs,
|
|
39
|
-
hasSlotContent,
|
|
40
|
-
};
|
|
36
|
+
return { config, ...keysAttrs };
|
|
41
37
|
}
|
|
@@ -3,13 +3,7 @@ import useUI from "../composables/useUI.ts";
|
|
|
3
3
|
import defaultConfig from "./config.js";
|
|
4
4
|
|
|
5
5
|
export default function useAttrs(props) {
|
|
6
|
-
const { config, getKeysAttrs
|
|
6
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
config,
|
|
12
|
-
...keysAttrs,
|
|
13
|
-
hasSlotContent,
|
|
14
|
-
};
|
|
8
|
+
return { config, ...getKeysAttrs() };
|
|
15
9
|
}
|
|
@@ -18,7 +18,7 @@ export default function useAttrs(
|
|
|
18
18
|
props: UDatePickerProps<unknown>,
|
|
19
19
|
{ isTop, isRight }: ComponentState,
|
|
20
20
|
): UseAttrs<Config> {
|
|
21
|
-
const { config, getKeysAttrs
|
|
21
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
22
22
|
|
|
23
23
|
const mutatedProps = computed(() => ({
|
|
24
24
|
openDirectionY: isTop.value ? Direction.Top : Direction.Bottom,
|
|
@@ -39,9 +39,5 @@ export default function useAttrs(
|
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
return {
|
|
43
|
-
config,
|
|
44
|
-
...keysAttrs,
|
|
45
|
-
hasSlotContent,
|
|
46
|
-
};
|
|
42
|
+
return { config, ...keysAttrs };
|
|
47
43
|
}
|
|
@@ -130,34 +130,6 @@ const isPeriod = computed(() => {
|
|
|
130
130
|
|
|
131
131
|
const elementId = props.id || useId();
|
|
132
132
|
|
|
133
|
-
const {
|
|
134
|
-
config,
|
|
135
|
-
wrapperAttrs,
|
|
136
|
-
calendarAttrs,
|
|
137
|
-
datepickerInputAttrs,
|
|
138
|
-
menuAttrs,
|
|
139
|
-
buttonWrapperAttrs,
|
|
140
|
-
buttonAttrs,
|
|
141
|
-
shiftRangeButtonAttrs,
|
|
142
|
-
rangeInputWrapperAttrs,
|
|
143
|
-
rangeInputErrorAttrs,
|
|
144
|
-
datepickerActiveInputAttrs,
|
|
145
|
-
rangeInputFirstAttrs,
|
|
146
|
-
rangeInputLastAttrs,
|
|
147
|
-
periodRowAttrs,
|
|
148
|
-
periodButtonAttrs,
|
|
149
|
-
periodButtonActiveAttrs,
|
|
150
|
-
periodDateAttrs,
|
|
151
|
-
periodDateCurrentAttrs,
|
|
152
|
-
periodDateSelectedAttrs,
|
|
153
|
-
periodDateCurrentSelectedAttrs,
|
|
154
|
-
periodDateListAttrs,
|
|
155
|
-
rangeSwitchButtonAttrs,
|
|
156
|
-
rangeSwitchTitleAttrs,
|
|
157
|
-
rangeSwitchWrapperAttrs,
|
|
158
|
-
customRangeDescriptionAttrs,
|
|
159
|
-
} = useAttrs(props, { isShownMenu, isTop, isRight, isPeriod });
|
|
160
|
-
|
|
161
133
|
const calendarValue = ref(props.modelValue);
|
|
162
134
|
const activeDate: Ref<string | Date | null> = ref(
|
|
163
135
|
props.modelValue.from !== null
|
|
@@ -249,6 +221,34 @@ const clickOutsideOptions = computed(() => {
|
|
|
249
221
|
};
|
|
250
222
|
});
|
|
251
223
|
|
|
224
|
+
const {
|
|
225
|
+
config,
|
|
226
|
+
wrapperAttrs,
|
|
227
|
+
calendarAttrs,
|
|
228
|
+
datepickerInputAttrs,
|
|
229
|
+
menuAttrs,
|
|
230
|
+
buttonWrapperAttrs,
|
|
231
|
+
buttonAttrs,
|
|
232
|
+
shiftRangeButtonAttrs,
|
|
233
|
+
rangeInputWrapperAttrs,
|
|
234
|
+
rangeInputErrorAttrs,
|
|
235
|
+
datepickerActiveInputAttrs,
|
|
236
|
+
rangeInputFirstAttrs,
|
|
237
|
+
rangeInputLastAttrs,
|
|
238
|
+
periodRowAttrs,
|
|
239
|
+
periodButtonAttrs,
|
|
240
|
+
periodButtonActiveAttrs,
|
|
241
|
+
periodDateAttrs,
|
|
242
|
+
periodDateCurrentAttrs,
|
|
243
|
+
periodDateSelectedAttrs,
|
|
244
|
+
periodDateCurrentSelectedAttrs,
|
|
245
|
+
periodDateListAttrs,
|
|
246
|
+
rangeSwitchButtonAttrs,
|
|
247
|
+
rangeSwitchTitleAttrs,
|
|
248
|
+
rangeSwitchWrapperAttrs,
|
|
249
|
+
customRangeDescriptionAttrs,
|
|
250
|
+
} = useAttrs(props, { isShownMenu, isTop, isRight, isPeriod });
|
|
251
|
+
|
|
252
252
|
const { userFormatDate } = useUserFormat(
|
|
253
253
|
localValue,
|
|
254
254
|
userFormatLocale,
|
|
@@ -12,13 +12,21 @@ export default /*tw*/ {
|
|
|
12
12
|
},
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
|
-
buttonWrapper:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
buttonWrapper: {
|
|
16
|
+
base: `
|
|
17
|
+
flex rounded-dynamic max-md:justify-between
|
|
18
|
+
focus-within:ring-dynamic focus-within:ring-offset-dynamic focus-within:ring-brand-700/15
|
|
19
|
+
`,
|
|
20
|
+
variants: {
|
|
21
|
+
opened: {
|
|
22
|
+
true: "ring-dynamic ring-offset-dynamic ring-brand-700/15",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
button: {
|
|
27
|
+
component: "{UButton}",
|
|
28
|
+
base: "shrink-0 grow rounded-none",
|
|
29
|
+
},
|
|
22
30
|
shiftRangeButton: `
|
|
23
31
|
first:rounded-dynamic first:rounded-r-none
|
|
24
32
|
last:rounded-dynamic last:rounded-l-none
|
|
@@ -57,19 +65,25 @@ export default /*tw*/ {
|
|
|
57
65
|
},
|
|
58
66
|
periodRow: "mb-1 flex min-w-64 gap-1",
|
|
59
67
|
periodButton: "{UButton} h-[3.125rem] w-full",
|
|
60
|
-
periodButtonActive: "!bg-gray-800/20",
|
|
68
|
+
periodButtonActive: "{>periodButton} !bg-gray-800/20",
|
|
61
69
|
rangeSwitchWrapper: "flex items-center justify-between py-2",
|
|
62
70
|
rangeSwitchButton: "{UButton}",
|
|
63
71
|
rangeSwitchTitle: "font-medium text-sm",
|
|
64
|
-
periodDateList:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
periodDateList: {
|
|
73
|
+
base: "grid grid-rows-1 gap-0.5",
|
|
74
|
+
variants: {
|
|
75
|
+
month: {
|
|
76
|
+
true: "grid-cols-3",
|
|
77
|
+
},
|
|
78
|
+
year: {
|
|
79
|
+
true: "grid-cols-3",
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
69
83
|
periodDate: "w-full",
|
|
70
|
-
periodDateSelected: "",
|
|
71
|
-
periodDateCurrent: "border-2 border-brand-600",
|
|
72
|
-
periodDateCurrentSelected: "",
|
|
84
|
+
periodDateSelected: "{>periodDate}",
|
|
85
|
+
periodDateCurrent: "{>periodDate} border-2 border-brand-600",
|
|
86
|
+
periodDateCurrentSelected: "{>periodDate} {>periodDateSelected} {>periodDateCurrent}",
|
|
73
87
|
customRangeDescription: "",
|
|
74
88
|
rangeInputWrapper: "flex mt-4 -space-x-px group/range-input-wrapper",
|
|
75
89
|
rangeInputFirst: {
|
|
@@ -22,79 +22,22 @@ export default function useAttrs(
|
|
|
22
22
|
props: UDatePickerRangeProps<unknown>,
|
|
23
23
|
{ isShownMenu, isTop, isRight, isPeriod }: DatePickerRangeState,
|
|
24
24
|
): UseAttrs<Config> {
|
|
25
|
-
const { config, getKeysAttrs
|
|
26
|
-
defaultConfig,
|
|
27
|
-
() => props.config,
|
|
28
|
-
);
|
|
25
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
29
26
|
|
|
30
27
|
const mutatedProps = computed(() => ({
|
|
31
28
|
openDirectionY: isTop.value ? Direction.Top : Direction.Bottom,
|
|
32
29
|
openDirectionX: isRight.value ? Direction.Right : Direction.Left,
|
|
33
30
|
error: Boolean(props.error),
|
|
34
31
|
description: Boolean(props.description),
|
|
32
|
+
/* component state, not a props */
|
|
33
|
+
opened: isShownMenu.value,
|
|
34
|
+
week: isPeriod.value.week,
|
|
35
|
+
month: isPeriod.value.month,
|
|
36
|
+
quarter: isPeriod.value.quarter,
|
|
37
|
+
year: isPeriod.value.year,
|
|
35
38
|
}));
|
|
36
39
|
|
|
37
|
-
const
|
|
38
|
-
const extendingKeysClasses = getExtendingKeysClasses(
|
|
39
|
-
[
|
|
40
|
-
...extendingKeys,
|
|
41
|
-
"periodButton",
|
|
42
|
-
"periodDateList",
|
|
43
|
-
"periodDate",
|
|
44
|
-
"periodDateWeekList",
|
|
45
|
-
"periodDateQuarterList",
|
|
46
|
-
"periodDateYearList",
|
|
47
|
-
"periodDateSelected",
|
|
48
|
-
"periodDateCurrent",
|
|
49
|
-
],
|
|
50
|
-
mutatedProps,
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
// TODO: Declare types for getKeysAttrs return value, this could be implemented using generic;
|
|
54
|
-
const keysAttrs = getKeysAttrs(mutatedProps, extendingKeys, {
|
|
55
|
-
buttonWrapper: {
|
|
56
|
-
extend: computed(() => [isShownMenu.value && extendingKeysClasses.buttonWrapperActive.value]),
|
|
57
|
-
},
|
|
58
|
-
button: {
|
|
59
|
-
extend: computed(() => [isShownMenu.value && extendingKeysClasses.buttonActive.value]),
|
|
60
|
-
},
|
|
61
|
-
periodDateList: {
|
|
62
|
-
extend: computed(() => [
|
|
63
|
-
isPeriod.value.week && extendingKeysClasses.periodDateWeekList.value,
|
|
64
|
-
isPeriod.value.month && extendingKeysClasses.periodDateMonthList.value,
|
|
65
|
-
isPeriod.value.quarter && extendingKeysClasses.periodDateQuarterList.value,
|
|
66
|
-
isPeriod.value.year && extendingKeysClasses.periodDateYearList.value,
|
|
67
|
-
]),
|
|
68
|
-
},
|
|
69
|
-
periodButtonActive: {
|
|
70
|
-
base: computed(() => [extendingKeysClasses.periodButton.value]),
|
|
71
|
-
},
|
|
72
|
-
periodDateWeekList: {
|
|
73
|
-
base: computed(() => [extendingKeysClasses.periodDateList.value]),
|
|
74
|
-
},
|
|
75
|
-
periodDateQuarterList: {
|
|
76
|
-
base: computed(() => [extendingKeysClasses.periodDateList.value]),
|
|
77
|
-
},
|
|
78
|
-
periodDateYearList: {
|
|
79
|
-
base: computed(() => [extendingKeysClasses.periodDateList.value]),
|
|
80
|
-
},
|
|
81
|
-
periodDateSelected: {
|
|
82
|
-
base: computed(() => [extendingKeysClasses.periodDate.value]),
|
|
83
|
-
},
|
|
84
|
-
periodDateCurrent: {
|
|
85
|
-
base: computed(() => [
|
|
86
|
-
extendingKeysClasses.periodDate.value,
|
|
87
|
-
extendingKeysClasses.periodDateCurrent.value,
|
|
88
|
-
]),
|
|
89
|
-
},
|
|
90
|
-
periodDateCurrentSelected: {
|
|
91
|
-
base: computed(() => [
|
|
92
|
-
extendingKeysClasses.periodDate.value,
|
|
93
|
-
extendingKeysClasses.periodDateSelected.value,
|
|
94
|
-
extendingKeysClasses.periodDateCurrent.value,
|
|
95
|
-
]),
|
|
96
|
-
},
|
|
97
|
-
});
|
|
40
|
+
const keysAttrs = getKeysAttrs(mutatedProps);
|
|
98
41
|
|
|
99
42
|
/* Merging DatePickerRange's i18n translations into Calendar's i18n translations. */
|
|
100
43
|
watchEffect(() => {
|
|
@@ -106,9 +49,5 @@ export default function useAttrs(
|
|
|
106
49
|
}
|
|
107
50
|
});
|
|
108
51
|
|
|
109
|
-
return {
|
|
110
|
-
config,
|
|
111
|
-
...keysAttrs,
|
|
112
|
-
hasSlotContent,
|
|
113
|
-
};
|
|
52
|
+
return { config, ...keysAttrs };
|
|
114
53
|
}
|
package/ui.form-input/UInput.vue
CHANGED
|
@@ -113,6 +113,7 @@ const VALIDATION_RULES_REG_EX = {
|
|
|
113
113
|
<script setup>
|
|
114
114
|
import { ref, computed, onMounted, useSlots, useId } from "vue";
|
|
115
115
|
|
|
116
|
+
import { hasSlotContent } from "../utils/helper.ts";
|
|
116
117
|
import { useMutationObserver } from "../composables/useMutationObserver.ts";
|
|
117
118
|
|
|
118
119
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
@@ -358,7 +359,6 @@ const {
|
|
|
358
359
|
leftIconAttrs,
|
|
359
360
|
rightIconAttrs,
|
|
360
361
|
rightIconWrapperAttrs,
|
|
361
|
-
hasSlotContent,
|
|
362
362
|
} = useAttrs(props, { isTypePassword, inputPasswordClasses });
|
|
363
363
|
|
|
364
364
|
const iconSize = computed(() => {
|
|
@@ -4,18 +4,12 @@ import useUI from "../composables/useUI.ts";
|
|
|
4
4
|
import defaultConfig from "./config.js";
|
|
5
5
|
|
|
6
6
|
export default function useAttrs(props) {
|
|
7
|
-
const { config, getKeysAttrs
|
|
7
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
8
8
|
|
|
9
9
|
const mutatedProps = computed(() => ({
|
|
10
10
|
error: Boolean(props.error),
|
|
11
11
|
label: Boolean(props.label),
|
|
12
12
|
}));
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
config,
|
|
18
|
-
...keysAttrs,
|
|
19
|
-
hasSlotContent,
|
|
20
|
-
};
|
|
14
|
+
return { config, ...getKeysAttrs(mutatedProps) };
|
|
21
15
|
}
|
|
@@ -96,11 +96,11 @@ import UButton from "../ui.button/UButton.vue";
|
|
|
96
96
|
import UFiles from "../ui.text-files/UFiles.vue";
|
|
97
97
|
|
|
98
98
|
import { getDefault } from "../utils/ui.ts";
|
|
99
|
-
import {
|
|
100
|
-
|
|
101
|
-
import useAttrs from "./useAttrs.js";
|
|
99
|
+
import { hasSlotContent } from "../utils/helper.ts";
|
|
102
100
|
import { useLocale } from "../composables/useLocale.ts";
|
|
103
101
|
|
|
102
|
+
import useAttrs from "./useAttrs.js";
|
|
103
|
+
import { getFileMbSize } from "./utilFileForm.js";
|
|
104
104
|
import { UInputFile } from "./constants.js";
|
|
105
105
|
import defaultConfig from "./config.js";
|
|
106
106
|
|
|
@@ -247,7 +247,6 @@ const {
|
|
|
247
247
|
inputAttrs,
|
|
248
248
|
fileListAttrs,
|
|
249
249
|
buttonsAttrs,
|
|
250
|
-
hasSlotContent,
|
|
251
250
|
} = useAttrs(props);
|
|
252
251
|
|
|
253
252
|
const i18nGlobal = tm(UInputFile);
|
|
@@ -4,18 +4,12 @@ import useUI from "../composables/useUI.ts";
|
|
|
4
4
|
import defaultConfig from "./config.js";
|
|
5
5
|
|
|
6
6
|
export default function useAttrs(props) {
|
|
7
|
-
const { config, getKeysAttrs
|
|
7
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
8
8
|
|
|
9
9
|
const mutatedProps = computed(() => ({
|
|
10
10
|
error: Boolean(props.error),
|
|
11
11
|
label: Boolean(props.label),
|
|
12
12
|
}));
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
config,
|
|
18
|
-
...keysAttrs,
|
|
19
|
-
hasSlotContent,
|
|
20
|
-
};
|
|
14
|
+
return { config, ...getKeysAttrs(mutatedProps) };
|
|
21
15
|
}
|
|
@@ -3,13 +3,7 @@ import useUI from "../composables/useUI.ts";
|
|
|
3
3
|
import defaultConfig from "./config.js";
|
|
4
4
|
|
|
5
5
|
export default function useAttrs(props) {
|
|
6
|
-
const { config, getKeysAttrs
|
|
6
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
config,
|
|
12
|
-
...keysAttrs,
|
|
13
|
-
hasSlotContent,
|
|
14
|
-
};
|
|
8
|
+
return { config, ...getKeysAttrs() };
|
|
15
9
|
}
|
|
@@ -3,13 +3,7 @@ import useUI from "../composables/useUI.ts";
|
|
|
3
3
|
import defaultConfig from "./config.js";
|
|
4
4
|
|
|
5
5
|
export default function useAttrs(props) {
|
|
6
|
-
const { config, getKeysAttrs
|
|
6
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
config,
|
|
12
|
-
...keysAttrs,
|
|
13
|
-
hasSlotContent,
|
|
14
|
-
};
|
|
8
|
+
return { config, ...getKeysAttrs() };
|
|
15
9
|
}
|
|
@@ -54,9 +54,11 @@
|
|
|
54
54
|
<script setup>
|
|
55
55
|
import { computed, ref } from "vue";
|
|
56
56
|
|
|
57
|
+
import { getDefault } from "../utils/ui.ts";
|
|
58
|
+
import { hasSlotContent } from "../utils/helper.ts";
|
|
59
|
+
|
|
57
60
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
58
61
|
import ULabel from "../ui.form-label/ULabel.vue";
|
|
59
|
-
import { getDefault } from "../utils/ui.ts";
|
|
60
62
|
|
|
61
63
|
import { UInputRating } from "./constants.js";
|
|
62
64
|
import defaultConfig from "./config.js";
|
|
@@ -174,16 +176,8 @@ const emit = defineEmits([
|
|
|
174
176
|
|
|
175
177
|
const hovered = ref(null);
|
|
176
178
|
|
|
177
|
-
const {
|
|
178
|
-
|
|
179
|
-
inputLabelAttrs,
|
|
180
|
-
containerAttrs,
|
|
181
|
-
counterAttrs,
|
|
182
|
-
totalAttrs,
|
|
183
|
-
starsAttrs,
|
|
184
|
-
starAttrs,
|
|
185
|
-
hasSlotContent,
|
|
186
|
-
} = useAttrs(props);
|
|
179
|
+
const { config, inputLabelAttrs, containerAttrs, counterAttrs, totalAttrs, starsAttrs, starAttrs } =
|
|
180
|
+
useAttrs(props);
|
|
187
181
|
|
|
188
182
|
const iconSize = computed(() => {
|
|
189
183
|
const sizes = {
|
|
@@ -2,13 +2,7 @@ import useUI from "../composables/useUI.ts";
|
|
|
2
2
|
import defaultConfig from "./config.js";
|
|
3
3
|
|
|
4
4
|
export default function useAttrs(props) {
|
|
5
|
-
const { config, getKeysAttrs
|
|
5
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return {
|
|
10
|
-
config,
|
|
11
|
-
...keysAttrs,
|
|
12
|
-
hasSlotContent,
|
|
13
|
-
};
|
|
7
|
+
return { config, ...getKeysAttrs() };
|
|
14
8
|
}
|
|
@@ -3,13 +3,7 @@ import useUI from "../composables/useUI.ts";
|
|
|
3
3
|
import defaultConfig from "./config.js";
|
|
4
4
|
|
|
5
5
|
export default function useAttrs(props) {
|
|
6
|
-
const { config, getKeysAttrs
|
|
6
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
config,
|
|
12
|
-
...keysAttrs,
|
|
13
|
-
hasSlotContent,
|
|
14
|
-
};
|
|
8
|
+
return { config, ...getKeysAttrs() };
|
|
15
9
|
}
|
|
@@ -4,17 +4,11 @@ import useUI from "../composables/useUI.ts";
|
|
|
4
4
|
import defaultConfig from "./config.js";
|
|
5
5
|
|
|
6
6
|
export default function useAttrs(props) {
|
|
7
|
-
const { config, getKeysAttrs
|
|
7
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
8
8
|
|
|
9
9
|
const mutatedProps = computed(() => ({
|
|
10
10
|
error: Boolean(props.error),
|
|
11
11
|
}));
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return {
|
|
16
|
-
config,
|
|
17
|
-
...keysAttrs,
|
|
18
|
-
hasSlotContent,
|
|
19
|
-
};
|
|
13
|
+
return { config, ...getKeysAttrs(mutatedProps) };
|
|
20
14
|
}
|
|
@@ -16,7 +16,7 @@ export default function useAttrs(
|
|
|
16
16
|
props: URadioProps,
|
|
17
17
|
{ radioColor, radioSize }: ComponentState,
|
|
18
18
|
): UseAttrs<Config> {
|
|
19
|
-
const { config, getKeysAttrs
|
|
19
|
+
const { config, getKeysAttrs } = useUI<Config>(defaultConfig, () => props.config);
|
|
20
20
|
|
|
21
21
|
const mutatedProps = computed(() => ({
|
|
22
22
|
color: radioColor.value,
|
|
@@ -25,11 +25,5 @@ export default function useAttrs(
|
|
|
25
25
|
error: Boolean(props.error),
|
|
26
26
|
}));
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return {
|
|
31
|
-
config,
|
|
32
|
-
...keysAttrs,
|
|
33
|
-
hasSlotContent,
|
|
34
|
-
};
|
|
28
|
+
return { config, ...getKeysAttrs(mutatedProps) };
|
|
35
29
|
}
|