sard-uniapp 1.25.4 → 1.25.5

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 (198) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/components/accordion/accordion.vue +1 -1
  3. package/components/accordion-item/accordion-item.vue +1 -1
  4. package/components/action-sheet/action-sheet.vue +1 -1
  5. package/components/alert/alert.vue +1 -1
  6. package/components/avatar/avatar.vue +1 -1
  7. package/components/avatar-group/avatar-group.vue +1 -1
  8. package/components/back-top/back-top.vue +1 -1
  9. package/components/badge/badge.vue +1 -1
  10. package/components/button/button.vue +1 -1
  11. package/components/calendar/calendar.vue +1 -1
  12. package/components/calendar-input/calendar-input.vue +2 -2
  13. package/components/calendar-popout/calendar-popout.vue +2 -2
  14. package/components/card/card.vue +1 -1
  15. package/components/cascader/README.md +89 -18
  16. package/components/cascader/cascader.d.ts +6 -6
  17. package/components/cascader/cascader.vue +201 -182
  18. package/components/cascader/common.d.ts +32 -7
  19. package/components/cascader/common.js +39 -23
  20. package/components/cascader/index.d.ts +1 -1
  21. package/components/cascader/index.scss +40 -4
  22. package/components/cascader/useCascaderTabs.d.ts +12 -0
  23. package/components/cascader/useCascaderTabs.js +59 -0
  24. package/components/cascader/useCascaderTree.d.ts +66 -0
  25. package/components/cascader/useCascaderTree.js +194 -0
  26. package/components/cascader/variables.scss +9 -2
  27. package/components/cascader-input/README.md +26 -13
  28. package/components/cascader-input/cascader-input.d.ts +7 -2
  29. package/components/cascader-input/cascader-input.vue +70 -16
  30. package/components/cascader-input/common.d.ts +356 -30
  31. package/components/cascader-popout/README.md +6 -0
  32. package/components/cascader-popout/cascader-popout.d.ts +5 -1
  33. package/components/cascader-popout/cascader-popout.vue +16 -4
  34. package/components/cascader-popout/common.d.ts +169 -17
  35. package/components/check-icon/check-icon.vue +1 -1
  36. package/components/checkbox/checkbox.d.ts +2 -2
  37. package/components/checkbox/checkbox.vue +1 -1
  38. package/components/checkbox-group/checkbox-group.vue +1 -1
  39. package/components/checkbox-input/checkbox-input.vue +2 -2
  40. package/components/checkbox-popout/checkbox-popout.vue +2 -2
  41. package/components/col/col.vue +1 -1
  42. package/components/collapse/collapse.vue +1 -1
  43. package/components/config/index.js +4 -1
  44. package/components/cool-icon/cool-icon.vue +1 -1
  45. package/components/count-down/count-down.vue +1 -1
  46. package/components/crop-image/crop-image.vue +1 -1
  47. package/components/crop-image-agent/crop-image-agent.vue +1 -1
  48. package/components/datetime-picker/datetime-picker.vue +1 -1
  49. package/components/datetime-picker-input/datetime-picker-input.vue +2 -2
  50. package/components/datetime-picker-popout/datetime-picker-popout.vue +2 -2
  51. package/components/datetime-range-picker/datetime-range-picker.vue +1 -1
  52. package/components/datetime-range-picker-input/datetime-range-picker-input.vue +2 -2
  53. package/components/datetime-range-picker-popout/datetime-range-picker-popout.vue +2 -2
  54. package/components/dialog/dialog.vue +2 -2
  55. package/components/dialog-agent/dialog-agent.vue +2 -2
  56. package/components/divider/divider.vue +1 -1
  57. package/components/dnd/dnd.vue +1 -1
  58. package/components/dnd-handle/dnd-handle.vue +1 -1
  59. package/components/dnd-item/dnd-item.vue +1 -1
  60. package/components/dropdown/dropdown.vue +1 -1
  61. package/components/dropdown-item/dropdown-item.vue +7 -2
  62. package/components/empty/empty.vue +1 -1
  63. package/components/fab/fab.vue +1 -1
  64. package/components/fab-item/fab-item.vue +1 -1
  65. package/components/floating-bubble/floating-bubble.vue +1 -1
  66. package/components/floating-panel/floating-panel.vue +1 -1
  67. package/components/form/form.vue +1 -1
  68. package/components/form-item/form-item.vue +1 -1
  69. package/components/form-item-plain/form-item-plain.vue +1 -1
  70. package/components/form-plain/form-plain.vue +1 -1
  71. package/components/grid/grid.vue +1 -1
  72. package/components/grid-item/grid-item.vue +2 -2
  73. package/components/icon/icon.vue +1 -1
  74. package/components/icon/sari.scss +17 -17
  75. package/components/image/image.vue +10 -4
  76. package/components/indexes/indexes.vue +1 -1
  77. package/components/indexes-anchor/indexes-anchor.vue +1 -1
  78. package/components/input/input.vue +1 -1
  79. package/components/keyboard/keyboard.vue +1 -1
  80. package/components/list/list.vue +1 -1
  81. package/components/list-item/list-item.vue +1 -1
  82. package/components/load-more/load-more.vue +1 -1
  83. package/components/loading/loading.vue +1 -1
  84. package/components/locale/lang/ar-SA.d.ts +2 -0
  85. package/components/locale/lang/ar-SA.js +2 -0
  86. package/components/locale/lang/en-US.d.ts +2 -0
  87. package/components/locale/lang/en-US.js +2 -0
  88. package/components/locale/lang/vi-VN.d.ts +2 -0
  89. package/components/locale/lang/vi-VN.js +2 -0
  90. package/components/locale/lang/zh-CN.d.ts +2 -0
  91. package/components/locale/lang/zh-CN.js +2 -0
  92. package/components/marquee/marquee.vue +1 -1
  93. package/components/menu/menu.vue +1 -1
  94. package/components/navbar/navbar.vue +2 -2
  95. package/components/navbar-item/navbar-item.vue +1 -1
  96. package/components/navbar-pit/navbar-pit.vue +1 -1
  97. package/components/notice-bar/notice-bar.vue +1 -1
  98. package/components/notify/notify.vue +2 -1
  99. package/components/notify-agent/notify-agent.vue +1 -1
  100. package/components/overlay/overlay.vue +1 -1
  101. package/components/pagination/pagination.vue +1 -1
  102. package/components/password-input/password-input.vue +1 -1
  103. package/components/picker/picker.vue +1 -1
  104. package/components/picker-input/picker-input.vue +2 -2
  105. package/components/picker-item/picker-item.vue +1 -1
  106. package/components/picker-popout/picker-popout.vue +2 -2
  107. package/components/popout/popout.vue +1 -1
  108. package/components/popout-input/popout-input.vue +1 -1
  109. package/components/popover/popover.vue +3 -2
  110. package/components/popover-reference/popover-reference.vue +1 -1
  111. package/components/popup/README.md +1 -0
  112. package/components/popup/common.d.ts +28 -0
  113. package/components/popup/index.scss +4 -2
  114. package/components/popup/popup.d.ts +1 -0
  115. package/components/popup/popup.vue +82 -16
  116. package/components/popup/variables.scss +6 -0
  117. package/components/progress-bar/progress-bar.vue +1 -1
  118. package/components/progress-circle/progress-circle.vue +1 -1
  119. package/components/pull-down-refresh/pull-down-refresh.vue +1 -1
  120. package/components/qrcode/qrcode.vue +6 -5
  121. package/components/radio/radio.vue +1 -1
  122. package/components/radio-group/radio-group.vue +1 -1
  123. package/components/radio-input/radio-input.vue +2 -2
  124. package/components/radio-popout/radio-popout.vue +2 -2
  125. package/components/rate/rate.vue +1 -1
  126. package/components/read-more/read-more.vue +1 -1
  127. package/components/resize-sensor/index.scss +7 -0
  128. package/components/resize-sensor/resize-sensor.vue +10 -3
  129. package/components/result/result.vue +1 -1
  130. package/components/row/row.vue +1 -1
  131. package/components/scroll-list/scroll-list.vue +1 -1
  132. package/components/scroll-spy/scroll-spy.vue +1 -1
  133. package/components/scroll-spy-anchor/scroll-spy-anchor.vue +1 -1
  134. package/components/search/search.vue +1 -1
  135. package/components/segmented/segmented.vue +1 -1
  136. package/components/segmented-item/segmented-item.vue +1 -1
  137. package/components/share-sheet/share-sheet.vue +2 -1
  138. package/components/sidebar/sidebar.vue +1 -1
  139. package/components/sidebar-item/sidebar-item.vue +1 -1
  140. package/components/signature/signature.vue +1 -1
  141. package/components/skeleton/skeleton.vue +1 -1
  142. package/components/skeleton-avatar/skeleton-avatar.vue +1 -1
  143. package/components/skeleton-block/skeleton-block.vue +1 -1
  144. package/components/skeleton-paragraph/skeleton-paragraph.vue +1 -1
  145. package/components/skeleton-title/skeleton-title.vue +1 -1
  146. package/components/slider/slider.vue +1 -1
  147. package/components/space/space.vue +1 -1
  148. package/components/status-bar/status-bar.vue +1 -1
  149. package/components/step/step.vue +1 -1
  150. package/components/stepper/stepper.vue +1 -1
  151. package/components/steps/steps.vue +1 -1
  152. package/components/sticky/sticky.vue +1 -1
  153. package/components/sticky-box/sticky-box.vue +1 -1
  154. package/components/swipe-action/swipe-action.vue +1 -1
  155. package/components/swiper-dot/swiper-dot.vue +1 -1
  156. package/components/switch/switch.vue +1 -1
  157. package/components/tab/tab.vue +1 -1
  158. package/components/tabbar/tabbar.vue +1 -1
  159. package/components/tabbar-item/tabbar-item.vue +1 -1
  160. package/components/tabbar-pit/tabbar-pit.vue +1 -1
  161. package/components/table/table.vue +1 -1
  162. package/components/table-cell/table-cell.vue +1 -1
  163. package/components/table-fixation/table-fixation.vue +1 -1
  164. package/components/table-row/table-row.vue +1 -1
  165. package/components/tabs/tabs.vue +1 -1
  166. package/components/tag/tag.vue +1 -1
  167. package/components/timeline/timeline.vue +1 -1
  168. package/components/timeline-item/timeline-item.vue +1 -1
  169. package/components/toast/toast.vue +2 -1
  170. package/components/toast-agent/toast-agent.vue +1 -1
  171. package/components/tree/README.md +0 -2
  172. package/components/tree/tree.d.ts +1 -1
  173. package/components/tree/tree.vue +36 -81
  174. package/components/tree-node/tree-node.vue +8 -4
  175. package/components/upload/upload.vue +1 -1
  176. package/components/upload-preview/upload-preview.vue +1 -1
  177. package/components/waterfall/waterfall.vue +1 -1
  178. package/components/waterfall-item/waterfall-item.vue +1 -1
  179. package/components/waterfall-load/waterfall-load.vue +1 -1
  180. package/components/watermark/watermark.vue +6 -8
  181. package/package.json +2 -1
  182. package/use/index.d.ts +1 -0
  183. package/use/index.js +1 -0
  184. package/use/useLockScroll.d.ts +8 -0
  185. package/use/useLockScroll.js +88 -0
  186. package/utils/file.d.ts +6 -0
  187. package/utils/file.js +33 -11
  188. package/utils/index.d.ts +2 -0
  189. package/utils/index.js +2 -0
  190. package/utils/log.d.ts +1 -0
  191. package/utils/log.js +4 -0
  192. package/utils/router.js +2 -1
  193. package/utils/system.d.ts +2 -0
  194. package/utils/system.js +6 -1
  195. package/utils/tree.d.ts +18 -0
  196. package/utils/tree.js +94 -0
  197. package/components/tree/utils.d.ts +0 -5
  198. package/components/tree/utils.js +0 -29
@@ -13,6 +13,7 @@
13
13
  :internal-prepend="$slots.prepend ? 1 : 0"
14
14
  :internal-append="$slots.append ? 1 : 0"
15
15
  :input-props="inputProps"
16
+ :multiline="multiple"
16
17
  @clear="onClear"
17
18
  @click="show"
18
19
  >
@@ -38,6 +39,10 @@
38
39
  :change-on-select="changeOnSelect"
39
40
  :label-render="labelRender"
40
41
  :all-levels="allLevels"
42
+ :multiple="multiple"
43
+ :check-strictly="checkStrictly"
44
+ :lazy="lazy"
45
+ :load="load"
41
46
  :validate-event="validateEvent"
42
47
  :resettable="resettable"
43
48
  @select="(option, tabIndex) => $emit('select', option, tabIndex)"
@@ -54,14 +59,15 @@
54
59
 
55
60
  <script>
56
61
  import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
57
- import { watch, computed } from "vue";
62
+ import { watch, computed, shallowRef, provide } from "vue";
58
63
  import SarPopoutInput from "../popout-input/popout-input.vue";
59
64
  import SarCascaderPopout from "../cascader-popout/cascader-popout.vue";
60
65
  import {
66
+ cascaderOptionsContextSymbol,
61
67
  defaultFieldKeys,
62
68
  getSelectedOptionsByValue
63
69
  } from "../cascader/common";
64
- import { isEmptyBinding } from "../../utils";
70
+ import { isEmptyArray, isEmptyBinding, isNullish } from "../../utils";
65
71
  import { usePopoutInput } from "../../use";
66
72
  import {
67
73
  defaultCascaderInputProps
@@ -69,13 +75,17 @@ import {
69
75
  /**
70
76
  * @property {string} rootClass 弹出式输入框根元素类名,默认值:-。
71
77
  * @property {StyleValue} rootStyle 弹出式输入框根元素样式,默认值:-。
72
- * @property {string | number | (string | number)[]} modelValue 选中项的值,默认值:-。
78
+ * @property {CascaderValue} modelValue 选中项的值,默认值:-。
73
79
  * @property {CascaderOption[]} options 可选项数据源,默认值:[]。
74
80
  * @property {CascaderFieldKeys} fieldKeys 自定义 `options` 中的字段,默认值:defaultFieldKeys。
75
81
  * @property {string} hintText 未选中时的提示文案,默认值:'请选择'。
76
82
  * @property {(option: CascaderOption) => string} labelRender 自定义可选项渲染,默认值:-。
77
83
  * @property {boolean} changeOnSelect 点击每级选项都会触发变化,默认值:false。
78
84
  * @property {boolean} allLevels 是否绑定所有级别的值,而不单单是最后一级,默认值:false。
85
+ * @property {boolean} multiple 是否多选,默认值:false。
86
+ * @property {boolean} checkStrictly 是否严格的遵守父子节点不互相关联(用于多选),默认值:false。
87
+ * @property {boolean} lazy 是否懒加载子节点,需与 load 方法结合使用,默认值:false。
88
+ * @property {(node?: CascaderStateNode) => Promise<CascaderOption[]> | CascaderOption[]} load 加载子节点的方法,仅当 lazy 属性为true 时生效,默认值:-。
79
89
  * @property {string} popoutClass 弹窗框根元素类名,默认值:-。
80
90
  * @property {StyleValue} popoutStyle 弹窗框根元素样式,默认值:-。
81
91
  * @property {boolean} visible 是否显示弹出框,默认值:-。
@@ -92,6 +102,7 @@ import {
92
102
  * @property {string} arrow 自定义箭头图标名,默认值:'caret-right'。
93
103
  * @property {string} arrowFamily 自定义箭头图标字体,默认值:'sari'。
94
104
  * @property {InputProps} inputProps 自定义输入框组件属性,默认值:-。
105
+ * @property {number} maxRows 多选时,输入框最大展示行数,设为 -1 表示不限制,默认值:3。
95
106
  * @event {(visible: boolean) => void} update 弹出框显隐时触发
96
107
  * @event {(value: string | number, selectedOptions: CascaderOption[]) => void} change 级联输入组件值改变时触发
97
108
  * @event {(option: CascaderOption, tabIndex: number) => void} select 选择级联选择某一项时触发
@@ -120,14 +131,15 @@ export default _defineComponent({
120
131
  __name: "cascader-input",
121
132
  props: _mergeDefaults({
122
133
  valueOnClear: { type: Function, required: false },
134
+ maxRows: { type: Number, required: false },
123
135
  visible: { type: Boolean, required: false },
124
136
  title: { type: String, required: false },
125
137
  showConfirm: { type: Boolean, required: false },
126
138
  validateEvent: { type: Boolean, required: false },
127
139
  popoutClass: { type: String, required: false },
128
- popoutStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
140
+ popoutStyle: { type: null, required: false },
129
141
  resettable: { type: Boolean, required: false },
130
- rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
142
+ rootStyle: { type: null, required: false },
131
143
  rootClass: { type: String, required: false },
132
144
  modelValue: { type: [String, Number, Array], required: false },
133
145
  options: { type: Array, required: false },
@@ -136,6 +148,10 @@ export default _defineComponent({
136
148
  labelRender: { type: Function, required: false },
137
149
  changeOnSelect: { type: Boolean, required: false },
138
150
  allLevels: { type: Boolean, required: false },
151
+ multiple: { type: Boolean, required: false },
152
+ checkStrictly: { type: Boolean, required: false },
153
+ lazy: { type: Boolean, required: false },
154
+ load: { type: Function, required: false },
139
155
  placeholder: { type: String, required: false },
140
156
  readonly: { type: Boolean, required: false },
141
157
  disabled: { type: Boolean, required: false },
@@ -175,24 +191,62 @@ export default _defineComponent({
175
191
  props.fieldKeys
176
192
  );
177
193
  });
194
+ const lazyOptions = shallowRef([]);
195
+ provide(cascaderOptionsContextSymbol, {
196
+ set(options) {
197
+ lazyOptions.value = options;
198
+ }
199
+ });
200
+ const renderedOptions = computed(() => {
201
+ return props.lazy && !!props.load ? lazyOptions.value : props.options;
202
+ });
178
203
  function getOutletText(options, value, fieldKeys) {
179
- const selectedOptions = getSelectedOptionsByValue(options, value, fieldKeys);
180
- if (!selectedOptions) {
181
- return isEmptyBinding(value) ? "" : String(value);
204
+ const selectedOptions = getSelectedOptionsByValue(
205
+ options,
206
+ value,
207
+ fieldKeys,
208
+ props.multiple
209
+ );
210
+ if (!selectedOptions || selectedOptions.length === 0) {
211
+ return getValueDisplay(value);
182
212
  }
183
- const labels = selectedOptions.map((option) => option[fieldKeys.label]);
184
- return labels.join("/");
213
+ const labels = selectedOptions.map((option) => {
214
+ return Array.isArray(option) ? option.map((item) => item[fieldKeys.label]) : option[fieldKeys.label];
215
+ });
216
+ return props.multiple ? labels.map((item) => item.join("/")) : labels.join("/");
185
217
  }
186
- function getInputValue() {
187
- if (isEmptyBinding(innerValue.value) || !props.options) {
218
+ function getValueDisplay(value) {
219
+ if (Array.isArray(value)) {
220
+ return value.map(
221
+ (item) => Array.isArray(item) ? item.join("/") : item
222
+ );
223
+ }
224
+ return isNullish(value) ? "" : String(value);
225
+ }
226
+ function getInputValue(options) {
227
+ if (isEmptyBinding(innerValue.value) || isEmptyArray(innerValue.value)) {
188
228
  return "";
189
229
  }
190
- return getOutletText(props.options, innerValue.value, fieldkeys.value);
230
+ if (!options || isEmptyArray(options)) {
231
+ return getValueDisplay(innerValue.value);
232
+ }
233
+ return getOutletText(options, innerValue.value, fieldkeys.value);
234
+ }
235
+ function getMayMultilineText(value) {
236
+ if (Array.isArray(value)) {
237
+ const diff = value.length - (props.maxRows === -1 ? Number.MAX_SAFE_INTEGER : props.maxRows);
238
+ const rows = value.slice(0, props.maxRows);
239
+ if (diff > 0) {
240
+ rows.push(`+${diff}`);
241
+ }
242
+ return rows.join("\n");
243
+ }
244
+ return value;
191
245
  }
192
246
  watch(
193
- [innerValue, () => props.options],
247
+ [innerValue, renderedOptions],
194
248
  () => {
195
- inputValue.value = getInputValue();
249
+ inputValue.value = getMayMultilineText(getInputValue(renderedOptions.value));
196
250
  },
197
251
  {
198
252
  immediate: true
@@ -201,7 +255,7 @@ export default _defineComponent({
201
255
  const onConfirm = () => {
202
256
  emit("confirm");
203
257
  };
204
- const __returned__ = { props, emit, innerVisible, innerValue, inputValue, show, onChange, onClear, onVisibleHook, fieldkeys, getOutletText, getInputValue, onConfirm, SarPopoutInput, SarCascaderPopout };
258
+ const __returned__ = { props, emit, innerVisible, innerValue, inputValue, show, onChange, onClear, onVisibleHook, fieldkeys, lazyOptions, renderedOptions, getOutletText, getValueDisplay, getInputValue, getMayMultilineText, onConfirm, SarPopoutInput, SarCascaderPopout };
205
259
  return __returned__;
206
260
  }
207
261
  });