sard-uniapp 1.19.1 → 1.19.3

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 (278) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/components/accordion/README.md +91 -0
  3. package/components/accordion/accordion.vue +7 -0
  4. package/components/accordion-item/accordion-item.vue +9 -0
  5. package/components/action-sheet/README.md +85 -0
  6. package/components/action-sheet/action-sheet.vue +15 -0
  7. package/components/action-sheet/variables.scss +1 -1
  8. package/components/alert/README.md +74 -0
  9. package/components/alert/alert.vue +10 -0
  10. package/components/avatar/README.md +86 -0
  11. package/components/avatar/avatar.vue +8 -0
  12. package/components/back-top/README.md +134 -0
  13. package/components/back-top/back-top.vue +9 -0
  14. package/components/badge/README.md +95 -0
  15. package/components/badge/badge.vue +11 -0
  16. package/components/button/README.md +162 -0
  17. package/components/button/button.vue +46 -0
  18. package/components/calendar/README.md +94 -0
  19. package/components/calendar/calendar.vue +21 -2
  20. package/components/calendar-input/README.md +65 -0
  21. package/components/calendar-input/calendar-input.d.ts +3 -2
  22. package/components/calendar-input/calendar-input.vue +32 -0
  23. package/components/calendar-input/common.d.ts +2 -0
  24. package/components/calendar-popout/README.md +100 -0
  25. package/components/calendar-popout/calendar-popout.d.ts +12 -2
  26. package/components/calendar-popout/calendar-popout.vue +32 -1
  27. package/components/calendar-popout/common.d.ts +2 -0
  28. package/components/card/README.md +82 -0
  29. package/components/card/card.vue +9 -0
  30. package/components/cascader/README.md +117 -0
  31. package/components/cascader/cascader.vue +13 -0
  32. package/components/cascader-input/README.md +51 -0
  33. package/components/cascader-input/cascader-input.d.ts +2 -1
  34. package/components/cascader-input/cascader-input.vue +32 -6
  35. package/components/cascader-input/common.d.ts +2 -0
  36. package/components/cascader-input/common.js +1 -0
  37. package/components/cascader-popout/README.md +53 -0
  38. package/components/cascader-popout/cascader-popout.d.ts +1 -1
  39. package/components/cascader-popout/cascader-popout.vue +21 -2
  40. package/components/check-icon/variables.scss +1 -1
  41. package/components/checkbox/README.md +185 -0
  42. package/components/checkbox/checkbox.vue +17 -0
  43. package/components/checkbox/variables.scss +1 -1
  44. package/components/checkbox-group/checkbox-group.vue +15 -0
  45. package/components/checkbox-input/README.md +44 -0
  46. package/components/checkbox-input/checkbox-input.d.ts +1 -0
  47. package/components/checkbox-input/checkbox-input.vue +25 -2
  48. package/components/checkbox-input/common.d.ts +2 -0
  49. package/components/checkbox-input/common.js +5 -1
  50. package/components/checkbox-popout/README.md +52 -0
  51. package/components/checkbox-popout/checkbox-popout.vue +19 -0
  52. package/components/col/col.vue +7 -0
  53. package/components/collapse/README.md +45 -0
  54. package/components/collapse/collapse.vue +3 -0
  55. package/components/config/index.d.ts +46 -1
  56. package/components/config/index.js +37 -0
  57. package/components/count-down/README.md +97 -0
  58. package/components/count-down/count-down.vue +8 -0
  59. package/components/count-to/README.md +61 -0
  60. package/components/count-to/count-to.vue +7 -0
  61. package/components/crop-image/README.md +86 -0
  62. package/components/crop-image/crop-image.vue +15 -0
  63. package/components/datetime-picker/README.md +136 -0
  64. package/components/datetime-picker/datetime-picker.vue +14 -0
  65. package/components/datetime-picker-input/README.md +82 -0
  66. package/components/datetime-picker-input/common.d.ts +2 -0
  67. package/components/datetime-picker-input/common.js +1 -0
  68. package/components/datetime-picker-input/datetime-picker-input.d.ts +2 -1
  69. package/components/datetime-picker-input/datetime-picker-input.vue +26 -0
  70. package/components/datetime-picker-popout/README.md +77 -0
  71. package/components/datetime-picker-popout/datetime-picker-popout.d.ts +1 -1
  72. package/components/datetime-picker-popout/datetime-picker-popout.vue +21 -2
  73. package/components/datetime-range-picker/README.md +49 -0
  74. package/components/datetime-range-picker/datetime-range-picker.vue +15 -0
  75. package/components/datetime-range-picker-input/README.md +58 -0
  76. package/components/datetime-range-picker-input/common.d.ts +2 -0
  77. package/components/datetime-range-picker-input/common.js +1 -0
  78. package/components/datetime-range-picker-input/datetime-range-picker-input.d.ts +1 -0
  79. package/components/datetime-range-picker-input/datetime-range-picker-input.vue +27 -0
  80. package/components/datetime-range-picker-popout/README.md +53 -0
  81. package/components/datetime-range-picker-popout/datetime-range-picker-popout.vue +22 -2
  82. package/components/dialog/README.md +192 -0
  83. package/components/dialog/dialog.d.ts +1 -1
  84. package/components/dialog/dialog.vue +33 -0
  85. package/components/dialog-agent/dialog-agent.d.ts +1 -1
  86. package/components/dialog-agent/dialog-agent.vue +21 -0
  87. package/components/divider/README.md +80 -0
  88. package/components/divider/divider.vue +8 -0
  89. package/components/dropdown/README.md +168 -0
  90. package/components/dropdown/common.d.ts +7 -0
  91. package/components/dropdown/common.js +1 -0
  92. package/components/dropdown/dropdown.d.ts +1 -1
  93. package/components/dropdown/dropdown.vue +16 -1
  94. package/components/dropdown/variables.scss +1 -1
  95. package/components/dropdown-item/dropdown-item.vue +51 -4
  96. package/components/empty/README.md +71 -0
  97. package/components/empty/empty.vue +8 -0
  98. package/components/empty/variables.scss +1 -1
  99. package/components/fab/README.md +111 -0
  100. package/components/fab/fab.vue +18 -0
  101. package/components/floating-bubble/README.md +70 -0
  102. package/components/floating-bubble/floating-bubble.vue +11 -0
  103. package/components/floating-panel/README.md +78 -0
  104. package/components/floating-panel/floating-panel.vue +11 -0
  105. package/components/form/README.md +308 -0
  106. package/components/form/form.vue +19 -0
  107. package/components/form-item/form-item.vue +17 -0
  108. package/components/grid/README.md +140 -0
  109. package/components/grid/grid.vue +11 -0
  110. package/components/grid-item/grid-item.vue +15 -0
  111. package/components/icon/README.md +118 -0
  112. package/components/icon/common.d.ts +2 -0
  113. package/components/icon/icon.d.ts +1 -0
  114. package/components/icon/icon.vue +18 -3
  115. package/components/indexes/README.md +83 -0
  116. package/components/indexes/indexes.vue +7 -0
  117. package/components/indexes-anchor/indexes-anchor.vue +5 -0
  118. package/components/input/README.md +170 -0
  119. package/components/input/common.d.ts +1 -0
  120. package/components/input/index.scss +0 -20
  121. package/components/input/input.vue +71 -17
  122. package/components/input/variables.scss +2 -2
  123. package/components/keyboard/README.md +82 -0
  124. package/components/keyboard/keyboard.vue +7 -0
  125. package/components/layout/README.md +89 -0
  126. package/components/list/README.md +118 -0
  127. package/components/list/list.vue +8 -0
  128. package/components/list-item/list-item.vue +15 -0
  129. package/components/load-more/README.md +75 -0
  130. package/components/load-more/load-more.vue +11 -0
  131. package/components/loading/README.md +89 -0
  132. package/components/loading/loading.vue +13 -0
  133. package/components/lucky-draw/README.md +174 -0
  134. package/components/marquee/README.md +65 -0
  135. package/components/marquee/marquee.vue +7 -0
  136. package/components/menu/_README.md +61 -0
  137. package/components/navbar/README.md +123 -0
  138. package/components/navbar/navbar.vue +11 -0
  139. package/components/navbar-item/navbar-item.vue +10 -0
  140. package/components/notice-bar/README.md +135 -0
  141. package/components/notice-bar/notice-bar.vue +17 -0
  142. package/components/notify/README.md +118 -0
  143. package/components/notify/notify.vue +11 -0
  144. package/components/notify-agent/notify-agent.vue +12 -0
  145. package/components/overlay/README.md +56 -0
  146. package/components/overlay/overlay.vue +10 -0
  147. package/components/pagination/README.md +80 -0
  148. package/components/pagination/pagination.vue +15 -0
  149. package/components/password-input/README.md +87 -0
  150. package/components/password-input/password-input.vue +17 -0
  151. package/components/picker/README.md +115 -0
  152. package/components/picker/common.d.ts +1 -1
  153. package/components/picker/common.js +18 -6
  154. package/components/picker/picker.vue +40 -15
  155. package/components/picker-input/README.md +51 -0
  156. package/components/picker-input/common.d.ts +2 -0
  157. package/components/picker-input/common.js +2 -0
  158. package/components/picker-input/picker-input.d.ts +2 -1
  159. package/components/picker-input/picker-input.vue +24 -2
  160. package/components/picker-popout/README.md +51 -0
  161. package/components/picker-popout/picker-popout.d.ts +1 -1
  162. package/components/picker-popout/picker-popout.vue +24 -4
  163. package/components/popout/README.md +111 -0
  164. package/components/popout/common.d.ts +1 -0
  165. package/components/popout/popout.d.ts +1 -1
  166. package/components/popout/popout.vue +30 -0
  167. package/components/popout-input/README.md +55 -0
  168. package/components/popout-input/popout-input.vue +16 -0
  169. package/components/popout-input/variables.scss +1 -1
  170. package/components/popover/README.md +191 -0
  171. package/components/popover/popover.vue +15 -0
  172. package/components/popover-reference/popover-reference.vue +5 -0
  173. package/components/popup/README.md +67 -0
  174. package/components/popup/popup.vue +20 -0
  175. package/components/progress-bar/README.md +90 -0
  176. package/components/progress-bar/progress-bar.vue +13 -0
  177. package/components/progress-circle/README.md +75 -0
  178. package/components/progress-circle/progress-circle.vue +10 -0
  179. package/components/pull-down-refresh/README.md +100 -0
  180. package/components/pull-down-refresh/pull-down-refresh.d.ts +1 -1
  181. package/components/pull-down-refresh/pull-down-refresh.vue +11 -0
  182. package/components/qrcode/README.md +103 -0
  183. package/components/qrcode/common.d.ts +2 -0
  184. package/components/qrcode/qrcode.vue +71 -61
  185. package/components/radio/README.md +172 -0
  186. package/components/radio/radio.vue +13 -0
  187. package/components/radio/variables.scss +1 -1
  188. package/components/radio-group/radio-group.vue +16 -0
  189. package/components/radio-input/README.md +44 -0
  190. package/components/radio-input/common.d.ts +3 -1
  191. package/components/radio-input/common.js +5 -1
  192. package/components/radio-input/radio-input.d.ts +1 -0
  193. package/components/radio-input/radio-input.vue +26 -2
  194. package/components/radio-popout/README.md +52 -0
  195. package/components/radio-popout/common.d.ts +1 -1
  196. package/components/radio-popout/radio-popout.vue +20 -0
  197. package/components/rate/README.md +106 -0
  198. package/components/rate/rate.d.ts +1 -1
  199. package/components/rate/rate.vue +22 -0
  200. package/components/rate/variables.scss +1 -1
  201. package/components/result/README.md +66 -0
  202. package/components/result/result.vue +10 -0
  203. package/components/row/row.vue +7 -0
  204. package/components/scroll-spy/README.md +70 -0
  205. package/components/scroll-spy/scroll-spy.vue +13 -0
  206. package/components/search/README.md +117 -0
  207. package/components/search/search.vue +25 -0
  208. package/components/search/variables.scss +1 -1
  209. package/components/share-sheet/README.md +94 -0
  210. package/components/share-sheet/share-sheet.vue +20 -0
  211. package/components/share-sheet/variables.scss +1 -1
  212. package/components/sidebar/README.md +118 -0
  213. package/components/sidebar/sidebar.vue +10 -0
  214. package/components/sidebar-item/sidebar-item.vue +8 -0
  215. package/components/signature/README.md +99 -0
  216. package/components/signature/signature.vue +20 -0
  217. package/components/skeleton/README.md +128 -0
  218. package/components/skeleton/skeleton.vue +12 -0
  219. package/components/skeleton-avatar/skeleton-avatar.vue +9 -0
  220. package/components/skeleton-block/skeleton-block.vue +8 -0
  221. package/components/skeleton-paragraph/skeleton-paragraph.vue +9 -0
  222. package/components/skeleton-title/skeleton-title.vue +8 -0
  223. package/components/slider/README.md +140 -0
  224. package/components/slider/slider.vue +29 -0
  225. package/components/space/README.md +82 -0
  226. package/components/space/space.vue +9 -0
  227. package/components/status-bar/README.md +72 -0
  228. package/components/status-bar/status-bar.vue +6 -0
  229. package/components/step/step.vue +9 -1
  230. package/components/stepper/README.md +94 -0
  231. package/components/stepper/stepper.vue +24 -0
  232. package/components/stepper/variables.scss +1 -1
  233. package/components/steps/README.md +142 -0
  234. package/components/steps/steps.vue +15 -0
  235. package/components/style/README.md +20 -0
  236. package/components/style/variables-dark.scss +10 -6
  237. package/components/style/variables.scss +17 -11
  238. package/components/swipe-action/README.md +82 -0
  239. package/components/swipe-action/swipe-action.vue +7 -0
  240. package/components/swiper-dot/README.md +45 -0
  241. package/components/swiper-dot/swiper-dot.vue +9 -0
  242. package/components/switch/README.md +89 -0
  243. package/components/switch/switch.vue +18 -0
  244. package/components/tab/tab.vue +8 -0
  245. package/components/tabbar/README.md +111 -0
  246. package/components/tabbar/tabbar.vue +12 -0
  247. package/components/tabbar-item/tabbar-item.vue +12 -0
  248. package/components/tabbar-pit/README.md +41 -0
  249. package/components/tabbar-pit/tabbar-pit.vue +5 -0
  250. package/components/table/README.md +162 -0
  251. package/components/table/table.vue +7 -0
  252. package/components/table-cell/table-cell.vue +7 -0
  253. package/components/table-row/table-row.vue +5 -0
  254. package/components/tabs/README.md +113 -0
  255. package/components/tabs/tabs.vue +10 -0
  256. package/components/tag/README.md +96 -0
  257. package/components/tag/common.d.ts +1 -1
  258. package/components/tag/index.scss +5 -1
  259. package/components/tag/tag.vue +16 -2
  260. package/components/timeline/README.md +66 -0
  261. package/components/timeline/timeline.vue +4 -0
  262. package/components/timeline/variables.scss +1 -1
  263. package/components/timeline-item/timeline-item.vue +9 -0
  264. package/components/toast/README.md +111 -0
  265. package/components/toast/toast.vue +11 -0
  266. package/components/toast-agent/toast-agent.vue +11 -0
  267. package/components/tree/README.md +208 -0
  268. package/components/tree/tree.vue +21 -0
  269. package/components/tree/variables.scss +3 -3
  270. package/components/upload/README.md +154 -0
  271. package/components/upload/common.d.ts +1 -0
  272. package/components/upload/upload.d.ts +1 -1
  273. package/components/upload/upload.vue +67 -26
  274. package/package.json +74 -45
  275. package/use/useFormPopout.d.ts +1 -1
  276. package/use/useFormPopout.js +4 -1
  277. package/use/usePopoutInput.d.ts +2 -1
  278. package/use/usePopoutInput.js +7 -4
@@ -34,8 +34,27 @@ import SarCascader from "../cascader/cascader.vue";
34
34
  import {
35
35
  defaultCascaderPopoutProps
36
36
  } from "./common";
37
- import { isNullish } from "../../utils";
37
+ import { isEmptyBinding } from "../../utils";
38
38
  import { useFormPopout } from "../../use";
39
+ /**
40
+ * @property {string} rootClass 组件根元素类名,默认值:-。
41
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
42
+ * @property {string | number} modelValue 选中项的值,默认值:-。
43
+ * @property {CascaderOption[]} options 可选项数据源,默认值:[]。
44
+ * @property {CascaderFieldKeys} fieldKeys 自定义 `options` 中的字段,默认值:defaultFieldKeys。
45
+ * @property {string} hintText 未选中时的提示文案,默认值:'请选择'。
46
+ * @property {(option: CascaderOption) => string} labelRender 自定义可选项渲染,默认值:-。
47
+ * @property {boolean} changeOnSelect 点击每级选项都会触发变化,默认值:false。
48
+ * @property {string} popoutClass 弹窗框根元素类名,默认值:-。
49
+ * @property {StyleValue} popoutStyle 弹窗框根元素样式,默认值:-。
50
+ * @property {boolean} visible 是否显示弹出框,默认值:-。
51
+ * @property {string} title 弹出框标题,默认值:-。
52
+ * @property {boolean} showConfirm 是否显示确定按钮,隐藏按钮可用于快捷选择,默认值:true。
53
+ * @property {boolean} validateEvent 是否触发表单验证,默认值:true。
54
+ * @event {(visible: boolean) => void} update 弹出框显隐时触发
55
+ * @event {(value: string | number, selectedOptions: CascaderOption[]) => void} change 级联输入组件值改变时触发
56
+ * @event {(option: CascaderOption, tabIndex: number) => void} select 选择级联选择某一项时触发
57
+ */
39
58
  export default _defineComponent({
40
59
  components: {
41
60
  SarPopout,
@@ -74,7 +93,7 @@ export default _defineComponent({
74
93
  emit,
75
94
  {
76
95
  onChange() {
77
- if (!props.showConfirm && !isNullish(popoutValue.value)) {
96
+ if (!props.showConfirm && !isEmptyBinding(popoutValue.value)) {
78
97
  onConfirm();
79
98
  innerVisible.value = false;
80
99
  }
@@ -3,7 +3,7 @@ page,
3
3
  .sar-portal {
4
4
  --sar-check-icon-size: 1em;
5
5
  --sar-check-icon-square-border-radius: 0.15em;
6
- --sar-check-icon-border-color: var(--sar-quaternary-color);
6
+ --sar-check-icon-border-color: var(--sar-fourth-color);
7
7
 
8
8
  --sar-check-icon-disabled-color: var(--sar-disabled-color);
9
9
  --sar-check-icon-disabled-bg: var(--sar-disabled-shallow-bg);
@@ -0,0 +1,185 @@
1
+ ---
2
+ nav: 组件
3
+ title: Checkbox
4
+ subtitle: 复选框
5
+ group: 表单组件
6
+ ---
7
+
8
+ ## 介绍
9
+
10
+ 在一组可选项中进行任意选择。
11
+
12
+ ## 引入
13
+
14
+ ```ts
15
+ import Checkbox from 'sard-uniapp/components/checkbox/checkbox.vue'
16
+ import CheckboxGroup from 'sard-uniapp/components/checkbox-group/checkbox-group.vue'
17
+ ```
18
+
19
+ ## 代码演示
20
+
21
+ ### 基础使用
22
+
23
+ 使用 `checked` 属性控制是否选中。
24
+
25
+ @code('${DEMO_PATH}/checkbox/demo/Basic.vue')
26
+
27
+ ### 只读和禁用
28
+
29
+ 只读或禁用后不可点击。
30
+
31
+ @code('${DEMO_PATH}/checkbox/demo/DisabledReadOnly.vue')
32
+
33
+ ### 图标大小
34
+
35
+ 使用 `size` 属性设置图标大小。
36
+
37
+ @code('${DEMO_PATH}/checkbox/demo/Size.vue')
38
+
39
+ ### 图标颜色
40
+
41
+ 使用 `checked-color` 属性设置选中时的图标颜色。
42
+
43
+ @code('${DEMO_PATH}/checkbox/demo/Color.vue')
44
+
45
+ ### 图标类型
46
+
47
+ 设置 `type` 属性为 `circle` 可以使图标变为圆形。
48
+
49
+ @code('${DEMO_PATH}/checkbox/demo/Type.vue')
50
+
51
+ ### 自定义图标
52
+
53
+ 如果内置的图标不满足需求,可以使用 `icon` 插槽设置为任意的图标。
54
+ 插槽接收`checked`属性表示当前的选中状态。
55
+
56
+ @code('${DEMO_PATH}/checkbox/demo/Icon.vue')
57
+
58
+ ### 复选框组
59
+
60
+ 复选框组用于收集选中状态的复选框的值。
61
+
62
+ @code('${DEMO_PATH}/checkbox/demo/Group.vue')
63
+
64
+ ### 排列方向
65
+
66
+ 将 `direction` 属性设置为 `horizontal` 后,复选框组会变成水平排列。
67
+
68
+ @code('${DEMO_PATH}/checkbox/demo/Direction.vue')
69
+
70
+ ### 自动渲染复选框
71
+
72
+ 使用 `options` 属性设置可选项。
73
+
74
+ @code('${DEMO_PATH}/checkbox/demo/GroupOptions.vue')
75
+
76
+ ### 自定义 UI
77
+
78
+ 如果只想使用复选的逻辑,并想自定义 UI,可以使用复选框组的 `custom` 插槽。
79
+
80
+ 这个插槽接收 `toggle`方法和 `value` 属性作为参数。`toggle` 用于切换指定选项的选中状态,`value` 用于判断选中状态。
81
+
82
+ @code('${DEMO_PATH}/checkbox/demo/Custom1.vue')
83
+
84
+ 结合 `list` 组件使用:
85
+
86
+ @code('${DEMO_PATH}/checkbox/demo/Custom2.vue')
87
+
88
+ 复选框组里面 `checkbox` 组件,会自动判断选中状态;可以给 `checkbox` 组件添加 `readonly` 属性以便将点击操作交给其他组件。
89
+
90
+ @code('${DEMO_PATH}/checkbox/demo/Custom3.vue')
91
+
92
+ ### 不确定状态
93
+
94
+ @code('${DEMO_PATH}/checkbox/demo/Indeterminate.vue')
95
+
96
+ ## API
97
+
98
+ ### CheckboxProps
99
+
100
+ | 属性 | 描述 | 类型 | 默认值 |
101
+ | ----------------------------- | -------------------------------- | -------------------- | -------- |
102
+ | root-class | 组件根元素类名 | string | - |
103
+ | root-style | 组件根元素样式 | StyleValue | - |
104
+ | checked (v-model) | 是否选中 | boolean | false |
105
+ | indeterminate <sup>1.6+</sup> | 是否处于不确定状态 | boolean | false |
106
+ | value | 复选框的值,配合复选框组一起使用 | any | - |
107
+ | label | 复选框标签 | string | - |
108
+ | disabled | 禁用状态 | boolean | - |
109
+ | readonly | 只读状态 | boolean | - |
110
+ | size | 图标的尺寸 | string | - |
111
+ | type | 图标类型 | 'square' \| 'circle' | 'square' |
112
+ | checked-color | 选中时图标的颜色 | string | - |
113
+ | validate-event | 是否触发表单验证 | boolean | true |
114
+
115
+ ### CheckboxSlots
116
+
117
+ | 插槽 | 描述 | 属性 |
118
+ | ------- | -------------- | -------------------- |
119
+ | default | 自定义默认内容 | - |
120
+ | icon | 自定义图标 | { checked: boolean } |
121
+
122
+ ### CheckboxEmits
123
+
124
+ | 事件 | 描述 | 类型 |
125
+ | -------------- | ------------------ | -------------------------- |
126
+ | click | 点击时触发 | (event: any) => void |
127
+ | update:checked | 选中状态改变时触发 | (checked: boolean) => void |
128
+ | change | 选中状态改变时触发 | (checked: boolean) => void |
129
+
130
+ ### CheckboxGroupProps
131
+
132
+ | 属性 | 描述 | 类型 | 默认值 |
133
+ | --------------------- | ------------------------------------- | ----------------------- | -------------------------------- |
134
+ | root-class | 组件根元素类名 | string | - |
135
+ | root-style | 组件根元素样式 | StyleValue | - |
136
+ | model-value (v-model) | 指定选中的选项 | any[] | - |
137
+ | disabled | 禁用状态 | boolean | - |
138
+ | readonly | 只读状态 | boolean | - |
139
+ | size | 图标的尺寸 | string | - |
140
+ | type | 图标类型 | 'square' \| 'circle' | 'square' |
141
+ | checked-color | 选中时图标的颜色 | string | - |
142
+ | validate-event | 是否触发表单验证 | boolean | true |
143
+ | options | 自动设置复选框 | CheckboxGroupOption[] | - |
144
+ | option-keys | 自定义 options 的 label、value 的字段 | CheckboxGroupOptionKeys | {label: 'label', value: 'value'} |
145
+
146
+ ### CheckboxGroupOption
147
+
148
+ ```ts
149
+ export type CheckboxGroupOption =
150
+ | {
151
+ [key: PropertyKey]: any
152
+ }
153
+ | string
154
+ | number
155
+ | boolean
156
+ ```
157
+
158
+ ### CheckboxGroupOptionKeys
159
+
160
+ ```ts
161
+ export interface CheckboxGroupOptionKeys {
162
+ label?: string
163
+ value?: string
164
+ }
165
+ ```
166
+
167
+ ### CheckboxGroupSlots
168
+
169
+ | 插槽 | 描述 | 属性 |
170
+ | ------- | ------------------------------------------------------------------------------ | ---------------------------------------------- |
171
+ | default | 自定义默认内容 | - |
172
+ | custom | 同默认插槽,额外可以接收 `toggle` 方法切换选中状态,用于自定义复选框结构和样式 | { toggle: (value: any) => void, value: any[] } |
173
+
174
+ ### CheckboxGroupEmits
175
+
176
+ | 事件 | 描述 | 类型 |
177
+ | ------------------ | -------------------- | ---------------------- |
178
+ | update:model-value | 复选框组值改变时触发 | (value: any[]) => void |
179
+ | change | 复选框组值改变时触发 | (value: any[]) => void |
180
+
181
+ ## 主题定制
182
+
183
+ ### CSS 变量
184
+
185
+ @code('./variables.scss#variables')
@@ -25,6 +25,23 @@ import {
25
25
  } from "./common";
26
26
  import SarCheckIcon from "../check-icon/check-icon.vue";
27
27
  import { useFormContext, useFormItemContext } from "../form/common";
28
+ /**
29
+ * @property {string} rootClass 组件根元素类名,默认值:-。
30
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
31
+ * @property {boolean} checked 是否选中,默认值:false。
32
+ * @property {boolean} indeterminate 是否处于不确定状态,默认值:false。
33
+ * @property {any} value 复选框的值,配合复选框组一起使用,默认值:-。
34
+ * @property {string} label 复选框标签,默认值:-。
35
+ * @property {boolean} disabled 禁用状态,默认值:-。
36
+ * @property {boolean} readonly 只读状态,默认值:-。
37
+ * @property {string} size 图标的尺寸,默认值:-。
38
+ * @property {'square' | 'circle'} type 图标类型,默认值:'square'。
39
+ * @property {string} checkedColor 选中时图标的颜色,默认值:-。
40
+ * @property {boolean} validateEvent 是否触发表单验证,默认值:true。
41
+ * @event {(event: any) => void} click 点击时触发
42
+ * @event {(checked: boolean) => void} update 选中状态改变时触发
43
+ * @event {(checked: boolean) => void} change 选中状态改变时触发
44
+ */
28
45
  export default _defineComponent({
29
46
  components: {
30
47
  SarCheckIcon,
@@ -5,7 +5,7 @@ page,
5
5
  --sar-checkbox-group-row-gap: 16rpx;
6
6
 
7
7
  --sar-checkbox-icon-font-size: 40rpx;
8
- --sar-checkbox-icon-color: var(--sar-quaternary-color);
8
+ --sar-checkbox-icon-color: var(--sar-fourth-color);
9
9
  --sar-checkbox-icon-checked-color: var(--sar-primary);
10
10
  --sar-checkbox-icon-disabled-color: var(--sar-disabled-color);
11
11
  --sar-checkbox-icon-transition-duration: var(--sar-duration);
@@ -40,6 +40,21 @@ import {
40
40
  } from "../../utils";
41
41
  import { useFormItemContext } from "../form/common";
42
42
  import SarCheckbox from "../checkbox/checkbox.vue";
43
+ /**
44
+ * @property {string} rootClass 组件根元素类名,默认值:-。
45
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
46
+ * @property {any[]} modelValue 指定选中的选项,默认值:-。
47
+ * @property {boolean} disabled 禁用状态,默认值:-。
48
+ * @property {boolean} readonly 只读状态,默认值:-。
49
+ * @property {string} size 图标的尺寸,默认值:-。
50
+ * @property {'square' | 'circle'} type 图标类型,默认值:'square'。
51
+ * @property {string} checkedColor 选中时图标的颜色,默认值:-。
52
+ * @property {boolean} validateEvent 是否触发表单验证,默认值:true。
53
+ * @property {CheckboxGroupOption[]} options 自动设置复选框,默认值:-。
54
+ * @property {CheckboxGroupOptionKeys} optionKeys 自定义 options 的 label、value 的字段,默认值:{label: 'label', value: 'value'}。
55
+ * @event {(value: any[]) => void} update 复选框组值改变时触发
56
+ * @event {(value: any[]) => void} change 复选框组值改变时触发
57
+ */
43
58
  export default _defineComponent({
44
59
  components: {
45
60
  SarCheckbox,
@@ -0,0 +1,44 @@
1
+ ---
2
+ nav: 组件
3
+ title: CheckboxInput
4
+ subtitle: 复选输入框
5
+ group: 表单组件
6
+ version: 1.3+
7
+ ---
8
+
9
+ ## 介绍
10
+
11
+ 组合了复选弹出框、列表、输入框组件,实现了在弹出框中多选的功能。
12
+
13
+ ## 引入
14
+
15
+ ```ts
16
+ import CheckboxInput from 'sard-uniapp/components/checkbox-input/checkbox-input.vue'
17
+ ```
18
+
19
+ ## 代码演示
20
+
21
+ ### 基础使用
22
+
23
+ 通过 `title` 和 `placeholder` 属性设置弹出框标题和输入框占位文本,
24
+ 通过 `options` 属性设置可选项。
25
+
26
+ @code('${DEMO_PATH}/checkbox-input/demo/Basic.vue')
27
+
28
+ ## API
29
+
30
+ ### CheckboxInputProps
31
+
32
+ 继承 [`CheckboxPopoutProps`](./checkbox-popout#CheckboxPopoutProps) 并有以下额外属性:
33
+
34
+ | 属性 | 描述 | 类型 | 默认值 |
35
+ | --------------------------------- | ---------------------- | ---------- | --------------- |
36
+ | root-class | 弹出式输入框根元素类名 | string | - |
37
+ | root-style | 弹出式输入框根元素样式 | StyleValue | - |
38
+ | clearable | 是否显示清空按钮 | boolean | false |
39
+ | placeholder | 输入框占位符内容 | string | - |
40
+ | value-on-clear <sup>1.19.2+</sup> | 设置点击清除按钮后的值 | () => any | () => undefined |
41
+
42
+ ### CheckboxInputEmits
43
+
44
+ 继承 [`CheckboxPopoutEmits`](./checkbox-popout#CheckboxPopoutEmits)
@@ -9,6 +9,7 @@ declare const _default: import("vue").DefineComponent<CheckboxInputProps, {}, {}
9
9
  "onUpdate:visible"?: ((visible: boolean) => any) | undefined;
10
10
  }>, {
11
11
  options: import("../checkbox/common").CheckboxGroupOption[];
12
+ valueOnClear: () => any;
12
13
  validateEvent: boolean;
13
14
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
15
  export default _default;
@@ -40,8 +40,30 @@ import {
40
40
  import {
41
41
  defaultCheckboxInputProps
42
42
  } from "./common";
43
- import { getMayPrimitiveOption, isNullish } from "../../utils";
43
+ import { getMayPrimitiveOption, isEmptyBinding } from "../../utils";
44
44
  import { usePopoutInput } from "../../use";
45
+ /**
46
+ * @property {string} rootClass 弹出式输入框根元素类名,默认值:-。
47
+ * @property {StyleValue} rootStyle 弹出式输入框根元素样式,默认值:-。
48
+ * @property {any[]} modelValue 指定选中的选项,默认值:-。
49
+ * @property {boolean} disabled 禁用状态,默认值:-。
50
+ * @property {boolean} readonly 只读状态,默认值:-。
51
+ * @property {string} size 图标的尺寸,默认值:-。
52
+ * @property {'square' | 'circle'} type 图标类型,默认值:'square'。
53
+ * @property {string} checkedColor 选中时图标的颜色,默认值:-。
54
+ * @property {boolean} validateEvent 是否触发表单验证,默认值:true。
55
+ * @property {CheckboxGroupOption[]} options 自动设置复选框,默认值:-。
56
+ * @property {CheckboxGroupOptionKeys} optionKeys 自定义 options 的 label、value 的字段,默认值:{label: 'label', value: 'value'}。
57
+ * @property {string} popoutClass 弹窗框根元素类名,默认值:-。
58
+ * @property {StyleValue} popoutStyle 弹窗框根元素样式,默认值:-。
59
+ * @property {boolean} visible 是否显示弹出框,默认值:-。
60
+ * @property {string} title 弹出框标题,默认值:-。
61
+ * @property {boolean} clearable 是否显示清空按钮,默认值:false。
62
+ * @property {string} placeholder 输入框占位符内容,默认值:-。
63
+ * @property {() => any} valueOnClear 设置点击清除按钮后的值,默认值:() => undefined。
64
+ * @event {(visible: boolean) => void} update 弹出框显隐时触发
65
+ * @event {(value: any[] | undefined) => void} change 复选输入组件值改变时触发
66
+ */
45
67
  export default _defineComponent({
46
68
  components: {
47
69
  SarPopoutInput,
@@ -55,6 +77,7 @@ export default _defineComponent({
55
77
  },
56
78
  __name: "checkbox-input",
57
79
  props: _mergeDefaults({
80
+ valueOnClear: { type: Function, required: false },
58
81
  visible: { type: Boolean, required: false },
59
82
  title: { type: String, required: false },
60
83
  popoutClass: { type: String, required: false },
@@ -91,7 +114,7 @@ export default _defineComponent({
91
114
  ).map((option) => getMayPrimitiveOption(option, optionKeys.label)).join(", ");
92
115
  }
93
116
  function getInputValue() {
94
- if (isNullish(innerValue.value) || innerValue.value.length === 0) {
117
+ if (isEmptyBinding(innerValue.value) || Array.isArray(innerValue.value) && innerValue.value.length === 0) {
95
118
  return "";
96
119
  }
97
120
  return getOutletText(props.options, fieldKeys.value, innerValue.value);
@@ -3,8 +3,10 @@ import { type PopoutInputProps } from '../popout-input/common';
3
3
  import { type CheckboxPopoutEmits, type CheckboxPopoutProps } from '../checkbox-popout/common';
4
4
  export type CheckboxInputOption = CheckboxGroupOption;
5
5
  export interface CheckboxInputProps extends CheckboxPopoutProps, Omit<PopoutInputProps, 'modelValue'> {
6
+ valueOnClear?: () => any;
6
7
  }
7
8
  export declare const defaultCheckboxInputProps: () => {
9
+ valueOnClear: CheckboxInputProps["valueOnClear"];
8
10
  options: () => never[];
9
11
  validateEvent: boolean;
10
12
  };
@@ -1,2 +1,6 @@
1
1
  import { defaultCheckboxPopoutProps, } from '../checkbox-popout/common';
2
- export const defaultCheckboxInputProps = defaultCheckboxPopoutProps;
2
+ import { defaultConfig } from '../config';
3
+ export const defaultCheckboxInputProps = () => ({
4
+ ...defaultCheckboxPopoutProps(),
5
+ ...defaultConfig.checkboxInput,
6
+ });
@@ -0,0 +1,52 @@
1
+ ---
2
+ nav: 组件
3
+ title: CheckboxPopout
4
+ subtitle: 复选弹出框
5
+ group: 表单组件
6
+ version: 1.16+
7
+ ---
8
+
9
+ ## 介绍
10
+
11
+ 组合了复选框组、列表、弹出框组件,实现了在弹出框中多选的功能。
12
+
13
+ ## 引入
14
+
15
+ ```ts
16
+ import CheckboxPopout from 'sard-uniapp/components/checkbox-popout/checkbox-popout.vue'
17
+ ```
18
+
19
+ ## 代码演示
20
+
21
+ ### 基础使用
22
+
23
+ 使用 `v-model` 双向绑定当前值,使用 `v-model:visible` 控制弹出框显隐。
24
+
25
+ @code('${DEMO_PATH}/checkbox-popout/demo/Basic.vue')
26
+
27
+ ## API
28
+
29
+ ### CheckboxPopoutProps
30
+
31
+ 继承 [`CheckboxGroupProps`](./checkbox#CheckboxGroupProps) 并有以下额外属性:
32
+
33
+ | 属性 | 描述 | 类型 | 默认值 |
34
+ | ----------------- | ---------------- | ---------- | ------ |
35
+ | popout-class | 弹窗框根元素类名 | string | - |
36
+ | popout-style | 弹窗框根元素样式 | StyleValue | - |
37
+ | visible (v-model) | 是否显示弹出框 | boolean | - |
38
+ | title | 弹出框标题 | string | - |
39
+
40
+ ### CheckboxPopoutEmits
41
+
42
+ | 事件 | 描述 | 类型 |
43
+ | ------------------------ | ------------------------ | ----------------------------------- |
44
+ | update:model-value | 复选输入组件值改变时触发 | (value: any[] \| undefined) => void |
45
+ | change <sup>1.9.2+</sup> | 复选输入组件值改变时触发 | (value: any[] \| undefined) => void |
46
+ | update:visible | 弹出框显隐时触发 | (visible: boolean) => void |
47
+
48
+ ## 主题定制
49
+
50
+ ### CSS 变量
51
+
52
+ @code('./variables.scss#variables')
@@ -70,6 +70,25 @@ import {
70
70
  } from "./common";
71
71
  import { useScrollSide, useFormPopout } from "../../use";
72
72
  import { defaultOptionKeys } from "../checkbox/common";
73
+ /**
74
+ * @property {string} rootClass 组件根元素类名,默认值:-。
75
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
76
+ * @property {any[]} modelValue 指定选中的选项,默认值:-。
77
+ * @property {boolean} disabled 禁用状态,默认值:-。
78
+ * @property {boolean} readonly 只读状态,默认值:-。
79
+ * @property {string} size 图标的尺寸,默认值:-。
80
+ * @property {'square' | 'circle'} type 图标类型,默认值:'square'。
81
+ * @property {string} checkedColor 选中时图标的颜色,默认值:-。
82
+ * @property {boolean} validateEvent 是否触发表单验证,默认值:true。
83
+ * @property {CheckboxGroupOption[]} options 自动设置复选框,默认值:-。
84
+ * @property {CheckboxGroupOptionKeys} optionKeys 自定义 options 的 label、value 的字段,默认值:{label: 'label', value: 'value'}。
85
+ * @property {string} popoutClass 弹窗框根元素类名,默认值:-。
86
+ * @property {StyleValue} popoutStyle 弹窗框根元素样式,默认值:-。
87
+ * @property {boolean} visible 是否显示弹出框,默认值:-。
88
+ * @property {string} title 弹出框标题,默认值:-。
89
+ * @event {(visible: boolean) => void} update 弹出框显隐时触发
90
+ * @event {(value: any[] | undefined) => void} change 复选输入组件值改变时触发
91
+ */
73
92
  export default _defineComponent({
74
93
  components: {
75
94
  SarPopout,
@@ -11,6 +11,13 @@ import {
11
11
  rowSymbol
12
12
  } from "../layout/common";
13
13
  import { classNames, stringifyStyle, createBem } from "../../utils";
14
+ /**
15
+ * @property {string} rootClass 组件根元素类名,默认值:-。
16
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
17
+ * @property {number | 'auto' | 'none'} span 列元素宽度,默认值:-。
18
+ * @property {number} offset 列元素偏移距离,默认值:-。
19
+ * @property {number} order 列元素顺序,默认值:-。
20
+ */
14
21
  export default _defineComponent({
15
22
  ...{
16
23
  options: {
@@ -0,0 +1,45 @@
1
+ ---
2
+ nav: 组件
3
+ title: Collapse
4
+ subtitle: 折叠
5
+ group: 数据展示
6
+ ---
7
+
8
+ ## 介绍
9
+
10
+ 可以展开/折叠内容区域。
11
+
12
+ ## 引入
13
+
14
+ ```ts
15
+ import Collapse from 'sard-uniapp/components/collapse/collapse.vue'
16
+ ```
17
+
18
+ ## 代码演示
19
+
20
+ ### 基础使用
21
+
22
+ 折叠组件是其他可折叠组件的基础组件。
23
+ 使用 `visible` 属性控制折叠框展开或折叠。
24
+
25
+ @code('${DEMO_PATH}/collapse/demo/Basic.vue')
26
+
27
+ ## API
28
+
29
+ ### CollapseProps
30
+
31
+ | 属性 | 描述 | 类型 | 默认值 |
32
+ | ------- | -------- | ------- | ------ |
33
+ | visible | 是否可见 | boolean | false |
34
+
35
+ ### CollapseSlots
36
+
37
+ | 插槽 | 描述 | 属性 |
38
+ | ------- | -------------- | ---- |
39
+ | default | 自定义默认内容 | - |
40
+
41
+ ## 主题定制
42
+
43
+ ### CSS 变量
44
+
45
+ @code('./variables.scss#variables')
@@ -24,6 +24,9 @@ import {
24
24
  uniqid,
25
25
  getBoundingClientRect
26
26
  } from "../../utils";
27
+ /**
28
+ * @property {boolean} visible 是否可见,默认值:false。
29
+ */
27
30
  export default _defineComponent({
28
31
  ...{
29
32
  options: {