sard-uniapp 1.19.5 → 1.20.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 (177) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +1 -1
  3. package/components/calendar/README.md +20 -20
  4. package/components/calendar/calendar.vue +1 -1
  5. package/components/calendar-input/README.md +10 -10
  6. package/components/calendar-input/calendar-input.vue +2 -2
  7. package/components/calendar-month/calendar-month.vue +17 -21
  8. package/components/calendar-popout/calendar-popout.vue +1 -1
  9. package/components/card/README.md +16 -8
  10. package/components/card/card.vue +7 -1
  11. package/components/card/common.d.ts +2 -0
  12. package/components/card/index.scss +30 -2
  13. package/components/card/variables.scss +16 -1
  14. package/components/checkbox/common.d.ts +1 -0
  15. package/components/checkbox/common.js +1 -0
  16. package/components/checkbox-input/checkbox-input.vue +9 -0
  17. package/components/checkbox-popout/README.md +27 -6
  18. package/components/checkbox-popout/checkbox-popout.vue +113 -47
  19. package/components/checkbox-popout/common.d.ts +3 -0
  20. package/components/checkbox-popout/index.scss +16 -0
  21. package/components/config/index.d.ts +6 -0
  22. package/components/config/index.js +6 -0
  23. package/components/datetime-picker/README.md +1 -71
  24. package/components/datetime-picker/common.d.ts +1 -0
  25. package/components/datetime-picker/common.js +21 -8
  26. package/components/datetime-picker/datetime-picker.vue +3 -3
  27. package/components/datetime-picker-input/README.md +10 -10
  28. package/components/datetime-picker-input/datetime-picker-input.vue +2 -2
  29. package/components/datetime-picker-popout/datetime-picker-popout.vue +1 -1
  30. package/components/datetime-range-picker/datetime-range-picker.vue +12 -10
  31. package/components/datetime-range-picker-input/README.md +10 -10
  32. package/components/datetime-range-picker-input/datetime-range-picker-input.vue +2 -2
  33. package/components/datetime-range-picker-popout/README.md +0 -6
  34. package/components/datetime-range-picker-popout/datetime-range-picker-popout.vue +11 -8
  35. package/components/floating-bubble/floating-bubble.vue +3 -3
  36. package/components/form/README.md +19 -19
  37. package/components/form/form.vue +1 -1
  38. package/components/icon/icon.d.ts +1 -1
  39. package/components/indexes/README.md +4 -0
  40. package/components/indexes-nav/indexes-nav.vue +2 -2
  41. package/components/keyboard/common.d.ts +1 -2
  42. package/components/keyboard/common.js +2 -11
  43. package/components/keyboard/keyboard.d.ts +2 -2
  44. package/components/list-item/index.scss +4 -0
  45. package/components/locale/lang/en-US.d.ts +4 -0
  46. package/components/locale/lang/en-US.js +4 -0
  47. package/components/locale/lang/zh-CN.d.ts +4 -0
  48. package/components/locale/lang/zh-CN.js +4 -0
  49. package/components/marquee/README.md +8 -2
  50. package/components/marquee/marquee.vue +9 -1
  51. package/components/notice-bar/README.md +8 -2
  52. package/components/notice-bar/notice-bar.vue +14 -8
  53. package/components/notify/notify.d.ts +1 -1
  54. package/components/notify-agent/notify-agent.d.ts +1 -1
  55. package/components/pagination/pagination.vue +2 -2
  56. package/components/popover/utils.js +4 -4
  57. package/components/pull-down-refresh/common.d.ts +1 -1
  58. package/components/radio/common.d.ts +1 -0
  59. package/components/radio/common.js +1 -0
  60. package/components/radio-input/radio-input.vue +6 -0
  61. package/components/radio-popout/README.md +20 -6
  62. package/components/radio-popout/common.d.ts +2 -0
  63. package/components/radio-popout/index.scss +4 -0
  64. package/components/radio-popout/radio-popout.vue +91 -45
  65. package/components/read-more/README.md +82 -0
  66. package/components/read-more/common.d.ts +24 -0
  67. package/components/read-more/common.js +2 -0
  68. package/components/read-more/index.d.ts +1 -0
  69. package/components/read-more/index.js +1 -0
  70. package/components/read-more/index.scss +41 -0
  71. package/components/read-more/read-more.d.ts +20 -0
  72. package/components/read-more/read-more.vue +168 -0
  73. package/components/read-more/variables.scss +12 -0
  74. package/components/resize-sensor/README.md +55 -0
  75. package/components/resize-sensor/common.d.ts +19 -0
  76. package/components/resize-sensor/common.js +2 -0
  77. package/components/resize-sensor/index.d.ts +1 -0
  78. package/components/resize-sensor/index.js +1 -0
  79. package/components/resize-sensor/index.scss +33 -0
  80. package/components/resize-sensor/resize-sensor.d.ts +16 -0
  81. package/components/resize-sensor/resize-sensor.vue +152 -0
  82. package/components/scroll-list/README.md +79 -0
  83. package/components/scroll-list/common.d.ts +23 -0
  84. package/components/scroll-list/common.js +1 -0
  85. package/components/scroll-list/index.d.ts +1 -0
  86. package/components/scroll-list/index.js +1 -0
  87. package/components/scroll-list/index.scss +35 -0
  88. package/components/scroll-list/scroll-list.d.ts +20 -0
  89. package/components/scroll-list/scroll-list.vue +158 -0
  90. package/components/scroll-list/variables.scss +11 -0
  91. package/components/sidebar/README.md +8 -8
  92. package/components/sidebar/sidebar.vue +1 -1
  93. package/components/slider/slider.vue +4 -4
  94. package/components/stepper/stepper.vue +2 -2
  95. package/components/sticky/README.md +92 -0
  96. package/components/sticky/common.d.ts +15 -0
  97. package/components/sticky/common.js +1 -0
  98. package/components/sticky/index.d.ts +1 -0
  99. package/components/sticky/index.js +1 -0
  100. package/components/sticky/index.scss +18 -0
  101. package/components/sticky/sticky.d.ts +10 -0
  102. package/components/sticky/sticky.vue +190 -0
  103. package/components/sticky-box/common.d.ts +19 -0
  104. package/components/sticky-box/common.js +1 -0
  105. package/components/sticky-box/index.d.ts +1 -0
  106. package/components/sticky-box/index.js +1 -0
  107. package/components/sticky-box/index.scss +19 -0
  108. package/components/sticky-box/sticky-box.d.ts +10 -0
  109. package/components/sticky-box/sticky-box.vue +82 -0
  110. package/components/style/mixins/border.scss +101 -38
  111. package/components/style/variables-dark.scss +4 -0
  112. package/components/style/variables.scss +8 -0
  113. package/components/table/table.vue +2 -1
  114. package/components/table-fixation/table-fixation.vue +2 -1
  115. package/components/toast/toast.d.ts +1 -1
  116. package/components/toast-agent/toast-agent.d.ts +1 -1
  117. package/components/tree/tree.d.ts +1 -1
  118. package/components/tree-node/tree-node.vue +2 -2
  119. package/components/upload/README.md +23 -15
  120. package/components/upload/common.d.ts +7 -4
  121. package/components/upload/upload.d.ts +2 -0
  122. package/components/upload/upload.vue +52 -14
  123. package/components/upload/utils.d.ts +1 -0
  124. package/components/upload/utils.js +2 -0
  125. package/components/upload-preview/index.scss +3 -2
  126. package/components/upload-preview/upload-preview.d.ts +6 -4
  127. package/components/upload-preview/upload-preview.vue +17 -24
  128. package/global.d.ts +5 -0
  129. package/index.d.ts +5 -0
  130. package/index.js +5 -0
  131. package/index.scss +2 -0
  132. package/package.json +5 -3
  133. package/use/index.d.ts +4 -0
  134. package/use/index.js +4 -0
  135. package/use/useIndeterminate.d.ts +10 -0
  136. package/use/useIndeterminate.js +27 -0
  137. package/use/useIntersectionObserver.d.ts +16 -0
  138. package/use/useIntersectionObserver.js +52 -0
  139. package/use/useSimulatedClick.js +2 -2
  140. package/use/useSimulatedPress.js +2 -2
  141. package/use/useSingleTask.d.ts +6 -0
  142. package/use/useSingleTask.js +40 -0
  143. package/use/useWindowResize.d.ts +4 -0
  144. package/use/useWindowResize.js +15 -0
  145. package/utils/array.d.ts +28 -0
  146. package/utils/array.js +90 -0
  147. package/utils/common.d.ts +3 -0
  148. package/utils/common.js +1 -0
  149. package/utils/date.d.ts +84 -11
  150. package/utils/date.js +120 -63
  151. package/utils/dom.js +2 -0
  152. package/utils/geometry.d.ts +56 -38
  153. package/utils/geometry.js +56 -30
  154. package/utils/index.d.ts +8 -1
  155. package/utils/index.js +8 -1
  156. package/utils/is.d.ts +12 -0
  157. package/utils/is.js +16 -0
  158. package/utils/number.d.ts +24 -0
  159. package/utils/number.js +37 -0
  160. package/utils/object.d.ts +29 -0
  161. package/utils/object.js +139 -0
  162. package/utils/persist.d.ts +15 -0
  163. package/utils/persist.js +89 -0
  164. package/utils/physics.d.ts +34 -0
  165. package/utils/physics.js +66 -0
  166. package/utils/request.d.ts +227 -0
  167. package/utils/request.js +249 -0
  168. package/utils/router.d.ts +47 -0
  169. package/utils/router.js +115 -0
  170. package/utils/string.d.ts +46 -0
  171. package/utils/string.js +134 -0
  172. package/utils/url-query.d.ts +19 -0
  173. package/utils/url-query.js +95 -0
  174. package/utils/utils.d.ts +0 -166
  175. package/utils/utils.js +0 -441
  176. package/utils/case.d.ts +0 -4
  177. package/utils/case.js +0 -26
@@ -33,11 +33,11 @@ import SarDatetimeRangePicker from "../datetime-range-picker/datetime-range-pick
33
33
  import {
34
34
  defaultDatetimeRangePickerInputProps
35
35
  } from "./common";
36
- import { formatDate, isEmptyBinding, toDate } from "../../utils";
36
+ import { isEmptyBinding, toDate } from "../../utils";
37
37
  import {
38
- getInitialValue,
39
38
  getMaxDate,
40
- getMinDate
39
+ getMinDate,
40
+ normalizeRangeValue
41
41
  } from "../datetime-picker/common";
42
42
  import { useFormPopout } from "../../use";
43
43
  /**
@@ -50,7 +50,7 @@ import { useFormPopout } from "../../use";
50
50
  * @property {(Date | string)[]} modelValue 绑定的值,默认值:-。
51
51
  * @property {(letter: DatetimeLetter, value: number, date: Date, index: number) => boolean} filter 选项的过滤函数,默认值:-。
52
52
  * @property {(letter: DatetimeLetter, option: DatetimeColumnOption, date: Date, index: number) => string | void |undefined} formatter 选项的格式化函数,默认值:-。
53
- * @property {string [详见特殊符号](../guide/date#日期格式特殊符号)} valueFormat 绑定值的格式,不指定则绑定值为 Date 对象,默认值:-。
53
+ * @property {string [详见特殊符号](../utilities/date#日期格式特殊符号)} valueFormat 绑定值的格式,不指定则绑定值为 Date 对象,默认值:-。
54
54
  * @property {string[]} tabs 设置起始和结束标签页标题,默认值:-。
55
55
  * @property {string} popoutClass 弹窗框根元素类名,默认值:-。
56
56
  * @property {StyleValue} popoutStyle 弹窗框根元素样式,默认值:-。
@@ -104,10 +104,13 @@ export default _defineComponent({
104
104
  });
105
105
  const { innerVisible, innerValue, popoutValue, onChange, onConfirm } = useFormPopout(props, emit, {
106
106
  onConfirmBefore() {
107
- if (!popoutValue.value) {
108
- const initialValue = getInitialValue(minDate.value, maxDate.value);
109
- const singleValue = props.valueFormat ? formatDate(initialValue, props.valueFormat) : initialValue;
110
- popoutValue.value = [singleValue, singleValue];
107
+ if (!popoutValue.value || Array.isArray(popoutValue.value) && popoutValue.value.filter(Boolean).length < 2) {
108
+ popoutValue.value = normalizeRangeValue(
109
+ minDate.value,
110
+ maxDate.value,
111
+ popoutValue.value,
112
+ props.valueFormat
113
+ );
111
114
  }
112
115
  }
113
116
  });
@@ -23,7 +23,7 @@ import {
23
23
  getBoundingClientRect,
24
24
  uniqid,
25
25
  getWindowInfo,
26
- minmax
26
+ clamp
27
27
  } from "../../utils";
28
28
  import {
29
29
  defaultFloatingBubbleProps
@@ -132,8 +132,8 @@ export default _defineComponent({
132
132
  const deltaY = event.touches[0].clientY - downCoord.y;
133
133
  x = bubbleRect.left + deltaX;
134
134
  y = bubbleRect.top + deltaY;
135
- x = minmax(x, getMinX(), getMaxX());
136
- y = minmax(y, getMinY(), getMaxY());
135
+ x = clamp(x, getMinX(), getMaxX());
136
+ y = clamp(y, getMinY(), getMaxY());
137
137
  if (props.axis === "y") {
138
138
  x = getMaxX();
139
139
  } else if (props.axis === "x") {
@@ -160,25 +160,25 @@ import FormItem from 'sard-uniapp/components/form-item/form-item.vue'
160
160
 
161
161
  ### FormProps
162
162
 
163
- | 属性 | 描述 | 类型 | 默认值 |
164
- | ------------------------ | ---------------------------------------------------------------------------------- | ---------------------------------------------------------- | --------------------------------------------------- |
165
- | root-class | 组件根元素类名 | string | - |
166
- | root-style | 组件根元素样式 | StyleValue | - |
167
- | model | 表单数据对象 | Record\<string, any> | - |
168
- | rules | 表单验证规则 | FormRules | - |
169
- | validate-trigger | 设置字段校验的时机 | TriggerType | change |
170
- | validate-on-rule-change | 是否在 `rules` 属性改变后立即触发一次验证 | boolean | true |
171
- | direction | 表单排列方向 | 'horizontal' \| 'vertical' | 'horizontal' |
172
- | label-width | 标签宽度 | string | - |
173
- | label-align | 标签水平对齐方式 | 'start' \| 'center' \| 'end' | 'start' |
174
- | label-valign | 标签垂直对齐方式 | 'start' \| 'center' \| 'end' | 'start' |
175
- | star-position | 必填星号在标签的左边或右边 | 'left' \| 'right' | 'left' |
176
- | hide-star | 是否隐藏必填时的星号 | boolean | false |
177
- | show-error | 是否显示校验错误信息 | boolean | true |
178
- | scroll-to-first-error | 当校验失败时,滚动到第一个错误表单项 | boolean | false |
179
- | scroll-into-view-options | 自定义滚动配置选项 | [ScrollIntoViewOptions](../guide/scroll-into-view-options) | {position: 'nearest', startOffset: 0, endOffset: 0} |
180
- | disabled | 是否禁用该表单内的所有组件。 如果设置为 `true`, 它将覆盖内部组件的 `disabled` 属性 | boolean | false |
181
- | readonly | 是否只读该表单内的所有组件。 如果设置为 `true`, 它将覆盖内部组件的 `readonly` 属性 | boolean | false |
163
+ | 属性 | 描述 | 类型 | 默认值 |
164
+ | ------------------------ | ---------------------------------------------------------------------------------- | -------------------------------------------------------------------- | --------------------------------------------------- |
165
+ | root-class | 组件根元素类名 | string | - |
166
+ | root-style | 组件根元素样式 | StyleValue | - |
167
+ | model | 表单数据对象 | Record\<string, any> | - |
168
+ | rules | 表单验证规则 | FormRules | - |
169
+ | validate-trigger | 设置字段校验的时机 | TriggerType | change |
170
+ | validate-on-rule-change | 是否在 `rules` 属性改变后立即触发一次验证 | boolean | true |
171
+ | direction | 表单排列方向 | 'horizontal' \| 'vertical' | 'horizontal' |
172
+ | label-width | 标签宽度 | string | - |
173
+ | label-align | 标签水平对齐方式 | 'start' \| 'center' \| 'end' | 'start' |
174
+ | label-valign | 标签垂直对齐方式 | 'start' \| 'center' \| 'end' | 'start' |
175
+ | star-position | 必填星号在标签的左边或右边 | 'left' \| 'right' | 'left' |
176
+ | hide-star | 是否隐藏必填时的星号 | boolean | false |
177
+ | show-error | 是否显示校验错误信息 | boolean | true |
178
+ | scroll-to-first-error | 当校验失败时,滚动到第一个错误表单项 | boolean | false |
179
+ | scroll-into-view-options | 自定义滚动配置选项 | [ScrollIntoViewOptions](../utilities/geometry#ScrollIntoViewOptions) | {position: 'nearest', startOffset: 0, endOffset: 0} |
180
+ | disabled | 是否禁用该表单内的所有组件。 如果设置为 `true`, 它将覆盖内部组件的 `disabled` 属性 | boolean | false |
181
+ | readonly | 是否只读该表单内的所有组件。 如果设置为 `true`, 它将覆盖内部组件的 `readonly` 属性 | boolean | false |
182
182
 
183
183
  ### FormSlots
184
184
 
@@ -36,7 +36,7 @@ import { useTranslate } from "../locale";
36
36
  * @property {boolean} hideStar 是否隐藏必填时的星号,默认值:false。
37
37
  * @property {boolean} showError 是否显示校验错误信息,默认值:true。
38
38
  * @property {boolean} scrollToFirstError 当校验失败时,滚动到第一个错误表单项,默认值:false。
39
- * @property {[ScrollIntoViewOptions](../guide/scroll-into-view-options)} scrollIntoViewOptions 自定义滚动配置选项,默认值:{position: 'nearest', startOffset: 0, endOffset: 0}。
39
+ * @property {[ScrollIntoViewOptions](../utilities/geometry#ScrollIntoViewOptions)} scrollIntoViewOptions 自定义滚动配置选项,默认值:{position: 'nearest', startOffset: 0, endOffset: 0}。
40
40
  * @property {boolean} disabled 是否禁用该表单内的所有组件。 如果设置为 `true`, 它将覆盖内部组件的 `disabled` 属性,默认值:false。
41
41
  * @property {boolean} readonly 是否只读该表单内的所有组件。 如果设置为 `true`, 它将覆盖内部组件的 `readonly` 属性,默认值:false。
42
42
  */
@@ -1,7 +1,7 @@
1
1
  import { type IconProps } from './common';
2
2
  declare const _default: import("vue").DefineComponent<IconProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<IconProps> & Readonly<{}>, {
3
- separate: boolean;
4
3
  name: string;
4
+ separate: boolean;
5
5
  family: string;
6
6
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
7
  export default _default;
@@ -32,6 +32,10 @@ import IndexesAnchor from 'sard-uniapp/components/indexes-anchor/indexes-anchor.
32
32
 
33
33
  @code('${DEMO_PATH}/indexes/demo/AreaCodeSearch.vue')
34
34
 
35
+ ### 全屏
36
+
37
+ @code('${DEMO_PATH}/indexes/demo/FullPage.vue')
38
+
35
39
  ## API
36
40
 
37
41
  ### IndexesProps
@@ -46,7 +46,7 @@ import {
46
46
  createBem,
47
47
  uniqid,
48
48
  getBoundingClientRect,
49
- minmax
49
+ clamp
50
50
  } from "../../utils";
51
51
  import { useMouseDown, useTransition } from "../../use";
52
52
  import { defaultConfig } from "../config";
@@ -106,7 +106,7 @@ export default _defineComponent({
106
106
  return;
107
107
  }
108
108
  const offsetY = touch.clientY - navRect.value.top;
109
- const itemIndex = minmax(
109
+ const itemIndex = clamp(
110
110
  Math.floor(offsetY / itemSize),
111
111
  0,
112
112
  props.anchors.length - 1
@@ -23,5 +23,4 @@ export declare const digitKeys: string[];
23
23
  export declare const idcardKeys: string[];
24
24
  export declare const chineseKeys: string[];
25
25
  export declare const englishKeys: string[];
26
- export declare function shuffle(arr: any[]): any[];
27
- export declare function getRandomKeys(): any[];
26
+ export declare function getRandomKeys(): string[];
@@ -1,4 +1,5 @@
1
1
  import { defaultConfig } from '../config';
2
+ import { shuffle } from '../../utils';
2
3
  export const defaultKeyboardProps = defaultConfig.keyboard;
3
4
  export const numberKeys = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'];
4
5
  export const digitKeys = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '0'];
@@ -92,16 +93,6 @@ export const englishKeys = [
92
93
  'N',
93
94
  'M',
94
95
  ];
95
- export function shuffle(arr) {
96
- const newArr = arr.slice();
97
- for (let i = arr.length - 1; i >= 0; i--) {
98
- const randomIndex = ~~(Math.random() * (i + 1));
99
- const randomItem = newArr[randomIndex];
100
- newArr[randomIndex] = newArr[i];
101
- newArr[i] = randomItem;
102
- }
103
- return newArr;
104
- }
105
96
  export function getRandomKeys() {
106
- return shuffle(numberKeys);
97
+ return shuffle(numberKeys.slice());
107
98
  }
@@ -4,11 +4,11 @@ declare const __VLS_component: import("vue").DefineComponent<KeyboardProps, {
4
4
  shuffle: () => void;
5
5
  toggle: () => void;
6
6
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
7
- input: (key: string) => any;
8
7
  delete: () => any;
8
+ input: (key: string) => any;
9
9
  }, string, import("vue").PublicProps, Readonly<KeyboardProps> & Readonly<{
10
- onInput?: ((key: string) => any) | undefined;
11
10
  onDelete?: (() => any) | undefined;
11
+ onInput?: ((key: string) => any) | undefined;
12
12
  }>, {
13
13
  type: "number" | "digit" | "idcard" | "random" | "plate";
14
14
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -58,6 +58,8 @@
58
58
  flex: auto;
59
59
  font-size: var(--sar-list-item-title-font-size);
60
60
  line-height: var(--sar-list-item-title-line-height);
61
+ word-wrap: break-word;
62
+ word-break: break-word;
61
63
  }
62
64
 
63
65
  @include e(description) {
@@ -66,6 +68,8 @@
66
68
  font-size: var(--sar-list-item-description-font-size);
67
69
  line-height: var(--sar-list-item-description-line-height);
68
70
  color: var(--sar-list-item-description-color);
71
+ word-wrap: break-word;
72
+ word-break: break-word;
69
73
  }
70
74
 
71
75
  @include e(value) {
@@ -103,6 +103,10 @@ declare const _default: {
103
103
  confirm: string;
104
104
  cancel: string;
105
105
  };
106
+ readMore: {
107
+ fold: string;
108
+ unfold: string;
109
+ };
106
110
  signature: {
107
111
  confirm: string;
108
112
  clear: string;
@@ -104,6 +104,10 @@ export default {
104
104
  confirm: 'Ok',
105
105
  cancel: 'Cancel',
106
106
  },
107
+ readMore: {
108
+ fold: 'fold',
109
+ unfold: 'unfold',
110
+ },
107
111
  signature: {
108
112
  confirm: 'Ok',
109
113
  clear: 'Clear',
@@ -103,6 +103,10 @@ declare const _default: {
103
103
  confirm: string;
104
104
  cancel: string;
105
105
  };
106
+ readMore: {
107
+ fold: string;
108
+ unfold: string;
109
+ };
106
110
  signature: {
107
111
  confirm: string;
108
112
  clear: string;
@@ -104,6 +104,10 @@ export default {
104
104
  confirm: '确定',
105
105
  cancel: '取消',
106
106
  },
107
+ readMore: {
108
+ fold: '收起',
109
+ unfold: '展开',
110
+ },
107
111
  signature: {
108
112
  confirm: '确定',
109
113
  clear: '清空',
@@ -29,10 +29,16 @@ import Marquee from 'sard-uniapp/components/marquee/marquee.vue'
29
29
  `Marquee` 组件是通过 `animation` 来实现高效的滚动动画的,
30
30
  会根据内容高度或宽度动态设置动画时长,以实现固定速率滚动。
31
31
 
32
- 如果 `Marquee` 挂载时机比插槽内容靠前,即插槽内容数据需要通过接口异步获取再渲染的,
32
+ @info
33
+
34
+ 在 <sup>1.20</sup>之前,如果 `Marquee` 挂载时机比插槽内容靠前,即插槽内容数据需要通过接口异步获取再渲染的,
33
35
  需要手动调用 `update` 方法来更新动画时长。
34
36
 
35
- @code('${DEMO_PATH}/marquee/demo/Reset.vue')
37
+ 在 <sup>1.20</sup>之后,会监听内容尺寸变化,自动调用更新方法,无需手动调用。
38
+
39
+ @endinfo
40
+
41
+ @code('${DEMO_PATH}/marquee/demo/Async.vue')
36
42
 
37
43
  ### 水平方向
38
44
 
@@ -2,6 +2,7 @@
2
2
  <view :class="marqueeClass" :style="marqueeStyle">
3
3
  <view :id="wrapperId" :class="bem.e('wrapper')" :style="wrapperStyle">
4
4
  <slot></slot>
5
+ <sar-resize-sensor @resize="onResize" />
5
6
  </view>
6
7
  </view>
7
8
  </template>
@@ -16,6 +17,7 @@ import {
16
17
  uniqid,
17
18
  getBoundingClientRect
18
19
  } from "../../utils";
20
+ import SarResizeSensor from "../resize-sensor/resize-sensor.vue";
19
21
  import {
20
22
  defaultMarqueeProps
21
23
  } from "./common";
@@ -28,6 +30,9 @@ import { useTimeout } from "../../use";
28
30
  * @property {number} delay 挂载后,延迟动画时间(单位 ms),避免进入页面时卡顿,默认值:1000。
29
31
  */
30
32
  export default _defineComponent({
33
+ components: {
34
+ SarResizeSensor,
35
+ },
31
36
  ...{
32
37
  options: {
33
38
  virtualHost: true,
@@ -65,6 +70,9 @@ export default _defineComponent({
65
70
  onMounted(() => {
66
71
  updateLater();
67
72
  });
73
+ const onResize = () => {
74
+ update();
75
+ };
68
76
  __expose({
69
77
  update
70
78
  });
@@ -80,7 +88,7 @@ export default _defineComponent({
80
88
  animationPlayState: duration.value ? "running" : "paused"
81
89
  });
82
90
  });
83
- const __returned__ = { props, bem, instance, wrapperId, duration, update, updateLater, marqueeClass, marqueeStyle, wrapperStyle };
91
+ const __returned__ = { props, bem, instance, wrapperId, duration, update, updateLater, onResize, marqueeClass, marqueeStyle, wrapperStyle, SarResizeSensor };
84
92
  return __returned__;
85
93
  }
86
94
  });
@@ -28,10 +28,16 @@ import NoticeBar from 'sard-uniapp/components/notice-bar/notice-bar.vue'
28
28
  `NoticeBar` 组件是通过 `animation` 来实现高效的滚动动画的,
29
29
  会根据内容宽度动态设置动画时长,以实现固定速率滚动。
30
30
 
31
- 如果 `NoticeBar` 挂载时机比插槽内容靠前,即插槽内容数据需要通过接口异步获取再渲染的,
31
+ @info
32
+
33
+ 在 <sup>1.20</sup>之前, 如果 `NoticeBar` 挂载时机比插槽内容靠前,即插槽内容数据需要通过接口异步获取再渲染的,
32
34
  需要手动调用 `update` 方法来更新动画时长。
33
35
 
34
- @code('${DEMO_PATH}/notice-bar/demo/Reset.vue')
36
+ 在 <sup>1.20</sup>之后,会监听内容尺寸变化,自动调用更新方法,无需手动调用。
37
+
38
+ @endinfo
39
+
40
+ @code('${DEMO_PATH}/notice-bar/demo/Async.vue')
35
41
 
36
42
  ### 强制滚动
37
43
 
@@ -13,6 +13,7 @@
13
13
  @animationend="onAnimationEnd"
14
14
  >
15
15
  <slot></slot>
16
+ <sar-resize-sensor @resize="onResize" />
16
17
  </view>
17
18
  </view>
18
19
  <view
@@ -41,6 +42,7 @@ import {
41
42
  getBoundingClientRect
42
43
  } from "../../utils";
43
44
  import SarIcon from "../icon/icon.vue";
45
+ import SarResizeSensor from "../resize-sensor/resize-sensor.vue";
44
46
  import {
45
47
  defaultNoticeBarProps
46
48
  } from "./common";
@@ -65,6 +67,7 @@ import { useTimeout } from "../../use";
65
67
  export default _defineComponent({
66
68
  components: {
67
69
  SarIcon,
70
+ SarResizeSensor,
68
71
  },
69
72
  ...{
70
73
  options: {
@@ -130,13 +133,6 @@ export default _defineComponent({
130
133
  firstLap.value = false;
131
134
  }
132
135
  };
133
- const innerVisible = ref(props.visible);
134
- const onRightIconClick = () => {
135
- if (props.closable) {
136
- innerVisible.value = false;
137
- emit("close");
138
- }
139
- };
140
136
  const { start: updateLater } = useTimeout(
141
137
  () => {
142
138
  update();
@@ -148,6 +144,16 @@ export default _defineComponent({
148
144
  updateLater();
149
145
  }
150
146
  });
147
+ const onResize = () => {
148
+ update();
149
+ };
150
+ const innerVisible = ref(props.visible);
151
+ const onRightIconClick = () => {
152
+ if (props.closable) {
153
+ innerVisible.value = false;
154
+ emit("close");
155
+ }
156
+ };
151
157
  const onClick = (event) => {
152
158
  emit("click", event);
153
159
  };
@@ -181,7 +187,7 @@ export default _defineComponent({
181
187
  animationDuration: `${firstLap.value ? wrapperData.value.first : wrapperData.value.later}ms`
182
188
  });
183
189
  });
184
- const __returned__ = { props, emit, bem, instance, contentId, wrapperId, shouldScroll, wrapperData, getWidth, update, firstLap, onAnimationEnd, innerVisible, onRightIconClick, updateLater, onClick, noticeBarClass, noticeBarStyle, wrapperStyle, SarIcon };
190
+ const __returned__ = { props, emit, bem, instance, contentId, wrapperId, shouldScroll, wrapperData, getWidth, update, firstLap, onAnimationEnd, updateLater, onResize, innerVisible, onRightIconClick, onClick, noticeBarClass, noticeBarStyle, wrapperStyle, SarIcon, SarResizeSensor };
185
191
  return __returned__;
186
192
  }
187
193
  });
@@ -9,9 +9,9 @@ declare const _default: import("vue").DefineComponent<NotifyProps, {
9
9
  onClick?: ((event: any) => any) | undefined;
10
10
  "onUpdate:visible"?: ((event: any) => any) | undefined;
11
11
  }>, {
12
+ timeout: number;
12
13
  type: "primary" | "success" | "warning" | "error";
13
14
  position: "top" | "bottom";
14
15
  duration: number;
15
- timeout: number;
16
16
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
17
  export default _default;
@@ -1,9 +1,9 @@
1
1
  import { type NotifyAgentProps } from './common';
2
2
  declare const _default: import("vue").DefineComponent<NotifyAgentProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NotifyAgentProps> & Readonly<{}>, {
3
+ timeout: number;
3
4
  type: "primary" | "success" | "warning" | "error";
4
5
  id: string;
5
6
  position: "top" | "bottom";
6
7
  duration: number;
7
- timeout: number;
8
8
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
9
  export default _default;
@@ -49,7 +49,7 @@
49
49
  <script>
50
50
  import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
51
51
  import { computed, ref, watch } from "vue";
52
- import { classNames, stringifyStyle, createBem, minmax } from "../../utils";
52
+ import { classNames, stringifyStyle, createBem, clamp } from "../../utils";
53
53
  import { useTranslate } from "../locale";
54
54
  import {
55
55
  getPageRange,
@@ -145,7 +145,7 @@ export default _defineComponent({
145
145
  const isPrevMulti = i === 0 && page !== 1;
146
146
  const isNextMulti = i === length - 1 && page !== innerPageCount.value;
147
147
  const type = isPrevMulti ? -1 : isNextMulti ? 1 : 0;
148
- page = type === 0 ? page : minmax(
148
+ page = type === 0 ? page : clamp(
149
149
  innerCurrent.value + type * props.multiCount,
150
150
  1,
151
151
  innerPageCount.value
@@ -1,4 +1,4 @@
1
- import { getWindowInfo, minmax } from '../../utils';
1
+ import { getWindowInfo, clamp } from '../../utils';
2
2
  const directions = ['top', 'right', 'bottom', 'left'];
3
3
  function getReverseDirection(direction) {
4
4
  const index = directions.indexOf(direction);
@@ -77,7 +77,7 @@ export function getPopoverPosition(refRect, popperRect, { refGap, position, view
77
77
  };
78
78
  const offset = strategies[side]();
79
79
  // 确保处于屏幕内
80
- return minmax(offset, viewportGap, axisWindowSize - popperRect[axisSizeName] - viewportGap);
80
+ return clamp(offset, viewportGap, axisWindowSize - popperRect[axisSizeName] - viewportGap);
81
81
  }
82
82
  function getDirectionOffset() {
83
83
  const strategies = {
@@ -96,7 +96,7 @@ export function getPopoverPosition(refRect, popperRect, { refGap, position, view
96
96
  };
97
97
  const offset = strategies[direction]();
98
98
  // 确保处于屏幕内
99
- return minmax(offset, viewportGap, crossAxisWindowSize - popperRect[crossAxisSizeName] - viewportGap);
99
+ return clamp(offset, viewportGap, crossAxisWindowSize - popperRect[crossAxisSizeName] - viewportGap);
100
100
  }
101
101
  popperStyle[crossAxis] = getDirectionOffset();
102
102
  popperStyle[axis] = getSideOffset();
@@ -120,7 +120,7 @@ export function getPopoverPosition(refRect, popperRect, { refGap, position, view
120
120
  Math.max(refRect[axis], finalPopperRect[axis]);
121
121
  const offset = extra + intersection / 2;
122
122
  // 确保箭头位于popper之内
123
- return minmax(offset, arrowSize, popperRect[axisSizeName] - arrowSize);
123
+ return clamp(offset, arrowSize, popperRect[axisSizeName] - arrowSize);
124
124
  }
125
125
  arrowStyle[axis] = getArrowOffset();
126
126
  arrowStyle[crossAxis] = getArrowCrossOffset(direction, popperRect);
@@ -19,7 +19,7 @@ export declare const defaultPullDownRefreshProps: () => {
19
19
  doneDuration: number;
20
20
  };
21
21
  export declare const pullDownRefreshProps: {
22
- rootStyle: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
22
+ rootStyle: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
23
23
  rootClass: StringConstructor;
24
24
  threshold: {
25
25
  type: NumberConstructor;
@@ -24,6 +24,7 @@ export interface RadioEmits {
24
24
  export declare const defaultOptionKeys: {
25
25
  label: string;
26
26
  value: string;
27
+ disabled: string;
27
28
  };
28
29
  export type RadioGroupOption = {
29
30
  [key: PropertyKey]: any;
@@ -2,6 +2,7 @@ import { defaultConfig } from '../config';
2
2
  export const defaultOptionKeys = {
3
3
  label: 'label',
4
4
  value: 'value',
5
+ disabled: 'disabled',
5
6
  };
6
7
  export const defaultRadioGroupProps = defaultConfig.radioGroup;
7
8
  export const radioContextSymbol = Symbol('radio-context');
@@ -23,6 +23,8 @@
23
23
  :options="options"
24
24
  :option-keys="optionKeys"
25
25
  :validate-event="validateEvent"
26
+ :searchable="searchable"
27
+ :filter-placeholder="filterPlaceholder"
26
28
  @change="onChange"
27
29
  />
28
30
  </sar-popout-input>
@@ -56,6 +58,8 @@ import { usePopoutInput } from "../../use";
56
58
  * @property {StyleValue} popoutStyle 弹窗框根元素样式,默认值:-。
57
59
  * @property {boolean} visible 是否显示弹出框,默认值:-。
58
60
  * @property {string} title 弹出框标题,默认值:-。
61
+ * @property {boolean} searchable 是否可搜索,默认值:false。
62
+ * @property {string} filterPlaceholder 搜索输入框占位符内容,默认值:-。
59
63
  * @property {boolean} clearable 是否显示清空按钮,默认值:false。
60
64
  * @property {string} placeholder 输入框占位符内容,默认值:-。
61
65
  * @property {() => any} valueOnClear 设置点击清除按钮后的值,默认值:() => undefined。
@@ -80,6 +84,8 @@ export default _defineComponent({
80
84
  title: { type: String, required: false },
81
85
  popoutClass: { type: String, required: false },
82
86
  popoutStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
87
+ searchable: { type: Boolean, required: false },
88
+ filterPlaceholder: { type: String, required: false },
83
89
  rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
84
90
  rootClass: { type: String, required: false },
85
91
  modelValue: { type: null, required: false },
@@ -24,18 +24,32 @@ import RadioPopout from 'sard-uniapp/components/radio-popout/radio-popout.vue'
24
24
 
25
25
  @code('${DEMO_PATH}/radio-popout/demo/Basic.vue')
26
26
 
27
+ ### 禁用选项 <sup>1.20+</sup>
28
+
29
+ 设置了 `disabled` 的选项可禁止选择。
30
+
31
+ @code('${DEMO_PATH}/radio-popout/demo/Disabled.vue')
32
+
33
+ ### 可搜索的 <sup>1.20+</sup>
34
+
35
+ 使用 `searchable` 显示搜索框,可用于过滤选项列表。
36
+
37
+ @code('${DEMO_PATH}/radio-popout/demo/Search.vue')
38
+
27
39
  ## API
28
40
 
29
41
  ### RadioPopoutProps
30
42
 
31
43
  继承 [`RadioGroupProps`](./radio#RadioGroupProps) 并有以下额外属性:
32
44
 
33
- | 属性 | 描述 | 类型 | 默认值 |
34
- | ----------------- | ---------------- | ---------- | ------ |
35
- | popout-class | 弹窗框根元素类名 | string | - |
36
- | popout-style | 弹窗框根元素样式 | StyleValue | - |
37
- | visible (v-model) | 是否显示弹出框 | boolean | - |
38
- | title | 弹出框标题 | string | - |
45
+ | 属性 | 描述 | 类型 | 默认值 |
46
+ | ----------------------------------- | -------------------- | ---------- | ------ |
47
+ | popout-class | 弹窗框根元素类名 | string | - |
48
+ | popout-style | 弹窗框根元素样式 | StyleValue | - |
49
+ | visible (v-model) | 是否显示弹出框 | boolean | - |
50
+ | title | 弹出框标题 | string | - |
51
+ | searchable <sup>1.20+</sup> | 是否可搜索 | boolean | false |
52
+ | filter-placeholder <sup>1.20+</sup> | 搜索输入框占位符内容 | string | - |
39
53
 
40
54
  ### RadioPopoutEmits
41
55
 
@@ -5,6 +5,8 @@ export interface RadioPopoutProps extends RadioGroupProps {
5
5
  title?: string;
6
6
  popoutClass?: string;
7
7
  popoutStyle?: StyleValue;
8
+ searchable?: boolean;
9
+ filterPlaceholder?: string;
8
10
  }
9
11
  export declare const defaultRadioPopoutProps: () => {
10
12
  options: () => never[];
@@ -7,5 +7,9 @@
7
7
 
8
8
  @include e(scroll) {
9
9
  max-height: var(--sar-radio-popout-max-height);
10
+
11
+ @include m(searchable) {
12
+ height: var(--sar-checkbox-popout-max-height);
13
+ }
10
14
  }
11
15
  }