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
@@ -0,0 +1,82 @@
1
+ ---
2
+ nav: 组件
3
+ title: SwipeAction
4
+ subtitle: 滑动操作
5
+ group: 反馈组件
6
+ version: 1.19+
7
+ ---
8
+
9
+ ## 介绍
10
+
11
+ 可以左右滑动来展示操作按钮。
12
+
13
+ ## 引入
14
+
15
+ ```ts
16
+ import SwipeAction from 'sard-uniapp/components/swipe-action/swipe-action.vue'
17
+ ```
18
+
19
+ ## 代码演示
20
+
21
+ ### 基础使用
22
+
23
+ 使用 `left`、`right` 插槽向左右两边添加操作按钮。
24
+
25
+ 插槽接收 `hide` 方法来隐藏操作按钮。
26
+
27
+ @code('${DEMO_PATH}/swipe-action/demo/Basic.vue')
28
+
29
+ ### 控制显隐
30
+
31
+ 使用 `v-model:visible` 属性控制显隐。
32
+
33
+ @code('${DEMO_PATH}/swipe-action/demo/Visible.vue')
34
+
35
+ ### 禁止滑动
36
+
37
+ 使用 `disabled` 属性来禁用滑动,同时也会禁用点击内容区域隐藏。
38
+
39
+ @code('${DEMO_PATH}/swipe-action/demo/Visible.vue')
40
+
41
+ ### 异步关闭
42
+
43
+ 插槽按钮可任意定制;利用好 `hide` 方法和 `disabled` 属性,可实现复杂的效果。
44
+
45
+ @code('${DEMO_PATH}/swipe-action/demo/Async.vue')
46
+
47
+ ### 结合表单使用
48
+
49
+ 下面演示了滑动操作组件如何与表单组件一起使用。
50
+
51
+ @code('${DEMO_PATH}/swipe-action/demo/Form.vue')
52
+
53
+ ## API
54
+
55
+ ### SwipeActionProps
56
+
57
+ | 属性 | 描述 | 类型 | 默认值 |
58
+ | ----------------- | -------------- | -------------------------- | ------ |
59
+ | root-class | 组件根元素类名 | string | - |
60
+ | root-style | 组件根元素样式 | StyleValue | - |
61
+ | disabled | 是否禁用滑动 | boolean | false |
62
+ | visible (v-model) | 控制显隐 | 'left' \| 'right' \| false | false |
63
+
64
+ ### SwipeActionSlots
65
+
66
+ | 插槽 | 描述 | 属性 |
67
+ | ------- | ------------------ | -------------------- |
68
+ | default | 自定义默认内容 | - |
69
+ | left | 自定义左边操作按钮 | { hide: () => void } |
70
+ | right | 自定义右边操作按钮 | { hide: () => void } |
71
+
72
+ ### SwipeActionEmits
73
+
74
+ | 事件 | 描述 | 类型 |
75
+ | -------------- | ------------------ | --------------------------------------------- |
76
+ | update:visible | 操作按钮显隐时触发 | (visible: 'left' \| 'right' \| false) => void |
77
+
78
+ ### SwipeActionExpose
79
+
80
+ | 属性 | 描述 | 类型 |
81
+ | ---- | ------------ | ---------- |
82
+ | hide | 隐藏操作按钮 | () => void |
@@ -44,6 +44,13 @@ import {
44
44
  getBoundingClientRect
45
45
  } from "../../utils";
46
46
  import { useMouseDown, useInitialVelocity, useStopMovedClick } from "../../use";
47
+ /**
48
+ * @property {string} rootClass 组件根元素类名,默认值:-。
49
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
50
+ * @property {boolean} disabled 是否禁用滑动,默认值:false。
51
+ * @property {'left' | 'right' | false} visible 控制显隐,默认值:false。
52
+ * @event {(visible: 'left' | 'right' | false) => void} update 操作按钮显隐时触发
53
+ */
47
54
  export default _defineComponent({
48
55
  ...{
49
56
  options: {
@@ -0,0 +1,45 @@
1
+ ---
2
+ nav: 组件
3
+ title: SwiperDot
4
+ subtitle: 轮播图指示点
5
+ group: 数据展示
6
+ ---
7
+
8
+ ## 介绍
9
+
10
+ 自定义轮播图指示点。
11
+
12
+ ## 引入
13
+
14
+ ```ts
15
+ import SwiperDot from 'sard-uniapp/components/swiper-dot/swiper-dot.vue'
16
+ ```
17
+
18
+ ## 代码演示
19
+
20
+ ### 基础使用
21
+
22
+ 使用一个相对定位的容器包裹轮播图组件和轮播图指示点组件,
23
+ 使用 `current` 属性设置活动指示点,使用 `type` 属性设置指示点类型,使用 `total` 属性设置指示点总数或者使用 `list` 属性设置指示文本(用于 `title` 类型)。
24
+
25
+ @code('${DEMO_PATH}/swiper-dot/demo/Basic.vue')
26
+
27
+ ## API
28
+
29
+ ### SwiperDotProps
30
+
31
+ | 属性 | 描述 | 类型 | 默认值 |
32
+ | ---------- | ------------------------------------ | ------------------------------------------------------ | ------- |
33
+ | root-class | 组件根元素类名 | string | - |
34
+ | root-style | 组件根元素样式 | StyleValue | - |
35
+ | type | 指示点类型 | 'dot' \| 'dot-bar' \| 'index' \| 'title' \| 'fraction' | 'dot' |
36
+ | current | 当前指示点索引 | number | 0 |
37
+ | total | 指示点总数 | number | 0 |
38
+ | list | 用于 `title` 类型的文本数据 | any[] | - |
39
+ | field | `type` 为 `title` 时,显示的内容字段 | string | 'title' |
40
+
41
+ ## 主题定制
42
+
43
+ ### CSS 变量
44
+
45
+ @code('./variables.scss#variables')
@@ -28,6 +28,15 @@ import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent }
28
28
  import { computed } from "vue";
29
29
  import { classNames, stringifyStyle, createBem } from "../../utils";
30
30
  import { defaultSwiperDotProps } from "./common";
31
+ /**
32
+ * @property {string} rootClass 组件根元素类名,默认值:-。
33
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
34
+ * @property {'dot' | 'dot-bar' | 'index' | 'title' | 'fraction'} type 指示点类型,默认值:'dot'。
35
+ * @property {number} current 当前指示点索引,默认值:0。
36
+ * @property {number} total 指示点总数,默认值:0。
37
+ * @property {any[]} list 用于 `title` 类型的文本数据,默认值:-。
38
+ * @property {string} field `type` 为 `title` 时,显示的内容字段,默认值:'title'。
39
+ */
31
40
  export default _defineComponent({
32
41
  ...{
33
42
  options: {
@@ -0,0 +1,89 @@
1
+ ---
2
+ nav: 组件
3
+ title: Switch
4
+ subtitle: 开关
5
+ group: 表单组件
6
+ ---
7
+
8
+ ## 介绍
9
+
10
+ 用于打开/关闭两种状态间的切换。
11
+
12
+ ## 引入
13
+
14
+ ```ts
15
+ import Switch from 'sard-uniapp/components/switch/switch.vue'
16
+ ```
17
+
18
+ ## 代码演示
19
+
20
+ ### 基础使用
21
+
22
+ 通过 `v-model` 绑定开关的选中状态,`true` 表示开,`false` 表示关。
23
+
24
+ @code('${DEMO_PATH}/switch/demo/Basic.vue')
25
+
26
+ ### 自定义尺寸
27
+
28
+ 使用 `size` 属性设置开关尺寸。
29
+
30
+ @code('${DEMO_PATH}/switch/demo/Size.vue')
31
+
32
+ ### 自定义颜色
33
+
34
+ 使用 `checkedColor` 属性设置打开时的颜色,使用 `uncheckedColor` 属性设置关闭时的颜色。
35
+
36
+ @code('${DEMO_PATH}/switch/demo/Color.vue')
37
+
38
+ ### 不同状态的值
39
+
40
+ 可以设置 `checkedValue` 和 `uncheckedValue` 属性代替默认的 `true` 和 `false`。
41
+
42
+ @code('${DEMO_PATH}/switch/demo/Value.vue')
43
+
44
+ ### 只读和禁用
45
+
46
+ 只读或禁用时不可操作。
47
+
48
+ @code('${DEMO_PATH}/switch/demo/DisabledReadOnly.vue')
49
+
50
+ ### 加载状态
51
+
52
+ 当提供 `beforeUpdate` 函数,会在 `fulfilled` 状态后才切换,期间显示加载状态。
53
+
54
+ @code('${DEMO_PATH}/switch/demo/Loading.vue')
55
+
56
+ ## API
57
+
58
+ ### SwitchProps
59
+
60
+ | 属性 | 描述 | 类型 | 默认值 |
61
+ | --------------------- | ---------------- | ----------------------------- | ------ |
62
+ | root-class | 组件根元素类名 | string | - |
63
+ | root-style | 组件根元素样式 | StyleValue | - |
64
+ | model-value (v-model) | 开关选中状态 | any | - |
65
+ | disabled | 禁用状态 | boolean | false |
66
+ | readonly | 只读状态 | boolean | false |
67
+ | loading (v-model) | 加载状态 | boolean | - |
68
+ | size | 开关大小 | string | - |
69
+ | checked-color | 开启时的颜色 | string | - |
70
+ | unchecked-color | 关闭时的颜色 | string | - |
71
+ | checked-value | 开启时的值 | any | true |
72
+ | unchecked-value | 关闭时的值 | any | false |
73
+ | before-update | 用于异步切换 | (value: any) => Promise\<any> | - |
74
+ | validate-event | 是否触发表单验证 | boolean | true |
75
+
76
+ ### SwitchEmits
77
+
78
+ | 事件 | 描述 | 类型 |
79
+ | ------------------------ | -------------------------------------- | -------------------------- |
80
+ | click | 点击按钮时触发,加载和禁用状态不会触发 | (event: any) => void |
81
+ | update:model-value | 开关状态切换时触发 | (value: any) => void |
82
+ | change <sup>1.9.2+</sup> | 开关状态切换时触发 | (value: any) => void |
83
+ | update:loading | 加载状态切换时触发 | (loading: boolean) => void |
84
+
85
+ ## 主题定制
86
+
87
+ ### CSS 变量
88
+
89
+ @code('./variables.scss#variables')
@@ -15,6 +15,24 @@ import { useFormContext, useFormItemContext } from "../form/common";
15
15
  import {
16
16
  defaultSwitchProps
17
17
  } from "./common";
18
+ /**
19
+ * @property {string} rootClass 组件根元素类名,默认值:-。
20
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
21
+ * @property {any} modelValue 开关选中状态,默认值:-。
22
+ * @property {boolean} disabled 禁用状态,默认值:false。
23
+ * @property {boolean} readonly 只读状态,默认值:false。
24
+ * @property {boolean} loading 加载状态,默认值:-。
25
+ * @property {string} size 开关大小,默认值:-。
26
+ * @property {string} checkedColor 开启时的颜色,默认值:-。
27
+ * @property {string} uncheckedColor 关闭时的颜色,默认值:-。
28
+ * @property {any} checkedValue 开启时的值,默认值:true。
29
+ * @property {any} uncheckedValue 关闭时的值,默认值:false。
30
+ * @property {(value: any) => Promise\<any>} beforeUpdate 用于异步切换,默认值:-。
31
+ * @property {boolean} validateEvent 是否触发表单验证,默认值:true。
32
+ * @event {(event: any) => void} click 点击按钮时触发,加载和禁用状态不会触发
33
+ * @event {(loading: boolean) => void} update 加载状态切换时触发
34
+ * @event {(value: any) => void} change 开关状态切换时触发
35
+ */
18
36
  export default _defineComponent({
19
37
  components: {
20
38
  SarLoading,
@@ -21,6 +21,14 @@ import {
21
21
  tabContextSymbol
22
22
  } from "../tabs/common";
23
23
  import { getBoundingClientRect } from "../../utils";
24
+ /**
25
+ * @property {string} rootClass 组件根元素类名,默认值:-。
26
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
27
+ * @property {string} title 标签显示的标题,默认值:-。
28
+ * @property {string | number| boolean} name 标签的唯一标识,默认为对应的下标,使用标签组件时要手动指定,默认值:-。
29
+ * @property {boolean} disabled 是否禁用标签,默认值:false。
30
+ * @event {(event: any) => void} click 点击标签时触发,不论是否禁用
31
+ */
24
32
  export default _defineComponent({
25
33
  ...{
26
34
  options: {
@@ -0,0 +1,111 @@
1
+ ---
2
+ nav: 组件
3
+ title: Tabbar
4
+ subtitle: 标签栏
5
+ group: 导航组件
6
+ ---
7
+
8
+ ## 介绍
9
+
10
+ 固定在页面底部的导航栏,用于切换不同的页面。
11
+
12
+ ## 引入
13
+
14
+ ```ts
15
+ import Tabbar from 'sard-uniapp/components/tabbar/tabbar.vue'
16
+ import TabbarItem from 'sard-uniapp/components/tabbar-item/tabbar-item.vue'
17
+ ```
18
+
19
+ ## 代码演示
20
+
21
+ ### 基础使用
22
+
23
+ 使用 `current` 属性控制选中的标签。
24
+
25
+ @code('${DEMO_PATH}/tabbar/demo/Basic.vue')
26
+
27
+ ### 自定义图标
28
+
29
+ 通过 `icon` 属性自定义图标。
30
+
31
+ @code('${DEMO_PATH}/tabbar/demo/Icon.vue')
32
+
33
+ ### 自定义颜色
34
+
35
+ 使用 `color` 属性设置未选中标签的颜色。
36
+ 使用 `activeColor` 属性设置选中标签的颜色。
37
+
38
+ @code('${DEMO_PATH}/tabbar/demo/Color.vue')
39
+
40
+ ### 徽标
41
+
42
+ 使用 `badge` 属性设置徽标。
43
+
44
+ @code('${DEMO_PATH}/tabbar/demo/Badge.vue')
45
+
46
+ ### 中间鼓起
47
+
48
+ 通过覆盖默认插槽自定义标签结构和样式。
49
+
50
+ @code('${DEMO_PATH}/tabbar/demo/Bulge.vue')
51
+
52
+ ## API
53
+
54
+ ### TabbarProps
55
+
56
+ | 属性 | 描述 | 类型 | 默认值 |
57
+ | --------------------------------------- | -------------------------- | ---------------- | ------ |
58
+ | root-class | 组件根元素类名 | string | - |
59
+ | root-style | 组件根元素样式 | StyleValue | - |
60
+ | current (v-model) | 当前选中标签的 `name` 属性 | number \| string | - |
61
+ | color | 未选中标签的颜色 | string | - |
62
+ | active-color | 选中标签的颜色 | string | - |
63
+ | bordered | 是否显示外边框 | boolean | true |
64
+ | fixed <sup>1.16+</sup> | 是否固定到页面底部 | boolean | false |
65
+ | safe-area-inset-bottom <sup>1.16+</sup> | 是否开启底部安全区适配 | boolean | false |
66
+
67
+ ### TabbarSlots
68
+
69
+ | 插槽 | 描述 | 属性 |
70
+ | ------- | -------------- | ---- |
71
+ | default | 自定义默认内容 | - |
72
+
73
+ ### TabbarEmits
74
+
75
+ | 事件 | 描述 | 类型 |
76
+ | ----------------------- | -------------- | -------------------------------- |
77
+ | update:current | 切换标签时触发 | (name: number \| string) => void |
78
+ | change <sup>1.12+</sup> | 切换标签时触发 | (name: number \| string) => void |
79
+
80
+ ### TabbarItemProps
81
+
82
+ | 属性 | 描述 | 类型 | 默认值 |
83
+ | ----------- | ---------------- | ---------------- | ------ |
84
+ | root-class | 组件根元素类名 | string | - |
85
+ | root-style | 组件根元素样式 | StyleValue | - |
86
+ | name | 标签唯一标识符 | string \| number | - |
87
+ | text | 要显示的标签文本 | string | - |
88
+ | icon | 图标名称 | string | - |
89
+ | icon-family | 图标字体 | string | - |
90
+ | icon-size | 图标大小 | string | - |
91
+ | badge | 显示的徽标值 | number \| string | - |
92
+ | dot | 是否显示小红点 | boolean | - |
93
+
94
+ ### TabbarItemSlots
95
+
96
+ | 插槽 | 描述 | 属性 |
97
+ | ------- | -------------- | ----------------- |
98
+ | default | 自定义文本内容 | - |
99
+ | icon | 自定义图标 | {active: boolean} |
100
+
101
+ ### TabbarItemEmits
102
+
103
+ | 事件 | 描述 | 类型 |
104
+ | ----- | -------------- | -------------------- |
105
+ | click | 点击标签时触发 | (event: any) => void |
106
+
107
+ ## 主题定制
108
+
109
+ ### CSS 变量
110
+
111
+ @code('./variables.scss#variables')
@@ -12,6 +12,18 @@ import {
12
12
  tabbarContextSymbol,
13
13
  defaultTabbarProps
14
14
  } from "./common";
15
+ /**
16
+ * @property {string} rootClass 组件根元素类名,默认值:-。
17
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
18
+ * @property {number | string} current 当前选中标签的 `name` 属性,默认值:-。
19
+ * @property {string} color 未选中标签的颜色,默认值:-。
20
+ * @property {string} activeColor 选中标签的颜色,默认值:-。
21
+ * @property {boolean} bordered 是否显示外边框,默认值:true。
22
+ * @property {boolean} fixed 是否固定到页面底部,默认值:false。
23
+ * @property {boolean} safeAreaInsetBottom 是否开启底部安全区适配,默认值:false。
24
+ * @event {(name: number | string) => void} update 切换标签时触发
25
+ * @event {(name: number | string) => void} change 切换标签时触发
26
+ */
15
27
  export default _defineComponent({
16
28
  ...{
17
29
  options: {
@@ -23,6 +23,18 @@ import {
23
23
  } from "../tabbar/common";
24
24
  import SarIcon from "../icon/icon.vue";
25
25
  import SarBadge from "../badge/badge.vue";
26
+ /**
27
+ * @property {string} rootClass 组件根元素类名,默认值:-。
28
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
29
+ * @property {string | number} name 标签唯一标识符,默认值:-。
30
+ * @property {string} text 要显示的标签文本,默认值:-。
31
+ * @property {string} icon 图标名称,默认值:-。
32
+ * @property {string} iconFamily 图标字体,默认值:-。
33
+ * @property {string} iconSize 图标大小,默认值:-。
34
+ * @property {number | string} badge 显示的徽标值,默认值:-。
35
+ * @property {boolean} dot 是否显示小红点,默认值:-。
36
+ * @event {(event: any) => void} click 点击标签时触发
37
+ */
26
38
  export default _defineComponent({
27
39
  components: {
28
40
  SarIcon,
@@ -0,0 +1,41 @@
1
+ ---
2
+ nav: 组件
3
+ title: TabbarPit
4
+ subtitle: 标签栏占位
5
+ group: 导航组件
6
+ version: 1.16+
7
+ ---
8
+
9
+ ## 介绍
10
+
11
+ 配合Tabbar组件使用,用于占位。
12
+
13
+ ## 引入
14
+
15
+ ```ts
16
+ import TabbarPit from 'sard-uniapp/components/tabbar-pit/tabbar-pit.vue'
17
+ ```
18
+
19
+ ## 代码演示
20
+
21
+ ### 基础使用
22
+
23
+ 在页面放置,即可占据一个和 `Tabbar` 组件高度一致的坑。
24
+
25
+ @code('${DEMO_PATH}/tabbar-pit/demo/Basic.vue')
26
+
27
+ ### 底部安全距离
28
+
29
+ 如果要撑开一个 `Tabbar` 高度 + `env(safe-area-inset-bottom)`,可以设置 `safe-area-inset-bottom` 属性。
30
+
31
+ @code('${DEMO_PATH}/tabbar-pit/demo/SafeAreaInsetBottom.vue')
32
+
33
+ ## API
34
+
35
+ ### TabbarPitProps
36
+
37
+ | 属性 | 描述 | 类型 | 默认值 |
38
+ | ---------------------- | ---------------------- | ---------- | ------ |
39
+ | root-class | 组件根元素类名 | string | - |
40
+ | root-style | 组件根元素样式 | StyleValue | - |
41
+ | safe-area-inset-bottom | 是否开启底部安全区适配 | boolean | false |
@@ -8,6 +8,11 @@
8
8
  import { defineComponent as _defineComponent } from "vue";
9
9
  import { computed } from "vue";
10
10
  import { classNames, stringifyStyle, createBem } from "../../utils";
11
+ /**
12
+ * @property {string} rootClass 组件根元素类名,默认值:-。
13
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
14
+ * @property {boolean} safeAreaInsetBottom 是否开启底部安全区适配,默认值:false。
15
+ */
11
16
  export default _defineComponent({
12
17
  ...{
13
18
  options: {
@@ -0,0 +1,162 @@
1
+ ---
2
+ nav: 组件
3
+ title: Table
4
+ subtitle: 表格
5
+ group: 数据展示
6
+ version: 1.9+
7
+ ---
8
+
9
+ ## 介绍
10
+
11
+ 用于展示多条结构类似的数据。
12
+
13
+ ## 引入
14
+
15
+ ```ts
16
+ import Table from 'sard-uniapp/components/table/table.vue'
17
+ import TableRow from 'sard-uniapp/components/table-row/table-row.vue'
18
+ import TableCell from 'sard-uniapp/components/table-cell/table-cell.vue'
19
+ ```
20
+
21
+ ## 代码演示
22
+
23
+ ### 基础使用
24
+
25
+ 表格组件是通过 `flex` 布局实现的,`sar-table-row` 组件表示一行,`sar-table-cell` 组件表示一个单元格。
26
+ 给 `sar-table-cell` 组件设置 `bold` 属性进行加粗以表示表头。
27
+
28
+ @code('${DEMO_PATH}/table/demo/Basic.vue')
29
+
30
+ `data.ts`
31
+
32
+ @code('${DEMO_PATH}/table/demo/data.ts')
33
+
34
+ ### 边框
35
+
36
+ 给 `sar-table` 组件添加 `bordered` 属性可以设置单元格的边框。
37
+
38
+ @code('${DEMO_PATH}/table/demo/Border.vue')
39
+
40
+ ### 下边框
41
+
42
+ 给 `sar-table` 组件添加 `underline` 属性可以设置单元格的下边框。
43
+
44
+ @code('${DEMO_PATH}/table/demo/Underline.vue')
45
+
46
+ ### 有条纹的
47
+
48
+ 可以自由的给 `sar-table-row` 组件添加背景色。
49
+
50
+ @code('${DEMO_PATH}/table/demo/Striped.vue')
51
+
52
+ ### 单元格条纹
53
+
54
+ 也可以自由的给其他元素添加背景色来定制样式。
55
+
56
+ @code('${DEMO_PATH}/table/demo/CellStriped.vue')
57
+
58
+ ### 自定义宽度
59
+
60
+ 因为表格组件是通过 `flex` 布局实现的,因此需要给同一列的单元格设置相同的宽度以便上下的单元格宽度可以对齐。
61
+
62
+ 通过 `sar-table-cell` 组件的 `width` 属性可以设置任意宽度。可以是带有单位的,也可以不带有单位,但需要注意的是,要么全部带有单位,要么全部不带有单位,内部会使用 `parseFloat()` 将宽度值转换为 `flex-grow` 属性的值,以便在任意宽度屏幕上等比平分空间。
63
+
64
+ @code('${DEMO_PATH}/table/demo/Width.vue')
65
+
66
+ ### 固定表头
67
+
68
+ 给 `sar-table` 组件设置 `height` 属性,并给第一个 `sar-table-row` 组件设置 `fixed` 属性即可将其固定到表格的顶部。
69
+
70
+ @code('${DEMO_PATH}/table/demo/FixedHeader.vue')
71
+
72
+ ### 固定列
73
+
74
+ 给 `sar-table-cell` 组件设置 `fixed` 或 `fixed="left"` 属性可以将其固定在左边,设置 `fixed="right"` 可以将其固定在右边。
75
+
76
+ @code('${DEMO_PATH}/table/demo/FixedColumn.vue')
77
+
78
+ ### 固定表头和列
79
+
80
+ 可以同时固定表头和列。
81
+
82
+ @code('${DEMO_PATH}/table/demo/Fixed.vue')
83
+
84
+ ### 满屏表格
85
+
86
+ 可以使用 `calc()` 函数、`--window-top` 导航高度变量、`vh` 相对视窗单位来设置表格的高度以实现满屏的表格效果。
87
+
88
+ @code('${DEMO_PATH}/table/demo/FullScreen.vue')
89
+
90
+ `level-data.ts`
91
+
92
+ @code('${DEMO_PATH}/table/demo/level-data.ts')
93
+
94
+ ### 多级表头
95
+
96
+ 使用 `sar-table-row` 和 `sar-table-cell` 的“你中有我我中有你”可以实现多级表头。需要注意单元格都需要设置指定宽度以便对齐。
97
+
98
+ @code('${DEMO_PATH}/table/demo/MultilevelHeader.vue')
99
+
100
+ ### 合并行或列
101
+
102
+ 不同于 `HTMLTableCellElement` 使用 `rowSpan` 和 `colSpan` 属性合并行或列。在 `sar-table` 中需要使用 `flex` 布局的思维来合并单元格。且同一列的单元格需要设置相同的宽度,跨多列的单元格宽度为其跨越的列的宽度的和。
103
+
104
+ @code('${DEMO_PATH}/table/demo/Merge.vue')
105
+
106
+ ## API
107
+
108
+ ### TableProps
109
+
110
+ | 属性 | 描述 | 类型 | 默认值 |
111
+ | ---------- | ---------------------------- | ---------- | ------ |
112
+ | root-class | 组件根元素类名 | string | - |
113
+ | root-style | 组件根元素样式 | StyleValue | - |
114
+ | bordered | 给单元格添加边框 | boolean | false |
115
+ | underline | 给单元格添加下边框 | boolean | false |
116
+ | height | 设置表格高度以便可以固定表头 | string | - |
117
+
118
+ ### TableSlots
119
+
120
+ | 插槽 | 描述 | 属性 |
121
+ | ------- | -------------- | ---- |
122
+ | default | 自定义默认内容 | - |
123
+
124
+ ### TableRowProps
125
+
126
+ | 属性 | 描述 | 类型 | 默认值 |
127
+ | ---------- | ---------------- | ---------- | ------ |
128
+ | root-class | 组件根元素类名 | string | - |
129
+ | root-style | 组件根元素样式 | StyleValue | - |
130
+ | fixed | 固定列到表格顶部 | boolean | false |
131
+
132
+ ### TableRowSlots
133
+
134
+ | 插槽 | 描述 | 属性 |
135
+ | ------- | -------------- | ---- |
136
+ | default | 自定义默认内容 | - |
137
+
138
+ ### TableCellProps
139
+
140
+ | 属性 | 描述 | 类型 | 默认值 |
141
+ | ---------- | ---------------------------------------- | ---------------------------- | ------ |
142
+ | root-class | 组件根元素类名 | string | - |
143
+ | root-style | 组件根元素样式 | StyleValue | - |
144
+ | fixed | 固定单元到表格左边或右边,true 表示左边 | boolean \| 'left' \| 'right' | - |
145
+ | width | 设置单元格宽度占比,可以带单位或不带单位 | string | '1' |
146
+ | bold | 单元格字体加粗 | boolean | false |
147
+
148
+ ### TableCellSlots
149
+
150
+ | 插槽 | 描述 | 属性 |
151
+ | ------- | -------------- | ---- |
152
+ | default | 自定义默认内容 | - |
153
+
154
+ ## 主题定制
155
+
156
+ ### CSS 变量
157
+
158
+ @code('./variables.scss#variables')
159
+
160
+ ### CSS 变量 - 暗黑模式
161
+
162
+ @code('./variables-dark.scss#variables')
@@ -37,6 +37,13 @@ import {
37
37
  defaultTableProps
38
38
  } from "./common";
39
39
  import SarTableFixation from "../table-fixation/table-fixation.vue";
40
+ /**
41
+ * @property {string} rootClass 组件根元素类名,默认值:-。
42
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
43
+ * @property {boolean} bordered 给单元格添加边框,默认值:false。
44
+ * @property {boolean} underline 给单元格添加下边框,默认值:false。
45
+ * @property {string} height 设置表格高度以便可以固定表头,默认值:-。
46
+ */
40
47
  export default _defineComponent({
41
48
  components: {
42
49
  SarTableFixation,