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.
Files changed (194) hide show
  1. package/CHANGELOG.md +25 -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 +2 -0
  9. package/components/button/common.d.ts +2 -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 +671 -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
@@ -0,0 +1,81 @@
1
+ @use '../style/base' as *;
2
+
3
+ @include bem(crop-image) {
4
+ @include b() {
5
+ @include universal;
6
+ position: fixed;
7
+ top: 0;
8
+ left: 0;
9
+ width: 100%;
10
+ height: 100%;
11
+ background-color: #000;
12
+ touch-action: none;
13
+ }
14
+
15
+ @include e(sensor) {
16
+ position: absolute;
17
+ width: 100%;
18
+ height: 100%;
19
+ }
20
+
21
+ @include e(focus) {
22
+ position: absolute;
23
+ transition: transform 0.15s;
24
+ }
25
+
26
+ @include e(puppet) {
27
+ position: relative;
28
+ transform-origin: top left;
29
+ transition: transform 0.15s;
30
+ }
31
+
32
+ @include e(image) {
33
+ position: absolute;
34
+ width: 100%;
35
+ height: 100%;
36
+ left: 50%;
37
+ top: 50%;
38
+ }
39
+
40
+ @include e(mask) {
41
+ position: absolute;
42
+ z-index: 10;
43
+ box-shadow: 0 0 0 9999vh rgba(45, 45, 45, 0.8);
44
+ pointer-events: none;
45
+ }
46
+
47
+ @include e(toolbar) {
48
+ @include universal;
49
+ position: absolute;
50
+ left: 32rpx;
51
+ right: 32rpx;
52
+ bottom: calc(env(safe-area-inset-bottom) + 32rpx);
53
+ z-index: 20;
54
+ flex-direction: row;
55
+ justify-content: center;
56
+ align-items: center;
57
+ }
58
+
59
+ @include e(canvas-wrapper) {
60
+ position: fixed;
61
+ left: 200vw;
62
+ width: 9999px;
63
+ height: 9999px;
64
+ }
65
+
66
+ @include e(loading) {
67
+ position: absolute;
68
+ top: 0;
69
+ left: 0;
70
+ z-index: 30;
71
+ display: flex;
72
+ width: 100%;
73
+ height: 100%;
74
+ justify-content: center;
75
+ align-items: center;
76
+ font-size: 60rpx;
77
+ color: #fff;
78
+ background-color: var(--sar-mask-illegible);
79
+ touch-action: none;
80
+ }
81
+ }
@@ -0,0 +1,19 @@
1
+ import { CropImageProps } from '../crop-image/common';
2
+ export interface CropImageAgentProps extends CropImageProps {
3
+ id?: string;
4
+ }
5
+ export type CropImageOptions = Omit<CropImageAgentProps, 'src'> & Required<Pick<CropImageAgentProps, 'src'>>;
6
+ export declare const defaultCropImageAgentProps: () => {
7
+ id: string;
8
+ duration: number;
9
+ cropScale: string;
10
+ type: "png";
11
+ quality: number;
12
+ };
13
+ export declare const imperativeName = "cropImage";
14
+ export interface CropImageImperative {
15
+ show(newProps: Record<string, any>): void;
16
+ hide(): void;
17
+ }
18
+ declare const cropImage: (options: CropImageOptions) => void;
19
+ export { cropImage };
@@ -0,0 +1,16 @@
1
+ import { getAvailableImperative } from '../../use/useImperative';
2
+ import { defaultConfig } from '../config';
3
+ import { defaultCropImageProps } from '../crop-image/common';
4
+ export const defaultCropImageAgentProps = () => ({
5
+ ...defaultCropImageProps,
6
+ ...defaultConfig.cropImageAgent,
7
+ });
8
+ export const imperativeName = 'cropImage';
9
+ const cropImage = (options) => {
10
+ const { id = defaultConfig.cropImageAgent.id } = options;
11
+ const imperative = getAvailableImperative(imperativeName, id);
12
+ if (imperative) {
13
+ imperative.show(options);
14
+ }
15
+ };
16
+ export { cropImage };
@@ -0,0 +1,9 @@
1
+ import { type CropImageAgentProps } from './common';
2
+ declare const _default: import("vue").DefineComponent<CropImageAgentProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CropImageAgentProps> & Readonly<{}>, {
3
+ type: "png" | "jpg";
4
+ id: string;
5
+ duration: number;
6
+ cropScale: string;
7
+ quality: number;
8
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ export default _default;
@@ -0,0 +1,70 @@
1
+ <template>
2
+ <sar-crop-image v-bind="innerProps" v-model:visible="innerProps.visible" />
3
+ </template>
4
+
5
+ <script>
6
+ import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
7
+ import { computed, ref } from "vue";
8
+ import SarCropImage from "../crop-image/crop-image.vue";
9
+ import {
10
+ defaultCropImageAgentProps,
11
+ imperativeName
12
+ } from "./common";
13
+ import { useImperative } from "../../use/useImperative";
14
+ export default _defineComponent({
15
+ components: {
16
+ SarCropImage,
17
+ },
18
+ ...{
19
+ options: {
20
+ virtualHost: true,
21
+ styleIsolation: "shared"
22
+ }
23
+ },
24
+ __name: "crop-image-agent",
25
+ props: _mergeDefaults({
26
+ id: { type: String, required: false },
27
+ rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
28
+ rootClass: { type: String, required: false },
29
+ visible: { type: Boolean, required: false },
30
+ src: { type: String, required: false },
31
+ cropScale: { type: String, required: false },
32
+ type: { type: String, required: false },
33
+ quality: { type: Number, required: false },
34
+ duration: { type: Number, required: false },
35
+ success: { type: Function, required: false },
36
+ fail: { type: Function, required: false },
37
+ complete: { type: Function, required: false },
38
+ beforeCrop: { type: Function, required: false },
39
+ cancelText: { type: String, required: false },
40
+ confirmText: { type: String, required: false }
41
+ }, defaultCropImageAgentProps()),
42
+ setup(__props, { expose: __expose }) {
43
+ __expose();
44
+ const props = __props;
45
+ const innerProps = ref({ ...props });
46
+ const imperative = {
47
+ show(newProps) {
48
+ innerProps.value = {
49
+ ...props,
50
+ ...newProps,
51
+ visible: true
52
+ };
53
+ },
54
+ hide() {
55
+ innerProps.value = {
56
+ ...innerProps.value,
57
+ visible: false
58
+ };
59
+ }
60
+ };
61
+ useImperative(
62
+ imperativeName,
63
+ imperative,
64
+ computed(() => innerProps.value.id)
65
+ );
66
+ const __returned__ = { props, innerProps, imperative, SarCropImage };
67
+ return __returned__;
68
+ }
69
+ });
70
+ </script>
@@ -0,0 +1 @@
1
+ export { type CropImageAgentProps, type CropImageOptions, cropImage, } from './common';
@@ -0,0 +1 @@
1
+ export { cropImage, } from './common';
@@ -17,7 +17,7 @@
17
17
  @update:visible="onVisible"
18
18
  :title="title ?? placeholder"
19
19
  @confirm="onConfirm"
20
- @visible-hook="onVisibleHook"
20
+ @enter="onEnter"
21
21
  >
22
22
  <template #visible="{ already }">
23
23
  <sar-datetime-picker
@@ -105,8 +105,8 @@ export default _defineComponent({
105
105
  const onChange = (value) => {
106
106
  popoutValue.value = value;
107
107
  };
108
- const onVisibleHook = (name) => {
109
- if (name === "enter" && !isNullish(innerValue.value) && popoutValue.value !== innerValue.value) {
108
+ const onEnter = () => {
109
+ if (!isNullish(innerValue.value) && popoutValue.value !== innerValue.value) {
110
110
  popoutValue.value = innerValue.value;
111
111
  }
112
112
  };
@@ -190,7 +190,7 @@ export default _defineComponent({
190
190
  innerVisible.value = true;
191
191
  emit("update:visible", true);
192
192
  };
193
- const __returned__ = { props, emit, formItemContext, innerValue, popoutValue, onChange, onVisibleHook, minDate, maxDate, normalizeValue, onConfirm, inputValue, getOutletText, getInputValue, onClear, innerVisible, onVisible, onInputClick, SarPopoutInput, SarPopout, SarDatetimePicker };
193
+ const __returned__ = { props, emit, formItemContext, innerValue, popoutValue, onChange, onEnter, minDate, maxDate, normalizeValue, onConfirm, inputValue, getOutletText, getInputValue, onClear, innerVisible, onVisible, onInputClick, SarPopoutInput, SarPopout, SarDatetimePicker };
194
194
  return __returned__;
195
195
  }
196
196
  });
@@ -33,7 +33,7 @@
33
33
 
34
34
  <script>
35
35
  import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
36
- import { computed, watch } from "vue";
36
+ import { computed, watch, ref } from "vue";
37
37
  import {
38
38
  classNames,
39
39
  stringifyStyle,
@@ -42,10 +42,10 @@ import {
42
42
  toDate
43
43
  } from "../../utils";
44
44
  import SarDatetimePicker from "../datetime-picker/datetime-picker.vue";
45
+ import SarTabs from "../tabs/tabs.vue";
45
46
  import {
46
47
  defaultDatetimeRangePickerProps
47
48
  } from "./common";
48
- import { ref } from "vue";
49
49
  import {
50
50
  getInitialValue,
51
51
  getMaxDate,
@@ -54,6 +54,7 @@ import {
54
54
  export default _defineComponent({
55
55
  components: {
56
56
  SarDatetimePicker,
57
+ SarTabs,
57
58
  },
58
59
  ...{
59
60
  options: {
@@ -132,7 +133,7 @@ export default _defineComponent({
132
133
  });
133
134
  const __returned__ = { props, emit, bem, datetimePickerProps, tabsList, tabsCurrent, minDate, maxDate, startValue, endValue, parseValue, onChange, datetimeRangePickerClass, datetimeRangePickerStyle, get stringifyStyle() {
134
135
  return stringifyStyle;
135
- }, SarDatetimePicker };
136
+ }, SarDatetimePicker, SarTabs };
136
137
  return __returned__;
137
138
  }
138
139
  });
@@ -17,7 +17,7 @@
17
17
  @update:visible="onVisible"
18
18
  :title="title ?? placeholder"
19
19
  @confirm="onConfirm"
20
- @visible-hook="onVisibleHook"
20
+ @enter="onEnter"
21
21
  >
22
22
  <template #visible="{ already }">
23
23
  <sar-datetime-range-picker
@@ -108,8 +108,8 @@ export default _defineComponent({
108
108
  const onChange = (value) => {
109
109
  popoutValue.value = value;
110
110
  };
111
- const onVisibleHook = (name) => {
112
- if (name === "enter" && !isNullish(innerValue.value) && popoutValue.value !== innerValue.value) {
111
+ const onEnter = () => {
112
+ if (!isNullish(innerValue.value) && popoutValue.value !== innerValue.value) {
113
113
  popoutValue.value = innerValue.value;
114
114
  }
115
115
  };
@@ -187,7 +187,7 @@ export default _defineComponent({
187
187
  innerVisible.value = true;
188
188
  emit("update:visible", true);
189
189
  };
190
- const __returned__ = { props, emit, formItemContext, innerValue, popoutValue, onChange, onVisibleHook, minDate, maxDate, onConfirm, inputValue, t, getOutletTextMayByStr, getOutletText, getInputValue, onClear, innerVisible, onVisible, onInputClick, SarPopoutInput, SarPopout, SarDatetimeRangePicker };
190
+ const __returned__ = { props, emit, formItemContext, innerValue, popoutValue, onChange, onEnter, minDate, maxDate, onConfirm, inputValue, t, getOutletTextMayByStr, getOutletText, getInputValue, onClear, innerVisible, onVisible, onInputClick, SarPopoutInput, SarPopout, SarDatetimeRangePicker };
191
191
  return __returned__;
192
192
  }
193
193
  });
@@ -1,6 +1,6 @@
1
1
  import { type StyleValue } from 'vue';
2
- import { type TransitionHookName } from '../../use';
3
2
  import { type ButtonProps } from '../button';
3
+ import { type TransitionHookEmits } from '../popup/common';
4
4
  export interface DialogProps {
5
5
  rootStyle?: StyleValue;
6
6
  rootClass?: string;
@@ -31,10 +31,9 @@ export declare const defaultDialogProps: {
31
31
  export interface DialogSlots {
32
32
  default?(props: Record<string, never>): any;
33
33
  }
34
- export interface DialogEmits {
34
+ export interface DialogEmits extends TransitionHookEmits {
35
35
  (e: 'update:visible', visible: boolean): void;
36
36
  (e: 'close'): void;
37
37
  (e: 'cancel'): void;
38
38
  (e: 'confirm'): void;
39
- (e: 'visible-hook', name: TransitionHookName): void;
40
39
  }
@@ -1,25 +1,18 @@
1
1
  import { type DialogProps, type DialogSlots } from './common';
2
- import { type TransitionHookName } from '../../use';
3
2
  declare function __VLS_template(): Readonly<DialogSlots> & DialogSlots;
4
- declare const __VLS_component: import("vue").DefineComponent<DialogProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
5
- cancel: () => any;
6
- close: () => any;
7
- confirm: () => any;
8
- "update:visible": (visible: boolean) => any;
9
- "visible-hook": (name: TransitionHookName) => any;
3
+ declare const __VLS_component: import("vue").DefineComponent<DialogProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
4
+ [x: string]: any;
5
+ } & {
6
+ [x: string]: any;
10
7
  }, string, import("vue").PublicProps, Readonly<DialogProps> & Readonly<{
11
- onCancel?: (() => any) | undefined;
12
- onClose?: (() => any) | undefined;
13
- onConfirm?: (() => any) | undefined;
14
- "onUpdate:visible"?: ((visible: boolean) => any) | undefined;
15
- "onVisible-hook"?: ((name: TransitionHookName) => any) | undefined;
8
+ [x: `on${Capitalize<any>}`]: ((...args: any) => any) | undefined;
16
9
  }>, {
17
10
  buttonType: "round" | "text";
18
11
  duration: number;
19
12
  overlayClosable: boolean;
13
+ showCancel: boolean;
20
14
  showConfirm: boolean;
21
15
  headed: boolean;
22
- showCancel: boolean;
23
16
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
17
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
25
18
  export default _default;
@@ -17,6 +17,7 @@
17
17
  type="pale-text"
18
18
  theme="neutral"
19
19
  size="large"
20
+ block
20
21
  @click="onClose"
21
22
  >
22
23
  <sar-icon name="close" />
@@ -43,6 +44,7 @@
43
44
  :theme="buttonProps.cancel.theme"
44
45
  :size="buttonProps.cancel.size"
45
46
  :round="buttonProps.confirm.round"
47
+ block
46
48
  v-bind="cancelProps"
47
49
  @click="onCancel"
48
50
  >
@@ -60,6 +62,7 @@
60
62
  :theme="buttonProps.confirm.theme"
61
63
  :size="buttonProps.confirm.size"
62
64
  :round="buttonProps.confirm.round"
65
+ block
63
66
  v-bind="confirmProps"
64
67
  @click="onConfirm"
65
68
  >
@@ -73,7 +76,14 @@
73
76
  <script>
74
77
  import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
75
78
  import { computed, ref, watch } from "vue";
76
- import { classNames, stringifyStyle, createBem, noop } from "../../utils";
79
+ import {
80
+ classNames,
81
+ stringifyStyle,
82
+ createBem,
83
+ noop,
84
+ isObject,
85
+ isFunction
86
+ } from "../../utils";
77
87
  import { useTranslate } from "../locale";
78
88
  import SarPopup from "../popup/popup.vue";
79
89
  import SarButton from "../button/button.vue";
@@ -113,7 +123,7 @@ export default _defineComponent({
113
123
  confirmProps: { type: Object, required: false },
114
124
  id: { type: String, required: false }
115
125
  }, defaultDialogProps),
116
- emits: ["update:visible", "close", "cancel", "confirm", "visible-hook"],
126
+ emits: ["update:visible", "close", "cancel", "confirm", "before-enter", "enter", "after-enter", "enter-cancelled", "before-leave", "leave", "after-leave", "leave-cancelled", "visible-hook"],
117
127
  setup(__props, { expose: __expose, emit: __emit }) {
118
128
  __expose();
119
129
  const props = __props;
@@ -134,9 +144,9 @@ export default _defineComponent({
134
144
  });
135
145
  const perhapsClose = (type) => {
136
146
  emit(type);
137
- if (typeof props.beforeClose === "function") {
147
+ if (isFunction(props.beforeClose)) {
138
148
  const result = props.beforeClose(type);
139
- if (result instanceof Promise) {
149
+ if (isObject(result) && isFunction(result.then)) {
140
150
  loading.value[type] = true;
141
151
  return result.then(() => {
142
152
  innerVisible.value = false;
@@ -195,6 +205,7 @@ export default _defineComponent({
195
205
  });
196
206
  const onVisibleHook = (name) => {
197
207
  emit("visible-hook", name);
208
+ emit(name);
198
209
  };
199
210
  const dialogClass = computed(() => {
200
211
  return classNames(
@@ -4,8 +4,8 @@ declare const _default: import("vue").DefineComponent<DialogAgentProps, {}, {},
4
4
  buttonType: "round" | "text";
5
5
  duration: number;
6
6
  overlayClosable: boolean;
7
+ showCancel: boolean;
7
8
  showConfirm: boolean;
8
9
  headed: boolean;
9
- showCancel: boolean;
10
10
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
11
  export default _default;
@@ -2,7 +2,6 @@
2
2
  <view
3
3
  :class="dropdownItemClass"
4
4
  :style="dropdownItemStyle"
5
- :id="itemId"
6
5
  @click="onItemClick"
7
6
  >
8
7
  <view v-if="label" :class="bem.e('label')">
@@ -173,8 +172,8 @@ export default _defineComponent({
173
172
  const popupInset = ref("");
174
173
  const awayInset = ref("");
175
174
  const setPosition = async () => {
176
- const windowInfo = await getWindowInfo();
177
- const itemRect = await getBoundingClientRect(`#${itemId}`, instance);
175
+ const { windowHeight } = getWindowInfo();
176
+ const itemRect = await getBoundingClientRect(`.${itemId}`, instance);
178
177
  const nextPopupInset = {
179
178
  left: 0,
180
179
  right: 0,
@@ -191,10 +190,10 @@ export default _defineComponent({
191
190
  nextPopupInset.top = `calc(${itemRect.bottom}px + var(--window-top))`;
192
191
  nextPopupInset.bottom = 0;
193
192
  nextAwayInset.top = 0;
194
- nextAwayInset.bottom = `calc(${windowInfo.windowHeight - itemRect.bottom}px + var(--window-top))`;
193
+ nextAwayInset.bottom = `calc(${windowHeight - itemRect.bottom}px + var(--window-top))`;
195
194
  } else {
196
195
  nextPopupInset.top = 0;
197
- nextPopupInset.bottom = `${windowInfo.windowHeight - itemRect.top}px`;
196
+ nextPopupInset.bottom = `${windowHeight - itemRect.top}px`;
198
197
  nextAwayInset.top = `calc(${itemRect.bottom}px + var(--window-top))`;
199
198
  nextAwayInset.bottom = 0;
200
199
  }
@@ -259,7 +258,8 @@ export default _defineComponent({
259
258
  bem.m(context.direction),
260
259
  bem.m("show", wholeVisible.value),
261
260
  bem.m("disabled", context.disabled || props.disabled),
262
- props.rootClass
261
+ props.rootClass,
262
+ itemId
263
263
  );
264
264
  });
265
265
  const dropdownItemStyle = computed(() => {
@@ -8,7 +8,7 @@ declare const _default: import("vue").DefineComponent<FabProps, {}, {}, {}, {},
8
8
  }>, {
9
9
  duration: number;
10
10
  overlayClosable: boolean;
11
- hideName: boolean;
12
11
  itemList: FabItem[];
12
+ hideName: boolean;
13
13
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
14
  export default _default;
@@ -1,6 +1,5 @@
1
1
  <template>
2
2
  <view
3
- :id="bubbleId"
4
3
  :class="floatingBubbleClass"
5
4
  :style="floatingBubbleStyle"
6
5
  @touchstart="onTouchStart"
@@ -56,7 +55,7 @@ export default _defineComponent({
56
55
  const instance = getCurrentInstance();
57
56
  const bubbleId = uniqid();
58
57
  let bubbleRect;
59
- let windowInfo;
58
+ const { windowWidth, windowHeight } = getWindowInfo();
60
59
  let downCoord = {
61
60
  x: 0,
62
61
  y: 0
@@ -82,17 +81,16 @@ export default _defineComponent({
82
81
  return props.gapX;
83
82
  }
84
83
  function getMaxX() {
85
- return windowInfo.windowWidth - props.gapX - bubbleRect.width;
84
+ return windowWidth - props.gapX - bubbleRect.width;
86
85
  }
87
86
  function getMinY() {
88
- return props.gapY + windowInfo.windowTop;
87
+ return props.gapY + 44 + 25;
89
88
  }
90
89
  function getMaxY() {
91
- return windowInfo.windowHeight - props.gapY - bubbleRect.height + windowInfo.windowTop;
90
+ return windowHeight - props.gapY - bubbleRect.height;
92
91
  }
93
92
  onMounted(async () => {
94
- windowInfo = await getWindowInfo();
95
- bubbleRect = await getBoundingClientRect(`#${bubbleId}`, instance);
93
+ bubbleRect = await getBoundingClientRect(`.${bubbleId}`, instance);
96
94
  position.value = props.offset ?? {
97
95
  x: getMaxX(),
98
96
  y: getMaxY()
@@ -107,10 +105,10 @@ export default _defineComponent({
107
105
  x: event.touches[0].clientX,
108
106
  y: event.touches[0].clientY
109
107
  };
110
- bubbleRect = await getBoundingClientRect(`#${bubbleId}`, instance);
108
+ bubbleRect = await getBoundingClientRect(`.${bubbleId}`, instance);
111
109
  };
112
110
  const onTouchMove = (event) => {
113
- if (!bubbleRect || !windowInfo) {
111
+ if (!bubbleRect) {
114
112
  return;
115
113
  }
116
114
  let x = 0;
@@ -122,7 +120,7 @@ export default _defineComponent({
122
120
  const deltaX = event.touches[0].clientX - downCoord.x;
123
121
  const deltaY = event.touches[0].clientY - downCoord.y;
124
122
  x = bubbleRect.left + deltaX;
125
- y = bubbleRect.top + deltaY + windowInfo.windowTop;
123
+ y = bubbleRect.top + deltaY;
126
124
  x = minmax(x, getMinX(), getMaxX());
127
125
  y = minmax(y, getMinY(), getMaxY());
128
126
  if (props.axis === "y") {
@@ -139,13 +137,13 @@ export default _defineComponent({
139
137
  emit("update:offset", offset);
140
138
  };
141
139
  const onTouchEnd = () => {
142
- if (windowInfo && bubbleRect) {
140
+ if (bubbleRect) {
143
141
  if (props.magnet) {
144
142
  let { x, y } = position.value;
145
143
  if (props.magnet === "x") {
146
- x = x < (windowInfo.windowWidth - bubbleRect.width) / 2 ? getMinX() : getMaxX();
144
+ x = x < (windowWidth - bubbleRect.width) / 2 ? getMinX() : getMaxX();
147
145
  } else if (props.magnet === "y") {
148
- y = y < (windowInfo.windowHeight - bubbleRect.height) / 2 ? getMinY() : getMaxY();
146
+ y = y < (windowHeight - bubbleRect.height) / 2 ? getMinY() : getMaxY();
149
147
  }
150
148
  const offset = {
151
149
  x,
@@ -168,7 +166,8 @@ export default _defineComponent({
168
166
  bem.b(),
169
167
  bem.m("animated", animated.value),
170
168
  bem.m("initialized", initialized.value),
171
- props.rootClass
169
+ props.rootClass,
170
+ bubbleId
172
171
  );
173
172
  });
174
173
  const floatingBubbleStyle = computed(() => {
@@ -180,11 +179,7 @@ export default _defineComponent({
180
179
  return bubbleRect;
181
180
  }, set bubbleRect(v) {
182
181
  bubbleRect = v;
183
- }, get windowInfo() {
184
- return windowInfo;
185
- }, set windowInfo(v) {
186
- windowInfo = v;
187
- }, get downCoord() {
182
+ }, windowWidth, windowHeight, get downCoord() {
188
183
  return downCoord;
189
184
  }, set downCoord(v) {
190
185
  downCoord = v;
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view :class="formItemClass" :style="formItemStyle" :id="fieldId">
2
+ <view :class="formItemClass" :style="formItemStyle">
3
3
  <view
4
4
  v-if="$slots.label || !isNullish(label)"
5
5
  :class="bem.e('label')"
@@ -213,7 +213,7 @@ export default _defineComponent({
213
213
  const scrollToField = async () => {
214
214
  const [scrollInfo, fieldRect, windowInfo] = await Promise.all([
215
215
  getViewportScrollInfo(),
216
- getBoundingClientRect(`#${fieldId}`, instance),
216
+ getBoundingClientRect(`.${fieldId}`, instance),
217
217
  getWindowInfo()
218
218
  ]);
219
219
  const scrollTop = getScrollIntoViewValue(
@@ -272,7 +272,8 @@ export default _defineComponent({
272
272
  bem.m(`align-${props.labelAlign || formContext.labelAlign}`),
273
273
  bem.m(`valign-${props.labelValign || formContext.labelValign}`),
274
274
  bem.m(`star-${props.starPosition || formContext.starPosition}`),
275
- props.rootClass
275
+ props.rootClass,
276
+ fieldId
276
277
  );
277
278
  });
278
279
  const formItemStyle = computed(() => {
@@ -1,4 +1,5 @@
1
1
  import { type StyleValue } from 'vue';
2
+ import { type BadgeProps } from '../badge';
2
3
  export interface GridProps {
3
4
  rootStyle?: StyleValue;
4
5
  rootClass?: string;
@@ -27,6 +28,9 @@ export interface GridItemProps {
27
28
  iconSize?: string;
28
29
  iconColor?: string;
29
30
  iconFamily?: string;
31
+ dot?: boolean;
32
+ badge?: number | string;
33
+ badgeProps?: BadgeProps;
30
34
  }
31
35
  export interface GridItemSlots {
32
36
  default?(props: Record<string, never>): any;