@opentiny/vue-docs 3.28.1 → 3.30.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 (285) hide show
  1. package/demos/apis/action-menu.js +22 -0
  2. package/demos/apis/alert.js +19 -22
  3. package/demos/apis/button-group.js +15 -0
  4. package/demos/apis/calendar-view.js +5 -5
  5. package/demos/apis/cascader-view.js +5 -5
  6. package/demos/apis/dialog-box.js +39 -38
  7. package/demos/apis/drawer.js +31 -0
  8. package/demos/apis/dropdown.js +39 -1
  9. package/demos/apis/filter-panel.js +21 -1
  10. package/demos/apis/fluent-editor.js +30 -0
  11. package/demos/apis/form.js +11 -0
  12. package/demos/apis/fullscreen.js +10 -11
  13. package/demos/apis/grid.js +131 -16
  14. package/demos/apis/guide.js +14 -0
  15. package/demos/apis/link.js +11 -0
  16. package/demos/apis/message.js +48 -22
  17. package/demos/apis/modal.js +34 -31
  18. package/demos/apis/notify.js +13 -13
  19. package/demos/apis/rate.js +15 -0
  20. package/demos/apis/search-box.js +343 -0
  21. package/demos/apis/select.js +14 -2
  22. package/demos/apis/tag-input.js +182 -0
  23. package/demos/apis/tree.js +23 -23
  24. package/demos/mobile-first/app/button-group/display-mode.vue +31 -0
  25. package/demos/mobile-first/app/button-group/webdoc/button-group.js +13 -0
  26. package/demos/mobile-first/app/calendar-view/webdoc/calendar-view.js +5 -4
  27. package/demos/mobile-first/app/modal/webdoc/modal.js +2 -1
  28. package/demos/pc/app/alert/center.spec.ts +8 -0
  29. package/demos/pc/app/alert/custom-close.spec.ts +39 -9
  30. package/demos/pc/app/alert/icon.spec.ts +18 -7
  31. package/demos/pc/app/alert/show-icon.spec.ts +1 -1
  32. package/demos/pc/app/anchor/webdoc/anchor.js +1 -0
  33. package/demos/pc/app/base-select/copy-multi.spec.ts +1 -1
  34. package/demos/pc/app/button-group/display-mode-composition-api.vue +23 -0
  35. package/demos/pc/app/button-group/display-mode.spec.ts +0 -0
  36. package/demos/pc/app/button-group/display-mode.vue +31 -0
  37. package/demos/pc/app/button-group/sup-composition-api.vue +1 -0
  38. package/demos/pc/app/button-group/sup.vue +1 -0
  39. package/demos/pc/app/button-group/webdoc/button-group.js +14 -0
  40. package/demos/pc/app/calendar-view/calendar-event.spec.ts +1 -1
  41. package/demos/pc/app/calendar-view/custom-day-bg-color.vue +10 -0
  42. package/demos/pc/app/calendar-view/webdoc/calendar-view.js +4 -4
  43. package/demos/pc/app/cascader/filter-mode-composition-api.vue +2 -3
  44. package/demos/pc/app/checkbox/checked-composition-api.vue +3 -3
  45. package/demos/pc/app/checkbox/checked.vue +3 -3
  46. package/demos/pc/app/date-picker/align.spec.ts +10 -13
  47. package/demos/pc/app/date-picker/clear.spec.ts +3 -3
  48. package/demos/pc/app/date-picker/default-value.spec.ts +4 -4
  49. package/demos/pc/app/date-picker/events.spec.ts +2 -2
  50. package/demos/pc/app/date-picker/format.spec.ts +3 -3
  51. package/demos/pc/app/date-picker/now.spec.ts +4 -4
  52. package/demos/pc/app/date-picker/shortcuts.spec.ts +1 -1
  53. package/demos/pc/app/date-picker/slot.spec.ts +5 -5
  54. package/demos/pc/app/dialog-box/basic-usage.spec.ts +5 -5
  55. package/demos/pc/app/dialog-box/form-in-dialog.spec.ts +1 -2
  56. package/demos/pc/app/drawer/basic-usage.spec.ts +4 -3
  57. package/demos/pc/app/drawer/close-on-press-escape.spec.ts +4 -2
  58. package/demos/pc/app/drawer/placement.spec.ts +4 -4
  59. package/demos/pc/app/drawer/show-header.spec.ts +3 -2
  60. package/demos/pc/app/drawer/webdoc/drawer.js +3 -2
  61. package/demos/pc/app/dropdown/show-icon-composition-api.vue +1 -1
  62. package/demos/pc/app/dropdown/show-icon.vue +1 -1
  63. package/demos/pc/app/dropdown/tip-composition-api.vue +5 -2
  64. package/demos/pc/app/dropdown/tip.vue +5 -2
  65. package/demos/pc/app/dropdown/webdoc/dropdown.js +2 -2
  66. package/demos/pc/app/filter-panel/size-composition-api.vue +58 -0
  67. package/demos/pc/app/filter-panel/size.spec.ts +23 -0
  68. package/demos/pc/app/filter-panel/size.vue +68 -0
  69. package/demos/pc/app/filter-panel/webdoc/filter-panel.js +13 -0
  70. package/demos/pc/app/flowchart/basic-usage-composition-api.vue +10 -260
  71. package/demos/pc/app/flowchart/basic-usage.spec.ts +2 -1
  72. package/demos/pc/app/flowchart/basic-usage.vue +4 -249
  73. package/demos/pc/app/flowchart/slots-composition-api.vue +182 -0
  74. package/demos/pc/app/flowchart/slots.spec.ts +24 -0
  75. package/demos/pc/app/flowchart/slots.vue +193 -0
  76. package/demos/pc/app/flowchart/webdoc/flowchart.js +14 -2
  77. package/demos/pc/app/form/basic-usage.spec.ts +6 -4
  78. package/demos/pc/app/form/custom-validation-string-length-composition-api.vue +38 -0
  79. package/demos/pc/app/form/custom-validation-string-length.spec.ts +18 -0
  80. package/demos/pc/app/form/custom-validation-string-length.vue +28 -13
  81. package/demos/pc/app/form/group-form-composition-api.vue +2 -2
  82. package/demos/pc/app/form/group-form.vue +2 -2
  83. package/demos/pc/app/grid/filter/advanced-filter-composition-api.vue +1 -1
  84. package/demos/pc/app/grid/filter/advanced-filter.spec.js +1 -0
  85. package/demos/pc/app/grid/filter/advanced-filter.vue +1 -1
  86. package/demos/pc/app/grid/filter/custom-filter-composition-api.vue +46 -23
  87. package/demos/pc/app/grid/filter/custom-filter.spec.js +1 -1
  88. package/demos/pc/app/grid/filter/custom-filter.vue +47 -24
  89. package/demos/pc/app/grid/filter/default-filter-composition-api.vue +5 -1
  90. package/demos/pc/app/grid/filter/default-filter.spec.ts +1 -0
  91. package/demos/pc/app/grid/filter/default-filter.vue +4 -1
  92. package/demos/pc/app/grid/filter/filter-label-value-composition-api.vue +71 -0
  93. package/demos/pc/app/grid/filter/filter-label-value.spec.ts +27 -0
  94. package/demos/pc/app/grid/filter/filter-label-value.vue +78 -0
  95. package/demos/pc/app/grid/filter/input-filter-custom-component-composition-api.vue +116 -0
  96. package/demos/pc/app/grid/filter/input-filter-custom-component.spec.ts +20 -0
  97. package/demos/pc/app/grid/filter/input-filter-custom-component.vue +126 -0
  98. package/demos/pc/app/grid/filter/layout-order-filter-composition-api.vue +114 -0
  99. package/demos/pc/app/grid/filter/layout-order-filter.spec.ts +31 -0
  100. package/demos/pc/app/grid/filter/layout-order-filter.vue +123 -0
  101. package/demos/pc/app/grid/toolbar/custom-toolbar.spec.js +1 -1
  102. package/demos/pc/app/grid/webdoc/grid-filter.js +89 -40
  103. package/demos/pc/app/guide/show-close-composition-api.vue +77 -0
  104. package/demos/pc/app/guide/show-close.spec.ts +37 -0
  105. package/demos/pc/app/guide/show-close.vue +84 -0
  106. package/demos/pc/app/guide/webdoc/guide.js +12 -0
  107. package/demos/pc/app/icon/advance-icons.js +108 -2
  108. package/demos/pc/app/icon/advance-usage-composition-api.vue +26 -1
  109. package/demos/pc/app/icon/advance-usage.vue +27 -1
  110. package/demos/pc/app/icon/webdoc/icon.js +5 -3
  111. package/demos/pc/app/input/resize.spec.ts +2 -2
  112. package/demos/pc/app/link/custom-icon-composition-api.vue +1 -1
  113. package/demos/pc/app/link/custom-icon.vue +1 -1
  114. package/demos/pc/app/link/target-composition-api.vue +24 -0
  115. package/demos/pc/app/link/target.spec.ts +41 -0
  116. package/demos/pc/app/link/target.vue +30 -0
  117. package/demos/pc/app/link/webdoc/link.js +14 -0
  118. package/demos/pc/app/message/basic-usage-composition-api.vue +48 -0
  119. package/demos/pc/app/message/basic-usage.spec.ts +27 -0
  120. package/demos/pc/app/message/basic-usage.vue +50 -0
  121. package/demos/pc/app/message/message-close-composition-api.vue +25 -0
  122. package/demos/pc/app/message/message-close.spec.ts +9 -0
  123. package/demos/pc/app/message/message-close.vue +32 -0
  124. package/demos/pc/app/message/message-duration-composition-api.vue +25 -0
  125. package/demos/pc/app/message/message-duration.spec.ts +9 -0
  126. package/demos/pc/app/message/message-duration.vue +32 -0
  127. package/demos/pc/app/message/prevent-duplicate-composition-api.vue +25 -0
  128. package/demos/pc/app/message/prevent-duplicate.spec.ts +9 -0
  129. package/demos/pc/app/message/prevent-duplicate.vue +32 -0
  130. package/demos/pc/app/message/webdoc/message.cn.md +7 -0
  131. package/demos/pc/app/message/webdoc/message.en.md +7 -0
  132. package/demos/pc/app/message/webdoc/message.js +56 -0
  133. package/demos/pc/app/modal/basic-usage.spec.ts +3 -3
  134. package/demos/pc/app/modal/modal-footer-composition-api.vue +3 -3
  135. package/demos/pc/app/modal/modal-footer.spec.ts +9 -4
  136. package/demos/pc/app/modal/modal-footer.vue +3 -3
  137. package/demos/pc/app/modal/modal-header.spec.ts +2 -2
  138. package/demos/pc/app/modal/modal-size.spec.ts +2 -2
  139. package/demos/pc/app/modal/status.spec.ts +22 -15
  140. package/demos/pc/app/nav-menu/overflow.spec.ts +1 -1
  141. package/demos/pc/app/popconfirm/custom-class.spec.ts +0 -1
  142. package/demos/pc/app/popconfirm/slot-message.spec.ts +10 -2
  143. package/demos/pc/app/popconfirm/trigger.spec.ts +16 -12
  144. package/demos/pc/app/popover/basic-usage.spec.js +3 -8
  145. package/demos/pc/app/popover/custom-popper.spec.js +2 -2
  146. package/demos/pc/app/popover/delay.spec.js +2 -2
  147. package/demos/pc/app/popover/disabled.spec.js +2 -2
  148. package/demos/pc/app/popover/events.spec.js +1 -1
  149. package/demos/pc/app/popover/ignore-boundaries.spec.js +2 -3
  150. package/demos/pc/app/popover/offset.spec.js +17 -31
  151. package/demos/pc/app/radio/dynamic-disable-composition-api.vue +3 -3
  152. package/demos/pc/app/radio/dynamic-disable.vue +2 -2
  153. package/demos/pc/app/rate/clearable-composition-api.vue +20 -0
  154. package/demos/pc/app/rate/clearable.spec.js +74 -0
  155. package/demos/pc/app/rate/clearable.vue +28 -0
  156. package/demos/pc/app/rate/webdoc/rate.js +12 -0
  157. package/demos/pc/app/search/events.spec.ts +1 -1
  158. package/demos/pc/app/search-box/append-to-body-composition-api.vue +300 -0
  159. package/demos/pc/app/search-box/append-to-body.vue +308 -0
  160. package/demos/pc/app/search-box/auto-match-composition-api.vue +162 -0
  161. package/demos/pc/app/search-box/auto-match.vue +170 -0
  162. package/demos/pc/app/search-box/basic-usage-composition-api.vue +269 -0
  163. package/demos/pc/app/search-box/basic-usage.vue +277 -0
  164. package/demos/pc/app/search-box/custom-panel-composition-api.vue +63 -0
  165. package/demos/pc/app/search-box/custom-panel.vue +72 -0
  166. package/demos/pc/app/search-box/default-field-composition-api.vue +163 -0
  167. package/demos/pc/app/search-box/default-field.vue +171 -0
  168. package/demos/pc/app/search-box/editable-composition-api.vue +311 -0
  169. package/demos/pc/app/search-box/editable.vue +320 -0
  170. package/demos/pc/app/search-box/empty-placeholder-composition-api.vue +162 -0
  171. package/demos/pc/app/search-box/empty-placeholder.vue +170 -0
  172. package/demos/pc/app/search-box/events-composition-api.vue +169 -0
  173. package/demos/pc/app/search-box/events.vue +173 -0
  174. package/demos/pc/app/search-box/group-key-composition-api.vue +257 -0
  175. package/demos/pc/app/search-box/group-key.vue +266 -0
  176. package/demos/pc/app/search-box/help-composition-api.vue +166 -0
  177. package/demos/pc/app/search-box/help.vue +175 -0
  178. package/demos/pc/app/search-box/id-map-key-composition-api.vue +131 -0
  179. package/demos/pc/app/search-box/id-map-key.vue +140 -0
  180. package/demos/pc/app/search-box/item-placeholder-composition-api.vue +119 -0
  181. package/demos/pc/app/search-box/item-placeholder.vue +127 -0
  182. package/demos/pc/app/search-box/max-length-composition-api.vue +29 -0
  183. package/demos/pc/app/search-box/max-length.vue +38 -0
  184. package/demos/pc/app/search-box/max-time-length-composition-api.vue +53 -0
  185. package/demos/pc/app/search-box/max-time-length.vue +62 -0
  186. package/demos/pc/app/search-box/merge-tag-composition-api.vue +59 -0
  187. package/demos/pc/app/search-box/merge-tag.vue +68 -0
  188. package/demos/pc/app/search-box/panel-max-height-composition-api.vue +162 -0
  189. package/demos/pc/app/search-box/panel-max-height.vue +170 -0
  190. package/demos/pc/app/search-box/potential-match-composition-api.vue +193 -0
  191. package/demos/pc/app/search-box/potential-match.vue +201 -0
  192. package/demos/pc/app/search-box/settings-composition-api.vue +163 -0
  193. package/demos/pc/app/search-box/settings.vue +171 -0
  194. package/demos/pc/app/search-box/size-composition-api.vue +162 -0
  195. package/demos/pc/app/search-box/size.vue +170 -0
  196. package/demos/pc/app/search-box/split-input-value-composition-api.vue +162 -0
  197. package/demos/pc/app/search-box/split-input-value.vue +170 -0
  198. package/demos/pc/app/search-box/suffix-icon-composition-api.vue +209 -0
  199. package/demos/pc/app/search-box/suffix-icon.vue +219 -0
  200. package/demos/pc/app/search-box/v-model-composition-api.vue +174 -0
  201. package/demos/pc/app/search-box/v-model.vue +182 -0
  202. package/demos/pc/app/search-box/webdoc/search-box.cn.md +7 -0
  203. package/demos/pc/app/search-box/webdoc/search-box.en.md +7 -0
  204. package/demos/pc/app/search-box/webdoc/search-box.js +257 -0
  205. package/demos/pc/app/select/copy-multi.spec.ts +1 -1
  206. package/demos/pc/app/select-wrapper/copy-multi.spec.ts +2 -1
  207. package/demos/pc/app/tabs/basic-usage.spec.ts +2 -2
  208. package/demos/pc/app/tabs/more-show-all.spec.ts +2 -1
  209. package/demos/pc/app/tabs/tabs-events-close-composition-api.vue +8 -2
  210. package/demos/pc/app/tabs/tabs-events-close.vue +8 -2
  211. package/demos/pc/app/tag/basic-usage.spec.ts +1 -1
  212. package/demos/pc/app/tag/color-border.spec.ts +2 -2
  213. package/demos/pc/app/tag/max-width.spec.ts +1 -1
  214. package/demos/pc/app/tag/size.spec.ts +3 -3
  215. package/demos/pc/app/tag/slot-default.spec.ts +3 -3
  216. package/demos/pc/app/tag-group/basic-usage.spec.js +5 -5
  217. package/demos/pc/app/tag-group/tag-group-effect.spec.js +10 -10
  218. package/demos/pc/app/tag-group/tag-group-event.spec.js +1 -1
  219. package/demos/pc/app/tag-input/basic-usage-composition-api.vue +29 -0
  220. package/demos/pc/app/tag-input/basic-usage.spec.ts +0 -0
  221. package/demos/pc/app/tag-input/basic-usage.vue +38 -0
  222. package/demos/pc/app/tag-input/clearable-tag-composition-api.vue +20 -0
  223. package/demos/pc/app/tag-input/clearable-tag.vue +27 -0
  224. package/demos/pc/app/tag-input/collapsed-tag-composition-api.vue +20 -0
  225. package/demos/pc/app/tag-input/collapsed-tag.vue +28 -0
  226. package/demos/pc/app/tag-input/disabled-readonly-composition-api.vue +20 -0
  227. package/demos/pc/app/tag-input/disabled-readonly.vue +29 -0
  228. package/demos/pc/app/tag-input/draggable-tag-composition-api.vue +12 -0
  229. package/demos/pc/app/tag-input/draggable-tag.spec.ts +0 -0
  230. package/demos/pc/app/tag-input/draggable-tag.vue +20 -0
  231. package/demos/pc/app/tag-input/max-composition-api.vue +20 -0
  232. package/demos/pc/app/tag-input/max.vue +28 -0
  233. package/demos/pc/app/tag-input/prefix-suffix-composition-api.vue +26 -0
  234. package/demos/pc/app/tag-input/prefix-suffix.vue +34 -0
  235. package/demos/pc/app/tag-input/separator-tag-composition-api.vue +20 -0
  236. package/demos/pc/app/tag-input/separator-tag.vue +28 -0
  237. package/demos/pc/app/tag-input/webdoc/tag-input.cn.md +7 -0
  238. package/demos/pc/app/tag-input/webdoc/tag-input.en.md +7 -0
  239. package/demos/pc/app/tag-input/webdoc/tag-input.js +107 -0
  240. package/demos/pc/app/time-picker/basic-usage.spec.ts +5 -4
  241. package/demos/pc/app/time-picker/clearable.spec.ts +5 -4
  242. package/demos/pc/app/time-picker/default-value.spec.ts +2 -2
  243. package/demos/pc/app/time-picker/disabled.spec.ts +4 -3
  244. package/demos/pc/app/time-picker/format.spec.ts +8 -11
  245. package/demos/pc/app/time-picker/is-range.spec.ts +4 -3
  246. package/demos/pc/app/time-picker/name.spec.ts +1 -1
  247. package/demos/pc/app/time-picker/placeholder.spec.ts +3 -3
  248. package/demos/pc/app/time-picker/popper-class.spec.ts +1 -1
  249. package/demos/pc/app/time-picker/size.spec.ts +2 -1
  250. package/demos/pc/app/time-select/basic-usage.spec.ts +1 -1
  251. package/demos/pc/app/time-select/clear-icon.spec.ts +1 -2
  252. package/demos/pc/app/time-select/focus.spec.ts +1 -1
  253. package/demos/pc/app/time-select/picker-options.spec.ts +2 -1
  254. package/demos/pc/app/time-select/range-placeholder.spec.ts +2 -2
  255. package/demos/pc/app/time-select/size-medium.spec.ts +3 -3
  256. package/demos/pc/app/tooltip/delay.spec.js +7 -9
  257. package/demos/pc/app/tooltip/offset.spec.js +0 -2
  258. package/demos/pc/app/tooltip/popper-options.spec.js +2 -1
  259. package/demos/pc/menus.js +6 -4
  260. package/demos/pc/webdoc/changelog-en.md +209 -86
  261. package/demos/pc/webdoc/changelog.md +176 -257
  262. package/demos/pc/webdoc/develop-demo-en.md +13 -13
  263. package/demos/pc/webdoc/import-components.md +1 -1
  264. package/demos/pc/webdoc/introduce.md +2 -0
  265. package/demos/pc/webdoc/skills-en.md +107 -0
  266. package/demos/pc/webdoc/skills.md +107 -0
  267. package/demos/pc/webdoc/theme-en.md +82 -79
  268. package/demos/pc/webdoc/v3.28.0-release-article.md +943 -0
  269. package/demos/saas/menus.js +1 -0
  270. package/package.json +21 -20
  271. package/playground/App.vue +6 -4
  272. package/playground/shims/vue-search-box.mjs +154 -0
  273. package/public/static/css/mobile-dark-theme.css +1 -0
  274. package/src/i18n/index.js +1 -2
  275. package/src/main.js +8 -5
  276. package/src/style.css +5 -0
  277. package/src/views/components-doc/common.vue +0 -25
  278. package/src/views/components-doc/mobile.vue +49 -2
  279. package/vite.config.ts +3 -2
  280. package/vite.extend.ts +65 -0
  281. package/demos/pc/app/grid/webdoc/grid-ai-agent.js +0 -23
  282. package/demos/pc/webdoc/mcp-en.md +0 -101
  283. package/demos/pc/webdoc/mcp.md +0 -101
  284. package/src/components/mcp-docs.vue +0 -33
  285. package/src/composable/useTinyRemoter.ts +0 -176
@@ -0,0 +1,131 @@
1
+ <template>
2
+ <div class="demo">
3
+ <tiny-search-box v-model="tags" :items="dataSource" @change="onChange" />
4
+ </div>
5
+ </template>
6
+
7
+ <script setup>
8
+ import { ref } from 'vue'
9
+ import TinySearchBox from '@opentiny/vue-search-box'
10
+
11
+ const tags = ref([])
12
+ const dataSource = ref([
13
+ {
14
+ label: '名称',
15
+ field: 'testName',
16
+ idMapKey: 'nameId', // 指定筛选项暴露 nameId 键值,可用来检索过滤
17
+ options: [
18
+ {
19
+ label: 'ecs-1',
20
+ nameId: 0
21
+ },
22
+ {
23
+ label: 'obs-2',
24
+ nameId: 2
25
+ },
26
+ {
27
+ label: 'vpc-1',
28
+ nameId: 3
29
+ },
30
+ {
31
+ label: 'evs-2',
32
+ nameId: 4
33
+ },
34
+ {
35
+ label: 'tms-1',
36
+ nameId: 5
37
+ }
38
+ ]
39
+ },
40
+ {
41
+ label: '可用地区',
42
+ field: 'testRegion',
43
+ type: 'checkbox',
44
+ options: [
45
+ {
46
+ label: '华南区',
47
+ id: '2-1' // idMapKey默认是id
48
+ },
49
+ {
50
+ label: '华北区',
51
+ id: '2-2'
52
+ },
53
+ {
54
+ label: '西北区',
55
+ id: '2-3'
56
+ },
57
+ {
58
+ label: '西南区',
59
+ id: '2-4'
60
+ }
61
+ ]
62
+ },
63
+ {
64
+ label: '标签',
65
+ field: 'testTag',
66
+ type: 'map',
67
+ idMapKey: 'tagId',
68
+ options: [
69
+ {
70
+ label: 'aaa',
71
+ tagId: 'id-1',
72
+ allValues: false,
73
+ options: [
74
+ {
75
+ label: '空值',
76
+ tagId: 'aaa-ddd'
77
+ },
78
+ {
79
+ label: '所有值',
80
+ tagId: 'aaa-eee'
81
+ },
82
+ {
83
+ label: '123',
84
+ tagId: 'aaa-fff'
85
+ }
86
+ ]
87
+ },
88
+ {
89
+ label: 'bbb',
90
+ tagId: 'id-2',
91
+ options: [
92
+ {
93
+ label: 'hhh',
94
+ tagId: 'bbb-hhh'
95
+ },
96
+ {
97
+ label: 'iii',
98
+ tagId: 'bbb-iii'
99
+ },
100
+ {
101
+ label: 'jjj',
102
+ tagId: 'bbb-jjj'
103
+ }
104
+ ]
105
+ },
106
+ {
107
+ label: 'ccc',
108
+ tagId: 'id-3',
109
+ options: [
110
+ {
111
+ label: 'kkk',
112
+ tagId: 'ccc-kkk'
113
+ },
114
+ {
115
+ label: 'lll',
116
+ tagId: 'ccc-lll'
117
+ },
118
+ {
119
+ label: 'mmm',
120
+ tagId: 'ccc-mmm'
121
+ }
122
+ ]
123
+ }
124
+ ]
125
+ }
126
+ ])
127
+
128
+ function onChange(newFilters, oldFilters) {
129
+ console.log('changeEvent:', JSON.stringify(newFilters), oldFilters)
130
+ }
131
+ </script>
@@ -0,0 +1,140 @@
1
+ <template>
2
+ <div class="demo">
3
+ <tiny-search-box v-model="tags" :items="dataSource" @change="onChange" />
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ import TinySearchBox from '@opentiny/vue-search-box'
9
+
10
+ export default {
11
+ components: {
12
+ TinySearchBox
13
+ },
14
+ data() {
15
+ return {
16
+ tags: [],
17
+ dataSource: [
18
+ {
19
+ label: '名称',
20
+ field: 'testName',
21
+ idMapKey: 'nameId', // 指定筛选项暴露 nameId 键值,可用来检索过滤
22
+ options: [
23
+ {
24
+ label: 'ecs-1',
25
+ nameId: 0
26
+ },
27
+ {
28
+ label: 'obs-2',
29
+ nameId: 2
30
+ },
31
+ {
32
+ label: 'vpc-1',
33
+ nameId: 3
34
+ },
35
+ {
36
+ label: 'evs-2',
37
+ nameId: 4
38
+ },
39
+ {
40
+ label: 'tms-1',
41
+ nameId: 5
42
+ }
43
+ ]
44
+ },
45
+ {
46
+ label: '可用地区',
47
+ field: 'testRegion',
48
+ type: 'checkbox',
49
+ options: [
50
+ {
51
+ label: '华南区',
52
+ id: '2-1' // idMapKey默认是id
53
+ },
54
+ {
55
+ label: '华北区',
56
+ id: '2-2'
57
+ },
58
+ {
59
+ label: '西北区',
60
+ id: '2-3'
61
+ },
62
+ {
63
+ label: '西南区',
64
+ id: '2-4'
65
+ }
66
+ ]
67
+ },
68
+ {
69
+ label: '标签',
70
+ field: 'testTag',
71
+ type: 'map',
72
+ idMapKey: 'tagId',
73
+ options: [
74
+ {
75
+ label: 'aaa',
76
+ tagId: 'id-1',
77
+ allValues: false,
78
+ options: [
79
+ {
80
+ label: '空值',
81
+ tagId: 'aaa-ddd'
82
+ },
83
+ {
84
+ label: '所有值',
85
+ tagId: 'aaa-eee'
86
+ },
87
+ {
88
+ label: '123',
89
+ tagId: 'aaa-fff'
90
+ }
91
+ ]
92
+ },
93
+ {
94
+ label: 'bbb',
95
+ tagId: 'id-2',
96
+ options: [
97
+ {
98
+ label: 'hhh',
99
+ tagId: 'bbb-hhh'
100
+ },
101
+ {
102
+ label: 'iii',
103
+ tagId: 'bbb-iii'
104
+ },
105
+ {
106
+ label: 'jjj',
107
+ tagId: 'bbb-jjj'
108
+ }
109
+ ]
110
+ },
111
+ {
112
+ label: 'ccc',
113
+ tagId: 'id-3',
114
+ options: [
115
+ {
116
+ label: 'kkk',
117
+ tagId: 'ccc-kkk'
118
+ },
119
+ {
120
+ label: 'lll',
121
+ tagId: 'ccc-lll'
122
+ },
123
+ {
124
+ label: 'mmm',
125
+ tagId: 'ccc-mmm'
126
+ }
127
+ ]
128
+ }
129
+ ]
130
+ }
131
+ ]
132
+ }
133
+ },
134
+ methods: {
135
+ onChange(newFilters, oldFilters) {
136
+ console.log('changeEvent:', JSON.stringify(newFilters), oldFilters)
137
+ }
138
+ }
139
+ }
140
+ </script>
@@ -0,0 +1,119 @@
1
+ <template>
2
+ <div class="demo">
3
+ <tiny-search-box v-model="tags" :items="items" editable />
4
+ </div>
5
+ </template>
6
+
7
+ <script setup>
8
+ import { ref } from 'vue'
9
+ import TinySearchBox from '@opentiny/vue-search-box'
10
+
11
+ const tags = ref([
12
+ {
13
+ field: 'testRegion',
14
+ label: '可用地区',
15
+ type: 'checkbox',
16
+ value: '华南区 | 西北区 | 华北区 | 西南区 | 东南区',
17
+ options: [
18
+ {
19
+ label: '华南区',
20
+ id: '2-1'
21
+ },
22
+ {
23
+ label: '西北区',
24
+ id: '2-3'
25
+ },
26
+ {
27
+ label: '华北区',
28
+ id: '2-2'
29
+ },
30
+ {
31
+ label: '西南区',
32
+ id: '2-4'
33
+ },
34
+ {
35
+ label: '东南区',
36
+ id: '2-5'
37
+ }
38
+ ]
39
+ }
40
+ ])
41
+ const items = ref([
42
+ {
43
+ label: '名称',
44
+ field: 'testName',
45
+ replace: true,
46
+ placeholder: '我是自定义名称的占位符',
47
+ options: [
48
+ {
49
+ label: 'ecs-1'
50
+ },
51
+ {
52
+ label: 'obs-2'
53
+ },
54
+ {
55
+ label: 'vpc-1'
56
+ },
57
+ {
58
+ label: 'evs-2'
59
+ },
60
+ {
61
+ label: 'tms-1'
62
+ }
63
+ ]
64
+ },
65
+ {
66
+ label: '可用地区',
67
+ field: 'testRegion',
68
+ type: 'checkbox',
69
+ mergeTag: true,
70
+ allowCreate: true,
71
+ placeholder: '我是自定义可选地区的占位符',
72
+ editAttrDisabled: true, // 编辑状态此属性禁用,不可变更
73
+ options: [
74
+ {
75
+ label: '华南区',
76
+ id: '2-1'
77
+ },
78
+ {
79
+ label: '华北区',
80
+ id: '2-2'
81
+ },
82
+ {
83
+ label: '西北区',
84
+ id: '2-3'
85
+ },
86
+ {
87
+ label: '西南区',
88
+ id: '2-4'
89
+ },
90
+ {
91
+ label: '东南区',
92
+ id: '2-5'
93
+ },
94
+ {
95
+ label: '东北区',
96
+ id: '2-6'
97
+ },
98
+ {
99
+ label: '华东区',
100
+ id: '2-7'
101
+ },
102
+ {
103
+ label: '华西区',
104
+ id: '2-8'
105
+ }
106
+ ]
107
+ },
108
+ {
109
+ label: '大小',
110
+ field: 'size',
111
+ type: 'numRange',
112
+ placeholder: '我是自定义大小的占位符',
113
+ unit: 'GB',
114
+ start: -1,
115
+ min: -1,
116
+ max: 20
117
+ }
118
+ ])
119
+ </script>
@@ -0,0 +1,127 @@
1
+ <template>
2
+ <div class="demo">
3
+ <tiny-search-box v-model="tags" :items="items" editable />
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ import TinySearchBox from '@opentiny/vue-search-box'
9
+
10
+ export default {
11
+ components: {
12
+ TinySearchBox
13
+ },
14
+ data() {
15
+ return {
16
+ items: [
17
+ {
18
+ label: '名称',
19
+ field: 'testName',
20
+ replace: true,
21
+ placeholder: '我是自定义名称的占位符',
22
+ options: [
23
+ {
24
+ label: 'ecs-1'
25
+ },
26
+ {
27
+ label: 'obs-2'
28
+ },
29
+ {
30
+ label: 'vpc-1'
31
+ },
32
+ {
33
+ label: 'evs-2'
34
+ },
35
+ {
36
+ label: 'tms-1'
37
+ }
38
+ ]
39
+ },
40
+ {
41
+ label: '可用地区',
42
+ field: 'testRegion',
43
+ type: 'checkbox',
44
+ mergeTag: true,
45
+ allowCreate: true,
46
+ placeholder: '我是自定义可选地区的占位符',
47
+ editAttrDisabled: true, // 编辑状态此属性禁用,不可变更
48
+ options: [
49
+ {
50
+ label: '华南区',
51
+ id: '2-1'
52
+ },
53
+ {
54
+ label: '华北区',
55
+ id: '2-2'
56
+ },
57
+ {
58
+ label: '西北区',
59
+ id: '2-3'
60
+ },
61
+ {
62
+ label: '西南区',
63
+ id: '2-4'
64
+ },
65
+ {
66
+ label: '东南区',
67
+ id: '2-5'
68
+ },
69
+ {
70
+ label: '东北区',
71
+ id: '2-6'
72
+ },
73
+ {
74
+ label: '华东区',
75
+ id: '2-7'
76
+ },
77
+ {
78
+ label: '华西区',
79
+ id: '2-8'
80
+ }
81
+ ]
82
+ },
83
+ {
84
+ label: '大小',
85
+ field: 'size',
86
+ type: 'numRange',
87
+ placeholder: '我是自定义大小的占位符',
88
+ unit: 'GB',
89
+ start: -1,
90
+ min: -1,
91
+ max: 20
92
+ }
93
+ ],
94
+ tags: [
95
+ {
96
+ field: 'testRegion',
97
+ label: '可用地区',
98
+ type: 'checkbox',
99
+ value: '华南区 | 西北区 | 华北区 | 西南区 | 东南区',
100
+ options: [
101
+ {
102
+ label: '华南区',
103
+ id: '2-1'
104
+ },
105
+ {
106
+ label: '西北区',
107
+ id: '2-3'
108
+ },
109
+ {
110
+ label: '华北区',
111
+ id: '2-2'
112
+ },
113
+ {
114
+ label: '西南区',
115
+ id: '2-4'
116
+ },
117
+ {
118
+ label: '东南区',
119
+ id: '2-5'
120
+ }
121
+ ]
122
+ }
123
+ ]
124
+ }
125
+ }
126
+ }
127
+ </script>
@@ -0,0 +1,29 @@
1
+ <template>
2
+ <div class="demo">
3
+ <tiny-search-box v-model="tags" :items="dataSource" :maxlength="maxlength" @exceed="handleExceed" />
4
+ </div>
5
+ </template>
6
+
7
+ <script setup>
8
+ import { ref } from 'vue'
9
+ import TinySearchBox from '@opentiny/vue-search-box'
10
+
11
+ const tags = ref([])
12
+ const maxlength = ref(8)
13
+ const dataSource = ref([
14
+ {
15
+ label: '名称',
16
+ field: 'testName',
17
+ replace: true,
18
+ options: [
19
+ {
20
+ label: '不能超过8个字符'
21
+ }
22
+ ]
23
+ }
24
+ ])
25
+
26
+ function handleExceed(number) {
27
+ alert(`不能超过${number}个字符`)
28
+ }
29
+ </script>
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <div class="demo">
3
+ <tiny-search-box v-model="tags" :items="dataSource" :maxlength="maxlength" @exceed="handleExceed" />
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ import TinySearchBox from '@opentiny/vue-search-box'
9
+
10
+ export default {
11
+ components: {
12
+ TinySearchBox
13
+ },
14
+ data() {
15
+ return {
16
+ tags: [],
17
+ maxlength: 8,
18
+ dataSource: [
19
+ {
20
+ label: '名称',
21
+ field: 'testName',
22
+ replace: true,
23
+ options: [
24
+ {
25
+ label: '不能超过8个字符'
26
+ }
27
+ ]
28
+ }
29
+ ]
30
+ }
31
+ },
32
+ methods: {
33
+ handleExceed(number) {
34
+ alert(`不能超过${number}个字符`)
35
+ }
36
+ }
37
+ }
38
+ </script>
@@ -0,0 +1,53 @@
1
+ <template>
2
+ <div class="demo">
3
+ <tiny-search-box v-model="tags" :items="items" @change="onChange" />
4
+ </div>
5
+ </template>
6
+
7
+ <script setup>
8
+ import { ref } from 'vue'
9
+ import TinySearchBox from '@opentiny/vue-search-box'
10
+
11
+ // 获取当前时间
12
+ const now = new Date()
13
+ // 获取一年的毫秒数:设置只能选择一年的时间区间
14
+ const year = 365 * 24 * 60 * 60 * 1000
15
+ // 获取半年的毫秒数:设置只能选择半年的时间区间
16
+ const halfYear = (365 / 2) * 24 * 3600 * 1000
17
+ // 获取一天的毫秒数
18
+ const day = 24 * 60 * 60 * 1000
19
+
20
+ const tags = ref([])
21
+ const items = ref([
22
+ {
23
+ label: '日期',
24
+ field: 'date',
25
+ type: 'dateRange',
26
+ format: 'yyyy/MM/dd', // 默认格式
27
+ // 默认开始时间
28
+ start: new Date(),
29
+ // 默认结束时间
30
+ end: undefined,
31
+ maxTimeLength: year, // 可选择的时间跨度为一年内
32
+ // 最小时间(当前时间前5天)
33
+ min: new Date(now.getTime() - 5 * day),
34
+ // 最大时间(当前时间后1年2个月)
35
+ max: new Date(now.getTime() + year + 2 * 30 * day)
36
+ },
37
+ {
38
+ label: '时间日期',
39
+ field: 'datetime',
40
+ type: 'datetimeRange',
41
+ format: 'yyyy/MM/dd HH:mm:ss', // 默认格式
42
+ // 最小时间(当前时间前半年)
43
+ // min: new Date(now.getTime() - halfYear),
44
+ // 最大时间(当前时间后半年)
45
+ // max: new Date(now.getTime() + halfYear),
46
+ maxTimeLength: halfYear // 可选择的时间跨度为半年内
47
+ }
48
+ ])
49
+
50
+ function onChange(newFilters, oldFilters) {
51
+ console.log('changeEvent:', newFilters, oldFilters)
52
+ }
53
+ </script>
@@ -0,0 +1,62 @@
1
+ <template>
2
+ <div class="demo">
3
+ <tiny-search-box v-model="tags" :items="items" @change="onChange" />
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ import TinySearchBox from '@opentiny/vue-search-box'
9
+
10
+ export default {
11
+ components: {
12
+ TinySearchBox
13
+ },
14
+ data() {
15
+ // 获取当前时间
16
+ const now = new Date()
17
+ // 获取一年的毫秒数:设置只能选择一年的时间区间
18
+ const year = 365 * 24 * 60 * 60 * 1000
19
+ // 获取半年的毫秒数:设置只能选择半年的时间区间
20
+ const halfYear = (365 / 2) * 24 * 3600 * 1000
21
+ // 获取一天的毫秒数
22
+ const day = 24 * 60 * 60 * 1000
23
+
24
+ return {
25
+ tags: [],
26
+ items: [
27
+ {
28
+ label: '日期',
29
+ field: 'date',
30
+ type: 'dateRange',
31
+ format: 'yyyy/MM/dd', // 默认格式
32
+ // 默认开始时间
33
+ start: new Date(),
34
+ // 默认结束时间
35
+ end: undefined,
36
+ maxTimeLength: year, // 可选择的时间跨度为一年内
37
+ // 最小时间(当前时间前5天)
38
+ min: new Date(now.getTime() - 5 * day),
39
+ // 最大时间(当前时间后1年2个月)
40
+ max: new Date(now.getTime() + year + 2 * 30 * day)
41
+ },
42
+ {
43
+ label: '时间日期',
44
+ field: 'datetime',
45
+ type: 'datetimeRange',
46
+ format: 'yyyy/MM/dd HH:mm:ss', // 默认格式
47
+ // 最小时间(当前时间前半年)
48
+ // min: new Date(now.getTime() - halfYear),
49
+ // 最大时间(当前时间后半年)
50
+ // max: new Date(now.getTime() + halfYear),
51
+ maxTimeLength: halfYear // 可选择的时间跨度为半年内
52
+ }
53
+ ]
54
+ }
55
+ },
56
+ methods: {
57
+ onChange(newFilters, oldFilters) {
58
+ console.log('changeEvent:', newFilters, oldFilters)
59
+ }
60
+ }
61
+ }
62
+ </script>