vueless 0.0.49 → 0.0.51
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/adatper.locale/locales/en.js +2 -0
- package/composable.breakpoint/index.js +93 -0
- package/package.json +1 -1
- package/ui.container-card/composable/attrs.composable.js +2 -2
- package/ui.container-card/index.vue +3 -6
- package/ui.container-modal/composables/attrs.composable.js +5 -8
- package/ui.container-modal-confirm/index.vue +5 -2
- package/ui.container-page/composables/attrs.composable.js +3 -3
- package/ui.container-page/index.vue +4 -6
- package/ui.data-list/configs/default.config.js +4 -0
- package/ui.data-list/index.vue +8 -2
- package/ui.data-table/index.vue +5 -4
- package/ui.dropdown-list/index.vue +6 -3
- package/ui.form-date-picker-range/index.vue +4 -5
- package/ui.form-input-file/index.vue +9 -8
- package/ui.form-radio-card/index.vue +6 -10
- package/ui.form-select/index.vue +8 -10
- package/ui.form-switch/index.vue +5 -4
- package/web-types.json +1 -14
- package/ui.viewport/index.vue +0 -78
- package/ui.viewport/store/index.js +0 -47
|
@@ -7,6 +7,7 @@ import tableConfig from "../../ui.data-table/configs/default.config";
|
|
|
7
7
|
import calendarConfig from "../../ui.form-calendar/configs/default.config";
|
|
8
8
|
import datepickerConfig from "../../ui.form-date-picker/configs/default.config";
|
|
9
9
|
import datepickerRangeConfig from "../../ui.form-date-picker-range/configs/default.config";
|
|
10
|
+
import dataListConfig from "../../ui.data-list/configs/default.config";
|
|
10
11
|
|
|
11
12
|
export default {
|
|
12
13
|
USelect: selectConfig.i18n,
|
|
@@ -18,4 +19,5 @@ export default {
|
|
|
18
19
|
UCalendar: calendarConfig.i18n,
|
|
19
20
|
UDatePicker: datepickerConfig.i18n,
|
|
20
21
|
UDatePickerRange: datepickerRangeConfig.i18n,
|
|
22
|
+
UDataList: dataListConfig.i18n,
|
|
21
23
|
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { onMounted, ref, watch, computed } from "vue";
|
|
2
|
+
|
|
3
|
+
const BREAKPOINT_NAME = {
|
|
4
|
+
xs: "xs",
|
|
5
|
+
sm: "sm",
|
|
6
|
+
md: "md",
|
|
7
|
+
lg: "lg",
|
|
8
|
+
xl: "xl",
|
|
9
|
+
"2xl": "2xl",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const BREAKPOINT = {
|
|
13
|
+
xs: 0,
|
|
14
|
+
sm: 640,
|
|
15
|
+
md: 768,
|
|
16
|
+
lg: 1024,
|
|
17
|
+
xl: 1280,
|
|
18
|
+
"2xl": 1536,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const mobileDevices = ["xs", "sm"];
|
|
22
|
+
const portableDevices = ["xs", "sm", "md"];
|
|
23
|
+
|
|
24
|
+
export default function useBreakpoint() {
|
|
25
|
+
let timeout;
|
|
26
|
+
|
|
27
|
+
const windowWidth = ref(undefined);
|
|
28
|
+
const currentBreakpoint = ref(BREAKPOINT_NAME.xs);
|
|
29
|
+
|
|
30
|
+
const isMobileBreakpoint = computed(() => {
|
|
31
|
+
return mobileDevices.includes(currentBreakpoint.value);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const isTabletBreakpoint = computed(() => {
|
|
35
|
+
return mobileDevices.includes(currentBreakpoint.value);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const isLaptopBreakpoint = computed(() => {
|
|
39
|
+
return currentBreakpoint.value === BREAKPOINT_NAME.lg;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const isPortableBreakpoint = computed(() => {
|
|
43
|
+
return portableDevices.includes(currentBreakpoint.value);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const elementSize = computed(() => {
|
|
47
|
+
return isMobileBreakpoint.value ? BREAKPOINT_NAME.md : BREAKPOINT_NAME.lg;
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
onMounted(() => {
|
|
51
|
+
windowWidth.value = window.innerWidth;
|
|
52
|
+
|
|
53
|
+
window.addEventListener(resizeListener, { passive: true });
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
watch(windowWidth, setBreakpoint, { immediate: true });
|
|
57
|
+
|
|
58
|
+
function resizeListener() {
|
|
59
|
+
if (timeout) {
|
|
60
|
+
window.cancelAnimationFrame(timeout);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
timeout = window.requestAnimationFrame(() => {
|
|
64
|
+
windowWidth.value = window.innerWidth;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function setBreakpoint(newWindowWidth) {
|
|
69
|
+
if (newWindowWidth === undefined) return;
|
|
70
|
+
|
|
71
|
+
currentBreakpoint.value = "xs";
|
|
72
|
+
|
|
73
|
+
if (newWindowWidth >= BREAKPOINT.sm && newWindowWidth < BREAKPOINT.smd) {
|
|
74
|
+
currentBreakpoint.value = "sm";
|
|
75
|
+
} else if (newWindowWidth >= BREAKPOINT.md && newWindowWidth < BREAKPOINT.lg) {
|
|
76
|
+
currentBreakpoint.value = "md";
|
|
77
|
+
} else if (newWindowWidth >= BREAKPOINT.lg && newWindowWidth < BREAKPOINT.xl) {
|
|
78
|
+
currentBreakpoint.value = "lg";
|
|
79
|
+
} else if (newWindowWidth >= BREAKPOINT.xl && newWindowWidth < BREAKPOINT["2xl"]) {
|
|
80
|
+
currentBreakpoint.value = "xl";
|
|
81
|
+
} else if (newWindowWidth >= BREAKPOINT["2xl"]) {
|
|
82
|
+
currentBreakpoint.value = "2xl";
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
isLaptopBreakpoint,
|
|
88
|
+
isTabletBreakpoint,
|
|
89
|
+
isMobileBreakpoint,
|
|
90
|
+
isPortableBreakpoint,
|
|
91
|
+
elementSize,
|
|
92
|
+
};
|
|
93
|
+
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import { cva, cx } from "../../service.ui";
|
|
|
4
4
|
import defaultConfig from "../configs/default.config";
|
|
5
5
|
import { computed } from "vue";
|
|
6
6
|
|
|
7
|
-
export function useAttrs(props, {
|
|
7
|
+
export function useAttrs(props, { isMobileBreakpoint }) {
|
|
8
8
|
const { config, getAttrs, hasSlotContent } = useUI(defaultConfig, () => props.config);
|
|
9
9
|
const { wrapper } = config.value;
|
|
10
10
|
|
|
@@ -33,7 +33,7 @@ export function useAttrs(props, { isMobileDevice }) {
|
|
|
33
33
|
|
|
34
34
|
const footerAttrs = computed(() => {
|
|
35
35
|
const footerMobileReverseClasses =
|
|
36
|
-
props.mobileFooterReverse &&
|
|
36
|
+
props.mobileFooterReverse && isMobileBreakpoint.value && config.value.footerMobileReverse;
|
|
37
37
|
|
|
38
38
|
return {
|
|
39
39
|
...footerAttrsRaw.value,
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
|
|
41
41
|
<script setup>
|
|
42
42
|
import { computed, useSlots } from "vue";
|
|
43
|
-
import { useStore } from "vuex";
|
|
44
43
|
|
|
45
44
|
import UIService from "../service.ui";
|
|
46
45
|
import UHeader from "../ui.text-header";
|
|
@@ -49,11 +48,11 @@ import UDivider from "../ui.container-divider";
|
|
|
49
48
|
import { UCard } from "./constants";
|
|
50
49
|
import defaultConfig from "./configs/default.config";
|
|
51
50
|
import { useAttrs } from "./composable/attrs.composable";
|
|
51
|
+
import useBreakpoint from "../composable.breakpoint";
|
|
52
52
|
|
|
53
53
|
/* Should be a string for correct web-types gen */
|
|
54
54
|
defineOptions({ name: "UCard", inheritAttrs: false });
|
|
55
55
|
|
|
56
|
-
const store = useStore();
|
|
57
56
|
const slots = useSlots();
|
|
58
57
|
|
|
59
58
|
const props = defineProps({
|
|
@@ -127,9 +126,7 @@ const isShownFooter = computed(() => {
|
|
|
127
126
|
return hasSlotContent(slots["footer-left"]) || hasSlotContent(slots["footer-right"]);
|
|
128
127
|
});
|
|
129
128
|
|
|
130
|
-
const
|
|
131
|
-
return store.getters["breakpoint/isMobileDevice"];
|
|
132
|
-
});
|
|
129
|
+
const { isMobileBreakpoint } = useBreakpoint();
|
|
133
130
|
|
|
134
131
|
const {
|
|
135
132
|
hasSlotContent,
|
|
@@ -142,5 +139,5 @@ const {
|
|
|
142
139
|
descriptionAttrs,
|
|
143
140
|
contentAttrs,
|
|
144
141
|
footerAttrs,
|
|
145
|
-
} = useAttrs(props, {
|
|
142
|
+
} = useAttrs(props, { isMobileBreakpoint });
|
|
146
143
|
</script>
|
|
@@ -2,13 +2,14 @@ import useUI from "../../composable.ui";
|
|
|
2
2
|
import { cva, cx } from "../../service.ui";
|
|
3
3
|
|
|
4
4
|
import defaultConfig from "../configs/default.config";
|
|
5
|
-
import { useStore } from "vuex";
|
|
6
5
|
import { computed } from "vue";
|
|
7
6
|
|
|
7
|
+
import useBreakpoint from "../../composable.breakpoint";
|
|
8
|
+
|
|
8
9
|
export function useAttrs(props) {
|
|
9
|
-
const store = useStore();
|
|
10
10
|
const { config, getAttrs, hasSlotContent } = useUI(defaultConfig, () => props.config, "wrapper");
|
|
11
11
|
const { modal } = config.value;
|
|
12
|
+
const { isMobileBreakpoint } = useBreakpoint();
|
|
12
13
|
|
|
13
14
|
const cvaModal = cva({
|
|
14
15
|
base: modal.base,
|
|
@@ -44,9 +45,7 @@ export function useAttrs(props) {
|
|
|
44
45
|
...headerAttrsRaw.value,
|
|
45
46
|
class: cx([
|
|
46
47
|
headerAttrsRaw.value.class,
|
|
47
|
-
props.mobileFooterReverse &&
|
|
48
|
-
store.getters["breakpoint/isMobileDevice"] &&
|
|
49
|
-
config.value.footerMobileReverse,
|
|
48
|
+
props.mobileFooterReverse && isMobileBreakpoint.value && config.value.footerMobileReverse,
|
|
50
49
|
]),
|
|
51
50
|
}));
|
|
52
51
|
|
|
@@ -54,9 +53,7 @@ export function useAttrs(props) {
|
|
|
54
53
|
...footerAttrsRaw.value,
|
|
55
54
|
class: cx([
|
|
56
55
|
footerAttrsRaw.value.class,
|
|
57
|
-
props.mobileFooterReverse &&
|
|
58
|
-
store.getters["breakpoint/isMobileDevice"] &&
|
|
59
|
-
config.value.footerMobileReverse,
|
|
56
|
+
props.mobileFooterReverse && isMobileBreakpoint.value && config.value.footerMobileReverse,
|
|
60
57
|
]),
|
|
61
58
|
}));
|
|
62
59
|
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
|
|
44
44
|
<UButton
|
|
45
45
|
v-if="cancelButton"
|
|
46
|
-
:label="
|
|
46
|
+
:label="currentLocale.cancel"
|
|
47
47
|
variant="thirdary"
|
|
48
48
|
filled
|
|
49
49
|
:data-cy="`${dataCy}-close`"
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
|
|
62
62
|
<script setup>
|
|
63
63
|
import { computed } from "vue";
|
|
64
|
+
import { merge } from "lodash-es";
|
|
64
65
|
|
|
65
66
|
import UIService from "../service.ui";
|
|
66
67
|
|
|
@@ -153,7 +154,7 @@ const props = defineProps({
|
|
|
153
154
|
|
|
154
155
|
const emit = defineEmits(["update:modelValue", "confirm", "close"]);
|
|
155
156
|
|
|
156
|
-
const {
|
|
157
|
+
const { tm } = useLocale();
|
|
157
158
|
|
|
158
159
|
const {
|
|
159
160
|
hasSlotContent,
|
|
@@ -168,6 +169,8 @@ const isShownModal = computed({
|
|
|
168
169
|
set: (value) => emit("update:modelValue", value),
|
|
169
170
|
});
|
|
170
171
|
|
|
172
|
+
const currentLocale = computed(() => merge(tm("UModalConfirm"), props.config.i18n));
|
|
173
|
+
|
|
171
174
|
function closeModal() {
|
|
172
175
|
isShownModal.value = false;
|
|
173
176
|
}
|
|
@@ -4,7 +4,7 @@ import { cva, cx, isMobileApp } from "../../service.ui";
|
|
|
4
4
|
import defaultConfig from "../configs/default.config";
|
|
5
5
|
import { computed } from "vue";
|
|
6
6
|
|
|
7
|
-
export function useAttrs(props, {
|
|
7
|
+
export function useAttrs(props, { isMobileBreakpoint }) {
|
|
8
8
|
const { config, getAttrs, hasSlotContent } = useUI(defaultConfig, () => props.config);
|
|
9
9
|
const { wrapper, page, rightRounding } = config.value;
|
|
10
10
|
|
|
@@ -62,7 +62,7 @@ export function useAttrs(props, { isMobileDevice }) {
|
|
|
62
62
|
...wrapperAttrsRaw.value,
|
|
63
63
|
class: cx([
|
|
64
64
|
wrapperAttrsRaw.value.class,
|
|
65
|
-
|
|
65
|
+
isMobileBreakpoint.value && !isMobileApp && config.value.wrapperMobile,
|
|
66
66
|
]),
|
|
67
67
|
}));
|
|
68
68
|
|
|
@@ -70,7 +70,7 @@ export function useAttrs(props, { isMobileDevice }) {
|
|
|
70
70
|
...footerAttrsRaw.value,
|
|
71
71
|
class: cx([
|
|
72
72
|
footerAttrsRaw.value.class,
|
|
73
|
-
props.mobileFooterReverse &&
|
|
73
|
+
props.mobileFooterReverse && isMobileBreakpoint.value && config.value.footerMobileReverse,
|
|
74
74
|
]),
|
|
75
75
|
}));
|
|
76
76
|
|
|
@@ -66,7 +66,8 @@
|
|
|
66
66
|
|
|
67
67
|
<script setup>
|
|
68
68
|
import { computed, useSlots, onMounted } from "vue";
|
|
69
|
-
|
|
69
|
+
|
|
70
|
+
import useBreakpoint from "../composable.breakpoint";
|
|
70
71
|
|
|
71
72
|
import ULink from "../ui.button-link/index.vue";
|
|
72
73
|
import UIcon from "../ui.image-icon/index.vue";
|
|
@@ -79,7 +80,6 @@ import { UPage } from "./constants";
|
|
|
79
80
|
import { useAttrs } from "./composables/attrs.composable";
|
|
80
81
|
|
|
81
82
|
const slots = useSlots();
|
|
82
|
-
const store = useStore();
|
|
83
83
|
|
|
84
84
|
/* Should be a string for correct web-types gen */
|
|
85
85
|
defineOptions({ name: "UPage", inheritAttrs: false });
|
|
@@ -168,9 +168,7 @@ const props = defineProps({
|
|
|
168
168
|
},
|
|
169
169
|
});
|
|
170
170
|
|
|
171
|
-
const
|
|
172
|
-
return store.getters["breakpoint/isMobileDevice"];
|
|
173
|
-
});
|
|
171
|
+
const { isMobileBreakpoint } = useBreakpoint();
|
|
174
172
|
|
|
175
173
|
const {
|
|
176
174
|
config,
|
|
@@ -190,7 +188,7 @@ const {
|
|
|
190
188
|
footerRightAttrs,
|
|
191
189
|
rightRoundingWrapperAttrs,
|
|
192
190
|
hasSlotContent,
|
|
193
|
-
} = useAttrs(props, {
|
|
191
|
+
} = useAttrs(props, { isMobileBreakpoint });
|
|
194
192
|
|
|
195
193
|
const isShownHeader = computed(() => {
|
|
196
194
|
const isHeaderLeftSlot = hasSlotContent(slots["header-left"]);
|
package/ui.data-list/index.vue
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
:name="config.iconDeleteName"
|
|
49
49
|
color="gray"
|
|
50
50
|
:data-cy="`${dataCy}-delete`"
|
|
51
|
-
:tooltip="
|
|
51
|
+
:tooltip="currentLocale.delete"
|
|
52
52
|
v-bind="iconDeleteAttrs"
|
|
53
53
|
@click="onClickDelete(element.id, element.name)"
|
|
54
54
|
/>
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
:name="config.iconEditName"
|
|
60
60
|
color="gray"
|
|
61
61
|
:data-cy="`${dataCy}-edit`"
|
|
62
|
-
:tooltip="
|
|
62
|
+
:tooltip="currentLocale.edit"
|
|
63
63
|
v-bind="iconEditAttrs"
|
|
64
64
|
@click="onClickEdit(element.id)"
|
|
65
65
|
/>
|
|
@@ -96,7 +96,9 @@
|
|
|
96
96
|
</template>
|
|
97
97
|
|
|
98
98
|
<script setup>
|
|
99
|
+
import { computed } from "vue";
|
|
99
100
|
import draggable from "vuedraggable";
|
|
101
|
+
import { merge } from "lodash-es";
|
|
100
102
|
|
|
101
103
|
import UIcon from "../ui.image-icon";
|
|
102
104
|
import UEmpty from "../ui.text-empty";
|
|
@@ -106,6 +108,7 @@ import UIService from "../service.ui";
|
|
|
106
108
|
import { UDataListName } from "./constants";
|
|
107
109
|
import defaultConfig from "./configs/default.config";
|
|
108
110
|
import { useAttrs } from "./composables/attrs.composable";
|
|
111
|
+
import { useLocale } from "../composable.locale";
|
|
109
112
|
|
|
110
113
|
/* Should be a string for correct web-types gen */
|
|
111
114
|
defineOptions({ name: "UDataList", inheritAttrs: true });
|
|
@@ -211,6 +214,9 @@ const {
|
|
|
211
214
|
iconDragAttrs,
|
|
212
215
|
hasSlotContent,
|
|
213
216
|
} = useAttrs(props);
|
|
217
|
+
const { tm } = useLocale();
|
|
218
|
+
|
|
219
|
+
const currentLocale = computed(() => merge(tm("UDataList"), props.config.i18n));
|
|
214
220
|
|
|
215
221
|
function onDragMove(event) {
|
|
216
222
|
const isDisabledNestingItem = event.draggedContext.element.isDisabledNesting;
|
package/ui.data-table/index.vue
CHANGED
|
@@ -272,6 +272,7 @@ import {
|
|
|
272
272
|
nextTick,
|
|
273
273
|
onBeforeUnmount,
|
|
274
274
|
} from "vue";
|
|
275
|
+
import { merge } from "lodash-es";
|
|
275
276
|
|
|
276
277
|
import UIcon from "../ui.image-icon";
|
|
277
278
|
import UEmpty from "../ui.text-empty";
|
|
@@ -404,7 +405,7 @@ const emit = defineEmits(["clickRow", "update:rows"]);
|
|
|
404
405
|
defineExpose({ clearSelectedItems });
|
|
405
406
|
|
|
406
407
|
const slots = useSlots();
|
|
407
|
-
const {
|
|
408
|
+
const { tm } = useLocale();
|
|
408
409
|
|
|
409
410
|
const selectAll = ref(false);
|
|
410
411
|
const canSelectAll = ref(true);
|
|
@@ -475,6 +476,8 @@ const {
|
|
|
475
476
|
headerAttrs,
|
|
476
477
|
} = useAttrs(props, { selectedRows, isHeaderSticky, tableRows, isFooterSticky });
|
|
477
478
|
|
|
479
|
+
const currentLocale = computed(() => merge(tm("UTable"), props.config.i18n));
|
|
480
|
+
|
|
478
481
|
const normalizedColumns = computed(() => TableService.normalizeColumns(props.columns));
|
|
479
482
|
|
|
480
483
|
const isSelectedAllRows = computed(() => {
|
|
@@ -519,9 +522,7 @@ const hasContentBeforeFirstRowSlot = computed(() => {
|
|
|
519
522
|
});
|
|
520
523
|
|
|
521
524
|
const emptyTableMsg = computed(() => {
|
|
522
|
-
return props.filters
|
|
523
|
-
? props.config?.i18n?.noResultsForFilters || t("UTable.noResultsForFilters")
|
|
524
|
-
: props.config?.i18n?.noItems || t("UTable.noItems");
|
|
525
|
+
return props.filters ? currentLocale.value.noResultsForFilters : currentLocale.value.noItems;
|
|
525
526
|
});
|
|
526
527
|
|
|
527
528
|
watch(selectAll, onChangeSelectAll, { deep: true });
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
:empty-styles="optionClasses"
|
|
66
66
|
>
|
|
67
67
|
<span v-bind="optionAttrs()">
|
|
68
|
-
<span v-text="
|
|
68
|
+
<span v-text="currentLocale.noDataToShow" />
|
|
69
69
|
</span>
|
|
70
70
|
</slot>
|
|
71
71
|
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
<template v-if="addOption">
|
|
74
74
|
<div v-bind="addTitleWrapperAttrs" @click="onClickAddOption">
|
|
75
75
|
<div v-bind="addTitleAttrs">
|
|
76
|
-
{{
|
|
76
|
+
{{ currentLocale.add }}
|
|
77
77
|
<span v-bind="addTitleHotkeyAttrs" v-text="addOptionKeyCombination" />
|
|
78
78
|
</div>
|
|
79
79
|
</div>
|
|
@@ -87,6 +87,7 @@
|
|
|
87
87
|
|
|
88
88
|
<script setup>
|
|
89
89
|
import { computed, ref } from "vue";
|
|
90
|
+
import { merge } from "lodash-es";
|
|
90
91
|
|
|
91
92
|
import UIcon from "../ui.image-icon";
|
|
92
93
|
import UButton from "../ui.button";
|
|
@@ -231,10 +232,12 @@ const {
|
|
|
231
232
|
optionContentAttrs,
|
|
232
233
|
} = useAttrs(props);
|
|
233
234
|
|
|
234
|
-
const {
|
|
235
|
+
const { tm } = useLocale();
|
|
235
236
|
|
|
236
237
|
defineExpose({ pointerSet, pointerBackward, pointerForward, pointerReset, addPointerElement });
|
|
237
238
|
|
|
239
|
+
const currentLocale = computed(() => merge(tm("UDropdownList"), props.config.i18n));
|
|
240
|
+
|
|
238
241
|
const addOptionKeyCombination = computed(() => {
|
|
239
242
|
return isMac ? "(⌘ + Enter)" : "(Ctrl + Enter)";
|
|
240
243
|
});
|
|
@@ -179,7 +179,6 @@
|
|
|
179
179
|
|
|
180
180
|
<script setup>
|
|
181
181
|
import { computed, watch, ref, nextTick } from "vue";
|
|
182
|
-
import { useStore } from "vuex";
|
|
183
182
|
import { merge } from "lodash-es";
|
|
184
183
|
|
|
185
184
|
import UIcon from "../ui.image-icon";
|
|
@@ -227,6 +226,7 @@ import {
|
|
|
227
226
|
import { wrongDateFormat, wrongMonthNumber, wrongDayNumber } from "./services/validation.service";
|
|
228
227
|
import useAttrs from "./composables/attrs.composable";
|
|
229
228
|
import { useLocale } from "../composable.locale";
|
|
229
|
+
import useBreakpoint from "../composable.breakpoint";
|
|
230
230
|
|
|
231
231
|
import defaultConfig from "./configs/default.config";
|
|
232
232
|
import {
|
|
@@ -385,7 +385,6 @@ const {
|
|
|
385
385
|
rangeInputWrapperAttrs,
|
|
386
386
|
inputRangeErrorAttrs,
|
|
387
387
|
} = useAttrs(props, { isShownMenu });
|
|
388
|
-
const store = useStore();
|
|
389
388
|
const { tm } = useLocale();
|
|
390
389
|
|
|
391
390
|
const calendarValue = ref(props.modelValue);
|
|
@@ -413,7 +412,7 @@ const localValue = computed({
|
|
|
413
412
|
},
|
|
414
413
|
});
|
|
415
414
|
|
|
416
|
-
const
|
|
415
|
+
const { isMobileBreakpoint } = useBreakpoint();
|
|
417
416
|
const rangeInputName = computed(() => `rangeInput-${props.id}`);
|
|
418
417
|
const currentLocale = computed(() => merge(tm("UDatePickerRange"), props.config.i18n));
|
|
419
418
|
|
|
@@ -560,7 +559,7 @@ const userFormatDate = computed(() => {
|
|
|
560
559
|
title = `${fromTitle} – ${toTitle}`;
|
|
561
560
|
}
|
|
562
561
|
|
|
563
|
-
if (
|
|
562
|
+
if (isMobileBreakpoint.value && !isPeriod.value.month && isVariant.value.button) {
|
|
564
563
|
const startDay = String(from.getDate()).padStart(2, "0");
|
|
565
564
|
const endDay = String(to?.getDate())?.padStart(2, "0");
|
|
566
565
|
const startMonth = String(from.getMonth()).padStart(2, "0");
|
|
@@ -633,7 +632,7 @@ function onClickPeriodButton(periodName) {
|
|
|
633
632
|
localValue.value.from !== null ? getDateFromUnixTimestamp(localValue.value.from) : new Date();
|
|
634
633
|
|
|
635
634
|
if (periodName === PERIOD.week) {
|
|
636
|
-
periodDateList.value = getWeekDateList(localDate,
|
|
635
|
+
periodDateList.value = getWeekDateList(localDate, locale.value.months.shorthand);
|
|
637
636
|
|
|
638
637
|
period.value = PERIOD.week;
|
|
639
638
|
}
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
<UButton
|
|
39
|
-
:label="
|
|
39
|
+
:label="currentLocale.selectFile"
|
|
40
40
|
:size="size"
|
|
41
41
|
variant="thirdary"
|
|
42
42
|
filled
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
<script setup>
|
|
62
62
|
import Uppy from "@uppy/core";
|
|
63
63
|
import DragDrop from "@uppy/vue/src/drag-drop";
|
|
64
|
+
import { merge } from "lodash-es";
|
|
64
65
|
|
|
65
66
|
import { computed, onBeforeUnmount, onMounted, ref, useSlots, watch } from "vue";
|
|
66
67
|
|
|
@@ -192,7 +193,7 @@ const slots = useSlots();
|
|
|
192
193
|
|
|
193
194
|
const emit = defineEmits(["changeFiles", "deleteFile"]);
|
|
194
195
|
|
|
195
|
-
const {
|
|
196
|
+
const { tm } = useLocale();
|
|
196
197
|
|
|
197
198
|
const filesData = ref([]);
|
|
198
199
|
const selectedFiles = ref([]);
|
|
@@ -217,6 +218,8 @@ const {
|
|
|
217
218
|
hasSlotContent,
|
|
218
219
|
} = useAttrs(props, { errorMessage, dragOver });
|
|
219
220
|
|
|
221
|
+
const currentLocale = computed(() => merge(tm("UInputFile"), props.config.i18n));
|
|
222
|
+
|
|
220
223
|
const filesList = computed(() => {
|
|
221
224
|
return filesData.value.map((file) => {
|
|
222
225
|
return {
|
|
@@ -245,11 +248,11 @@ const uppyUpload = computed(() => {
|
|
|
245
248
|
const allowedFilesForUpload = computed(() => {
|
|
246
249
|
const allowedFormat = props.allowedFileTypes.join(", ");
|
|
247
250
|
|
|
248
|
-
return `${
|
|
251
|
+
return `${currentLocale.value.canAttachFilesFormat} ${allowedFormat}`;
|
|
249
252
|
});
|
|
250
253
|
|
|
251
254
|
const descriptionText = computed(() => {
|
|
252
|
-
return `${
|
|
255
|
+
return `${currentLocale.value.selectOrDragImage} ${allowedFilesForUpload.value}`;
|
|
253
256
|
});
|
|
254
257
|
|
|
255
258
|
const componentSize = computed(() => {
|
|
@@ -365,10 +368,8 @@ function onChangeError() {
|
|
|
365
368
|
function onChangeErrorFilesTypes() {
|
|
366
369
|
if (errorFilesTypes.value.length) {
|
|
367
370
|
const error = errorFilesTypes.value.join(", ");
|
|
368
|
-
const cannotAttachFilesStart =
|
|
369
|
-
|
|
370
|
-
const cannotAttachFilesEnd =
|
|
371
|
-
props.config?.i18n?.cannotAttachFilesEnd || t("UInputFile.cannotAttachFilesEnd");
|
|
371
|
+
const cannotAttachFilesStart = currentLocale.value.cannotAttachFilesStart;
|
|
372
|
+
const cannotAttachFilesEnd = currentLocale.value.cannotAttachFilesEnd;
|
|
372
373
|
|
|
373
374
|
errorMessage.value = `${cannotAttachFilesStart} ${error} ${cannotAttachFilesEnd}`;
|
|
374
375
|
}
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
|
|
26
26
|
<script setup>
|
|
27
27
|
import { computed } from "vue";
|
|
28
|
-
import { useStore } from "vuex";
|
|
29
28
|
|
|
30
29
|
import UIcon from "../ui.image-icon";
|
|
31
30
|
import URadio from "../ui.form-radio";
|
|
@@ -34,12 +33,11 @@ import UIService, { getRandomId } from "../service.ui";
|
|
|
34
33
|
import defaultConfig from "./configs/default.config";
|
|
35
34
|
import { URadioCard } from "./constants";
|
|
36
35
|
import { useAttrs } from "./composables/attrs.composable";
|
|
36
|
+
import useBreakpoint from "../composable.breakpoint";
|
|
37
37
|
|
|
38
38
|
/* Should be a string for correct web-types gen */
|
|
39
39
|
defineOptions({ name: "URadioCard", inheritAttrs: false });
|
|
40
40
|
|
|
41
|
-
const store = useStore();
|
|
42
|
-
|
|
43
41
|
const props = defineProps({
|
|
44
42
|
/**
|
|
45
43
|
* Set radio card name.
|
|
@@ -126,9 +124,7 @@ const emit = defineEmits(["update:modelValue"]);
|
|
|
126
124
|
|
|
127
125
|
const { radioAttrs, iconAttrs, wrapperAttrs, labelAttrs, itemsAttrs } = useAttrs(props);
|
|
128
126
|
|
|
129
|
-
const
|
|
130
|
-
return store.getters["breakpoint/isMobileDevice"];
|
|
131
|
-
});
|
|
127
|
+
const { isMobileBreakpoint } = useBreakpoint();
|
|
132
128
|
|
|
133
129
|
const selectedItem = computed({
|
|
134
130
|
get: () => props.modelValue,
|
|
@@ -137,10 +133,10 @@ const selectedItem = computed({
|
|
|
137
133
|
|
|
138
134
|
const gridColsClass = computed(() => {
|
|
139
135
|
return {
|
|
140
|
-
"grid-cols-1":
|
|
141
|
-
"grid-cols-2": props.gridCols === 2 &&
|
|
142
|
-
"grid-cols-3": props.gridCols === 3 &&
|
|
143
|
-
"grid-cols-4": props.gridCols === 4 &&
|
|
136
|
+
"grid-cols-1": isMobileBreakpoint.value,
|
|
137
|
+
"grid-cols-2": props.gridCols === 2 && isMobileBreakpoint.value,
|
|
138
|
+
"grid-cols-3": props.gridCols === 3 && isMobileBreakpoint.value,
|
|
139
|
+
"grid-cols-4": props.gridCols === 4 && isMobileBreakpoint.value,
|
|
144
140
|
};
|
|
145
141
|
});
|
|
146
142
|
</script>
|
package/ui.form-select/index.vue
CHANGED
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
v-bind="caretClearTextAttrs"
|
|
152
152
|
@mousedown.prevent.capture="removeElement(localValue)"
|
|
153
153
|
@click.prevent.capture
|
|
154
|
-
v-text="
|
|
154
|
+
v-text="currentLocale.clear"
|
|
155
155
|
/>
|
|
156
156
|
</div>
|
|
157
157
|
|
|
@@ -189,15 +189,11 @@
|
|
|
189
189
|
</template>
|
|
190
190
|
|
|
191
191
|
<template #empty="{ emptyStyles }">
|
|
192
|
-
<span
|
|
193
|
-
v-show="isEmpty"
|
|
194
|
-
:class="emptyStyles"
|
|
195
|
-
v-text="props.config?.i18n?.listIsEmpty || t('USelect.listIsEmpty')"
|
|
196
|
-
/>
|
|
192
|
+
<span v-show="isEmpty" :class="emptyStyles" v-text="currentLocale.listIsEmpty" />
|
|
197
193
|
<span
|
|
198
194
|
v-show="options.length === 0 && !search && !isEmpty"
|
|
199
195
|
:class="emptyStyles"
|
|
200
|
-
v-text="
|
|
196
|
+
v-text="currentLocale.noDataToShow"
|
|
201
197
|
/>
|
|
202
198
|
</template>
|
|
203
199
|
</UDropdownList>
|
|
@@ -207,7 +203,7 @@
|
|
|
207
203
|
|
|
208
204
|
<script setup>
|
|
209
205
|
import { ref, computed, nextTick, watch, useSlots, onMounted } from "vue";
|
|
210
|
-
import { debounce } from "lodash-es";
|
|
206
|
+
import { debounce, merge } from "lodash-es";
|
|
211
207
|
|
|
212
208
|
import UIcon from "../ui.image-icon";
|
|
213
209
|
import ULabel from "../ui.form-label";
|
|
@@ -444,7 +440,7 @@ const emit = defineEmits([
|
|
|
444
440
|
]);
|
|
445
441
|
|
|
446
442
|
const slots = useSlots();
|
|
447
|
-
const {
|
|
443
|
+
const { tm } = useLocale();
|
|
448
444
|
|
|
449
445
|
const isOpen = ref(false);
|
|
450
446
|
const preferredOpenDirection = ref(DIRECTION.bottom);
|
|
@@ -492,8 +488,10 @@ const {
|
|
|
492
488
|
dropdownListAttrs,
|
|
493
489
|
} = useAttrs(props, { isTop, isOpen, selectedLabel });
|
|
494
490
|
|
|
491
|
+
const currentLocale = computed(() => merge(tm("USelect"), props.config.i18n));
|
|
492
|
+
|
|
495
493
|
const inputPlaceholder = computed(() => {
|
|
496
|
-
const message =
|
|
494
|
+
const message = currentLocale.value.addMore;
|
|
497
495
|
|
|
498
496
|
return props.multiple && localValue.value.length ? message : props.placeholder;
|
|
499
497
|
});
|
package/ui.form-switch/index.vue
CHANGED
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
|
|
39
39
|
<script setup>
|
|
40
40
|
import { computed } from "vue";
|
|
41
|
+
import { merge } from "lodash-es";
|
|
41
42
|
|
|
42
43
|
import UIcon from "../ui.image-icon";
|
|
43
44
|
import ULabel from "../ui.form-label";
|
|
@@ -154,7 +155,9 @@ const props = defineProps({
|
|
|
154
155
|
|
|
155
156
|
const emit = defineEmits(["update:modelValue"]);
|
|
156
157
|
|
|
157
|
-
const {
|
|
158
|
+
const { tm } = useLocale();
|
|
159
|
+
|
|
160
|
+
const currentLocale = computed(() => merge(tm("USwitch"), props.config.i18n));
|
|
158
161
|
|
|
159
162
|
const checkedValue = computed({
|
|
160
163
|
get: () => props.modelValue,
|
|
@@ -165,9 +168,7 @@ const { config, iconAttrs, labelAttrs, inputAttrs, wrapperAttrs, circleAttrs, to
|
|
|
165
168
|
useAttrs(props, { checked: checkedValue });
|
|
166
169
|
|
|
167
170
|
const switchLabel = computed(() => {
|
|
168
|
-
return checkedValue.value
|
|
169
|
-
? props.config?.i18n?.active || t("USwitch.active")
|
|
170
|
-
: props.config?.i18n?.inactive || t("USwitch.inactive");
|
|
171
|
+
return checkedValue.value ? currentLocale.value.active : currentLocale.value.inactive;
|
|
171
172
|
});
|
|
172
173
|
|
|
173
174
|
const iconSize = computed(() => {
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"framework": "vue",
|
|
3
3
|
"name": "vueless",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.51",
|
|
5
5
|
"contributions": {
|
|
6
6
|
"html": {
|
|
7
7
|
"description-markup": "markdown",
|
|
@@ -6993,19 +6993,6 @@
|
|
|
6993
6993
|
"symbol": "default"
|
|
6994
6994
|
}
|
|
6995
6995
|
},
|
|
6996
|
-
{
|
|
6997
|
-
"name": "UViewport",
|
|
6998
|
-
"description": "",
|
|
6999
|
-
"slots": [
|
|
7000
|
-
{
|
|
7001
|
-
"name": "default"
|
|
7002
|
-
}
|
|
7003
|
-
],
|
|
7004
|
-
"source": {
|
|
7005
|
-
"module": "vueless/ui.viewport/index.vue",
|
|
7006
|
-
"symbol": "default"
|
|
7007
|
-
}
|
|
7008
|
-
},
|
|
7009
6996
|
{
|
|
7010
6997
|
"name": "YearView",
|
|
7011
6998
|
"description": "",
|
package/ui.viewport/index.vue
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<slot :breakpoint="breakpoint" />
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script>
|
|
8
|
-
import { mapMutations } from "vuex";
|
|
9
|
-
|
|
10
|
-
export default {
|
|
11
|
-
name: "UViewport",
|
|
12
|
-
|
|
13
|
-
data() {
|
|
14
|
-
return {
|
|
15
|
-
windowWidth: 0,
|
|
16
|
-
breakpoint: "",
|
|
17
|
-
};
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
watch: {
|
|
21
|
-
windowWidth: {
|
|
22
|
-
immediate: true,
|
|
23
|
-
handler: "setBreakpoint",
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
mounted() {
|
|
28
|
-
this.setWindowWidth();
|
|
29
|
-
this.setListener();
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
methods: {
|
|
33
|
-
...mapMutations("breakpoint", ["SET_BREAKPOINT"]),
|
|
34
|
-
|
|
35
|
-
setWindowWidth() {
|
|
36
|
-
this.windowWidth = window.innerWidth;
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
setListener() {
|
|
40
|
-
let timeout;
|
|
41
|
-
|
|
42
|
-
window.addEventListener(
|
|
43
|
-
"resize",
|
|
44
|
-
() => {
|
|
45
|
-
if (timeout) {
|
|
46
|
-
window.cancelAnimationFrame(timeout);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
timeout = window.requestAnimationFrame(() => {
|
|
50
|
-
this.setWindowWidth();
|
|
51
|
-
});
|
|
52
|
-
},
|
|
53
|
-
{ passive: true },
|
|
54
|
-
);
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
setBreakpoint(windowWidth) {
|
|
58
|
-
if (!windowWidth) return;
|
|
59
|
-
|
|
60
|
-
this.breakpoint = "xs";
|
|
61
|
-
|
|
62
|
-
if (windowWidth >= 640 && windowWidth < 768) {
|
|
63
|
-
this.breakpoint = "sm";
|
|
64
|
-
} else if (windowWidth >= 768 && windowWidth < 1024) {
|
|
65
|
-
this.breakpoint = "md";
|
|
66
|
-
} else if (windowWidth >= 1024 && windowWidth < 1280) {
|
|
67
|
-
this.breakpoint = "lg";
|
|
68
|
-
} else if (windowWidth >= 1280 && windowWidth < 1536) {
|
|
69
|
-
this.breakpoint = "xl";
|
|
70
|
-
} else if (windowWidth >= 1536) {
|
|
71
|
-
this.breakpoint = "2xl";
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
this.SET_BREAKPOINT(this.breakpoint);
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
</script>
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
namespaced: true,
|
|
3
|
-
|
|
4
|
-
state: {
|
|
5
|
-
breakpoint: "",
|
|
6
|
-
mobileDevices: ["xs", "sm"],
|
|
7
|
-
portableDevices: ["xs", "sm", "md"],
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
getters: {
|
|
11
|
-
isLaptopDevice(state) {
|
|
12
|
-
const { breakpoint } = state;
|
|
13
|
-
|
|
14
|
-
return breakpoint === "lg";
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
isTabletDevice(state) {
|
|
18
|
-
const { breakpoint } = state;
|
|
19
|
-
|
|
20
|
-
return breakpoint === "md";
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
isMobileDevice(state) {
|
|
24
|
-
const { breakpoint, mobileDevices } = state;
|
|
25
|
-
|
|
26
|
-
return mobileDevices.includes(breakpoint);
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
isPortableDevice(state) {
|
|
30
|
-
const { breakpoint, portableDevices } = state;
|
|
31
|
-
|
|
32
|
-
return portableDevices.includes(breakpoint);
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
elementSize(state, getters) {
|
|
36
|
-
const { isMobileDevice } = getters;
|
|
37
|
-
|
|
38
|
-
return isMobileDevice ? "md" : "lg";
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
mutations: {
|
|
43
|
-
SET_BREAKPOINT(state, breakpoint) {
|
|
44
|
-
state.breakpoint = breakpoint;
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
};
|