@movk/nuxt 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. package/.nuxt/movk-ui.css +3 -0
  2. package/README.md +74 -79
  3. package/dist/module.d.mts +57 -1
  4. package/dist/module.json +2 -2
  5. package/dist/module.mjs +120 -126
  6. package/dist/runtime/components/AutoForm.d.vue.ts +10 -30
  7. package/dist/runtime/components/AutoForm.vue +114 -125
  8. package/dist/runtime/components/AutoForm.vue.d.ts +10 -30
  9. package/dist/runtime/components/ColorChooser.d.vue.ts +21 -22
  10. package/dist/runtime/components/ColorChooser.vue +304 -27
  11. package/dist/runtime/components/ColorChooser.vue.d.ts +21 -22
  12. package/dist/runtime/components/DataTable.d.vue.ts +57 -0
  13. package/dist/runtime/components/DataTable.vue +584 -0
  14. package/dist/runtime/components/DataTable.vue.d.ts +57 -0
  15. package/dist/runtime/components/DatePicker.d.vue.ts +20 -33
  16. package/dist/runtime/components/DatePicker.vue +173 -65
  17. package/dist/runtime/components/DatePicker.vue.d.ts +20 -33
  18. package/dist/runtime/components/MessageBox.d.vue.ts +36 -0
  19. package/dist/runtime/components/MessageBox.vue +113 -0
  20. package/dist/runtime/components/MessageBox.vue.d.ts +36 -0
  21. package/dist/runtime/components/PillGroup.d.vue.ts +33 -0
  22. package/dist/runtime/components/PillGroup.vue +291 -0
  23. package/dist/runtime/components/PillGroup.vue.d.ts +33 -0
  24. package/dist/runtime/components/Popconfirm.d.vue.ts +30 -0
  25. package/dist/runtime/components/Popconfirm.vue +143 -0
  26. package/dist/runtime/components/Popconfirm.vue.d.ts +30 -0
  27. package/dist/runtime/components/SearchForm.d.vue.ts +21 -149
  28. package/dist/runtime/components/SearchForm.vue +211 -153
  29. package/dist/runtime/components/SearchForm.vue.d.ts +21 -149
  30. package/dist/runtime/components/SlideVerify.d.vue.ts +31 -70
  31. package/dist/runtime/components/SlideVerify.vue +117 -90
  32. package/dist/runtime/components/SlideVerify.vue.d.ts +31 -70
  33. package/dist/runtime/components/StarRating.d.vue.ts +38 -87
  34. package/dist/runtime/components/StarRating.vue +118 -74
  35. package/dist/runtime/components/StarRating.vue.d.ts +38 -87
  36. package/dist/runtime/components/input/AsPhoneNumberInput.d.vue.ts +11 -15
  37. package/dist/runtime/components/input/AsPhoneNumberInput.vue +22 -9
  38. package/dist/runtime/components/input/AsPhoneNumberInput.vue.d.ts +11 -15
  39. package/dist/runtime/components/input/WithCharacterLimit.d.vue.ts +11 -13
  40. package/dist/runtime/components/input/WithCharacterLimit.vue +23 -11
  41. package/dist/runtime/components/input/WithCharacterLimit.vue.d.ts +11 -13
  42. package/dist/runtime/components/input/WithClear.d.vue.ts +13 -11
  43. package/dist/runtime/components/input/WithClear.vue +27 -8
  44. package/dist/runtime/components/input/WithClear.vue.d.ts +13 -11
  45. package/dist/runtime/components/input/WithCopy.d.vue.ts +13 -13
  46. package/dist/runtime/components/input/WithCopy.vue +25 -8
  47. package/dist/runtime/components/input/WithCopy.vue.d.ts +13 -13
  48. package/dist/runtime/components/input/WithFloatingLabel.d.vue.ts +13 -16
  49. package/dist/runtime/components/input/WithFloatingLabel.vue +35 -27
  50. package/dist/runtime/components/input/WithFloatingLabel.vue.d.ts +13 -16
  51. package/dist/runtime/components/input/WithPasswordToggle.d.vue.ts +11 -7
  52. package/dist/runtime/components/input/WithPasswordToggle.vue +24 -7
  53. package/dist/runtime/components/input/WithPasswordToggle.vue.d.ts +11 -7
  54. package/dist/runtime/components/theme-picker/ThemePicker.d.vue.ts +8 -1
  55. package/dist/runtime/components/theme-picker/ThemePicker.vue +27 -12
  56. package/dist/runtime/components/theme-picker/ThemePicker.vue.d.ts +8 -1
  57. package/dist/runtime/components/theme-picker/ThemePickerButton.d.vue.ts +9 -4
  58. package/dist/runtime/components/theme-picker/ThemePickerButton.vue +4 -0
  59. package/dist/runtime/components/theme-picker/ThemePickerButton.vue.d.ts +9 -4
  60. package/dist/runtime/composables/index.d.ts +9 -8
  61. package/dist/runtime/composables/index.js +1 -0
  62. package/dist/runtime/composables/useApiFetch.d.ts +10 -5
  63. package/dist/runtime/composables/useApiFetch.js +20 -2
  64. package/dist/runtime/composables/useAutoForm.d.ts +4 -4
  65. package/dist/runtime/composables/useAutoForm.js +23 -9
  66. package/dist/runtime/composables/useClientApiFetch.d.ts +3 -2
  67. package/dist/runtime/composables/useDateFormatter.d.ts +16 -3
  68. package/dist/runtime/composables/useDateFormatter.js +89 -30
  69. package/dist/runtime/composables/useDownloadWithProgress.d.ts +26 -27
  70. package/dist/runtime/composables/useDownloadWithProgress.js +142 -40
  71. package/dist/runtime/composables/useLazyApiFetch.d.ts +3 -2
  72. package/dist/runtime/composables/useMessageBox.d.ts +6 -0
  73. package/dist/runtime/composables/useMessageBox.js +16 -0
  74. package/dist/runtime/composables/useTheme.d.ts +26 -16
  75. package/dist/runtime/composables/useTheme.js +98 -71
  76. package/dist/runtime/composables/useUploadWithProgress.d.ts +23 -29
  77. package/dist/runtime/composables/useUploadWithProgress.js +78 -67
  78. package/dist/runtime/domains/api/auth.d.ts +2 -0
  79. package/dist/runtime/domains/api/auth.js +31 -0
  80. package/dist/runtime/domains/api/endpoint-config.d.ts +11 -0
  81. package/dist/runtime/domains/api/endpoint-config.js +17 -0
  82. package/dist/runtime/domains/api/errors.d.ts +2 -0
  83. package/dist/runtime/domains/api/errors.js +10 -0
  84. package/dist/runtime/domains/api/fetch-key.d.ts +20 -0
  85. package/dist/runtime/domains/api/fetch-key.js +23 -0
  86. package/dist/runtime/domains/api/interceptors/error.d.ts +13 -0
  87. package/dist/runtime/domains/api/interceptors/error.js +49 -0
  88. package/dist/runtime/domains/api/interceptors/request.d.ts +12 -0
  89. package/dist/runtime/domains/api/interceptors/request.js +46 -0
  90. package/dist/runtime/domains/api/interceptors/response.d.ts +17 -0
  91. package/dist/runtime/domains/api/interceptors/response.js +27 -0
  92. package/dist/runtime/domains/api/response.d.ts +4 -0
  93. package/dist/runtime/domains/api/response.js +14 -0
  94. package/dist/runtime/domains/api/toast.d.ts +15 -0
  95. package/dist/runtime/domains/api/toast.js +46 -0
  96. package/dist/runtime/domains/api/transfer.d.ts +69 -0
  97. package/dist/runtime/domains/api/transfer.js +81 -0
  98. package/dist/runtime/domains/auto-form/actions.d.ts +2 -0
  99. package/dist/runtime/domains/auto-form/actions.js +4 -0
  100. package/dist/runtime/domains/auto-form/components/Array.d.vue.ts +13 -0
  101. package/dist/runtime/{components/auto-form-renderer/AutoFormRendererArray.vue → domains/auto-form/components/Array.vue} +25 -29
  102. package/dist/runtime/domains/auto-form/components/Array.vue.d.ts +13 -0
  103. package/dist/runtime/domains/auto-form/components/Children.d.vue.ts +11 -0
  104. package/dist/runtime/{components/auto-form-renderer/AutoFormRendererChildren.vue → domains/auto-form/components/Children.vue} +18 -18
  105. package/dist/runtime/domains/auto-form/components/Children.vue.d.ts +11 -0
  106. package/dist/runtime/domains/auto-form/components/Field.d.vue.ts +11 -0
  107. package/dist/runtime/domains/auto-form/components/Field.vue +56 -0
  108. package/dist/runtime/domains/auto-form/components/Field.vue.d.ts +11 -0
  109. package/dist/runtime/domains/auto-form/components/Layout.d.vue.ts +11 -0
  110. package/dist/runtime/{components/auto-form-renderer/AutoFormRendererLayout.vue → domains/auto-form/components/Layout.vue} +24 -25
  111. package/dist/runtime/domains/auto-form/components/Layout.vue.d.ts +11 -0
  112. package/dist/runtime/domains/auto-form/components/Nested.d.vue.ts +11 -0
  113. package/dist/runtime/{components/auto-form-renderer/AutoFormRendererNested.vue → domains/auto-form/components/Nested.vue} +17 -21
  114. package/dist/runtime/domains/auto-form/components/Nested.vue.d.ts +11 -0
  115. package/dist/runtime/domains/auto-form/controls.d.ts +41 -0
  116. package/dist/runtime/{auto-form → domains/auto-form}/controls.js +27 -24
  117. package/dist/runtime/{auto-form/field-utils.d.ts → domains/auto-form/fields.d.ts} +3 -1
  118. package/dist/runtime/{auto-form/field-utils.js → domains/auto-form/fields.js} +18 -2
  119. package/dist/runtime/{auto-form → domains/auto-form}/metadata.js +1 -1
  120. package/dist/runtime/domains/auto-form/provider.d.ts +62 -0
  121. package/dist/runtime/{auto-form → domains/auto-form}/provider.js +6 -3
  122. package/dist/runtime/{auto-form/reactive-utils.d.ts → domains/auto-form/reactive.d.ts} +5 -5
  123. package/dist/runtime/{auto-form/reactive-utils.js → domains/auto-form/reactive.js} +1 -1
  124. package/dist/runtime/{auto-form/schema-introspector.d.ts → domains/auto-form/schema.d.ts} +2 -2
  125. package/dist/runtime/{auto-form/schema-introspector.js → domains/auto-form/schema.js} +1 -1
  126. package/dist/runtime/domains/data-table/columns/constants.d.ts +50 -0
  127. package/dist/runtime/domains/data-table/columns/constants.js +19 -0
  128. package/dist/runtime/domains/data-table/columns/resolve-columns.d.ts +4 -0
  129. package/dist/runtime/domains/data-table/columns/resolve-columns.js +59 -0
  130. package/dist/runtime/domains/data-table/columns/resolve-data-column.d.ts +9 -0
  131. package/dist/runtime/domains/data-table/columns/resolve-data-column.js +164 -0
  132. package/dist/runtime/domains/data-table/columns/resolve-group-column.d.ts +4 -0
  133. package/dist/runtime/domains/data-table/columns/resolve-group-column.js +19 -0
  134. package/dist/runtime/domains/data-table/columns/resolve-special-columns.d.ts +8 -0
  135. package/dist/runtime/domains/data-table/columns/resolve-special-columns.js +232 -0
  136. package/dist/runtime/domains/data-table/columns/style.d.ts +11 -0
  137. package/dist/runtime/domains/data-table/columns/style.js +67 -0
  138. package/dist/runtime/domains/data-table/columns/utils.d.ts +6 -0
  139. package/dist/runtime/domains/data-table/columns/utils.js +16 -0
  140. package/dist/runtime/domains/data-table/components/ActionConfirm.d.vue.ts +10 -0
  141. package/dist/runtime/domains/data-table/components/ActionConfirm.vue +39 -0
  142. package/dist/runtime/domains/data-table/components/ActionConfirm.vue.d.ts +10 -0
  143. package/dist/runtime/domains/data-table/components/ActionsCell.d.vue.ts +11 -0
  144. package/dist/runtime/domains/data-table/components/ActionsCell.vue +91 -0
  145. package/dist/runtime/domains/data-table/components/ActionsCell.vue.d.ts +11 -0
  146. package/dist/runtime/domains/data-table/components/CellTooltip.d.vue.ts +9 -0
  147. package/dist/runtime/domains/data-table/components/CellTooltip.vue +40 -0
  148. package/dist/runtime/domains/data-table/components/CellTooltip.vue.d.ts +9 -0
  149. package/dist/runtime/domains/data-table/components/Pagination.d.vue.ts +26 -0
  150. package/dist/runtime/domains/data-table/components/Pagination.vue +132 -0
  151. package/dist/runtime/domains/data-table/components/Pagination.vue.d.ts +26 -0
  152. package/dist/runtime/domains/data-table/indent.d.ts +8 -0
  153. package/dist/runtime/domains/data-table/indent.js +19 -0
  154. package/dist/runtime/domains/data-table/tree-selection.d.ts +9 -0
  155. package/dist/runtime/domains/data-table/tree-selection.js +76 -0
  156. package/dist/runtime/{utils/theme.d.ts → domains/theme/theme-icons.d.ts} +0 -1
  157. package/dist/runtime/index.css +1 -0
  158. package/dist/runtime/plugins/api.factory.js +17 -117
  159. package/dist/runtime/plugins/theme.js +49 -27
  160. package/dist/runtime/types/api/config.d.ts +127 -0
  161. package/dist/runtime/types/api/fetch.d.ts +50 -0
  162. package/dist/runtime/types/api/index.d.ts +5 -0
  163. package/dist/runtime/types/api/module.d.ts +94 -0
  164. package/dist/runtime/types/api/response.d.ts +62 -0
  165. package/dist/runtime/types/api/response.js +0 -0
  166. package/dist/runtime/types/api/transfer.d.ts +32 -0
  167. package/dist/runtime/types/api/transfer.js +0 -0
  168. package/dist/runtime/types/app.config.d.ts +6 -0
  169. package/dist/runtime/types/auto-form/base.d.ts +26 -0
  170. package/dist/runtime/types/auto-form/base.js +0 -0
  171. package/dist/runtime/types/auto-form/component.d.ts +28 -0
  172. package/dist/runtime/types/auto-form/component.js +0 -0
  173. package/dist/runtime/types/auto-form/controls.d.ts +45 -0
  174. package/dist/runtime/types/auto-form/controls.js +0 -0
  175. package/dist/runtime/types/auto-form/fields.d.ts +68 -0
  176. package/dist/runtime/types/auto-form/fields.js +0 -0
  177. package/dist/runtime/types/auto-form/index.d.ts +7 -0
  178. package/dist/runtime/types/auto-form/index.js +0 -0
  179. package/dist/runtime/types/auto-form/search-form.d.ts +84 -0
  180. package/dist/runtime/types/auto-form/search-form.js +0 -0
  181. package/dist/runtime/types/auto-form/slots.d.ts +85 -0
  182. package/dist/runtime/types/auto-form/slots.js +0 -0
  183. package/dist/runtime/types/auto-form/zod-factory.d.ts +127 -0
  184. package/dist/runtime/types/auto-form/zod-factory.js +0 -0
  185. package/dist/runtime/types/components/color-chooser.d.ts +109 -0
  186. package/dist/runtime/types/components/color-chooser.js +0 -0
  187. package/dist/runtime/types/components/date-picker.d.ts +41 -0
  188. package/dist/runtime/types/components/date-picker.js +0 -0
  189. package/dist/runtime/types/components/index.d.ts +8 -0
  190. package/dist/runtime/types/components/index.js +0 -0
  191. package/dist/runtime/types/components/input/as-phone-number-input.d.ts +17 -0
  192. package/dist/runtime/types/components/input/as-phone-number-input.js +0 -0
  193. package/dist/runtime/types/components/input/index.d.ts +6 -0
  194. package/dist/runtime/types/components/input/index.js +0 -0
  195. package/dist/runtime/types/components/input/with-character-limit.d.ts +11 -0
  196. package/dist/runtime/types/components/input/with-character-limit.js +0 -0
  197. package/dist/runtime/types/components/input/with-clear.d.ts +10 -0
  198. package/dist/runtime/types/components/input/with-clear.js +0 -0
  199. package/dist/runtime/types/components/input/with-copy.d.ts +11 -0
  200. package/dist/runtime/types/components/input/with-copy.js +0 -0
  201. package/dist/runtime/types/components/input/with-floating-label.d.ts +12 -0
  202. package/dist/runtime/types/components/input/with-floating-label.js +0 -0
  203. package/dist/runtime/types/components/input/with-password-toggle.d.ts +7 -0
  204. package/dist/runtime/types/components/input/with-password-toggle.js +0 -0
  205. package/dist/runtime/types/components/message-box.d.ts +69 -0
  206. package/dist/runtime/types/components/message-box.js +0 -0
  207. package/dist/runtime/types/components/pill-group.d.ts +103 -0
  208. package/dist/runtime/types/components/pill-group.js +0 -0
  209. package/dist/runtime/types/components/popconfirm.d.ts +74 -0
  210. package/dist/runtime/types/components/popconfirm.js +0 -0
  211. package/dist/runtime/types/components/slide-verify.d.ts +54 -0
  212. package/dist/runtime/types/components/slide-verify.js +0 -0
  213. package/dist/runtime/types/components/star-rating.d.ts +55 -0
  214. package/dist/runtime/types/components/star-rating.js +0 -0
  215. package/dist/runtime/types/data-table/columns.d.ts +236 -0
  216. package/dist/runtime/types/data-table/columns.js +6 -0
  217. package/dist/runtime/types/data-table/component.d.ts +190 -0
  218. package/dist/runtime/types/data-table/component.js +0 -0
  219. package/dist/runtime/types/data-table/contexts.d.ts +44 -0
  220. package/dist/runtime/types/data-table/contexts.js +0 -0
  221. package/dist/runtime/types/data-table/index.d.ts +6 -0
  222. package/dist/runtime/types/data-table/index.js +1 -0
  223. package/dist/runtime/types/data-table/pagination.d.ts +87 -0
  224. package/dist/runtime/types/data-table/pagination.js +0 -0
  225. package/dist/runtime/types/index.d.ts +6 -5
  226. package/dist/runtime/types/index.js +5 -5
  227. package/dist/runtime/types/shared.d.ts +5 -0
  228. package/dist/runtime/types/shared.js +0 -0
  229. package/dist/runtime/types/zod.d.ts +11 -10
  230. package/dist/runtime/utils/extend-theme.d.ts +19 -0
  231. package/dist/runtime/utils/extend-theme.js +44 -0
  232. package/dist/runtime/utils/form-control.d.ts +33 -0
  233. package/dist/runtime/utils/form-control.js +54 -0
  234. package/dist/runtime/utils/meta.d.ts +2 -5
  235. package/dist/runtime/utils/meta.js +1 -3
  236. package/dist/runtime/utils/theme-defaults.d.ts +27 -0
  237. package/dist/runtime/utils/theme-defaults.js +28 -0
  238. package/dist/runtime/utils/tv.d.ts +1 -0
  239. package/dist/runtime/utils/tv.js +4 -0
  240. package/dist/runtime/vue/composables/useSiteConfig.d.ts +13 -0
  241. package/dist/runtime/vue/composables/useSiteConfig.js +11 -0
  242. package/dist/runtime/vue/plugins/theme.d.ts +6 -0
  243. package/dist/runtime/vue/plugins/theme.js +14 -0
  244. package/dist/runtime/vue/stubs/base.d.ts +2 -0
  245. package/dist/runtime/vue/stubs/base.js +2 -0
  246. package/dist/runtime/vue/stubs/inertia.d.ts +2 -0
  247. package/dist/runtime/vue/stubs/inertia.js +2 -0
  248. package/dist/runtime/vue/stubs/movk-extra.d.ts +2 -0
  249. package/dist/runtime/vue/stubs/movk-extra.js +2 -0
  250. package/dist/runtime/vue/stubs/none.d.ts +2 -0
  251. package/dist/runtime/vue/stubs/none.js +2 -0
  252. package/dist/runtime/vue/stubs/vue-router.d.ts +2 -0
  253. package/dist/runtime/vue/stubs/vue-router.js +2 -0
  254. package/dist/shared/nuxt.DfBEyjld.mjs +667 -0
  255. package/dist/types.d.mts +2 -6
  256. package/dist/unplugin.d.mts +28 -0
  257. package/dist/unplugin.mjs +292 -0
  258. package/dist/vite.d.mts +12 -0
  259. package/dist/vite.mjs +20 -0
  260. package/package.json +75 -36
  261. package/vue-plugin.d.ts +5 -0
  262. package/dist/runtime/auto-form/controls.d.ts +0 -221
  263. package/dist/runtime/auto-form/provider.d.ts +0 -27
  264. package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.d.vue.ts +0 -28
  265. package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.vue.d.ts +0 -28
  266. package/dist/runtime/components/auto-form-renderer/AutoFormRendererChildren.d.vue.ts +0 -26
  267. package/dist/runtime/components/auto-form-renderer/AutoFormRendererChildren.vue.d.ts +0 -26
  268. package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.d.vue.ts +0 -26
  269. package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue +0 -55
  270. package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue.d.ts +0 -26
  271. package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.d.vue.ts +0 -26
  272. package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.vue.d.ts +0 -26
  273. package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.d.vue.ts +0 -26
  274. package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.vue.d.ts +0 -26
  275. package/dist/runtime/constants/api-defaults.d.ts +0 -9
  276. package/dist/runtime/constants/api-defaults.js +0 -32
  277. package/dist/runtime/constants/grid-cols.d.ts +0 -7
  278. package/dist/runtime/constants/grid-cols.js +0 -44
  279. package/dist/runtime/style.css +0 -1
  280. package/dist/runtime/types/api.d.ts +0 -349
  281. package/dist/runtime/types/auto-form.d.ts +0 -259
  282. package/dist/runtime/types/module.d.ts +0 -96
  283. package/dist/runtime/types/theme.d.ts +0 -2
  284. package/dist/runtime/utils/api-utils.d.ts +0 -58
  285. package/dist/runtime/utils/api-utils.js +0 -98
  286. /package/dist/runtime/{constants/auto-form.d.ts → domains/auto-form/constants.d.ts} +0 -0
  287. /package/dist/runtime/{constants/auto-form.js → domains/auto-form/constants.js} +0 -0
  288. /package/dist/runtime/{auto-form → domains/auto-form}/metadata.d.ts +0 -0
  289. /package/dist/runtime/{utils/theme.js → domains/theme/theme-icons.js} +0 -0
  290. /package/dist/runtime/types/{api.js → api/config.js} +0 -0
  291. /package/dist/runtime/types/{auto-form.js → api/fetch.js} +0 -0
  292. /package/dist/runtime/types/{module.js → api/index.js} +0 -0
  293. /package/dist/runtime/types/{theme.js → api/module.js} +0 -0
@@ -1,75 +1,36 @@
1
- import type { ClassNameValue } from '../types/index.js';
2
- export interface SlideVerifyProps {
3
- /**
4
- * 滑块宽度
5
- * @defaultValue 50
6
- */
7
- sliderWidth?: number;
8
- /**
9
- * 滑块高度
10
- * @defaultValue 32
11
- */
12
- height?: number;
13
- /**
14
- * 是否禁用
15
- * @defaultValue false
16
- */
17
- disabled?: boolean;
18
- /**
19
- * 待滑动时的提示文本
20
- * @defaultValue '请向右滑动验证'
21
- */
22
- text?: string;
23
- /**
24
- * 验证成功时的提示文本
25
- * @defaultValue '验证成功'
26
- */
27
- successText?: string;
28
- /**
29
- * 滑块图标
30
- * @defaultValue 'i-lucide-chevrons-right'
31
- */
32
- icon?: string;
33
- /**
34
- * 验证成功时的图标
35
- * @defaultValue 'i-lucide-check'
36
- */
37
- successIcon?: string;
38
- /**
39
- * 完成验证所需的阈值百分比(0-1)
40
- * @defaultValue 0.9
41
- */
42
- threshold?: number;
43
- /**
44
- * 自定义轨道样式
45
- */
46
- trackClass?: ClassNameValue;
47
- /**
48
- * 自定义滑块样式
49
- */
50
- sliderClass?: ClassNameValue;
51
- /**
52
- * 自定义文本样式
53
- */
54
- textClass?: ClassNameValue;
55
- /**
56
- * 自定义根元素样式
57
- */
58
- class?: ClassNameValue;
59
- }
60
- export interface SlideVerifyEmits {
61
- success: [];
62
- dragStart: [];
63
- dragEnd: [success: boolean];
64
- }
65
- declare var __VLS_22: {
66
- verified: any;
67
- progress: any;
1
+ import theme from '#build/movk-ui/slide-verify';
2
+ import type { ComponentConfig } from '@nuxt/ui';
3
+ import type { AppConfig } from 'nuxt/schema';
4
+ import type { SlideVerifyProps, SlideVerifySlots } from '../types/components/slide-verify';
5
+ type __VLS_Props = SlideVerifyProps & {
6
+ size?: ComponentConfig<typeof theme, AppConfig, 'slideVerify'>['variants']['size'];
7
+ ui?: ComponentConfig<typeof theme, AppConfig, 'slideVerify'>['slots'];
68
8
  };
69
- type __VLS_Slots = {} & {
70
- slider?: (props: typeof __VLS_22) => any;
9
+ type __VLS_Slots = SlideVerifySlots;
10
+ declare function reset(): void;
11
+ type __VLS_ModelProps = {
12
+ modelValue?: boolean;
71
13
  };
72
- declare const __VLS_base: any;
14
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
15
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
16
+ reset: typeof reset;
17
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
18
+ success: () => any;
19
+ "update:modelValue": (value: boolean) => any;
20
+ dragStart: () => any;
21
+ dragEnd: (success: boolean) => any;
22
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
23
+ onSuccess?: (() => any) | undefined;
24
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
25
+ onDragStart?: (() => any) | undefined;
26
+ onDragEnd?: ((success: boolean) => any) | undefined;
27
+ }>, {
28
+ icon: import("@nuxt/ui").IconProps["name"];
29
+ text: string;
30
+ successText: string;
31
+ successIcon: import("@nuxt/ui").IconProps["name"];
32
+ threshold: number;
33
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
73
34
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
74
35
  declare const _default: typeof __VLS_export;
75
36
  export default _default;
@@ -1,96 +1,47 @@
1
- import type { ButtonProps } from '@nuxt/ui';
2
- export interface StarRatingProps {
3
- /**
4
- * 当前评分值
5
- * @defaultValue 0
6
- */
1
+ import type { ComponentConfig } from '@nuxt/ui';
2
+ import theme from '#build/movk-ui/star-rating';
3
+ import type { AppConfig } from 'nuxt/schema';
4
+ import type { StarRatingProps } from '../types/components/star-rating';
5
+ type __VLS_Props = StarRatingProps & {
6
+ ui?: ComponentConfig<typeof theme, AppConfig, 'starRating'>['slots'];
7
+ };
8
+ type __VLS_ModelProps = {
7
9
  modelValue?: number;
8
- /**
9
- * 最大星级数
10
- * @defaultValue 5
11
- */
12
- max?: number;
13
- /**
14
- * 是否禁用
15
- * @defaultValue false
16
- */
17
- disabled?: boolean;
18
- /**
19
- * 是否只读
20
- * @defaultValue false
21
- */
22
- readonly?: boolean;
23
- /**
24
- * 是否显示评分徽章
25
- * @defaultValue true
26
- */
27
- showBadge?: boolean;
28
- /**
29
- * 自定义星星按钮属性
30
- */
31
- buttonProps?: Partial<ButtonProps>;
32
- /**
33
- * 未选中星星的图标
34
- * @defaultValue 'i-lucide-star'
35
- */
36
- emptyIcon?: string;
37
- /**
38
- * 选中星星的图标
39
- * @defaultValue 'i-lucide-star'
40
- */
41
- filledIcon?: string;
42
- /**
43
- * 半星图标
44
- * @defaultValue 'i-lucide-star-half'
45
- */
46
- halfIcon?: string;
47
- /**
48
- * 选中星星的颜色
49
- * @defaultValue 'warning'
50
- */
51
- color?: ButtonProps['color'];
52
- /**
53
- * 星星大小
54
- * @defaultValue 'sm'
55
- */
56
- size?: ButtonProps['size'];
57
- /**
58
- * 是否允许半星
59
- * @defaultValue false
60
- */
61
- allowHalf?: boolean;
62
- /**
63
- * 是否允许清除评分
64
- * @defaultValue false
65
- */
66
- clearable?: boolean;
67
- }
68
- export interface StarRatingEmits {
69
- 'update:modelValue': [value: number];
70
- /** 评分改变事件 */
71
- 'change': [value: number];
72
- /** 悬停事件 */
73
- 'hover': [value: number | null];
74
- }
75
- declare var __VLS_1: {
76
- value: any;
77
- max: any;
78
- }, __VLS_13: {
79
- value: any;
80
- max: any;
81
- label: any;
82
- }, __VLS_20: {
83
- value: any;
84
- max: any;
10
+ };
11
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
12
+ declare var __VLS_7: {
13
+ value: number;
14
+ max: number;
15
+ }, __VLS_19: {
16
+ value: number;
17
+ max: number;
18
+ label: string;
19
+ }, __VLS_26: {
20
+ value: number;
21
+ max: number;
85
22
  };
86
23
  type __VLS_Slots = {} & {
87
- prefix?: (props: typeof __VLS_1) => any;
24
+ prefix?: (props: typeof __VLS_7) => any;
88
25
  } & {
89
- badge?: (props: typeof __VLS_13) => any;
26
+ badge?: (props: typeof __VLS_19) => any;
90
27
  } & {
91
- suffix?: (props: typeof __VLS_20) => any;
28
+ suffix?: (props: typeof __VLS_26) => any;
92
29
  };
93
- declare const __VLS_base: any;
30
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
31
+ change: (value: number) => any;
32
+ hover: (value: number | null) => any;
33
+ "update:modelValue": (value: number) => any;
34
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
35
+ onChange?: ((value: number) => any) | undefined;
36
+ onHover?: ((value: number | null) => any) | undefined;
37
+ "onUpdate:modelValue"?: ((value: number) => any) | undefined;
38
+ }>, {
39
+ max: number;
40
+ showBadge: boolean;
41
+ emptyIcon: import("@nuxt/ui").IconProps["name"];
42
+ filledIcon: import("@nuxt/ui").IconProps["name"];
43
+ halfIcon: import("@nuxt/ui").IconProps["name"];
44
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
94
45
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
95
46
  declare const _default: typeof __VLS_export;
96
47
  export default _default;
@@ -1,26 +1,71 @@
1
1
  <script setup>
2
2
  import { UButton, UBadge } from "#components";
3
3
  import { computed, ref } from "vue";
4
+ import { FieldGroupReset } from "@nuxt/ui/composables/useFieldGroup";
5
+ import { useAppConfig } from "#imports";
6
+ import theme from "#build/movk-ui/star-rating";
7
+ import { useExtendedTv } from "../utils/extend-theme";
8
+ import { useFieldControl } from "../utils/form-control";
4
9
  const props = defineProps({
5
- modelValue: { type: Number, required: false, default: 0 },
10
+ id: { type: String, required: false },
11
+ name: { type: String, required: false },
6
12
  max: { type: Number, required: false, default: 5 },
7
- disabled: { type: Boolean, required: false, default: false },
8
- readonly: { type: Boolean, required: false, default: false },
13
+ disabled: { type: Boolean, required: false },
14
+ highlight: { type: Boolean, required: false },
15
+ readonly: { type: Boolean, required: false },
9
16
  showBadge: { type: Boolean, required: false, default: true },
10
17
  buttonProps: { type: Object, required: false },
11
- emptyIcon: { type: String, required: false, default: "i-lucide-star" },
12
- filledIcon: { type: String, required: false, default: "i-lucide-star" },
13
- halfIcon: { type: String, required: false, default: "i-lucide-star-half" },
14
- color: { type: null, required: false, default: "warning" },
15
- size: { type: null, required: false, default: "sm" },
16
- allowHalf: { type: Boolean, required: false, default: false },
17
- clearable: { type: Boolean, required: false, default: false }
18
+ emptyIcon: { type: null, required: false, default: "i-lucide-star" },
19
+ filledIcon: { type: null, required: false, default: "i-lucide-star" },
20
+ halfIcon: { type: null, required: false, default: "i-lucide-star-half" },
21
+ color: { type: null, required: false },
22
+ size: { type: null, required: false },
23
+ allowHalf: { type: Boolean, required: false },
24
+ clearable: { type: Boolean, required: false },
25
+ class: { type: null, required: false },
26
+ ui: { type: Object, required: false }
18
27
  });
19
- const emit = defineEmits(["update:modelValue", "change", "hover"]);
28
+ const modelValue = defineModel({ type: Number, ...{ default: 0 } });
29
+ const emits = defineEmits(["change", "hover"]);
20
30
  defineOptions({ inheritAttrs: false });
31
+ const {
32
+ id,
33
+ name,
34
+ size: effectiveSize,
35
+ color: effectiveColor,
36
+ disabled: effectiveDisabled,
37
+ fieldGroupOrientation,
38
+ ariaAttrs,
39
+ emitFormBlur,
40
+ emitFormChange,
41
+ emitFormFocus,
42
+ emitFormInput
43
+ } = useFieldControl(props);
21
44
  const hoveredStar = ref(null);
22
45
  const focusedIndex = ref(0);
23
- const isInteractive = computed(() => !props.disabled && !props.readonly);
46
+ const isInteractive = computed(() => !effectiveDisabled.value && !props.readonly);
47
+ const appConfig = useAppConfig();
48
+ const { extendUi } = useExtendedTv(
49
+ { slots: {} },
50
+ theme,
51
+ () => appConfig.movk?.starRating,
52
+ () => ({
53
+ ui: {
54
+ ...props.ui,
55
+ root: [props.ui?.root, props.class]
56
+ },
57
+ variants: {
58
+ interactive: isInteractive.value,
59
+ disabled: effectiveDisabled.value,
60
+ readonly: props.readonly && !effectiveDisabled.value,
61
+ fieldGroup: fieldGroupOrientation.value
62
+ }
63
+ })
64
+ );
65
+ function emitFormValueChange() {
66
+ emitFormInput();
67
+ emitFormChange();
68
+ }
24
69
  function calculateHalfStarValue(index, event) {
25
70
  if (!props.allowHalf) return index + 1;
26
71
  const target = event.currentTarget;
@@ -30,13 +75,10 @@ function calculateHalfStarValue(index, event) {
30
75
  return posX < halfWidth ? index + 0.5 : index + 1;
31
76
  }
32
77
  function updateValue(newValue) {
33
- if (props.clearable && newValue === props.modelValue) {
34
- emit("update:modelValue", 0);
35
- emit("change", 0);
36
- return;
37
- }
38
- emit("update:modelValue", newValue);
39
- emit("change", newValue);
78
+ const finalValue = props.clearable && newValue === modelValue.value ? 0 : newValue;
79
+ modelValue.value = finalValue;
80
+ emits("change", finalValue);
81
+ emitFormValueChange();
40
82
  }
41
83
  function handleClick(index, event) {
42
84
  if (!isInteractive.value || !event) return;
@@ -47,7 +89,7 @@ function handleMouseEnter(index, event) {
47
89
  if (!isInteractive.value || !event) return;
48
90
  const hoverValue = calculateHalfStarValue(index, event);
49
91
  hoveredStar.value = hoverValue - 1;
50
- emit("hover", hoverValue);
92
+ emits("hover", hoverValue);
51
93
  }
52
94
  function handleMouseMove(index, event) {
53
95
  if (!isInteractive.value || !props.allowHalf) return;
@@ -55,13 +97,13 @@ function handleMouseMove(index, event) {
55
97
  const currentHover = hoveredStar.value !== null ? hoveredStar.value + 1 : null;
56
98
  if (currentHover !== hoverValue) {
57
99
  hoveredStar.value = hoverValue - 1;
58
- emit("hover", hoverValue);
100
+ emits("hover", hoverValue);
59
101
  }
60
102
  }
61
103
  function handleMouseLeave() {
62
104
  if (!isInteractive.value) return;
63
105
  hoveredStar.value = null;
64
- emit("hover", null);
106
+ emits("hover", null);
65
107
  }
66
108
  function handleKeyDown(event) {
67
109
  if (!isInteractive.value) return;
@@ -70,17 +112,17 @@ function handleKeyDown(event) {
70
112
  case "ArrowRight":
71
113
  case "ArrowUp":
72
114
  event.preventDefault();
73
- if (props.modelValue < props.max) {
74
- updateValue(Math.min(props.modelValue + step, props.max));
75
- focusedIndex.value = Math.min(Math.floor(props.modelValue + step), props.max - 1);
115
+ if (modelValue.value < props.max) {
116
+ updateValue(Math.min(modelValue.value + step, props.max));
117
+ focusedIndex.value = Math.min(Math.floor(modelValue.value + step), props.max - 1);
76
118
  }
77
119
  break;
78
120
  case "ArrowLeft":
79
121
  case "ArrowDown":
80
122
  event.preventDefault();
81
- if (props.modelValue > 0) {
82
- updateValue(Math.max(props.modelValue - step, 0));
83
- focusedIndex.value = Math.max(Math.floor(props.modelValue - step) - 1, 0);
123
+ if (modelValue.value > 0) {
124
+ updateValue(Math.max(modelValue.value - step, 0));
125
+ focusedIndex.value = Math.max(Math.floor(modelValue.value - step) - 1, 0);
84
126
  }
85
127
  break;
86
128
  case "Home":
@@ -113,7 +155,7 @@ function handleKeyDown(event) {
113
155
  }
114
156
  }
115
157
  function getStarState(index) {
116
- const displayValue = hoveredStar.value !== null ? hoveredStar.value + 1 : props.modelValue;
158
+ const displayValue = hoveredStar.value !== null ? hoveredStar.value + 1 : modelValue.value;
117
159
  if (index < Math.floor(displayValue)) {
118
160
  return "full";
119
161
  }
@@ -130,65 +172,67 @@ function getStarIcon(index) {
130
172
  }
131
173
  function getStarColor(index) {
132
174
  const state = getStarState(index);
133
- return state !== "empty" ? props.color : "neutral";
175
+ return state !== "empty" ? effectiveColor.value : "neutral";
134
176
  }
135
- const badgeLabel = computed(() => `${props.modelValue}/${props.max}`);
177
+ const badgeLabel = computed(() => `${modelValue.value}/${props.max}`);
136
178
  </script>
137
179
 
138
180
  <template>
139
181
  <div
140
- class="inline-flex items-center gap-1"
182
+ :id="id"
183
+ :name="name"
184
+ :class="extendUi.root"
141
185
  role="slider"
142
- :aria-label="`\u8BC4\u5206 ${props.modelValue} / ${props.max}`"
143
- :aria-valuenow="props.modelValue"
186
+ :aria-label="`\u8BC4\u5206 ${modelValue} / ${props.max}`"
187
+ :aria-valuenow="modelValue"
144
188
  :aria-valuemin="0"
145
189
  :aria-valuemax="props.max"
146
- :aria-disabled="props.disabled"
190
+ :aria-disabled="effectiveDisabled"
147
191
  :aria-readonly="props.readonly"
148
192
  :tabindex="isInteractive ? 0 : -1"
193
+ v-bind="ariaAttrs"
194
+ @blur="emitFormBlur"
195
+ @focus="emitFormFocus"
149
196
  @keydown="handleKeyDown"
150
197
  >
151
- <slot name="prefix" :value="props.modelValue" :max="props.max" />
152
- <div class="flex items-center gap-0.5">
153
- <UButton
154
- v-for="index in props.max"
155
- :key="index"
156
- :icon="getStarIcon(index - 1)"
157
- :color="getStarColor(index - 1)"
158
- variant="ghost"
159
- :size="props.size"
160
- :disabled="props.disabled"
161
- :aria-label="`${index} \u661F`"
162
- :tabindex="-1"
163
- v-bind="buttonProps"
164
- class="transition-all duration-150"
165
- :class="{
166
- 'cursor-pointer hover:scale-110': isInteractive,
167
- 'cursor-not-allowed opacity-50': props.disabled,
168
- 'cursor-default': props.readonly && !props.disabled
169
- }"
170
- @click="handleClick(index - 1, $event)"
171
- @mouseenter="handleMouseEnter(index - 1, $event)"
172
- @mousemove="handleMouseMove(index - 1, $event)"
173
- @mouseleave="handleMouseLeave"
174
- />
175
- </div>
198
+ <FieldGroupReset>
199
+ <slot name="prefix" :value="modelValue" :max="props.max" />
200
+ <div :class="extendUi.stars">
201
+ <UButton
202
+ v-for="index in props.max"
203
+ :key="index"
204
+ :icon="getStarIcon(index - 1)"
205
+ :color="getStarColor(index - 1)"
206
+ variant="ghost"
207
+ :size="effectiveSize"
208
+ :disabled="effectiveDisabled"
209
+ :aria-label="`${index} \u661F`"
210
+ :tabindex="-1"
211
+ v-bind="buttonProps"
212
+ :class="extendUi.star"
213
+ @click="handleClick(index - 1, $event)"
214
+ @mouseenter="handleMouseEnter(index - 1, $event)"
215
+ @mousemove="handleMouseMove(index - 1, $event)"
216
+ @mouseleave="handleMouseLeave"
217
+ />
218
+ </div>
176
219
 
177
- <slot
178
- name="badge"
179
- :value="props.modelValue"
180
- :max="props.max"
181
- :label="badgeLabel"
182
- >
183
- <UBadge
184
- v-if="showBadge && props.modelValue > 0"
220
+ <slot
221
+ name="badge"
222
+ :value="modelValue"
223
+ :max="props.max"
185
224
  :label="badgeLabel"
186
- color="primary"
187
- variant="subtle"
188
- size="xs"
189
- />
190
- </slot>
225
+ >
226
+ <UBadge
227
+ v-if="showBadge && modelValue > 0"
228
+ :label="badgeLabel"
229
+ color="primary"
230
+ variant="subtle"
231
+ :size="effectiveSize"
232
+ />
233
+ </slot>
191
234
 
192
- <slot name="suffix" :value="props.modelValue" :max="props.max" />
235
+ <slot name="suffix" :value="modelValue" :max="props.max" />
236
+ </FieldGroupReset>
193
237
  </div>
194
238
  </template>
@@ -1,96 +1,47 @@
1
- import type { ButtonProps } from '@nuxt/ui';
2
- export interface StarRatingProps {
3
- /**
4
- * 当前评分值
5
- * @defaultValue 0
6
- */
1
+ import type { ComponentConfig } from '@nuxt/ui';
2
+ import theme from '#build/movk-ui/star-rating';
3
+ import type { AppConfig } from 'nuxt/schema';
4
+ import type { StarRatingProps } from '../types/components/star-rating';
5
+ type __VLS_Props = StarRatingProps & {
6
+ ui?: ComponentConfig<typeof theme, AppConfig, 'starRating'>['slots'];
7
+ };
8
+ type __VLS_ModelProps = {
7
9
  modelValue?: number;
8
- /**
9
- * 最大星级数
10
- * @defaultValue 5
11
- */
12
- max?: number;
13
- /**
14
- * 是否禁用
15
- * @defaultValue false
16
- */
17
- disabled?: boolean;
18
- /**
19
- * 是否只读
20
- * @defaultValue false
21
- */
22
- readonly?: boolean;
23
- /**
24
- * 是否显示评分徽章
25
- * @defaultValue true
26
- */
27
- showBadge?: boolean;
28
- /**
29
- * 自定义星星按钮属性
30
- */
31
- buttonProps?: Partial<ButtonProps>;
32
- /**
33
- * 未选中星星的图标
34
- * @defaultValue 'i-lucide-star'
35
- */
36
- emptyIcon?: string;
37
- /**
38
- * 选中星星的图标
39
- * @defaultValue 'i-lucide-star'
40
- */
41
- filledIcon?: string;
42
- /**
43
- * 半星图标
44
- * @defaultValue 'i-lucide-star-half'
45
- */
46
- halfIcon?: string;
47
- /**
48
- * 选中星星的颜色
49
- * @defaultValue 'warning'
50
- */
51
- color?: ButtonProps['color'];
52
- /**
53
- * 星星大小
54
- * @defaultValue 'sm'
55
- */
56
- size?: ButtonProps['size'];
57
- /**
58
- * 是否允许半星
59
- * @defaultValue false
60
- */
61
- allowHalf?: boolean;
62
- /**
63
- * 是否允许清除评分
64
- * @defaultValue false
65
- */
66
- clearable?: boolean;
67
- }
68
- export interface StarRatingEmits {
69
- 'update:modelValue': [value: number];
70
- /** 评分改变事件 */
71
- 'change': [value: number];
72
- /** 悬停事件 */
73
- 'hover': [value: number | null];
74
- }
75
- declare var __VLS_1: {
76
- value: any;
77
- max: any;
78
- }, __VLS_13: {
79
- value: any;
80
- max: any;
81
- label: any;
82
- }, __VLS_20: {
83
- value: any;
84
- max: any;
10
+ };
11
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
12
+ declare var __VLS_7: {
13
+ value: number;
14
+ max: number;
15
+ }, __VLS_19: {
16
+ value: number;
17
+ max: number;
18
+ label: string;
19
+ }, __VLS_26: {
20
+ value: number;
21
+ max: number;
85
22
  };
86
23
  type __VLS_Slots = {} & {
87
- prefix?: (props: typeof __VLS_1) => any;
24
+ prefix?: (props: typeof __VLS_7) => any;
88
25
  } & {
89
- badge?: (props: typeof __VLS_13) => any;
26
+ badge?: (props: typeof __VLS_19) => any;
90
27
  } & {
91
- suffix?: (props: typeof __VLS_20) => any;
28
+ suffix?: (props: typeof __VLS_26) => any;
92
29
  };
93
- declare const __VLS_base: any;
30
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
31
+ change: (value: number) => any;
32
+ hover: (value: number | null) => any;
33
+ "update:modelValue": (value: number) => any;
34
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
35
+ onChange?: ((value: number) => any) | undefined;
36
+ onHover?: ((value: number | null) => any) | undefined;
37
+ "onUpdate:modelValue"?: ((value: number) => any) | undefined;
38
+ }>, {
39
+ max: number;
40
+ showBadge: boolean;
41
+ emptyIcon: import("@nuxt/ui").IconProps["name"];
42
+ filledIcon: import("@nuxt/ui").IconProps["name"];
43
+ halfIcon: import("@nuxt/ui").IconProps["name"];
44
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
94
45
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
95
46
  declare const _default: typeof __VLS_export;
96
47
  export default _default;