@uzum-tech/ui 1.14.3 → 1.14.5
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 +22847 -22848
- package/dist/index.prod.js +3 -3
- package/es/_internal/select-menu/src/SelectOption.d.ts +3 -3
- package/es/_internal/select-menu/src/SelectOption.js +23 -20
- package/es/_internal/select-menu/src/styles/index.cssr.js +5 -4
- package/es/_internal/selection/src/styles/index.cssr.js +3 -0
- package/es/carousel/src/Carousel.d.ts +8 -3
- package/es/carousel/src/Carousel.js +42 -26
- package/es/carousel/src/CarouselArrow.js +1 -1
- package/es/carousel/src/CarouselContext.d.ts +2 -2
- package/es/carousel/src/CarouselContext.js +4 -4
- package/es/carousel/src/CarouselDots.js +1 -1
- package/es/carousel/src/CarouselItem.d.ts +1 -1
- package/es/carousel/src/CarouselItem.js +6 -3
- package/es/carousel/src/interface.d.ts +16 -0
- package/es/carousel/src/utils/index.js +4 -4
- package/es/carousel/styles/light.d.ts +1 -2
- package/es/carousel/styles/light.js +2 -2
- package/es/mapping-card/src/MappingCard.d.ts +9 -0
- package/es/mapping-card/src/MappingCardList.d.ts +3 -5
- package/es/mapping-card/src/MappingCardList.js +11 -57
- package/es/mapping-card/src/MappingCardParts/Body.js +9 -3
- package/es/mapping-card/src/MappingCardParts/Header.js +21 -19
- package/es/mapping-card/src/interface.d.ts +5 -0
- package/es/mapping-card/src/interface.js +4 -0
- package/es/mapping-card/src/styles/index.cssr.js +4 -2
- package/es/version.d.ts +1 -1
- package/es/version.js +1 -1
- package/lib/_internal/select-menu/src/SelectOption.d.ts +3 -3
- package/lib/_internal/select-menu/src/SelectOption.js +22 -19
- package/lib/_internal/select-menu/src/styles/index.cssr.js +5 -4
- package/lib/_internal/selection/src/styles/index.cssr.js +3 -0
- package/lib/carousel/src/Carousel.d.ts +8 -3
- package/lib/carousel/src/Carousel.js +41 -25
- package/lib/carousel/src/CarouselContext.d.ts +2 -2
- package/lib/carousel/src/CarouselContext.js +6 -7
- package/lib/carousel/src/CarouselDots.js +1 -1
- package/lib/carousel/src/CarouselItem.d.ts +1 -1
- package/lib/carousel/src/CarouselItem.js +7 -5
- package/lib/carousel/src/interface.d.ts +16 -0
- package/lib/carousel/src/utils/index.js +4 -4
- package/lib/carousel/styles/light.d.ts +1 -2
- package/lib/carousel/styles/light.js +4 -5
- package/lib/mapping-card/src/MappingCard.d.ts +9 -0
- package/lib/mapping-card/src/MappingCardList.d.ts +3 -5
- package/lib/mapping-card/src/MappingCardList.js +10 -56
- package/lib/mapping-card/src/MappingCardParts/Body.js +9 -3
- package/lib/mapping-card/src/MappingCardParts/Header.js +20 -18
- package/lib/mapping-card/src/interface.d.ts +5 -0
- package/lib/mapping-card/src/interface.js +4 -0
- package/lib/mapping-card/src/styles/index.cssr.js +4 -2
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/web-types.json +8 -1
|
@@ -1,79 +1,33 @@
|
|
|
1
|
-
import { h, defineComponent, computed
|
|
1
|
+
import { h, defineComponent, computed } from 'vue';
|
|
2
2
|
import { useConfig } from '../../_mixins';
|
|
3
|
-
import { call } from '../../_utils';
|
|
4
3
|
import { UPagination } from '../../pagination';
|
|
4
|
+
import { UFlex } from '../../flex';
|
|
5
5
|
import UMappingCard from './MappingCard';
|
|
6
6
|
import { mappingCardListProps } from './interface';
|
|
7
7
|
export default defineComponent({
|
|
8
8
|
name: 'MappingCardList',
|
|
9
9
|
props: mappingCardListProps,
|
|
10
10
|
setup(props) {
|
|
11
|
-
var _a;
|
|
12
11
|
const { mergedClsPrefixRef } = useConfig(props);
|
|
13
|
-
const uncontrolledPageRef = ref(1);
|
|
14
|
-
const uncontrolledPageSizeRef = ref(props.pagination !== false ? (_a = props.pagination.pageSize) !== null && _a !== void 0 ? _a : 10 : 10);
|
|
15
|
-
const mergedPageRef = computed(() => {
|
|
16
|
-
const { pagination } = props;
|
|
17
|
-
if (pagination !== false && pagination.page !== undefined) {
|
|
18
|
-
return pagination.page;
|
|
19
|
-
}
|
|
20
|
-
return uncontrolledPageRef.value;
|
|
21
|
-
});
|
|
22
|
-
const mergedPageSizeRef = computed(() => {
|
|
23
|
-
const { pagination } = props;
|
|
24
|
-
if (pagination !== false && pagination.pageSize !== undefined) {
|
|
25
|
-
return pagination.pageSize;
|
|
26
|
-
}
|
|
27
|
-
return uncontrolledPageSizeRef.value;
|
|
28
|
-
});
|
|
29
|
-
const paginatedItemsRef = computed(() => {
|
|
30
|
-
const { pagination, items } = props;
|
|
31
|
-
if (!pagination)
|
|
32
|
-
return items;
|
|
33
|
-
const pageSize = mergedPageSizeRef.value;
|
|
34
|
-
const startIndex = (mergedPageRef.value - 1) * pageSize;
|
|
35
|
-
return items.slice(startIndex, startIndex + pageSize);
|
|
36
|
-
});
|
|
37
|
-
function doUpdatePage(page) {
|
|
38
|
-
uncontrolledPageRef.value = page;
|
|
39
|
-
const pagination = props.pagination;
|
|
40
|
-
if (!pagination)
|
|
41
|
-
return;
|
|
42
|
-
if (pagination['onUpdate:page']) {
|
|
43
|
-
call(pagination['onUpdate:page'], page);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
function doUpdatePageSize(pageSize) {
|
|
47
|
-
uncontrolledPageSizeRef.value = pageSize;
|
|
48
|
-
uncontrolledPageRef.value = 1;
|
|
49
|
-
const pagination = props.pagination;
|
|
50
|
-
if (!pagination)
|
|
51
|
-
return;
|
|
52
|
-
if (pagination['onUpdate:pageSize']) {
|
|
53
|
-
call(pagination['onUpdate:pageSize'], pageSize);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
12
|
const mergedPaginationRef = computed(() => {
|
|
57
13
|
const { pagination } = props;
|
|
58
|
-
if (
|
|
14
|
+
if (pagination === false)
|
|
59
15
|
return null;
|
|
60
|
-
return
|
|
16
|
+
return pagination;
|
|
61
17
|
});
|
|
62
18
|
return {
|
|
63
19
|
mergedClsPrefix: mergedClsPrefixRef,
|
|
64
|
-
paginatedItems: paginatedItemsRef,
|
|
65
20
|
mergedPagination: mergedPaginationRef
|
|
66
21
|
};
|
|
67
22
|
},
|
|
68
23
|
render() {
|
|
69
|
-
const { mergedClsPrefix,
|
|
24
|
+
const { mergedClsPrefix, mergedPagination, gap, items } = this;
|
|
70
25
|
return (h("div", { class: `${mergedClsPrefix}-mapping-card-list` },
|
|
71
|
-
h(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
h(UPagination, Object.assign({}, mergedPagination)))) : null));
|
|
26
|
+
h(UFlex, { vertical: true, size: gap, class: `${mergedClsPrefix}-mapping-card-list__items` }, {
|
|
27
|
+
default: () => items.map((item, index) => h(UMappingCard, Object.assign({ key: index }, item)))
|
|
28
|
+
}),
|
|
29
|
+
mergedPagination ? (h(UFlex, { justify: "flex-end", class: `${mergedClsPrefix}-mapping-card-list__pagination` }, {
|
|
30
|
+
default: () => h(UPagination, Object.assign({}, mergedPagination))
|
|
31
|
+
})) : null));
|
|
78
32
|
}
|
|
79
33
|
});
|
|
@@ -31,10 +31,16 @@ export default defineComponent({
|
|
|
31
31
|
})));
|
|
32
32
|
};
|
|
33
33
|
return (h("div", { class: `${prefix}-mapping-card__body` }, rows.map((group, index) => {
|
|
34
|
-
var _a
|
|
34
|
+
var _a;
|
|
35
35
|
return (h("div", { key: (_a = group.id) !== null && _a !== void 0 ? _a : index, class: `${prefix}-mapping-card__body-group` },
|
|
36
|
-
h(UList, { showDivider: false, showIcon: false },
|
|
37
|
-
|
|
36
|
+
h(UList, { showDivider: false, showIcon: false }, {
|
|
37
|
+
default: () => {
|
|
38
|
+
var _a;
|
|
39
|
+
return (h(UGrid, { cols: (_a = props.cols) !== null && _a !== void 0 ? _a : 3, layoutShiftDisabled: true, class: `${prefix}-mapping-card__body-items` }, {
|
|
40
|
+
default: () => group.items.map(renderRowItem)
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
}),
|
|
38
44
|
group.icon && (h("div", { class: `${prefix}-mapping-card__body-group-icon` }, group.icon()))));
|
|
39
45
|
})));
|
|
40
46
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h, defineComponent, inject } from 'vue';
|
|
1
|
+
import { h, defineComponent, inject, Fragment } from 'vue';
|
|
2
2
|
import { UButton } from '../../../button';
|
|
3
3
|
import { UIcon } from '../../../icon';
|
|
4
4
|
import { UFlex } from '../../../flex';
|
|
@@ -22,23 +22,25 @@ export default defineComponent({
|
|
|
22
22
|
const locale = localeRef.value;
|
|
23
23
|
const renderTextProp = (value) => typeof value === 'function' ? value() : value;
|
|
24
24
|
return (h("div", { class: `${prefix}-mapping-card__header` },
|
|
25
|
-
h(UFlex, { align: "center", size: "small", class: `${prefix}-mapping-card__header-info` },
|
|
26
|
-
h(
|
|
27
|
-
h("div", { class: `${prefix}-mapping-card__header-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
25
|
+
h(UFlex, { align: "center", size: "small", class: `${prefix}-mapping-card__header-info` }, {
|
|
26
|
+
default: () => (h(Fragment, null,
|
|
27
|
+
h("div", { class: `${prefix}-mapping-card__header-info-text` },
|
|
28
|
+
h("div", { class: `${prefix}-mapping-card__header-title` }, renderTextProp(props.title)),
|
|
29
|
+
props.description && (h("div", { class: `${prefix}-mapping-card__header-description` }, renderTextProp(props.description)))),
|
|
30
|
+
!props.hideCopy && (h(UTooltip, null, {
|
|
31
|
+
trigger: () => {
|
|
32
|
+
var _a;
|
|
33
|
+
return (h(UButton, Object.assign({ quaternary: true, circle: true }, ((_a = props.copyButtonProps) !== null && _a !== void 0 ? _a : {}), { theme: theme.peers.Button, themeOverrides: theme.peerOverrides.Button, onClick: () => { var _a; return (_a = props.onCopy) === null || _a === void 0 ? void 0 : _a.call(props); } }), {
|
|
34
|
+
icon: () => {
|
|
35
|
+
var _a;
|
|
36
|
+
return (h(UIcon, Object.assign({}, ((_a = props.copyIconProps) !== null && _a !== void 0 ? _a : {}), { theme: theme.peers.CopyIcon, themeOverrides: theme.peerOverrides.CopyIcon }), { default: () => h(ContentCopy, null) }));
|
|
37
|
+
}
|
|
38
|
+
}));
|
|
39
|
+
},
|
|
40
|
+
default: () => locale.copyTooltip
|
|
41
|
+
}))))
|
|
42
|
+
}),
|
|
43
|
+
!props.hideHeaderActions && (h(UFlex, { align: "center", size: "small" }, {
|
|
42
44
|
default: () => resolveSlot(slots.headerActions, () => {
|
|
43
45
|
var _a, _b;
|
|
44
46
|
const buttons = [];
|
|
@@ -69,6 +71,6 @@ export default defineComponent({
|
|
|
69
71
|
}));
|
|
70
72
|
return buttons;
|
|
71
73
|
})
|
|
72
|
-
})));
|
|
74
|
+
}))));
|
|
73
75
|
}
|
|
74
76
|
});
|
|
@@ -36,6 +36,7 @@ export interface MappingCardInterface {
|
|
|
36
36
|
defaultSpan?: number;
|
|
37
37
|
copy?: () => string;
|
|
38
38
|
hideCopy?: boolean;
|
|
39
|
+
hideHeaderActions?: boolean;
|
|
39
40
|
copyButtonProps?: Partial<ButtonProps>;
|
|
40
41
|
copyIconProps?: Partial<IconProps>;
|
|
41
42
|
headerEditButtonProps?: Partial<ButtonProps>;
|
|
@@ -72,6 +73,10 @@ export declare const mappingCardProps: {
|
|
|
72
73
|
readonly type: PropType<MappingCardInterface["hideCopy"]>;
|
|
73
74
|
readonly default: false;
|
|
74
75
|
};
|
|
76
|
+
readonly hideHeaderActions: {
|
|
77
|
+
readonly type: PropType<MappingCardInterface["hideHeaderActions"]>;
|
|
78
|
+
readonly default: false;
|
|
79
|
+
};
|
|
75
80
|
readonly copyButtonProps: PropType<MappingCardInterface["copyButtonProps"]>;
|
|
76
81
|
readonly copyIconProps: PropType<MappingCardInterface["copyIconProps"]>;
|
|
77
82
|
readonly headerEditButtonProps: PropType<MappingCardInterface["headerEditButtonProps"]>;
|
|
@@ -8,7 +8,7 @@ import { c, cB, cE, cM } from '../../../_utils/cssr';
|
|
|
8
8
|
// --u-body-padding
|
|
9
9
|
// --u-title-color
|
|
10
10
|
// --u-description-color
|
|
11
|
-
export default cB('mapping-card', `
|
|
11
|
+
export default c([cB('mapping-card', `
|
|
12
12
|
background-color: var(--u-background-color);
|
|
13
13
|
border: 1px solid var(--u-border-color);
|
|
14
14
|
border-radius: var(--u-border-radius);
|
|
@@ -87,4 +87,6 @@ export default cB('mapping-card', `
|
|
|
87
87
|
color: var(--u-arrow-color);
|
|
88
88
|
font-size: 16px;
|
|
89
89
|
flex-shrink: 0;
|
|
90
|
-
`)])
|
|
90
|
+
`)]), cB('mapping-card-list', [cE('pagination', `
|
|
91
|
+
margin-top: 16px;
|
|
92
|
+
`)])]);
|
package/es/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "1.14.
|
|
1
|
+
declare const _default: "1.14.5";
|
|
2
2
|
export default _default;
|
package/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '1.14.
|
|
1
|
+
export default '1.14.5';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import type { TreeNode } from 'treemate';
|
|
2
|
+
import type { PropType, Ref } from 'vue';
|
|
3
3
|
import type { SelectOption } from '../../../select/src/interface';
|
|
4
|
-
import {
|
|
4
|
+
import type { RenderLabelImpl, RenderOptionImpl } from './interface';
|
|
5
5
|
declare const _default: import("vue").DefineComponent<{
|
|
6
6
|
clsPrefix: {
|
|
7
7
|
type: StringConstructor;
|
|
@@ -3,19 +3,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const vue_1 = require("vue");
|
|
7
6
|
const vooks_1 = require("vooks");
|
|
7
|
+
const vue_1 = require("vue");
|
|
8
8
|
const _utils_1 = require("../../../_utils");
|
|
9
|
-
const
|
|
9
|
+
const account_option_1 = __importDefault(require("../../account-option"));
|
|
10
10
|
const icon_1 = require("../../icon");
|
|
11
|
+
const icons_1 = require("../../icons");
|
|
11
12
|
const interface_1 = require("./interface");
|
|
12
|
-
const account_option_1 = __importDefault(require("../../account-option"));
|
|
13
13
|
function renderCheckMark(show, clsPrefix) {
|
|
14
|
-
return ((0, vue_1.h)(
|
|
15
|
-
|
|
16
|
-
default: () => (0, vue_1.h)(
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
return ((0, vue_1.h)("div", { class: `${clsPrefix}-base-select-option__check-wrapper` },
|
|
15
|
+
(0, vue_1.h)(vue_1.Transition, { name: "fade-in-scale-up-transition" }, {
|
|
16
|
+
default: () => show ? ((0, vue_1.h)(icon_1.UBaseIcon, { clsPrefix: clsPrefix, class: `${clsPrefix}-base-select-option__check` }, {
|
|
17
|
+
default: () => (0, vue_1.h)(icons_1.CheckmarkIcon)
|
|
18
|
+
})) : null
|
|
19
|
+
})));
|
|
19
20
|
}
|
|
20
21
|
exports.default = (0, vue_1.defineComponent)({
|
|
21
22
|
name: 'UBaseSelectOption',
|
|
@@ -35,27 +36,31 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
35
36
|
} = (0, vue_1.inject)(interface_1.internalSelectionMenuInjectionKey);
|
|
36
37
|
const isPendingRef = (0, vooks_1.useMemo)(() => {
|
|
37
38
|
const { value: pendingTmNode } = pendingTmNodeRef;
|
|
38
|
-
if (!pendingTmNode)
|
|
39
|
+
if (!pendingTmNode) {
|
|
39
40
|
return false;
|
|
41
|
+
}
|
|
40
42
|
return props.tmNode.key === pendingTmNode.key;
|
|
41
43
|
});
|
|
42
44
|
function handleClick(e) {
|
|
43
45
|
const { tmNode } = props;
|
|
44
|
-
if (tmNode.disabled)
|
|
46
|
+
if (tmNode.disabled) {
|
|
45
47
|
return;
|
|
48
|
+
}
|
|
46
49
|
handleOptionClick(e, tmNode);
|
|
47
50
|
}
|
|
48
51
|
function handleMouseEnter(e) {
|
|
49
52
|
const { tmNode } = props;
|
|
50
|
-
if (tmNode.disabled)
|
|
53
|
+
if (tmNode.disabled) {
|
|
51
54
|
return;
|
|
55
|
+
}
|
|
52
56
|
handleOptionMouseEnter(e, tmNode);
|
|
53
57
|
}
|
|
54
58
|
function handleMouseMove(e) {
|
|
55
59
|
const { tmNode } = props;
|
|
56
60
|
const { value: isPending } = isPendingRef;
|
|
57
|
-
if (tmNode.disabled || isPending)
|
|
61
|
+
if (tmNode.disabled || isPending) {
|
|
58
62
|
return;
|
|
63
|
+
}
|
|
59
64
|
handleOptionMouseEnter(e, tmNode);
|
|
60
65
|
}
|
|
61
66
|
return {
|
|
@@ -72,8 +77,9 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
72
77
|
isSelected: (0, vooks_1.useMemo)(() => {
|
|
73
78
|
const { value } = valueRef;
|
|
74
79
|
const { value: multiple } = multipleRef;
|
|
75
|
-
if (value === null)
|
|
80
|
+
if (value === null) {
|
|
76
81
|
return false;
|
|
82
|
+
}
|
|
77
83
|
const optionValue = props.tmNode.rawNode[valueFieldRef.value];
|
|
78
84
|
if (multiple) {
|
|
79
85
|
const { value: valueSet } = valueSetRef;
|
|
@@ -93,16 +99,13 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
93
99
|
},
|
|
94
100
|
render() {
|
|
95
101
|
const { clsPrefix, tmNode: { rawNode }, isSelected, isPending, isGrouped, showCheckmark, nodeProps, renderOption, renderLabel, handleClick, handleMouseEnter, handleMouseMove, account } = this;
|
|
96
|
-
const checkmark = renderCheckMark(isSelected, clsPrefix);
|
|
102
|
+
const checkmark = renderCheckMark(showCheckmark && isSelected, clsPrefix);
|
|
97
103
|
const label = renderLabel
|
|
98
104
|
? renderLabel(rawNode, isSelected)
|
|
99
105
|
: (0, _utils_1.render)(rawNode[this.labelField], rawNode, isSelected);
|
|
100
106
|
const children = account
|
|
101
|
-
? [
|
|
102
|
-
|
|
103
|
-
showCheckmark && checkmark
|
|
104
|
-
]
|
|
105
|
-
: [label, showCheckmark && checkmark];
|
|
107
|
+
? [(0, vue_1.h)(account_option_1.default, Object.assign({}, rawNode, { label: label })), checkmark]
|
|
108
|
+
: [label, checkmark];
|
|
106
109
|
const attrs = nodeProps === null || nodeProps === void 0 ? void 0 : nodeProps(rawNode);
|
|
107
110
|
const node = ((0, vue_1.h)("div", Object.assign({}, attrs, { class: [
|
|
108
111
|
`${clsPrefix}-base-select-option`,
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
const cssr_1 = require("../../../../_utils/cssr");
|
|
7
6
|
const fade_in_scale_up_cssr_1 = require("../../../../_styles/transitions/fade-in-scale-up.cssr");
|
|
7
|
+
const cssr_1 = require("../../../../_utils/cssr");
|
|
8
8
|
// --u-loading-color
|
|
9
9
|
// --u-loading-size
|
|
10
10
|
// --u-option-padding-right
|
|
@@ -109,14 +109,15 @@ exports.default = (0, cssr_1.cB)('base-select-menu', `
|
|
|
109
109
|
color: var(--u-option-text-color-disabled);
|
|
110
110
|
`), (0, cssr_1.cM)('selected', `
|
|
111
111
|
opacity: var(--u-option-opacity-disabled);
|
|
112
|
-
`)]), (0, cssr_1.cE)('check', `
|
|
113
|
-
font-size: 24px;
|
|
112
|
+
`)]), (0, cssr_1.cE)('check-wrapper', `
|
|
114
113
|
position: absolute;
|
|
115
114
|
right: calc(var(--u-option-padding-right) - 4px);
|
|
116
115
|
top: 50%;
|
|
117
116
|
transform: translateY(-50%);
|
|
117
|
+
`, [(0, cssr_1.cE)('check', `
|
|
118
|
+
font-size: 24px;
|
|
118
119
|
color: var(--u-option-check-color);
|
|
119
120
|
transition: color .3s var(--u-bezier);
|
|
120
121
|
`, [(0, fade_in_scale_up_cssr_1.fadeInScaleUpTransition)({
|
|
121
122
|
enterScale: '0.5'
|
|
122
|
-
})])])]);
|
|
123
|
+
})])])])]);
|
|
@@ -277,6 +277,9 @@ exports.default = (0, cssr_1.c)([(0, cssr_1.cB)('base-selection', `
|
|
|
277
277
|
color: var(--u-text-color-disabled);
|
|
278
278
|
`), (0, cssr_1.cE)('render-label', `
|
|
279
279
|
color: var(--u-text-color-disabled);
|
|
280
|
+
`), (0, cssr_1.cB)('base-selection-overlay', `
|
|
281
|
+
pointer-events: auto;
|
|
282
|
+
user-select: text;
|
|
280
283
|
`)]), (0, cssr_1.cB)('base-selection-tag-wrapper', `
|
|
281
284
|
max-width: 100%;
|
|
282
285
|
display: inline-flex;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { CSSProperties, PropType, Ref, TransitionProps, VNode } from 'vue';
|
|
1
|
+
import type { CSSProperties, PropType, Ref, SlotsType, TransitionProps, VNode } from 'vue';
|
|
2
2
|
import type { ExtractPublicPropTypes } from '../../_utils';
|
|
3
|
-
import type { ArrowScopedSlotProps, DotScopedSlotProps, Size } from './interface';
|
|
3
|
+
import type { ArrowScopedSlotProps, CarouselArrowSlotProps, CarouselDotSlotProps, DotScopedSlotProps, Size } from './interface';
|
|
4
4
|
declare const transitionProperties: readonly ["transitionDuration", "transitionTimingFunction"];
|
|
5
5
|
type TransitionStyle = Partial<Pick<CSSProperties, (typeof transitionProperties)[number]>>;
|
|
6
6
|
export declare const carouselProps: {
|
|
@@ -97,6 +97,11 @@ export declare const carouselProps: {
|
|
|
97
97
|
}, any>>>;
|
|
98
98
|
};
|
|
99
99
|
export type CarouselProps = ExtractPublicPropTypes<typeof carouselProps>;
|
|
100
|
+
export interface CarouselSlots {
|
|
101
|
+
default?: () => VNode[];
|
|
102
|
+
arrow?: (props: CarouselArrowSlotProps) => VNode[];
|
|
103
|
+
dots?: (props: CarouselDotSlotProps) => VNode[];
|
|
104
|
+
}
|
|
100
105
|
declare const _default: import("vue").DefineComponent<{
|
|
101
106
|
defaultIndex: {
|
|
102
107
|
type: NumberConstructor;
|
|
@@ -344,5 +349,5 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
344
349
|
draggable: boolean;
|
|
345
350
|
touchable: boolean;
|
|
346
351
|
mousewheel: boolean;
|
|
347
|
-
},
|
|
352
|
+
}, SlotsType<CarouselSlots>>;
|
|
348
353
|
export default _default;
|
|
@@ -27,20 +27,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.carouselProps = void 0;
|
|
30
|
-
const vue_1 = require("vue");
|
|
31
|
-
const vueuc_1 = require("vueuc");
|
|
32
|
-
const vooks_1 = require("vooks");
|
|
33
30
|
const evtd_1 = require("evtd");
|
|
34
31
|
const seemly_1 = require("seemly");
|
|
32
|
+
const vooks_1 = require("vooks");
|
|
33
|
+
const vue_1 = require("vue");
|
|
34
|
+
const vueuc_1 = require("vueuc");
|
|
35
35
|
const _mixins_1 = require("../../_mixins");
|
|
36
36
|
const _utils_1 = require("../../_utils");
|
|
37
37
|
const styles_1 = require("../styles");
|
|
38
|
-
const
|
|
38
|
+
const CarouselArrow_1 = __importDefault(require("./CarouselArrow"));
|
|
39
39
|
const CarouselContext_1 = require("./CarouselContext");
|
|
40
40
|
const CarouselDots_1 = __importDefault(require("./CarouselDots"));
|
|
41
|
-
const CarouselArrow_1 = __importDefault(require("./CarouselArrow"));
|
|
42
41
|
const CarouselItem_1 = __importStar(require("./CarouselItem"));
|
|
43
42
|
const index_cssr_1 = __importDefault(require("./styles/index.cssr"));
|
|
43
|
+
const utils_1 = require("./utils");
|
|
44
44
|
const transitionProperties = [
|
|
45
45
|
'transitionDuration',
|
|
46
46
|
'transitionTimingFunction'
|
|
@@ -92,6 +92,7 @@ let globalDragging = false;
|
|
|
92
92
|
exports.default = (0, vue_1.defineComponent)({
|
|
93
93
|
name: 'Carousel',
|
|
94
94
|
props: exports.carouselProps,
|
|
95
|
+
slots: Object,
|
|
95
96
|
setup(props) {
|
|
96
97
|
const { mergedClsPrefixRef, inlineThemeDisabled } = (0, _mixins_1.useConfig)(props);
|
|
97
98
|
// Dom
|
|
@@ -119,10 +120,14 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
119
120
|
(props.slidesPerView === 'auto' && props.centeredSlides));
|
|
120
121
|
// Carousel size
|
|
121
122
|
const perViewSizeRef = (0, vue_1.ref)({ width: 0, height: 0 });
|
|
123
|
+
const slideSizesTrigger = (0, vue_1.ref)(0);
|
|
122
124
|
const slideSizesRef = (0, vue_1.computed)(() => {
|
|
123
125
|
const { value: slidesEls } = slideElsRef;
|
|
124
|
-
if (!slidesEls.length)
|
|
126
|
+
if (!slidesEls.length) {
|
|
125
127
|
return [];
|
|
128
|
+
}
|
|
129
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
130
|
+
slideSizesTrigger.value;
|
|
126
131
|
const { value: autoSlideSize } = autoSlideSizeRef;
|
|
127
132
|
if (autoSlideSize) {
|
|
128
133
|
return slidesEls.map((slide) => (0, utils_1.calculateSize)(slide));
|
|
@@ -143,8 +148,9 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
143
148
|
// The translate required to reach each slide
|
|
144
149
|
const slideTranlatesRef = (0, vue_1.computed)(() => {
|
|
145
150
|
const { value: slideSizes } = slideSizesRef;
|
|
146
|
-
if (!slideSizes.length)
|
|
151
|
+
if (!slideSizes.length) {
|
|
147
152
|
return [];
|
|
153
|
+
}
|
|
148
154
|
const { centeredSlides, spaceBetween } = props;
|
|
149
155
|
const { value: axis } = sizeAxisRef;
|
|
150
156
|
const { [axis]: perViewSize } = perViewSizeRef.value;
|
|
@@ -171,8 +177,9 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
171
177
|
: (0, utils_1.resolveSpeed)(transitionStyleRef.value.transitionDuration));
|
|
172
178
|
const slideStylesRef = (0, vue_1.computed)(() => {
|
|
173
179
|
const { value: slidesEls } = slideElsRef;
|
|
174
|
-
if (!slidesEls.length)
|
|
180
|
+
if (!slidesEls.length) {
|
|
175
181
|
return [];
|
|
182
|
+
}
|
|
176
183
|
const useComputedSize = !(autoSlideSizeRef.value || realSlidesPerViewRef.value === 1);
|
|
177
184
|
const getSlideSize = (index) => {
|
|
178
185
|
if (useComputedSize) {
|
|
@@ -208,8 +215,9 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
208
215
|
else {
|
|
209
216
|
const { value: slideSizes } = slideSizesRef;
|
|
210
217
|
const { length } = slideSizes;
|
|
211
|
-
if (!length)
|
|
218
|
+
if (!length) {
|
|
212
219
|
return totalSlides;
|
|
220
|
+
}
|
|
213
221
|
const { value: translates } = slideTranlatesRef;
|
|
214
222
|
const { value: axis } = sizeAxisRef;
|
|
215
223
|
const perViewSize = perViewSizeRef.value[axis];
|
|
@@ -268,6 +276,9 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
268
276
|
function isNextDisabled() {
|
|
269
277
|
return getRealNextIndex() === null;
|
|
270
278
|
}
|
|
279
|
+
let inTransition = false;
|
|
280
|
+
let dragging = false;
|
|
281
|
+
let isEffectiveDrag = false;
|
|
271
282
|
// To
|
|
272
283
|
function to(index) {
|
|
273
284
|
const realIndex = (0, utils_1.clampValue)((0, utils_1.getRealIndex)(index, duplicatedableRef.value), 0, totalViewRef.value);
|
|
@@ -278,24 +289,27 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
278
289
|
}
|
|
279
290
|
function prev() {
|
|
280
291
|
const prevIndex = getRealPrevIndex();
|
|
281
|
-
if (prevIndex !== null)
|
|
292
|
+
if (prevIndex !== null) {
|
|
282
293
|
toRealIndex(prevIndex);
|
|
294
|
+
}
|
|
283
295
|
}
|
|
284
296
|
function next() {
|
|
285
297
|
const nextIndex = getRealNextIndex();
|
|
286
|
-
if (nextIndex !== null)
|
|
298
|
+
if (nextIndex !== null) {
|
|
287
299
|
toRealIndex(nextIndex);
|
|
300
|
+
}
|
|
288
301
|
}
|
|
289
302
|
function prevIfSlideTransitionEnd() {
|
|
290
|
-
if (!inTransition || !duplicatedableRef.value)
|
|
303
|
+
if (!inTransition || !duplicatedableRef.value) {
|
|
291
304
|
prev();
|
|
305
|
+
}
|
|
292
306
|
}
|
|
293
307
|
function nextIfSlideTransitionEnd() {
|
|
294
|
-
if (!inTransition || !duplicatedableRef.value)
|
|
308
|
+
if (!inTransition || !duplicatedableRef.value) {
|
|
295
309
|
next();
|
|
310
|
+
}
|
|
296
311
|
}
|
|
297
312
|
// Translate to
|
|
298
|
-
let inTransition = false;
|
|
299
313
|
// record the translate of each slide, so that it can be restored at touch
|
|
300
314
|
let previousTranslate = 0;
|
|
301
315
|
const translateStyleRef = (0, vue_1.ref)({});
|
|
@@ -380,13 +394,15 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
380
394
|
};
|
|
381
395
|
(0, CarouselContext_1.provideCarouselContext)(carouselContext);
|
|
382
396
|
function addSlide(slide) {
|
|
383
|
-
if (!slide)
|
|
397
|
+
if (!slide) {
|
|
384
398
|
return;
|
|
399
|
+
}
|
|
385
400
|
slideElsRef.value.push(slide);
|
|
386
401
|
}
|
|
387
402
|
function removeSlide(slide) {
|
|
388
|
-
if (!slide)
|
|
403
|
+
if (!slide) {
|
|
389
404
|
return;
|
|
405
|
+
}
|
|
390
406
|
const index = getSlideIndex(slide);
|
|
391
407
|
if (index !== -1) {
|
|
392
408
|
slideElsRef.value.splice(index, 1);
|
|
@@ -445,12 +461,11 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
445
461
|
let dragStartY = 0;
|
|
446
462
|
let dragOffset = 0;
|
|
447
463
|
let dragStartTime = 0;
|
|
448
|
-
let dragging = false;
|
|
449
|
-
let isEffectiveDrag = false;
|
|
450
464
|
function handleTouchstart(event) {
|
|
451
465
|
var _a;
|
|
452
|
-
if (globalDragging)
|
|
466
|
+
if (globalDragging) {
|
|
453
467
|
return;
|
|
468
|
+
}
|
|
454
469
|
if (!((_a = slidesElRef.value) === null || _a === void 0 ? void 0 : _a.contains((0, seemly_1.getPreciseEventTarget)(event)))) {
|
|
455
470
|
return;
|
|
456
471
|
}
|
|
@@ -574,8 +589,9 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
574
589
|
}
|
|
575
590
|
function handleMousewheel(event) {
|
|
576
591
|
event.preventDefault();
|
|
577
|
-
if (inTransition)
|
|
592
|
+
if (inTransition) {
|
|
578
593
|
return;
|
|
594
|
+
}
|
|
579
595
|
let { deltaX, deltaY } = event;
|
|
580
596
|
if (event.shiftKey && !deltaX) {
|
|
581
597
|
deltaX = deltaY;
|
|
@@ -606,10 +622,8 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
606
622
|
resetAutoplay();
|
|
607
623
|
}
|
|
608
624
|
function handleSlideResize() {
|
|
609
|
-
var _a, _b;
|
|
610
625
|
if (autoSlideSizeRef.value) {
|
|
611
|
-
|
|
612
|
-
slideSizesRef.effect.run();
|
|
626
|
+
slideSizesTrigger.value++;
|
|
613
627
|
}
|
|
614
628
|
}
|
|
615
629
|
function handleMouseenter() {
|
|
@@ -651,8 +665,9 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
651
665
|
}
|
|
652
666
|
});
|
|
653
667
|
(0, vue_1.watch)(realIndexRef, (realIndex, lastRealIndex) => {
|
|
654
|
-
if (realIndex === lastRealIndex)
|
|
668
|
+
if (realIndex === lastRealIndex) {
|
|
655
669
|
return;
|
|
670
|
+
}
|
|
656
671
|
resetAutoplay();
|
|
657
672
|
if (sequenceLayoutRef.value) {
|
|
658
673
|
if (duplicatedableRef.value && displayTotalViewRef.value > 2) {
|
|
@@ -701,9 +716,10 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
701
716
|
'next',
|
|
702
717
|
'isPrevDisabled',
|
|
703
718
|
'isNextDisabled'
|
|
704
|
-
])), { total: displayTotalViewRef.value, currentIndex: mergedDisplayIndexRef.value })));
|
|
719
|
+
])), { total: displayTotalViewRef.value, current: mergedDisplayIndexRef.value, currentIndex: mergedDisplayIndexRef.value })));
|
|
705
720
|
const dotSlotPropsRef = (0, vue_1.computed)(() => ({
|
|
706
721
|
total: displayTotalViewRef.value,
|
|
722
|
+
current: mergedDisplayIndexRef.value,
|
|
707
723
|
currentIndex: mergedDisplayIndexRef.value,
|
|
708
724
|
to: carouselContext.to
|
|
709
725
|
}));
|
|
@@ -17,5 +17,5 @@ export interface CarouselContextValue {
|
|
|
17
17
|
removeSlide: (slide?: HTMLElement) => void;
|
|
18
18
|
onCarouselItemClick: (index: number, event: MouseEvent) => void;
|
|
19
19
|
}
|
|
20
|
-
export declare
|
|
21
|
-
export declare
|
|
20
|
+
export declare function provideCarouselContext(contextValue: CarouselContextValue): void;
|
|
21
|
+
export declare function useCarouselContext(location?: string, component?: string): CarouselContextValue;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.provideCarouselContext = provideCarouselContext;
|
|
4
|
+
exports.useCarouselContext = useCarouselContext;
|
|
4
5
|
const vue_1 = require("vue");
|
|
5
6
|
const _utils_1 = require("../../_utils");
|
|
6
7
|
const carouselMethodsInjectionKey = (0, _utils_1.createInjectionKey)('u-carousel-methods');
|
|
7
|
-
|
|
8
|
+
function provideCarouselContext(contextValue) {
|
|
8
9
|
(0, vue_1.provide)(carouselMethodsInjectionKey, contextValue);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const useCarouselContext = (location = 'unknown', component = 'component') => {
|
|
10
|
+
}
|
|
11
|
+
function useCarouselContext(location = 'unknown', component = 'component') {
|
|
12
12
|
const CarouselContext = (0, vue_1.inject)(carouselMethodsInjectionKey);
|
|
13
13
|
if (!CarouselContext) {
|
|
14
14
|
(0, _utils_1.throwError)(location, `\`${component}\` must be placed inside \`u-carousel\`.`);
|
|
15
15
|
}
|
|
16
16
|
return CarouselContext;
|
|
17
|
-
}
|
|
18
|
-
exports.useCarouselContext = useCarouselContext;
|
|
17
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const vue_1 = require("vue");
|
|
4
3
|
const seemly_1 = require("seemly");
|
|
4
|
+
const vue_1 = require("vue");
|
|
5
5
|
const _mixins_1 = require("../../_mixins");
|
|
6
6
|
const CarouselContext_1 = require("./CarouselContext");
|
|
7
7
|
const carouselDotsProps = {
|