@v1nt1248/3nclient-lib 0.3.30 → 0.3.31
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 → ui3n-notification-DPC5Ke4b.js} +96 -97
- package/dist/{components → src/components}/index.d.ts +3 -3
- package/dist/{components → src/components}/ui3n-breadcrumbs/types.d.ts +2 -0
- package/dist/{components → src/components}/ui3n-dialog/types.d.ts +1 -1
- package/dist/{components → src/components}/ui3n-editable/types.d.ts +1 -1
- package/dist/{components → src/components}/ui3n-editable/ui3n-editable.d.ts +1 -1
- package/dist/{components → src/components}/ui3n-editable/useContentEditable.d.ts +1 -1
- package/dist/{components → src/components}/ui3n-input/types.d.ts +2 -2
- package/dist/{components → src/components}/ui3n-menu/types.d.ts +16 -1
- package/dist/{components → src/components}/ui3n-menu/ui3n-menu.d.ts +2 -0
- package/dist/{components → src/components}/ui3n-mobile-menu/ui3n-mobile-menu.d.ts +2 -2
- package/dist/{components → src/components}/ui3n-notification/types.d.ts +0 -4
- package/dist/src/components/ui3n-notification/ui3n-notification-container.d.ts +11 -0
- package/dist/{components → src/components}/ui3n-notification/ui3n-notification.d.ts +1 -1
- package/dist/{components → src/components}/ui3n-progress/ui3n-progress-circular.d.ts +3 -3
- package/dist/{components → src/components}/ui3n-progress/ui3n-progress-linear.d.ts +2 -0
- package/dist/{components → src/components}/ui3n-selector/types.d.ts +1 -11
- package/dist/{components → src/components}/ui3n-step-line-bar/ui3n-step-line-bar.d.ts +1 -0
- package/dist/{components → src/components}/ui3n-switch/ui3n-switch.d.ts +2 -6
- package/dist/{components → src/components}/ui3n-table/composables/useTable.d.ts +4 -3
- package/dist/{components → src/components}/ui3n-text/ui3n-text.d.ts +1 -0
- package/dist/{components → src/components}/ui3n-tooltip/ui3n-tooltip.d.ts +1 -0
- package/dist/{index.d.ts → src/index.d.ts} +1 -1
- package/dist/{plugins → src/plugins}/dialogs/dialogs.d.ts +2 -2
- package/dist/{plugins → src/plugins}/dialogs/store-dialog.d.ts +2 -2
- package/dist/{plugins → src/plugins}/dialogs/types.d.ts +1 -1
- package/dist/{plugins → src/plugins}/notifications/store-notifications.d.ts +1 -1
- package/dist/{plugins → src/plugins}/notifications/types.d.ts +1 -1
- package/dist/{ui3n-components.d.ts → src/ui3n-components.d.ts} +1 -1
- package/dist/{ui3n-plugins.d.ts → src/ui3n-plugins.d.ts} +5 -5
- package/dist/{utils → src/utils}/files/create-video-thumbnail.d.ts +1 -1
- package/dist/{utils → src/utils}/for-vue/try-on-scope-dispose.d.ts +1 -1
- package/dist/{utils → src/utils}/for-vue/unref-element.d.ts +1 -1
- package/dist/src/utils/processes/scheduler-yield.d.ts +1 -0
- package/dist/{utils → src/utils}/processes/task-runner.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/ui3n-components.js +1402 -1392
- package/dist/ui3n-plugins.js +56 -43
- package/package.json +2 -2
- package/src/components/index.ts +9 -2
- package/src/components/ui3n-autocomplete/ui3n-autocomplete.vue +2 -1
- package/src/components/ui3n-breadcrumbs/types.ts +2 -0
- package/src/components/ui3n-breadcrumbs/ui3n-breadcrumb.vue +45 -35
- package/src/components/ui3n-breadcrumbs/ui3n-breadcrumbs.vue +12 -1
- package/src/components/ui3n-checkbox/ui3n-checkbox.vue +33 -67
- package/src/components/ui3n-editable/ui3n-editable.vue +68 -46
- package/src/components/ui3n-emoji/ui3n-emoji.vue +21 -27
- package/src/components/ui3n-icon/ui3n-icon.vue +13 -5
- package/src/components/ui3n-input/types.ts +2 -2
- package/src/components/ui3n-input/ui3n-input.vue +15 -9
- package/src/components/ui3n-menu/types.ts +19 -1
- package/src/components/ui3n-menu/ui3n-menu.vue +60 -57
- package/src/components/ui3n-mobile-menu/ui3n-mobile-menu.vue +87 -38
- package/src/components/ui3n-notification/types.ts +0 -4
- package/src/components/ui3n-notification/ui3n-notification-container.vue +62 -0
- package/src/components/ui3n-notification/ui3n-notification.vue +74 -70
- package/src/components/ui3n-progress/ui3n-progress-circular.vue +80 -120
- package/src/components/ui3n-progress/ui3n-progress-linear.vue +32 -15
- package/src/components/ui3n-radio-group/ui3n-radio-group.vue +2 -1
- package/src/components/ui3n-radio-group/ui3n-radio.vue +38 -47
- package/src/components/ui3n-scrollbar-horizontal/{ui3n-scroolbar-horizontal.vue → ui3n-scrollbar-horizontal.vue} +6 -8
- package/src/components/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.vue +10 -6
- package/src/components/ui3n-selector/types.ts +1 -10
- package/src/components/ui3n-selector/ui3n-selector.vue +49 -47
- package/src/components/ui3n-slider/ui3n-slider.vue +6 -9
- package/src/components/ui3n-step-line-bar/ui3n-step-line-bar.vue +5 -1
- package/src/components/ui3n-switch/ui3n-switch.vue +24 -19
- package/src/components/ui3n-table/composables/useTable.ts +37 -22
- package/src/components/ui3n-table/ui3n-table-sort-icon.vue +6 -1
- package/src/components/ui3n-table/ui3n-table.vue +3 -1
- package/src/components/ui3n-tabs/ui3n-tabs.vue +0 -23
- package/src/components/ui3n-text/ui3n-text.vue +36 -8
- package/src/components/ui3n-tooltip/ui3n-tooltip.vue +39 -18
- package/src/components/ui3n-virtual-scroll/ui3n-virtual-scroll.vue +2 -2
- package/dist/utils/processes/scheduler-yield.d.ts +0 -1
- /package/dist/{components → src/components}/ui3n-autocomplete/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-autocomplete/ui3n-autocomplete.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-badge/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-badge/ui3n-badge-simple.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-badge/ui3n-badge.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-breadcrumbs/ui3n-breadcrumb.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-breadcrumbs/ui3n-breadcrumbs.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-button/constants.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-button/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-button/ui3n-button.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-checkbox/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-checkbox/ui3n-checkbox.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-chip/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-chip/ui3n-chip.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-dialog/ui3n-dialog-provider.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-dialog/ui3n-dialog.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-dialog/util.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-drop-files/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-drop-files/ui3n-drop-files.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-emoji/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-emoji/ui3n-emoji.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-icon/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-icon/ui3n-icon.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-input/ui3n-input.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-input-file/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-input-file/ui3n-input-file.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-list/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-list/ui3n-list.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-mobile-menu/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-mobile-menu-item/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-mobile-menu-item/ui3n-mobile-menu-item.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-progress/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-radio-group/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-radio-group/ui3n-radio-group.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-radio-group/ui3n-radio.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-scrollbar-horizontal/types.d.ts +0 -0
- /package/dist/{components/ui3n-scrollbar-horizontal/ui3n-scroolbar-horizontal.d.ts → src/components/ui3n-scrollbar-horizontal/ui3n-scrollbar-horizontal.d.ts} +0 -0
- /package/dist/{components → src/components}/ui3n-scrollbar-vertical/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-selector/ui3n-selector.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-slider/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-slider/ui3n-slider.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-step-line-bar/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-switch/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-table/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-table/ui3n-table-sort-icon.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-table/ui3n-table.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-tabs/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-tabs/ui3n-tabs.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-text/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-tooltip/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-virtual-scroll/types.d.ts +0 -0
- /package/dist/{components → src/components}/ui3n-virtual-scroll/ui3n-virtual-scroll.d.ts +0 -0
- /package/dist/{composables → src/composables}/index.d.ts +0 -0
- /package/dist/{composables → src/composables}/useDblClickHandler.d.ts +0 -0
- /package/dist/{constants → src/constants}/emoticons.d.ts +0 -0
- /package/dist/{constants → src/constants}/general.d.ts +0 -0
- /package/dist/{constants → src/constants}/index.d.ts +0 -0
- /package/dist/{constants → src/constants}/plugins-keys.d.ts +0 -0
- /package/dist/{demo → src/demo}/constants.d.ts +0 -0
- /package/dist/{directives → src/directives}/index.d.ts +0 -0
- /package/dist/{directives → src/directives}/ui3n-click-outside.d.ts +0 -0
- /package/dist/{directives → src/directives}/ui3n-html.d.ts +0 -0
- /package/dist/{directives → src/directives}/ui3n-long-press.d.ts +0 -0
- /package/dist/{directives → src/directives}/ui3n-resize.d.ts +0 -0
- /package/dist/{directives → src/directives}/ui3n-ripple.d.ts +0 -0
- /package/dist/{directives → src/directives}/ui3n-title.d.ts +0 -0
- /package/dist/{plugins → src/plugins}/index.d.ts +0 -0
- /package/dist/{plugins → src/plugins}/notifications/notifications.d.ts +0 -0
- /package/dist/{plugins → src/plugins}/vue-bus/store-vue-bus.d.ts +0 -0
- /package/dist/{plugins → src/plugins}/vue-bus/types.d.ts +0 -0
- /package/dist/{plugins → src/plugins}/vue-bus/vue-bus.d.ts +0 -0
- /package/dist/{types → src/types}/components.types.d.ts +0 -0
- /package/dist/{types → src/types}/directives.types.d.ts +0 -0
- /package/dist/{types → src/types}/index.d.ts +0 -0
- /package/dist/{types → src/types}/plugins.types.d.ts +0 -0
- /package/dist/{types → src/types}/utils.types.d.ts +0 -0
- /package/dist/{ui3n-utils.d.ts → src/ui3n-utils.d.ts} +0 -0
- /package/dist/{utils → src/utils}/copy-to-clipboard.d.ts +0 -0
- /package/dist/{utils → src/utils}/debounce.d.ts +0 -0
- /package/dist/{utils → src/utils}/execute-function.d.ts +0 -0
- /package/dist/{utils → src/utils}/files/b64-to-blob.d.ts +0 -0
- /package/dist/{utils → src/utils}/files/blob-from-data-url.d.ts +0 -0
- /package/dist/{utils → src/utils}/files/blob-to-b64.d.ts +0 -0
- /package/dist/{utils → src/utils}/files/file-to-uint8array.d.ts +0 -0
- /package/dist/{utils → src/utils}/files/format-file-size.d.ts +0 -0
- /package/dist/{utils → src/utils}/files/get-file-extension.d.ts +0 -0
- /package/dist/{utils → src/utils}/files/is-file-archive.d.ts +0 -0
- /package/dist/{utils → src/utils}/files/is-file-audio.d.ts +0 -0
- /package/dist/{utils → src/utils}/files/is-file-image.d.ts +0 -0
- /package/dist/{utils → src/utils}/files/is-file-video.d.ts +0 -0
- /package/dist/{utils → src/utils}/files/mime-types.d.ts +0 -0
- /package/dist/{utils → src/utils}/files/resize-image.d.ts +0 -0
- /package/dist/{utils → src/utils}/files/uint8-to-data-url.d.ts +0 -0
- /package/dist/{utils → src/utils}/for-web3n.d.ts +0 -0
- /package/dist/{utils → src/utils}/get-random-id.d.ts +0 -0
- /package/dist/{utils → src/utils}/index.d.ts +0 -0
- /package/dist/{utils → src/utils}/processes/deferred.d.ts +0 -0
- /package/dist/{utils → src/utils}/processes/named-procs.d.ts +0 -0
- /package/dist/{utils → src/utils}/processes/single.d.ts +0 -0
- /package/dist/{utils → src/utils}/processes/sleep.d.ts +0 -0
- /package/dist/{utils → src/utils}/remove-whitespace-in-string.d.ts +0 -0
- /package/dist/{utils → src/utils}/round.d.ts +0 -0
- /package/dist/{utils → src/utils}/sqlite-on-3nstorage/index.d.ts +0 -0
- /package/dist/{utils → src/utils}/sqlite-on-3nstorage/types.d.ts +0 -0
- /package/dist/{utils → src/utils}/textarea-max-rows.d.ts +0 -0
- /package/dist/{utils → src/utils}/ui/capitalize.d.ts +0 -0
- /package/dist/{utils → src/utils}/ui/generate-color.d.ts +0 -0
- /package/dist/{utils → src/utils}/ui/has-slot-content.d.ts +0 -0
- /package/dist/{utils → src/utils}/ui/html2text.d.ts +0 -0
- /package/dist/{utils → src/utils}/ui/invert-color.d.ts +0 -0
- /package/dist/{utils → src/utils}/ui/mark-search.d.ts +0 -0
- /package/dist/{utils → src/utils}/ui/prepare-date-as-string.d.ts +0 -0
- /package/dist/{utils → src/utils}/ui/selection.d.ts +0 -0
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
items: () => [] as T[],
|
|
23
23
|
itemValue: 'id',
|
|
24
24
|
clearable: false,
|
|
25
|
-
withSearch: false,
|
|
26
25
|
returnObject: false,
|
|
27
26
|
noDataText: '',
|
|
28
27
|
});
|
|
@@ -37,28 +36,16 @@
|
|
|
37
36
|
const isFocused = ref(false);
|
|
38
37
|
const activeItemIndex = ref<Nullable<number>>(null);
|
|
39
38
|
|
|
40
|
-
const query = ref('');
|
|
41
|
-
const processedQuery = computed(() => query.value.toLowerCase());
|
|
42
|
-
|
|
43
39
|
const filteredItems = computed(() => {
|
|
44
|
-
return props.items
|
|
45
|
-
.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const itemDisplayingVal = getItemTitle(item, true);
|
|
51
|
-
return itemDisplayingVal.includes(processedQuery.value);
|
|
52
|
-
})
|
|
53
|
-
.filter(item => {
|
|
54
|
-
if (!props.hideSelected) {
|
|
55
|
-
return true;
|
|
56
|
-
}
|
|
40
|
+
return props.items.filter(item => {
|
|
41
|
+
if (!props.hideSelected) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
57
44
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
45
|
+
return props.returnObject
|
|
46
|
+
? (props.modelValue as T).id !== item.id
|
|
47
|
+
: (props.modelValue as T[keyof T]) !== item[props.itemValue];
|
|
48
|
+
});
|
|
62
49
|
}) as ComputedRef<T[]>;
|
|
63
50
|
|
|
64
51
|
const displayingSelection = computed(() => {
|
|
@@ -79,24 +66,23 @@
|
|
|
79
66
|
return selectedItem ? getItemTitle(selectedItem) : props.modelValue;
|
|
80
67
|
});
|
|
81
68
|
|
|
82
|
-
function getItemTitle(
|
|
83
|
-
if (!
|
|
69
|
+
function getItemTitle(item: T, withProcessing?: boolean): string {
|
|
70
|
+
if (!item || typeof item !== 'object') {
|
|
84
71
|
return '';
|
|
85
72
|
}
|
|
86
73
|
|
|
87
|
-
if (typeof value !== 'object') {
|
|
88
|
-
const val = (value as T[keyof T]).toString();
|
|
89
|
-
return withProcessing ? val.toLowerCase() : val;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
74
|
const isItemDisplayFunction = props.itemDisplay && typeof props.itemDisplay === 'function';
|
|
93
|
-
const preVal = isItemDisplayFunction
|
|
94
|
-
? (props.itemDisplay as Ui3nSelectorItemDisplayingFunction<T>)(
|
|
75
|
+
const preVal: unknown = isItemDisplayFunction
|
|
76
|
+
? (props.itemDisplay as Ui3nSelectorItemDisplayingFunction<T>)(item)
|
|
95
77
|
: props.itemDisplay
|
|
96
|
-
?
|
|
97
|
-
:
|
|
98
|
-
|
|
99
|
-
|
|
78
|
+
? item[props.itemDisplay as keyof T]
|
|
79
|
+
: item.id;
|
|
80
|
+
|
|
81
|
+
if (preVal === undefined || preVal === null) {
|
|
82
|
+
return '';
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const val = String(preVal);
|
|
100
86
|
return withProcessing ? val.toLowerCase() : val;
|
|
101
87
|
}
|
|
102
88
|
|
|
@@ -105,11 +91,15 @@
|
|
|
105
91
|
emits('focus');
|
|
106
92
|
}
|
|
107
93
|
|
|
108
|
-
function onBlur() {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
94
|
+
function onBlur(event: FocusEvent) {
|
|
95
|
+
const target = event.relatedTarget as HTMLElement;
|
|
96
|
+
|
|
97
|
+
if (activatorEl.value?.contains(target) || bodyEl.value?.contains(target)) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
isFocused.value = false;
|
|
102
|
+
emits('blur');
|
|
113
103
|
}
|
|
114
104
|
|
|
115
105
|
function onItemClick(item: T) {
|
|
@@ -119,7 +109,6 @@
|
|
|
119
109
|
|
|
120
110
|
const newValue = props.returnObject ? item : item[props.itemValue];
|
|
121
111
|
emits('update:modelValue', newValue);
|
|
122
|
-
query.value = '';
|
|
123
112
|
isMenuOpen.value = false;
|
|
124
113
|
}
|
|
125
114
|
|
|
@@ -127,7 +116,6 @@
|
|
|
127
116
|
emits('update:modelValue', null);
|
|
128
117
|
isMenuOpen.value = false;
|
|
129
118
|
activeItemIndex.value = null;
|
|
130
|
-
query.value = '';
|
|
131
119
|
}
|
|
132
120
|
|
|
133
121
|
function handlePressingDownKey() {
|
|
@@ -157,7 +145,7 @@
|
|
|
157
145
|
function handlePressingEscOrTabKeys() {
|
|
158
146
|
emits('blur');
|
|
159
147
|
isMenuOpen.value = false;
|
|
160
|
-
bodyEl.value
|
|
148
|
+
bodyEl.value?.blur();
|
|
161
149
|
activatorEl.value && activatorEl.value.blur();
|
|
162
150
|
}
|
|
163
151
|
|
|
@@ -177,7 +165,6 @@
|
|
|
177
165
|
const item = filteredItems.value[activeItemIndex.value!];
|
|
178
166
|
onItemClick(item);
|
|
179
167
|
activeItemIndex.value = null;
|
|
180
|
-
query.value = '';
|
|
181
168
|
}
|
|
182
169
|
}
|
|
183
170
|
|
|
@@ -226,6 +213,11 @@
|
|
|
226
213
|
() => isMenuOpen.value,
|
|
227
214
|
(val, oVal) => {
|
|
228
215
|
if (val !== oVal && val) {
|
|
216
|
+
if (activatorEl.value) {
|
|
217
|
+
const rect = activatorEl.value.getBoundingClientRect();
|
|
218
|
+
activatorEl.value.style.setProperty('--ui3n-selector-width', `${rect.width}px`);
|
|
219
|
+
}
|
|
220
|
+
|
|
229
221
|
if (props.modelValue) {
|
|
230
222
|
const selectedItemIndex = filteredItems.value.findIndex(item => {
|
|
231
223
|
if (typeof props.modelValue === 'object') {
|
|
@@ -240,7 +232,6 @@
|
|
|
240
232
|
emits('list:open');
|
|
241
233
|
} else if (val !== oVal && !val) {
|
|
242
234
|
activeItemIndex.value = null;
|
|
243
|
-
query.value = '';
|
|
244
235
|
emits('list:close');
|
|
245
236
|
}
|
|
246
237
|
},
|
|
@@ -272,13 +263,20 @@
|
|
|
272
263
|
:offset-y="4"
|
|
273
264
|
position-autoupdate
|
|
274
265
|
:content-border-radius="8"
|
|
275
|
-
:content-styles="{ width: '100%' }"
|
|
266
|
+
:content-styles="{ width: '100%', minWidth: 'var(--ui3n-selector-width, 200px)' }"
|
|
276
267
|
:class="$style.menu"
|
|
277
268
|
:disabled="disabled"
|
|
269
|
+
@click="
|
|
270
|
+
() => {
|
|
271
|
+
if (!disabled) {
|
|
272
|
+
isMenuOpen = !isMenuOpen;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
"
|
|
278
276
|
>
|
|
279
277
|
<div
|
|
280
278
|
ref="activator"
|
|
281
|
-
tabindex="0"
|
|
279
|
+
:tabindex="disabled ? -1 : 0"
|
|
282
280
|
:class="[
|
|
283
281
|
$style.trigger,
|
|
284
282
|
isFocused && $style.triggerFocused,
|
|
@@ -313,6 +311,7 @@
|
|
|
313
311
|
:disabled="disabled"
|
|
314
312
|
:class="$style.clearBtn"
|
|
315
313
|
@click.stop.prevent="resetValue"
|
|
314
|
+
@mousedown.stop.prevent
|
|
316
315
|
/>
|
|
317
316
|
|
|
318
317
|
<ui3n-icon
|
|
@@ -349,7 +348,6 @@
|
|
|
349
348
|
:item="item"
|
|
350
349
|
:index="index"
|
|
351
350
|
:active-index="activeItemIndex"
|
|
352
|
-
:query="query"
|
|
353
351
|
>
|
|
354
352
|
{{ getItemTitle(item) }}
|
|
355
353
|
</slot>
|
|
@@ -384,6 +382,7 @@
|
|
|
384
382
|
--ui3n-selector-item-padding: 4px;
|
|
385
383
|
--ui3n-selector-item-font-size: 13px;
|
|
386
384
|
--ui3n-selector-item-border-radius: 4px;
|
|
385
|
+
--ui3n-selector-body-padding: 4px;
|
|
387
386
|
|
|
388
387
|
position: relative;
|
|
389
388
|
width: 100%;
|
|
@@ -466,6 +465,9 @@
|
|
|
466
465
|
width: 100%;
|
|
467
466
|
background-color: var(--color-bg-block-primary-default);
|
|
468
467
|
padding: var(--ui3n-selector-body-padding);
|
|
468
|
+
box-shadow: 0 4px 12px var(--shadow-close);
|
|
469
|
+
border: 1px solid var(--color-border-control-tritery-default);
|
|
470
|
+
border-radius: 8px;
|
|
469
471
|
|
|
470
472
|
.noData {
|
|
471
473
|
display: flex;
|
|
@@ -75,14 +75,10 @@
|
|
|
75
75
|
}) as ComputedRef<Record<string, string>>;
|
|
76
76
|
|
|
77
77
|
const pointer1PositionCss = computed(() =>
|
|
78
|
-
props.range
|
|
79
|
-
? `calc(${activeBlockStyle.value.left} - calc(${thumbSizeCss.value} / 2))`
|
|
80
|
-
: `calc(${activeBlockStyle.value.width} - calc(${thumbSizeCss.value} / 2))`,
|
|
78
|
+
props.range ? `calc(${activeBlockStyle.value.left} + 1px)` : `${activeBlockStyle.value.width}`,
|
|
81
79
|
);
|
|
82
80
|
const pointer2PositionCss = computed(() =>
|
|
83
|
-
props.range
|
|
84
|
-
? `calc(${activeBlockStyle.value.width} + ${activeBlockStyle.value.left} - calc(${thumbSizeCss.value} / 2))`
|
|
85
|
-
: '200%',
|
|
81
|
+
props.range ? `calc(${activeBlockStyle.value.width} + ${activeBlockStyle.value.left} - 1px)` : '200%',
|
|
86
82
|
);
|
|
87
83
|
|
|
88
84
|
const label1Text = computed(() => {
|
|
@@ -312,7 +308,7 @@
|
|
|
312
308
|
:model-value="showLabel['1']"
|
|
313
309
|
:content="label1Text"
|
|
314
310
|
trigger="manual"
|
|
315
|
-
placement="top
|
|
311
|
+
placement="top"
|
|
316
312
|
position-strategy="absolute"
|
|
317
313
|
:color="labelColor"
|
|
318
314
|
:text-color="labelTextColor"
|
|
@@ -336,7 +332,7 @@
|
|
|
336
332
|
:model-value="showLabel['2']"
|
|
337
333
|
:content="label2Text"
|
|
338
334
|
trigger="manual"
|
|
339
|
-
placement="top
|
|
335
|
+
placement="top"
|
|
340
336
|
position-strategy="absolute"
|
|
341
337
|
:color="labelColor"
|
|
342
338
|
:text-color="labelTextColor"
|
|
@@ -381,7 +377,8 @@
|
|
|
381
377
|
|
|
382
378
|
.pointerWrapper {
|
|
383
379
|
position: absolute;
|
|
384
|
-
top:
|
|
380
|
+
//top: calc(var(--ui3n-slider-track-height) / 2 * -1);
|
|
381
|
+
top: calc(var(--ui3n-slider-track-height) * -1);
|
|
385
382
|
width: var(--ui3n-slider-thumb-size);
|
|
386
383
|
height: var(--ui3n-slider-thumb-size);
|
|
387
384
|
border-radius: 50%;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
+
import { computed } from 'vue';
|
|
2
3
|
import type { Ui3nStepLineBarProps } from './types';
|
|
3
4
|
|
|
4
5
|
const props = withDefaults(defineProps<Ui3nStepLineBarProps>(), {
|
|
6
|
+
steps: 1,
|
|
5
7
|
current: 1,
|
|
6
8
|
});
|
|
9
|
+
|
|
10
|
+
const validatedSteps = computed(() => Math.max(0, Math.floor(props.steps)));
|
|
7
11
|
</script>
|
|
8
12
|
|
|
9
13
|
<template>
|
|
@@ -17,7 +21,7 @@
|
|
|
17
21
|
|
|
18
22
|
<div :class="$style.body">
|
|
19
23
|
<div
|
|
20
|
-
v-for="step in
|
|
24
|
+
v-for="step in validatedSteps"
|
|
21
25
|
:key="step"
|
|
22
26
|
:class="[$style.step, step <= current && $style.active]"
|
|
23
27
|
/>
|
|
@@ -10,11 +10,9 @@
|
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
const emits = defineEmits<Ui3nSwitchEmits>();
|
|
13
|
-
|
|
14
13
|
defineSlots<Ui3nSwitchSlots>();
|
|
15
14
|
|
|
16
15
|
const slots = useSlots();
|
|
17
|
-
const switchEl = ref<HTMLDivElement | null>(null);
|
|
18
16
|
const val = ref<boolean>(false);
|
|
19
17
|
|
|
20
18
|
const switchStyle = computed(() => ({
|
|
@@ -24,6 +22,9 @@
|
|
|
24
22
|
|
|
25
23
|
function change(ev: Event) {
|
|
26
24
|
ev.preventDefault();
|
|
25
|
+
if (props.disabled) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
27
28
|
|
|
28
29
|
val.value = !val.value;
|
|
29
30
|
emits('change', val.value);
|
|
@@ -58,15 +59,18 @@
|
|
|
58
59
|
|
|
59
60
|
<template>
|
|
60
61
|
<div
|
|
61
|
-
ref="switchEl"
|
|
62
62
|
:id="id"
|
|
63
63
|
:style="switchStyle"
|
|
64
|
+
:tabindex="disabled ? -1 : 0"
|
|
64
65
|
:class="[
|
|
65
66
|
$style.ui3nSwitch,
|
|
66
67
|
val && $style.checked,
|
|
67
68
|
!slots.default && $style.noLabel,
|
|
68
69
|
disabled && $style.disabled,
|
|
69
70
|
]"
|
|
71
|
+
@keydown.enter="change"
|
|
72
|
+
@keydown.space="change"
|
|
73
|
+
@click="change"
|
|
70
74
|
>
|
|
71
75
|
<input
|
|
72
76
|
v-if="name"
|
|
@@ -78,13 +82,7 @@
|
|
|
78
82
|
:value="val ? 'on' : ''"
|
|
79
83
|
/>
|
|
80
84
|
|
|
81
|
-
<div
|
|
82
|
-
:class="$style.body"
|
|
83
|
-
:tabindex="disabled ? -1 : 0"
|
|
84
|
-
@keydown.enter="change"
|
|
85
|
-
@keydown.space="change"
|
|
86
|
-
@click="change"
|
|
87
|
-
>
|
|
85
|
+
<div :class="$style.body">
|
|
88
86
|
<div :class="[$style.dot, val ? $style.right : $style.left]" />
|
|
89
87
|
</div>
|
|
90
88
|
|
|
@@ -104,10 +102,17 @@
|
|
|
104
102
|
--ui3n-switch-font-weight: 500;
|
|
105
103
|
|
|
106
104
|
position: relative;
|
|
107
|
-
display: flex;
|
|
105
|
+
display: inline-flex;
|
|
108
106
|
justify-content: flex-start;
|
|
109
107
|
align-items: center;
|
|
110
108
|
gap: 8px;
|
|
109
|
+
cursor: pointer;
|
|
110
|
+
|
|
111
|
+
&:focus-visible {
|
|
112
|
+
outline: 2px solid var(--color-border-control-accent-focused);
|
|
113
|
+
outline-offset: 4px;
|
|
114
|
+
border-radius: 4px;
|
|
115
|
+
}
|
|
111
116
|
}
|
|
112
117
|
|
|
113
118
|
.body {
|
|
@@ -116,7 +121,7 @@
|
|
|
116
121
|
height: var(--ui3n-switch-size);
|
|
117
122
|
width: calc(var(--ui3n-switch-size) * 2);
|
|
118
123
|
border-radius: var(--ui3n-switch-size);
|
|
119
|
-
|
|
124
|
+
transition: background-color 0.2s ease;
|
|
120
125
|
}
|
|
121
126
|
|
|
122
127
|
.checked {
|
|
@@ -135,23 +140,23 @@
|
|
|
135
140
|
|
|
136
141
|
.dot {
|
|
137
142
|
--ui3n-switch-dot-size: calc(var(--ui3n-switch-size) / 4 * 3);
|
|
143
|
+
--ui3n-switch-dot-margin: calc(var(--ui3n-switch-size) / 8);
|
|
138
144
|
|
|
139
145
|
position: absolute;
|
|
140
146
|
width: var(--ui3n-switch-dot-size);
|
|
141
147
|
height: var(--ui3n-switch-dot-size);
|
|
142
148
|
border-radius: 50%;
|
|
143
149
|
background-color: var(--color-bg-control-primary-default);
|
|
144
|
-
top:
|
|
145
|
-
|
|
146
|
-
transition: all 250ms ease-in-out;
|
|
150
|
+
top: var(--ui3n-switch-dot-margin);
|
|
151
|
+
transition: left 200ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
147
152
|
}
|
|
148
153
|
|
|
149
154
|
.left {
|
|
150
|
-
left:
|
|
155
|
+
left: var(--ui3n-switch-dot-margin);
|
|
151
156
|
}
|
|
152
157
|
|
|
153
158
|
.right {
|
|
154
|
-
left: calc(100% - var(--ui3n-switch-size));
|
|
159
|
+
left: calc(100% - var(--ui3n-switch-dot-size) - var(--ui3n-switch-dot-margin));
|
|
155
160
|
}
|
|
156
161
|
|
|
157
162
|
.label {
|
|
@@ -159,11 +164,11 @@
|
|
|
159
164
|
font-weight: var(--ui3n-switch-font-weight);
|
|
160
165
|
color: var(--ui3n-switch-font-color);
|
|
161
166
|
user-select: none;
|
|
162
|
-
cursor: pointer;
|
|
163
167
|
}
|
|
164
168
|
|
|
165
169
|
.disabled {
|
|
166
|
-
opacity: 0.
|
|
170
|
+
opacity: 0.5;
|
|
167
171
|
pointer-events: none;
|
|
172
|
+
cursor: not-allowed;
|
|
168
173
|
}
|
|
169
174
|
</style>
|
|
@@ -2,6 +2,7 @@ import { computed, type Ref, ref, watch, UnwrapRef } from 'vue';
|
|
|
2
2
|
import get from 'lodash/get';
|
|
3
3
|
import isEmpty from 'lodash/isEmpty';
|
|
4
4
|
import size from 'lodash/size';
|
|
5
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
5
6
|
import {
|
|
6
7
|
Ui3nTableBodyBaseItem,
|
|
7
8
|
Ui3nTableConfig,
|
|
@@ -43,7 +44,7 @@ export function useTable<T extends Ui3nTableBodyBaseItem>(props: Ui3nTableProps<
|
|
|
43
44
|
|
|
44
45
|
const { config = {}, head } = props;
|
|
45
46
|
const { columnStyle } = config;
|
|
46
|
-
const keys = head.map(h => h.key);
|
|
47
|
+
const keys = head.filter(h => !h.hidden).map(h => h.key);
|
|
47
48
|
return keys.reduce((res, key, index) => {
|
|
48
49
|
const width = get(columnStyle, [key, 'width'], '1fr');
|
|
49
50
|
res = index === 0 ? `${width}` : `${res} ${width}`;
|
|
@@ -79,7 +80,7 @@ export function useTable<T extends Ui3nTableBodyBaseItem>(props: Ui3nTableProps<
|
|
|
79
80
|
const { config = {}, head } = props;
|
|
80
81
|
const { sortOrder } = config;
|
|
81
82
|
if (!isEmpty(sortOrder)) {
|
|
82
|
-
return sortOrder;
|
|
83
|
+
return cloneDeep(sortOrder);
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
for (const h of head) {
|
|
@@ -146,12 +147,16 @@ export function useTable<T extends Ui3nTableBodyBaseItem>(props: Ui3nTableProps<
|
|
|
146
147
|
const index = (selectedRows.value as Array<T[keyof T]>).findIndex(
|
|
147
148
|
keyValue => keyValue === row[currentConfig.value.fieldAsRowKey as keyof T],
|
|
148
149
|
);
|
|
149
|
-
|
|
150
|
+
if (index !== -1) {
|
|
151
|
+
(selectedRows.value as Array<T[keyof T]>).splice(index, 1);
|
|
152
|
+
}
|
|
150
153
|
}
|
|
151
154
|
} else {
|
|
152
|
-
isRowKeyUsed.value
|
|
155
|
+
if (isRowKeyUsed.value) {
|
|
153
156
|
(selectedRows.value as Array<T[keyof T]>).push(row[currentConfig.value.fieldAsRowKey as keyof T]);
|
|
154
|
-
|
|
157
|
+
} else {
|
|
158
|
+
(selectedRows.value as Set<T>).add(row);
|
|
159
|
+
}
|
|
155
160
|
}
|
|
156
161
|
}
|
|
157
162
|
|
|
@@ -164,7 +169,9 @@ export function useTable<T extends Ui3nTableBodyBaseItem>(props: Ui3nTableProps<
|
|
|
164
169
|
selectInMultipleMode(row);
|
|
165
170
|
}
|
|
166
171
|
|
|
167
|
-
!withoutEvents
|
|
172
|
+
if (!withoutEvents) {
|
|
173
|
+
emits('select:row', selectedRowsArray.value);
|
|
174
|
+
}
|
|
168
175
|
}
|
|
169
176
|
|
|
170
177
|
function toggleSelectedRows(val: Ui3nCheckboxValue) {
|
|
@@ -191,17 +198,24 @@ export function useTable<T extends Ui3nTableBodyBaseItem>(props: Ui3nTableProps<
|
|
|
191
198
|
currentConfig.value.sortOrder.direction =
|
|
192
199
|
currentConfig.value.sortOrder?.direction === 'asc' ? 'desc' : 'asc';
|
|
193
200
|
} else {
|
|
194
|
-
currentConfig.value.sortOrder
|
|
195
|
-
|
|
201
|
+
currentConfig.value.sortOrder = {
|
|
202
|
+
field: field as UnwrapRef<keyof T>,
|
|
203
|
+
direction: 'desc',
|
|
204
|
+
};
|
|
196
205
|
}
|
|
197
206
|
|
|
198
|
-
currentConfig.value.sortOrder?.field
|
|
207
|
+
if (currentConfig.value.sortOrder?.field) {
|
|
199
208
|
emits('change:sort', currentConfig.value.sortOrder as Ui3nTableSort<T>);
|
|
209
|
+
}
|
|
200
210
|
}
|
|
201
211
|
|
|
202
212
|
function clear() {
|
|
203
|
-
|
|
204
|
-
|
|
213
|
+
if (isRowKeyUsed.value) {
|
|
214
|
+
(selectedRows.value as Array<T[keyof T]>) = [];
|
|
215
|
+
} else {
|
|
216
|
+
(selectedRows.value as Set<T>).clear();
|
|
217
|
+
}
|
|
218
|
+
|
|
205
219
|
hasGroupActionsRow.value = false;
|
|
206
220
|
emits('select:row', []);
|
|
207
221
|
}
|
|
@@ -215,17 +229,17 @@ export function useTable<T extends Ui3nTableBodyBaseItem>(props: Ui3nTableProps<
|
|
|
215
229
|
},
|
|
216
230
|
);
|
|
217
231
|
|
|
218
|
-
watch(
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
);
|
|
232
|
+
// watch(
|
|
233
|
+
// tableColumnWidth,
|
|
234
|
+
// (val, oVal) => {
|
|
235
|
+
// if (val && val !== oVal) {
|
|
236
|
+
// tableEl.value && tableEl.value.style.setProperty('--ui3n-table-columns-width', val);
|
|
237
|
+
// }
|
|
238
|
+
// },
|
|
239
|
+
// {
|
|
240
|
+
// immediate: true,
|
|
241
|
+
// },
|
|
242
|
+
// );
|
|
229
243
|
|
|
230
244
|
watch(
|
|
231
245
|
() => selectedRowsSize.value,
|
|
@@ -238,6 +252,7 @@ export function useTable<T extends Ui3nTableBodyBaseItem>(props: Ui3nTableProps<
|
|
|
238
252
|
|
|
239
253
|
return {
|
|
240
254
|
tableEl,
|
|
255
|
+
tableColumnWidth,
|
|
241
256
|
unusedPlaceCssStyle,
|
|
242
257
|
currentConfig,
|
|
243
258
|
visibleColumns,
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
const iconName = computed(() => (props.value === 'asc' ? 'round-arrow-upward' : 'round-arrow-downward'));
|
|
12
|
+
|
|
13
|
+
const parsedSize = computed(() => {
|
|
14
|
+
const num = Number(props.size);
|
|
15
|
+
return isNaN(num) ? 16 : num;
|
|
16
|
+
});
|
|
12
17
|
</script>
|
|
13
18
|
|
|
14
19
|
<template>
|
|
@@ -19,7 +24,7 @@
|
|
|
19
24
|
<ui3n-icon
|
|
20
25
|
:key="iconName"
|
|
21
26
|
:icon="iconName"
|
|
22
|
-
:size="
|
|
27
|
+
:size="parsedSize"
|
|
23
28
|
:color="color"
|
|
24
29
|
/>
|
|
25
30
|
</transition>
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
const {
|
|
20
20
|
tableEl,
|
|
21
|
+
tableColumnWidth,
|
|
21
22
|
unusedPlaceCssStyle,
|
|
22
23
|
currentConfig,
|
|
23
24
|
visibleColumns,
|
|
@@ -53,6 +54,7 @@
|
|
|
53
54
|
<template>
|
|
54
55
|
<div
|
|
55
56
|
ref="tableEl"
|
|
57
|
+
:style="{ '--ui3n-table-columns-width': tableColumnWidth }"
|
|
56
58
|
:class="$style.ui3nTable"
|
|
57
59
|
>
|
|
58
60
|
<fieldset
|
|
@@ -192,7 +194,7 @@
|
|
|
192
194
|
:cell="row[col.key]"
|
|
193
195
|
>
|
|
194
196
|
<span :class="$style.cell">
|
|
195
|
-
{{ row[col.key] }}
|
|
197
|
+
{{ col.format ? col.format(row[col.key]) : row[col.key] }}
|
|
196
198
|
</span>
|
|
197
199
|
</slot>
|
|
198
200
|
</div>
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
|
|
19
19
|
const tabs = ref<HTMLDivElement | null>(null);
|
|
20
20
|
const activeIndex = ref(props.modelValue);
|
|
21
|
-
const children = ref<HTMLCollection | null>(null);
|
|
22
21
|
|
|
23
22
|
const tabsStyle = computed(() => ({
|
|
24
23
|
'--ui3n-tabs-active-color': props.activeColor,
|
|
@@ -49,28 +48,6 @@
|
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
50
|
|
|
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
|
-
}
|
|
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
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
51
|
function onClick(ev: MouseEvent) {
|
|
75
52
|
const target = ev.target as HTMLElement;
|
|
76
53
|
|