vueless 0.0.178 → 0.0.180
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.data-table/configs/default.config.js +2 -2
- package/ui.form-calendar/components/DayView.vue +6 -6
- package/ui.form-calendar/components/MonthView.vue +9 -5
- package/ui.form-calendar/components/YearView.vue +8 -4
- package/ui.form-calendar/composables/attrs.composable.js +23 -18
- package/ui.form-calendar/configs/default.config.js +12 -17
- package/ui.form-calendar/index.vue +4 -4
- package/ui.form-checkbox-group/configs/default.config.js +2 -0
- package/ui.form-checkbox-group/index.vue +39 -22
- package/ui.form-color-picker/composables/attrs.composable.js +19 -14
- package/ui.form-color-picker/configs/default.config.js +21 -15
- package/ui.form-color-picker/index.stories.js +1 -1
- package/ui.form-color-picker/index.vue +78 -59
- package/ui.form-date-picker/index.vue +4 -3
- package/ui.form-date-picker-range/index.vue +16 -4
- package/ui.form-input/index.stories.js +15 -5
- package/ui.form-input/index.vue +56 -28
- package/ui.form-radio/index.stories.js +4 -4
- package/ui.form-radio/index.vue +8 -4
- package/ui.form-radio-group/composables/attrs.composable.js +2 -0
- package/ui.form-radio-group/configs/default.config.js +3 -3
- package/ui.form-radio-group/index.stories.js +3 -3
- package/ui.form-radio-group/index.vue +29 -8
- package/ui.loader-top/Docs.mdx +8 -10
- package/ui.loader-top/composables/useLoaderTop.js +22 -11
- package/ui.loader-top/index.vue +17 -35
- package/ui.loader-top/services/loaderTop.service.js +6 -0
- package/ui.navigation-progress/composables/attrs.composable.js +38 -2
- package/ui.navigation-progress/configs/default.config.js +32 -0
- package/ui.navigation-progress/index.stories.js +127 -2
- package/ui.navigation-progress/index.vue +53 -5
- package/ui.text-alert/configs/default.config.js +7 -7
- package/ui.text-block/composables/attrs.composable.js +2 -0
- package/ui.text-block/configs/default.config.js +7 -7
- package/ui.text-block/index.stories.js +16 -16
- package/ui.text-block/index.vue +4 -4
- package/web-types.json +111 -45
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
>
|
|
13
|
-
<div v-bind="
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/>
|
|
2
|
+
<ULabel
|
|
3
|
+
:label="label"
|
|
4
|
+
:description="description"
|
|
5
|
+
:disabled="disabled"
|
|
6
|
+
:error="error"
|
|
7
|
+
:size="size"
|
|
8
|
+
align="topWithDesc"
|
|
9
|
+
:data-cy="dataCy"
|
|
10
|
+
v-bind="labelAttrs"
|
|
11
|
+
>
|
|
12
|
+
<div v-bind="listAttrs">
|
|
13
|
+
<div v-bind="unselectedAttrs">
|
|
14
|
+
<URadio
|
|
15
|
+
:id="id"
|
|
16
|
+
:name="name"
|
|
17
|
+
:size="size"
|
|
18
|
+
color="grayscale"
|
|
19
|
+
:checked="selectedItem === ''"
|
|
20
|
+
:disabled="disabled"
|
|
21
|
+
v-bind="unselectedRadioAttrs"
|
|
22
|
+
@update:model-value="onUpdateValue('')"
|
|
23
|
+
/>
|
|
25
24
|
|
|
25
|
+
<label :for="id">
|
|
26
26
|
<UIcon
|
|
27
27
|
v-if="selectedItem === ''"
|
|
28
28
|
internal
|
|
29
|
+
:size="iconSize"
|
|
29
30
|
color="gray"
|
|
30
|
-
:name="config.
|
|
31
|
-
v-bind="
|
|
32
|
-
size="sm"
|
|
31
|
+
:name="config.unselectedIconName"
|
|
32
|
+
v-bind="unselectedIconAttrs"
|
|
33
33
|
/>
|
|
34
|
-
</
|
|
35
|
-
|
|
36
|
-
<URadio
|
|
37
|
-
v-for="(color, index) in colorOptions"
|
|
38
|
-
:key="index"
|
|
39
|
-
:name="name"
|
|
40
|
-
:value="color"
|
|
41
|
-
:checked="selectedItem === color"
|
|
42
|
-
:color="color"
|
|
43
|
-
:disabled="disabled"
|
|
44
|
-
:size="size"
|
|
45
|
-
v-bind="radioAttrs"
|
|
46
|
-
@update:value="onInputRadio(color)"
|
|
47
|
-
/>
|
|
34
|
+
</label>
|
|
48
35
|
</div>
|
|
49
|
-
|
|
50
|
-
|
|
36
|
+
|
|
37
|
+
<URadio
|
|
38
|
+
v-for="(color, index) in colorOptions"
|
|
39
|
+
:key="index"
|
|
40
|
+
:name="name"
|
|
41
|
+
:size="size"
|
|
42
|
+
:value="color"
|
|
43
|
+
:color="color"
|
|
44
|
+
:checked="selectedItem === color"
|
|
45
|
+
:disabled="disabled"
|
|
46
|
+
v-bind="radioAttrs"
|
|
47
|
+
@update:model-value="onUpdateValue(color)"
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
</ULabel>
|
|
51
51
|
</template>
|
|
52
52
|
|
|
53
53
|
<script setup>
|
|
@@ -56,7 +56,7 @@ import { computed } from "vue";
|
|
|
56
56
|
import UIcon from "../ui.image-icon";
|
|
57
57
|
import URadio from "../ui.form-radio";
|
|
58
58
|
import ULabel from "../ui.form-label";
|
|
59
|
-
import UIService from "../service.ui";
|
|
59
|
+
import UIService, { getRandomId } from "../service.ui";
|
|
60
60
|
|
|
61
61
|
import { UColorPicker } from "./constants";
|
|
62
62
|
import defaultConfig from "./configs/default.config";
|
|
@@ -75,11 +75,11 @@ const props = defineProps({
|
|
|
75
75
|
},
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
|
-
* Color picker
|
|
78
|
+
* Color picker name.
|
|
79
79
|
*/
|
|
80
|
-
|
|
81
|
-
type:
|
|
82
|
-
default:
|
|
80
|
+
name: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: UIService.get(defaultConfig, UColorPicker).default.name,
|
|
83
83
|
},
|
|
84
84
|
|
|
85
85
|
/**
|
|
@@ -108,7 +108,7 @@ const props = defineProps({
|
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
110
|
* Color picker size.
|
|
111
|
-
* @values sm, md, lg
|
|
111
|
+
* @values xs, sm, md, lg, xl
|
|
112
112
|
*/
|
|
113
113
|
size: {
|
|
114
114
|
type: String,
|
|
@@ -116,12 +116,11 @@ const props = defineProps({
|
|
|
116
116
|
},
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
|
-
* Color picker
|
|
119
|
+
* Color picker color list.
|
|
120
120
|
*/
|
|
121
|
-
|
|
122
|
-
type:
|
|
123
|
-
|
|
124
|
-
default: "",
|
|
121
|
+
colorOptions: {
|
|
122
|
+
type: Array,
|
|
123
|
+
default: () => UIService.get(defaultConfig, UColorPicker).default.colorOptions,
|
|
125
124
|
},
|
|
126
125
|
|
|
127
126
|
/**
|
|
@@ -132,6 +131,15 @@ const props = defineProps({
|
|
|
132
131
|
default: UIService.get(defaultConfig, UColorPicker).default.disabled,
|
|
133
132
|
},
|
|
134
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Generates unique element id.
|
|
136
|
+
* @ignore
|
|
137
|
+
*/
|
|
138
|
+
id: {
|
|
139
|
+
type: String,
|
|
140
|
+
default: () => getRandomId(),
|
|
141
|
+
},
|
|
142
|
+
|
|
135
143
|
/**
|
|
136
144
|
* Component ui config object.
|
|
137
145
|
*/
|
|
@@ -153,13 +161,12 @@ const emit = defineEmits(["update:modelValue"]);
|
|
|
153
161
|
|
|
154
162
|
const {
|
|
155
163
|
config,
|
|
156
|
-
wrapperAttrs,
|
|
157
|
-
listAttrs,
|
|
158
164
|
labelAttrs,
|
|
165
|
+
listAttrs,
|
|
159
166
|
radioAttrs,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
167
|
+
unselectedIconAttrs,
|
|
168
|
+
unselectedAttrs,
|
|
169
|
+
unselectedRadioAttrs,
|
|
163
170
|
} = useAttrs(props);
|
|
164
171
|
|
|
165
172
|
const selectedItem = computed({
|
|
@@ -167,7 +174,19 @@ const selectedItem = computed({
|
|
|
167
174
|
set: (value) => emit("update:modelValue", value),
|
|
168
175
|
});
|
|
169
176
|
|
|
170
|
-
|
|
177
|
+
const iconSize = computed(() => {
|
|
178
|
+
const sizes = {
|
|
179
|
+
xs: "3xs",
|
|
180
|
+
sm: "2xs",
|
|
181
|
+
md: "xs",
|
|
182
|
+
lg: "sm",
|
|
183
|
+
xl: "md",
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
return sizes[props.size];
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
function onUpdateValue(value) {
|
|
171
190
|
selectedItem.value = value;
|
|
172
191
|
}
|
|
173
192
|
</script>
|
|
@@ -221,6 +221,8 @@ const STANDARD_USER_FORMAT = "l, j F, Y";
|
|
|
221
221
|
|
|
222
222
|
const { tm } = useLocale();
|
|
223
223
|
|
|
224
|
+
const i18nGlobal = tm(UDatePicker);
|
|
225
|
+
|
|
224
226
|
const isShownCalendar = ref(false);
|
|
225
227
|
const userFormatDate = ref("");
|
|
226
228
|
const formattedDate = ref("");
|
|
@@ -255,6 +257,8 @@ const localValue = computed({
|
|
|
255
257
|
set: (value) => emit("update:modelValue", value),
|
|
256
258
|
});
|
|
257
259
|
|
|
260
|
+
const currentLocale = computed(() => merge(defaultConfig.i18n, i18nGlobal, props.config.i18n));
|
|
261
|
+
|
|
258
262
|
const { config, inputAttrs, calendarAttrs, wrapperAttrs } = useAttrs(props, {
|
|
259
263
|
isShownCalendar,
|
|
260
264
|
isTop,
|
|
@@ -299,9 +303,6 @@ function onBlur(event) {
|
|
|
299
303
|
function formatUserDate(data) {
|
|
300
304
|
if (props.userFormat !== STANDARD_USER_FORMAT) return data;
|
|
301
305
|
|
|
302
|
-
const i18nGlobal = tm(UDatePicker);
|
|
303
|
-
const currentLocale = computed(() => merge(defaultConfig.i18n, i18nGlobal, props.config.i18n));
|
|
304
|
-
|
|
305
306
|
let prefix = "";
|
|
306
307
|
const formattedDate = data.charAt(0).toUpperCase() + data.toLowerCase().slice(1);
|
|
307
308
|
const formattedDateWithoutDay = formattedDate.split(",").slice(1).join("").trim();
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<UInput
|
|
4
4
|
v-if="isVariant.input"
|
|
5
5
|
:id="id"
|
|
6
|
+
ref="inputRef"
|
|
6
7
|
v-model="userFormatDate"
|
|
7
8
|
:label="label"
|
|
8
9
|
:placeholder="placeholder"
|
|
@@ -421,6 +422,7 @@ const rangeInputEndRef = ref(null);
|
|
|
421
422
|
const buttonRef = ref(null);
|
|
422
423
|
const buttonPrevRef = ref(null);
|
|
423
424
|
const buttonNextRef = ref(null);
|
|
425
|
+
const inputRef = ref(null);
|
|
424
426
|
|
|
425
427
|
const { isTop, isRight, adjustPositionY, adjustPositionX } = useAdjustElementPosition(
|
|
426
428
|
wrapperRef,
|
|
@@ -463,10 +465,6 @@ const i18nGlobal = tm(UDatePickerRange);
|
|
|
463
465
|
|
|
464
466
|
const currentLocale = computed(() => merge(defaultConfig.i18n, i18nGlobal, props.config.i18n));
|
|
465
467
|
|
|
466
|
-
const clickOutsideOptions = computed(() => ({
|
|
467
|
-
ignore: [buttonRef.value.buttonRef, buttonPrevRef.value.buttonRef, buttonNextRef.value.buttonRef],
|
|
468
|
-
}));
|
|
469
|
-
|
|
470
468
|
const locale = computed(() => {
|
|
471
469
|
const { months, weekdays } = currentLocale.value;
|
|
472
470
|
|
|
@@ -610,6 +608,20 @@ const isVariant = computed(() => ({
|
|
|
610
608
|
input: props.variant === DATE_PICKER_INPUT_TYPE,
|
|
611
609
|
}));
|
|
612
610
|
|
|
611
|
+
const clickOutsideOptions = computed(() => {
|
|
612
|
+
if (isVariant.value.input) {
|
|
613
|
+
return { ignore: [inputRef.value.input] };
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
return {
|
|
617
|
+
ignore: [
|
|
618
|
+
buttonRef.value.buttonRef,
|
|
619
|
+
buttonPrevRef.value.buttonRef,
|
|
620
|
+
buttonNextRef.value.buttonRef,
|
|
621
|
+
],
|
|
622
|
+
};
|
|
623
|
+
});
|
|
624
|
+
|
|
613
625
|
const userFormatDate = computed(() => {
|
|
614
626
|
if ((!localValue.value.from && !localValue.value.to) || !localValue.value.from) return "";
|
|
615
627
|
|
|
@@ -47,7 +47,7 @@ const SlotTemplate = (args) => ({
|
|
|
47
47
|
template: `
|
|
48
48
|
<UInput v-bind="args"
|
|
49
49
|
>
|
|
50
|
-
${args.slotTemplate}
|
|
50
|
+
${args.slotTemplate || ""}
|
|
51
51
|
</UInput>
|
|
52
52
|
`,
|
|
53
53
|
});
|
|
@@ -150,8 +150,18 @@ sizes.args = {};
|
|
|
150
150
|
export const validationRules = ValidationRuleTemplate.bind({});
|
|
151
151
|
validationRules.args = {};
|
|
152
152
|
|
|
153
|
-
export const
|
|
154
|
-
|
|
153
|
+
export const iconLeft = DefaultTemplate.bind({});
|
|
154
|
+
iconLeft.args = {
|
|
155
|
+
iconLeft: "star",
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export const iconRight = DefaultTemplate.bind({});
|
|
159
|
+
iconRight.args = {
|
|
160
|
+
iconRight: "star",
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export const iconLeftSlot = SlotTemplate.bind({});
|
|
164
|
+
iconLeftSlot.args = {
|
|
155
165
|
slotTemplate: `
|
|
156
166
|
<template #left>
|
|
157
167
|
🥸
|
|
@@ -159,8 +169,8 @@ slotLeft.args = {
|
|
|
159
169
|
`,
|
|
160
170
|
};
|
|
161
171
|
|
|
162
|
-
export const
|
|
163
|
-
|
|
172
|
+
export const iconRightSlot = SlotTemplate.bind({});
|
|
173
|
+
iconRightSlot.args = {
|
|
164
174
|
slotTemplate: `
|
|
165
175
|
<template #right>
|
|
166
176
|
🥸
|
package/ui.form-input/index.vue
CHANGED
|
@@ -11,9 +11,15 @@
|
|
|
11
11
|
v-bind="labelAttrs"
|
|
12
12
|
>
|
|
13
13
|
<label :for="id" v-bind="blockAttrs">
|
|
14
|
-
<span
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
<span
|
|
15
|
+
v-if="hasSlotContent($slots['left']) || iconLeft"
|
|
16
|
+
ref="leftSlotWrapper"
|
|
17
|
+
v-bind="leftSlotAttrs"
|
|
18
|
+
>
|
|
19
|
+
<!-- @slot Use it to add icon before text. -->
|
|
20
|
+
<slot name="left">
|
|
21
|
+
<UIcon v-if="iconLeft" :name="iconLeft" />
|
|
22
|
+
</slot>
|
|
17
23
|
</span>
|
|
18
24
|
|
|
19
25
|
<span v-bind="inputWrapperAttrs">
|
|
@@ -38,30 +44,24 @@
|
|
|
38
44
|
/>
|
|
39
45
|
</span>
|
|
40
46
|
|
|
41
|
-
<label
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
interactive
|
|
53
|
-
internal
|
|
54
|
-
:data-cy="`${dataCy}-show-password`"
|
|
55
|
-
v-bind="passwordIconAttrs"
|
|
56
|
-
@click="onClickShowPassword"
|
|
57
|
-
/>
|
|
58
|
-
</slot>
|
|
47
|
+
<label v-if="isTypePassword" v-bind="rightSlotAttrs" :for="id">
|
|
48
|
+
<UIcon
|
|
49
|
+
v-if="isTypePassword"
|
|
50
|
+
:name="isShownPassword ? config.passwordVisibleIconName : config.passwordHiddenIconName"
|
|
51
|
+
color="gray"
|
|
52
|
+
interactive
|
|
53
|
+
internal
|
|
54
|
+
:data-cy="`${dataCy}-show-password`"
|
|
55
|
+
v-bind="passwordIconAttrs"
|
|
56
|
+
@click="onClickShowPassword"
|
|
57
|
+
/>
|
|
59
58
|
</label>
|
|
60
59
|
|
|
61
|
-
<span v-if="hasSlotContent($slots['right'])" v-bind="rightSlotAttrs">
|
|
62
|
-
<!-- @slot Use it to add
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
<span v-if="hasSlotContent($slots['right']) || iconRight" v-bind="rightSlotAttrs">
|
|
61
|
+
<!-- @slot Use it to add icon after text. -->
|
|
62
|
+
<slot name="right">
|
|
63
|
+
<UIcon v-if="iconRight" :name="iconRight" />
|
|
64
|
+
</slot>
|
|
65
65
|
</span>
|
|
66
66
|
</label>
|
|
67
67
|
</ULabel>
|
|
@@ -247,6 +247,22 @@ const props = defineProps({
|
|
|
247
247
|
type: String,
|
|
248
248
|
default: "",
|
|
249
249
|
},
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Left side icon name.
|
|
253
|
+
*/
|
|
254
|
+
iconLeft: {
|
|
255
|
+
type: String,
|
|
256
|
+
default: "",
|
|
257
|
+
},
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Right side icon name.
|
|
261
|
+
*/
|
|
262
|
+
iconRight: {
|
|
263
|
+
type: String,
|
|
264
|
+
default: "",
|
|
265
|
+
},
|
|
250
266
|
});
|
|
251
267
|
|
|
252
268
|
const slots = useSlots();
|
|
@@ -360,11 +376,23 @@ function transformValue(value, exp) {
|
|
|
360
376
|
}
|
|
361
377
|
|
|
362
378
|
function setLabelPosition() {
|
|
363
|
-
if (props.labelAlign === "top" || !hasSlotContent(slots["left"])) return;
|
|
379
|
+
if (props.labelAlign === "top" || (!hasSlotContent(slots["left"]) && !props.iconLeft)) return;
|
|
380
|
+
|
|
381
|
+
let leftSlotOrIconWidth = 0;
|
|
382
|
+
|
|
383
|
+
if (leftSlotWrapper.value) {
|
|
384
|
+
leftSlotOrIconWidth = leftSlotWrapper.value.getBoundingClientRect().width;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
if (props.iconLeft) {
|
|
388
|
+
const iconLeftElement = document.querySelector(`#${props.id} ~ .ui-icon`);
|
|
364
389
|
|
|
365
|
-
|
|
390
|
+
if (iconLeftElement) {
|
|
391
|
+
leftSlotOrIconWidth = iconLeftElement.getBoundingClientRect().width;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
366
394
|
|
|
367
|
-
labelComponent.value.labelElement.style.left = `${
|
|
395
|
+
labelComponent.value.labelElement.style.left = `${leftSlotOrIconWidth}px`;
|
|
368
396
|
}
|
|
369
397
|
</script>
|
|
370
398
|
|
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
component: URadio,
|
|
13
13
|
args: {
|
|
14
14
|
name: "radio1",
|
|
15
|
-
label: "
|
|
15
|
+
label: "Radio",
|
|
16
16
|
value: "1",
|
|
17
17
|
color: "brand",
|
|
18
18
|
},
|
|
@@ -29,7 +29,7 @@ const DefaultTemplate = (args) => ({
|
|
|
29
29
|
return { args, slots };
|
|
30
30
|
},
|
|
31
31
|
template: `
|
|
32
|
-
<URadio v-bind="args"
|
|
32
|
+
<URadio v-bind="args">
|
|
33
33
|
<template v-for="(slot, index) of slots" :key="index" v-slot:[slot]>
|
|
34
34
|
<template v-if="args[slot]">{{ args[slot] }}</template>
|
|
35
35
|
</template>
|
|
@@ -43,7 +43,7 @@ const SlotTemplate = (args) => ({
|
|
|
43
43
|
return { args };
|
|
44
44
|
},
|
|
45
45
|
template: `
|
|
46
|
-
<URadio v-bind="args"
|
|
46
|
+
<URadio v-bind="args">
|
|
47
47
|
${args.slotTemplate}
|
|
48
48
|
</URadio>
|
|
49
49
|
`,
|
|
@@ -56,7 +56,7 @@ export const disabled = DefaultTemplate.bind({});
|
|
|
56
56
|
disabled.args = { disabled: true, name: "radio2" };
|
|
57
57
|
|
|
58
58
|
export const description = DefaultTemplate.bind({});
|
|
59
|
-
description.args = { name: "radio3" };
|
|
59
|
+
description.args = { name: "radio3", description: "description" };
|
|
60
60
|
|
|
61
61
|
export const checked = DefaultTemplate.bind({});
|
|
62
62
|
checked.args = { checked: true, name: "radio4" };
|
package/ui.form-radio/index.vue
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
type="radio"
|
|
15
15
|
:disabled="disabled"
|
|
16
16
|
:name="radioName"
|
|
17
|
-
:value="
|
|
17
|
+
:value="radioValue"
|
|
18
18
|
:checked="checked"
|
|
19
19
|
:data-cy="dataCy"
|
|
20
20
|
v-bind="radioAttrs"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
</template>
|
|
31
31
|
|
|
32
32
|
<script setup>
|
|
33
|
-
import { inject, onMounted, ref, watchEffect } from "vue";
|
|
33
|
+
import { computed, inject, onMounted, ref, watchEffect } from "vue";
|
|
34
34
|
|
|
35
35
|
import ULabel from "../ui.form-label";
|
|
36
36
|
import UIService, { getRandomId } from "../service.ui";
|
|
@@ -44,10 +44,10 @@ defineOptions({ name: "URadio", inheritAttrs: false });
|
|
|
44
44
|
|
|
45
45
|
const props = defineProps({
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* Native value attribute.
|
|
48
48
|
*/
|
|
49
49
|
value: {
|
|
50
|
-
type: [String, Number],
|
|
50
|
+
type: [Boolean, String, Number, Array, Object],
|
|
51
51
|
default: "",
|
|
52
52
|
},
|
|
53
53
|
|
|
@@ -157,6 +157,10 @@ const radioSize = ref(getRadioGroupSize ? getRadioGroupSize() : props.size);
|
|
|
157
157
|
|
|
158
158
|
const { radioAttrs, labelAttrs } = useAttrs(props, { radioColor, radioSize });
|
|
159
159
|
|
|
160
|
+
const radioValue = computed(() => {
|
|
161
|
+
return props.value === "" ? "on" : props.value;
|
|
162
|
+
});
|
|
163
|
+
|
|
160
164
|
onMounted(() => {
|
|
161
165
|
radioName.value = props.name || getRadioGroupName;
|
|
162
166
|
});
|
|
@@ -19,9 +19,11 @@ export function useAttrs(props) {
|
|
|
19
19
|
|
|
20
20
|
const labelAttrs = getAttrs("label", { isComponent: true });
|
|
21
21
|
const listAttrs = getAttrs("list", { classes: listClasses });
|
|
22
|
+
const radioAttrs = getAttrs("radio", { isComponent: true });
|
|
22
23
|
|
|
23
24
|
return {
|
|
24
25
|
labelAttrs,
|
|
25
26
|
listAttrs,
|
|
27
|
+
radioAttrs,
|
|
26
28
|
};
|
|
27
29
|
}
|
|
@@ -14,9 +14,9 @@ export default {
|
|
|
14
14
|
label: "Label",
|
|
15
15
|
value: "1",
|
|
16
16
|
radios: [
|
|
17
|
-
{ name: "radio", label: "
|
|
18
|
-
{ name: "radio", label: "
|
|
19
|
-
{ name: "radio", label: "
|
|
17
|
+
{ name: "radio", label: "Radio 1", value: "1" },
|
|
18
|
+
{ name: "radio", label: "Radio 2", value: "2" },
|
|
19
|
+
{ name: "radio", label: "Radio 3", value: "3" },
|
|
20
20
|
],
|
|
21
21
|
},
|
|
22
22
|
argTypes: {
|
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<ULabel
|
|
3
|
+
:size="size"
|
|
3
4
|
:label="label"
|
|
5
|
+
:error="error"
|
|
4
6
|
:description="description"
|
|
5
7
|
:disabled="disabled"
|
|
6
|
-
:error="error"
|
|
7
|
-
:size="size"
|
|
8
8
|
align="topWithDesc"
|
|
9
9
|
:data-cy="dataCy"
|
|
10
10
|
v-bind="labelAttrs"
|
|
11
11
|
>
|
|
12
12
|
<div v-bind="listAttrs">
|
|
13
|
-
<slot
|
|
13
|
+
<slot>
|
|
14
|
+
<URadio
|
|
15
|
+
v-for="(option, index) in options"
|
|
16
|
+
:key="option.value"
|
|
17
|
+
:model-value="modelValue"
|
|
18
|
+
:value="option.value"
|
|
19
|
+
:label="option.label"
|
|
20
|
+
:description="option.description"
|
|
21
|
+
:disabled="disabled"
|
|
22
|
+
:data-cy="`${dataCy}-item-${index}`"
|
|
23
|
+
v-bind="radioAttrs"
|
|
24
|
+
/>
|
|
25
|
+
</slot>
|
|
14
26
|
</div>
|
|
15
27
|
</ULabel>
|
|
16
28
|
</template>
|
|
@@ -19,6 +31,7 @@
|
|
|
19
31
|
import { computed, provide } from "vue";
|
|
20
32
|
|
|
21
33
|
import ULabel from "../ui.form-label";
|
|
34
|
+
import URadio from "../ui.form-radio";
|
|
22
35
|
import UIService from "../service.ui";
|
|
23
36
|
|
|
24
37
|
import defaultConfig from "./configs/default.config";
|
|
@@ -33,10 +46,18 @@ const props = defineProps({
|
|
|
33
46
|
* Radio group selected value.
|
|
34
47
|
*/
|
|
35
48
|
modelValue: {
|
|
36
|
-
type: [String, Number],
|
|
49
|
+
type: [Boolean, String, Number, Array, Object],
|
|
37
50
|
default: "",
|
|
38
51
|
},
|
|
39
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Radio group options.
|
|
55
|
+
*/
|
|
56
|
+
options: {
|
|
57
|
+
type: Array,
|
|
58
|
+
default: () => [],
|
|
59
|
+
},
|
|
60
|
+
|
|
40
61
|
/**
|
|
41
62
|
* Radio group label.
|
|
42
63
|
*/
|
|
@@ -46,7 +67,7 @@ const props = defineProps({
|
|
|
46
67
|
},
|
|
47
68
|
|
|
48
69
|
/**
|
|
49
|
-
*
|
|
70
|
+
* Radio group description.
|
|
50
71
|
*/
|
|
51
72
|
description: {
|
|
52
73
|
type: String,
|
|
@@ -54,7 +75,7 @@ const props = defineProps({
|
|
|
54
75
|
},
|
|
55
76
|
|
|
56
77
|
/**
|
|
57
|
-
*
|
|
78
|
+
* Radio group error message.
|
|
58
79
|
*/
|
|
59
80
|
error: {
|
|
60
81
|
type: String,
|
|
@@ -63,7 +84,7 @@ const props = defineProps({
|
|
|
63
84
|
|
|
64
85
|
/**
|
|
65
86
|
* Radio size.
|
|
66
|
-
* @values sm, md, lg
|
|
87
|
+
* @values xs, sm, md, lg, xl
|
|
67
88
|
*/
|
|
68
89
|
size: {
|
|
69
90
|
type: String,
|
|
@@ -114,7 +135,7 @@ const props = defineProps({
|
|
|
114
135
|
|
|
115
136
|
const emit = defineEmits(["update:modelValue"]);
|
|
116
137
|
|
|
117
|
-
const { listAttrs,
|
|
138
|
+
const { labelAttrs, listAttrs, radioAttrs } = useAttrs(props);
|
|
118
139
|
|
|
119
140
|
const selectedItem = computed({
|
|
120
141
|
get: () => props.modelValue,
|
package/ui.loader-top/Docs.mdx
CHANGED
|
@@ -25,9 +25,8 @@ const {
|
|
|
25
25
|
loaderTopOn,
|
|
26
26
|
loaderTopOff,
|
|
27
27
|
requestQueue,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
removeComponentRequestQueue
|
|
28
|
+
addRequestUrl
|
|
29
|
+
removeRequestUrl
|
|
31
30
|
} = useLoaderTop();
|
|
32
31
|
|
|
33
32
|
// get loader state
|
|
@@ -42,14 +41,13 @@ loaderTopOff("/transactions");
|
|
|
42
41
|
// get current resource array
|
|
43
42
|
console.log(requestQueue.value);
|
|
44
43
|
|
|
45
|
-
//
|
|
46
|
-
|
|
44
|
+
// add resource into loader queue
|
|
45
|
+
addRequestUrl("/transactions");
|
|
46
|
+
addRequestUrl(["/transactions", "/products"]);
|
|
47
47
|
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
// remove resource from component related loader queue
|
|
52
|
-
removeComponentRequestQueue("/transactions");
|
|
48
|
+
// remove resource from loader queue
|
|
49
|
+
removeRequestUrl("/transactions");
|
|
50
|
+
removeRequestUrl(["/transactions", "/products"]);
|
|
53
51
|
`} language="jsx" dark />
|
|
54
52
|
|
|
55
53
|
## Using loader outside Vue components
|