@uzum-tech/ui 1.5.1 → 1.5.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 +0 -1
- package/dist/index.js +1333 -869
- package/dist/index.prod.js +3 -3
- package/es/_internal/checkbox/src/use-checkbox.js +3 -3
- package/es/_internal/radio/src/use-radio.js +3 -3
- package/es/_internal/typography/src/styles/text.cssr.js +0 -1
- package/es/_internal/typography/styles/light.js +1 -1
- package/es/_mixins/use-form-item.d.ts +4 -4
- package/es/_mixins/use-form-item.js +4 -4
- package/es/_styles/common/dark.js +1 -1
- package/es/_styles/common/light.d.ts +3 -0
- package/es/_styles/common/light.js +1 -1
- package/es/_utils/composable/composables.d.ts +11 -0
- package/es/_utils/composable/composables.js +40 -0
- package/es/_utils/index.d.ts +1 -1
- package/es/_utils/index.js +1 -1
- package/es/_utils/uzum/index.d.ts +1 -0
- package/es/_utils/uzum/index.js +1 -0
- package/es/_utils/uzum/value.d.ts +1 -0
- package/es/_utils/uzum/value.js +9 -0
- package/es/_utils/vue/resolve-slot.d.ts +1 -1
- package/es/alert/styles/light.js +6 -6
- package/es/auto-complete/src/AutoComplete.js +10 -10
- package/es/avatar/src/Avatar.d.ts +6 -0
- package/es/avatar/src/Avatar.js +9 -3
- package/es/card-list/src/CardList.js +1 -1
- package/es/card-list/src/CardListItem.d.ts +13 -0
- package/es/card-list/src/CardListItem.js +11 -4
- package/es/card-list/src/interface.d.ts +1 -0
- package/es/card-list/src/styles/index.cssr.js +6 -6
- package/es/card-list/styles/light.js +2 -2
- package/es/cascader/src/Cascader.js +7 -7
- package/es/checkbox/src/CheckboxGroup.js +9 -9
- package/es/color-picker/src/ColorPicker.js +6 -6
- package/es/components.d.ts +1 -0
- package/es/components.js +1 -0
- package/es/config-provider/src/internal-interface.d.ts +2 -0
- package/es/data-table/src/DataTable.d.ts +8 -0
- package/es/data-table/src/DataTable.js +21 -10
- package/es/data-table/src/TableParts/Body.d.ts +1 -0
- package/es/data-table/src/TableParts/Body.js +6 -5
- package/es/data-table/src/TableParts/Cell.js +85 -23
- package/es/data-table/src/interface.d.ts +13 -6
- package/es/data-table/src/interface.js +1 -1
- package/es/data-table/src/styles/index.cssr.js +5 -3
- package/es/data-table/src/use-mask.d.ts +3 -6
- package/es/data-table/src/utils.d.ts +2 -1
- package/es/data-table/src/utils.js +13 -0
- package/es/date-picker/src/DatePicker.js +7 -7
- package/es/dialog/src/DialogProvider.d.ts +6 -0
- package/es/dynamic-tags/src/DynamicTags.js +3 -3
- package/es/input/src/Input.js +8 -8
- package/es/input-number/src/InputNumber.js +7 -7
- package/es/input-otp/index.d.ts +3 -0
- package/es/input-otp/index.js +1 -0
- package/es/input-otp/src/InputOtp.d.ts +871 -0
- package/es/input-otp/src/InputOtp.js +250 -0
- package/es/input-otp/src/public-types.d.ts +25 -0
- package/es/input-otp/src/public-types.js +1 -0
- package/es/input-otp/src/styles/index.cssr.d.ts +2 -0
- package/es/input-otp/src/styles/index.cssr.js +20 -0
- package/es/input-otp/src/styles/input-otp-rtl.cssr.d.ts +2 -0
- package/es/input-otp/src/styles/input-otp-rtl.cssr.js +5 -0
- package/es/input-otp/styles/dark.d.ts +3 -0
- package/es/input-otp/styles/dark.js +12 -0
- package/es/input-otp/styles/index.d.ts +4 -0
- package/es/input-otp/styles/index.js +3 -0
- package/es/input-otp/styles/light.d.ts +83 -0
- package/es/input-otp/styles/light.js +22 -0
- package/es/input-otp/styles/rtl.d.ts +2 -0
- package/es/input-otp/styles/rtl.js +5 -0
- package/es/legacy-transfer/src/Transfer.js +3 -3
- package/es/list/src/List.d.ts +41 -55
- package/es/list/src/List.js +6 -10
- package/es/list/src/ListItem.d.ts +84 -25
- package/es/list/src/ListItem.js +120 -98
- package/es/list/src/interface.d.ts +1 -0
- package/es/list/src/props.d.ts +70 -31
- package/es/list/src/props.js +25 -5
- package/es/list/src/styles/index.cssr.js +32 -90
- package/es/list/styles/light.d.ts +5 -8
- package/es/list/styles/light.js +6 -9
- package/es/mention/src/Mention.js +7 -7
- package/es/radio/src/RadioGroup.js +5 -5
- package/es/rate/src/Rate.js +3 -3
- package/es/select/src/Select.js +7 -7
- package/es/slider/src/Slider.js +3 -3
- package/es/styles.d.ts +1 -0
- package/es/styles.js +1 -0
- package/es/switch/src/Switch.js +7 -7
- package/es/tag/src/styles/index.cssr.js +5 -1
- package/es/tag/styles/light.js +2 -2
- package/es/theme-editor/src/ThemeEditor.d.ts +3 -0
- package/es/themes/dark.js +2 -0
- package/es/themes/light.js +2 -0
- package/es/time-picker/src/TimePicker.js +7 -7
- package/es/transfer/src/Transfer.js +3 -3
- package/es/tree-select/src/TreeSelect.js +5 -5
- package/es/upload/src/UploadFile.js +4 -3
- package/es/version.d.ts +1 -1
- package/es/version.js +1 -1
- package/lib/_internal/checkbox/src/use-checkbox.js +3 -3
- package/lib/_internal/radio/src/use-radio.js +3 -3
- package/lib/_internal/typography/src/styles/text.cssr.js +0 -1
- package/lib/_internal/typography/styles/light.js +1 -1
- package/lib/_mixins/use-form-item.d.ts +4 -4
- package/lib/_mixins/use-form-item.js +4 -4
- package/lib/_styles/common/dark.js +1 -1
- package/lib/_styles/common/light.d.ts +3 -0
- package/lib/_styles/common/light.js +1 -1
- package/lib/_utils/composable/composables.d.ts +11 -0
- package/lib/_utils/composable/composables.js +47 -0
- package/lib/_utils/index.d.ts +1 -1
- package/lib/_utils/index.js +2 -1
- package/lib/_utils/uzum/index.d.ts +1 -0
- package/lib/_utils/uzum/index.js +3 -1
- package/lib/_utils/uzum/value.d.ts +1 -0
- package/lib/_utils/uzum/value.js +12 -0
- package/lib/_utils/vue/resolve-slot.d.ts +1 -1
- package/lib/alert/styles/light.js +6 -6
- package/lib/auto-complete/src/AutoComplete.js +10 -10
- package/lib/avatar/src/Avatar.d.ts +6 -0
- package/lib/avatar/src/Avatar.js +9 -3
- package/lib/card-list/src/CardList.js +1 -1
- package/lib/card-list/src/CardListItem.d.ts +13 -0
- package/lib/card-list/src/CardListItem.js +11 -4
- package/lib/card-list/src/interface.d.ts +1 -0
- package/lib/card-list/src/styles/index.cssr.js +5 -5
- package/lib/card-list/styles/light.js +2 -2
- package/lib/cascader/src/Cascader.js +7 -7
- package/lib/checkbox/src/CheckboxGroup.js +9 -9
- package/lib/color-picker/src/ColorPicker.js +6 -6
- package/lib/components.d.ts +1 -0
- package/lib/components.js +1 -0
- package/lib/config-provider/src/internal-interface.d.ts +2 -0
- package/lib/data-table/src/DataTable.d.ts +8 -0
- package/lib/data-table/src/DataTable.js +21 -10
- package/lib/data-table/src/TableParts/Body.d.ts +1 -0
- package/lib/data-table/src/TableParts/Body.js +6 -5
- package/lib/data-table/src/TableParts/Cell.js +84 -22
- package/lib/data-table/src/interface.d.ts +13 -6
- package/lib/data-table/src/interface.js +1 -1
- package/lib/data-table/src/styles/index.cssr.js +5 -3
- package/lib/data-table/src/use-mask.d.ts +3 -6
- package/lib/data-table/src/utils.d.ts +2 -1
- package/lib/data-table/src/utils.js +14 -1
- package/lib/date-picker/src/DatePicker.js +7 -7
- package/lib/dialog/src/DialogProvider.d.ts +6 -0
- package/lib/dynamic-tags/src/DynamicTags.js +3 -3
- package/lib/input/src/Input.js +8 -8
- package/lib/input-number/src/InputNumber.js +7 -7
- package/lib/input-otp/index.d.ts +3 -0
- package/lib/input-otp/index.js +9 -0
- package/lib/input-otp/src/InputOtp.d.ts +871 -0
- package/lib/input-otp/src/InputOtp.js +256 -0
- package/lib/input-otp/src/public-types.d.ts +25 -0
- package/lib/input-otp/src/public-types.js +2 -0
- package/lib/input-otp/src/styles/index.cssr.d.ts +2 -0
- package/lib/input-otp/src/styles/index.cssr.js +25 -0
- package/lib/input-otp/src/styles/input-otp-rtl.cssr.d.ts +2 -0
- package/lib/input-otp/src/styles/input-otp-rtl.cssr.js +10 -0
- package/lib/input-otp/styles/dark.d.ts +3 -0
- package/lib/input-otp/styles/dark.js +14 -0
- package/lib/input-otp/styles/index.d.ts +4 -0
- package/lib/input-otp/styles/index.js +12 -0
- package/lib/input-otp/styles/light.d.ts +83 -0
- package/lib/input-otp/styles/light.js +25 -0
- package/lib/input-otp/styles/rtl.d.ts +2 -0
- package/lib/input-otp/styles/rtl.js +11 -0
- package/lib/legacy-transfer/src/Transfer.js +3 -3
- package/lib/list/src/List.d.ts +41 -55
- package/lib/list/src/List.js +6 -10
- package/lib/list/src/ListItem.d.ts +84 -25
- package/lib/list/src/ListItem.js +119 -97
- package/lib/list/src/interface.d.ts +1 -0
- package/lib/list/src/props.d.ts +70 -31
- package/lib/list/src/props.js +25 -5
- package/lib/list/src/styles/index.cssr.js +32 -90
- package/lib/list/styles/light.d.ts +5 -8
- package/lib/list/styles/light.js +6 -9
- package/lib/mention/src/Mention.js +7 -7
- package/lib/radio/src/RadioGroup.js +5 -5
- package/lib/rate/src/Rate.js +3 -3
- package/lib/select/src/Select.js +7 -7
- package/lib/slider/src/Slider.js +3 -3
- package/lib/styles.d.ts +1 -0
- package/lib/styles.js +106 -103
- package/lib/switch/src/Switch.js +7 -7
- package/lib/tag/src/styles/index.cssr.js +5 -1
- package/lib/tag/styles/light.js +2 -2
- package/lib/theme-editor/src/ThemeEditor.d.ts +3 -0
- package/lib/themes/dark.js +2 -0
- package/lib/themes/light.js +2 -0
- package/lib/time-picker/src/TimePicker.js +7 -7
- package/lib/transfer/src/Transfer.js +3 -3
- package/lib/tree-select/src/TreeSelect.js +5 -5
- package/lib/upload/src/UploadFile.js +4 -3
- 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 +180 -38
package/es/list/src/ListItem.js
CHANGED
|
@@ -2,10 +2,13 @@ import { h, defineComponent, inject, computed, ref } from 'vue';
|
|
|
2
2
|
import { call, createRefFromPropsAndInjection, throwError } from '../../_utils';
|
|
3
3
|
import { listInjectionKey, listItemProps } from './props';
|
|
4
4
|
import { ChevronRightIcon } from '../../_internal/icons';
|
|
5
|
-
import { UBaseIcon,
|
|
5
|
+
import { UBaseIcon, UBaseSkeleton, InternalUText } from '../../_internal';
|
|
6
|
+
import { UAvatar } from '../../avatar';
|
|
7
|
+
import { UIcon } from '../../icon';
|
|
8
|
+
import { UBadge } from '../../badge';
|
|
6
9
|
export default defineComponent({
|
|
7
10
|
name: 'ListItem',
|
|
8
|
-
props: listItemProps,
|
|
11
|
+
props: Object.assign({}, listItemProps),
|
|
9
12
|
setup(props, { slots }) {
|
|
10
13
|
const listInjection = inject(listInjectionKey, null);
|
|
11
14
|
if (!listInjection) {
|
|
@@ -20,23 +23,21 @@ export default defineComponent({
|
|
|
20
23
|
const mergedHoverable = createRef('hoverable');
|
|
21
24
|
const mergedDisabled = createRef('disabled');
|
|
22
25
|
const mergedLoading = createRef('loading');
|
|
23
|
-
const
|
|
26
|
+
const mergedShowIcon = createRef('showIcon');
|
|
27
|
+
const mergedRounded = createRef('rounded');
|
|
24
28
|
const mergedClickHandler = createRef('onClick');
|
|
25
29
|
const mergedKeypressHandler = createRef('onKeypress');
|
|
26
30
|
const mergedPressHandler = createRef('onPress');
|
|
27
31
|
const mergedBlurHandler = createRef('onBlur');
|
|
28
32
|
const mergedFocusHandler = createRef('onFocus');
|
|
29
|
-
const hasFocus = computed(() =>
|
|
30
|
-
return !mergedDisabled.value && mergedHoverable.value;
|
|
31
|
-
});
|
|
33
|
+
const hasFocus = computed(() => !mergedDisabled.value && mergedHoverable.value);
|
|
32
34
|
const isPressed = ref(false);
|
|
33
35
|
const handleClick = (e) => {
|
|
34
36
|
if (!mergedDisabled.value) {
|
|
35
37
|
if (mergedClickHandler.value)
|
|
36
38
|
call(mergedClickHandler.value, e);
|
|
37
|
-
if (e.which === 1 || e.button === 0)
|
|
39
|
+
if (e.which === 1 || e.button === 0)
|
|
38
40
|
handlePress('mouseup');
|
|
39
|
-
}
|
|
40
41
|
}
|
|
41
42
|
};
|
|
42
43
|
const handleKeyPress = (e) => {
|
|
@@ -44,61 +45,45 @@ export default defineComponent({
|
|
|
44
45
|
const { code } = e;
|
|
45
46
|
if (code === 'Enter' || code === 'Space' || code === 'NumpadEnter') {
|
|
46
47
|
e.preventDefault();
|
|
47
|
-
if (!e.repeat)
|
|
48
|
+
if (!e.repeat)
|
|
48
49
|
handlePress('keyup');
|
|
49
|
-
}
|
|
50
50
|
}
|
|
51
51
|
if (mergedKeypressHandler.value)
|
|
52
52
|
call(mergedKeypressHandler.value, e);
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
const handleBlur = (e) => {
|
|
56
|
-
if (hasFocus.value) {
|
|
57
|
-
|
|
58
|
-
call(mergedBlurHandler.value, e);
|
|
56
|
+
if (hasFocus.value && mergedBlurHandler.value) {
|
|
57
|
+
call(mergedBlurHandler.value, e);
|
|
59
58
|
}
|
|
60
59
|
};
|
|
61
60
|
const handleFocus = (e) => {
|
|
62
|
-
if (hasFocus.value) {
|
|
63
|
-
|
|
64
|
-
call(mergedFocusHandler.value, e);
|
|
61
|
+
if (hasFocus.value && mergedFocusHandler.value) {
|
|
62
|
+
call(mergedFocusHandler.value, e);
|
|
65
63
|
}
|
|
66
64
|
};
|
|
67
65
|
const handlePress = (eventName) => {
|
|
68
|
-
if (mergedDisabled.value ||
|
|
69
|
-
mergedLoading.value ||
|
|
70
|
-
mergedLoadingSkeleton.value) {
|
|
66
|
+
if (mergedDisabled.value || mergedLoading.value)
|
|
71
67
|
return;
|
|
72
|
-
}
|
|
73
68
|
if (mergedPressHandler.value)
|
|
74
69
|
call(mergedPressHandler.value);
|
|
75
70
|
if (hasFocus.value) {
|
|
76
71
|
isPressed.value = true;
|
|
77
72
|
window.addEventListener(eventName, () => {
|
|
78
73
|
isPressed.value = false;
|
|
79
|
-
}, {
|
|
80
|
-
once: true,
|
|
81
|
-
passive: true
|
|
82
|
-
});
|
|
74
|
+
}, { once: true, passive: true });
|
|
83
75
|
}
|
|
84
76
|
};
|
|
85
|
-
const
|
|
86
|
-
if (!(name in props))
|
|
87
|
-
return null;
|
|
88
|
-
return props[name] || slots[name] || listInjection[name].value || null;
|
|
89
|
-
};
|
|
77
|
+
const resolveSlot = (name) => slots[name] || null;
|
|
90
78
|
return {
|
|
91
79
|
mergedClsPrefix: listInjection.mergedClsPrefix,
|
|
92
|
-
|
|
93
|
-
mergedDescriptionFirst: createRef('descriptionFirst'),
|
|
94
|
-
mergedColumnsEven: createRef('columnsEven'),
|
|
95
|
-
mergedRounded: createRef('rounded'),
|
|
80
|
+
mergedHoverable,
|
|
96
81
|
mergedDisabled,
|
|
97
82
|
mergedLoading,
|
|
98
|
-
|
|
99
|
-
|
|
83
|
+
mergedShowIcon,
|
|
84
|
+
mergedRounded,
|
|
100
85
|
mergedTag: createRef('tag'),
|
|
101
|
-
|
|
86
|
+
resolveSlot,
|
|
102
87
|
hasFocus,
|
|
103
88
|
isPressed,
|
|
104
89
|
handleClick,
|
|
@@ -106,14 +91,18 @@ export default defineComponent({
|
|
|
106
91
|
handleBlur,
|
|
107
92
|
handleFocus,
|
|
108
93
|
bordered: listInjection.bordered,
|
|
109
|
-
showDivider: listInjection.showDivider
|
|
94
|
+
showDivider: listInjection.showDivider,
|
|
95
|
+
size: listInjection.size
|
|
110
96
|
};
|
|
111
97
|
},
|
|
112
98
|
render() {
|
|
113
|
-
|
|
99
|
+
var _a, _b, _c, _d, _e, _f;
|
|
100
|
+
const { $slots, mergedClsPrefix, showDivider, prefixAlign, suffixAlign, size, resolveSlot } = this;
|
|
114
101
|
const mergedTag = this.mergedTag || 'ul';
|
|
102
|
+
const skeletonOn = !!this.mergedLoading;
|
|
115
103
|
const sharedCls = [
|
|
116
104
|
`${mergedClsPrefix}-list-item`,
|
|
105
|
+
`${mergedClsPrefix}-list-item--${size}`,
|
|
117
106
|
this.mergedHoverable && `${mergedClsPrefix}-list-item--hoverable`,
|
|
118
107
|
this.mergedRounded && `${mergedClsPrefix}-list-item--rounded`,
|
|
119
108
|
this.mergedDisabled && `${mergedClsPrefix}-list-item--disabled`,
|
|
@@ -127,70 +116,103 @@ export default defineComponent({
|
|
|
127
116
|
onBlur: this.handleBlur,
|
|
128
117
|
onFocus: this.handleFocus
|
|
129
118
|
};
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if ($slots.default) {
|
|
133
|
-
return h(mergedTag, Object.assign({ class: [...sharedCls] }, sharedAttrs), [
|
|
134
|
-
prefixNode,
|
|
135
|
-
h("div", { class: `${mergedClsPrefix}-list-item__main` }, $slots.default()),
|
|
136
|
-
suffixNode,
|
|
137
|
-
showDivider && h("hr", { class: `${mergedClsPrefix}-list-item__divider` })
|
|
138
|
-
]);
|
|
119
|
+
function renderIcon(icon) {
|
|
120
|
+
return () => h(UIcon, null, { default: () => h(icon) });
|
|
139
121
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
122
|
+
const renderAvatar = () => {
|
|
123
|
+
if (!Object.values(this.avatar).length)
|
|
124
|
+
return null;
|
|
125
|
+
const Avatar = (h(UAvatar, Object.assign({ size: size }, this.avatar, { icon: undefined }), renderIcon(this.avatar.icon)));
|
|
126
|
+
return this.avatar.hasBadge ? (h(UBadge, Object.assign({}, this.badge), { default: () => Avatar })) : (Avatar);
|
|
127
|
+
};
|
|
128
|
+
const prefixSkeletonSizes = {
|
|
129
|
+
large: 54,
|
|
130
|
+
medium: 48,
|
|
131
|
+
small: 42
|
|
132
|
+
};
|
|
133
|
+
const prefixSkeletonSize = prefixSkeletonSizes[size];
|
|
134
|
+
const prefixSkeletonborderRadius = this.avatar.circle ? 100 : 12;
|
|
135
|
+
const prefixNode = $slots.prefix || renderAvatar() ? (h("div", { class: `${mergedClsPrefix}-list-item__prefix ${mergedClsPrefix}-align-${prefixAlign}` }, skeletonOn || this.loadingPrefix ? (h(UBaseSkeleton, { width: `${prefixSkeletonSize}px`, height: `${prefixSkeletonSize}px`, style: { borderRadius: `${prefixSkeletonborderRadius}px` } })) : $slots.prefix ? ($slots.prefix()) : (renderAvatar()))) : null;
|
|
136
|
+
const header = ((_a = this.header) === null || _a === void 0 ? void 0 : _a.text) || resolveSlot('header');
|
|
137
|
+
const description = ((_b = this.description) === null || _b === void 0 ? void 0 : _b.text) || resolveSlot('description');
|
|
138
|
+
const hasLeft = !!(header || description);
|
|
139
|
+
const textVariant = {
|
|
140
|
+
large: {
|
|
141
|
+
title: 'body-l-medium',
|
|
142
|
+
subtitle: 'body-m-medium'
|
|
143
|
+
},
|
|
144
|
+
medium: {
|
|
145
|
+
title: 'body-m-medium',
|
|
146
|
+
subtitle: 'body-s-medium'
|
|
147
|
+
},
|
|
148
|
+
small: {
|
|
149
|
+
title: 'body-l-medium',
|
|
150
|
+
subtitle: 'body-m-medium'
|
|
151
151
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
152
|
+
};
|
|
153
|
+
const defaultHeaderProps = {
|
|
154
|
+
position: 'top',
|
|
155
|
+
variant: textVariant[size].title,
|
|
156
|
+
align: 'center',
|
|
157
|
+
skeleton: {
|
|
158
|
+
sharp: false,
|
|
159
|
+
height: '24px'
|
|
159
160
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
161
|
+
};
|
|
162
|
+
const defaultDescriptionProps = {
|
|
163
|
+
position: 'bottom',
|
|
164
|
+
variant: textVariant[size].subtitle,
|
|
165
|
+
skeleton: {
|
|
166
|
+
sharp: false,
|
|
167
|
+
height: '24px'
|
|
167
168
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
...sharedCls,
|
|
176
|
-
`${mergedClsPrefix}-list-item--default`,
|
|
177
|
-
this.mergedDescriptionFirst &&
|
|
178
|
-
`${mergedClsPrefix}-list-item--description-first`,
|
|
179
|
-
this.mergedColumnsEven &&
|
|
180
|
-
`${mergedClsPrefix}-list-item--columns-even`,
|
|
181
|
-
this.mergedLoadingSkeleton &&
|
|
182
|
-
`${mergedClsPrefix}-list-item--loading-skeleton`
|
|
183
|
-
] }, sharedAttrs), [
|
|
184
|
-
prefixNode,
|
|
185
|
-
h("div", { class: `${mergedClsPrefix}-list-item__main` },
|
|
186
|
-
avatarNode,
|
|
187
|
-
h("div", { class: `${mergedClsPrefix}-list-item__text` },
|
|
188
|
-
leftNode,
|
|
189
|
-
rightNode),
|
|
190
|
-
iconNode),
|
|
191
|
-
suffixNode,
|
|
192
|
-
showDivider && h("hr", { class: `${mergedClsPrefix}-list-item__divider` })
|
|
193
|
-
]);
|
|
169
|
+
};
|
|
170
|
+
const headerProps = Object.assign(Object.assign(Object.assign({}, defaultHeaderProps), this.header), { skeleton: Object.assign(Object.assign({}, defaultHeaderProps.skeleton), (_c = this.header) === null || _c === void 0 ? void 0 : _c.skeleton) });
|
|
171
|
+
const descriptionProps = Object.assign(Object.assign(Object.assign({}, defaultDescriptionProps), this.description), { skeleton: Object.assign(Object.assign({}, defaultDescriptionProps.skeleton), (_d = this.description) === null || _d === void 0 ? void 0 : _d.skeleton) });
|
|
172
|
+
function renderTextNode(content, props, classSuffix) {
|
|
173
|
+
return content ? (h(InternalUText, Object.assign({}, props, { text: undefined, align: undefined, skeleton: undefined, class: `${mergedClsPrefix}-list-item__${classSuffix}` }), {
|
|
174
|
+
default: () => skeletonOn || (props === null || props === void 0 ? void 0 : props.loading) ? (h(UBaseSkeleton, Object.assign({}, props.skeletonPro, { style: { borderRadius: '6px' } }))) : typeof content === 'string' ? (props.text) : (content())
|
|
175
|
+
})) : null;
|
|
194
176
|
}
|
|
177
|
+
const headerNode = renderTextNode(header, headerProps, 'title');
|
|
178
|
+
const descriptionNode = renderTextNode(description, descriptionProps, 'subtitle');
|
|
179
|
+
const headerSide = ((_e = this.headerSide) === null || _e === void 0 ? void 0 : _e.text) || resolveSlot('headerSide');
|
|
180
|
+
const descriptionSide = ((_f = this.descriptionSide) === null || _f === void 0 ? void 0 : _f.text) || resolveSlot('descriptionSide');
|
|
181
|
+
const hasRight = !!(headerSide || descriptionSide);
|
|
182
|
+
const headerSideProps = Object.assign(Object.assign({}, defaultHeaderProps), this.headerSide);
|
|
183
|
+
const descriptionSideProps = Object.assign(Object.assign({}, defaultDescriptionProps), this.descriptionSide);
|
|
184
|
+
const headerSideNode = renderTextNode(headerSide, headerSideProps, 'title');
|
|
185
|
+
const descriptionSideNode = renderTextNode(descriptionSide, descriptionSideProps, 'subtitle');
|
|
186
|
+
const leftNode = hasLeft ? (h("div", { class: [
|
|
187
|
+
`${mergedClsPrefix}-list-item__content`,
|
|
188
|
+
`${mergedClsPrefix}-list-item__content--left`,
|
|
189
|
+
headerProps.align && `${mergedClsPrefix}-align-${headerProps.align}`,
|
|
190
|
+
!(headerSide || descriptionSide) &&
|
|
191
|
+
`${mergedClsPrefix}-list-item__content--full`
|
|
192
|
+
] }, (headerProps === null || headerProps === void 0 ? void 0 : headerProps.position) === 'top' &&
|
|
193
|
+
descriptionProps.position === 'bottom'
|
|
194
|
+
? [headerNode, descriptionNode]
|
|
195
|
+
: [descriptionNode, headerNode])) : null;
|
|
196
|
+
const rightNode = hasRight ? (h("div", { class: [
|
|
197
|
+
`${mergedClsPrefix}-list-item__content`,
|
|
198
|
+
`${mergedClsPrefix}-list-item__content--right`,
|
|
199
|
+
headerSideProps.align &&
|
|
200
|
+
`${mergedClsPrefix}-align-${headerSideProps.align}`,
|
|
201
|
+
!(header || description) &&
|
|
202
|
+
`${mergedClsPrefix}-list-item__content--full`
|
|
203
|
+
] }, (headerSideProps === null || headerSideProps === void 0 ? void 0 : headerSideProps.position) === 'top' &&
|
|
204
|
+
descriptionSideProps.position === 'bottom'
|
|
205
|
+
? [headerSideNode, descriptionSideNode]
|
|
206
|
+
: [descriptionSideNode, headerSideNode])) : null;
|
|
207
|
+
const suffixIcon = !skeletonOn && this.mergedShowIcon ? (h(UBaseIcon, { clsPrefix: mergedClsPrefix }, () => h(ChevronRightIcon, null))) : null;
|
|
208
|
+
const suffixSkeletonSize = 24;
|
|
209
|
+
const suffixNode = (h("div", { class: `${mergedClsPrefix}-list-item__suffix ${mergedClsPrefix}-align-${suffixAlign}` }, (skeletonOn || this.loadingSuffix) && this.mergedShowIcon ? (h(UBaseSkeleton, { width: `${suffixSkeletonSize}px`, height: `${suffixSkeletonSize}px`, circle: true })) : ([$slots.suffix ? $slots.suffix() : suffixIcon])));
|
|
210
|
+
return h(mergedTag, Object.assign({ class: sharedCls }, sharedAttrs), [
|
|
211
|
+
prefixNode,
|
|
212
|
+
h("div", { class: `${mergedClsPrefix}-list-item__main` },
|
|
213
|
+
h("div", { class: `${mergedClsPrefix}-list-item__text` }, $slots.default ? $slots.default() : [leftNode, rightNode])),
|
|
214
|
+
suffixNode,
|
|
215
|
+
showDivider && h("hr", { class: `${mergedClsPrefix}-list-item__divider` })
|
|
216
|
+
]);
|
|
195
217
|
}
|
|
196
218
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ExtractPublicPropTypes } from '../../_utils';
|
|
2
2
|
import type { PropType, Ref } from 'vue';
|
|
3
3
|
import { VNodeChild } from 'vue';
|
|
4
|
+
export type Size = 'small' | 'medium' | 'large';
|
|
4
5
|
export interface BooleanProp {
|
|
5
6
|
type: BooleanConstructor;
|
|
6
7
|
default: undefined;
|
package/es/list/src/props.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { ArrayMouseHandler, ArrayKeyboardHandler, ArrayEmptyHandler, ArrayFocusHandler, ExtractPublicPropTypes } from '../../_utils';
|
|
2
|
-
import type { PropType, Ref } from 'vue';
|
|
3
|
-
import { ListItemPropsBoolean, ListItemPropsRenderable, ExtractIntoInjection, ListInjectionBoolean, ListInjectionRenderable } from './interface';
|
|
2
|
+
import type { Component, PropType, Ref } from 'vue';
|
|
3
|
+
import { ListItemPropsBoolean, ListItemPropsRenderable, ExtractIntoInjection, ListInjectionBoolean, ListInjectionRenderable, Size } from './interface';
|
|
4
|
+
import { InternalTextProps } from '../../_internal/typography';
|
|
5
|
+
import { SkeletonProps } from '../../_internal/skeleton';
|
|
6
|
+
import { AvatarProps } from '../../avatar';
|
|
7
|
+
import { BadgeProps } from '../../badge';
|
|
4
8
|
export declare const listItemPropsBoolean: Array<keyof ListItemPropsBoolean>;
|
|
5
9
|
export declare const listItemPropsRenderable: Array<keyof ListItemPropsRenderable>;
|
|
6
10
|
export declare const listItemBaseProps: {
|
|
@@ -39,11 +43,55 @@ export declare const listItemBaseProps: {
|
|
|
39
43
|
icon: import("./interface").RenderableProp;
|
|
40
44
|
avatar: import("./interface").RenderableProp;
|
|
41
45
|
};
|
|
46
|
+
export type HeaderPropObject = InternalTextProps & Partial<{
|
|
47
|
+
loading: boolean;
|
|
48
|
+
position: 'top' | 'bottom';
|
|
49
|
+
skeleton: SkeletonProps;
|
|
50
|
+
align: 'stretch' | 'start' | 'center' | 'end';
|
|
51
|
+
}>;
|
|
52
|
+
export type DescriptionPropsObject = InternalTextProps & Partial<{
|
|
53
|
+
loading: boolean;
|
|
54
|
+
position: 'top' | 'bottom';
|
|
55
|
+
skeleton: SkeletonProps;
|
|
56
|
+
}>;
|
|
42
57
|
export declare const listItemProps: {
|
|
58
|
+
avatar: {
|
|
59
|
+
type: PropType<AvatarProps & {
|
|
60
|
+
icon: Component;
|
|
61
|
+
hasBadge?: boolean;
|
|
62
|
+
}>;
|
|
63
|
+
default: () => {};
|
|
64
|
+
};
|
|
65
|
+
badge: {
|
|
66
|
+
type: PropType<BadgeProps>;
|
|
67
|
+
default: () => {};
|
|
68
|
+
};
|
|
43
69
|
tag: {
|
|
44
70
|
type: StringConstructor;
|
|
45
71
|
default: undefined;
|
|
46
72
|
};
|
|
73
|
+
prefixAlign: {
|
|
74
|
+
type: PropType<"start" | "center" | "end">;
|
|
75
|
+
default: string;
|
|
76
|
+
};
|
|
77
|
+
suffixAlign: {
|
|
78
|
+
type: PropType<"start" | "center" | "end">;
|
|
79
|
+
default: string;
|
|
80
|
+
};
|
|
81
|
+
loadingPrefix: BooleanConstructor;
|
|
82
|
+
loadingSuffix: BooleanConstructor;
|
|
83
|
+
header: {
|
|
84
|
+
type: PropType<HeaderPropObject>;
|
|
85
|
+
};
|
|
86
|
+
description: {
|
|
87
|
+
type: PropType<DescriptionPropsObject>;
|
|
88
|
+
};
|
|
89
|
+
headerSide: {
|
|
90
|
+
type: PropType<HeaderPropObject>;
|
|
91
|
+
};
|
|
92
|
+
descriptionSide: {
|
|
93
|
+
type: PropType<DescriptionPropsObject>;
|
|
94
|
+
};
|
|
47
95
|
onClick: {
|
|
48
96
|
type: PropType<ArrayMouseHandler | undefined>;
|
|
49
97
|
default: undefined;
|
|
@@ -72,14 +120,13 @@ export declare const listItemProps: {
|
|
|
72
120
|
disabled: import("./interface").BooleanProp;
|
|
73
121
|
loading: import("./interface").BooleanProp;
|
|
74
122
|
loadingSkeleton: import("./interface").BooleanProp;
|
|
75
|
-
header: import("./interface").RenderableProp;
|
|
76
|
-
description: import("./interface").RenderableProp;
|
|
77
|
-
headerSide: import("./interface").RenderableProp;
|
|
78
|
-
descriptionSide: import("./interface").RenderableProp;
|
|
79
123
|
icon: import("./interface").RenderableProp;
|
|
80
|
-
avatar: import("./interface").RenderableProp;
|
|
81
124
|
};
|
|
82
125
|
export declare const listProps: {
|
|
126
|
+
size: {
|
|
127
|
+
type: PropType<Size>;
|
|
128
|
+
default: string;
|
|
129
|
+
};
|
|
83
130
|
showIcon: {
|
|
84
131
|
type: BooleanConstructor;
|
|
85
132
|
default: boolean;
|
|
@@ -129,18 +176,12 @@ export declare const listProps: {
|
|
|
129
176
|
icon: import("./interface").RenderableProp;
|
|
130
177
|
avatar: import("./interface").RenderableProp;
|
|
131
178
|
theme: PropType<import("../../_mixins").Theme<"List", {
|
|
132
|
-
padding: string;
|
|
133
179
|
iconSize: string;
|
|
134
180
|
iconSpace: string;
|
|
135
181
|
suffixSpace: string;
|
|
136
182
|
prefixSpace: string;
|
|
137
|
-
titleSize: string;
|
|
138
|
-
titleLineHeight: string;
|
|
139
|
-
subtitleSize: string;
|
|
140
|
-
subtitleLineHeight: string;
|
|
141
183
|
subtitleColor: string;
|
|
142
184
|
avatarSpace: string;
|
|
143
|
-
minHeight: string;
|
|
144
185
|
colorFocus: string;
|
|
145
186
|
pressedScale: string;
|
|
146
187
|
textColorDisabled: string;
|
|
@@ -154,22 +195,19 @@ export declare const listProps: {
|
|
|
154
195
|
borderColor: string;
|
|
155
196
|
borderColorModal: string;
|
|
156
197
|
borderColorPopover: string;
|
|
157
|
-
|
|
158
|
-
|
|
198
|
+
borderRadiusLarge: string;
|
|
199
|
+
borderRadiusMedium: string;
|
|
200
|
+
borderRadiusSmall: string;
|
|
201
|
+
padding: string;
|
|
202
|
+
suffixSize: string;
|
|
159
203
|
}, any>>;
|
|
160
204
|
themeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"List", {
|
|
161
|
-
padding: string;
|
|
162
205
|
iconSize: string;
|
|
163
206
|
iconSpace: string;
|
|
164
207
|
suffixSpace: string;
|
|
165
208
|
prefixSpace: string;
|
|
166
|
-
titleSize: string;
|
|
167
|
-
titleLineHeight: string;
|
|
168
|
-
subtitleSize: string;
|
|
169
|
-
subtitleLineHeight: string;
|
|
170
209
|
subtitleColor: string;
|
|
171
210
|
avatarSpace: string;
|
|
172
|
-
minHeight: string;
|
|
173
211
|
colorFocus: string;
|
|
174
212
|
pressedScale: string;
|
|
175
213
|
textColorDisabled: string;
|
|
@@ -183,22 +221,19 @@ export declare const listProps: {
|
|
|
183
221
|
borderColor: string;
|
|
184
222
|
borderColorModal: string;
|
|
185
223
|
borderColorPopover: string;
|
|
186
|
-
|
|
187
|
-
|
|
224
|
+
borderRadiusLarge: string;
|
|
225
|
+
borderRadiusMedium: string;
|
|
226
|
+
borderRadiusSmall: string;
|
|
227
|
+
padding: string;
|
|
228
|
+
suffixSize: string;
|
|
188
229
|
}, any>>>;
|
|
189
230
|
builtinThemeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"List", {
|
|
190
|
-
padding: string;
|
|
191
231
|
iconSize: string;
|
|
192
232
|
iconSpace: string;
|
|
193
233
|
suffixSpace: string;
|
|
194
234
|
prefixSpace: string;
|
|
195
|
-
titleSize: string;
|
|
196
|
-
titleLineHeight: string;
|
|
197
|
-
subtitleSize: string;
|
|
198
|
-
subtitleLineHeight: string;
|
|
199
235
|
subtitleColor: string;
|
|
200
236
|
avatarSpace: string;
|
|
201
|
-
minHeight: string;
|
|
202
237
|
colorFocus: string;
|
|
203
238
|
pressedScale: string;
|
|
204
239
|
textColorDisabled: string;
|
|
@@ -212,8 +247,11 @@ export declare const listProps: {
|
|
|
212
247
|
borderColor: string;
|
|
213
248
|
borderColorModal: string;
|
|
214
249
|
borderColorPopover: string;
|
|
215
|
-
|
|
216
|
-
|
|
250
|
+
borderRadiusLarge: string;
|
|
251
|
+
borderRadiusMedium: string;
|
|
252
|
+
borderRadiusSmall: string;
|
|
253
|
+
padding: string;
|
|
254
|
+
suffixSize: string;
|
|
217
255
|
}, any>>>;
|
|
218
256
|
};
|
|
219
257
|
export type ListInjection = ExtractIntoInjection<typeof listItemBaseProps> & ListInjectionBoolean & ListInjectionRenderable & {
|
|
@@ -222,6 +260,7 @@ export type ListInjection = ExtractIntoInjection<typeof listItemBaseProps> & Lis
|
|
|
222
260
|
bordered: Ref<boolean>;
|
|
223
261
|
clickable: Ref<boolean>;
|
|
224
262
|
showDivider: Ref<boolean>;
|
|
263
|
+
size: Ref<Size>;
|
|
225
264
|
};
|
|
226
265
|
export declare const listInjectionKey: import("vue").InjectionKey<ListInjection>;
|
|
227
266
|
export type ListItemProps = ExtractPublicPropTypes<typeof listItemProps>;
|
package/es/list/src/props.js
CHANGED
|
@@ -7,8 +7,7 @@ export const listItemPropsBoolean = [
|
|
|
7
7
|
'hoverable',
|
|
8
8
|
'rounded',
|
|
9
9
|
'disabled',
|
|
10
|
-
'loading'
|
|
11
|
-
'loadingSkeleton'
|
|
10
|
+
'loading'
|
|
12
11
|
];
|
|
13
12
|
export const listItemPropsRenderable = [
|
|
14
13
|
'header',
|
|
@@ -42,11 +41,32 @@ export const listItemBaseProps = Object.assign(Object.assign(Object.assign({}, l
|
|
|
42
41
|
type: [Function, Array, undefined],
|
|
43
42
|
default: undefined
|
|
44
43
|
} });
|
|
45
|
-
|
|
44
|
+
const headerProps = {
|
|
45
|
+
type: Object
|
|
46
|
+
};
|
|
47
|
+
const descriptionProps = {
|
|
48
|
+
type: Object
|
|
49
|
+
};
|
|
50
|
+
export const listItemProps = Object.assign(Object.assign({}, listItemBaseProps), { avatar: {
|
|
51
|
+
type: Object,
|
|
52
|
+
default: () => ({})
|
|
53
|
+
}, badge: {
|
|
54
|
+
type: Object,
|
|
55
|
+
default: () => ({})
|
|
56
|
+
}, tag: {
|
|
46
57
|
type: String,
|
|
47
58
|
default: undefined
|
|
48
|
-
}
|
|
49
|
-
|
|
59
|
+
}, prefixAlign: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: 'start'
|
|
62
|
+
}, suffixAlign: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: 'start'
|
|
65
|
+
}, loadingPrefix: Boolean, loadingSuffix: Boolean, header: headerProps, description: descriptionProps, headerSide: headerProps, descriptionSide: descriptionProps });
|
|
66
|
+
export const listProps = Object.assign(Object.assign(Object.assign({}, useTheme.props), listItemBaseProps), { size: {
|
|
67
|
+
type: [String],
|
|
68
|
+
default: 'medium'
|
|
69
|
+
}, showIcon: {
|
|
50
70
|
type: Boolean,
|
|
51
71
|
default: true
|
|
52
72
|
}, tag: {
|