@volverjs/ui-vue 0.0.6-beta.1 → 0.0.6-beta.3
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 +2 -2
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +363 -0
- package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -0
- package/dist/components/VvAvatarGroup/VvAvatarGroup.vue.d.ts +68 -0
- package/dist/components/VvAvatarGroup/index.d.ts +38 -0
- package/dist/components/VvNav/VvNav.es.js +442 -0
- package/dist/components/VvNav/VvNav.umd.js +1 -0
- package/dist/components/VvNav/VvNav.vue.d.ts +47 -0
- package/dist/components/VvNav/index.d.ts +31 -0
- package/dist/components/VvNavItemTitle/VvNavItemTitle.es.js +19 -0
- package/dist/components/VvNavItemTitle/VvNavItemTitle.umd.js +1 -0
- package/dist/components/VvNavItemTitle/VvNavItemTitle.vue.d.ts +6 -0
- package/dist/components/VvNavSeparator/VvNavSeparator.d.ts +2 -0
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/stories/AvatarGroup/AvatarGroup.settings.d.ts +56 -0
- package/dist/stories/AvatarGroup/AvatarGroup.test.d.ts +2 -0
- package/dist/stories/Nav/Nav.settings.d.ts +33 -0
- package/dist/stories/Nav/Nav.test.d.ts +2 -0
- package/package.json +25 -1
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAvatarGroup/VvAvatarGroup.vue +65 -0
- package/src/components/VvAvatarGroup/index.ts +28 -0
- package/src/components/VvNav/VvNav.vue +56 -0
- package/src/components/VvNav/index.ts +20 -0
- package/src/components/VvNavItemTitle/VvNavItemTitle.vue +11 -0
- package/src/components/VvNavSeparator/VvNavSeparator.ts +8 -0
- package/src/stories/Avatar/Avatar.settings.ts +1 -9
- package/src/stories/AvatarGroup/AvatarGroup.settings.ts +60 -0
- package/src/stories/AvatarGroup/AvatarGroup.stories.mdx +30 -0
- package/src/stories/AvatarGroup/AvatarGroup.test.ts +36 -0
- package/src/stories/AvatarGroup/AvatarGroupModifiers.stories.mdx +24 -0
- package/src/stories/AvatarGroup/AvatarGroupSlotDefault.stories.mdx +45 -0
- package/src/stories/Nav/Nav.settings.ts +34 -0
- package/src/stories/Nav/Nav.stories.mdx +28 -0
- package/src/stories/Nav/Nav.test.ts +32 -0
- package/src/stories/Nav/NavModifiers.stories.mdx +48 -0
package/README.md
CHANGED
|
@@ -165,10 +165,10 @@ The following features are planned for the next releases:
|
|
|
165
165
|
- [x] (v0.0.3) Rewrite of `VvDropdown` to get it applicable to any element;
|
|
166
166
|
- [x] (v0.0.5) Input masks for `VvInputText` component;
|
|
167
167
|
- [x] `VvAvatar` component;
|
|
168
|
-
- [
|
|
168
|
+
- [x] `VvAvatarGroup` component;
|
|
169
|
+
- [x] Menus, navigation and tabs with `VvNav`;
|
|
169
170
|
- [ ] Alerts, notifications and toasts with `VvAlert` and `VvToast` component;
|
|
170
171
|
- [ ] Loaders with `VvLoader` and `VvSkeleton`;
|
|
171
|
-
- [ ] Menus, navigation and tabs with `VvNav`;
|
|
172
172
|
- [ ] `VvTable` component with sort, filters, pagination and cell editing;
|
|
173
173
|
- [ ] Multiple uploads, image crop and file previews with `VvInputFile`;
|
|
174
174
|
- [ ] Carousel and galleries with `VvCarousel` component;
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import { computed, unref, defineComponent, toRefs, openBlock, createElementBlock, normalizeClass, renderSlot, createCommentVNode, Fragment, renderList, createBlock, mergeProps, withCtx, toDisplayString, createTextVNode } from "vue";
|
|
2
|
+
import { nanoid } from "nanoid";
|
|
3
|
+
var Side = /* @__PURE__ */ ((Side2) => {
|
|
4
|
+
Side2["left"] = "left";
|
|
5
|
+
Side2["right"] = "right";
|
|
6
|
+
Side2["top"] = "top";
|
|
7
|
+
Side2["bottom"] = "bottom";
|
|
8
|
+
return Side2;
|
|
9
|
+
})(Side || {});
|
|
10
|
+
var Placement = /* @__PURE__ */ ((Placement2) => {
|
|
11
|
+
Placement2["topStart"] = "top-start";
|
|
12
|
+
Placement2["topEnd"] = "top-end";
|
|
13
|
+
Placement2["bottomStart"] = "bottom-start";
|
|
14
|
+
Placement2["bottomEnd"] = "bottom-end";
|
|
15
|
+
Placement2["leftStart"] = "left-start";
|
|
16
|
+
Placement2["leftEnd"] = "left-end";
|
|
17
|
+
Placement2["rightStart"] = "right-start";
|
|
18
|
+
Placement2["rightEnd"] = "right-end";
|
|
19
|
+
return Placement2;
|
|
20
|
+
})(Placement || {});
|
|
21
|
+
var Position = /* @__PURE__ */ ((Position2) => {
|
|
22
|
+
Position2["before"] = "before";
|
|
23
|
+
Position2["after"] = "after";
|
|
24
|
+
return Position2;
|
|
25
|
+
})(Position || {});
|
|
26
|
+
var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
27
|
+
ButtonType2["button"] = "button";
|
|
28
|
+
ButtonType2["submit"] = "submit";
|
|
29
|
+
ButtonType2["reset"] = "reset";
|
|
30
|
+
return ButtonType2;
|
|
31
|
+
})(ButtonType || {});
|
|
32
|
+
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
33
|
+
AnchorTarget2["_blank"] = "_blank";
|
|
34
|
+
AnchorTarget2["_self"] = "_self";
|
|
35
|
+
AnchorTarget2["_parent"] = "_parent";
|
|
36
|
+
AnchorTarget2["_top"] = "_top";
|
|
37
|
+
return AnchorTarget2;
|
|
38
|
+
})(AnchorTarget || {});
|
|
39
|
+
const LinkProps = {
|
|
40
|
+
/**
|
|
41
|
+
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
42
|
+
* @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
|
|
43
|
+
*/
|
|
44
|
+
to: {
|
|
45
|
+
type: [String, Object]
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* Anchor href
|
|
49
|
+
*/
|
|
50
|
+
href: String,
|
|
51
|
+
/**
|
|
52
|
+
* Anchor target
|
|
53
|
+
*/
|
|
54
|
+
target: {
|
|
55
|
+
type: String,
|
|
56
|
+
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* Anchor rel
|
|
60
|
+
*/
|
|
61
|
+
rel: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: "noopener noreferrer"
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const DisabledProps = {
|
|
67
|
+
/**
|
|
68
|
+
* Whether the form control is disabled
|
|
69
|
+
*/
|
|
70
|
+
disabled: Boolean
|
|
71
|
+
};
|
|
72
|
+
const ActiveProps = {
|
|
73
|
+
/**
|
|
74
|
+
* Whether the item is active
|
|
75
|
+
*/
|
|
76
|
+
active: Boolean
|
|
77
|
+
};
|
|
78
|
+
const PressedProps = {
|
|
79
|
+
/**
|
|
80
|
+
* Whether the item is pressed
|
|
81
|
+
*/
|
|
82
|
+
pressed: Boolean
|
|
83
|
+
};
|
|
84
|
+
const LabelProps = {
|
|
85
|
+
/**
|
|
86
|
+
* The item label
|
|
87
|
+
*/
|
|
88
|
+
label: [String, Number]
|
|
89
|
+
};
|
|
90
|
+
const ModifiersProps = {
|
|
91
|
+
/**
|
|
92
|
+
* Component BEM modifiers
|
|
93
|
+
*/
|
|
94
|
+
modifiers: [String, Array]
|
|
95
|
+
};
|
|
96
|
+
({
|
|
97
|
+
/**
|
|
98
|
+
* VvIcon name or props
|
|
99
|
+
* @see VVIcon
|
|
100
|
+
*/
|
|
101
|
+
icon: { type: [String, Object] },
|
|
102
|
+
/**
|
|
103
|
+
* VvIcon position
|
|
104
|
+
*/
|
|
105
|
+
iconPosition: {
|
|
106
|
+
type: String,
|
|
107
|
+
default: Position.before,
|
|
108
|
+
validation: (value) => Object.values(Position).includes(value)
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
({
|
|
112
|
+
/**
|
|
113
|
+
* Dropdown placement
|
|
114
|
+
*/
|
|
115
|
+
placement: {
|
|
116
|
+
type: String,
|
|
117
|
+
default: Side.bottom,
|
|
118
|
+
validator: (value) => {
|
|
119
|
+
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
/**
|
|
123
|
+
* Dropdown strategy
|
|
124
|
+
*/
|
|
125
|
+
strategy: {
|
|
126
|
+
type: String,
|
|
127
|
+
default: "absolute",
|
|
128
|
+
validator: (value) => {
|
|
129
|
+
return ["fixed", "absolute"].includes(value);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
/**
|
|
133
|
+
* Dropdown show / hide transition name
|
|
134
|
+
*/
|
|
135
|
+
transitionName: {
|
|
136
|
+
type: String
|
|
137
|
+
},
|
|
138
|
+
/**
|
|
139
|
+
* Offset of the dropdown from the trigger
|
|
140
|
+
* @see https://floating-ui.com/docs/offset
|
|
141
|
+
*/
|
|
142
|
+
offset: {
|
|
143
|
+
type: [Number, String, Object],
|
|
144
|
+
default: 0
|
|
145
|
+
},
|
|
146
|
+
/**
|
|
147
|
+
* Move dropdown to the side if there is no space in the default position
|
|
148
|
+
* @see https://floating-ui.com/docs/shift
|
|
149
|
+
*/
|
|
150
|
+
shift: {
|
|
151
|
+
type: [Boolean, Object],
|
|
152
|
+
default: false
|
|
153
|
+
},
|
|
154
|
+
/**
|
|
155
|
+
* Flip dropdown position if there is no space in the default position
|
|
156
|
+
* @see https://floating-ui.com/docs/flip
|
|
157
|
+
*/
|
|
158
|
+
flip: {
|
|
159
|
+
type: [Boolean, Object],
|
|
160
|
+
default: true
|
|
161
|
+
},
|
|
162
|
+
/**
|
|
163
|
+
* Size of the dropdown
|
|
164
|
+
* @see https://floating-ui.com/docs/size
|
|
165
|
+
*/
|
|
166
|
+
size: {
|
|
167
|
+
type: [Boolean, Object],
|
|
168
|
+
default: () => ({ padding: 10 })
|
|
169
|
+
},
|
|
170
|
+
/**
|
|
171
|
+
* Automatically change the position of the dropdown
|
|
172
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
173
|
+
*/
|
|
174
|
+
autoPlacement: {
|
|
175
|
+
type: [Boolean, Object],
|
|
176
|
+
default: false
|
|
177
|
+
},
|
|
178
|
+
/**
|
|
179
|
+
* Add arrow to the dropdown
|
|
180
|
+
* @see https://floating-ui.com/docs/arrow
|
|
181
|
+
*/
|
|
182
|
+
arrow: {
|
|
183
|
+
type: Boolean,
|
|
184
|
+
default: false
|
|
185
|
+
},
|
|
186
|
+
/**
|
|
187
|
+
* Close dropdown on click outside
|
|
188
|
+
*/
|
|
189
|
+
autoClose: {
|
|
190
|
+
type: Boolean,
|
|
191
|
+
default: true
|
|
192
|
+
},
|
|
193
|
+
/**
|
|
194
|
+
* Autofocus first item on dropdown open
|
|
195
|
+
*/
|
|
196
|
+
autofocusFirst: {
|
|
197
|
+
type: Boolean,
|
|
198
|
+
default: true
|
|
199
|
+
},
|
|
200
|
+
/**
|
|
201
|
+
* Set dropdown width to the same as the trigger
|
|
202
|
+
*/
|
|
203
|
+
triggerWidth: {
|
|
204
|
+
type: Boolean
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
({
|
|
208
|
+
...DisabledProps,
|
|
209
|
+
...LabelProps,
|
|
210
|
+
...PressedProps,
|
|
211
|
+
...ActiveProps,
|
|
212
|
+
...LinkProps,
|
|
213
|
+
/**
|
|
214
|
+
* Button type
|
|
215
|
+
*/
|
|
216
|
+
type: {
|
|
217
|
+
type: String,
|
|
218
|
+
default: ButtonType.button,
|
|
219
|
+
validator: (value) => Object.values(ButtonType).includes(value)
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
const VvAvatarGroupProps = {
|
|
223
|
+
...ModifiersProps,
|
|
224
|
+
/**
|
|
225
|
+
* avatar items
|
|
226
|
+
*/
|
|
227
|
+
items: {
|
|
228
|
+
type: Array,
|
|
229
|
+
default: () => [],
|
|
230
|
+
required: true
|
|
231
|
+
},
|
|
232
|
+
toShow: {
|
|
233
|
+
type: Number,
|
|
234
|
+
default: 3
|
|
235
|
+
},
|
|
236
|
+
totalItems: {
|
|
237
|
+
type: Number
|
|
238
|
+
},
|
|
239
|
+
avatarModifiers: [String, Array]
|
|
240
|
+
};
|
|
241
|
+
const VvAvatarProps = {
|
|
242
|
+
...ModifiersProps,
|
|
243
|
+
/**
|
|
244
|
+
* Image src for avatar
|
|
245
|
+
*/
|
|
246
|
+
imgSrc: String
|
|
247
|
+
};
|
|
248
|
+
function useModifiers(prefix, modifiers, others) {
|
|
249
|
+
return computed(() => {
|
|
250
|
+
const toReturn = {
|
|
251
|
+
[prefix]: true
|
|
252
|
+
};
|
|
253
|
+
const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
|
|
254
|
+
if (modifiersArray) {
|
|
255
|
+
if (Array.isArray(modifiersArray)) {
|
|
256
|
+
modifiersArray.forEach((modifier) => {
|
|
257
|
+
if (modifier) {
|
|
258
|
+
toReturn[`${prefix}--${modifier}`] = true;
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
if (others) {
|
|
264
|
+
Object.keys(others.value).forEach((key) => {
|
|
265
|
+
toReturn[`${prefix}--${key}`] = unref(others.value[key]);
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
return toReturn;
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
const _hoisted_1$1 = ["role", "aria-label"];
|
|
272
|
+
const _hoisted_2 = ["src"];
|
|
273
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
274
|
+
__name: "VvAvatar",
|
|
275
|
+
props: VvAvatarProps,
|
|
276
|
+
setup(__props) {
|
|
277
|
+
const props = __props;
|
|
278
|
+
const { modifiers } = toRefs(props);
|
|
279
|
+
const bemCssClasses = useModifiers("vv-avatar", modifiers);
|
|
280
|
+
return (_ctx, _cache) => {
|
|
281
|
+
return openBlock(), createElementBlock("span", {
|
|
282
|
+
class: normalizeClass(unref(bemCssClasses)),
|
|
283
|
+
role: _ctx.imgSrc ? void 0 : "img",
|
|
284
|
+
"aria-label": _ctx.imgSrc ? void 0 : "avatar"
|
|
285
|
+
}, [
|
|
286
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
287
|
+
_ctx.imgSrc ? (openBlock(), createElementBlock("img", {
|
|
288
|
+
key: 0,
|
|
289
|
+
src: _ctx.imgSrc,
|
|
290
|
+
alt: "avatar"
|
|
291
|
+
}, null, 8, _hoisted_2)) : createCommentVNode("", true)
|
|
292
|
+
])
|
|
293
|
+
], 10, _hoisted_1$1);
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || nanoid()));
|
|
298
|
+
const _hoisted_1 = { key: 0 };
|
|
299
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
300
|
+
__name: "VvAvatarGroup",
|
|
301
|
+
props: VvAvatarGroupProps,
|
|
302
|
+
setup(__props) {
|
|
303
|
+
const props = __props;
|
|
304
|
+
const { modifiers, items, toShow, totalItems, avatarModifiers } = toRefs(props);
|
|
305
|
+
const bemCssClasses = useModifiers("vv-avatar-group", modifiers);
|
|
306
|
+
const stringModifiers = computed(() => {
|
|
307
|
+
if ((avatarModifiers == null ? void 0 : avatarModifiers.value) && Array.isArray(avatarModifiers == null ? void 0 : avatarModifiers.value)) {
|
|
308
|
+
return avatarModifiers.value.join(" ");
|
|
309
|
+
}
|
|
310
|
+
return (avatarModifiers == null ? void 0 : avatarModifiers.value) || "";
|
|
311
|
+
});
|
|
312
|
+
const avatarItems = computed(() => {
|
|
313
|
+
return items.value.slice(0, toShow.value).map((item) => {
|
|
314
|
+
let modifiers2 = [];
|
|
315
|
+
let itemModifiers = [];
|
|
316
|
+
if (avatarModifiers == null ? void 0 : avatarModifiers.value) {
|
|
317
|
+
modifiers2 = Array.isArray(avatarModifiers == null ? void 0 : avatarModifiers.value) ? avatarModifiers == null ? void 0 : avatarModifiers.value : [avatarModifiers == null ? void 0 : avatarModifiers.value];
|
|
318
|
+
}
|
|
319
|
+
if (item.modifiers) {
|
|
320
|
+
itemModifiers = Array.isArray(item.modifiers) ? item.modifiers : [item.modifiers];
|
|
321
|
+
}
|
|
322
|
+
return {
|
|
323
|
+
...item,
|
|
324
|
+
key: item.key || useUniqueId().value,
|
|
325
|
+
modifiers: [...modifiers2, ...itemModifiers]
|
|
326
|
+
};
|
|
327
|
+
});
|
|
328
|
+
});
|
|
329
|
+
return (_ctx, _cache) => {
|
|
330
|
+
return openBlock(), createElementBlock("span", {
|
|
331
|
+
class: normalizeClass(unref(bemCssClasses))
|
|
332
|
+
}, [
|
|
333
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
334
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(avatarItems), (avatarItem) => {
|
|
335
|
+
return openBlock(), createBlock(_sfc_main$1, mergeProps({
|
|
336
|
+
key: avatarItem.key
|
|
337
|
+
}, {
|
|
338
|
+
modifiers: avatarItem.modifiers,
|
|
339
|
+
imgSrc: avatarItem.imgSrc
|
|
340
|
+
}), {
|
|
341
|
+
default: withCtx(() => [
|
|
342
|
+
avatarItem.text ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(avatarItem.text), 1)) : createCommentVNode("", true)
|
|
343
|
+
]),
|
|
344
|
+
_: 2
|
|
345
|
+
}, 1040);
|
|
346
|
+
}), 128)),
|
|
347
|
+
(unref(totalItems) || unref(items).length) > unref(toShow) ? (openBlock(), createBlock(_sfc_main$1, {
|
|
348
|
+
key: 0,
|
|
349
|
+
modifiers: `${unref(stringModifiers)} surface bordered`
|
|
350
|
+
}, {
|
|
351
|
+
default: withCtx(() => [
|
|
352
|
+
createTextVNode(toDisplayString(`+${(unref(totalItems) || unref(items).length) - unref(toShow)}`), 1)
|
|
353
|
+
]),
|
|
354
|
+
_: 1
|
|
355
|
+
}, 8, ["modifiers"])) : createCommentVNode("", true)
|
|
356
|
+
])
|
|
357
|
+
], 2);
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
export {
|
|
362
|
+
_sfc_main as default
|
|
363
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","nanoid"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvAvatarGroup=o(e.vue,e.nanoid)}(this,(function(e,o){"use strict";var r=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(r||{}),t=(e=>(e.before="before",e.after="after",e))(t||{}),a=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(a||{});Boolean,Boolean,Boolean;const n={modifiers:[String,Array]};t.before,r.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,a.button;const l={...n,items:{type:Array,default:()=>[],required:!0},toShow:{type:Number,default:3},totalItems:{type:Number},avatarModifiers:[String,Array]},i={...n,imgSrc:String};function u(o,r,t){return e.computed((()=>{const a={[o]:!0},n="string"==typeof(null==r?void 0:r.value)?r.value.split(" "):null==r?void 0:r.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(a[`${o}--${e}`]=!0)})),t&&Object.keys(t.value).forEach((r=>{a[`${o}--${r}`]=e.unref(t.value[r])})),a}))}const s=["role","aria-label"],d=["src"],f=e.defineComponent({__name:"VvAvatar",props:i,setup(o){const r=o,{modifiers:t}=e.toRefs(r),a=u("vv-avatar",t);return(o,r)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(e.unref(a)),role:o.imgSrc?void 0:"img","aria-label":o.imgSrc?void 0:"avatar"},[e.renderSlot(o.$slots,"default",{},(()=>[o.imgSrc?(e.openBlock(),e.createElementBlock("img",{key:0,src:o.imgSrc,alt:"avatar"},null,8,d)):e.createCommentVNode("",!0)]))],10,s))}}),m={key:0};return e.defineComponent({__name:"VvAvatarGroup",props:l,setup(r){const t=r,{modifiers:a,items:n,toShow:l,totalItems:i,avatarModifiers:s}=e.toRefs(t),d=u("vv-avatar-group",a),c=e.computed((()=>(null==s?void 0:s.value)&&Array.isArray(null==s?void 0:s.value)?s.value.join(" "):(null==s?void 0:s.value)||"")),v=e.computed((()=>n.value.slice(0,l.value).map((r=>{let t=[],a=[];return(null==s?void 0:s.value)&&(t=Array.isArray(null==s?void 0:s.value)?null==s?void 0:s.value:[null==s?void 0:s.value]),r.modifiers&&(a=Array.isArray(r.modifiers)?r.modifiers:[r.modifiers]),{...r,key:r.key||e.computed((()=>String((null==n?void 0:n.value)||o.nanoid()))).value,modifiers:[...t,...a]};var n}))));return(o,r)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(e.unref(d))},[e.renderSlot(o.$slots,"default",{},(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(v),(o=>(e.openBlock(),e.createBlock(f,e.mergeProps({key:o.key},{modifiers:o.modifiers,imgSrc:o.imgSrc}),{default:e.withCtx((()=>[o.text?(e.openBlock(),e.createElementBlock("span",m,e.toDisplayString(o.text),1)):e.createCommentVNode("",!0)])),_:2},1040)))),128)),(e.unref(i)||e.unref(n).length)>e.unref(l)?(e.openBlock(),e.createBlock(f,{key:0,modifiers:`${e.unref(c)} surface bordered`},{default:e.withCtx((()=>[e.createTextVNode(e.toDisplayString("+"+((e.unref(i)||e.unref(n).length)-e.unref(l))),1)])),_:1},8,["modifiers"])):e.createCommentVNode("",!0)]))],2))}})}));
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
2
|
+
items: {
|
|
3
|
+
type: {
|
|
4
|
+
(arrayLength: number): import("@/components/VvAvatarGroup").AvatarItem[];
|
|
5
|
+
(...items: import("@/components/VvAvatarGroup").AvatarItem[]): import("@/components/VvAvatarGroup").AvatarItem[];
|
|
6
|
+
new (arrayLength: number): import("@/components/VvAvatarGroup").AvatarItem[];
|
|
7
|
+
new (...items: import("@/components/VvAvatarGroup").AvatarItem[]): import("@/components/VvAvatarGroup").AvatarItem[];
|
|
8
|
+
isArray(arg: any): arg is any[];
|
|
9
|
+
readonly prototype: any[];
|
|
10
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
11
|
+
from<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
|
|
12
|
+
from<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
|
|
13
|
+
from<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
|
|
14
|
+
of<T_4>(...items: T_4[]): T_4[];
|
|
15
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
16
|
+
};
|
|
17
|
+
default: () => never[];
|
|
18
|
+
required: boolean;
|
|
19
|
+
};
|
|
20
|
+
toShow: {
|
|
21
|
+
type: NumberConstructor;
|
|
22
|
+
default: number;
|
|
23
|
+
};
|
|
24
|
+
totalItems: {
|
|
25
|
+
type: NumberConstructor;
|
|
26
|
+
};
|
|
27
|
+
avatarModifiers: globalThis.PropType<string | string[]>;
|
|
28
|
+
modifiers: globalThis.PropType<string | string[]>;
|
|
29
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
30
|
+
items: {
|
|
31
|
+
type: {
|
|
32
|
+
(arrayLength: number): import("@/components/VvAvatarGroup").AvatarItem[];
|
|
33
|
+
(...items: import("@/components/VvAvatarGroup").AvatarItem[]): import("@/components/VvAvatarGroup").AvatarItem[];
|
|
34
|
+
new (arrayLength: number): import("@/components/VvAvatarGroup").AvatarItem[];
|
|
35
|
+
new (...items: import("@/components/VvAvatarGroup").AvatarItem[]): import("@/components/VvAvatarGroup").AvatarItem[];
|
|
36
|
+
isArray(arg: any): arg is any[];
|
|
37
|
+
readonly prototype: any[];
|
|
38
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
39
|
+
from<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
|
|
40
|
+
from<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
|
|
41
|
+
from<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
|
|
42
|
+
of<T_4>(...items: T_4[]): T_4[];
|
|
43
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
44
|
+
};
|
|
45
|
+
default: () => never[];
|
|
46
|
+
required: boolean;
|
|
47
|
+
};
|
|
48
|
+
toShow: {
|
|
49
|
+
type: NumberConstructor;
|
|
50
|
+
default: number;
|
|
51
|
+
};
|
|
52
|
+
totalItems: {
|
|
53
|
+
type: NumberConstructor;
|
|
54
|
+
};
|
|
55
|
+
avatarModifiers: globalThis.PropType<string | string[]>;
|
|
56
|
+
modifiers: globalThis.PropType<string | string[]>;
|
|
57
|
+
}>>, {
|
|
58
|
+
items: import("@/components/VvAvatarGroup").AvatarItem[];
|
|
59
|
+
toShow: number;
|
|
60
|
+
}>, {
|
|
61
|
+
default: (_: {}) => any;
|
|
62
|
+
}>;
|
|
63
|
+
export default _default;
|
|
64
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
65
|
+
new (): {
|
|
66
|
+
$slots: S;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export type AvatarItem = {
|
|
2
|
+
key?: string;
|
|
3
|
+
text?: string;
|
|
4
|
+
imgSrc?: string;
|
|
5
|
+
modifiers?: string | string[];
|
|
6
|
+
};
|
|
7
|
+
export declare const VvAvatarGroupProps: {
|
|
8
|
+
/**
|
|
9
|
+
* avatar items
|
|
10
|
+
*/
|
|
11
|
+
items: {
|
|
12
|
+
type: {
|
|
13
|
+
(arrayLength: number): AvatarItem[];
|
|
14
|
+
(...items: AvatarItem[]): AvatarItem[];
|
|
15
|
+
new (arrayLength: number): AvatarItem[];
|
|
16
|
+
new (...items: AvatarItem[]): AvatarItem[];
|
|
17
|
+
isArray(arg: any): arg is any[];
|
|
18
|
+
readonly prototype: any[];
|
|
19
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
20
|
+
from<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
|
|
21
|
+
from<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
|
|
22
|
+
from<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
|
|
23
|
+
of<T_4>(...items: T_4[]): T_4[];
|
|
24
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
25
|
+
};
|
|
26
|
+
default: () => never[];
|
|
27
|
+
required: boolean;
|
|
28
|
+
};
|
|
29
|
+
toShow: {
|
|
30
|
+
type: NumberConstructor;
|
|
31
|
+
default: number;
|
|
32
|
+
};
|
|
33
|
+
totalItems: {
|
|
34
|
+
type: NumberConstructor;
|
|
35
|
+
};
|
|
36
|
+
avatarModifiers: globalThis.PropType<string | string[]>;
|
|
37
|
+
modifiers: globalThis.PropType<string | string[]>;
|
|
38
|
+
};
|