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.
Files changed (194) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +3 -2
  3. package/components/action-sheet/action-sheet.vue +8 -2
  4. package/components/action-sheet/index.scss +1 -1
  5. package/components/back-top/back-top.d.ts +1 -1
  6. package/components/badge/badge.vue +1 -1
  7. package/components/button/button.d.ts +1 -0
  8. package/components/button/button.vue +3 -0
  9. package/components/button/common.d.ts +3 -0
  10. package/components/button/index.scss +6 -1
  11. package/components/calendar/calendar.d.ts +1 -1
  12. package/components/calendar/calendar.vue +49 -22
  13. package/components/calendar/index.scss +5 -5
  14. package/components/calendar/variables.scss +1 -1
  15. package/components/calendar-input/calendar-input.d.ts +1 -1
  16. package/components/calendar-month/index.scss +1 -0
  17. package/components/cascader/cascader.d.ts +6 -6
  18. package/components/cascader/cascader.vue +9 -4
  19. package/components/cascader/common.d.ts +3 -3
  20. package/components/cascader/index.scss +1 -0
  21. package/components/checkbox-input/checkbox-input.vue +59 -32
  22. package/components/checkbox-input/index.scss +4 -0
  23. package/components/config/index.d.ts +23 -0
  24. package/components/config/index.js +47 -18
  25. package/components/crop-image/common.d.ts +32 -0
  26. package/components/crop-image/common.js +2 -0
  27. package/components/crop-image/crop-image.d.ts +19 -0
  28. package/components/crop-image/crop-image.vue +666 -0
  29. package/components/crop-image/index.d.ts +1 -0
  30. package/components/crop-image/index.scss +81 -0
  31. package/components/crop-image-agent/common.d.ts +19 -0
  32. package/components/crop-image-agent/common.js +16 -0
  33. package/components/crop-image-agent/crop-image-agent.d.ts +9 -0
  34. package/components/crop-image-agent/crop-image-agent.vue +70 -0
  35. package/components/crop-image-agent/index.d.ts +1 -0
  36. package/components/crop-image-agent/index.js +1 -0
  37. package/components/datetime-picker-input/datetime-picker-input.vue +4 -4
  38. package/components/datetime-range-picker/datetime-range-picker.vue +4 -3
  39. package/components/datetime-range-picker-input/datetime-range-picker-input.vue +4 -4
  40. package/components/dialog/common.d.ts +2 -3
  41. package/components/dialog/dialog.d.ts +6 -13
  42. package/components/dialog/dialog.vue +15 -4
  43. package/components/dialog-agent/dialog-agent.d.ts +1 -1
  44. package/components/dropdown-item/dropdown-item.vue +6 -6
  45. package/components/fab/fab.d.ts +1 -1
  46. package/components/floating-bubble/floating-bubble.vue +14 -19
  47. package/components/form-item/form-item.vue +4 -3
  48. package/components/grid/common.d.ts +4 -0
  49. package/components/grid-item/grid-item.vue +33 -18
  50. package/components/grid-item/index.scss +12 -4
  51. package/components/icon/index.scss +1 -0
  52. package/components/icon/sari.scss +9 -1
  53. package/components/indexes/common.d.ts +3 -5
  54. package/components/indexes/indexes.d.ts +2 -0
  55. package/components/indexes/indexes.vue +45 -109
  56. package/components/indexes-anchor/indexes-anchor.vue +9 -9
  57. package/components/indexes-nav/indexes-nav.vue +26 -22
  58. package/components/input/input.d.ts +4 -4
  59. package/components/loading/index.scss +1 -1
  60. package/components/locale/lang/en-US.d.ts +9 -0
  61. package/components/locale/lang/en-US.js +9 -0
  62. package/components/locale/lang/zh-CN.d.ts +9 -0
  63. package/components/locale/lang/zh-CN.js +9 -0
  64. package/components/navbar/common.d.ts +12 -0
  65. package/components/navbar/index.scss +17 -10
  66. package/components/navbar/navbar.d.ts +5 -1
  67. package/components/navbar/navbar.vue +45 -15
  68. package/components/navbar/variables.scss +4 -1
  69. package/components/navbar-item/index.scss +10 -0
  70. package/components/navbar-item/navbar-item.vue +27 -4
  71. package/components/navbar-pit/navbar-pit.d.ts +2 -0
  72. package/components/navbar-pit/navbar-pit.vue +22 -0
  73. package/components/notify/common.d.ts +1 -0
  74. package/components/notify/index.scss +12 -7
  75. package/components/notify/notify.vue +9 -3
  76. package/components/notify-agent/notify-agent.vue +9 -11
  77. package/components/pagination/pagination.d.ts +1 -1
  78. package/components/picker-input/picker-input.vue +4 -4
  79. package/components/popout/common.d.ts +2 -3
  80. package/components/popout/popout.d.ts +5 -12
  81. package/components/popout/popout.vue +16 -5
  82. package/components/popover/utils.js +2 -4
  83. package/components/popover-reference/popover-reference.vue +3 -3
  84. package/components/popup/common.d.ts +5 -3
  85. package/components/popup/index.scss +25 -3
  86. package/components/popup/popup.d.ts +1 -1
  87. package/components/pull-down-refresh/pull-down-refresh.d.ts +1 -1
  88. package/components/qrcode/qrcode.d.ts +1 -1
  89. package/components/qrcode/qrcode.vue +4 -7
  90. package/components/radio-input/index.scss +5 -1
  91. package/components/radio-input/radio-input.vue +59 -32
  92. package/components/scroll-spy/common.d.ts +29 -0
  93. package/components/scroll-spy/common.js +1 -0
  94. package/components/scroll-spy/index.d.ts +1 -0
  95. package/components/scroll-spy/index.js +1 -0
  96. package/components/scroll-spy/scroll-spy.d.ts +28 -0
  97. package/components/scroll-spy/scroll-spy.vue +120 -0
  98. package/components/scroll-spy-anchor/common.d.ts +13 -0
  99. package/components/scroll-spy-anchor/index.d.ts +1 -0
  100. package/components/scroll-spy-anchor/index.js +1 -0
  101. package/components/scroll-spy-anchor/scroll-spy-anchor.d.ts +10 -0
  102. package/components/scroll-spy-anchor/scroll-spy-anchor.vue +50 -0
  103. package/components/search/search.vue +2 -0
  104. package/components/share-sheet/share-sheet.vue +3 -2
  105. package/components/sidebar/common.d.ts +28 -0
  106. package/components/sidebar/common.js +1 -0
  107. package/components/sidebar/index.d.ts +1 -0
  108. package/components/sidebar/index.js +1 -0
  109. package/components/sidebar/index.scss +15 -0
  110. package/components/sidebar/sidebar.d.ts +16 -0
  111. package/components/sidebar/sidebar.vue +136 -0
  112. package/components/sidebar/variables.scss +20 -0
  113. package/components/sidebar-item/common.d.ts +16 -0
  114. package/components/sidebar-item/common.js +1 -0
  115. package/components/sidebar-item/index.d.ts +1 -0
  116. package/components/sidebar-item/index.js +1 -0
  117. package/components/sidebar-item/index.scss +70 -0
  118. package/components/sidebar-item/sidebar-item.d.ts +14 -0
  119. package/components/sidebar-item/sidebar-item.vue +111 -0
  120. package/components/signature/common.d.ts +41 -0
  121. package/components/signature/common.js +2 -0
  122. package/components/signature/index.d.ts +1 -0
  123. package/components/signature/index.js +1 -0
  124. package/components/signature/index.scss +109 -0
  125. package/components/signature/signature.d.ts +32 -0
  126. package/components/signature/signature.vue +580 -0
  127. package/components/signature/variables-dark.scss +7 -0
  128. package/components/signature/variables.scss +9 -0
  129. package/components/status-bar/common.d.ts +17 -0
  130. package/components/status-bar/common.js +2 -0
  131. package/components/status-bar/index.d.ts +1 -0
  132. package/components/status-bar/index.js +1 -0
  133. package/components/status-bar/index.scss +7 -0
  134. package/components/status-bar/status-bar.d.ts +12 -0
  135. package/components/status-bar/status-bar.vue +56 -0
  136. package/components/style/mixins/ellipsis.scss +7 -0
  137. package/components/style/mixins/scroll-shadow.scss +40 -0
  138. package/components/style/mixins.scss +1 -0
  139. package/components/style/variables.scss +3 -0
  140. package/components/swiper-dot/swiper-dot.d.ts +1 -1
  141. package/components/tab/tab.vue +4 -3
  142. package/components/tabbar/common.d.ts +1 -0
  143. package/components/tabbar/tabbar.d.ts +2 -0
  144. package/components/tabbar/tabbar.vue +2 -1
  145. package/components/table-cell/index.scss +1 -2
  146. package/components/table-fixation/table-fixation.vue +16 -8
  147. package/components/tree-node/tree-node.vue +3 -3
  148. package/components/upload/upload.vue +3 -2
  149. package/dark.scss +1 -0
  150. package/global.d.ts +9 -0
  151. package/index.d.ts +8 -0
  152. package/index.js +8 -0
  153. package/index.scss +2 -0
  154. package/package.json +28 -24
  155. package/use/index.d.ts +4 -0
  156. package/use/index.js +4 -0
  157. package/use/useDragPinch.d.ts +15 -0
  158. package/use/useDragPinch.js +88 -0
  159. package/use/useImperative.js +1 -0
  160. package/use/useInitialVelocity.d.ts +13 -0
  161. package/use/useInitialVelocity.js +65 -0
  162. package/use/useMouseDown.js +3 -4
  163. package/use/useScrollSide.d.ts +6 -0
  164. package/use/useScrollSide.js +34 -0
  165. package/use/useScrollSpy.d.ts +19 -0
  166. package/use/useScrollSpy.js +99 -0
  167. package/use/useTimeoutLoading.d.ts +6 -0
  168. package/use/useTimeoutLoading.js +53 -0
  169. package/use/useZIndex.js +7 -3
  170. package/utils/bem.d.ts +8 -8
  171. package/utils/dom.d.ts +3 -69
  172. package/utils/dom.js +32 -109
  173. package/utils/file.d.ts +1 -0
  174. package/utils/file.js +14 -0
  175. package/utils/geometry.d.ts +67 -0
  176. package/utils/geometry.js +127 -0
  177. package/utils/index.d.ts +2 -0
  178. package/utils/index.js +2 -0
  179. package/utils/inertialAnimate.d.ts +10 -0
  180. package/utils/inertialAnimate.js +42 -0
  181. package/utils/is.d.ts +8 -0
  182. package/utils/is.js +8 -0
  183. package/utils/system.d.ts +2 -0
  184. package/utils/system.js +6 -3
  185. package/utils/utils.d.ts +7 -0
  186. package/utils/utils.js +13 -0
  187. package/components/_template/_template.d.ts +0 -16
  188. package/components/_template/_template.vue +0 -45
  189. package/components/_template/common.d.ts +0 -14
  190. package/components/_template/index.d.ts +0 -1
  191. package/components/_template/index.scss +0 -17
  192. package/components/_template/variables.scss +0 -5
  193. /package/components/{_template → crop-image}/index.js +0 -0
  194. /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 (typeof props.beforeClose === "function") {
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,2 @@
1
+ import { defaultConfig } from '../config';
2
+ export const defaultSignatureProps = defaultConfig.signature;
@@ -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
+ };