@v1nt1248/3nclient-lib 0.3.27 → 0.3.29
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/dist/chunks/ui3n-notification-Dr_3Td9N.js +279 -0
- package/dist/components/index.d.ts +12 -12
- package/dist/components/ui3n-autocomplete/types.d.ts +8 -0
- package/dist/components/ui3n-autocomplete/ui3n-autocomplete.d.ts +2 -2
- package/dist/components/ui3n-badge/types.d.ts +12 -0
- package/dist/components/ui3n-badge/ui3n-badge-simple.d.ts +1 -1
- package/dist/components/ui3n-badge/ui3n-badge.d.ts +1 -1
- package/dist/components/ui3n-breadcrumbs/types.d.ts +1 -1
- package/dist/components/ui3n-breadcrumbs/ui3n-breadcrumb.d.ts +2 -2
- package/dist/components/ui3n-button/types.d.ts +4 -2
- package/dist/components/ui3n-checkbox/types.d.ts +11 -0
- package/dist/components/ui3n-checkbox/ui3n-checkbox.d.ts +4 -1
- package/dist/components/ui3n-chip/types.d.ts +6 -1
- package/dist/components/ui3n-chip/ui3n-chip.d.ts +2 -0
- package/dist/components/ui3n-drop-files/types.d.ts +7 -0
- package/dist/components/ui3n-drop-files/ui3n-drop-files.d.ts +7 -1
- package/dist/components/ui3n-editable/types.d.ts +11 -0
- package/dist/components/ui3n-editable/ui3n-editable.d.ts +4 -2
- package/dist/components/ui3n-icon/types.d.ts +5 -1
- package/dist/components/ui3n-icon/ui3n-icon.d.ts +2 -2
- package/dist/components/ui3n-input/types.d.ts +4 -0
- package/dist/components/ui3n-input/ui3n-input.d.ts +4 -1
- package/dist/components/ui3n-input-file/types.d.ts +11 -0
- package/dist/components/ui3n-input-file/ui3n-input-file.d.ts +4 -1
- package/dist/components/ui3n-list/types.d.ts +4 -0
- package/dist/components/ui3n-menu/types.d.ts +4 -0
- package/dist/components/ui3n-menu/ui3n-menu.d.ts +1 -1
- package/dist/components/ui3n-notification/ui3n-notification.d.ts +2 -2
- package/dist/components/ui3n-progress/ui3n-progress-circular.d.ts +1 -1
- package/dist/components/ui3n-progress/ui3n-progress-linear.d.ts +1 -1
- package/dist/components/ui3n-radio-group/types.d.ts +18 -0
- package/dist/components/ui3n-radio-group/ui3n-radio-group.d.ts +3 -1
- package/dist/components/ui3n-radio-group/ui3n-radio.d.ts +6 -7
- package/dist/components/ui3n-scrollbar-horizontal/types.d.ts +1 -0
- package/dist/components/ui3n-scrollbar-horizontal/ui3n-scroolbar-horizontal.d.ts +1 -0
- package/dist/components/ui3n-scrollbar-vertical/types.d.ts +3 -0
- package/dist/components/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.d.ts +3 -0
- package/dist/components/ui3n-selector/types.d.ts +11 -0
- package/dist/components/ui3n-selector/ui3n-selector.d.ts +2 -2
- package/dist/components/ui3n-slider/types.d.ts +11 -0
- package/dist/components/ui3n-slider/ui3n-slider.d.ts +4 -1
- package/dist/components/ui3n-step-line-bar/types.d.ts +4 -0
- package/dist/components/ui3n-switch/types.d.ts +11 -0
- package/dist/components/ui3n-switch/ui3n-switch.d.ts +4 -1
- package/dist/components/ui3n-table/composables/useTable.d.ts +1 -0
- package/dist/components/ui3n-table/types.d.ts +4 -0
- package/dist/components/ui3n-table/ui3n-table-sort-icon.d.ts +4 -1
- package/dist/components/ui3n-tabs/types.d.ts +4 -0
- package/dist/components/ui3n-text/types.d.ts +11 -0
- package/dist/components/ui3n-text/ui3n-text.d.ts +4 -1
- package/dist/components/ui3n-tooltip/types.d.ts +4 -0
- package/dist/components/ui3n-tooltip/ui3n-tooltip.d.ts +4 -2
- package/dist/style.css +1 -1
- package/dist/ui3n-components.js +2083 -1697
- package/dist/ui3n-plugins.js +1 -1
- package/package.json +1 -1
- package/src/components/index.ts +29 -7
- package/src/components/ui3n-autocomplete/types.ts +9 -1
- package/src/components/ui3n-autocomplete/ui3n-autocomplete.vue +182 -51
- package/src/components/ui3n-badge/types.ts +10 -0
- package/src/components/ui3n-badge/ui3n-badge-simple.vue +54 -55
- package/src/components/ui3n-badge/ui3n-badge.vue +4 -0
- package/src/components/ui3n-breadcrumbs/types.ts +1 -1
- package/src/components/ui3n-breadcrumbs/ui3n-breadcrumb.vue +7 -5
- package/src/components/ui3n-button/types.ts +4 -2
- package/src/components/ui3n-button/ui3n-button.vue +24 -19
- package/src/components/ui3n-checkbox/types.ts +12 -0
- package/src/components/ui3n-checkbox/ui3n-checkbox.vue +79 -29
- package/src/components/ui3n-chip/types.ts +6 -1
- package/src/components/ui3n-chip/ui3n-chip.vue +64 -61
- package/src/components/ui3n-dialog/ui3n-dialog.vue +3 -3
- package/src/components/ui3n-drop-files/types.ts +8 -0
- package/src/components/ui3n-drop-files/ui3n-drop-files.vue +73 -29
- package/src/components/ui3n-editable/types.ts +12 -0
- package/src/components/ui3n-editable/ui3n-editable.vue +56 -24
- package/src/components/ui3n-icon/types.ts +5 -1
- package/src/components/ui3n-icon/ui3n-icon.vue +45 -50
- package/src/components/ui3n-input/types.ts +4 -0
- package/src/components/ui3n-input/ui3n-input.vue +14 -1
- package/src/components/ui3n-input-file/types.ts +12 -0
- package/src/components/ui3n-input-file/ui3n-input-file.vue +33 -16
- package/src/components/ui3n-list/types.ts +4 -0
- package/src/components/ui3n-list/ui3n-list.vue +3 -1
- package/src/components/ui3n-menu/types.ts +4 -0
- package/src/components/ui3n-menu/ui3n-menu.vue +43 -32
- package/src/components/ui3n-notification/ui3n-notification.vue +190 -175
- package/src/components/ui3n-progress/ui3n-progress-circular.vue +40 -22
- package/src/components/ui3n-progress/ui3n-progress-linear.vue +14 -7
- package/src/components/ui3n-radio-group/types.ts +20 -0
- package/src/components/ui3n-radio-group/ui3n-radio-group.vue +61 -48
- package/src/components/ui3n-radio-group/ui3n-radio.vue +60 -65
- package/src/components/ui3n-scrollbar-horizontal/types.ts +1 -0
- package/src/components/ui3n-scrollbar-horizontal/ui3n-scroolbar-horizontal.vue +8 -1
- package/src/components/ui3n-scrollbar-vertical/types.ts +3 -0
- package/src/components/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.vue +12 -5
- package/src/components/ui3n-selector/types.ts +12 -0
- package/src/components/ui3n-selector/ui3n-selector.vue +63 -40
- package/src/components/ui3n-slider/types.ts +12 -0
- package/src/components/ui3n-slider/ui3n-slider.vue +88 -39
- package/src/components/ui3n-step-line-bar/types.ts +4 -0
- package/src/components/ui3n-step-line-bar/ui3n-step-line-bar.vue +8 -10
- package/src/components/ui3n-switch/types.ts +12 -0
- package/src/components/ui3n-switch/ui3n-switch.vue +57 -25
- package/src/components/ui3n-table/composables/useTable.ts +17 -0
- package/src/components/ui3n-table/types.ts +4 -0
- package/src/components/ui3n-table/ui3n-table-sort-icon.vue +9 -8
- package/src/components/ui3n-table/ui3n-table.vue +48 -17
- package/src/components/ui3n-tabs/types.ts +4 -0
- package/src/components/ui3n-tabs/ui3n-tabs.vue +146 -108
- package/src/components/ui3n-text/types.ts +12 -0
- package/src/components/ui3n-text/ui3n-text.vue +56 -15
- package/src/components/ui3n-tooltip/types.ts +4 -0
- package/src/components/ui3n-tooltip/ui3n-tooltip.vue +61 -43
- package/src/components/ui3n-virtual-scroll/ui3n-virtual-scroll.vue +201 -17
- package/dist/chunks/ui3n-notification-DlDM-u-R.js +0 -276
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
import Ui3nIcon from '../ui3n-icon/ui3n-icon.vue';
|
|
4
4
|
import type { Ui3nTableSortIconProps } from './types';
|
|
5
5
|
|
|
6
|
-
const props = defineProps<Ui3nTableSortIconProps>()
|
|
6
|
+
const props = withDefaults(defineProps<Ui3nTableSortIconProps>(), {
|
|
7
|
+
size: 16,
|
|
8
|
+
color: 'var(--color-icon-table-primary-default)',
|
|
9
|
+
});
|
|
7
10
|
|
|
8
|
-
const
|
|
9
|
-
const iconColor = computed(() => props.color || 'var(--color-icon-table-primary-default)');
|
|
11
|
+
const iconName = computed(() => (props.value === 'asc' ? 'round-arrow-upward' : 'round-arrow-downward'));
|
|
10
12
|
</script>
|
|
11
13
|
|
|
12
14
|
<template>
|
|
@@ -15,11 +17,10 @@
|
|
|
15
17
|
name="fade"
|
|
16
18
|
>
|
|
17
19
|
<ui3n-icon
|
|
18
|
-
:key="
|
|
19
|
-
:icon="
|
|
20
|
-
:
|
|
21
|
-
:
|
|
22
|
-
:color="iconColor"
|
|
20
|
+
:key="iconName"
|
|
21
|
+
:icon="iconName"
|
|
22
|
+
:size="Number(size)"
|
|
23
|
+
:color="color"
|
|
23
24
|
/>
|
|
24
25
|
</transition>
|
|
25
26
|
</template>
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
<script setup lang="ts" generic="T extends Ui3nTableBodyBaseItem">
|
|
2
2
|
import size from 'lodash/size';
|
|
3
3
|
import { useTable } from './composables/useTable';
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
Ui3nTableBodyBaseItem,
|
|
6
|
+
Ui3nTableEmits,
|
|
7
|
+
Ui3nTableProps,
|
|
8
|
+
Ui3nTableSlots,
|
|
9
|
+
Ui3nTableExpose,
|
|
10
|
+
} from './types';
|
|
5
11
|
import Ui3nButton from '../ui3n-button/ui3n-button.vue';
|
|
6
12
|
import Ui3nCheckbox from '../ui3n-checkbox/ui3n-checkbox.vue';
|
|
7
13
|
import Ui3nTableSortIcon from './ui3n-table-sort-icon.vue';
|
|
@@ -27,6 +33,7 @@
|
|
|
27
33
|
processSelection,
|
|
28
34
|
toggleSelectedRows,
|
|
29
35
|
changeSortOrder,
|
|
36
|
+
clear,
|
|
30
37
|
} = useTable(props, emits);
|
|
31
38
|
|
|
32
39
|
const eventHandlers = {
|
|
@@ -39,6 +46,7 @@
|
|
|
39
46
|
selectedRowsArray,
|
|
40
47
|
hasGroupActionsRow,
|
|
41
48
|
closeGroupActionsRow,
|
|
49
|
+
clear,
|
|
42
50
|
});
|
|
43
51
|
</script>
|
|
44
52
|
|
|
@@ -47,6 +55,19 @@
|
|
|
47
55
|
ref="tableEl"
|
|
48
56
|
:class="$style.ui3nTable"
|
|
49
57
|
>
|
|
58
|
+
<fieldset
|
|
59
|
+
v-if="config?.tableName && selectedRowsSize > 0"
|
|
60
|
+
:class="$style.hiddenBlock"
|
|
61
|
+
>
|
|
62
|
+
<input
|
|
63
|
+
v-for="(row, rowIndex) in selectedRowsArray"
|
|
64
|
+
:key="getRowKey(row, rowIndex)"
|
|
65
|
+
type="hidden"
|
|
66
|
+
:name="config.selectable === 'multiple' ? `${config.tableName}[]` : config.tableName"
|
|
67
|
+
:value="String(getRowKey(row, rowIndex))"
|
|
68
|
+
/>
|
|
69
|
+
</fieldset>
|
|
70
|
+
|
|
50
71
|
<div :class="[$style.header, showGroupActionsRow && $style.withGroupActions]">
|
|
51
72
|
<!-- group actions -->
|
|
52
73
|
<div
|
|
@@ -112,9 +133,7 @@
|
|
|
112
133
|
<div :class="$style.body">
|
|
113
134
|
<template v-if="config?.showNoDataMessage && !size(body.content)">
|
|
114
135
|
<slot name="no-data">
|
|
115
|
-
<div :class="$style.noData">
|
|
116
|
-
No data
|
|
117
|
-
</div>
|
|
136
|
+
<div :class="$style.noData">No data</div>
|
|
118
137
|
</slot>
|
|
119
138
|
</template>
|
|
120
139
|
|
|
@@ -204,8 +223,13 @@
|
|
|
204
223
|
--ui3n-table-group-actions-bg-color: var(--color-bg-block-primary-default);
|
|
205
224
|
--ui3n-table-header-bg-color: var(--color-bg-table-header-default);
|
|
206
225
|
--ui3n-table-header-color: var(--color-text-table-primary-default);
|
|
226
|
+
--ui3n-table-header-font-size: 14px;
|
|
227
|
+
--ui3n-table-padding-inline: 16px;
|
|
207
228
|
--ui3n-table-row-color: var(--color-text-table-primary-default);
|
|
208
229
|
--ui3n-table-row-bg-color-selected: var(--color-bg-control-primary-hover);
|
|
230
|
+
--ui3n-table-row-checkbox-width: 16px;
|
|
231
|
+
--ui3n-table-cell-font-size: 12px;
|
|
232
|
+
--ui3n-table-nodata-height: 48px;
|
|
209
233
|
--ui3n-table-nodata-color: var(--color-text-control-secondary-default);
|
|
210
234
|
|
|
211
235
|
position: relative;
|
|
@@ -219,6 +243,13 @@
|
|
|
219
243
|
align-items: stretch;
|
|
220
244
|
}
|
|
221
245
|
|
|
246
|
+
.hiddenBlock {
|
|
247
|
+
display: none;
|
|
248
|
+
border: none;
|
|
249
|
+
padding: 0;
|
|
250
|
+
margin: 0;
|
|
251
|
+
}
|
|
252
|
+
|
|
222
253
|
.header {
|
|
223
254
|
position: sticky;
|
|
224
255
|
top: 0;
|
|
@@ -228,7 +259,7 @@
|
|
|
228
259
|
display: grid;
|
|
229
260
|
grid-template-columns: var(--ui3n-table-columns-width);
|
|
230
261
|
background-color: var(--ui3n-table-header-bg-color);
|
|
231
|
-
padding-left: var(--
|
|
262
|
+
padding-left: var(--ui3n-table-padding-inline);
|
|
232
263
|
z-index: 5;
|
|
233
264
|
|
|
234
265
|
&.withGroupActions {
|
|
@@ -238,7 +269,7 @@
|
|
|
238
269
|
}
|
|
239
270
|
|
|
240
271
|
.headerItemWrapper:not(:first-child) {
|
|
241
|
-
padding: 0 var(--
|
|
272
|
+
padding: 0 calc(var(--ui3n-table-padding-inline) / 4);
|
|
242
273
|
}
|
|
243
274
|
}
|
|
244
275
|
|
|
@@ -267,7 +298,7 @@
|
|
|
267
298
|
|
|
268
299
|
.headerText {
|
|
269
300
|
display: block;
|
|
270
|
-
font-size: var(--font-
|
|
301
|
+
font-size: var(--ui3n-table-header-font-size);
|
|
271
302
|
font-weight: 500;
|
|
272
303
|
color: var(--ui3n-table-header-color);
|
|
273
304
|
@include mixins.text-overflow-ellipsis();
|
|
@@ -275,7 +306,7 @@
|
|
|
275
306
|
|
|
276
307
|
.sortableActive {
|
|
277
308
|
.headerItem {
|
|
278
|
-
gap:
|
|
309
|
+
gap: 8px;
|
|
279
310
|
}
|
|
280
311
|
}
|
|
281
312
|
|
|
@@ -286,7 +317,7 @@
|
|
|
286
317
|
display: flex;
|
|
287
318
|
width: 100%;
|
|
288
319
|
height: var(--ui3n-table-group-actions-height);
|
|
289
|
-
padding: 0 var(--
|
|
320
|
+
padding: 0 var(--ui3n-table-padding-inline);
|
|
290
321
|
justify-content: space-between;
|
|
291
322
|
align-items: center;
|
|
292
323
|
background-color: var(--ui3n-table-group-actions-bg-color);
|
|
@@ -298,7 +329,7 @@
|
|
|
298
329
|
.groupActionsBody {
|
|
299
330
|
display: flex;
|
|
300
331
|
height: 100%;
|
|
301
|
-
padding: 0 var(--
|
|
332
|
+
padding: 0 calc(var(--ui3n-table-padding-inline) / 2);
|
|
302
333
|
flex-grow: 1;
|
|
303
334
|
}
|
|
304
335
|
|
|
@@ -318,7 +349,7 @@
|
|
|
318
349
|
background-color: transparent;
|
|
319
350
|
|
|
320
351
|
&:not(.customRow) {
|
|
321
|
-
padding-left: var(--
|
|
352
|
+
padding-left: var(--ui3n-table-padding-inline);
|
|
322
353
|
display: grid;
|
|
323
354
|
grid-template-columns: var(--ui3n-table-columns-width);
|
|
324
355
|
}
|
|
@@ -340,7 +371,7 @@
|
|
|
340
371
|
position: absolute;
|
|
341
372
|
top: 0;
|
|
342
373
|
left: 16px;
|
|
343
|
-
width: var(--
|
|
374
|
+
width: var(--ui3n-table-row-checkbox-width);
|
|
344
375
|
height: 100%;
|
|
345
376
|
display: flex;
|
|
346
377
|
justify-content: flex-start;
|
|
@@ -356,12 +387,12 @@
|
|
|
356
387
|
align-items: center;
|
|
357
388
|
|
|
358
389
|
&.bodyItemFirst {
|
|
359
|
-
padding-left: var(--
|
|
390
|
+
padding-left: calc(var(--ui3n-table-padding-inline) * 1.5);
|
|
360
391
|
}
|
|
361
392
|
}
|
|
362
393
|
|
|
363
394
|
.cell {
|
|
364
|
-
font-size: var(--font-
|
|
395
|
+
font-size: var(--ui3n-table-cell-font-size);
|
|
365
396
|
font-weight: 400;
|
|
366
397
|
color: var(--ui3n-table-row-color);
|
|
367
398
|
}
|
|
@@ -369,12 +400,12 @@
|
|
|
369
400
|
.noData {
|
|
370
401
|
position: relative;
|
|
371
402
|
width: 100%;
|
|
372
|
-
height: var(--
|
|
373
|
-
padding-top:
|
|
403
|
+
height: var(--ui3n-table-nodata-height);
|
|
404
|
+
padding-top: 24px;
|
|
374
405
|
display: flex;
|
|
375
406
|
justify-content: center;
|
|
376
407
|
align-items: center;
|
|
377
|
-
font-size: var(--font-
|
|
408
|
+
font-size: var(--ui3n-table-cell-font-size);
|
|
378
409
|
font-weight: 600;
|
|
379
410
|
color: var(--ui3n-table-nodata-color);
|
|
380
411
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed, onMounted, ref, watch, useCssModule } from 'vue';
|
|
3
|
-
import type { Ui3nTabsEmits, Ui3nTabsProps, Ui3nTabsSlots } from './types';
|
|
2
|
+
import { computed, nextTick, onMounted, ref, watch, useCssModule } from 'vue';
|
|
3
|
+
import type { Ui3nTabsEmits, Ui3nTabsProps, Ui3nTabsSlots } from './types';
|
|
4
4
|
|
|
5
|
-
const props = withDefaults(
|
|
6
|
-
defineProps<Ui3nTabsProps>(),
|
|
7
|
-
{
|
|
5
|
+
const props = withDefaults(defineProps<Ui3nTabsProps>(), {
|
|
8
6
|
modelValue: 0,
|
|
9
7
|
itemDirection: 'horizontal',
|
|
10
8
|
activeColor: 'var(--color-text-control-accent-default)',
|
|
@@ -12,139 +10,179 @@ const props = withDefaults(
|
|
|
12
10
|
indicatorColor: 'var(--color-border-control-accent-default)',
|
|
13
11
|
indicatorSize: 2,
|
|
14
12
|
indicatorPosition: 'normal',
|
|
15
|
-
}
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
const children = ref<HTMLCollection | null>(null);
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
13
|
+
});
|
|
14
|
+
const emits = defineEmits<Ui3nTabsEmits>();
|
|
15
|
+
defineSlots<Ui3nTabsSlots>();
|
|
16
|
+
|
|
17
|
+
const $style = useCssModule();
|
|
18
|
+
|
|
19
|
+
const tabs = ref<HTMLDivElement | null>(null);
|
|
20
|
+
const activeIndex = ref(props.modelValue);
|
|
21
|
+
const children = ref<HTMLCollection | null>(null);
|
|
22
|
+
|
|
23
|
+
const tabsStyle = computed(() => ({
|
|
24
|
+
'--ui3n-tabs-active-color': props.activeColor,
|
|
25
|
+
'--ui3n-tabs-inactive-color': props.inactiveColor,
|
|
26
|
+
'--ui3n-tabs-indicator-color': props.indicatorColor,
|
|
27
|
+
'--ui3n-tabs-indicator-size': `${props.indicatorSize}px`,
|
|
28
|
+
'--ui3n-tabs-indicator-position': props.indicatorPosition === 'reverse' ? '100%' : '0',
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
function updateChildrenAttributes(): void {
|
|
32
|
+
if (tabs.value?.children) {
|
|
33
|
+
const children = tabs.value.children;
|
|
34
|
+
for (let i = 0; i < children.length; i++) {
|
|
35
|
+
const child = children[i] as HTMLElement;
|
|
36
|
+
|
|
37
|
+
child.dataset.index = `${i}`;
|
|
38
|
+
|
|
39
|
+
if (!child.classList.contains($style.item)) {
|
|
40
|
+
child.classList.add($style.item);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (i === activeIndex.value) {
|
|
44
|
+
child.classList.add($style.active);
|
|
45
|
+
} else {
|
|
46
|
+
child.classList.remove($style.active);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
41
50
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
|
|
52
|
+
function initialTabsActivity(): void {
|
|
53
|
+
if (children.value) {
|
|
54
|
+
for (let i = 0; i < children.value.length; i++) {
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
children.value[i].dataset.index = `${i}`;
|
|
57
|
+
children.value[i].classList.add($style.item);
|
|
58
|
+
}
|
|
50
59
|
}
|
|
51
60
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
|
|
62
|
+
function setTabsActivity(index: number): void {
|
|
63
|
+
if (children.value) {
|
|
64
|
+
for (let i = 0; i < children.value.length; i++) {
|
|
65
|
+
if (i === index) {
|
|
66
|
+
children.value[i].classList.add($style.active);
|
|
67
|
+
} else {
|
|
68
|
+
children.value[i].classList.remove($style.active);
|
|
69
|
+
}
|
|
61
70
|
}
|
|
62
71
|
}
|
|
63
72
|
}
|
|
64
|
-
}
|
|
65
73
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
74
|
+
function onClick(ev: MouseEvent) {
|
|
75
|
+
const target = ev.target as HTMLElement;
|
|
76
|
+
|
|
77
|
+
const itemEl = target.closest('[data-index]') as HTMLElement | null;
|
|
78
|
+
|
|
79
|
+
if (itemEl && itemEl.dataset.index) {
|
|
80
|
+
if (itemEl.hasAttribute('disabled') || itemEl.classList.contains($style.disabled)) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const index = Number(itemEl.dataset.index);
|
|
85
|
+
|
|
86
|
+
activeIndex.value = index;
|
|
87
|
+
updateChildrenAttributes();
|
|
88
|
+
|
|
89
|
+
emits('update:modelValue', index);
|
|
90
|
+
}
|
|
71
91
|
}
|
|
72
|
-
|
|
92
|
+
|
|
93
|
+
watch(
|
|
94
|
+
() => props.modelValue,
|
|
95
|
+
newVal => {
|
|
96
|
+
if (newVal !== activeIndex.value) {
|
|
97
|
+
activeIndex.value = newVal;
|
|
98
|
+
nextTick(() => {
|
|
99
|
+
updateChildrenAttributes();
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{ immediate: true },
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
onMounted(() => {
|
|
107
|
+
updateChildrenAttributes();
|
|
108
|
+
});
|
|
73
109
|
</script>
|
|
74
110
|
|
|
75
111
|
<template>
|
|
76
112
|
<div
|
|
77
113
|
ref="tabs"
|
|
114
|
+
:id="id"
|
|
115
|
+
:style="tabsStyle"
|
|
78
116
|
:class="[$style.ui3nTabs, itemDirection === 'vertical' && $style.vertical]"
|
|
79
|
-
|
|
117
|
+
@click="onClick"
|
|
80
118
|
>
|
|
81
119
|
<slot />
|
|
82
120
|
</div>
|
|
83
121
|
</template>
|
|
84
122
|
|
|
85
123
|
<style lang="scss" module>
|
|
86
|
-
@use '../../assets/styles/mixins' as mixins;
|
|
87
|
-
|
|
88
|
-
.ui3nTabs {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
position: relative;
|
|
92
|
-
height: var(--ui3n-tabs-height);
|
|
93
|
-
display: flex;
|
|
94
|
-
justify-content: center;
|
|
95
|
-
align-items: stretch;
|
|
96
|
-
background-color: transparent;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.item {
|
|
100
|
-
cursor: pointer;
|
|
101
|
-
position: relative;
|
|
102
|
-
user-select: none;
|
|
103
|
-
color: v-bind(inactiveColorValue);
|
|
104
|
-
@include mixins.ripple(var(--color-bg-control-secondary-default));
|
|
105
|
-
|
|
106
|
-
&:hover {
|
|
107
|
-
background-color: var(--color-bg-control-secondary-default);
|
|
108
|
-
}
|
|
124
|
+
@use '../../assets/styles/mixins' as mixins;
|
|
125
|
+
|
|
126
|
+
.ui3nTabs {
|
|
127
|
+
--ui3n-tabs-height: 48px;
|
|
109
128
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
bottom: v-bind(indicatorPositionValue);
|
|
116
|
-
height: v-bind(indicatorSizeValue);
|
|
129
|
+
position: relative;
|
|
130
|
+
height: var(--ui3n-tabs-height);
|
|
131
|
+
display: flex;
|
|
132
|
+
justify-content: center;
|
|
133
|
+
align-items: stretch;
|
|
117
134
|
background-color: transparent;
|
|
118
|
-
transition: background-color 250ms ease-in-out;
|
|
119
135
|
}
|
|
120
136
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
137
|
+
.item {
|
|
138
|
+
cursor: pointer;
|
|
139
|
+
position: relative;
|
|
140
|
+
user-select: none;
|
|
141
|
+
color: var(--ui3n-tabs-inactive-color);
|
|
142
|
+
@include mixins.ripple(var(--color-bg-control-secondary-default));
|
|
143
|
+
|
|
144
|
+
&:hover {
|
|
145
|
+
background-color: var(--color-bg-control-secondary-default);
|
|
146
|
+
}
|
|
127
147
|
|
|
128
|
-
|
|
129
|
-
|
|
148
|
+
&::after {
|
|
149
|
+
position: absolute;
|
|
150
|
+
content: '';
|
|
151
|
+
left: 0;
|
|
152
|
+
width: 100%;
|
|
153
|
+
bottom: var(--ui3n-tabs-indicator-position);
|
|
154
|
+
height: var(--ui3n-tabs-indicator-size);
|
|
155
|
+
background-color: transparent;
|
|
156
|
+
transition: background-color 250ms ease-in-out;
|
|
157
|
+
}
|
|
130
158
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
159
|
+
&[disabled] {
|
|
160
|
+
opacity: 0.5;
|
|
161
|
+
cursor: default;
|
|
162
|
+
pointer-events: none;
|
|
163
|
+
}
|
|
134
164
|
}
|
|
135
|
-
}
|
|
136
165
|
|
|
137
|
-
.
|
|
138
|
-
|
|
139
|
-
flex-direction: column;
|
|
166
|
+
.active {
|
|
167
|
+
color: var(--ui3n-tabs-active-color);
|
|
140
168
|
|
|
141
|
-
.item {
|
|
142
169
|
&::after {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
170
|
+
background-color: var(--ui3n-tabs-indicator-color);
|
|
171
|
+
transition: background-color 250ms ease-in-out;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.vertical {
|
|
176
|
+
height: auto;
|
|
177
|
+
flex-direction: column;
|
|
178
|
+
|
|
179
|
+
.item {
|
|
180
|
+
&::after {
|
|
181
|
+
left: var(--ui3n-tabs-indicator-position);
|
|
182
|
+
width: var(--ui3n-tabs-indicator-size);
|
|
183
|
+
bottom: 0;
|
|
184
|
+
height: 100%;
|
|
185
|
+
}
|
|
147
186
|
}
|
|
148
187
|
}
|
|
149
|
-
}
|
|
150
188
|
</style>
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
export interface Ui3nTextProps {
|
|
2
|
+
/**
|
|
3
|
+
* Root element id
|
|
4
|
+
*/
|
|
5
|
+
id?: string;
|
|
6
|
+
/**
|
|
7
|
+
* HTML name attribute for form submission
|
|
8
|
+
*/
|
|
9
|
+
name?: string;
|
|
2
10
|
/**
|
|
3
11
|
* Text value
|
|
4
12
|
*/
|
|
@@ -86,3 +94,7 @@ export interface Ui3nTextEmits {
|
|
|
86
94
|
*/
|
|
87
95
|
(event: 'update:valid', value: boolean): void;
|
|
88
96
|
}
|
|
97
|
+
|
|
98
|
+
export interface Ui3nTextExpose {
|
|
99
|
+
clear: () => void;
|
|
100
|
+
}
|