@uzum-tech/ui 2.1.4 → 2.2.0
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/index.js +1213 -527
- package/dist/index.mjs +1210 -528
- package/dist/index.prod.js +2 -2
- package/dist/index.prod.mjs +2 -2
- package/es/_internal/icon/src/UIcon.mjs +17 -9
- package/es/_internal/icons/SearchOutline.d.ts +2 -0
- package/es/_internal/icons/SearchOutline.mjs +18 -0
- package/es/_internal/icons/index.d.ts +1 -0
- package/es/_internal/icons/index.mjs +1 -0
- package/es/_utils/dom/copy-to-clipboard.d.ts +1 -0
- package/es/_utils/dom/copy-to-clipboard.mjs +8 -0
- package/es/_utils/dom/index.d.ts +1 -0
- package/es/_utils/dom/index.mjs +1 -0
- package/es/components.d.ts +1079 -4
- package/es/components.mjs +3 -0
- package/es/config-provider/src/internal-interface.d.ts +4 -0
- package/es/data-table/src/use-table-data.d.ts +1 -1
- package/es/icon-pack/index.d.ts +5 -0
- package/es/icon-pack/index.mjs +3 -0
- package/es/icon-pack/src/IconPack.d.ts +1047 -0
- package/es/icon-pack/src/IconPack.mjs +300 -0
- package/es/icon-pack/src/interface.d.ts +465 -0
- package/es/icon-pack/src/interface.mjs +75 -0
- package/es/icon-pack/src/styles/index.cssr.d.ts +2 -0
- package/es/icon-pack/src/styles/index.cssr.mjs +131 -0
- package/es/icon-pack/styles/dark.d.ts +123 -0
- package/es/icon-pack/styles/dark.mjs +20 -0
- package/es/icon-pack/styles/index.d.ts +3 -0
- package/es/icon-pack/styles/index.mjs +2 -0
- package/es/icon-pack/styles/light.d.ts +143 -0
- package/es/icon-pack/styles/light.mjs +64 -0
- package/es/icon-wrapper/src/IconWrapper.d.ts +1 -1
- package/es/input/src/Input.mjs +3 -1
- package/es/pagination/index.d.ts +3 -3
- package/es/pagination/index.mjs +2 -1
- package/es/pagination/src/Pagination.d.ts +74 -1379
- package/es/pagination/src/Pagination.mjs +28 -63
- package/es/pagination/src/interface.d.ts +1345 -1
- package/es/pagination/src/interface.mjs +68 -1
- package/es/themes/dark.mjs +2 -0
- package/es/themes/light.mjs +2 -0
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/lib/_internal/icon/src/UIcon.js +15 -8
- package/lib/_internal/icons/SearchOutline.d.ts +2 -0
- package/lib/_internal/icons/SearchOutline.js +10 -0
- package/lib/_internal/icons/index.d.ts +1 -0
- package/lib/_internal/icons/index.js +3 -1
- package/lib/_utils/dom/copy-to-clipboard.d.ts +1 -0
- package/lib/_utils/dom/copy-to-clipboard.js +11 -0
- package/lib/_utils/dom/index.d.ts +1 -0
- package/lib/_utils/dom/index.js +3 -1
- package/lib/components.d.ts +1079 -4
- package/lib/components.js +11 -5
- package/lib/config-provider/src/internal-interface.d.ts +4 -0
- package/lib/data-table/src/use-table-data.d.ts +1 -1
- package/lib/icon-pack/index.d.ts +5 -0
- package/lib/icon-pack/index.js +13 -0
- package/lib/icon-pack/src/IconPack.d.ts +1047 -0
- package/lib/icon-pack/src/IconPack.js +240 -0
- package/lib/icon-pack/src/interface.d.ts +465 -0
- package/lib/icon-pack/src/interface.js +49 -0
- package/lib/icon-pack/src/styles/index.cssr.d.ts +2 -0
- package/lib/icon-pack/src/styles/index.cssr.js +136 -0
- package/lib/icon-pack/styles/dark.d.ts +123 -0
- package/lib/icon-pack/styles/dark.js +22 -0
- package/lib/icon-pack/styles/index.d.ts +3 -0
- package/lib/icon-pack/styles/index.js +10 -0
- package/lib/icon-pack/styles/light.d.ts +143 -0
- package/lib/icon-pack/styles/light.js +46 -0
- package/lib/icon-wrapper/src/IconWrapper.d.ts +1 -1
- package/lib/input/src/Input.js +3 -1
- package/lib/pagination/index.d.ts +3 -3
- package/lib/pagination/index.js +2 -1
- package/lib/pagination/src/Pagination.d.ts +74 -1379
- package/lib/pagination/src/Pagination.js +27 -40
- package/lib/pagination/src/interface.d.ts +1345 -1
- package/lib/pagination/src/interface.js +37 -0
- package/lib/themes/dark.js +110 -108
- package/lib/themes/light.js +110 -108
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/volar.d.ts +1 -0
- package/web-types.json +258 -1
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const vue_1 = require("vue");
|
|
7
|
+
const icons_1 = require("../../_internal/icons");
|
|
8
|
+
const _mixins_1 = require("../../_mixins");
|
|
9
|
+
const _utils_1 = require("../../_utils");
|
|
10
|
+
const debounce_1 = require("../../_utils/debounce");
|
|
11
|
+
const ellipsis_1 = require("../../ellipsis");
|
|
12
|
+
const empty_1 = require("../../empty");
|
|
13
|
+
const input_1 = require("../../input");
|
|
14
|
+
const scrollbar_1 = require("../../scrollbar");
|
|
15
|
+
const styles_1 = require("../styles");
|
|
16
|
+
const interface_1 = require("./interface");
|
|
17
|
+
const index_cssr_1 = __importDefault(require("./styles/index.cssr"));
|
|
18
|
+
exports.default = (0, vue_1.defineComponent)({
|
|
19
|
+
name: 'IconPack',
|
|
20
|
+
props: interface_1.iconPackProps,
|
|
21
|
+
emits: ['update:value', 'update:searchValue', 'select', 'copy', 'search'],
|
|
22
|
+
setup(props, { emit }) {
|
|
23
|
+
const { mergedClsPrefixRef, mergedIconPacksRef } = (0, _mixins_1.useConfig)(props);
|
|
24
|
+
const themeRef = (0, _mixins_1.useTheme)('IconPack', '-icon-pack', index_cssr_1.default, styles_1.iconPackLight, props, mergedClsPrefixRef);
|
|
25
|
+
const formItem = (0, _mixins_1.useFormItem)(props);
|
|
26
|
+
const { mergedDisabledRef } = formItem;
|
|
27
|
+
(0, vue_1.provide)(interface_1.iconPackInjectionKey, {
|
|
28
|
+
mergedClsPrefixRef
|
|
29
|
+
});
|
|
30
|
+
const uncontrolledValueRef = (0, vue_1.ref)(props.defaultValue);
|
|
31
|
+
const mergedValueRef = (0, vue_1.computed)(() => props.value !== undefined ? props.value : uncontrolledValueRef.value);
|
|
32
|
+
const uncontrolledSearchRef = (0, vue_1.ref)(props.defaultSearchValue);
|
|
33
|
+
const mergedSearchRef = (0, vue_1.computed)(() => props.searchValue !== undefined
|
|
34
|
+
? props.searchValue
|
|
35
|
+
: uncontrolledSearchRef.value);
|
|
36
|
+
const mergedPackRef = (0, vue_1.computed)(() => {
|
|
37
|
+
const { pack } = props;
|
|
38
|
+
if (pack && typeof pack === 'object')
|
|
39
|
+
return pack;
|
|
40
|
+
const config = mergedIconPacksRef === null || mergedIconPacksRef === void 0 ? void 0 : mergedIconPacksRef.value;
|
|
41
|
+
if (!config)
|
|
42
|
+
return undefined;
|
|
43
|
+
const name = typeof pack === 'string' ? pack : config.defaultPackName;
|
|
44
|
+
return config.packs.find(p => p.name === name);
|
|
45
|
+
});
|
|
46
|
+
function renderIconVNode(name) {
|
|
47
|
+
const pack = mergedPackRef.value;
|
|
48
|
+
if (!pack)
|
|
49
|
+
return null;
|
|
50
|
+
if (props.async === true && typeof pack.renderAsyncIcon === 'function')
|
|
51
|
+
return pack.renderAsyncIcon(name);
|
|
52
|
+
if (typeof pack.renderIcon === 'function')
|
|
53
|
+
return pack.renderIcon(name);
|
|
54
|
+
if (typeof pack.renderAsyncIcon === 'function')
|
|
55
|
+
return pack.renderAsyncIcon(name);
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
const allIconsRef = (0, vue_1.computed)(() => {
|
|
59
|
+
const pack = mergedPackRef.value;
|
|
60
|
+
if (!pack)
|
|
61
|
+
return [];
|
|
62
|
+
const format = props.formatIconLabel;
|
|
63
|
+
return pack.iconNames.map((name) => {
|
|
64
|
+
const slashIndex = name.indexOf('/');
|
|
65
|
+
const group = slashIndex === -1 ? '' : name.slice(0, slashIndex);
|
|
66
|
+
const defaultLabel = slashIndex === -1 ? name : name.slice(slashIndex + 1);
|
|
67
|
+
return {
|
|
68
|
+
name,
|
|
69
|
+
group,
|
|
70
|
+
label: format ? format(name, group) : defaultLabel,
|
|
71
|
+
render: () => renderIconVNode(name)
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
const searchIndexRef = (0, vue_1.computed)(() => allIconsRef.value.map(icon => `${icon.name}\n${icon.label}`.toLowerCase()));
|
|
76
|
+
const debouncedQueryRef = (0, vue_1.ref)(mergedSearchRef.value.trim().toLowerCase());
|
|
77
|
+
const applyQuery = (value) => {
|
|
78
|
+
debouncedQueryRef.value = value.trim().toLowerCase();
|
|
79
|
+
};
|
|
80
|
+
const applyQueryDebounced = (0, debounce_1.debounce)(applyQuery, props.searchDebounce);
|
|
81
|
+
(0, vue_1.watch)(mergedSearchRef, (value) => {
|
|
82
|
+
if (props.searchDebounce <= 0)
|
|
83
|
+
applyQuery(value);
|
|
84
|
+
else
|
|
85
|
+
applyQueryDebounced(value);
|
|
86
|
+
});
|
|
87
|
+
const filteredIconsRef = (0, vue_1.computed)(() => {
|
|
88
|
+
const query = debouncedQueryRef.value;
|
|
89
|
+
const icons = allIconsRef.value;
|
|
90
|
+
if (!query)
|
|
91
|
+
return icons;
|
|
92
|
+
const searchIndex = searchIndexRef.value;
|
|
93
|
+
const result = [];
|
|
94
|
+
for (let index = 0; index < icons.length; index++) {
|
|
95
|
+
if (searchIndex[index].includes(query))
|
|
96
|
+
result.push(icons[index]);
|
|
97
|
+
}
|
|
98
|
+
return result;
|
|
99
|
+
});
|
|
100
|
+
const groupsRef = (0, vue_1.computed)(() => {
|
|
101
|
+
const icons = filteredIconsRef.value;
|
|
102
|
+
if (!props.grouped)
|
|
103
|
+
return [{ key: '', label: '', icons }];
|
|
104
|
+
const map = new Map();
|
|
105
|
+
for (const icon of icons) {
|
|
106
|
+
const existing = map.get(icon.group);
|
|
107
|
+
if (existing)
|
|
108
|
+
existing.push(icon);
|
|
109
|
+
else
|
|
110
|
+
map.set(icon.group, [icon]);
|
|
111
|
+
}
|
|
112
|
+
const format = props.formatGroupLabel;
|
|
113
|
+
return Array.from(map, ([key, groupIcons]) => ({
|
|
114
|
+
key,
|
|
115
|
+
label: format ? format(key) : key,
|
|
116
|
+
icons: groupIcons
|
|
117
|
+
}));
|
|
118
|
+
});
|
|
119
|
+
const isEmptyRef = (0, vue_1.computed)(() => filteredIconsRef.value.length === 0);
|
|
120
|
+
function handleSearch(value) {
|
|
121
|
+
if (props.searchValue === undefined)
|
|
122
|
+
uncontrolledSearchRef.value = value;
|
|
123
|
+
emit('update:searchValue', value);
|
|
124
|
+
emit('search', value);
|
|
125
|
+
}
|
|
126
|
+
function handleSelect(icon) {
|
|
127
|
+
if (mergedDisabledRef.value)
|
|
128
|
+
return;
|
|
129
|
+
if (props.value === undefined)
|
|
130
|
+
uncontrolledValueRef.value = icon.name;
|
|
131
|
+
emit('update:value', icon.name);
|
|
132
|
+
emit('select', icon.name, icon);
|
|
133
|
+
formItem.triggerFormInput();
|
|
134
|
+
formItem.triggerFormChange();
|
|
135
|
+
if (props.copyable) {
|
|
136
|
+
const text = props.formatCopy
|
|
137
|
+
? props.formatCopy(icon.name, icon)
|
|
138
|
+
: icon.name;
|
|
139
|
+
void (0, _utils_1.copyToClipboard)(text).catch(() => { });
|
|
140
|
+
emit('copy', text, icon);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const cssVarsRef = (0, vue_1.computed)(() => {
|
|
144
|
+
const { common: { cubicBezierEaseInOut }, self: { containerColor, borderRadius, titleTextColor, descriptionTextColor, groupTitleTextColor, groupCounterTextColor, cardColor, cardColorHover, cardColorPressed, cardColorSelected, cardBorderRadius, cardIconColor, cardIconColorSelected, cardLabelTextColor, cardLabelTextColorSelected, dividerColor } } = themeRef.value;
|
|
145
|
+
const { columns } = props;
|
|
146
|
+
const gridTemplateColumns = columns === undefined || columns === null || columns === 'auto'
|
|
147
|
+
? `repeat(auto-fill, minmax(${(0, _utils_1.formatLength)(props.minColumnWidth)}, 1fr))`
|
|
148
|
+
: `repeat(${columns}, minmax(0, 1fr))`;
|
|
149
|
+
return {
|
|
150
|
+
'--u-bezier': cubicBezierEaseInOut,
|
|
151
|
+
'--u-icon-pack-container-color': containerColor,
|
|
152
|
+
'--u-icon-pack-border-radius': borderRadius,
|
|
153
|
+
'--u-icon-pack-title-text-color': titleTextColor,
|
|
154
|
+
'--u-icon-pack-description-text-color': descriptionTextColor,
|
|
155
|
+
'--u-icon-pack-group-title-text-color': groupTitleTextColor,
|
|
156
|
+
'--u-icon-pack-group-counter-text-color': groupCounterTextColor,
|
|
157
|
+
'--u-icon-pack-card-color': cardColor,
|
|
158
|
+
'--u-icon-pack-card-color-hover': cardColorHover,
|
|
159
|
+
'--u-icon-pack-card-color-pressed': cardColorPressed,
|
|
160
|
+
'--u-icon-pack-card-color-selected': cardColorSelected,
|
|
161
|
+
'--u-icon-pack-card-border-radius': cardBorderRadius,
|
|
162
|
+
'--u-icon-pack-card-icon-color': cardIconColor,
|
|
163
|
+
'--u-icon-pack-card-icon-color-selected': cardIconColorSelected,
|
|
164
|
+
'--u-icon-pack-card-label-text-color': cardLabelTextColor,
|
|
165
|
+
'--u-icon-pack-card-label-text-color-selected': cardLabelTextColorSelected,
|
|
166
|
+
'--u-icon-pack-divider-color': dividerColor,
|
|
167
|
+
'--u-icon-pack-grid-template-columns': gridTemplateColumns,
|
|
168
|
+
'--u-icon-pack-icon-size': (0, _utils_1.formatLength)(props.iconSize),
|
|
169
|
+
'--u-icon-pack-content-padding': (0, _utils_1.formatLength)(props.contentPadding)
|
|
170
|
+
};
|
|
171
|
+
});
|
|
172
|
+
const themeClassHandle = (0, _mixins_1.useThemeClass)('icon-pack', (0, vue_1.computed)(() => ''), cssVarsRef, props);
|
|
173
|
+
return {
|
|
174
|
+
mergedClsPrefix: mergedClsPrefixRef,
|
|
175
|
+
mergedTheme: themeRef,
|
|
176
|
+
cssVars: cssVarsRef,
|
|
177
|
+
themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
|
|
178
|
+
onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender,
|
|
179
|
+
mergedValue: mergedValueRef,
|
|
180
|
+
mergedSearch: mergedSearchRef,
|
|
181
|
+
mergedDisabled: mergedDisabledRef,
|
|
182
|
+
groups: groupsRef,
|
|
183
|
+
isEmpty: isEmptyRef,
|
|
184
|
+
handleSearch,
|
|
185
|
+
handleSelect
|
|
186
|
+
};
|
|
187
|
+
},
|
|
188
|
+
render() {
|
|
189
|
+
var _a;
|
|
190
|
+
const { mergedClsPrefix: cls, $slots, title, description, searchable, grouped, showGroupCounter, searchPlaceholder, searchInputProps, scrollbarProps, emptyText, emptyProps, height, maxBodyHeight, mergedDisabled } = this;
|
|
191
|
+
(_a = this.onRender) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
192
|
+
const showHeader = !!(title || description)
|
|
193
|
+
|| !!$slots.header
|
|
194
|
+
|| !!$slots.title
|
|
195
|
+
|| !!$slots.description;
|
|
196
|
+
const hasFixedHeight = height !== undefined && height !== null;
|
|
197
|
+
const bodyStyle = hasFixedHeight
|
|
198
|
+
? { flex: '1 1 auto', minHeight: 0 }
|
|
199
|
+
: { maxHeight: (0, _utils_1.formatLength)(maxBodyHeight) };
|
|
200
|
+
const renderCard = (icon) => {
|
|
201
|
+
const selected = this.mergedValue === icon.name;
|
|
202
|
+
return ((0, vue_1.h)("div", { key: icon.name, class: [
|
|
203
|
+
`${cls}-icon-pack-card`,
|
|
204
|
+
selected && `${cls}-icon-pack-card--selected`
|
|
205
|
+
], role: "button", tabindex: mergedDisabled ? -1 : 0, "aria-pressed": selected, "aria-disabled": mergedDisabled, onClick: () => this.handleSelect(icon), onKeydown: (e) => {
|
|
206
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
207
|
+
e.preventDefault();
|
|
208
|
+
this.handleSelect(icon);
|
|
209
|
+
}
|
|
210
|
+
} },
|
|
211
|
+
(0, vue_1.h)("div", { class: `${cls}-icon-pack-card__icon` }, icon.render()),
|
|
212
|
+
(0, vue_1.h)(ellipsis_1.UPerformantEllipsis, { class: `${cls}-icon-pack-card__label`, lineClamp: 1 }, { default: () => icon.label })));
|
|
213
|
+
};
|
|
214
|
+
return ((0, vue_1.h)("div", { class: [
|
|
215
|
+
`${cls}-icon-pack`,
|
|
216
|
+
this.themeClass,
|
|
217
|
+
mergedDisabled && `${cls}-icon-pack--disabled`
|
|
218
|
+
], style: Object.assign(Object.assign({}, this.cssVars), (hasFixedHeight ? { height: (0, _utils_1.formatLength)(height) } : {})) },
|
|
219
|
+
showHeader && ((0, vue_1.h)("div", { class: `${cls}-icon-pack__header` },
|
|
220
|
+
(0, vue_1.h)("div", { class: `${cls}-icon-pack__header-main` }, (0, _utils_1.resolveSlot)($slots.header, () => [
|
|
221
|
+
(title || $slots.title) && ((0, vue_1.h)("div", { class: `${cls}-icon-pack__title` }, $slots.title ? $slots.title() : title)),
|
|
222
|
+
(description || $slots.description) && ((0, vue_1.h)("div", { class: `${cls}-icon-pack__description` }, $slots.description ? $slots.description() : description))
|
|
223
|
+
])))),
|
|
224
|
+
searchable && ((0, vue_1.h)("div", { class: `${cls}-icon-pack__search` },
|
|
225
|
+
(0, vue_1.h)(input_1.UInput, Object.assign({ value: this.mergedSearch, clearable: true, disabled: mergedDisabled, placeholder: searchPlaceholder, onUpdateValue: this.handleSearch }, searchInputProps), { prefix: () => (0, vue_1.h)(icons_1.SearchOutlineIcon) }))),
|
|
226
|
+
(0, vue_1.h)(scrollbar_1.UScrollbar, Object.assign({ class: `${cls}-icon-pack__body`, style: bodyStyle }, scrollbarProps), {
|
|
227
|
+
default: () => this.isEmpty ? ((0, vue_1.h)("div", { class: `${cls}-icon-pack__empty` }, (0, _utils_1.resolveSlot)($slots.empty, () => [
|
|
228
|
+
(0, vue_1.h)(empty_1.UEmpty, Object.assign({}, emptyProps, { size: "large", description: emptyText, theme: this.mergedTheme.peers.Empty, themeOverrides: this.mergedTheme.peerOverrides.Empty }))
|
|
229
|
+
]))) : ((0, vue_1.h)("div", { class: `${cls}-icon-pack__groups` }, this.groups.map(group => ((0, vue_1.h)("div", { key: group.key, class: `${cls}-icon-pack__group` },
|
|
230
|
+
grouped && group.key !== '' && ((0, vue_1.h)("div", { class: `${cls}-icon-pack__group-header` },
|
|
231
|
+
(0, vue_1.h)("div", { class: `${cls}-icon-pack__group-title` }, group.label),
|
|
232
|
+
showGroupCounter && ((0, vue_1.h)("span", { class: `${cls}-icon-pack__group-counter` },
|
|
233
|
+
"(",
|
|
234
|
+
group.icons.length,
|
|
235
|
+
")")))),
|
|
236
|
+
(0, vue_1.h)("div", { class: `${cls}-icon-pack__grid` }, group.icons.map(renderCard)))))))
|
|
237
|
+
}),
|
|
238
|
+
$slots.footer && ((0, vue_1.h)("div", { class: `${cls}-icon-pack__footer` }, $slots.footer()))));
|
|
239
|
+
}
|
|
240
|
+
});
|