sard-uniapp 1.11.2 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -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 +2 -0
- package/components/button/common.d.ts +2 -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 +671 -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
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
v-if="cancel"
|
|
39
39
|
type="pale-text"
|
|
40
40
|
root-style="height: auto"
|
|
41
|
+
block
|
|
41
42
|
@click="onCancel"
|
|
42
43
|
>
|
|
43
44
|
{{ cancel }}
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
v-if="search"
|
|
47
48
|
type="pale-text"
|
|
48
49
|
root-style="height: auto"
|
|
50
|
+
block
|
|
49
51
|
@click="onConfirm"
|
|
50
52
|
>
|
|
51
53
|
{{ search }}
|
|
@@ -77,7 +77,8 @@ import {
|
|
|
77
77
|
stringifyStyle,
|
|
78
78
|
createBem,
|
|
79
79
|
noop,
|
|
80
|
-
isFileUrl
|
|
80
|
+
isFileUrl,
|
|
81
|
+
isFunction
|
|
81
82
|
} from "../../utils";
|
|
82
83
|
import SarPopup from "../popup/popup.vue";
|
|
83
84
|
import SarIcon from "../icon/icon.vue";
|
|
@@ -132,7 +133,7 @@ export default _defineComponent({
|
|
|
132
133
|
}
|
|
133
134
|
);
|
|
134
135
|
const perhapsClose = (type) => {
|
|
135
|
-
if (
|
|
136
|
+
if (isFunction(props.beforeClose)) {
|
|
136
137
|
const result = props.beforeClose(type);
|
|
137
138
|
if (result instanceof Promise) {
|
|
138
139
|
return result.then(() => {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type StyleValue } from 'vue';
|
|
2
|
+
import { type ScrollIntoViewOptions, type NodeRect } from '../../utils';
|
|
3
|
+
export interface SidebarProps {
|
|
4
|
+
rootStyle?: StyleValue;
|
|
5
|
+
rootClass?: string;
|
|
6
|
+
current?: string | number;
|
|
7
|
+
round?: boolean;
|
|
8
|
+
line?: boolean;
|
|
9
|
+
scrollIntoViewOptions?: ScrollIntoViewOptions;
|
|
10
|
+
}
|
|
11
|
+
export interface SidebarSlots {
|
|
12
|
+
default?(props: Record<string, never>): any;
|
|
13
|
+
}
|
|
14
|
+
export interface SidebarEmits {
|
|
15
|
+
(e: 'update:current', name: string | number): void;
|
|
16
|
+
(e: 'change', name: string | number): void;
|
|
17
|
+
}
|
|
18
|
+
export interface SidebarExpose {
|
|
19
|
+
}
|
|
20
|
+
export interface SidebarContext {
|
|
21
|
+
current: any;
|
|
22
|
+
select: (name: string | number, rect?: NodeRect) => void;
|
|
23
|
+
register: (name: string | number, getRect: () => Promise<NodeRect>) => void;
|
|
24
|
+
unregister: (name: string | number) => void;
|
|
25
|
+
round?: boolean;
|
|
26
|
+
line?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare const sidebarContextSymbol: unique symbol;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const sidebarContextSymbol = Symbol('sidebar-context');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { SidebarProps, SidebarSlots, SidebarEmits, SidebarExpose, } from './common';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@use '../style/base' as *;
|
|
2
|
+
|
|
3
|
+
@include bem(sidebar) {
|
|
4
|
+
@include b() {
|
|
5
|
+
@include universal;
|
|
6
|
+
width: var(--sar-sidebar-width);
|
|
7
|
+
background: var(--sar-sidebar-bg);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@include e(content) {
|
|
11
|
+
@include universal;
|
|
12
|
+
|
|
13
|
+
min-height: 100%;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type SidebarProps, type SidebarSlots } from './common';
|
|
2
|
+
declare function __VLS_template(): Readonly<SidebarSlots> & SidebarSlots;
|
|
3
|
+
declare const __VLS_component: import("vue").DefineComponent<SidebarProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
4
|
+
change: (name: string | number) => any;
|
|
5
|
+
"update:current": (name: string | number) => any;
|
|
6
|
+
}, string, import("vue").PublicProps, Readonly<SidebarProps> & Readonly<{
|
|
7
|
+
onChange?: ((name: string | number) => any) | undefined;
|
|
8
|
+
"onUpdate:current"?: ((name: string | number) => any) | undefined;
|
|
9
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
11
|
+
export default _default;
|
|
12
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
13
|
+
new (): {
|
|
14
|
+
$slots: S;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<scroll-view
|
|
3
|
+
scroll-y
|
|
4
|
+
:scroll-top="scrollTop"
|
|
5
|
+
:class="sidebarClass"
|
|
6
|
+
:style="sidebarStyle"
|
|
7
|
+
@scroll="onScroll"
|
|
8
|
+
>
|
|
9
|
+
<view :class="bem.e('content')">
|
|
10
|
+
<slot></slot>
|
|
11
|
+
</view>
|
|
12
|
+
</scroll-view>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
import { defineComponent as _defineComponent } from "vue";
|
|
17
|
+
import {
|
|
18
|
+
computed,
|
|
19
|
+
getCurrentInstance,
|
|
20
|
+
provide,
|
|
21
|
+
reactive,
|
|
22
|
+
ref,
|
|
23
|
+
toRef,
|
|
24
|
+
watch
|
|
25
|
+
} from "vue";
|
|
26
|
+
import {
|
|
27
|
+
classNames,
|
|
28
|
+
stringifyStyle,
|
|
29
|
+
createBem,
|
|
30
|
+
getScrollIntoViewValue,
|
|
31
|
+
uniqid,
|
|
32
|
+
getBoundingClientRect,
|
|
33
|
+
isNullish
|
|
34
|
+
} from "../../utils";
|
|
35
|
+
import {
|
|
36
|
+
sidebarContextSymbol
|
|
37
|
+
} from "./common";
|
|
38
|
+
export default _defineComponent({
|
|
39
|
+
...{
|
|
40
|
+
options: {
|
|
41
|
+
virtualHost: true,
|
|
42
|
+
styleIsolation: "shared"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
__name: "sidebar",
|
|
46
|
+
props: {
|
|
47
|
+
rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
48
|
+
rootClass: { type: String, required: false },
|
|
49
|
+
current: { type: [String, Number], required: false },
|
|
50
|
+
round: { type: Boolean, required: false },
|
|
51
|
+
line: { type: Boolean, required: false },
|
|
52
|
+
scrollIntoViewOptions: { type: Object, required: false }
|
|
53
|
+
},
|
|
54
|
+
emits: ["update:current", "change"],
|
|
55
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
56
|
+
const props = __props;
|
|
57
|
+
const emit = __emit;
|
|
58
|
+
const bem = createBem("sidebar");
|
|
59
|
+
const innerCurrent = ref(props.current);
|
|
60
|
+
const sidebarItemMap = new Map();
|
|
61
|
+
const scrollViewId = uniqid();
|
|
62
|
+
const scrollTop = ref(0);
|
|
63
|
+
const instance = getCurrentInstance();
|
|
64
|
+
let memoScrollTop = 0;
|
|
65
|
+
const onScroll = (event) => {
|
|
66
|
+
memoScrollTop = event.detail.scrollTop;
|
|
67
|
+
};
|
|
68
|
+
const scrollIntoView = async (name) => {
|
|
69
|
+
const getRect = sidebarItemMap.get(name);
|
|
70
|
+
if (!getRect) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const itemRect = await getRect();
|
|
74
|
+
const scrollViewRect = await getBoundingClientRect(
|
|
75
|
+
`.${scrollViewId}`,
|
|
76
|
+
instance
|
|
77
|
+
);
|
|
78
|
+
const value = getScrollIntoViewValue(
|
|
79
|
+
scrollViewRect.height,
|
|
80
|
+
memoScrollTop,
|
|
81
|
+
itemRect.height,
|
|
82
|
+
itemRect.top - scrollViewRect.top + memoScrollTop,
|
|
83
|
+
props.scrollIntoViewOptions
|
|
84
|
+
);
|
|
85
|
+
scrollTop.value = value;
|
|
86
|
+
};
|
|
87
|
+
watch(
|
|
88
|
+
() => props.current,
|
|
89
|
+
() => {
|
|
90
|
+
if (!isNullish(props.current) && props.current !== innerCurrent.value) {
|
|
91
|
+
innerCurrent.value = props.current;
|
|
92
|
+
scrollIntoView(props.current);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
provide(
|
|
97
|
+
sidebarContextSymbol,
|
|
98
|
+
reactive({
|
|
99
|
+
current: innerCurrent,
|
|
100
|
+
round: toRef(() => props.round),
|
|
101
|
+
line: toRef(() => props.line),
|
|
102
|
+
register(name, getRect) {
|
|
103
|
+
sidebarItemMap.set(name, getRect);
|
|
104
|
+
},
|
|
105
|
+
unregister(name) {
|
|
106
|
+
sidebarItemMap.delete(name);
|
|
107
|
+
},
|
|
108
|
+
select(name) {
|
|
109
|
+
if (name !== innerCurrent.value) {
|
|
110
|
+
innerCurrent.value = name;
|
|
111
|
+
emit("update:current", name);
|
|
112
|
+
emit("change", name);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
})
|
|
116
|
+
);
|
|
117
|
+
const sidebarClass = computed(() => {
|
|
118
|
+
return classNames(bem.b(), props.rootClass, scrollViewId);
|
|
119
|
+
});
|
|
120
|
+
const sidebarStyle = computed(() => {
|
|
121
|
+
return stringifyStyle(props.rootStyle);
|
|
122
|
+
});
|
|
123
|
+
__expose({});
|
|
124
|
+
const __returned__ = { props, emit, bem, innerCurrent, sidebarItemMap, scrollViewId, scrollTop, instance, get memoScrollTop() {
|
|
125
|
+
return memoScrollTop;
|
|
126
|
+
}, set memoScrollTop(v) {
|
|
127
|
+
memoScrollTop = v;
|
|
128
|
+
}, onScroll, scrollIntoView, sidebarClass, sidebarStyle };
|
|
129
|
+
return __returned__;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
</script>
|
|
133
|
+
|
|
134
|
+
<style lang="scss">
|
|
135
|
+
@import './index.scss';
|
|
136
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// #variables
|
|
2
|
+
page {
|
|
3
|
+
--sar-sidebar-bg: var(--sar-body-bg);
|
|
4
|
+
--sar-sidebar-width: 184rpx;
|
|
5
|
+
|
|
6
|
+
--sar-sidebar-item-padding-x: 40rpx;
|
|
7
|
+
--sar-sidebar-item-padding-y: 28rpx;
|
|
8
|
+
--sar-sidebar-item-font-size: var(--sar-text-sm);
|
|
9
|
+
--sar-sidebar-item-color: var(--sar-secondary-color);
|
|
10
|
+
--sar-sidebar-item-active-bg: var(--sar-emphasis-bg);
|
|
11
|
+
--sar-sidebar-item-active-color: var(--sar-emphasis-color);
|
|
12
|
+
--sar-sidebar-item-active-font-weight: var(--sar-font-normal);
|
|
13
|
+
|
|
14
|
+
--sar-sidebar-line-width: 6rpx;
|
|
15
|
+
--sar-sidebar-line-height: 24rpx;
|
|
16
|
+
--sar-sidebar-line-bg: var(--sar-primary);
|
|
17
|
+
|
|
18
|
+
--sar-sidebar-round-size: 12rpx;
|
|
19
|
+
}
|
|
20
|
+
// #endvariables
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type StyleValue } from 'vue';
|
|
2
|
+
export interface SidebarItemProps {
|
|
3
|
+
rootStyle?: StyleValue;
|
|
4
|
+
rootClass?: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
name: string | number;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface SidebarItemSlots {
|
|
10
|
+
default?(props: Record<string, never>): any;
|
|
11
|
+
}
|
|
12
|
+
export interface SidebarItemEmits {
|
|
13
|
+
(e: 'click', event: any): void;
|
|
14
|
+
}
|
|
15
|
+
export interface SidebarItemExpose {
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { SidebarItemProps, SidebarItemSlots, SidebarItemEmits, SidebarItemExpose, } from './common';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
@use '../style/base' as *;
|
|
2
|
+
|
|
3
|
+
@include bem(sidebar-item) {
|
|
4
|
+
@include b() {
|
|
5
|
+
@include universal;
|
|
6
|
+
padding: var(--sar-sidebar-item-padding-y) var(--sar-sidebar-item-padding-x);
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
font-size: var(--sar-sidebar-item-font-size);
|
|
9
|
+
line-height: var(--sar-leading-snug);
|
|
10
|
+
color: var(--sar-sidebar-item-color);
|
|
11
|
+
text-align: center;
|
|
12
|
+
|
|
13
|
+
@include m(current) {
|
|
14
|
+
font-weight: var(--sar-sidebar-item-active-font-weight);
|
|
15
|
+
color: var(--sar-sidebar-item-active-color);
|
|
16
|
+
background: var(--sar-sidebar-item-active-bg);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@include m(disabled) {
|
|
20
|
+
@include disabled-text;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@include e(title) {
|
|
25
|
+
@include line-clamp(2);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@include e(line) {
|
|
29
|
+
position: absolute;
|
|
30
|
+
top: 50%;
|
|
31
|
+
left: 0;
|
|
32
|
+
width: var(--sar-sidebar-line-width);
|
|
33
|
+
height: var(--sar-sidebar-line-height);
|
|
34
|
+
transform: translateY(-50%);
|
|
35
|
+
background: var(--sar-sidebar-line-bg);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@include e(round-top, round-bottom) {
|
|
39
|
+
position: absolute;
|
|
40
|
+
right: 0;
|
|
41
|
+
width: var(--sar-sidebar-round-size);
|
|
42
|
+
height: var(--sar-sidebar-round-size);
|
|
43
|
+
background: var(--sar-sidebar-item-active-bg);
|
|
44
|
+
pointer-events: none;
|
|
45
|
+
|
|
46
|
+
&::before {
|
|
47
|
+
content: '';
|
|
48
|
+
display: flex;
|
|
49
|
+
width: 100%;
|
|
50
|
+
height: 100%;
|
|
51
|
+
background-color: var(--sar-sidebar-bg);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@include e(round-top) {
|
|
56
|
+
bottom: 100%;
|
|
57
|
+
|
|
58
|
+
&::before {
|
|
59
|
+
border-bottom-right-radius: 100%;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@include e(round-bottom) {
|
|
64
|
+
top: 100%;
|
|
65
|
+
|
|
66
|
+
&::before {
|
|
67
|
+
border-top-right-radius: 100%;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type SidebarItemProps, type SidebarItemSlots } from './common';
|
|
2
|
+
declare function __VLS_template(): Readonly<SidebarItemSlots> & SidebarItemSlots;
|
|
3
|
+
declare const __VLS_component: import("vue").DefineComponent<SidebarItemProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
4
|
+
click: (event: any) => any;
|
|
5
|
+
}, string, import("vue").PublicProps, Readonly<SidebarItemProps> & Readonly<{
|
|
6
|
+
onClick?: ((event: any) => any) | undefined;
|
|
7
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
9
|
+
export default _default;
|
|
10
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
11
|
+
new (): {
|
|
12
|
+
$slots: S;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="sidebarItemClass" :style="sidebarItemStyle" @click="onClick">
|
|
3
|
+
<view v-if="isCurrent && context.round" :class="bem.e('round-top')"></view>
|
|
4
|
+
<view v-if="isCurrent && context.line" :class="bem.e('line')"></view>
|
|
5
|
+
<slot>
|
|
6
|
+
<view :class="bem.e('title')">
|
|
7
|
+
{{ title }}
|
|
8
|
+
</view>
|
|
9
|
+
</slot>
|
|
10
|
+
<view
|
|
11
|
+
v-if="isCurrent && context.round"
|
|
12
|
+
:class="bem.e('round-bottom')"
|
|
13
|
+
></view>
|
|
14
|
+
</view>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
import { defineComponent as _defineComponent } from "vue";
|
|
19
|
+
import {
|
|
20
|
+
computed,
|
|
21
|
+
getCurrentInstance,
|
|
22
|
+
inject,
|
|
23
|
+
nextTick,
|
|
24
|
+
onMounted,
|
|
25
|
+
onUnmounted
|
|
26
|
+
} from "vue";
|
|
27
|
+
import {
|
|
28
|
+
classNames,
|
|
29
|
+
stringifyStyle,
|
|
30
|
+
createBem,
|
|
31
|
+
uniqid,
|
|
32
|
+
getBoundingClientRect
|
|
33
|
+
} from "../../utils";
|
|
34
|
+
import { sidebarContextSymbol } from "../sidebar/common";
|
|
35
|
+
export default _defineComponent({
|
|
36
|
+
...{
|
|
37
|
+
options: {
|
|
38
|
+
virtualHost: true,
|
|
39
|
+
styleIsolation: "shared"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
__name: "sidebar-item",
|
|
43
|
+
props: {
|
|
44
|
+
rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
45
|
+
rootClass: { type: String, required: false },
|
|
46
|
+
title: { type: String, required: false },
|
|
47
|
+
name: { type: [String, Number], required: true },
|
|
48
|
+
disabled: { type: Boolean, required: false }
|
|
49
|
+
},
|
|
50
|
+
emits: ["click"],
|
|
51
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
52
|
+
const props = __props;
|
|
53
|
+
const emit = __emit;
|
|
54
|
+
const bem = createBem("sidebar-item");
|
|
55
|
+
const context = inject(sidebarContextSymbol);
|
|
56
|
+
if (!context) {
|
|
57
|
+
throw new Error("SidebarItem must be included in Sidebar.");
|
|
58
|
+
}
|
|
59
|
+
const instance = getCurrentInstance();
|
|
60
|
+
const isCurrent = computed(() => {
|
|
61
|
+
return context.current === props.name;
|
|
62
|
+
});
|
|
63
|
+
const itemId = uniqid();
|
|
64
|
+
const getRect = () => {
|
|
65
|
+
return getBoundingClientRect(`.${itemId}`, instance);
|
|
66
|
+
};
|
|
67
|
+
const select = () => {
|
|
68
|
+
context.select(props.name);
|
|
69
|
+
};
|
|
70
|
+
const onClick = (event) => {
|
|
71
|
+
emit("click", event);
|
|
72
|
+
if (!props.disabled) {
|
|
73
|
+
select();
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
onMounted(() => {
|
|
77
|
+
context.register(props.name, getRect);
|
|
78
|
+
if (isCurrent.value) {
|
|
79
|
+
nextTick(() => {
|
|
80
|
+
select();
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
onUnmounted(() => {
|
|
85
|
+
context.unregister(props.name);
|
|
86
|
+
});
|
|
87
|
+
const sidebarItemClass = computed(() => {
|
|
88
|
+
return classNames(
|
|
89
|
+
bem.b(),
|
|
90
|
+
bem.m("current", isCurrent.value),
|
|
91
|
+
bem.m("disabled", props.disabled),
|
|
92
|
+
props.rootClass,
|
|
93
|
+
itemId
|
|
94
|
+
);
|
|
95
|
+
});
|
|
96
|
+
const sidebarItemStyle = computed(() => {
|
|
97
|
+
return stringifyStyle(props.rootStyle);
|
|
98
|
+
});
|
|
99
|
+
__expose({
|
|
100
|
+
reset: () => {
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
const __returned__ = { props, emit, bem, context, instance, isCurrent, itemId, getRect, select, onClick, sidebarItemClass, sidebarItemStyle };
|
|
104
|
+
return __returned__;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
</script>
|
|
108
|
+
|
|
109
|
+
<style lang="scss">
|
|
110
|
+
@import './index.scss';
|
|
111
|
+
</style>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type StyleValue } from 'vue';
|
|
2
|
+
export interface SignatureProps {
|
|
3
|
+
rootStyle?: StyleValue;
|
|
4
|
+
rootClass?: string;
|
|
5
|
+
color?: string;
|
|
6
|
+
lineWidth?: number;
|
|
7
|
+
background?: string;
|
|
8
|
+
fullScreen?: boolean;
|
|
9
|
+
duration?: number;
|
|
10
|
+
visible?: boolean;
|
|
11
|
+
cancelText?: string;
|
|
12
|
+
clearText?: string;
|
|
13
|
+
confirmText?: string;
|
|
14
|
+
customNavbar?: boolean;
|
|
15
|
+
type?: 'png' | 'jpg';
|
|
16
|
+
target?: 'dataURL' | 'filePath';
|
|
17
|
+
quality?: number;
|
|
18
|
+
}
|
|
19
|
+
export declare const defaultSignatureProps: {
|
|
20
|
+
lineWidth: number;
|
|
21
|
+
fullScreen: boolean;
|
|
22
|
+
color: string;
|
|
23
|
+
duration: number;
|
|
24
|
+
type: "png";
|
|
25
|
+
target: "dataURL";
|
|
26
|
+
quality: number;
|
|
27
|
+
};
|
|
28
|
+
export interface SignatureSlots {
|
|
29
|
+
default?(props: Record<string, never>): any;
|
|
30
|
+
}
|
|
31
|
+
export interface SignatureEmits {
|
|
32
|
+
(e: 'update:visible', visible: boolean): void;
|
|
33
|
+
(e: 'confirm', dataURL: string): void;
|
|
34
|
+
(e: 'clear'): void;
|
|
35
|
+
(e: 'cancel'): void;
|
|
36
|
+
}
|
|
37
|
+
export interface SignatureExpose {
|
|
38
|
+
resize: () => void;
|
|
39
|
+
clear: () => void;
|
|
40
|
+
confirm: () => void;
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { SignatureProps, SignatureSlots, SignatureEmits, SignatureExpose, } from './common';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
@use '../style/base' as *;
|
|
2
|
+
|
|
3
|
+
@include bem(signature) {
|
|
4
|
+
@include b() {
|
|
5
|
+
@include universal;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@include e(body) {
|
|
9
|
+
@include universal;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: var(--sar-signature-canvas-height);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@include e(canvas-content) {
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 100%;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@include e(canvas) {
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
background-color: var(--sar-signature-canvas-bg);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@include e(covert-canvas) {
|
|
26
|
+
position: fixed;
|
|
27
|
+
left: 200vw;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@include e(footer) {
|
|
31
|
+
@include universal;
|
|
32
|
+
margin-top: 20rpx;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@include e(footer-content) {
|
|
36
|
+
@include universal;
|
|
37
|
+
flex-direction: row;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@include e(button-group) {
|
|
41
|
+
@include universal;
|
|
42
|
+
flex-direction: row;
|
|
43
|
+
margin-left: auto;
|
|
44
|
+
gap: 20rpx;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@include m(full) {
|
|
48
|
+
position: fixed;
|
|
49
|
+
top: 0;
|
|
50
|
+
left: 0;
|
|
51
|
+
width: 100%;
|
|
52
|
+
height: 100%;
|
|
53
|
+
background-color: var(--sar-signature-full-bg);
|
|
54
|
+
touch-action: none;
|
|
55
|
+
|
|
56
|
+
@include e(content) {
|
|
57
|
+
@include universal;
|
|
58
|
+
flex: 1;
|
|
59
|
+
min-height: 0;
|
|
60
|
+
flex-direction: row-reverse;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@include e(body) {
|
|
64
|
+
width: calc(100vw - var(--sar-signature-side-width));
|
|
65
|
+
height: 100%;
|
|
66
|
+
padding: var(--sar-signature-full-gap) var(--sar-signature-full-gap)
|
|
67
|
+
calc(var(--sar-signature-full-gap) + env(safe-area-inset-bottom)) 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@include e(footer) {
|
|
71
|
+
position: relative;
|
|
72
|
+
width: var(--sar-signature-side-width);
|
|
73
|
+
height: 100%;
|
|
74
|
+
margin-top: 0;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@include e(footer-content) {
|
|
78
|
+
position: absolute;
|
|
79
|
+
right: 100%;
|
|
80
|
+
bottom: 0;
|
|
81
|
+
width: 100vh;
|
|
82
|
+
height: var(--sar-signature-side-width);
|
|
83
|
+
padding-left: var(--sar-signature-full-gap);
|
|
84
|
+
padding-right: calc(
|
|
85
|
+
var(--sar-signature-full-gap) + env(safe-area-inset-bottom)
|
|
86
|
+
);
|
|
87
|
+
align-items: center;
|
|
88
|
+
transform-origin: right bottom;
|
|
89
|
+
transform: rotate(90deg);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@include m(fade-enter-from, fade-leave-to) {
|
|
94
|
+
opacity: 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@include m(fade-enter-to, fade-leave-from) {
|
|
98
|
+
opacity: 1;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@include m(fade-enter-active, fade-leave-active) {
|
|
102
|
+
transition: opacity 0s ease;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@include m(hidden) {
|
|
106
|
+
left: 200vw;
|
|
107
|
+
opacity: 0;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type SignatureProps, type SignatureSlots } from './common';
|
|
2
|
+
declare function __VLS_template(): Readonly<SignatureSlots> & SignatureSlots;
|
|
3
|
+
declare const __VLS_component: import("vue").DefineComponent<SignatureProps, {
|
|
4
|
+
resize: () => void;
|
|
5
|
+
clear: () => void;
|
|
6
|
+
confirm: () => void;
|
|
7
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
|
+
cancel: () => any;
|
|
9
|
+
clear: () => any;
|
|
10
|
+
confirm: (dataURL: string) => any;
|
|
11
|
+
"update:visible": (visible: boolean) => any;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<SignatureProps> & Readonly<{
|
|
13
|
+
onCancel?: (() => any) | undefined;
|
|
14
|
+
onClear?: (() => any) | undefined;
|
|
15
|
+
onConfirm?: ((dataURL: string) => any) | undefined;
|
|
16
|
+
"onUpdate:visible"?: ((visible: boolean) => any) | undefined;
|
|
17
|
+
}>, {
|
|
18
|
+
type: "png" | "jpg";
|
|
19
|
+
duration: number;
|
|
20
|
+
color: string;
|
|
21
|
+
target: "dataURL" | "filePath";
|
|
22
|
+
quality: number;
|
|
23
|
+
lineWidth: number;
|
|
24
|
+
fullScreen: boolean;
|
|
25
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
26
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
27
|
+
export default _default;
|
|
28
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
29
|
+
new (): {
|
|
30
|
+
$slots: S;
|
|
31
|
+
};
|
|
32
|
+
};
|