sard-uniapp 1.11.2 → 1.12.1
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/CHANGELOG.md +34 -0
- package/README.md +3 -2
- package/components/action-sheet/action-sheet.vue +8 -2
- package/components/action-sheet/index.scss +1 -1
- package/components/back-top/back-top.d.ts +1 -1
- package/components/badge/badge.vue +1 -1
- package/components/button/button.d.ts +1 -0
- package/components/button/button.vue +3 -0
- package/components/button/common.d.ts +3 -0
- package/components/button/index.scss +6 -1
- package/components/calendar/calendar.d.ts +1 -1
- package/components/calendar/calendar.vue +49 -22
- package/components/calendar/index.scss +5 -5
- package/components/calendar/variables.scss +1 -1
- package/components/calendar-input/calendar-input.d.ts +1 -1
- package/components/calendar-month/index.scss +1 -0
- package/components/cascader/cascader.d.ts +6 -6
- package/components/cascader/cascader.vue +9 -4
- package/components/cascader/common.d.ts +3 -3
- package/components/cascader/index.scss +1 -0
- package/components/checkbox-input/checkbox-input.vue +59 -32
- package/components/checkbox-input/index.scss +4 -0
- package/components/config/index.d.ts +23 -0
- package/components/config/index.js +47 -18
- package/components/crop-image/common.d.ts +32 -0
- package/components/crop-image/common.js +2 -0
- package/components/crop-image/crop-image.d.ts +19 -0
- package/components/crop-image/crop-image.vue +666 -0
- package/components/crop-image/index.d.ts +1 -0
- package/components/crop-image/index.scss +81 -0
- package/components/crop-image-agent/common.d.ts +19 -0
- package/components/crop-image-agent/common.js +16 -0
- package/components/crop-image-agent/crop-image-agent.d.ts +9 -0
- package/components/crop-image-agent/crop-image-agent.vue +70 -0
- package/components/crop-image-agent/index.d.ts +1 -0
- package/components/crop-image-agent/index.js +1 -0
- package/components/datetime-picker-input/datetime-picker-input.vue +4 -4
- package/components/datetime-range-picker/datetime-range-picker.vue +4 -3
- package/components/datetime-range-picker-input/datetime-range-picker-input.vue +4 -4
- package/components/dialog/common.d.ts +2 -3
- package/components/dialog/dialog.d.ts +6 -13
- package/components/dialog/dialog.vue +15 -4
- package/components/dialog-agent/dialog-agent.d.ts +1 -1
- package/components/dropdown-item/dropdown-item.vue +6 -6
- package/components/fab/fab.d.ts +1 -1
- package/components/floating-bubble/floating-bubble.vue +14 -19
- package/components/form-item/form-item.vue +4 -3
- package/components/grid/common.d.ts +4 -0
- package/components/grid-item/grid-item.vue +33 -18
- package/components/grid-item/index.scss +12 -4
- package/components/icon/index.scss +1 -0
- package/components/icon/sari.scss +9 -1
- package/components/indexes/common.d.ts +3 -5
- package/components/indexes/indexes.d.ts +2 -0
- package/components/indexes/indexes.vue +45 -109
- package/components/indexes-anchor/indexes-anchor.vue +9 -9
- package/components/indexes-nav/indexes-nav.vue +26 -22
- package/components/input/input.d.ts +4 -4
- package/components/loading/index.scss +1 -1
- package/components/locale/lang/en-US.d.ts +9 -0
- package/components/locale/lang/en-US.js +9 -0
- package/components/locale/lang/zh-CN.d.ts +9 -0
- package/components/locale/lang/zh-CN.js +9 -0
- package/components/navbar/common.d.ts +12 -0
- package/components/navbar/index.scss +17 -10
- package/components/navbar/navbar.d.ts +5 -1
- package/components/navbar/navbar.vue +45 -15
- package/components/navbar/variables.scss +4 -1
- package/components/navbar-item/index.scss +10 -0
- package/components/navbar-item/navbar-item.vue +27 -4
- package/components/navbar-pit/navbar-pit.d.ts +2 -0
- package/components/navbar-pit/navbar-pit.vue +22 -0
- package/components/notify/common.d.ts +1 -0
- package/components/notify/index.scss +12 -7
- package/components/notify/notify.vue +9 -3
- package/components/notify-agent/notify-agent.vue +9 -11
- package/components/pagination/pagination.d.ts +1 -1
- package/components/picker-input/picker-input.vue +4 -4
- package/components/popout/common.d.ts +2 -3
- package/components/popout/popout.d.ts +5 -12
- package/components/popout/popout.vue +16 -5
- package/components/popover/utils.js +2 -4
- package/components/popover-reference/popover-reference.vue +3 -3
- package/components/popup/common.d.ts +5 -3
- package/components/popup/index.scss +25 -3
- package/components/popup/popup.d.ts +1 -1
- package/components/pull-down-refresh/pull-down-refresh.d.ts +1 -1
- package/components/qrcode/qrcode.d.ts +1 -1
- package/components/qrcode/qrcode.vue +4 -7
- package/components/radio-input/index.scss +5 -1
- package/components/radio-input/radio-input.vue +59 -32
- package/components/scroll-spy/common.d.ts +29 -0
- package/components/scroll-spy/common.js +1 -0
- package/components/scroll-spy/index.d.ts +1 -0
- package/components/scroll-spy/index.js +1 -0
- package/components/scroll-spy/scroll-spy.d.ts +28 -0
- package/components/scroll-spy/scroll-spy.vue +120 -0
- package/components/scroll-spy-anchor/common.d.ts +13 -0
- package/components/scroll-spy-anchor/index.d.ts +1 -0
- package/components/scroll-spy-anchor/index.js +1 -0
- package/components/scroll-spy-anchor/scroll-spy-anchor.d.ts +10 -0
- package/components/scroll-spy-anchor/scroll-spy-anchor.vue +50 -0
- package/components/search/search.vue +2 -0
- package/components/share-sheet/share-sheet.vue +3 -2
- package/components/sidebar/common.d.ts +28 -0
- package/components/sidebar/common.js +1 -0
- package/components/sidebar/index.d.ts +1 -0
- package/components/sidebar/index.js +1 -0
- package/components/sidebar/index.scss +15 -0
- package/components/sidebar/sidebar.d.ts +16 -0
- package/components/sidebar/sidebar.vue +136 -0
- package/components/sidebar/variables.scss +20 -0
- package/components/sidebar-item/common.d.ts +16 -0
- package/components/sidebar-item/common.js +1 -0
- package/components/sidebar-item/index.d.ts +1 -0
- package/components/sidebar-item/index.js +1 -0
- package/components/sidebar-item/index.scss +70 -0
- package/components/sidebar-item/sidebar-item.d.ts +14 -0
- package/components/sidebar-item/sidebar-item.vue +111 -0
- package/components/signature/common.d.ts +41 -0
- package/components/signature/common.js +2 -0
- package/components/signature/index.d.ts +1 -0
- package/components/signature/index.js +1 -0
- package/components/signature/index.scss +109 -0
- package/components/signature/signature.d.ts +32 -0
- package/components/signature/signature.vue +580 -0
- package/components/signature/variables-dark.scss +7 -0
- package/components/signature/variables.scss +9 -0
- package/components/status-bar/common.d.ts +17 -0
- package/components/status-bar/common.js +2 -0
- package/components/status-bar/index.d.ts +1 -0
- package/components/status-bar/index.js +1 -0
- package/components/status-bar/index.scss +7 -0
- package/components/status-bar/status-bar.d.ts +12 -0
- package/components/status-bar/status-bar.vue +56 -0
- package/components/style/mixins/ellipsis.scss +7 -0
- package/components/style/mixins/scroll-shadow.scss +40 -0
- package/components/style/mixins.scss +1 -0
- package/components/style/variables.scss +3 -0
- package/components/swiper-dot/swiper-dot.d.ts +1 -1
- package/components/tab/tab.vue +4 -3
- package/components/tabbar/common.d.ts +1 -0
- package/components/tabbar/tabbar.d.ts +2 -0
- package/components/tabbar/tabbar.vue +2 -1
- package/components/table-cell/index.scss +1 -2
- package/components/table-fixation/table-fixation.vue +16 -8
- package/components/tree-node/tree-node.vue +3 -3
- package/components/upload/upload.vue +3 -2
- package/dark.scss +1 -0
- package/global.d.ts +9 -0
- package/index.d.ts +8 -0
- package/index.js +8 -0
- package/index.scss +2 -0
- package/package.json +28 -24
- package/use/index.d.ts +4 -0
- package/use/index.js +4 -0
- package/use/useDragPinch.d.ts +15 -0
- package/use/useDragPinch.js +88 -0
- package/use/useImperative.js +1 -0
- package/use/useInitialVelocity.d.ts +13 -0
- package/use/useInitialVelocity.js +65 -0
- package/use/useMouseDown.js +3 -4
- package/use/useScrollSide.d.ts +6 -0
- package/use/useScrollSide.js +34 -0
- package/use/useScrollSpy.d.ts +19 -0
- package/use/useScrollSpy.js +99 -0
- package/use/useTimeoutLoading.d.ts +6 -0
- package/use/useTimeoutLoading.js +53 -0
- package/use/useZIndex.js +7 -3
- package/utils/bem.d.ts +8 -8
- package/utils/dom.d.ts +3 -69
- package/utils/dom.js +32 -109
- package/utils/file.d.ts +1 -0
- package/utils/file.js +14 -0
- package/utils/geometry.d.ts +67 -0
- package/utils/geometry.js +127 -0
- package/utils/index.d.ts +2 -0
- package/utils/index.js +2 -0
- package/utils/inertialAnimate.d.ts +10 -0
- package/utils/inertialAnimate.js +42 -0
- package/utils/is.d.ts +8 -0
- package/utils/is.js +8 -0
- package/utils/system.d.ts +2 -0
- package/utils/system.js +6 -3
- package/utils/utils.d.ts +7 -0
- package/utils/utils.js +13 -0
- package/components/_template/_template.d.ts +0 -16
- package/components/_template/_template.vue +0 -45
- package/components/_template/common.d.ts +0 -14
- package/components/_template/index.d.ts +0 -1
- package/components/_template/index.scss +0 -17
- package/components/_template/variables.scss +0 -5
- /package/components/{_template → crop-image}/index.js +0 -0
- /package/components/{_template → scroll-spy-anchor}/common.js +0 -0
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
theme="neutral"
|
|
18
18
|
:root-class="classNames(bem.e('header-cancel'))"
|
|
19
19
|
:loading="loading.cancel"
|
|
20
|
+
block
|
|
20
21
|
@click="onCancel"
|
|
21
22
|
>
|
|
22
23
|
<template v-if="cancelText">{{ cancelText }}</template>
|
|
@@ -37,6 +38,7 @@
|
|
|
37
38
|
:root-class="classNames(bem.e('header-confirm'))"
|
|
38
39
|
:loading="loading.confirm"
|
|
39
40
|
:disabled="confirmDisabled"
|
|
41
|
+
block
|
|
40
42
|
@click="onConfirm"
|
|
41
43
|
>
|
|
42
44
|
<template v-if="confirmText">{{ confirmText }}</template>
|
|
@@ -49,7 +51,7 @@
|
|
|
49
51
|
:class="bem.e('close')"
|
|
50
52
|
@click="onCloseClick"
|
|
51
53
|
>
|
|
52
|
-
<sar-button type="pale-text" theme="neutral" size="large">
|
|
54
|
+
<sar-button type="pale-text" theme="neutral" size="large" block>
|
|
53
55
|
<sar-icon name="close" />
|
|
54
56
|
</sar-button>
|
|
55
57
|
</view>
|
|
@@ -63,6 +65,7 @@
|
|
|
63
65
|
theme="primary"
|
|
64
66
|
round
|
|
65
67
|
:loading="loading.cancel"
|
|
68
|
+
block
|
|
66
69
|
@click="onCancel"
|
|
67
70
|
>
|
|
68
71
|
<template v-if="cancelText">{{ cancelText }}</template>
|
|
@@ -76,6 +79,7 @@
|
|
|
76
79
|
round
|
|
77
80
|
:loading="loading.confirm"
|
|
78
81
|
:disabled="confirmDisabled"
|
|
82
|
+
block
|
|
79
83
|
@click="onConfirm"
|
|
80
84
|
>
|
|
81
85
|
<template v-if="confirmText">{{ confirmText }}</template>
|
|
@@ -90,7 +94,13 @@
|
|
|
90
94
|
<script>
|
|
91
95
|
import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
|
|
92
96
|
import { computed, ref, watch } from "vue";
|
|
93
|
-
import {
|
|
97
|
+
import {
|
|
98
|
+
classNames,
|
|
99
|
+
stringifyStyle,
|
|
100
|
+
createBem,
|
|
101
|
+
noop,
|
|
102
|
+
isFunction
|
|
103
|
+
} from "../../utils";
|
|
94
104
|
import SarPopup from "../popup/popup.vue";
|
|
95
105
|
import SarButton from "../button/button.vue";
|
|
96
106
|
import SarIcon from "../icon/icon.vue";
|
|
@@ -130,7 +140,7 @@ export default _defineComponent({
|
|
|
130
140
|
beforeClose: { type: Function, required: false },
|
|
131
141
|
keepRender: { type: Boolean, required: false }
|
|
132
142
|
}, defaultPopoutProps),
|
|
133
|
-
emits: ["update:visible", "close", "cancel", "confirm", "visible-hook"],
|
|
143
|
+
emits: ["update:visible", "close", "cancel", "confirm", "before-enter", "enter", "after-enter", "enter-cancelled", "before-leave", "leave", "after-leave", "leave-cancelled", "visible-hook"],
|
|
134
144
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
135
145
|
__expose();
|
|
136
146
|
const props = __props;
|
|
@@ -159,8 +169,9 @@ export default _defineComponent({
|
|
|
159
169
|
};
|
|
160
170
|
const callVisibleHook = usePopupVisibleHookProvide();
|
|
161
171
|
const onVisibleHook = (name) => {
|
|
162
|
-
emit("visible-hook", name);
|
|
163
172
|
callVisibleHook(name);
|
|
173
|
+
emit("visible-hook", name);
|
|
174
|
+
emit(name);
|
|
164
175
|
};
|
|
165
176
|
const loading = ref({
|
|
166
177
|
cancel: false,
|
|
@@ -169,7 +180,7 @@ export default _defineComponent({
|
|
|
169
180
|
});
|
|
170
181
|
const perhapsClose = (type) => {
|
|
171
182
|
emit(type);
|
|
172
|
-
if (
|
|
183
|
+
if (isFunction(props.beforeClose)) {
|
|
173
184
|
const result = props.beforeClose(type);
|
|
174
185
|
if (result instanceof Promise) {
|
|
175
186
|
loading.value[type] = true;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { minmax } from '../../utils';
|
|
1
|
+
import { getWindowInfo, minmax } from '../../utils';
|
|
2
2
|
const directions = ['top', 'right', 'bottom', 'left'];
|
|
3
3
|
function getReverseDirection(direction) {
|
|
4
4
|
const index = directions.indexOf(direction);
|
|
@@ -33,9 +33,7 @@ function getArrowCrossOffset(direction, rect) {
|
|
|
33
33
|
export function getPopoverPosition(refRect, popperRect, { refGap, position, viewportGap, arrowSize, }) {
|
|
34
34
|
const breadth = popperRect.width + refGap;
|
|
35
35
|
const thickness = popperRect.height + refGap;
|
|
36
|
-
const
|
|
37
|
-
const windowWidth = systemInfo.windowWidth;
|
|
38
|
-
const windowHeight = systemInfo.windowHeight;
|
|
36
|
+
const { windowWidth, windowHeight } = getWindowInfo();
|
|
39
37
|
const gapBoundaries = {
|
|
40
38
|
top: refRect.top - thickness - viewportGap,
|
|
41
39
|
right: windowWidth - refRect.right - breadth - viewportGap,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view :class="refClass" :style="refStyle"
|
|
2
|
+
<view :class="refClass" :style="refStyle" @click="onClick">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</view>
|
|
5
5
|
</template>
|
|
@@ -37,7 +37,7 @@ export default _defineComponent({
|
|
|
37
37
|
const instance = getCurrentInstance();
|
|
38
38
|
const context = inject(popoverContextSymbol);
|
|
39
39
|
const getRect = () => {
|
|
40
|
-
return getBoundingClientRect(
|
|
40
|
+
return getBoundingClientRect(`.${referenceId}`, instance);
|
|
41
41
|
};
|
|
42
42
|
onMounted(() => {
|
|
43
43
|
context?.register({
|
|
@@ -49,7 +49,7 @@ export default _defineComponent({
|
|
|
49
49
|
emit("click", event);
|
|
50
50
|
};
|
|
51
51
|
const refClass = computed(() => {
|
|
52
|
-
return classNames(props.rootClass);
|
|
52
|
+
return classNames(props.rootClass, referenceId);
|
|
53
53
|
});
|
|
54
54
|
const refStyle = computed(() => {
|
|
55
55
|
return stringifyStyle(props.rootStyle);
|
|
@@ -5,7 +5,7 @@ export interface PopupProps {
|
|
|
5
5
|
rootClass?: string;
|
|
6
6
|
visible?: boolean;
|
|
7
7
|
duration?: number;
|
|
8
|
-
effect?: 'slide-top' | 'slide-right' | 'slide-bottom' | 'slide-left' | 'zoom' | 'fade';
|
|
8
|
+
effect?: 'slide-top' | 'slide-right' | 'slide-bottom' | 'slide-left' | 'zoom' | 'fade' | 'full-fade';
|
|
9
9
|
overlay?: boolean;
|
|
10
10
|
overlayClass?: string;
|
|
11
11
|
overlayStyle?: string;
|
|
@@ -21,8 +21,7 @@ export declare const defaultPopupProps: {
|
|
|
21
21
|
export interface PopupSlots {
|
|
22
22
|
default?(props: Record<string, never>): any;
|
|
23
23
|
}
|
|
24
|
-
export interface
|
|
25
|
-
(e: 'overlay-click', event: any): void;
|
|
24
|
+
export interface TransitionHookEmits {
|
|
26
25
|
(e: 'before-enter'): void;
|
|
27
26
|
(e: 'enter'): void;
|
|
28
27
|
(e: 'after-enter'): void;
|
|
@@ -33,6 +32,9 @@ export interface PopupEmits {
|
|
|
33
32
|
(e: 'leave-cancelled'): void;
|
|
34
33
|
(e: 'visible-hook', name: TransitionHookName): void;
|
|
35
34
|
}
|
|
35
|
+
export interface PopupEmits extends TransitionHookEmits {
|
|
36
|
+
(e: 'overlay-click', event: any): void;
|
|
37
|
+
}
|
|
36
38
|
export interface PopupContext {
|
|
37
39
|
visibleState: TransitionHookName | undefined;
|
|
38
40
|
}
|
|
@@ -36,16 +36,38 @@
|
|
|
36
36
|
transform: translate(-50%, -50%);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
@include m(full-fade) {
|
|
40
|
+
left: 0;
|
|
41
|
+
top: 0;
|
|
42
|
+
width: 100%;
|
|
43
|
+
height: 100%;
|
|
44
|
+
}
|
|
45
|
+
|
|
39
46
|
// fade
|
|
40
|
-
@include m(
|
|
47
|
+
@include m(
|
|
48
|
+
fade-enter-from,
|
|
49
|
+
fade-leave-to,
|
|
50
|
+
full-fade-enter-from,
|
|
51
|
+
full-fade-leave-to
|
|
52
|
+
) {
|
|
41
53
|
opacity: 0;
|
|
42
54
|
}
|
|
43
55
|
|
|
44
|
-
@include m(
|
|
56
|
+
@include m(
|
|
57
|
+
fade-enter-to,
|
|
58
|
+
fade-leave-from,
|
|
59
|
+
full-fade-enter-to,
|
|
60
|
+
full-fade-leave-from
|
|
61
|
+
) {
|
|
45
62
|
opacity: 1;
|
|
46
63
|
}
|
|
47
64
|
|
|
48
|
-
@include m(
|
|
65
|
+
@include m(
|
|
66
|
+
fade-enter-active,
|
|
67
|
+
fade-leave-active,
|
|
68
|
+
full-fade-enter-active,
|
|
69
|
+
full-fade-leave-active
|
|
70
|
+
) {
|
|
49
71
|
transition: opacity var(--sar-popup-duration) ease-in-out;
|
|
50
72
|
}
|
|
51
73
|
|
|
@@ -7,7 +7,7 @@ declare const __VLS_component: import("vue").DefineComponent<PopupProps, {}, {},
|
|
|
7
7
|
}, string, import("vue").PublicProps, Readonly<PopupProps> & Readonly<{
|
|
8
8
|
[x: `on${Capitalize<any>}`]: ((...args: any) => any) | undefined;
|
|
9
9
|
}>, {
|
|
10
|
-
effect: "slide-top" | "slide-right" | "slide-bottom" | "slide-left" | "zoom" | "fade";
|
|
10
|
+
effect: "slide-top" | "slide-right" | "slide-bottom" | "slide-left" | "zoom" | "fade" | "full-fade";
|
|
11
11
|
duration: number;
|
|
12
12
|
overlay: boolean;
|
|
13
13
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -17,9 +17,9 @@ declare const __VLS_component: import("vue").DefineComponent<PullDownRefreshProp
|
|
|
17
17
|
}>, {
|
|
18
18
|
disabled: boolean;
|
|
19
19
|
loading: boolean;
|
|
20
|
+
transitionDuration: number;
|
|
20
21
|
threshold: number;
|
|
21
22
|
headerHeight: number;
|
|
22
|
-
transitionDuration: number;
|
|
23
23
|
doneDuration: number;
|
|
24
24
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
25
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
@@ -7,8 +7,8 @@ declare const __VLS_component: import("vue").DefineComponent<QrcodeProps, {}, {}
|
|
|
7
7
|
ecl: import("./common").QrcodeECL;
|
|
8
8
|
size: string;
|
|
9
9
|
type: "canvas" | "image";
|
|
10
|
-
canvasSize: number;
|
|
11
10
|
color: string;
|
|
11
|
+
canvasSize: number;
|
|
12
12
|
bgColor: string;
|
|
13
13
|
quietZoneModules: number;
|
|
14
14
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -31,7 +31,8 @@ import {
|
|
|
31
31
|
createBem,
|
|
32
32
|
uniqid,
|
|
33
33
|
qrcode,
|
|
34
|
-
isApp
|
|
34
|
+
isApp,
|
|
35
|
+
getNode
|
|
35
36
|
} from "../../utils";
|
|
36
37
|
import { defaultQrcodeProps } from "./common";
|
|
37
38
|
export default _defineComponent({
|
|
@@ -157,15 +158,11 @@ export default _defineComponent({
|
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
);
|
|
160
|
-
onMounted(() => {
|
|
161
|
+
onMounted(async () => {
|
|
161
162
|
if (isApp) {
|
|
162
163
|
contextRef.value = uni.createCanvasContext(canvasId, instance);
|
|
163
164
|
} else {
|
|
164
|
-
|
|
165
|
-
if (res && res.node) {
|
|
166
|
-
canvasRef.value = res.node;
|
|
167
|
-
}
|
|
168
|
-
}).exec();
|
|
165
|
+
canvasRef.value = await getNode(`#${canvasId}`, instance);
|
|
169
166
|
}
|
|
170
167
|
});
|
|
171
168
|
const qrcodeClass = computed(() => {
|
|
@@ -15,40 +15,54 @@
|
|
|
15
15
|
:visible="innerVisible"
|
|
16
16
|
@update:visible="onVisible"
|
|
17
17
|
:title="title ?? placeholder"
|
|
18
|
-
:show-
|
|
18
|
+
:show-footer="false"
|
|
19
19
|
@confirm="onConfirm"
|
|
20
20
|
>
|
|
21
21
|
<template #visible="{ already }">
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
:
|
|
28
|
-
:
|
|
29
|
-
:
|
|
30
|
-
@
|
|
22
|
+
<view v-if="already" :class="containerClass">
|
|
23
|
+
<scroll-view
|
|
24
|
+
:class="bem.e('scroll')"
|
|
25
|
+
scroll-y
|
|
26
|
+
trap-scroll
|
|
27
|
+
:upper-threshold="0"
|
|
28
|
+
:lower-threshold="0"
|
|
29
|
+
:throttle="false"
|
|
30
|
+
@scroll="onScroll"
|
|
31
|
+
@scrolltoupper="onScrolltoupper"
|
|
32
|
+
@scrolltolower="onScrolltolower"
|
|
31
33
|
>
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
34
|
+
<sar-radio-group
|
|
35
|
+
:size="size"
|
|
36
|
+
:type="type"
|
|
37
|
+
:checkedColor="checkedColor"
|
|
38
|
+
:direction="direction"
|
|
39
|
+
:validate-event="false"
|
|
40
|
+
:model-value="popoutValue"
|
|
41
|
+
@change="onChange"
|
|
42
|
+
>
|
|
43
|
+
<template #custom="{ toggle }">
|
|
44
|
+
<sar-list inlaid>
|
|
45
|
+
<sar-list-item
|
|
46
|
+
v-for="option in options"
|
|
47
|
+
:key="getMayPrimitiveOption(option, fieldKeys.value)"
|
|
48
|
+
:title="getMayPrimitiveOption(option, fieldKeys.label)"
|
|
49
|
+
hover
|
|
50
|
+
@click="
|
|
51
|
+
toggle(getMayPrimitiveOption(option, fieldKeys.value))
|
|
52
|
+
"
|
|
53
|
+
>
|
|
54
|
+
<template #value>
|
|
55
|
+
<sar-radio
|
|
56
|
+
readonly
|
|
57
|
+
:value="getMayPrimitiveOption(option, fieldKeys.value)"
|
|
58
|
+
/>
|
|
59
|
+
</template>
|
|
60
|
+
</sar-list-item>
|
|
61
|
+
</sar-list>
|
|
62
|
+
</template>
|
|
63
|
+
</sar-radio-group>
|
|
64
|
+
</scroll-view>
|
|
65
|
+
</view>
|
|
52
66
|
</template>
|
|
53
67
|
</sar-popout>
|
|
54
68
|
</template>
|
|
@@ -66,8 +80,14 @@ import { defaultOptionKeys } from "../radio/common";
|
|
|
66
80
|
import {
|
|
67
81
|
defaultRadioInputProps
|
|
68
82
|
} from "./common";
|
|
69
|
-
import {
|
|
83
|
+
import {
|
|
84
|
+
classNames,
|
|
85
|
+
createBem,
|
|
86
|
+
getMayPrimitiveOption,
|
|
87
|
+
isNullish
|
|
88
|
+
} from "../../utils";
|
|
70
89
|
import { useFormItemContext } from "../form/common";
|
|
90
|
+
import { useScrollSide } from "../../use";
|
|
71
91
|
export default _defineComponent({
|
|
72
92
|
components: {
|
|
73
93
|
SarPopoutInput,
|
|
@@ -188,7 +208,14 @@ export default _defineComponent({
|
|
|
188
208
|
innerVisible.value = true;
|
|
189
209
|
emit("update:visible", true);
|
|
190
210
|
};
|
|
191
|
-
const
|
|
211
|
+
const { scrollSide, onScroll, onScrolltoupper, onScrolltolower } = useScrollSide();
|
|
212
|
+
const containerClass = computed(() => {
|
|
213
|
+
return classNames(
|
|
214
|
+
bem.e("container"),
|
|
215
|
+
bem.em("container", scrollSide.value, scrollSide.value)
|
|
216
|
+
);
|
|
217
|
+
});
|
|
218
|
+
const __returned__ = { props, emit, bem, formItemContext, fieldKeys, innerValue, popoutValue, onChange, onConfirm, inputValue, getOutletText, getInputValue, onClear, innerVisible, onVisible, onInputClick, scrollSide, onScroll, onScrolltoupper, onScrolltolower, containerClass, SarPopoutInput, SarPopout, SarRadioGroup, SarRadio, SarList, SarListItem, get getMayPrimitiveOption() {
|
|
192
219
|
return getMayPrimitiveOption;
|
|
193
220
|
} };
|
|
194
221
|
return __returned__;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type NodeRect } from '../../utils';
|
|
2
|
+
import { type StyleValue } from 'vue';
|
|
3
|
+
export interface ScrollSpyProps {
|
|
4
|
+
rootStyle?: StyleValue;
|
|
5
|
+
rootClass?: string;
|
|
6
|
+
current?: string | number;
|
|
7
|
+
offset?: number;
|
|
8
|
+
upperThreshold?: number | string;
|
|
9
|
+
lowerThreshold?: number | string;
|
|
10
|
+
}
|
|
11
|
+
export interface ScrollSpySlots {
|
|
12
|
+
default?(props: Record<string, never>): any;
|
|
13
|
+
}
|
|
14
|
+
export interface ScrollSpyEmits {
|
|
15
|
+
(e: 'update:current', name: number | string): void;
|
|
16
|
+
(e: 'change', name: number | string): void;
|
|
17
|
+
(e: 'scrolltoupper'): void;
|
|
18
|
+
(e: 'scrolltolower'): void;
|
|
19
|
+
(e: 'scroll', event: any): void;
|
|
20
|
+
}
|
|
21
|
+
export interface ScrollSpyExpose {
|
|
22
|
+
scrollTo: (name: string | number) => void;
|
|
23
|
+
update: () => void;
|
|
24
|
+
}
|
|
25
|
+
export interface ScrollSpyContext {
|
|
26
|
+
register: (name: string | number, getRect: () => Promise<NodeRect>) => void;
|
|
27
|
+
unregister: (name: string | number) => void;
|
|
28
|
+
}
|
|
29
|
+
export declare const scrollSpyContextSymbol: unique symbol;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const scrollSpyContextSymbol = Symbol('scroll-spy-context');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ScrollSpyProps, ScrollSpySlots, ScrollSpyEmits, ScrollSpyExpose, } from './common';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ScrollSpyProps, type ScrollSpySlots } from './common';
|
|
2
|
+
declare function __VLS_template(): Readonly<ScrollSpySlots> & ScrollSpySlots;
|
|
3
|
+
declare const __VLS_component: import("vue").DefineComponent<ScrollSpyProps, {
|
|
4
|
+
scrollTo: (name: string | number) => void;
|
|
5
|
+
update: () => void;
|
|
6
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
7
|
+
change: (name: string | number) => any;
|
|
8
|
+
scroll: (event: any) => any;
|
|
9
|
+
"update:current": (name: string | number) => any;
|
|
10
|
+
scrolltoupper: () => any;
|
|
11
|
+
scrolltolower: () => any;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<ScrollSpyProps> & Readonly<{
|
|
13
|
+
onChange?: ((name: string | number) => any) | undefined;
|
|
14
|
+
onScroll?: ((event: any) => any) | undefined;
|
|
15
|
+
"onUpdate:current"?: ((name: string | number) => any) | undefined;
|
|
16
|
+
onScrolltoupper?: (() => any) | undefined;
|
|
17
|
+
onScrolltolower?: (() => any) | undefined;
|
|
18
|
+
}>, {
|
|
19
|
+
upperThreshold: number | string;
|
|
20
|
+
lowerThreshold: number | string;
|
|
21
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
23
|
+
export default _default;
|
|
24
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
25
|
+
new (): {
|
|
26
|
+
$slots: S;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<scroll-view
|
|
3
|
+
:class="classNames(props.rootClass, scrollViewId)"
|
|
4
|
+
:style="rootStyle"
|
|
5
|
+
scroll-y
|
|
6
|
+
:scroll-top="scrollTop"
|
|
7
|
+
:upper-threshold="upperThreshold"
|
|
8
|
+
:lower-threshold="lowerThreshold"
|
|
9
|
+
@scroll="onScroll"
|
|
10
|
+
@scrolltoupper="onScrolltoupper"
|
|
11
|
+
@scrolltolower="onScrolltolower"
|
|
12
|
+
>
|
|
13
|
+
<view>
|
|
14
|
+
<slot></slot>
|
|
15
|
+
</view>
|
|
16
|
+
</scroll-view>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
import { defineComponent as _defineComponent } from "vue";
|
|
21
|
+
import {
|
|
22
|
+
getCurrentInstance,
|
|
23
|
+
onMounted,
|
|
24
|
+
provide,
|
|
25
|
+
reactive,
|
|
26
|
+
toRef,
|
|
27
|
+
watch
|
|
28
|
+
} from "vue";
|
|
29
|
+
import {
|
|
30
|
+
isNullish,
|
|
31
|
+
uniqid,
|
|
32
|
+
getBoundingClientRect,
|
|
33
|
+
classNames
|
|
34
|
+
} from "../../utils";
|
|
35
|
+
import {
|
|
36
|
+
scrollSpyContextSymbol
|
|
37
|
+
} from "./common";
|
|
38
|
+
import { useScrollSpy } from "../../use";
|
|
39
|
+
export default _defineComponent({
|
|
40
|
+
...{
|
|
41
|
+
options: {
|
|
42
|
+
virtualHost: true,
|
|
43
|
+
styleIsolation: "shared"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
__name: "scroll-spy",
|
|
47
|
+
props: {
|
|
48
|
+
rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
49
|
+
rootClass: { type: String, required: false },
|
|
50
|
+
current: { type: [String, Number], required: false },
|
|
51
|
+
offset: { type: Number, required: false },
|
|
52
|
+
upperThreshold: { type: [Number, String], required: false, default: 50 },
|
|
53
|
+
lowerThreshold: { type: [Number, String], required: false, default: 50 }
|
|
54
|
+
},
|
|
55
|
+
emits: ["update:current", "change", "scrolltoupper", "scrolltolower", "scroll"],
|
|
56
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
57
|
+
const props = __props;
|
|
58
|
+
const emit = __emit;
|
|
59
|
+
const scrollViewId = uniqid();
|
|
60
|
+
const instance = getCurrentInstance();
|
|
61
|
+
const {
|
|
62
|
+
scrollTop,
|
|
63
|
+
innerCurrent,
|
|
64
|
+
anchorRectList,
|
|
65
|
+
register,
|
|
66
|
+
unregister,
|
|
67
|
+
onScroll: onScrollAlias,
|
|
68
|
+
scrollTo,
|
|
69
|
+
update,
|
|
70
|
+
initialize
|
|
71
|
+
} = useScrollSpy(
|
|
72
|
+
reactive({
|
|
73
|
+
startOffset: toRef(() => props.offset),
|
|
74
|
+
defaultCurrent: props.current,
|
|
75
|
+
getSpiedRect() {
|
|
76
|
+
return getBoundingClientRect(`.${scrollViewId}`, instance);
|
|
77
|
+
},
|
|
78
|
+
onChange(name) {
|
|
79
|
+
emit("update:current", name);
|
|
80
|
+
emit("change", name);
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
);
|
|
84
|
+
const onScrolltoupper = () => {
|
|
85
|
+
emit("scrolltoupper");
|
|
86
|
+
};
|
|
87
|
+
const onScrolltolower = () => {
|
|
88
|
+
emit("scrolltolower");
|
|
89
|
+
};
|
|
90
|
+
const onScroll = (event) => {
|
|
91
|
+
emit("scroll", event);
|
|
92
|
+
onScrollAlias(event);
|
|
93
|
+
};
|
|
94
|
+
provide(scrollSpyContextSymbol, {
|
|
95
|
+
register,
|
|
96
|
+
unregister
|
|
97
|
+
});
|
|
98
|
+
onMounted(() => {
|
|
99
|
+
initialize();
|
|
100
|
+
});
|
|
101
|
+
watch(
|
|
102
|
+
() => props.current,
|
|
103
|
+
() => {
|
|
104
|
+
if (!isNullish(props.current) && anchorRectList.value.find((item) => item[0] === props.current) && props.current !== innerCurrent.value) {
|
|
105
|
+
innerCurrent.value = props.current;
|
|
106
|
+
scrollTo(props.current);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
__expose({
|
|
111
|
+
scrollTo,
|
|
112
|
+
update
|
|
113
|
+
});
|
|
114
|
+
const __returned__ = { props, emit, scrollViewId, instance, scrollTop, innerCurrent, anchorRectList, register, unregister, onScrollAlias, scrollTo, update, initialize, onScrolltoupper, onScrolltolower, onScroll, get classNames() {
|
|
115
|
+
return classNames;
|
|
116
|
+
} };
|
|
117
|
+
return __returned__;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
</script>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type StyleValue } from 'vue';
|
|
2
|
+
export interface ScrollSpyAnchorProps {
|
|
3
|
+
rootStyle?: StyleValue;
|
|
4
|
+
rootClass?: string;
|
|
5
|
+
name: string | number;
|
|
6
|
+
}
|
|
7
|
+
export interface ScrollSpyAnchorSlots {
|
|
8
|
+
default?(props: Record<string, never>): any;
|
|
9
|
+
}
|
|
10
|
+
export interface ScrollSpyAnchorEmits {
|
|
11
|
+
}
|
|
12
|
+
export interface ScrollSpyAnchorExpose {
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ScrollSpyAnchorProps, ScrollSpyAnchorSlots, ScrollSpyAnchorEmits, ScrollSpyAnchorExpose, } from './common';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ScrollSpyAnchorProps, type ScrollSpyAnchorSlots } from './common';
|
|
2
|
+
declare function __VLS_template(): Readonly<ScrollSpyAnchorSlots> & ScrollSpyAnchorSlots;
|
|
3
|
+
declare const __VLS_component: import("vue").DefineComponent<ScrollSpyAnchorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ScrollSpyAnchorProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
4
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
5
|
+
export default _default;
|
|
6
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
7
|
+
new (): {
|
|
8
|
+
$slots: S;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="classNames(rootClass, anchorId)" :style="rootStyle">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</view>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import { defineComponent as _defineComponent } from "vue";
|
|
9
|
+
import { inject, onBeforeMount, getCurrentInstance } from "vue";
|
|
10
|
+
import { classNames, getBoundingClientRect, uniqid } from "../../utils";
|
|
11
|
+
import {
|
|
12
|
+
scrollSpyContextSymbol
|
|
13
|
+
} from "../scroll-spy/common";
|
|
14
|
+
export default _defineComponent({
|
|
15
|
+
...{
|
|
16
|
+
options: {
|
|
17
|
+
virtualHost: true,
|
|
18
|
+
styleIsolation: "shared"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
__name: "scroll-spy-anchor",
|
|
22
|
+
props: {
|
|
23
|
+
rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
24
|
+
rootClass: { type: String, required: false },
|
|
25
|
+
name: { type: [String, Number], required: true }
|
|
26
|
+
},
|
|
27
|
+
setup(__props, { expose: __expose }) {
|
|
28
|
+
__expose();
|
|
29
|
+
const props = __props;
|
|
30
|
+
const context = inject(
|
|
31
|
+
scrollSpyContextSymbol
|
|
32
|
+
);
|
|
33
|
+
if (!context) {
|
|
34
|
+
throw new Error("ScrollSpyAnchor must be included in ScrollSpy.");
|
|
35
|
+
}
|
|
36
|
+
const anchorId = uniqid();
|
|
37
|
+
const instance = getCurrentInstance();
|
|
38
|
+
const getRect = () => {
|
|
39
|
+
return getBoundingClientRect(`.${anchorId}`, instance);
|
|
40
|
+
};
|
|
41
|
+
onBeforeMount(() => {
|
|
42
|
+
context.register(props.name, getRect);
|
|
43
|
+
});
|
|
44
|
+
const __returned__ = { props, context, anchorId, instance, getRect, get classNames() {
|
|
45
|
+
return classNames;
|
|
46
|
+
} };
|
|
47
|
+
return __returned__;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
</script>
|