vueless 0.0.554 → 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 +28 -64
- package/constants.js +21 -2
- 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/config.ts +36 -36
- package/ui.form-calendar/useAttrs.ts +2 -264
- 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/node/tailwindSafelist.js +2 -2
- package/utils/ui.ts +3 -4
- package/web-types.json +17 -1
- package/ui.button/useAttrs.ts +0 -26
|
@@ -7,17 +7,11 @@ import type { UseAttrs } from "../types.ts";
|
|
|
7
7
|
import type { UDividerProps, Config } from "./types.ts";
|
|
8
8
|
|
|
9
9
|
export default function useAttrs(props: UDividerProps): UseAttrs<Config> {
|
|
10
|
-
const { config, getKeysAttrs
|
|
10
|
+
const { config, getKeysAttrs } = useUI<Config>(defaultConfig, () => props.config);
|
|
11
11
|
|
|
12
12
|
const mutatedProps = computed(() => ({
|
|
13
13
|
label: Boolean(props.label),
|
|
14
14
|
}));
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
config,
|
|
20
|
-
...keysAttrs,
|
|
21
|
-
hasSlotContent,
|
|
22
|
-
};
|
|
16
|
+
return { config, ...getKeysAttrs(mutatedProps) };
|
|
23
17
|
}
|
|
@@ -6,13 +6,7 @@ import type { UseAttrs } from "../types.ts";
|
|
|
6
6
|
import type { UGroupProps, Config } from "./types.ts";
|
|
7
7
|
|
|
8
8
|
export default function useAttrs(props: UGroupProps): 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
|
}
|
|
@@ -6,13 +6,7 @@ import type { UseAttrs } from "../types.ts";
|
|
|
6
6
|
import type { UGroupsProps, Config } from "./types.ts";
|
|
7
7
|
|
|
8
8
|
export default function useAttrs(props: UGroupsProps): 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
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { computed, useSlots, watch, ref, useId } from "vue";
|
|
3
3
|
|
|
4
4
|
import { getDefault } from "../utils/ui.ts";
|
|
5
|
+
import { hasSlotContent } from "../utils/helper.ts";
|
|
5
6
|
|
|
6
7
|
import ULink from "../ui.button-link/ULink.vue";
|
|
7
8
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
@@ -66,7 +67,6 @@ const {
|
|
|
66
67
|
footerLeftAttrs,
|
|
67
68
|
footerAttrs,
|
|
68
69
|
footerRightAttrs,
|
|
69
|
-
hasSlotContent,
|
|
70
70
|
} = useAttrs(props);
|
|
71
71
|
|
|
72
72
|
const isShownModal = computed({
|
|
@@ -6,17 +6,7 @@ import type { UseAttrs } from "../types.ts";
|
|
|
6
6
|
import type { UModalProps, Config } from "./types.ts";
|
|
7
7
|
|
|
8
8
|
export default function useAttrs(props: UModalProps): UseAttrs<Config> {
|
|
9
|
-
const { config, getKeysAttrs
|
|
10
|
-
defaultConfig,
|
|
11
|
-
() => props.config,
|
|
12
|
-
"wrapper",
|
|
13
|
-
);
|
|
9
|
+
const { config, getKeysAttrs } = useUI<Config>(defaultConfig, () => props.config, "wrapper");
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return {
|
|
18
|
-
config,
|
|
19
|
-
...keysAttrs,
|
|
20
|
-
hasSlotContent,
|
|
21
|
-
};
|
|
11
|
+
return { config, ...getKeysAttrs() };
|
|
22
12
|
}
|
|
@@ -3,6 +3,7 @@ import { computed } from "vue";
|
|
|
3
3
|
import { merge } from "lodash-es";
|
|
4
4
|
|
|
5
5
|
import { getDefault } from "../utils/ui.ts";
|
|
6
|
+
import { hasSlotContent } from "../utils/helper.ts";
|
|
6
7
|
|
|
7
8
|
import UButton from "../ui.button/UButton.vue";
|
|
8
9
|
import UModal from "../ui.container-modal/UModal.vue";
|
|
@@ -49,13 +50,8 @@ const emit = defineEmits([
|
|
|
49
50
|
|
|
50
51
|
const { tm } = useLocale();
|
|
51
52
|
|
|
52
|
-
const {
|
|
53
|
-
|
|
54
|
-
footerLeftFallbackAttrs,
|
|
55
|
-
confirmModalAttrs,
|
|
56
|
-
confirmButtonAttrs,
|
|
57
|
-
cancelButtonAttrs,
|
|
58
|
-
} = useAttrs(props);
|
|
53
|
+
const { footerLeftFallbackAttrs, confirmModalAttrs, confirmButtonAttrs, cancelButtonAttrs } =
|
|
54
|
+
useAttrs(props);
|
|
59
55
|
|
|
60
56
|
const isShownModal = computed({
|
|
61
57
|
get: () => props.modelValue,
|
|
@@ -6,13 +6,7 @@ import type { UseAttrs } from "../types.ts";
|
|
|
6
6
|
import type { UModalConfirmProps, Config } from "./types.ts";
|
|
7
7
|
|
|
8
8
|
export default function useAttrs(props: UModalConfirmProps): 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
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, useSlots, onMounted } from "vue";
|
|
3
3
|
|
|
4
|
+
import { getDefault } from "../utils/ui.ts";
|
|
5
|
+
import { hasSlotContent } from "../utils/helper.ts";
|
|
4
6
|
import useBreakpoint from "../composables/useBreakpoint.ts";
|
|
5
7
|
|
|
6
8
|
import ULink from "../ui.button-link/ULink.vue";
|
|
7
9
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
8
10
|
import UHeader from "../ui.text-header/UHeader.vue";
|
|
9
11
|
|
|
10
|
-
import { getDefault } from "../utils/ui.ts";
|
|
11
|
-
|
|
12
12
|
import defaultConfig from "./config.ts";
|
|
13
13
|
import { UPage } from "./constants.ts";
|
|
14
14
|
import useAttrs from "./useAttrs.ts";
|
|
@@ -47,8 +47,7 @@ const {
|
|
|
47
47
|
footerLeftAttrs,
|
|
48
48
|
footerRightAttrs,
|
|
49
49
|
rightRoundingWrapperAttrs,
|
|
50
|
-
|
|
51
|
-
} = useAttrs(props, { isMobileBreakpoint });
|
|
50
|
+
} = useAttrs(props);
|
|
52
51
|
|
|
53
52
|
const isExistHeader = computed(() => {
|
|
54
53
|
return (
|
|
@@ -71,7 +70,7 @@ const isShownArrowButton = computed(() => {
|
|
|
71
70
|
onMounted(() => {
|
|
72
71
|
const classes = props.gray
|
|
73
72
|
? config.value.htmlBody.split(" ").filter((item) => Boolean(item))
|
|
74
|
-
:
|
|
73
|
+
: [];
|
|
75
74
|
|
|
76
75
|
document.querySelector("body").classList.add(...classes);
|
|
77
76
|
});
|
|
@@ -1,41 +1,12 @@
|
|
|
1
|
-
import { computed } from "vue";
|
|
2
1
|
import useUI from "../composables/useUI.ts";
|
|
3
|
-
import { isMobileApp } from "../utils/platform.ts";
|
|
4
2
|
|
|
5
3
|
import defaultConfig from "./config.ts";
|
|
6
4
|
|
|
7
|
-
import type { Ref } from "vue";
|
|
8
5
|
import type { UseAttrs } from "../types.ts";
|
|
9
6
|
import type { UPageProps, Config } from "./types.ts";
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
8
|
+
export default function useAttrs(props: UPageProps): UseAttrs<Config> {
|
|
9
|
+
const { config, getKeysAttrs } = useUI<Config>(defaultConfig, () => props.config, "wrapper");
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
props: UPageProps,
|
|
17
|
-
{ isMobileBreakpoint }: ComponentState,
|
|
18
|
-
): UseAttrs<Config> {
|
|
19
|
-
const { config, getKeysAttrs, hasSlotContent, getExtendingKeysClasses } = useUI<Config>(
|
|
20
|
-
defaultConfig,
|
|
21
|
-
() => props.config,
|
|
22
|
-
"wrapper",
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
const extendingKeys = ["wrapperMobile"];
|
|
26
|
-
const extendingKeysClasses = getExtendingKeysClasses(extendingKeys);
|
|
27
|
-
|
|
28
|
-
const keysAttrs = getKeysAttrs({}, extendingKeys, {
|
|
29
|
-
wrapper: {
|
|
30
|
-
extend: computed(() => [
|
|
31
|
-
isMobileBreakpoint.value && !isMobileApp && extendingKeysClasses.wrapperMobile.value,
|
|
32
|
-
]),
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
-
config,
|
|
38
|
-
...keysAttrs,
|
|
39
|
-
hasSlotContent,
|
|
40
|
-
};
|
|
11
|
+
return { config, ...getKeysAttrs() };
|
|
41
12
|
}
|
|
@@ -6,13 +6,7 @@ import type { UseAttrs } from "../types.ts";
|
|
|
6
6
|
import type { URowProps, Config } from "./types.ts";
|
|
7
7
|
|
|
8
8
|
export default function useAttrs(props: URowProps): 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
|
}
|
|
@@ -176,9 +176,11 @@ import { computed } from "vue";
|
|
|
176
176
|
import draggable from "vuedraggable";
|
|
177
177
|
import { merge } from "lodash-es";
|
|
178
178
|
|
|
179
|
+
import { getDefault } from "../utils/ui.ts";
|
|
180
|
+
import { hasSlotContent } from "../utils/helper.ts";
|
|
181
|
+
|
|
179
182
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
180
183
|
import UEmpty from "../ui.text-empty/UEmpty.vue";
|
|
181
|
-
import { getDefault } from "../utils/ui.ts";
|
|
182
184
|
|
|
183
185
|
import { UDataList as UDataListName } from "./constants.js";
|
|
184
186
|
import defaultConfig from "./config.js";
|
|
@@ -323,7 +325,6 @@ const {
|
|
|
323
325
|
deleteIconAttrs,
|
|
324
326
|
editIconAttrs,
|
|
325
327
|
dragIconAttrs,
|
|
326
|
-
hasSlotContent,
|
|
327
328
|
} = useAttrs(props);
|
|
328
329
|
const { tm } = useLocale();
|
|
329
330
|
|
package/ui.data-list/config.js
CHANGED
package/ui.data-list/useAttrs.js
CHANGED
|
@@ -1,25 +1,9 @@
|
|
|
1
1
|
import useUI from "../composables/useUI.ts";
|
|
2
2
|
|
|
3
3
|
import defaultConfig from "./config.js";
|
|
4
|
-
import { computed } from "vue";
|
|
5
4
|
|
|
6
5
|
export default function useAttrs(props) {
|
|
7
|
-
const { config, getKeysAttrs
|
|
8
|
-
defaultConfig,
|
|
9
|
-
() => props.config,
|
|
10
|
-
);
|
|
6
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
11
7
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const keysAttrs = getKeysAttrs({}, [], {
|
|
15
|
-
labelCrossed: {
|
|
16
|
-
base: computed(() => [extendingKeysClasses.label.value]),
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
config,
|
|
22
|
-
...keysAttrs,
|
|
23
|
-
hasSlotContent,
|
|
24
|
-
};
|
|
8
|
+
return { config, ...getKeysAttrs() };
|
|
25
9
|
}
|
package/ui.data-table/UTable.vue
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
onBeforeUnmount,
|
|
11
11
|
useTemplateRef,
|
|
12
12
|
} from "vue";
|
|
13
|
-
import { merge } from "lodash-es";
|
|
13
|
+
import { merge, isEqual } from "lodash-es";
|
|
14
14
|
|
|
15
15
|
import UEmpty from "../ui.text-empty/UEmpty.vue";
|
|
16
16
|
import UDivider from "../ui.container-divider/UDivider.vue";
|
|
@@ -19,6 +19,9 @@ import ULoaderProgress from "../ui.loader-progress/ULoaderProgress.vue";
|
|
|
19
19
|
import UTableRow from "./UTableRow.vue";
|
|
20
20
|
|
|
21
21
|
import { getDefault, cx } from "../utils/ui.ts";
|
|
22
|
+
import { hasSlotContent } from "../utils/helper.ts";
|
|
23
|
+
import { useLocale } from "../composables/useLocale.ts";
|
|
24
|
+
import { PX_IN_REM } from "../constants.js";
|
|
22
25
|
|
|
23
26
|
import defaultConfig from "./config.ts";
|
|
24
27
|
import {
|
|
@@ -31,14 +34,11 @@ import {
|
|
|
31
34
|
addRowId,
|
|
32
35
|
} from "./utilTable.ts";
|
|
33
36
|
|
|
34
|
-
import { PX_IN_REM } from "../constants.js";
|
|
35
37
|
import { UTable } from "./constants.ts";
|
|
36
38
|
import useAttrs from "./useAttrs.ts";
|
|
37
|
-
import { useLocale } from "../composables/useLocale.ts";
|
|
38
39
|
|
|
39
40
|
import type { Cell, Row, RowId, UTableProps, UTableRowAttrs } from "./types.ts";
|
|
40
41
|
import type { Ref, RendererElement, ComputedRef } from "vue";
|
|
41
|
-
import { isEqual } from "lodash-es";
|
|
42
42
|
|
|
43
43
|
defineOptions({ inheritAttrs: false });
|
|
44
44
|
|
|
@@ -207,6 +207,7 @@ const {
|
|
|
207
207
|
headerRowAttrs,
|
|
208
208
|
bodyRowAfterAttrs,
|
|
209
209
|
bodyRowBeforeAttrs,
|
|
210
|
+
bodyRowBeforeCheckedAttrs,
|
|
210
211
|
bodyRowBeforeCellAttrs,
|
|
211
212
|
footerAttrs,
|
|
212
213
|
bodyRowDateDividerAttrs,
|
|
@@ -227,7 +228,6 @@ const {
|
|
|
227
228
|
bodyAttrs,
|
|
228
229
|
footerRowAttrs,
|
|
229
230
|
stickyFooterRowAttrs,
|
|
230
|
-
hasSlotContent,
|
|
231
231
|
headerAttrs,
|
|
232
232
|
bodyCellContentAttrs,
|
|
233
233
|
bodyCellCheckboxAttrs,
|
|
@@ -639,7 +639,7 @@ defineExpose({
|
|
|
639
639
|
<template v-for="(row, rowIndex) in sortedRows" :key="row.id">
|
|
640
640
|
<tr
|
|
641
641
|
v-if="rowIndex === firstRow && hasSlotContent($slots['before-first-row'])"
|
|
642
|
-
v-bind="bodyRowBeforeAttrs"
|
|
642
|
+
v-bind="tableRows[0]?.isChecked ? bodyRowBeforeCheckedAttrs : bodyRowBeforeAttrs"
|
|
643
643
|
>
|
|
644
644
|
<td :colspan="colsCount" v-bind="bodyRowBeforeCellAttrs">
|
|
645
645
|
<!-- @slot Use it to add something before first row. -->
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, onMounted, useSlots, useTemplateRef } from "vue";
|
|
3
3
|
import { cx } from "../utils/ui.ts";
|
|
4
|
-
import
|
|
4
|
+
import { hasSlotContent } from "../utils/helper.ts";
|
|
5
5
|
|
|
6
6
|
import { PX_IN_REM } from "../constants.js";
|
|
7
7
|
import { mapRowColumns } from "./utilTable.ts";
|
|
@@ -11,12 +11,8 @@ import { useMutationObserver } from "../composables/useMutationObserver.ts";
|
|
|
11
11
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
12
12
|
import UCheckbox from "../ui.form-checkbox/UCheckbox.vue";
|
|
13
13
|
|
|
14
|
-
import defaultConfig from "./config.ts";
|
|
15
|
-
|
|
16
14
|
import type { Cell, CellObject, Row, RowScopedProps, UTableRowProps } from "./types.ts";
|
|
17
15
|
|
|
18
|
-
const { hasSlotContent } = useUI(defaultConfig);
|
|
19
|
-
|
|
20
16
|
const NESTED_ROW_SHIFT_REM = 1.5;
|
|
21
17
|
const LAST_NESTED_ROW_SHIFT_REM = 2;
|
|
22
18
|
|
package/ui.data-table/config.ts
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
wrapper: "relative w-full overflow-auto",
|
|
3
3
|
headerCounterBase: "mr-1.5 pr-1.5 font-medium text-sm text-gray-900",
|
|
4
|
-
stickyHeader:
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
stickyHeader: {
|
|
5
|
+
base: "fixed top-0 flex items-center z-30 overflow-hidden border rounded-none",
|
|
6
|
+
variants: {
|
|
7
|
+
actionsHeader: {
|
|
8
|
+
true: "rounded-t-dynamic border-blue-200 bg-blue-50",
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
compoundVariants: [
|
|
12
|
+
{ stickedHeader: true, actionsHeader: true, class: "rounded-none" },
|
|
13
|
+
{ stickedHeader: true, actionsHeader: false, class: "border-gray-200 bg-white" },
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
stickyHeaderCell: "{>headerCellBase} flex-none whitespace-nowrap",
|
|
7
17
|
stickyHeaderCheckbox: "{UCheckbox}",
|
|
8
18
|
stickyHeaderCounter: {
|
|
9
|
-
base: "absolute top-4 left-11 bg-gradient-to-r from-white from-80%",
|
|
19
|
+
base: "{>headerCounterBase} absolute top-4 left-11 bg-gradient-to-r from-white from-80%",
|
|
10
20
|
variants: {
|
|
11
21
|
compact: {
|
|
12
22
|
true: "top-3",
|
|
@@ -14,10 +24,8 @@ export default /*tw*/ {
|
|
|
14
24
|
},
|
|
15
25
|
},
|
|
16
26
|
stickyHeaderLoader: "{ULoaderProgress}",
|
|
17
|
-
stickyHeaderActions: "rounded-none",
|
|
18
|
-
headerActions: "rounded-t-dynamic border-blue-200 bg-blue-50",
|
|
19
27
|
headerActionsCheckbox: "{UCheckbox}",
|
|
20
|
-
headerActionsCounter: "-ml-1.5",
|
|
28
|
+
headerActionsCounter: "{>headerCounterBase} -ml-1.5",
|
|
21
29
|
tableWrapper: "border border-gray-200 rounded-dynamic bg-white",
|
|
22
30
|
table: "min-w-full border-none text-sm w-full table-auto",
|
|
23
31
|
header: "border-b border-gray-200",
|
|
@@ -30,10 +38,10 @@ export default /*tw*/ {
|
|
|
30
38
|
},
|
|
31
39
|
},
|
|
32
40
|
},
|
|
33
|
-
headerCellCheckbox: "w-10",
|
|
41
|
+
headerCellCheckbox: "{>headerCellBase} w-10",
|
|
34
42
|
headerCheckbox: "{UCheckbox}",
|
|
35
43
|
headerCounter: {
|
|
36
|
-
base: "absolute top-4 mt-px left-11 ml-px",
|
|
44
|
+
base: "{>headerCounterBase} absolute top-4 mt-px left-11 ml-px",
|
|
37
45
|
variants: {
|
|
38
46
|
compact: {
|
|
39
47
|
true: "top-3",
|
|
@@ -45,7 +53,8 @@ export default /*tw*/ {
|
|
|
45
53
|
bodyRow: "hover:bg-gray-50",
|
|
46
54
|
bodyRowChecked: "bg-gray-100 transition",
|
|
47
55
|
bodyRowBefore: "!p-0",
|
|
48
|
-
|
|
56
|
+
bodyRowBeforeChecked: "{>bodyRowChecked} !p-0",
|
|
57
|
+
bodyRowBeforeCell: "{>bodyCellBase} py-1",
|
|
49
58
|
bodyRowAfter: "!p-0",
|
|
50
59
|
bodyRowDateDivider: "",
|
|
51
60
|
bodyCellBase: {
|
|
@@ -57,7 +66,7 @@ export default /*tw*/ {
|
|
|
57
66
|
},
|
|
58
67
|
},
|
|
59
68
|
bodyCellContent: "text-ellipsis overflow-hidden",
|
|
60
|
-
bodyCellCheckbox: "first:px-4", // try to remove first
|
|
69
|
+
bodyCellCheckbox: "{>bodyCellBase} first:px-4", // try to remove first
|
|
61
70
|
bodyCellDateDivider: "",
|
|
62
71
|
bodyCellNested: "mr-2 flex gap-0.5",
|
|
63
72
|
bodyCellNestedExpandIconWrapper: "",
|
|
@@ -74,7 +83,14 @@ export default /*tw*/ {
|
|
|
74
83
|
bodyCheckbox: "{UCheckbox}",
|
|
75
84
|
bodyDateDivider: "{UDivider}",
|
|
76
85
|
bodyEmptyState: "{UEmpty} my-8",
|
|
77
|
-
footer:
|
|
86
|
+
footer: {
|
|
87
|
+
base: "group/footer border-t border-solid border-gray-200",
|
|
88
|
+
variants: {
|
|
89
|
+
stickedFooter: {
|
|
90
|
+
true: "relative group/footer-fixed",
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
78
94
|
footerRow: {
|
|
79
95
|
base: "[&_td]:p-[1.125rem] [&_td]:py-5 first:[&_td]:p-5",
|
|
80
96
|
variants: {
|
|
@@ -83,7 +99,6 @@ export default /*tw*/ {
|
|
|
83
99
|
},
|
|
84
100
|
},
|
|
85
101
|
},
|
|
86
|
-
stickyFooter: "relative group/footer-fixed",
|
|
87
102
|
stickyFooterRow: `
|
|
88
103
|
fixed bottom-0 -ml-px border border-b border-gray-200 bg-white
|
|
89
104
|
collapse group-[]/footer-fixed:[visibility:inherit]
|
|
@@ -7,7 +7,7 @@ import type { Row, UTableProps, Config } from "./types.ts";
|
|
|
7
7
|
import type { UseAttrs } from "../types.ts";
|
|
8
8
|
import type { Ref } from "vue";
|
|
9
9
|
|
|
10
|
-
export type
|
|
10
|
+
export type ComponentState = {
|
|
11
11
|
tableRows: Ref<Row[]>;
|
|
12
12
|
isShownActionsHeader: Ref<boolean>;
|
|
13
13
|
isHeaderSticky: Ref<boolean>;
|
|
@@ -16,81 +16,16 @@ export type UTableState = {
|
|
|
16
16
|
|
|
17
17
|
export default function useAttrs(
|
|
18
18
|
props: UTableProps,
|
|
19
|
-
{
|
|
19
|
+
{ isShownActionsHeader, isHeaderSticky, isFooterSticky }: ComponentState,
|
|
20
20
|
): UseAttrs<Config> {
|
|
21
|
-
const { config, getKeysAttrs
|
|
22
|
-
defaultConfig,
|
|
23
|
-
() => props.config,
|
|
24
|
-
);
|
|
21
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
25
22
|
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
];
|
|
33
|
-
const extendingKeysClasses = getExtendingKeysClasses([
|
|
34
|
-
...extendingKeys,
|
|
35
|
-
"headerCellBase",
|
|
36
|
-
"bodyCellBase",
|
|
37
|
-
"bodyRowChecked",
|
|
38
|
-
]);
|
|
23
|
+
const mutatedProps = computed(() => ({
|
|
24
|
+
/* component state, not a props */
|
|
25
|
+
actionsHeader: isShownActionsHeader.value,
|
|
26
|
+
stickedHeader: isHeaderSticky.value,
|
|
27
|
+
stickedFooter: isFooterSticky.value,
|
|
28
|
+
}));
|
|
39
29
|
|
|
40
|
-
|
|
41
|
-
stickyHeader: {
|
|
42
|
-
extend: computed(() => {
|
|
43
|
-
const classes = [];
|
|
44
|
-
|
|
45
|
-
if (isShownActionsHeader.value) {
|
|
46
|
-
classes.push(extendingKeysClasses.headerActions.value);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (isShownActionsHeader.value && isHeaderSticky.value) {
|
|
50
|
-
classes.push(extendingKeysClasses.stickyHeaderActions.value);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (!isShownActionsHeader.value && isHeaderSticky.value) {
|
|
54
|
-
classes.push(extendingKeysClasses.stickyHeaderRow.value);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return classes;
|
|
58
|
-
}),
|
|
59
|
-
},
|
|
60
|
-
stickyHeaderCell: {
|
|
61
|
-
base: computed(() => [extendingKeysClasses.headerCellBase.value]),
|
|
62
|
-
},
|
|
63
|
-
headerCounter: {
|
|
64
|
-
base: computed(() => [extendingKeysClasses.headerCounterBase.value]),
|
|
65
|
-
},
|
|
66
|
-
stickyHeaderCounter: {
|
|
67
|
-
base: computed(() => [extendingKeysClasses.headerCounterBase.value]),
|
|
68
|
-
},
|
|
69
|
-
headerActionsCounter: {
|
|
70
|
-
base: computed(() => [extendingKeysClasses.headerCounterBase.value]),
|
|
71
|
-
},
|
|
72
|
-
headerCellCheckbox: {
|
|
73
|
-
base: computed(() => [extendingKeysClasses.headerCellBase.value]),
|
|
74
|
-
},
|
|
75
|
-
bodyCellCheckbox: {
|
|
76
|
-
base: computed(() => [extendingKeysClasses.bodyCellBase.value]),
|
|
77
|
-
},
|
|
78
|
-
bodyRowBeforeCell: {
|
|
79
|
-
base: computed(() => [extendingKeysClasses.bodyCellBase.value]),
|
|
80
|
-
},
|
|
81
|
-
footer: {
|
|
82
|
-
extend: computed(() => [isFooterSticky.value && extendingKeysClasses.stickyFooter.value]),
|
|
83
|
-
},
|
|
84
|
-
bodyRowBefore: {
|
|
85
|
-
extend: computed(() => [
|
|
86
|
-
tableRows.value[0]?.isChecked && extendingKeysClasses.bodyRowChecked.value,
|
|
87
|
-
]),
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
return {
|
|
92
|
-
config,
|
|
93
|
-
...keysAttrs,
|
|
94
|
-
hasSlotContent,
|
|
95
|
-
};
|
|
30
|
+
return { config, ...getKeysAttrs(mutatedProps) };
|
|
96
31
|
}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
wrapper: "relative inline-block",
|
|
3
|
-
dropdownBadge:
|
|
4
|
-
|
|
3
|
+
dropdownBadge: {
|
|
4
|
+
component: "{UBadge}",
|
|
5
|
+
base: "transition",
|
|
6
|
+
variants: {
|
|
7
|
+
opened: {
|
|
8
|
+
true: "group ring-dynamic ring-offset-dynamic ring-{color}-700/15",
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
compoundVariants: [{ opened: true, color: ["grayscale", "white"], class: "ring-gray-700/15" }],
|
|
12
|
+
},
|
|
5
13
|
dropdownIcon: "{UIcon} transition duration-300 group-[]:rotate-180",
|
|
6
14
|
dropdownList: {
|
|
7
15
|
component: "{UDropdownList}",
|
|
@@ -7,33 +7,20 @@ import type { Ref } from "vue";
|
|
|
7
7
|
import type { Config, UDropdownBadgeProps } from "./types.ts";
|
|
8
8
|
import type { UseAttrs } from "../types.ts";
|
|
9
9
|
|
|
10
|
-
interface
|
|
10
|
+
interface ComponentState {
|
|
11
11
|
isShownOptions: Ref<boolean>;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export default function useAttrs(
|
|
15
15
|
props: UDropdownBadgeProps,
|
|
16
|
-
{ isShownOptions }:
|
|
16
|
+
{ isShownOptions }: ComponentState,
|
|
17
17
|
): UseAttrs<Config> {
|
|
18
|
-
const { config, getKeysAttrs
|
|
19
|
-
defaultConfig,
|
|
20
|
-
() => props.config,
|
|
21
|
-
);
|
|
18
|
+
const { config, getKeysAttrs } = useUI(defaultConfig, () => props.config);
|
|
22
19
|
|
|
23
|
-
const
|
|
24
|
-
|
|
20
|
+
const mutatedProps = computed(() => ({
|
|
21
|
+
/* component state, not a props */
|
|
22
|
+
opened: isShownOptions.value,
|
|
23
|
+
}));
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
dropdownBadge: {
|
|
28
|
-
extend: computed(() => [
|
|
29
|
-
isShownOptions.value && extendingKeysClasses.dropdownBadgeActive.value,
|
|
30
|
-
]),
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
config,
|
|
36
|
-
...keysAttrs,
|
|
37
|
-
hasSlotContent,
|
|
38
|
-
};
|
|
25
|
+
return { config, ...getKeysAttrs(mutatedProps) };
|
|
39
26
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
wrapper: "relative inline-block",
|
|
3
|
-
dropdownButton:
|
|
4
|
-
|
|
5
|
-
base: "group ring-dynamic ring-offset-dynamic ring-{color}-700/15",
|
|
3
|
+
dropdownButton: {
|
|
4
|
+
component: "{UButton}",
|
|
6
5
|
variants: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
opened: {
|
|
7
|
+
true: "group ring-dynamic ring-offset-dynamic ring-{color}-700/15",
|
|
8
|
+
false: "reactive-fix", // todo: remove it later
|
|
10
9
|
},
|
|
11
10
|
},
|
|
11
|
+
compoundVariants: [{ opened: true, color: ["grayscale", "white"], class: "ring-gray-700/15" }],
|
|
12
12
|
},
|
|
13
13
|
dropdownIcon: "{UIcon} transition duration-300 group-[]:rotate-180",
|
|
14
14
|
dropdownList: {
|