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
@@ -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 { classNames, stringifyStyle, createBem, noop } from "../../utils";
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 (typeof props.beforeClose === "function") {
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 systemInfo = uni.getSystemInfoSync();
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" :id="referenceId" @click="onClick">
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(`#${referenceId}`, instance);
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 PopupEmits {
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(fade-enter-from, fade-leave-to) {
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(fade-enter-to, fade-leave-from) {
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(fade-enter-active, fade-leave-active) {
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
- uni.createSelectorQuery().in(instance).select(`#${canvasId}`).node((res) => {
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(() => {
@@ -1,7 +1,11 @@
1
1
  @use '../style/base' as *;
2
2
 
3
3
  @include bem(radio-input) {
4
+ @include e(container) {
5
+ @include scroll-shadow;
6
+ }
7
+
4
8
  @include e(scroll) {
5
- max-height: var(--sar-radio-input-max-height);
9
+ max-height: var(--sar-checkbox-input-max-height);
6
10
  }
7
11
  }
@@ -15,40 +15,54 @@
15
15
  :visible="innerVisible"
16
16
  @update:visible="onVisible"
17
17
  :title="title ?? placeholder"
18
- :show-confirm="false"
18
+ :show-footer="false"
19
19
  @confirm="onConfirm"
20
20
  >
21
21
  <template #visible="{ already }">
22
- <scroll-view v-if="already" scroll-y :class="bem.e('scroll')">
23
- <sar-radio-group
24
- :size="size"
25
- :type="type"
26
- :checkedColor="checkedColor"
27
- :direction="direction"
28
- :validate-event="false"
29
- :model-value="popoutValue"
30
- @change="onChange"
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
- <template #custom="{ toggle }">
33
- <sar-list inlaid>
34
- <sar-list-item
35
- v-for="option in options"
36
- :key="getMayPrimitiveOption(option, fieldKeys.value)"
37
- :title="getMayPrimitiveOption(option, fieldKeys.label)"
38
- hover
39
- @click="toggle(getMayPrimitiveOption(option, fieldKeys.value))"
40
- >
41
- <template #value>
42
- <sar-radio
43
- readonly
44
- :value="getMayPrimitiveOption(option, fieldKeys.value)"
45
- />
46
- </template>
47
- </sar-list-item>
48
- </sar-list>
49
- </template>
50
- </sar-radio-group>
51
- </scroll-view>
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 { createBem, getMayPrimitiveOption, isNullish } from "../../utils";
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 __returned__ = { props, emit, bem, formItemContext, fieldKeys, innerValue, popoutValue, onChange, onConfirm, inputValue, getOutletText, getInputValue, onClear, innerVisible, onVisible, onInputClick, SarPopoutInput, SarPopout, SarRadioGroup, SarRadio, SarList, SarListItem, get getMayPrimitiveOption() {
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>