@datametria/vue-components 2.3.1 → 2.4.1
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/README.md +625 -594
- package/dist/index.es.js +1962 -1887
- package/dist/index.umd.js +6 -6
- package/dist/src/components/DatametriaForm.vue.d.ts +1 -1
- package/dist/src/components/DatametriaInput.vue.d.ts +9 -1
- package/dist/src/components/DatametriaSelect.vue.d.ts +10 -1
- package/dist/vue-components.css +1 -1
- package/package.json +103 -102
- package/src/components/DatametriaAlert.vue +151 -133
- package/src/components/DatametriaAutocomplete.vue +250 -229
- package/src/components/DatametriaAvatar.vue +256 -238
- package/src/components/DatametriaBadge.vue +101 -96
- package/src/components/DatametriaBreadcrumb.vue +132 -128
- package/src/components/DatametriaButton.vue +191 -173
- package/src/components/DatametriaCard.vue +84 -66
- package/src/components/DatametriaCheckbox.vue +197 -193
- package/src/components/DatametriaChip.vue +159 -141
- package/src/components/DatametriaContainer.vue +70 -52
- package/src/components/DatametriaDataTable.vue +318 -300
- package/src/components/DatametriaDatePicker.vue +396 -378
- package/src/components/DatametriaDialog.vue +297 -293
- package/src/components/DatametriaDivider.vue +105 -98
- package/src/components/DatametriaDropdown.vue +356 -350
- package/src/components/DatametriaEmpty.vue +155 -151
- package/src/components/DatametriaFileUpload.vue +413 -395
- package/src/components/DatametriaFloatingBar.vue +144 -126
- package/src/components/DatametriaForm.vue +174 -156
- package/src/components/DatametriaFormItem.vue +183 -179
- package/src/components/DatametriaGrid.vue +55 -37
- package/src/components/DatametriaInput.vue +314 -263
- package/src/components/DatametriaMenu.vue +618 -600
- package/src/components/DatametriaModal.vue +147 -129
- package/src/components/DatametriaNavbar.vue +277 -223
- package/src/components/DatametriaPagination.vue +375 -371
- package/src/components/DatametriaPasswordInput.vue +446 -426
- package/src/components/DatametriaPopconfirm.vue +240 -234
- package/src/components/DatametriaProgress.vue +228 -224
- package/src/components/DatametriaRadio.vue +151 -147
- package/src/components/DatametriaResult.vue +135 -131
- package/src/components/DatametriaSelect.vue +311 -211
- package/src/components/DatametriaSidebar.vue +294 -222
- package/src/components/DatametriaSkeleton.vue +257 -234
- package/src/components/DatametriaSlider.vue +409 -391
- package/src/components/DatametriaSortableTable.vue +826 -802
- package/src/components/DatametriaSpinner.vue +114 -110
- package/src/components/DatametriaSteps.vue +318 -312
- package/src/components/DatametriaSwitch.vue +146 -142
- package/src/components/DatametriaTabPane.vue +94 -76
- package/src/components/DatametriaTable.vue +118 -100
- package/src/components/DatametriaTabs.vue +315 -297
- package/src/components/DatametriaTextarea.vue +213 -195
- package/src/components/DatametriaTimePicker.vue +317 -299
- package/src/components/DatametriaToast.vue +176 -176
- package/src/components/DatametriaTooltip.vue +421 -400
- package/src/components/DatametriaTree.vue +126 -122
- package/src/components/DatametriaTreeNode.vue +176 -172
- package/src/components/DatametriaUpload.vue +379 -361
- package/src/components/__tests__/DatametriaAlert.test.js +35 -35
- package/src/components/__tests__/DatametriaAlert.test.ts +190 -190
- package/src/components/__tests__/DatametriaAvatar.test.ts +151 -151
- package/src/components/__tests__/DatametriaBadge.test.js +29 -29
- package/src/components/__tests__/DatametriaBadge.test.ts +167 -167
- package/src/components/__tests__/DatametriaBreadcrumb.test.ts +187 -0
- package/src/components/__tests__/DatametriaButton.test.js +30 -30
- package/src/components/__tests__/DatametriaButton.test.ts +283 -283
- package/src/components/__tests__/DatametriaCard.test.ts +201 -201
- package/src/components/__tests__/DatametriaCheckbox.test.ts +204 -0
- package/src/components/__tests__/DatametriaChip.test.js +38 -38
- package/src/components/__tests__/DatametriaContainer.test.ts +52 -52
- package/src/components/__tests__/DatametriaDialog.test.ts +338 -0
- package/src/components/__tests__/DatametriaDivider.test.ts +54 -54
- package/src/components/__tests__/DatametriaDropdown.test.ts +357 -0
- package/src/components/__tests__/DatametriaEmpty.test.ts +261 -0
- package/src/components/__tests__/DatametriaFileUpload.test.ts +290 -290
- package/src/components/__tests__/DatametriaFloatingBar.test.ts +137 -137
- package/src/components/__tests__/DatametriaForm.test.ts +96 -0
- package/src/components/__tests__/DatametriaFormItem.test.ts +58 -0
- package/src/components/__tests__/DatametriaGrid.test.ts +31 -31
- package/src/components/__tests__/DatametriaInput.test.ts +72 -72
- package/src/components/__tests__/DatametriaMenu.test.ts +366 -366
- package/src/components/__tests__/DatametriaModal.test.ts +86 -86
- package/src/components/__tests__/DatametriaNavbar.test.js +48 -48
- package/src/components/__tests__/DatametriaNavbar.test.ts +203 -203
- package/src/components/__tests__/DatametriaPasswordInput.test.js +305 -305
- package/src/components/__tests__/DatametriaRadio.test.ts +195 -0
- package/src/components/__tests__/DatametriaSelect.test.ts +77 -77
- package/src/components/__tests__/DatametriaSidebar.test.ts +169 -169
- package/src/components/__tests__/DatametriaSlider.test.ts +261 -261
- package/src/components/__tests__/DatametriaSortableTable.test.js +168 -168
- package/src/components/__tests__/DatametriaSpinner.test.ts +156 -156
- package/src/components/__tests__/DatametriaSteps.test.ts +211 -0
- package/src/components/__tests__/DatametriaSwitch.test.ts +129 -0
- package/src/components/__tests__/DatametriaTabPane.test.ts +205 -0
- package/src/components/__tests__/DatametriaTable.test.ts +97 -97
- package/src/components/__tests__/DatametriaTabs.test.ts +232 -232
- package/src/components/__tests__/DatametriaToast.test.js +48 -48
- package/src/components/__tests__/DatametriaToast.test.ts +99 -99
- package/src/components/__tests__/DatametriaTree.test.ts +376 -0
- package/src/components/__tests__/index.test.ts +48 -0
- package/src/composables/useAccessibilityScale.ts +94 -94
- package/src/composables/useBreakpoints.ts +82 -82
- package/src/composables/useHapticFeedback.ts +439 -439
- package/src/composables/useRipple.ts +218 -218
- package/src/composables/useTheme.ts +5 -1
- package/src/index.ts +84 -84
- package/src/stories/Variants.stories.js +95 -95
- package/src/styles/design-tokens.css +623 -623
- package/src/theme/ThemeProvider.vue +96 -96
- package/src/theme/__tests__/ThemeProvider.test.ts +208 -208
- package/src/theme/__tests__/constants.test.ts +31 -31
- package/src/theme/__tests__/presets.test.ts +166 -166
- package/src/theme/__tests__/tokens.test.ts +155 -155
- package/src/theme/__tests__/types.test.ts +153 -153
- package/src/theme/__tests__/useTheme.test.ts +146 -146
- package/src/theme/constants.ts +14 -14
- package/src/theme/index.ts +12 -12
- package/src/theme/presets/datametria.ts +94 -94
- package/src/theme/presets/default.ts +94 -94
- package/src/theme/presets/index.ts +8 -8
- package/src/theme/tokens/colors.ts +28 -28
- package/src/theme/tokens/index.ts +47 -47
- package/src/theme/tokens/spacing.ts +21 -21
- package/src/theme/tokens/typography.ts +35 -35
- package/src/theme/types.ts +111 -111
- package/src/theme/useTheme.ts +28 -28
- package/src/types/index.ts +55 -55
|
@@ -1,143 +1,147 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<button
|
|
3
|
-
type="button"
|
|
4
|
-
role="switch"
|
|
5
|
-
class="datametria-switch"
|
|
6
|
-
:class="{
|
|
7
|
-
'is-checked': modelValue,
|
|
8
|
-
'is-disabled': disabled,
|
|
9
|
-
'is-loading': loading
|
|
10
|
-
}"
|
|
11
|
-
:aria-checked="modelValue"
|
|
12
|
-
:disabled="disabled || loading"
|
|
13
|
-
@click="handleClick"
|
|
14
|
-
>
|
|
15
|
-
<span class="datametria-switch__core" :style="coreStyle">
|
|
16
|
-
<span v-if="loading" class="datametria-switch__loading">
|
|
17
|
-
<span class="spinner"></span>
|
|
18
|
-
</span>
|
|
19
|
-
</span>
|
|
20
|
-
</button>
|
|
21
|
-
</template>
|
|
22
|
-
|
|
23
|
-
<script setup lang="ts">
|
|
24
|
-
import { computed } from 'vue'
|
|
25
|
-
|
|
26
|
-
interface Props {
|
|
27
|
-
modelValue?: boolean
|
|
28
|
-
disabled?: boolean
|
|
29
|
-
loading?: boolean
|
|
30
|
-
activeColor?: string
|
|
31
|
-
inactiveColor?: string
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
35
|
-
modelValue: false,
|
|
36
|
-
disabled: false,
|
|
37
|
-
loading: false,
|
|
38
|
-
activeColor: '#0072ce',
|
|
39
|
-
inactiveColor: '#dcdfe6'
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
const emit = defineEmits<{
|
|
43
|
-
'update:modelValue': [value: boolean]
|
|
44
|
-
change: [value: boolean]
|
|
45
|
-
}>()
|
|
46
|
-
|
|
47
|
-
const coreStyle = computed(() => ({
|
|
48
|
-
backgroundColor: props.modelValue ? props.activeColor : props.inactiveColor
|
|
49
|
-
}))
|
|
50
|
-
|
|
51
|
-
const handleClick = () => {
|
|
52
|
-
if (props.disabled || props.loading) return
|
|
53
|
-
const newValue = !props.modelValue
|
|
54
|
-
emit('update:modelValue', newValue)
|
|
55
|
-
emit('change', newValue)
|
|
56
|
-
}
|
|
57
|
-
</script>
|
|
58
|
-
|
|
59
|
-
<style scoped>
|
|
60
|
-
.datametria-switch {
|
|
61
|
-
display: inline-flex;
|
|
62
|
-
align-items: center;
|
|
63
|
-
position: relative;
|
|
64
|
-
font-size: 14px;
|
|
65
|
-
line-height: 20px;
|
|
66
|
-
height: 20px;
|
|
67
|
-
vertical-align: middle;
|
|
68
|
-
border: none;
|
|
69
|
-
background: transparent;
|
|
70
|
-
cursor: pointer;
|
|
71
|
-
padding: 0;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.datametria-switch.is-disabled {
|
|
75
|
-
cursor: not-allowed;
|
|
76
|
-
opacity: 0.5;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.datametria-switch.is-loading {
|
|
80
|
-
cursor: not-allowed;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.datametria-switch__core {
|
|
84
|
-
display: inline-block;
|
|
85
|
-
position: relative;
|
|
86
|
-
width: 40px;
|
|
87
|
-
height: 20px;
|
|
88
|
-
border-radius: 10px;
|
|
89
|
-
transition: background-color 0.3s;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.datametria-switch__core::after {
|
|
93
|
-
content: '';
|
|
94
|
-
position: absolute;
|
|
95
|
-
top: 2px;
|
|
96
|
-
left: 2px;
|
|
97
|
-
width: 16px;
|
|
98
|
-
height: 16px;
|
|
99
|
-
border-radius: 50%;
|
|
100
|
-
background-color: #fff;
|
|
101
|
-
transition: transform 0.3s;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.datametria-switch.is-checked .datametria-switch__core::after {
|
|
105
|
-
transform: translateX(20px);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.datametria-switch__loading {
|
|
109
|
-
position: absolute;
|
|
110
|
-
top: 50%;
|
|
111
|
-
left: 50%;
|
|
112
|
-
transform: translate(-50%, -50%);
|
|
113
|
-
display: flex;
|
|
114
|
-
align-items: center;
|
|
115
|
-
justify-content: center;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.spinner {
|
|
119
|
-
width: 12px;
|
|
120
|
-
height: 12px;
|
|
121
|
-
border: 2px solid #fff;
|
|
122
|
-
border-top-color: transparent;
|
|
123
|
-
border-radius: 50%;
|
|
124
|
-
animation: spin 0.6s linear infinite;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
@keyframes spin {
|
|
128
|
-
to { transform: rotate(360deg); }
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.datametria-switch:focus-visible {
|
|
132
|
-
outline: 2px solid var(--dm-
|
|
133
|
-
outline-offset: 2px;
|
|
134
|
-
border-radius: 10px;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/* Dark mode */
|
|
138
|
-
@media (prefers-color-scheme: dark) {
|
|
139
|
-
.datametria-switch__core {
|
|
140
|
-
background-color: var(--dm-bg-color-dark, #1e1e1e);
|
|
1
|
+
<template>
|
|
2
|
+
<button
|
|
3
|
+
type="button"
|
|
4
|
+
role="switch"
|
|
5
|
+
class="datametria-switch"
|
|
6
|
+
:class="{
|
|
7
|
+
'is-checked': modelValue,
|
|
8
|
+
'is-disabled': disabled,
|
|
9
|
+
'is-loading': loading
|
|
10
|
+
}"
|
|
11
|
+
:aria-checked="modelValue"
|
|
12
|
+
:disabled="disabled || loading"
|
|
13
|
+
@click="handleClick"
|
|
14
|
+
>
|
|
15
|
+
<span class="datametria-switch__core" :style="coreStyle">
|
|
16
|
+
<span v-if="loading" class="datametria-switch__loading">
|
|
17
|
+
<span class="spinner"></span>
|
|
18
|
+
</span>
|
|
19
|
+
</span>
|
|
20
|
+
</button>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script setup lang="ts">
|
|
24
|
+
import { computed } from 'vue'
|
|
25
|
+
|
|
26
|
+
interface Props {
|
|
27
|
+
modelValue?: boolean
|
|
28
|
+
disabled?: boolean
|
|
29
|
+
loading?: boolean
|
|
30
|
+
activeColor?: string
|
|
31
|
+
inactiveColor?: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
35
|
+
modelValue: false,
|
|
36
|
+
disabled: false,
|
|
37
|
+
loading: false,
|
|
38
|
+
activeColor: '#0072ce',
|
|
39
|
+
inactiveColor: '#dcdfe6'
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const emit = defineEmits<{
|
|
43
|
+
'update:modelValue': [value: boolean]
|
|
44
|
+
change: [value: boolean]
|
|
45
|
+
}>()
|
|
46
|
+
|
|
47
|
+
const coreStyle = computed(() => ({
|
|
48
|
+
backgroundColor: props.modelValue ? props.activeColor : props.inactiveColor
|
|
49
|
+
}))
|
|
50
|
+
|
|
51
|
+
const handleClick = () => {
|
|
52
|
+
if (props.disabled || props.loading) return
|
|
53
|
+
const newValue = !props.modelValue
|
|
54
|
+
emit('update:modelValue', newValue)
|
|
55
|
+
emit('change', newValue)
|
|
56
|
+
}
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<style scoped>
|
|
60
|
+
.datametria-switch {
|
|
61
|
+
display: inline-flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
position: relative;
|
|
64
|
+
font-size: 14px;
|
|
65
|
+
line-height: 20px;
|
|
66
|
+
height: 20px;
|
|
67
|
+
vertical-align: middle;
|
|
68
|
+
border: none;
|
|
69
|
+
background: transparent;
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
padding: 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.datametria-switch.is-disabled {
|
|
75
|
+
cursor: not-allowed;
|
|
76
|
+
opacity: 0.5;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.datametria-switch.is-loading {
|
|
80
|
+
cursor: not-allowed;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.datametria-switch__core {
|
|
84
|
+
display: inline-block;
|
|
85
|
+
position: relative;
|
|
86
|
+
width: 40px;
|
|
87
|
+
height: 20px;
|
|
88
|
+
border-radius: 10px;
|
|
89
|
+
transition: background-color 0.3s;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.datametria-switch__core::after {
|
|
93
|
+
content: '';
|
|
94
|
+
position: absolute;
|
|
95
|
+
top: 2px;
|
|
96
|
+
left: 2px;
|
|
97
|
+
width: 16px;
|
|
98
|
+
height: 16px;
|
|
99
|
+
border-radius: 50%;
|
|
100
|
+
background-color: #fff;
|
|
101
|
+
transition: transform 0.3s;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.datametria-switch.is-checked .datametria-switch__core::after {
|
|
105
|
+
transform: translateX(20px);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.datametria-switch__loading {
|
|
109
|
+
position: absolute;
|
|
110
|
+
top: 50%;
|
|
111
|
+
left: 50%;
|
|
112
|
+
transform: translate(-50%, -50%);
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
justify-content: center;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.spinner {
|
|
119
|
+
width: 12px;
|
|
120
|
+
height: 12px;
|
|
121
|
+
border: 2px solid #fff;
|
|
122
|
+
border-top-color: transparent;
|
|
123
|
+
border-radius: 50%;
|
|
124
|
+
animation: spin 0.6s linear infinite;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@keyframes spin {
|
|
128
|
+
to { transform: rotate(360deg); }
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.datametria-switch:focus-visible {
|
|
132
|
+
outline: 2px solid var(--dm-primary, #0072ce);
|
|
133
|
+
outline-offset: 2px;
|
|
134
|
+
border-radius: 10px;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* Dark mode */
|
|
138
|
+
@media (prefers-color-scheme: dark) {
|
|
139
|
+
.datametria-switch__core {
|
|
140
|
+
background-color: var(--dm-bg-color-dark, #1e1e1e);
|
|
141
141
|
}
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
|
|
143
|
+
[data-theme="dark"] .datametria-switch__core {
|
|
144
|
+
background-color: var(--dm-bg-color-dark, #1e1e1e);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
</style>
|
|
@@ -1,82 +1,100 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
:id="id"
|
|
4
|
-
class="datametria-tab-pane"
|
|
5
|
-
:class="{ 'is-active': active }"
|
|
6
|
-
role="tabpanel"
|
|
7
|
-
:aria-labelledby="ariaLabelledby"
|
|
8
|
-
:hidden="!active"
|
|
9
|
-
>
|
|
10
|
-
<slot v-if="lazy ? (active || wasActive) : true"></slot>
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:id="id"
|
|
4
|
+
class="datametria-tab-pane"
|
|
5
|
+
:class="{ 'is-active': active }"
|
|
6
|
+
role="tabpanel"
|
|
7
|
+
:aria-labelledby="ariaLabelledby"
|
|
8
|
+
:hidden="!active"
|
|
9
|
+
>
|
|
10
|
+
<slot v-if="lazy ? (active || wasActive) : true"></slot>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup lang="ts">
|
|
15
|
+
import { ref, watch, inject, onMounted, onBeforeUnmount, computed } from 'vue'
|
|
16
|
+
|
|
17
|
+
interface Props {
|
|
18
|
+
label: string
|
|
19
|
+
name?: string
|
|
20
|
+
disabled?: boolean
|
|
21
|
+
lazy?: boolean
|
|
22
|
+
icon?: string
|
|
23
|
+
badge?: string | number
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
27
|
+
disabled: false,
|
|
28
|
+
lazy: false
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const tabsContext = inject<any>('datametriaTabs', null)
|
|
32
|
+
const wasActive = ref(false)
|
|
33
|
+
|
|
34
|
+
const active = computed(() => {
|
|
35
|
+
if (!tabsContext) return false
|
|
36
|
+
return tabsContext.activePane.value === (props.name || props.label)
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const id = computed(() => {
|
|
40
|
+
const name = props.name || props.label
|
|
41
|
+
return `pane-${name.replace(/\s+/g, '-').toLowerCase()}`
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
const ariaLabelledby = computed(() => {
|
|
45
|
+
const name = props.name || props.label
|
|
46
|
+
return `tab-${name.replace(/\s+/g, '-').toLowerCase()}`
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
watch(active, (isActive) => {
|
|
50
|
+
if (isActive) {
|
|
51
|
+
wasActive.value = true
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
onMounted(() => {
|
|
56
|
+
if (tabsContext) {
|
|
57
|
+
tabsContext.registerPane({
|
|
58
|
+
label: props.label,
|
|
59
|
+
name: props.name || props.label,
|
|
60
|
+
disabled: props.disabled,
|
|
61
|
+
icon: props.icon,
|
|
62
|
+
badge: props.badge
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
onBeforeUnmount(() => {
|
|
68
|
+
if (tabsContext) {
|
|
69
|
+
tabsContext.unregisterPane(props.name || props.label)
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<style scoped>
|
|
75
|
+
.datametria-tab-pane {
|
|
76
|
+
display: none;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.datametria-tab-pane.is-active {
|
|
80
|
+
display: block;
|
|
81
|
+
}
|
|
13
82
|
|
|
14
|
-
|
|
15
|
-
import { ref, watch, inject, onMounted, onBeforeUnmount, computed } from 'vue'
|
|
83
|
+
/* Dark Mode Support - Hybrid Approach */
|
|
16
84
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
badge?: string | number
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
27
|
-
disabled: false,
|
|
28
|
-
lazy: false
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
const tabsContext = inject<any>('datametriaTabs', null)
|
|
32
|
-
const wasActive = ref(false)
|
|
33
|
-
|
|
34
|
-
const active = computed(() => {
|
|
35
|
-
if (!tabsContext) return false
|
|
36
|
-
return tabsContext.activePane.value === (props.name || props.label)
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
const id = computed(() => {
|
|
40
|
-
const name = props.name || props.label
|
|
41
|
-
return `pane-${name.replace(/\s+/g, '-').toLowerCase()}`
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
const ariaLabelledby = computed(() => {
|
|
45
|
-
const name = props.name || props.label
|
|
46
|
-
return `tab-${name.replace(/\s+/g, '-').toLowerCase()}`
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
watch(active, (isActive) => {
|
|
50
|
-
if (isActive) {
|
|
51
|
-
wasActive.value = true
|
|
52
|
-
}
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
onMounted(() => {
|
|
56
|
-
if (tabsContext) {
|
|
57
|
-
tabsContext.registerPane({
|
|
58
|
-
label: props.label,
|
|
59
|
-
name: props.name || props.label,
|
|
60
|
-
disabled: props.disabled,
|
|
61
|
-
icon: props.icon,
|
|
62
|
-
badge: props.badge
|
|
63
|
-
})
|
|
85
|
+
/* Fallback automático (sem JS) */
|
|
86
|
+
@media (prefers-color-scheme: dark) {
|
|
87
|
+
.datametria-tab-pane {
|
|
88
|
+
background: var(--dm-bg-color-dark, #1e1e1e);
|
|
89
|
+
color: var(--dm-text-primary-dark, #e0e0e0);
|
|
90
|
+
border-color: var(--dm-border-color-dark, #404040);
|
|
64
91
|
}
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
onBeforeUnmount(() => {
|
|
68
|
-
if (tabsContext) {
|
|
69
|
-
tabsContext.unregisterPane(props.name || props.label)
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
</script>
|
|
73
|
-
|
|
74
|
-
<style scoped>
|
|
75
|
-
.datametria-tab-pane {
|
|
76
|
-
display: none;
|
|
77
92
|
}
|
|
78
93
|
|
|
79
|
-
|
|
80
|
-
|
|
94
|
+
/* Controle manual via useTheme() */
|
|
95
|
+
[data-theme="dark"] .datametria-tab-pane {
|
|
96
|
+
background: var(--dm-bg-color-dark, #1e1e1e);
|
|
97
|
+
color: var(--dm-text-primary-dark, #e0e0e0);
|
|
98
|
+
border-color: var(--dm-border-color-dark, #404040);
|
|
81
99
|
}
|
|
82
|
-
</style>
|
|
100
|
+
</style>
|
|
@@ -1,105 +1,123 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="datametria-table">
|
|
3
|
-
<table class="datametria-table__table">
|
|
4
|
-
<thead class="datametria-table__thead">
|
|
5
|
-
<tr>
|
|
6
|
-
<th
|
|
7
|
-
v-for="column in columns"
|
|
8
|
-
:key="column.key"
|
|
9
|
-
class="datametria-table__th"
|
|
10
|
-
:style="{ width: column.width }"
|
|
11
|
-
>
|
|
12
|
-
{{ column.label }}
|
|
13
|
-
</th>
|
|
14
|
-
</tr>
|
|
15
|
-
</thead>
|
|
16
|
-
<tbody class="datametria-table__tbody">
|
|
17
|
-
<tr
|
|
18
|
-
v-for="(row, index) in data"
|
|
19
|
-
:key="index"
|
|
20
|
-
class="datametria-table__tr"
|
|
21
|
-
>
|
|
22
|
-
<td
|
|
23
|
-
v-for="column in columns"
|
|
24
|
-
:key="column.key"
|
|
25
|
-
class="datametria-table__td"
|
|
26
|
-
>
|
|
27
|
-
<slot :name="`cell-${column.key}`" :row="row" :value="row[column.key]">
|
|
28
|
-
{{ row[column.key] }}
|
|
29
|
-
</slot>
|
|
30
|
-
</td>
|
|
31
|
-
</tr>
|
|
32
|
-
</tbody>
|
|
33
|
-
</table>
|
|
34
|
-
|
|
35
|
-
<div v-if="data.length === 0" class="datametria-table__empty">
|
|
36
|
-
<slot name="empty">Nenhum dado disponível</slot>
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
</template>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="datametria-table">
|
|
3
|
+
<table class="datametria-table__table">
|
|
4
|
+
<thead class="datametria-table__thead">
|
|
5
|
+
<tr>
|
|
6
|
+
<th
|
|
7
|
+
v-for="column in columns"
|
|
8
|
+
:key="column.key"
|
|
9
|
+
class="datametria-table__th"
|
|
10
|
+
:style="{ width: column.width }"
|
|
11
|
+
>
|
|
12
|
+
{{ column.label }}
|
|
13
|
+
</th>
|
|
14
|
+
</tr>
|
|
15
|
+
</thead>
|
|
16
|
+
<tbody class="datametria-table__tbody">
|
|
17
|
+
<tr
|
|
18
|
+
v-for="(row, index) in data"
|
|
19
|
+
:key="index"
|
|
20
|
+
class="datametria-table__tr"
|
|
21
|
+
>
|
|
22
|
+
<td
|
|
23
|
+
v-for="column in columns"
|
|
24
|
+
:key="column.key"
|
|
25
|
+
class="datametria-table__td"
|
|
26
|
+
>
|
|
27
|
+
<slot :name="`cell-${column.key}`" :row="row" :value="row[column.key]">
|
|
28
|
+
{{ row[column.key] }}
|
|
29
|
+
</slot>
|
|
30
|
+
</td>
|
|
31
|
+
</tr>
|
|
32
|
+
</tbody>
|
|
33
|
+
</table>
|
|
34
|
+
|
|
35
|
+
<div v-if="data.length === 0" class="datametria-table__empty">
|
|
36
|
+
<slot name="empty">Nenhum dado disponível</slot>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script setup lang="ts">
|
|
42
|
+
interface Column {
|
|
43
|
+
key: string
|
|
44
|
+
label: string
|
|
45
|
+
width?: string
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface Props {
|
|
49
|
+
columns: Column[]
|
|
50
|
+
data: Record<string, any>[]
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
defineProps<Props>()
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<style scoped>
|
|
57
|
+
.datametria-table {
|
|
58
|
+
width: 100%;
|
|
59
|
+
overflow-x: auto;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.datametria-table__table {
|
|
63
|
+
width: 100%;
|
|
64
|
+
border-collapse: collapse;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.datametria-table__thead {
|
|
68
|
+
background: var(--dm-neutral-50, #f9fafb);
|
|
69
|
+
border-bottom: 2px solid var(--dm-neutral-200, #e5e7eb);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.datametria-table__th {
|
|
73
|
+
padding: var(--dm-spacing-3, 0.75rem) var(--dm-spacing-4, 1rem);
|
|
74
|
+
text-align: left;
|
|
75
|
+
font-size: var(--dm-font-size-sm, 0.875rem);
|
|
76
|
+
font-weight: var(--dm-font-weight-semibold, 600);
|
|
77
|
+
color: var(--dm-neutral-700, #374151);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.datametria-table__tbody {
|
|
81
|
+
background: white;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.datametria-table__tr {
|
|
85
|
+
border-bottom: 1px solid var(--dm-neutral-200, #e5e7eb);
|
|
86
|
+
transition: background 0.2s;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.datametria-table__tr:hover {
|
|
90
|
+
background: var(--dm-neutral-50, #f9fafb);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.datametria-table__td {
|
|
94
|
+
padding: var(--dm-spacing-3, 0.75rem) var(--dm-spacing-4, 1rem);
|
|
95
|
+
font-size: var(--dm-font-size-sm, 0.875rem);
|
|
96
|
+
color: var(--dm-neutral-900, #111827);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.datametria-table__empty {
|
|
100
|
+
padding: var(--dm-spacing-12, 3rem);
|
|
101
|
+
text-align: center;
|
|
102
|
+
color: var(--dm-neutral-500, #6b7280);
|
|
103
|
+
font-size: var(--dm-font-size-sm, 0.875rem);
|
|
104
|
+
}
|
|
40
105
|
|
|
41
|
-
|
|
42
|
-
interface Column {
|
|
43
|
-
key: string
|
|
44
|
-
label: string
|
|
45
|
-
width?: string
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
interface Props {
|
|
49
|
-
columns: Column[]
|
|
50
|
-
data: Record<string, any>[]
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
defineProps<Props>()
|
|
54
|
-
</script>
|
|
55
|
-
|
|
56
|
-
<style scoped>
|
|
57
|
-
.datametria-table {
|
|
58
|
-
width: 100%;
|
|
59
|
-
overflow-x: auto;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.datametria-table__table {
|
|
63
|
-
width: 100%;
|
|
64
|
-
border-collapse: collapse;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.datametria-table__thead {
|
|
68
|
-
background: var(--dm-neutral-50, #f9fafb);
|
|
69
|
-
border-bottom: 2px solid var(--dm-neutral-200, #e5e7eb);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.datametria-table__th {
|
|
73
|
-
padding: var(--dm-spacing-3, 0.75rem) var(--dm-spacing-4, 1rem);
|
|
74
|
-
text-align: left;
|
|
75
|
-
font-size: var(--dm-font-size-sm, 0.875rem);
|
|
76
|
-
font-weight: var(--dm-font-weight-semibold, 600);
|
|
77
|
-
color: var(--dm-neutral-700, #374151);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.datametria-table__tbody {
|
|
81
|
-
background: white;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.datametria-table__tr {
|
|
85
|
-
border-bottom: 1px solid var(--dm-neutral-200, #e5e7eb);
|
|
86
|
-
transition: background 0.2s;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.datametria-table__tr:hover {
|
|
90
|
-
background: var(--dm-neutral-50, #f9fafb);
|
|
91
|
-
}
|
|
106
|
+
/* Dark Mode Support - Hybrid Approach */
|
|
92
107
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
108
|
+
/* Fallback automático (sem JS) */
|
|
109
|
+
@media (prefers-color-scheme: dark) {
|
|
110
|
+
.datametria-table {
|
|
111
|
+
background: var(--dm-bg-color-dark, #1e1e1e);
|
|
112
|
+
color: var(--dm-text-primary-dark, #e0e0e0);
|
|
113
|
+
border-color: var(--dm-border-color-dark, #404040);
|
|
114
|
+
}
|
|
97
115
|
}
|
|
98
116
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
color: var(--dm-
|
|
103
|
-
|
|
117
|
+
/* Controle manual via useTheme() */
|
|
118
|
+
[data-theme="dark"] .datametria-table {
|
|
119
|
+
background: var(--dm-bg-color-dark, #1e1e1e);
|
|
120
|
+
color: var(--dm-text-primary-dark, #e0e0e0);
|
|
121
|
+
border-color: var(--dm-border-color-dark, #404040);
|
|
104
122
|
}
|
|
105
|
-
</style>
|
|
123
|
+
</style>
|