@v1nt1248/3nclient-lib 0.2.33 → 0.2.35
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 +5 -0
- package/dist/components/ui3n-dialog/types.d.ts +1 -1
- package/dist/components/ui3n-editable/types.d.ts +1 -1
- package/dist/components/ui3n-editable/ui3n-editable.vue.d.ts +1 -1
- package/dist/components/ui3n-editable/useContentEditable.d.ts +1 -1
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/useDblClickHandler.d.ts +3 -0
- package/dist/directives/index.d.ts +2 -1
- package/dist/directives/ui3n-long-press.d.ts +27 -0
- package/dist/index.d.ts +3 -2
- package/dist/style.css +1 -1
- package/dist/types/directives.types.d.ts +7 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/ui3n-components.d.ts +4 -1
- package/dist/ui3n-components.js +4879 -4810
- package/dist/ui3n-plugins.d.ts +1 -2
- package/dist/ui3n-plugins.js +2 -2
- package/dist/ui3n-utils.js +154 -144
- package/dist/utils/files/create-video-thumbnail.d.ts +1 -1
- package/dist/utils/for-vue/try-on-scope-dispose.d.ts +2 -0
- package/dist/utils/for-vue/unref-element.d.ts +2 -0
- package/dist/utils/index.d.ts +3 -1
- package/package.json +18 -13
- package/src/components/ui3n-autocomplete/ui3n-autocomplete.vue +32 -9
- package/src/components/ui3n-breadcrumbs/ui3n-breadcrumbs.vue +14 -14
- package/src/components/ui3n-button/ui3n-button.vue +229 -226
- package/src/components/ui3n-checkbox/ui3n-checkbox.vue +30 -7
- package/src/components/ui3n-chip/ui3n-chip.vue +113 -109
- package/src/components/ui3n-dialog/types.ts +1 -1
- package/src/components/ui3n-dialog/ui3n-dialog.vue +7 -8
- package/src/components/ui3n-editable/types.ts +1 -1
- package/src/components/ui3n-editable/ui3n-editable.vue +34 -12
- package/src/components/ui3n-editable/useContentEditable.ts +6 -3
- package/src/components/ui3n-icon/ui3n-icon.vue +1 -1
- package/src/components/ui3n-input/ui3n-input.vue +272 -273
- package/src/components/ui3n-input-file/ui3n-input-file.vue +2 -2
- package/src/components/ui3n-list/ui3n-list.vue +70 -60
- package/src/components/ui3n-menu/ui3n-menu.vue +1 -1
- package/src/components/ui3n-notification/ui3n-notification.vue +4 -1
- package/src/components/ui3n-progress/ui3n-progress-circular.vue +168 -147
- package/src/components/ui3n-progress/ui3n-progress-linear.vue +77 -73
- package/src/components/ui3n-radio-group/ui3n-radio.vue +178 -177
- package/src/components/ui3n-step-line-bar/ui3n-step-line-bar.vue +50 -46
- package/src/components/ui3n-switch/ui3n-switch.vue +114 -116
- package/src/components/ui3n-table/composables/useTable.ts +17 -9
- package/src/components/ui3n-table/ui3n-table-sort-icon.vue +9 -6
- package/src/components/ui3n-table/ui3n-table.vue +7 -5
- package/src/components/ui3n-text/ui3n-text.vue +157 -215
- package/src/components/ui3n-tooltip/ui3n-tooltip.vue +4 -5
- package/src/components/types/index.ts +0 -15
- /package/dist/{components/types/index.d.ts → types/components.types.d.ts} +0 -0
- /package/dist/{plugins/types.d.ts → types/plugins.types.d.ts} +0 -0
- /package/dist/utils/{for-we3n.d.ts → for-web3n.d.ts} +0 -0
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { onMounted, ref, watch, useSlots } from 'vue';
|
|
3
|
-
import type { Ui3nSwitchEmits, Ui3nSwitchProps, Ui3nSwitchSlots } from './types';
|
|
4
|
-
|
|
5
|
-
const props = withDefaults(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
const emits = defineEmits<Ui3nSwitchEmits>();
|
|
15
|
-
|
|
16
|
-
defineSlots<Ui3nSwitchSlots>();
|
|
17
|
-
|
|
18
|
-
const slots = useSlots();
|
|
19
|
-
const switchEl = ref<HTMLDivElement | null>(null);
|
|
20
|
-
const val = ref<boolean>(false);
|
|
21
|
-
|
|
22
|
-
onMounted(() => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
2
|
+
import { onMounted, ref, watch, useSlots } from 'vue';
|
|
3
|
+
import type { Ui3nSwitchEmits, Ui3nSwitchProps, Ui3nSwitchSlots } from './types';
|
|
4
|
+
|
|
5
|
+
const props = withDefaults(
|
|
6
|
+
defineProps<Ui3nSwitchProps>(),
|
|
7
|
+
{
|
|
8
|
+
size: 16,
|
|
9
|
+
color: 'var(--color-icon-control-accent-default)',
|
|
10
|
+
disabled: false,
|
|
11
|
+
},
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const emits = defineEmits<Ui3nSwitchEmits>();
|
|
15
|
+
|
|
16
|
+
defineSlots<Ui3nSwitchSlots>();
|
|
17
|
+
|
|
18
|
+
const slots = useSlots();
|
|
19
|
+
const switchEl = ref<HTMLDivElement | null>(null);
|
|
20
|
+
const val = ref<boolean>(false);
|
|
21
|
+
|
|
22
|
+
onMounted(() => {
|
|
23
|
+
if (switchEl.value) {
|
|
24
|
+
switchEl.value.style.setProperty('--ui3n-switch-color', `${props.color}`);
|
|
25
|
+
props.size && switchEl.value.style.setProperty('--ui3n-switch-size', `${props.size}px`);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
watch(
|
|
30
|
+
() => props.modelValue,
|
|
31
|
+
newValue => val.value = newValue,
|
|
32
|
+
{ immediate: true },
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
function change(ev: Event) {
|
|
36
|
+
ev.preventDefault();
|
|
37
|
+
|
|
38
|
+
val.value = !val.value;
|
|
39
|
+
emits('change', val.value);
|
|
40
|
+
emits('update:modelValue', val.value);
|
|
26
41
|
}
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
watch(
|
|
30
|
-
() => props.modelValue,
|
|
31
|
-
newValue => val.value = newValue,
|
|
32
|
-
{ immediate: true },
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
function change(ev: Event) {
|
|
36
|
-
ev.preventDefault();
|
|
37
|
-
|
|
38
|
-
val.value = !val.value;
|
|
39
|
-
emits('change', val.value);
|
|
40
|
-
emits('update:modelValue', val.value);
|
|
41
|
-
}
|
|
42
42
|
</script>
|
|
43
43
|
|
|
44
44
|
<template>
|
|
@@ -46,17 +46,15 @@ function change(ev: Event) {
|
|
|
46
46
|
ref="switchEl"
|
|
47
47
|
:class="[$style.ui3nSwitch, val && $style.checked, !slots.default && $style.noLabel, disabled && $style.disabled]"
|
|
48
48
|
>
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
</div>
|
|
59
|
-
</Transition>
|
|
49
|
+
<div
|
|
50
|
+
:class="$style.body"
|
|
51
|
+
:tabindex="disabled ? -1 : 0"
|
|
52
|
+
@keydown.enter="change"
|
|
53
|
+
@keydown.space="change"
|
|
54
|
+
@click="change"
|
|
55
|
+
>
|
|
56
|
+
<div :class="[$style.dot, val ? $style.right : $style.left]" />
|
|
57
|
+
</div>
|
|
60
58
|
|
|
61
59
|
<div :class="$style.label">
|
|
62
60
|
<slot />
|
|
@@ -65,75 +63,75 @@ function change(ev: Event) {
|
|
|
65
63
|
</template>
|
|
66
64
|
|
|
67
65
|
<style lang="scss" module>
|
|
68
|
-
.ui3nSwitch {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.body {
|
|
84
|
-
position: relative;
|
|
85
|
-
background-color: var(--ui3n-switch-off-color);
|
|
86
|
-
height: var(--ui3n-switch-size);
|
|
87
|
-
width: calc(var(--ui3n-switch-size) * 2);
|
|
88
|
-
border-radius: var(--ui3n-switch-size);
|
|
89
|
-
cursor: pointer;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.checked {
|
|
66
|
+
.ui3nSwitch {
|
|
67
|
+
--ui3n-switch-size: 16px;
|
|
68
|
+
--ui3n-switch-color: var(--color-icon-control-accent-default);
|
|
69
|
+
--ui3n-switch-off-color: var(--color-bg-table-cell-pressed);
|
|
70
|
+
--ui3n-switch-font-size: 12px;
|
|
71
|
+
--ui3n-switch-font-color: var(--color-text-control-primary-default);
|
|
72
|
+
--ui3n-switch-font-weight: 500;
|
|
73
|
+
|
|
74
|
+
position: relative;
|
|
75
|
+
display: flex;
|
|
76
|
+
justify-content: flex-start;
|
|
77
|
+
align-items: center;
|
|
78
|
+
gap: var(--spacing-s);
|
|
79
|
+
}
|
|
80
|
+
|
|
93
81
|
.body {
|
|
94
|
-
|
|
82
|
+
position: relative;
|
|
83
|
+
background-color: var(--ui3n-switch-off-color);
|
|
84
|
+
height: var(--ui3n-switch-size);
|
|
85
|
+
width: calc(var(--ui3n-switch-size) * 2);
|
|
86
|
+
border-radius: var(--ui3n-switch-size);
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.checked {
|
|
91
|
+
.body {
|
|
92
|
+
background-color: var(--ui3n-switch-color);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.dot {
|
|
96
|
+
border-color: var(--ui3n-switch-color);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.noLabel {
|
|
101
|
+
gap: 0;
|
|
95
102
|
}
|
|
96
103
|
|
|
97
104
|
.dot {
|
|
98
|
-
|
|
105
|
+
--ui3n-switch-dot-size: calc(var(--ui3n-switch-size) / 4 * 3);
|
|
106
|
+
|
|
107
|
+
position: absolute;
|
|
108
|
+
width: var(--ui3n-switch-dot-size);
|
|
109
|
+
height: var(--ui3n-switch-dot-size);
|
|
110
|
+
border-radius: 50%;
|
|
111
|
+
background-color: var(--color-bg-control-primary-default);
|
|
112
|
+
top: 0;
|
|
113
|
+
margin: calc(var(--ui3n-switch-size) / 8);
|
|
114
|
+
transition: all 250ms ease-in-out;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.left {
|
|
118
|
+
left: 0;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.right {
|
|
122
|
+
left: calc(100% - var(--ui3n-switch-size));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.label {
|
|
126
|
+
font-size: var(--ui3n-switch-font-size);
|
|
127
|
+
font-weight: var(--ui3n-switch-font-weight);
|
|
128
|
+
color: var(--ui3n-switch-font-color);
|
|
129
|
+
user-select: none;
|
|
130
|
+
cursor: pointer;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.disabled {
|
|
134
|
+
opacity: 0.7;
|
|
135
|
+
pointer-events: none;
|
|
99
136
|
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.noLabel {
|
|
103
|
-
gap: 0;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.dot {
|
|
107
|
-
--ui3n-switch-dot-size: calc(var(--ui3n-switch-size) / 4 * 3);
|
|
108
|
-
|
|
109
|
-
position: absolute;
|
|
110
|
-
width: var(--ui3n-switch-dot-size);
|
|
111
|
-
height: var(--ui3n-switch-dot-size);
|
|
112
|
-
border-radius: 50%;
|
|
113
|
-
background-color: var(--color-bg-control-primary-default);
|
|
114
|
-
top: 0;
|
|
115
|
-
margin: calc(var(--ui3n-switch-size) / 8);
|
|
116
|
-
transition: all 250ms ease-in-out;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.left {
|
|
120
|
-
left: 0;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.right {
|
|
124
|
-
left: calc(100% - var(--ui3n-switch-size));
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.label {
|
|
128
|
-
font-size: var(--ui3n-switch-font-size);
|
|
129
|
-
font-weight: var(--ui3n-switch-font-weight);
|
|
130
|
-
color: var(--ui3n-switch-font-color);
|
|
131
|
-
user-select: none;
|
|
132
|
-
cursor: pointer;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.disabled {
|
|
136
|
-
opacity: 0.7;
|
|
137
|
-
pointer-events: none;
|
|
138
|
-
}
|
|
139
137
|
</style>
|
|
@@ -15,7 +15,7 @@ export function useTable<T extends Ui3nTableBodyBaseItem>(props: Ui3nTableProps<
|
|
|
15
15
|
sortOrder: setInitialSortOrder(),
|
|
16
16
|
fieldAsRowKey: setFieldAsRowKey(),
|
|
17
17
|
});
|
|
18
|
-
const selectedRows: Ref<Set<T> | Array<T[keyof T]>> =
|
|
18
|
+
const selectedRows: Ref<Set<T> | Array<T[keyof T]>> = currentConfig.value?.fieldAsRowKey
|
|
19
19
|
? ref([])
|
|
20
20
|
: (ref(new Set()) as Ref<Set<T>>);
|
|
21
21
|
const hasGroupActionsRow = ref(false);
|
|
@@ -25,8 +25,8 @@ export function useTable<T extends Ui3nTableBodyBaseItem>(props: Ui3nTableProps<
|
|
|
25
25
|
const selectedRowsArray = computed(() =>
|
|
26
26
|
isRowKeyUsed.value
|
|
27
27
|
? props.body.content.filter(row =>
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
(selectedRows.value as Array<T[keyof T]>).includes(row[currentConfig.value.fieldAsRowKey as keyof T]),
|
|
29
|
+
)
|
|
30
30
|
: Array.from(selectedRows.value as Set<T>),
|
|
31
31
|
);
|
|
32
32
|
const selectedRowsSize = computed(() =>
|
|
@@ -53,9 +53,13 @@ export function useTable<T extends Ui3nTableBodyBaseItem>(props: Ui3nTableProps<
|
|
|
53
53
|
function setFieldAsRowKey() {
|
|
54
54
|
const { config = {}, body } = props;
|
|
55
55
|
const { fieldAsRowKey } = config;
|
|
56
|
-
if (fieldAsRowKey && fieldAsRowKey in get(body, ['content', 0], {}))
|
|
56
|
+
if (fieldAsRowKey && fieldAsRowKey in get(body, ['content', 0], {})) {
|
|
57
|
+
return fieldAsRowKey;
|
|
58
|
+
}
|
|
57
59
|
|
|
58
|
-
if ('id' in get(body, ['content', 0], {}))
|
|
60
|
+
if ('id' in get(body, ['content', 0], {})) {
|
|
61
|
+
return 'id';
|
|
62
|
+
}
|
|
59
63
|
|
|
60
64
|
return undefined;
|
|
61
65
|
}
|
|
@@ -95,7 +99,9 @@ export function useTable<T extends Ui3nTableBodyBaseItem>(props: Ui3nTableProps<
|
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
function getRowStyle(row: T): Record<string, string> {
|
|
98
|
-
if (isEmpty(props.body.rowsStyle) || !isRowKeyUsed.value)
|
|
102
|
+
if (isEmpty(props.body.rowsStyle) || !isRowKeyUsed.value) {
|
|
103
|
+
return {};
|
|
104
|
+
}
|
|
99
105
|
|
|
100
106
|
const rowKey = row[currentConfig.value.fieldAsRowKey as keyof T] as string | number;
|
|
101
107
|
// @ts-expect-error
|
|
@@ -133,7 +139,7 @@ export function useTable<T extends Ui3nTableBodyBaseItem>(props: Ui3nTableProps<
|
|
|
133
139
|
}
|
|
134
140
|
} else {
|
|
135
141
|
isRowKeyUsed.value &&
|
|
136
|
-
|
|
142
|
+
(selectedRows.value as Array<T[keyof T]>).push(row[currentConfig.value.fieldAsRowKey as keyof T]);
|
|
137
143
|
!isRowKeyUsed.value && (selectedRows.value as Set<T>).add(row);
|
|
138
144
|
}
|
|
139
145
|
}
|
|
@@ -151,9 +157,11 @@ export function useTable<T extends Ui3nTableBodyBaseItem>(props: Ui3nTableProps<
|
|
|
151
157
|
}
|
|
152
158
|
|
|
153
159
|
function toggleSelectedRows(val: Ui3nCheckboxValue) {
|
|
154
|
-
if (props.config.selectable !== 'multiple')
|
|
160
|
+
if (props.config.selectable !== 'multiple') {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
155
163
|
|
|
156
|
-
if (
|
|
164
|
+
if (val) {
|
|
157
165
|
for (const item of props.body.content) {
|
|
158
166
|
if (!isRowSelected(item)) {
|
|
159
167
|
processSelection(item, true);
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed } from 'vue'
|
|
3
|
-
import Ui3nIcon from '../ui3n-icon/ui3n-icon.vue'
|
|
2
|
+
import { computed } from 'vue';
|
|
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 = defineProps<Ui3nTableSortIconProps>();
|
|
7
7
|
|
|
8
|
-
const iconSize = computed(() => props.size ? +props.size : 16)
|
|
9
|
-
const iconColor = computed(() => props.color || 'var(--color-icon-table-primary-default)')
|
|
8
|
+
const iconSize = computed(() => props.size ? +props.size : 16);
|
|
9
|
+
const iconColor = computed(() => props.color || 'var(--color-icon-table-primary-default)');
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<template>
|
|
13
|
-
<transition
|
|
13
|
+
<transition
|
|
14
|
+
mode="out-in"
|
|
15
|
+
name="fade"
|
|
16
|
+
>
|
|
14
17
|
<ui3n-icon
|
|
15
18
|
:key="value === 'asc' ? 'round-arrow-upward' : 'round-arrow-downward'"
|
|
16
19
|
:icon="value === 'asc' ? 'round-arrow-upward' : 'round-arrow-downward'"
|
|
@@ -111,7 +111,9 @@
|
|
|
111
111
|
<div :class="$style.body">
|
|
112
112
|
<template v-if="config?.showNoDataMessage && !size(body.content)">
|
|
113
113
|
<slot name="no-data">
|
|
114
|
-
<div :class="$style.noData">
|
|
114
|
+
<div :class="$style.noData">
|
|
115
|
+
No data
|
|
116
|
+
</div>
|
|
115
117
|
</slot>
|
|
116
118
|
</template>
|
|
117
119
|
|
|
@@ -169,9 +171,9 @@
|
|
|
169
171
|
:column-style="config?.columnStyle"
|
|
170
172
|
:cell="row[col.key]"
|
|
171
173
|
>
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
174
|
+
<span :class="$style.cell">
|
|
175
|
+
{{ row[col.key] }}
|
|
176
|
+
</span>
|
|
175
177
|
</slot>
|
|
176
178
|
</div>
|
|
177
179
|
</template>
|
|
@@ -188,7 +190,7 @@
|
|
|
188
190
|
</template>
|
|
189
191
|
|
|
190
192
|
<style lang="scss" module>
|
|
191
|
-
@use '
|
|
193
|
+
@use '@/assets/styles/mixins.scss' as mixins;
|
|
192
194
|
|
|
193
195
|
.ui3nTable {
|
|
194
196
|
--ui3n-table-columns-width: auto;
|