@gi-base/ui 0.0.0-stage → 0.0.1

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 (483) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +32 -2
  3. package/dist/chunks/badge.vue_vue_type_style_index_0_lang-CY33mp7-.mjs +63 -0
  4. package/dist/chunks/button.vue_vue_type_style_index_0_lang-R3M50qg6.mjs +261 -0
  5. package/dist/chunks/card.vue_vue_type_style_index_0_lang-D8ofADym.mjs +140 -0
  6. package/dist/chunks/chart-card-CkzKgoNn.mjs +4 -0
  7. package/dist/chunks/chart-card.vue_vue_type_style_index_0_lang-O3dB4zv4.mjs +111 -0
  8. package/dist/chunks/chart-pxel8ocW.mjs +4 -0
  9. package/dist/chunks/chart.vue_vue_type_style_index_0_lang-Dt4-6E5R.mjs +1512 -0
  10. package/dist/chunks/context-ft3Pl675.mjs +4 -0
  11. package/dist/chunks/dialog.vue_vue_type_style_index_0_lang-DjG-cRmI.mjs +285 -0
  12. package/dist/chunks/icon.vue_vue_type_style_index_0_lang-CupFXcqv.mjs +93 -0
  13. package/dist/chunks/index-BQJqnh5l.mjs +181 -0
  14. package/dist/chunks/index-D0dJjV1u.mjs +127 -0
  15. package/dist/chunks/overlay.vue_vue_type_style_index_0_lang-BbOIddAC.mjs +58 -0
  16. package/dist/chunks/select.vue_vue_type_style_index_0_lang-CTXa4r_r.mjs +774 -0
  17. package/dist/chunks/sub-menu.vue_vue_type_script_setup_true_lang-D7eESzZS.mjs +775 -0
  18. package/dist/chunks/tag.vue_vue_type_style_index_0_lang-DEpBCkCG.mjs +146 -0
  19. package/dist/chunks/useClickOutside-C1JC115M.mjs +27 -0
  20. package/dist/chunks/useFloating-D4y_Ynh2.mjs +1067 -0
  21. package/dist/chunks/z-index-DpEcb64l.mjs +6 -0
  22. package/dist/components/affix/index.d.ts +134 -0
  23. package/dist/components/affix/index.mjs +62 -0
  24. package/dist/components/affix/src/affix.d.ts +32 -0
  25. package/dist/components/affix/src/affix.vue.d.ts +83 -0
  26. package/dist/components/ai/index.d.ts +1472 -0
  27. package/dist/components/ai/index.mjs +1107 -0
  28. package/dist/components/ai/src/console.vue.d.ts +23 -0
  29. package/dist/components/ai/src/cursor.vue.d.ts +59 -0
  30. package/dist/components/ai/src/focus-ring.vue.d.ts +77 -0
  31. package/dist/components/ai/src/ghost-input.vue.d.ts +74 -0
  32. package/dist/components/ai/src/guide.vue.d.ts +41 -0
  33. package/dist/components/ai/src/interact-lock.vue.d.ts +65 -0
  34. package/dist/components/ai/src/page-renderer.d.ts +62 -0
  35. package/dist/components/ai/src/page-renderer.vue.d.ts +50 -0
  36. package/dist/components/ai/src/progress.vue.d.ts +70 -0
  37. package/dist/components/ai/src/provider.vue.d.ts +61 -0
  38. package/dist/components/ai/src/review-panel.vue.d.ts +69 -0
  39. package/dist/components/ai/src/spotlight.vue.d.ts +78 -0
  40. package/dist/components/ai/src/step-tip.vue.d.ts +87 -0
  41. package/dist/components/ai/src/summary-panel.vue.d.ts +66 -0
  42. package/dist/components/ai/src/target.d.ts +33 -0
  43. package/dist/components/ai/src/useAi.d.ts +11 -0
  44. package/dist/components/alert/index.d.ts +178 -0
  45. package/dist/components/alert/index.mjs +92 -0
  46. package/dist/components/alert/src/alert.d.ts +45 -0
  47. package/dist/components/alert/src/alert.vue.d.ts +112 -0
  48. package/dist/components/anchor/index.d.ts +203 -0
  49. package/dist/components/anchor/index.mjs +118 -0
  50. package/dist/components/anchor/src/anchor-link.vue.d.ts +39 -0
  51. package/dist/components/anchor/src/anchor.d.ts +48 -0
  52. package/dist/components/anchor/src/anchor.vue.d.ts +98 -0
  53. package/dist/components/app-shell/index.d.ts +352 -0
  54. package/dist/components/app-shell/index.mjs +229 -0
  55. package/dist/components/app-shell/src/app-shell.d.ts +99 -0
  56. package/dist/components/app-shell/src/app-shell.vue.d.ts +213 -0
  57. package/dist/components/autocomplete/index.d.ts +330 -0
  58. package/dist/components/autocomplete/index.mjs +166 -0
  59. package/dist/components/autocomplete/src/autocomplete.d.ts +83 -0
  60. package/dist/components/autocomplete/src/autocomplete.vue.d.ts +204 -0
  61. package/dist/components/avatar/index.d.ts +215 -0
  62. package/dist/components/avatar/index.mjs +99 -0
  63. package/dist/components/avatar/src/avatar-group.vue.d.ts +48 -0
  64. package/dist/components/avatar/src/avatar.d.ts +48 -0
  65. package/dist/components/avatar/src/avatar.vue.d.ts +96 -0
  66. package/dist/components/backtop/index.d.ts +124 -0
  67. package/dist/components/backtop/index.mjs +80 -0
  68. package/dist/components/backtop/src/backtop.d.ts +31 -0
  69. package/dist/components/backtop/src/backtop.vue.d.ts +78 -0
  70. package/dist/components/badge/index.d.ts +177 -0
  71. package/dist/components/badge/index.mjs +7 -0
  72. package/dist/components/badge/src/badge.d.ts +46 -0
  73. package/dist/components/badge/src/badge.vue.d.ts +112 -0
  74. package/dist/components/breadcrumb/index.d.ts +148 -0
  75. package/dist/components/breadcrumb/index.mjs +98 -0
  76. package/dist/components/breadcrumb/src/breadcrumb-item.vue.d.ts +51 -0
  77. package/dist/components/breadcrumb/src/breadcrumb.d.ts +46 -0
  78. package/dist/components/breadcrumb/src/breadcrumb.vue.d.ts +47 -0
  79. package/dist/components/button/index.d.ts +460 -0
  80. package/dist/components/button/index.mjs +7 -0
  81. package/dist/components/button/src/button.d.ts +144 -0
  82. package/dist/components/button/src/button.vue.d.ts +270 -0
  83. package/dist/components/button-group/index.d.ts +94 -0
  84. package/dist/components/button-group/index.mjs +49 -0
  85. package/dist/components/button-group/src/button-group.d.ts +27 -0
  86. package/dist/components/button-group/src/button-group.vue.d.ts +62 -0
  87. package/dist/components/button-group/src/context.d.ts +7 -0
  88. package/dist/components/calendar/index.d.ts +151 -0
  89. package/dist/components/calendar/index.mjs +199 -0
  90. package/dist/components/calendar/src/calendar.d.ts +35 -0
  91. package/dist/components/calendar/src/calendar.vue.d.ts +96 -0
  92. package/dist/components/card/index.d.ts +230 -0
  93. package/dist/components/card/index.mjs +7 -0
  94. package/dist/components/card/src/card.d.ts +67 -0
  95. package/dist/components/card/src/card.vue.d.ts +148 -0
  96. package/dist/components/carousel/index.d.ts +300 -0
  97. package/dist/components/carousel/index.mjs +166 -0
  98. package/dist/components/carousel/src/carousel-item.vue.d.ts +17 -0
  99. package/dist/components/carousel/src/carousel.d.ts +71 -0
  100. package/dist/components/carousel/src/carousel.vue.d.ts +171 -0
  101. package/dist/components/cascader/index.d.ts +322 -0
  102. package/dist/components/cascader/index.mjs +177 -0
  103. package/dist/components/cascader/src/cascader.d.ts +87 -0
  104. package/dist/components/cascader/src/cascader.vue.d.ts +182 -0
  105. package/dist/components/chart/index.d.ts +605 -0
  106. package/dist/components/chart/index.mjs +20 -0
  107. package/dist/components/chart/src/chart-option.d.ts +62 -0
  108. package/dist/components/chart/src/chart.d.ts +186 -0
  109. package/dist/components/chart/src/chart.vue.d.ts +341 -0
  110. package/dist/components/chart-card/index.d.ts +638 -0
  111. package/dist/components/chart-card/index.mjs +7 -0
  112. package/dist/components/chart-card/src/chart-card.d.ts +167 -0
  113. package/dist/components/chart-card/src/chart-card.vue.d.ts +387 -0
  114. package/dist/components/check-tag/index.d.ts +181 -0
  115. package/dist/components/check-tag/index.mjs +92 -0
  116. package/dist/components/check-tag/src/check-tag.d.ts +49 -0
  117. package/dist/components/check-tag/src/check-tag.vue.d.ts +111 -0
  118. package/dist/components/checkbox/constants.d.ts +20 -0
  119. package/dist/components/checkbox/index.d.ts +340 -0
  120. package/dist/components/checkbox/index.mjs +6 -0
  121. package/dist/components/checkbox/src/checkbox.d.ts +100 -0
  122. package/dist/components/checkbox/src/checkbox.vue.d.ts +207 -0
  123. package/dist/components/checkbox-group/index.d.ts +249 -0
  124. package/dist/components/checkbox-group/index.mjs +108 -0
  125. package/dist/components/checkbox-group/src/checkbox-group.d.ts +84 -0
  126. package/dist/components/checkbox-group/src/checkbox-group.vue.d.ts +153 -0
  127. package/dist/components/col/index.d.ts +213 -0
  128. package/dist/components/col/index.mjs +82 -0
  129. package/dist/components/col/src/col.d.ts +74 -0
  130. package/dist/components/col/src/col.vue.d.ts +133 -0
  131. package/dist/components/collapse/index.d.ts +249 -0
  132. package/dist/components/collapse/index.mjs +231 -0
  133. package/dist/components/collapse/src/collapse-item.vue.d.ts +80 -0
  134. package/dist/components/collapse/src/collapse.d.ts +82 -0
  135. package/dist/components/collapse/src/collapse.vue.d.ts +75 -0
  136. package/dist/components/color-picker/index.d.ts +212 -0
  137. package/dist/components/color-picker/index.mjs +274 -0
  138. package/dist/components/color-picker/src/color-picker.d.ts +53 -0
  139. package/dist/components/color-picker/src/color-picker.vue.d.ts +118 -0
  140. package/dist/components/config-provider/index.d.ts +153 -0
  141. package/dist/components/config-provider/index.mjs +56 -0
  142. package/dist/components/config-provider/src/config-provider.d.ts +34 -0
  143. package/dist/components/config-provider/src/config-provider.vue.d.ts +94 -0
  144. package/dist/components/container/index.d.ts +424 -0
  145. package/dist/components/container/index.mjs +246 -0
  146. package/dist/components/container/src/aside.d.ts +19 -0
  147. package/dist/components/container/src/aside.vue.d.ts +49 -0
  148. package/dist/components/container/src/container.d.ts +23 -0
  149. package/dist/components/container/src/container.vue.d.ts +49 -0
  150. package/dist/components/container/src/footer.d.ts +14 -0
  151. package/dist/components/container/src/footer.vue.d.ts +38 -0
  152. package/dist/components/container/src/header.d.ts +43 -0
  153. package/dist/components/container/src/header.vue.d.ts +89 -0
  154. package/dist/components/container/src/main.d.ts +24 -0
  155. package/dist/components/container/src/main.vue.d.ts +56 -0
  156. package/dist/components/countdown/index.d.ts +140 -0
  157. package/dist/components/countdown/index.mjs +55 -0
  158. package/dist/components/countdown/src/countdown.d.ts +35 -0
  159. package/dist/components/countdown/src/countdown.vue.d.ts +74 -0
  160. package/dist/components/crud/index.d.ts +1424 -0
  161. package/dist/components/crud/index.mjs +1728 -0
  162. package/dist/components/crud/src/crud-dialog.vue.d.ts +675 -0
  163. package/dist/components/crud/src/crud-field-control.vue.d.ts +15 -0
  164. package/dist/components/crud/src/crud-pagination.vue.d.ts +18 -0
  165. package/dist/components/crud/src/crud-search.vue.d.ts +40 -0
  166. package/dist/components/crud/src/crud-table.vue.d.ts +106 -0
  167. package/dist/components/crud/src/crud-toolbar.vue.d.ts +55 -0
  168. package/dist/components/crud/src/crud.d.ts +180 -0
  169. package/dist/components/crud/src/crud.vue.d.ts +1756 -0
  170. package/dist/components/crud/src/types.d.ts +266 -0
  171. package/dist/components/crud/src/useCrud.d.ts +27 -0
  172. package/dist/components/date-picker/index.d.ts +557 -0
  173. package/dist/components/date-picker/index.mjs +865 -0
  174. package/dist/components/date-picker/src/date-panel.vue.d.ts +55 -0
  175. package/dist/components/date-picker/src/date-picker.d.ts +160 -0
  176. package/dist/components/date-picker/src/date-picker.vue.d.ts +335 -0
  177. package/dist/components/date-picker/src/date-utils.d.ts +26 -0
  178. package/dist/components/descriptions/index.d.ts +272 -0
  179. package/dist/components/descriptions/index.mjs +94 -0
  180. package/dist/components/descriptions/src/descriptions-item.vue.d.ts +79 -0
  181. package/dist/components/descriptions/src/descriptions.d.ts +67 -0
  182. package/dist/components/descriptions/src/descriptions.vue.d.ts +98 -0
  183. package/dist/components/dialog/index.d.ts +547 -0
  184. package/dist/components/dialog/index.mjs +10 -0
  185. package/dist/components/dialog/src/dialog.d.ts +132 -0
  186. package/dist/components/dialog/src/dialog.vue.d.ts +319 -0
  187. package/dist/components/divider/index.d.ts +93 -0
  188. package/dist/components/divider/index.mjs +38 -0
  189. package/dist/components/divider/src/divider.d.ts +24 -0
  190. package/dist/components/divider/src/divider.vue.d.ts +62 -0
  191. package/dist/components/drawer/index.d.ts +449 -0
  192. package/dist/components/drawer/index.mjs +233 -0
  193. package/dist/components/drawer/src/drawer.d.ts +108 -0
  194. package/dist/components/drawer/src/drawer.vue.d.ts +249 -0
  195. package/dist/components/dropdown/index.d.ts +445 -0
  196. package/dist/components/dropdown/index.mjs +192 -0
  197. package/dist/components/dropdown/src/dropdown-item.vue.d.ts +56 -0
  198. package/dist/components/dropdown/src/dropdown-menu.vue.d.ts +17 -0
  199. package/dist/components/dropdown/src/dropdown.d.ts +102 -0
  200. package/dist/components/dropdown/src/dropdown.vue.d.ts +208 -0
  201. package/dist/components/empty/index.d.ts +103 -0
  202. package/dist/components/empty/index.mjs +67 -0
  203. package/dist/components/empty/src/empty.d.ts +25 -0
  204. package/dist/components/empty/src/empty.vue.d.ts +67 -0
  205. package/dist/components/empty/src/presets.d.ts +3 -0
  206. package/dist/components/footer-bar/index.d.ts +119 -0
  207. package/dist/components/footer-bar/index.mjs +100 -0
  208. package/dist/components/footer-bar/src/footer-bar.d.ts +41 -0
  209. package/dist/components/footer-bar/src/footer-bar.vue.d.ts +76 -0
  210. package/dist/components/form/index.d.ts +626 -0
  211. package/dist/components/form/index.mjs +675 -0
  212. package/dist/components/form/src/constants.d.ts +17 -0
  213. package/dist/components/form/src/form-item.vue.d.ts +168 -0
  214. package/dist/components/form/src/form.d.ts +177 -0
  215. package/dist/components/form/src/form.vue.d.ts +218 -0
  216. package/dist/components/form/src/types.d.ts +91 -0
  217. package/dist/components/icon/index.d.ts +150 -0
  218. package/dist/components/icon/index.mjs +7 -0
  219. package/dist/components/icon/src/icon.d.ts +54 -0
  220. package/dist/components/icon/src/icon.vue.d.ts +94 -0
  221. package/dist/components/image/index.d.ts +328 -0
  222. package/dist/components/image/index.mjs +101 -0
  223. package/dist/components/image/src/image.d.ts +80 -0
  224. package/dist/components/image/src/image.vue.d.ts +194 -0
  225. package/dist/components/image-viewer/index.d.ts +344 -0
  226. package/dist/components/image-viewer/index.mjs +305 -0
  227. package/dist/components/image-viewer/src/image-viewer.d.ts +88 -0
  228. package/dist/components/image-viewer/src/image-viewer.vue.d.ts +189 -0
  229. package/dist/components/infinite-scroll/index.d.ts +4 -0
  230. package/dist/components/infinite-scroll/index.mjs +35 -0
  231. package/dist/components/input/index.d.ts +550 -0
  232. package/dist/components/input/index.mjs +298 -0
  233. package/dist/components/input/src/input.d.ts +133 -0
  234. package/dist/components/input/src/input.vue.d.ts +327 -0
  235. package/dist/components/input-otp/index.d.ts +203 -0
  236. package/dist/components/input-otp/index.mjs +94 -0
  237. package/dist/components/input-otp/src/input-otp.d.ts +51 -0
  238. package/dist/components/input-otp/src/input-otp.vue.d.ts +109 -0
  239. package/dist/components/input-tag/index.d.ts +357 -0
  240. package/dist/components/input-tag/index.mjs +205 -0
  241. package/dist/components/input-tag/src/input-tag.d.ts +91 -0
  242. package/dist/components/input-tag/src/input-tag.vue.d.ts +201 -0
  243. package/dist/components/layout/index.d.ts +91 -0
  244. package/dist/components/layout/index.mjs +181 -0
  245. package/dist/components/layout/src/layout-executor.d.ts +24 -0
  246. package/dist/components/layout/src/layout-executor.vue.d.ts +62 -0
  247. package/dist/components/layout/src/layout.d.ts +60 -0
  248. package/dist/components/link/index.d.ts +162 -0
  249. package/dist/components/link/index.mjs +102 -0
  250. package/dist/components/link/src/link.d.ts +44 -0
  251. package/dist/components/link/src/link.vue.d.ts +103 -0
  252. package/dist/components/loading/index.d.ts +11 -0
  253. package/dist/components/loading/index.mjs +167 -0
  254. package/dist/components/loading/src/directive.d.ts +5 -0
  255. package/dist/components/loading/src/loading.d.ts +67 -0
  256. package/dist/components/loading/src/loading.vue.d.ts +40 -0
  257. package/dist/components/loading/src/service.d.ts +11 -0
  258. package/dist/components/mention/index.d.ts +211 -0
  259. package/dist/components/mention/index.mjs +126 -0
  260. package/dist/components/mention/src/mention.d.ts +50 -0
  261. package/dist/components/mention/src/mention.vue.d.ts +114 -0
  262. package/dist/components/menu/index.d.ts +814 -0
  263. package/dist/components/menu/index.mjs +50 -0
  264. package/dist/components/menu/src/menu-item-group.vue.d.ts +30 -0
  265. package/dist/components/menu/src/menu-item.vue.d.ts +72 -0
  266. package/dist/components/menu/src/menu.d.ts +294 -0
  267. package/dist/components/menu/src/menu.vue.d.ts +263 -0
  268. package/dist/components/menu/src/sub-menu.vue.d.ts +154 -0
  269. package/dist/components/message-box/index.d.ts +16 -0
  270. package/dist/components/message-box/index.mjs +288 -0
  271. package/dist/components/message-box/src/message-box.d.ts +171 -0
  272. package/dist/components/message-box/src/message-box.vue.d.ts +69 -0
  273. package/dist/components/message-box/src/service.d.ts +12 -0
  274. package/dist/components/notice/index.d.ts +252 -0
  275. package/dist/components/notice/index.mjs +307 -0
  276. package/dist/components/notice/src/notice.d.ts +79 -0
  277. package/dist/components/notice/src/notice.vue.d.ts +137 -0
  278. package/dist/components/notice/src/service.d.ts +34 -0
  279. package/dist/components/notification/index.d.ts +5 -0
  280. package/dist/components/notification/index.mjs +131 -0
  281. package/dist/components/notification/src/notification-item.vue.d.ts +28 -0
  282. package/dist/components/notification/src/notification.d.ts +26 -0
  283. package/dist/components/notification/src/service.d.ts +3 -0
  284. package/dist/components/number/index.d.ts +400 -0
  285. package/dist/components/number/index.mjs +257 -0
  286. package/dist/components/number/src/number.d.ts +114 -0
  287. package/dist/components/number/src/number.vue.d.ts +227 -0
  288. package/dist/components/overlay/index.d.ts +124 -0
  289. package/dist/components/overlay/index.mjs +7 -0
  290. package/dist/components/overlay/src/overlay.vue.d.ts +70 -0
  291. package/dist/components/page-header/index.d.ts +83 -0
  292. package/dist/components/page-header/index.mjs +79 -0
  293. package/dist/components/page-header/src/page-header.d.ts +17 -0
  294. package/dist/components/page-header/src/page-header.vue.d.ts +55 -0
  295. package/dist/components/pagination/index.d.ts +390 -0
  296. package/dist/components/pagination/index.mjs +195 -0
  297. package/dist/components/pagination/src/pagination.d.ts +101 -0
  298. package/dist/components/pagination/src/pagination.vue.d.ts +232 -0
  299. package/dist/components/popconfirm/index.d.ts +1146 -0
  300. package/dist/components/popconfirm/index.mjs +130 -0
  301. package/dist/components/popconfirm/src/popconfirm.d.ts +82 -0
  302. package/dist/components/popconfirm/src/popconfirm.vue.d.ts +1855 -0
  303. package/dist/components/popover/index.d.ts +873 -0
  304. package/dist/components/popover/index.mjs +110 -0
  305. package/dist/components/popover/src/popover.d.ts +85 -0
  306. package/dist/components/popover/src/popover.vue.d.ts +1271 -0
  307. package/dist/components/progress/index.d.ts +254 -0
  308. package/dist/components/progress/index.mjs +120 -0
  309. package/dist/components/progress/src/progress.d.ts +68 -0
  310. package/dist/components/progress/src/progress.vue.d.ts +146 -0
  311. package/dist/components/radio/constants.d.ts +17 -0
  312. package/dist/components/radio/index.d.ts +233 -0
  313. package/dist/components/radio/index.mjs +6 -0
  314. package/dist/components/radio/src/radio.d.ts +65 -0
  315. package/dist/components/radio/src/radio.vue.d.ts +143 -0
  316. package/dist/components/radio-group/index.d.ts +235 -0
  317. package/dist/components/radio-group/index.mjs +91 -0
  318. package/dist/components/radio-group/src/radio-group.d.ts +77 -0
  319. package/dist/components/radio-group/src/radio-group.vue.d.ts +144 -0
  320. package/dist/components/rate/index.d.ts +320 -0
  321. package/dist/components/rate/index.mjs +115 -0
  322. package/dist/components/rate/src/rate.d.ts +84 -0
  323. package/dist/components/rate/src/rate.vue.d.ts +182 -0
  324. package/dist/components/result/index.d.ts +91 -0
  325. package/dist/components/result/index.mjs +74 -0
  326. package/dist/components/result/src/result.d.ts +21 -0
  327. package/dist/components/result/src/result.vue.d.ts +62 -0
  328. package/dist/components/rolling-notice/index.d.ts +187 -0
  329. package/dist/components/rolling-notice/index.mjs +176 -0
  330. package/dist/components/rolling-notice/src/rolling-notice.d.ts +57 -0
  331. package/dist/components/rolling-notice/src/rolling-notice.vue.d.ts +102 -0
  332. package/dist/components/row/index.d.ts +105 -0
  333. package/dist/components/row/index.mjs +64 -0
  334. package/dist/components/row/src/row.d.ts +33 -0
  335. package/dist/components/row/src/row.vue.d.ts +69 -0
  336. package/dist/components/scrollbar/index.d.ts +386 -0
  337. package/dist/components/scrollbar/index.mjs +235 -0
  338. package/dist/components/scrollbar/src/scrollbar.d.ts +101 -0
  339. package/dist/components/scrollbar/src/scrollbar.vue.d.ts +237 -0
  340. package/dist/components/segmented/index.d.ts +252 -0
  341. package/dist/components/segmented/index.mjs +177 -0
  342. package/dist/components/segmented/src/segmented.d.ts +88 -0
  343. package/dist/components/segmented/src/segmented.vue.d.ts +159 -0
  344. package/dist/components/select/index.d.ts +1107 -0
  345. package/dist/components/select/index.mjs +36 -0
  346. package/dist/components/select/src/constants.d.ts +34 -0
  347. package/dist/components/select/src/option-group.vue.d.ts +39 -0
  348. package/dist/components/select/src/option.vue.d.ts +56 -0
  349. package/dist/components/select/src/remote.d.ts +6 -0
  350. package/dist/components/select/src/select.d.ts +336 -0
  351. package/dist/components/select/src/select.vue.d.ts +583 -0
  352. package/dist/components/select-virtual/index.d.ts +884 -0
  353. package/dist/components/select-virtual/index.mjs +18 -0
  354. package/dist/components/select-virtual/src/select-virtual.vue.d.ts +522 -0
  355. package/dist/components/sidebar/index.d.ts +279 -0
  356. package/dist/components/sidebar/index.mjs +283 -0
  357. package/dist/components/sidebar/src/sidebar.d.ts +106 -0
  358. package/dist/components/sidebar/src/sidebar.vue.d.ts +170 -0
  359. package/dist/components/skeleton/index.d.ts +186 -0
  360. package/dist/components/skeleton/index.mjs +87 -0
  361. package/dist/components/skeleton/src/skeleton-item.vue.d.ts +58 -0
  362. package/dist/components/skeleton/src/skeleton.d.ts +43 -0
  363. package/dist/components/skeleton/src/skeleton.vue.d.ts +66 -0
  364. package/dist/components/slider/index.d.ts +282 -0
  365. package/dist/components/slider/index.mjs +190 -0
  366. package/dist/components/slider/src/slider.d.ts +73 -0
  367. package/dist/components/slider/src/slider.vue.d.ts +159 -0
  368. package/dist/components/space/index.d.ts +164 -0
  369. package/dist/components/space/index.mjs +132 -0
  370. package/dist/components/space/src/space.d.ts +55 -0
  371. package/dist/components/space/src/space.vue.d.ts +92 -0
  372. package/dist/components/sparkline/index.d.ts +219 -0
  373. package/dist/components/sparkline/index.mjs +109 -0
  374. package/dist/components/sparkline/src/sparkline.d.ts +57 -0
  375. package/dist/components/sparkline/src/sparkline.vue.d.ts +124 -0
  376. package/dist/components/splitter/index.d.ts +263 -0
  377. package/dist/components/splitter/index.mjs +299 -0
  378. package/dist/components/splitter/src/context.d.ts +35 -0
  379. package/dist/components/splitter/src/split-panel.vue.d.ts +87 -0
  380. package/dist/components/splitter/src/splitter.d.ts +64 -0
  381. package/dist/components/splitter/src/splitter.vue.d.ts +79 -0
  382. package/dist/components/statistic/index.d.ts +207 -0
  383. package/dist/components/statistic/index.mjs +92 -0
  384. package/dist/components/statistic/src/statistic.d.ts +52 -0
  385. package/dist/components/statistic/src/statistic.vue.d.ts +131 -0
  386. package/dist/components/steps/index.d.ts +271 -0
  387. package/dist/components/steps/index.mjs +128 -0
  388. package/dist/components/steps/src/step.vue.d.ts +73 -0
  389. package/dist/components/steps/src/steps.d.ts +65 -0
  390. package/dist/components/steps/src/steps.vue.d.ts +104 -0
  391. package/dist/components/switch/index.d.ts +426 -0
  392. package/dist/components/switch/index.mjs +214 -0
  393. package/dist/components/switch/src/switch.d.ts +129 -0
  394. package/dist/components/switch/src/switch.vue.d.ts +244 -0
  395. package/dist/components/table/index.d.ts +1709 -0
  396. package/dist/components/table/index.mjs +1304 -0
  397. package/dist/components/table/src/table-column.vue.d.ts +341 -0
  398. package/dist/components/table/src/table.d.ts +564 -0
  399. package/dist/components/table/src/table.vue.d.ts +623 -0
  400. package/dist/components/table-v2/index.d.ts +302 -0
  401. package/dist/components/table-v2/index.mjs +147 -0
  402. package/dist/components/table-v2/src/table-v2.d.ts +89 -0
  403. package/dist/components/table-v2/src/table-v2.vue.d.ts +165 -0
  404. package/dist/components/tabs/index.d.ts +355 -0
  405. package/dist/components/tabs/index.mjs +278 -0
  406. package/dist/components/tabs/src/tab-pane.vue.d.ts +76 -0
  407. package/dist/components/tabs/src/tabs.d.ts +113 -0
  408. package/dist/components/tabs/src/tabs.vue.d.ts +147 -0
  409. package/dist/components/tag/index.d.ts +323 -0
  410. package/dist/components/tag/index.mjs +7 -0
  411. package/dist/components/tag/src/tag.d.ts +88 -0
  412. package/dist/components/tag/src/tag.vue.d.ts +194 -0
  413. package/dist/components/text/index.d.ts +138 -0
  414. package/dist/components/text/index.mjs +66 -0
  415. package/dist/components/text/src/text.d.ts +45 -0
  416. package/dist/components/text/src/text.vue.d.ts +89 -0
  417. package/dist/components/textarea/index.d.ts +417 -0
  418. package/dist/components/textarea/index.mjs +189 -0
  419. package/dist/components/textarea/src/textarea.d.ts +97 -0
  420. package/dist/components/textarea/src/textarea.vue.d.ts +231 -0
  421. package/dist/components/time-picker/index.d.ts +216 -0
  422. package/dist/components/time-picker/index.mjs +228 -0
  423. package/dist/components/time-picker/src/time-picker.d.ts +53 -0
  424. package/dist/components/time-picker/src/time-picker.vue.d.ts +120 -0
  425. package/dist/components/time-select/index.d.ts +188 -0
  426. package/dist/components/time-select/index.mjs +124 -0
  427. package/dist/components/time-select/src/time-select.d.ts +46 -0
  428. package/dist/components/time-select/src/time-select.vue.d.ts +104 -0
  429. package/dist/components/timeline/index.d.ts +206 -0
  430. package/dist/components/timeline/index.mjs +81 -0
  431. package/dist/components/timeline/src/timeline-item.vue.d.ts +107 -0
  432. package/dist/components/timeline/src/timeline.d.ts +49 -0
  433. package/dist/components/timeline/src/timeline.vue.d.ts +29 -0
  434. package/dist/components/toast/index.d.ts +8 -0
  435. package/dist/components/toast/index.mjs +170 -0
  436. package/dist/components/toast/src/service.d.ts +4 -0
  437. package/dist/components/toast/src/toast-item.vue.d.ts +37 -0
  438. package/dist/components/toast/src/toast.d.ts +48 -0
  439. package/dist/components/tooltip/index.d.ts +636 -0
  440. package/dist/components/tooltip/index.mjs +342 -0
  441. package/dist/components/tooltip/src/tooltip.d.ts +197 -0
  442. package/dist/components/tooltip/src/tooltip.vue.d.ts +383 -0
  443. package/dist/components/tour/index.d.ts +337 -0
  444. package/dist/components/tour/index.mjs +180 -0
  445. package/dist/components/tour/src/tour.d.ts +91 -0
  446. package/dist/components/tour/src/tour.vue.d.ts +203 -0
  447. package/dist/components/transfer/index.d.ts +319 -0
  448. package/dist/components/transfer/index.mjs +298 -0
  449. package/dist/components/transfer/src/transfer.d.ts +79 -0
  450. package/dist/components/transfer/src/transfer.vue.d.ts +190 -0
  451. package/dist/components/tree/index.d.ts +536 -0
  452. package/dist/components/tree/index.mjs +312 -0
  453. package/dist/components/tree/src/tree-node.vue.d.ts +25 -0
  454. package/dist/components/tree/src/tree.d.ts +136 -0
  455. package/dist/components/tree/src/tree.vue.d.ts +298 -0
  456. package/dist/components/tree-select/index.d.ts +683 -0
  457. package/dist/components/tree-select/index.mjs +599 -0
  458. package/dist/components/tree-select/src/tree-select.d.ts +229 -0
  459. package/dist/components/tree-select/src/tree-select.vue.d.ts +390 -0
  460. package/dist/components/tree-v2/index.d.ts +255 -0
  461. package/dist/components/tree-v2/index.mjs +149 -0
  462. package/dist/components/tree-v2/src/tree-v2.d.ts +63 -0
  463. package/dist/components/tree-v2/src/tree-v2.vue.d.ts +139 -0
  464. package/dist/components/upload/index.d.ts +736 -0
  465. package/dist/components/upload/index.mjs +616 -0
  466. package/dist/components/upload/src/upload.d.ts +233 -0
  467. package/dist/components/upload/src/upload.vue.d.ts +421 -0
  468. package/dist/components/virtual-list/index.d.ts +159 -0
  469. package/dist/components/virtual-list/index.mjs +89 -0
  470. package/dist/components/virtual-list/src/virtual-list.d.ts +38 -0
  471. package/dist/components/virtual-list/src/virtual-list.vue.d.ts +103 -0
  472. package/dist/components/watermark/index.d.ts +264 -0
  473. package/dist/components/watermark/index.mjs +72 -0
  474. package/dist/components/watermark/src/watermark.d.ts +67 -0
  475. package/dist/components/watermark/src/watermark.vue.d.ts +164 -0
  476. package/dist/hooks/useClickOutside.d.ts +12 -0
  477. package/dist/hooks/useFloating.d.ts +49 -0
  478. package/dist/index.d.ts +116 -0
  479. package/dist/index.mjs +396 -0
  480. package/dist/style.css +1 -0
  481. package/dist/utils/form.d.ts +51 -0
  482. package/dist/utils/z-index.d.ts +9 -0
  483. package/package.json +61 -3
@@ -0,0 +1,1728 @@
1
+ import { useAiTarget as Ve, useNamespace as Be, withInstall as at } from "@gi-base/utils";
2
+ import { defineComponent as pe, computed as z, openBlock as d, createBlock as D, resolveDynamicComponent as lt, mergeProps as re, unref as a, useSlots as De, ref as H, watch as Ge, nextTick as Ie, withCtx as S, createVNode as W, createElementVNode as K, createElementBlock as A, Fragment as ge, renderList as le, normalizeStyle as te, renderSlot as L, toDisplayString as Q, createCommentVNode as P, createTextVNode as ee, normalizeClass as x, onMounted as Ye, onBeforeUnmount as Ze, withDirectives as it, withModifiers as Ke, reactive as je, shallowRef as ye, createSlots as Te, normalizeProps as Re, guardReactiveProps as Oe } from "vue";
3
+ import { GiButton as Z } from "../button/index.mjs";
4
+ import { GiDialog as ot } from "../dialog/index.mjs";
5
+ import { GiForm as _e, GiFormItem as et } from "../form/index.mjs";
6
+ import { GiIcon as se } from "../icon/index.mjs";
7
+ import { GiTooltip as qe } from "../tooltip/index.mjs";
8
+ import { GiDatePicker as nt } from "../date-picker/index.mjs";
9
+ import { GiInput as Le } from "../input/index.mjs";
10
+ import { GiNumber as rt } from "../number/index.mjs";
11
+ import { GiSegmented as st } from "../segmented/index.mjs";
12
+ import { GiSelect as ut } from "../select/index.mjs";
13
+ import { GiSwitch as dt } from "../switch/index.mjs";
14
+ import { GiTextarea as ct } from "../textarea/index.mjs";
15
+ import { GiPagination as ft } from "../pagination/index.mjs";
16
+ import { G as Me } from "../../chunks/index-BQJqnh5l.mjs";
17
+ import { GiEmpty as mt } from "../empty/index.mjs";
18
+ import { vLoading as vt } from "../loading/index.mjs";
19
+ import { GiPopover as gt } from "../popover/index.mjs";
20
+ import { confirm as He } from "../message-box/index.mjs";
21
+ import { toast as oe } from "../toast/index.mjs";
22
+ const Ne = {
23
+ create: "新增",
24
+ edit: "编辑",
25
+ view: "查看",
26
+ add: "新增",
27
+ batchDelete: "批量删除",
28
+ refresh: "刷新",
29
+ search: "查询",
30
+ reset: "重置",
31
+ submit: "确定",
32
+ cancel: "取消",
33
+ columnSettings: "列设置",
34
+ showAllColumns: "显示全部",
35
+ columnSettingsTip: "至少保留一列",
36
+ empty: "暂无数据",
37
+ success: "操作成功",
38
+ deleteConfirm: "确定删除这条数据吗?",
39
+ batchDeleteConfirm: "确定删除选中的 {count} 条数据吗?",
40
+ noCreateApi: "未配置 create 接口",
41
+ noUpdateApi: "未配置 update 接口",
42
+ noRemoveApi: "未配置 remove 接口",
43
+ noBatchRemoveApi: "未配置 batchRemove 接口",
44
+ noExporter: "未配置导出器"
45
+ }, pt = {
46
+ /** 数据源:list 必需,其余按操作配置 */
47
+ api: {
48
+ type: Object,
49
+ required: !0
50
+ },
51
+ /** AI 实体名,例如 system.user */
52
+ entity: { type: String, default: "" },
53
+ title: { type: String, default: "" },
54
+ columns: {
55
+ type: Array,
56
+ default: () => []
57
+ },
58
+ /** 查询区字段,空数组时不显示查询区 */
59
+ searchFields: {
60
+ type: Array,
61
+ default: () => []
62
+ },
63
+ formFields: {
64
+ type: Array,
65
+ default: () => []
66
+ },
67
+ rules: {
68
+ type: Object,
69
+ default: () => ({})
70
+ },
71
+ labels: {
72
+ type: Object,
73
+ default: () => ({})
74
+ },
75
+ idKey: { type: String, default: "id" },
76
+ rowKey: { type: String, default: "" },
77
+ selection: { type: Boolean, default: !1 },
78
+ showIndex: { type: Boolean, default: !1 },
79
+ showActions: { type: Boolean, default: !0 },
80
+ actionWidth: { type: [String, Number], default: 180 },
81
+ actionFixed: {
82
+ type: [Boolean, String],
83
+ default: "right"
84
+ },
85
+ canView: { type: Boolean, default: !0 },
86
+ canEdit: { type: Boolean, default: !0 },
87
+ canDelete: { type: Boolean, default: !0 },
88
+ permissions: {
89
+ type: Object,
90
+ default: () => ({})
91
+ },
92
+ pageSize: { type: Number, default: 10 },
93
+ pageSizes: { type: Array, default: () => [10, 20, 50, 100] },
94
+ defaultQuery: {
95
+ type: Object,
96
+ default: () => ({})
97
+ },
98
+ defaultForm: {
99
+ type: Object,
100
+ default: () => ({})
101
+ },
102
+ immediate: { type: Boolean, default: !0 },
103
+ showSearch: { type: Boolean, default: !0 },
104
+ searchVisibleCount: { type: Number, default: 3 },
105
+ showToolbar: { type: Boolean, default: !0 },
106
+ showAdd: { type: Boolean, default: !0 },
107
+ showBatchDelete: { type: Boolean, default: !0 },
108
+ showRefresh: { type: Boolean, default: !0 },
109
+ showColumnSettings: { type: Boolean, default: !0 },
110
+ showExport: { type: Boolean, default: !1 },
111
+ exporter: {
112
+ type: Function,
113
+ default: void 0
114
+ },
115
+ hiddenColumns: {
116
+ type: Array,
117
+ default: () => []
118
+ },
119
+ maxHeight: {
120
+ type: [String, Number],
121
+ default: ""
122
+ },
123
+ fill: { type: Boolean, default: !1 },
124
+ emptyText: { type: String, default: "" },
125
+ dialogWidth: { type: [String, Number], default: "680px" },
126
+ searchLabelWidth: {
127
+ type: [String, Number],
128
+ default: "auto"
129
+ },
130
+ paginationLayout: {
131
+ type: String,
132
+ default: "total, sizes, prev, pager, next, jumper"
133
+ },
134
+ /** AI 根语义目标码 */
135
+ aiTarget: { type: String, default: "" },
136
+ aiPolicy: {
137
+ type: Object,
138
+ default: () => ({ destructive: "confirm" })
139
+ }
140
+ }, tt = /* @__PURE__ */ pe({
141
+ name: "CrudFieldControl",
142
+ __name: "crud-field-control",
143
+ props: {
144
+ field: {},
145
+ modelValue: { default: void 0 },
146
+ disabled: { type: Boolean, default: void 0 }
147
+ },
148
+ emits: ["update:model-value"],
149
+ setup(e, { emit: F }) {
150
+ const m = e, l = F, v = (f) => l("update:model-value", f), u = z(() => {
151
+ const f = m.field, $ = { ...f.props || {} };
152
+ return f.placeholder && ($.placeholder = f.placeholder), f.clearable !== void 0 && ($.clearable = f.clearable), m.disabled !== void 0 ? $.disabled = m.disabled : f.disabled !== void 0 && ($.disabled = f.disabled), $;
153
+ });
154
+ return (f, $) => e.field.component ? (d(), D(lt(e.field.component), re({ key: 0 }, u.value, {
155
+ "model-value": e.modelValue,
156
+ "onUpdate:modelValue": v
157
+ }), null, 16, ["model-value"])) : e.field.type === "password" ? (d(), D(a(Le), re({ key: 1 }, u.value, {
158
+ type: "password",
159
+ "show-password": "",
160
+ "model-value": e.modelValue,
161
+ "onUpdate:modelValue": v
162
+ }), null, 16, ["model-value"])) : e.field.type === "textarea" ? (d(), D(a(ct), re({ key: 2 }, u.value, {
163
+ rows: e.field.rows || 3,
164
+ "model-value": e.modelValue,
165
+ "onUpdate:modelValue": v
166
+ }), null, 16, ["rows", "model-value"])) : e.field.type === "number" ? (d(), D(a(rt), re({ key: 3 }, u.value, {
167
+ "model-value": e.modelValue,
168
+ "onUpdate:modelValue": v
169
+ }), null, 16, ["model-value"])) : e.field.type === "select" ? (d(), D(a(ut), re({ key: 4 }, u.value, {
170
+ options: e.field.options || [],
171
+ "model-value": e.modelValue,
172
+ "onUpdate:modelValue": v
173
+ }), null, 16, ["options", "model-value"])) : e.field.type === "switch" ? (d(), D(a(dt), re({ key: 5 }, u.value, {
174
+ "active-value": e.field.activeValue ?? 1,
175
+ "inactive-value": e.field.inactiveValue ?? 0,
176
+ "model-value": e.modelValue,
177
+ "onUpdate:modelValue": v
178
+ }), null, 16, ["active-value", "inactive-value", "model-value"])) : e.field.type === "radio" ? (d(), D(a(st), re({ key: 6 }, u.value, {
179
+ options: e.field.options || [],
180
+ "model-value": e.modelValue,
181
+ "onUpdate:modelValue": v
182
+ }), null, 16, ["options", "model-value"])) : e.field.type === "date" ? (d(), D(a(nt), re({ key: 7 }, u.value, {
183
+ "model-value": e.modelValue,
184
+ "onUpdate:modelValue": v
185
+ }), null, 16, ["model-value"])) : (d(), D(a(Le), re({ key: 8 }, u.value, {
186
+ "model-value": e.modelValue,
187
+ "onUpdate:modelValue": v
188
+ }), null, 16, ["model-value"]));
189
+ }
190
+ }), ht = { class: "gi-crud-dialog__grid" }, bt = { class: "gi-crud-dialog__label-ellipsis" }, yt = /* @__PURE__ */ pe({
191
+ name: "CrudDialog",
192
+ __name: "crud-dialog",
193
+ props: {
194
+ modelValue: { type: Boolean },
195
+ title: {},
196
+ mode: {},
197
+ fields: {},
198
+ form: {},
199
+ rules: { default: () => ({}) },
200
+ submitting: { type: Boolean, default: !1 },
201
+ width: { default: "680px" },
202
+ labelWidth: { default: "96px" },
203
+ labels: { default: () => ({}) },
204
+ aiTarget: { default: "" }
205
+ },
206
+ emits: ["update:modelValue", "submit", "cancel"],
207
+ setup(e, { expose: F, emit: m }) {
208
+ const l = e, v = m, u = De(), f = H(), $ = z(() => ({ ...Ne, ...l.labels || {} })), T = (c) => !!u[`field-${c}`], G = (c) => c.fullRow ? 24 : c.span ? Math.max(1, Math.min(24, c.span)) : c.type === "textarea" ? 24 : 12, n = (c) => ({ gridColumn: `span ${G(c)} / span ${G(c)}` }), h = (c, R) => {
209
+ l.form[c] = R;
210
+ }, b = (c) => {
211
+ v("cancel"), c();
212
+ }, g = async () => {
213
+ if (!f.value) return !0;
214
+ try {
215
+ return await f.value.validate(), !0;
216
+ } catch {
217
+ return !1;
218
+ }
219
+ };
220
+ return Ge(
221
+ () => l.modelValue,
222
+ (c) => {
223
+ c && Ie(() => {
224
+ var R;
225
+ (R = f.value) == null || R.clearValidate();
226
+ });
227
+ }
228
+ ), F({
229
+ validate: g,
230
+ resetFields: () => {
231
+ var c;
232
+ return (c = f.value) == null ? void 0 : c.resetFields();
233
+ },
234
+ clearValidate: () => {
235
+ var c;
236
+ return (c = f.value) == null ? void 0 : c.clearValidate();
237
+ }
238
+ }), Ve({
239
+ code: l.aiTarget,
240
+ getValue: () => ({ visible: l.modelValue, form: l.form }),
241
+ trigger: (c) => v("update:modelValue", c !== "close"),
242
+ execute: async (c) => {
243
+ var R;
244
+ return c === "validate" ? g() : c === "reset" ? ((R = f.value) == null || R.resetFields(), !0) : { ok: !1, reason: "unsupported" };
245
+ },
246
+ isVisible: () => !0
247
+ }), (c, R) => (d(), D(a(ot), {
248
+ "model-value": e.modelValue,
249
+ title: e.title,
250
+ width: e.width,
251
+ "close-on-click-modal": e.mode === "view",
252
+ "ai-target": e.aiTarget || void 0,
253
+ "onUpdate:modelValue": R[1] || (R[1] = (B) => v("update:modelValue", B)),
254
+ onClose: R[2] || (R[2] = (B) => v("cancel"))
255
+ }, {
256
+ footer: S(({ close: B }) => [
257
+ W(a(Z), {
258
+ disabled: e.submitting,
259
+ onClick: (J) => b(B)
260
+ }, {
261
+ default: S(() => [
262
+ ee(Q($.value.cancel), 1)
263
+ ]),
264
+ _: 1
265
+ }, 8, ["disabled", "onClick"]),
266
+ e.mode !== "view" ? (d(), D(a(Z), {
267
+ key: 0,
268
+ type: "primary",
269
+ loading: e.submitting,
270
+ onClick: R[0] || (R[0] = (J) => v("submit"))
271
+ }, {
272
+ default: S(() => [
273
+ ee(Q($.value.submit), 1)
274
+ ]),
275
+ _: 1
276
+ }, 8, ["loading"])) : P("", !0)
277
+ ]),
278
+ default: S(() => [
279
+ W(a(_e), {
280
+ ref_key: "formRef",
281
+ ref: f,
282
+ model: e.form,
283
+ rules: e.rules,
284
+ "label-position": "right",
285
+ "label-width": e.labelWidth,
286
+ disabled: e.mode === "view",
287
+ class: "gi-crud-dialog__form"
288
+ }, {
289
+ default: S(() => [
290
+ K("div", ht, [
291
+ (d(!0), A(ge, null, le(e.fields, (B) => (d(), D(a(et), {
292
+ key: B.prop,
293
+ label: B.label,
294
+ prop: B.prop,
295
+ rules: B.rules,
296
+ "ai-target": e.aiTarget ? e.aiTarget + ".dialog.field." + B.prop : void 0,
297
+ style: te(n(B))
298
+ }, {
299
+ label: S(({ label: J }) => [
300
+ W(a(qe), {
301
+ content: String(J),
302
+ placement: "top",
303
+ "max-width": 280
304
+ }, {
305
+ default: S(() => [
306
+ K("span", bt, Q(J), 1)
307
+ ]),
308
+ _: 2
309
+ }, 1032, ["content"]),
310
+ B.tip ? (d(), D(a(qe), {
311
+ key: 0,
312
+ content: B.tip,
313
+ placement: "top",
314
+ "max-width": 280
315
+ }, {
316
+ default: S(() => [
317
+ W(a(se), {
318
+ name: "gi-Info",
319
+ size: 14,
320
+ class: "gi-crud-dialog__tip-icon"
321
+ })
322
+ ]),
323
+ _: 1
324
+ }, 8, ["content"])) : P("", !0)
325
+ ]),
326
+ default: S(() => [
327
+ T(B.prop) ? L(c.$slots, "field-" + B.prop, {
328
+ field: B,
329
+ form: e.form,
330
+ mode: e.mode
331
+ }, void 0, void 0, 0) : (d(), D(tt, {
332
+ key: 1,
333
+ field: B,
334
+ "model-value": e.form[B.prop],
335
+ disabled: e.mode === "view" || B.disabled,
336
+ "onUpdate:modelValue": (J) => h(B.prop, J)
337
+ }, null, 8, ["field", "model-value", "disabled", "onUpdate:modelValue"]))
338
+ ]),
339
+ _: 2
340
+ }, 1032, ["label", "prop", "rules", "ai-target", "style"]))), 128))
341
+ ])
342
+ ]),
343
+ _: 3
344
+ }, 8, ["model", "rules", "label-width", "disabled"])
345
+ ]),
346
+ _: 3
347
+ }, 8, ["model-value", "title", "width", "close-on-click-modal", "ai-target"]));
348
+ }
349
+ }), wt = /* @__PURE__ */ pe({
350
+ name: "CrudPagination",
351
+ __name: "crud-pagination",
352
+ props: {
353
+ pageNum: {},
354
+ pageSize: {},
355
+ total: {},
356
+ pageSizes: { default: () => [10, 20, 50, 100] },
357
+ layout: { default: "total, sizes, prev, pager, next, jumper" }
358
+ },
359
+ emits: ["page-change", "size-change"],
360
+ setup(e, { emit: F }) {
361
+ const m = F, l = Be("crud-pagination");
362
+ return (v, u) => e.total > 0 ? (d(), A("div", {
363
+ key: 0,
364
+ class: x(a(l).b())
365
+ }, [
366
+ W(a(ft), {
367
+ "current-page": e.pageNum,
368
+ "page-size": e.pageSize,
369
+ "page-sizes": e.pageSizes,
370
+ total: e.total,
371
+ layout: e.layout,
372
+ background: "",
373
+ "onUpdate:currentPage": u[0] || (u[0] = (f) => m("page-change", f)),
374
+ "onUpdate:pageSize": u[1] || (u[1] = (f) => m("size-change", f))
375
+ }, null, 8, ["current-page", "page-size", "page-sizes", "total", "layout"])
376
+ ], 2)) : P("", !0);
377
+ }
378
+ }), St = ["data-ai-target"], Ct = /* @__PURE__ */ pe({
379
+ name: "CrudSearch",
380
+ __name: "crud-search",
381
+ props: {
382
+ fields: {},
383
+ model: {},
384
+ loading: { type: Boolean, default: !1 },
385
+ labelWidth: { default: "auto" },
386
+ visibleCount: { default: 3 },
387
+ labels: { default: () => ({}) },
388
+ aiTarget: { default: "" }
389
+ },
390
+ emits: ["search", "reset"],
391
+ setup(e, { emit: F }) {
392
+ const m = e, l = F, v = Be("crud-search"), u = De(), f = H(!1), $ = z(() => ({ ...Ne, ...m.labels || {} })), T = z(() => f.value || m.fields.length <= m.visibleCount ? m.fields : m.fields.slice(0, m.visibleCount)), G = (h) => !!u[`field-${h}`], n = (h, b) => {
393
+ m.model[h] = b;
394
+ };
395
+ return Ve({
396
+ code: m.aiTarget,
397
+ getValue: () => m.model,
398
+ setValue: (h) => {
399
+ h && typeof h == "object" && Object.assign(m.model, h);
400
+ },
401
+ trigger: (h) => {
402
+ l(h === "reset" ? "reset" : "search");
403
+ },
404
+ isVisible: () => !0
405
+ }), (h, b) => e.fields.length ? (d(), A("section", {
406
+ key: 0,
407
+ class: x(a(v).b()),
408
+ "data-ai-target": e.aiTarget || void 0
409
+ }, [
410
+ W(a(_e), {
411
+ model: e.model,
412
+ "label-width": e.labelWidth,
413
+ "label-position": "left",
414
+ class: "gi-crud-search__form"
415
+ }, {
416
+ default: S(() => [
417
+ K("div", {
418
+ class: x(a(v).be("grid"))
419
+ }, [
420
+ (d(!0), A(ge, null, le(T.value, (g) => (d(), D(a(et), {
421
+ key: g.prop,
422
+ label: g.label,
423
+ prop: g.prop,
424
+ rules: g.rules,
425
+ "ai-target": e.aiTarget ? e.aiTarget + ".search." + g.prop : void 0,
426
+ class: x(a(v).be("item"))
427
+ }, {
428
+ default: S(() => [
429
+ G(g.prop) ? L(h.$slots, "field-" + g.prop, {
430
+ field: g,
431
+ model: e.model
432
+ }, void 0, void 0, 0) : (d(), D(tt, {
433
+ key: 1,
434
+ field: g,
435
+ "model-value": e.model[g.prop],
436
+ "onUpdate:modelValue": (c) => n(g.prop, c)
437
+ }, null, 8, ["field", "model-value", "onUpdate:modelValue"]))
438
+ ]),
439
+ _: 2
440
+ }, 1032, ["label", "prop", "rules", "ai-target", "class"]))), 128))
441
+ ], 2)
442
+ ]),
443
+ _: 3
444
+ }, 8, ["model", "label-width"]),
445
+ K("div", {
446
+ class: x(a(v).be("actions"))
447
+ }, [
448
+ W(a(Z), {
449
+ type: "primary",
450
+ loading: e.loading,
451
+ onClick: b[0] || (b[0] = (g) => l("search"))
452
+ }, {
453
+ icon: S(() => [
454
+ W(a(se), {
455
+ name: "gi-Search",
456
+ size: 14
457
+ })
458
+ ]),
459
+ default: S(() => [
460
+ ee(" " + Q($.value.search), 1)
461
+ ]),
462
+ _: 1
463
+ }, 8, ["loading"]),
464
+ W(a(Z), {
465
+ disabled: e.loading,
466
+ onClick: b[1] || (b[1] = (g) => l("reset"))
467
+ }, {
468
+ icon: S(() => [
469
+ W(a(se), {
470
+ name: "gi-ArrowCounterclockwise",
471
+ size: 14
472
+ })
473
+ ]),
474
+ default: S(() => [
475
+ ee(" " + Q($.value.reset), 1)
476
+ ]),
477
+ _: 1
478
+ }, 8, ["disabled"]),
479
+ e.fields.length > e.visibleCount ? (d(), D(a(Z), {
480
+ key: 0,
481
+ text: "",
482
+ type: "primary",
483
+ onClick: b[2] || (b[2] = (g) => f.value = !f.value)
484
+ }, {
485
+ icon: S(() => [
486
+ W(a(se), {
487
+ name: f.value ? "gi-ArrowUp" : "gi-ArrowDown",
488
+ size: 14
489
+ }, null, 8, ["name"])
490
+ ]),
491
+ default: S(() => [
492
+ ee(" " + Q(f.value ? "收起" : "展开"), 1)
493
+ ]),
494
+ _: 1
495
+ })) : P("", !0)
496
+ ], 2)
497
+ ], 10, St)) : P("", !0);
498
+ }
499
+ }), kt = ["data-ai-target"], xt = ["width"], Vt = ["width"], Bt = ["onClick"], zt = ["data-ai-target", "onClick"], $t = ["colspan"], xe = 46, We = 56, At = /* @__PURE__ */ pe({
500
+ name: "CrudTable",
501
+ __name: "crud-table",
502
+ props: {
503
+ columns: {},
504
+ data: { default: () => [] },
505
+ loading: { type: Boolean, default: !1 },
506
+ rowKey: { default: "id" },
507
+ selection: { type: Boolean, default: !1 },
508
+ showIndex: { type: Boolean, default: !1 },
509
+ showActions: { type: Boolean, default: !0 },
510
+ actionWidth: { default: 180 },
511
+ actionFixed: { type: [Boolean, String], default: "right" },
512
+ canView: { type: Boolean, default: !0 },
513
+ canEdit: { type: Boolean, default: !0 },
514
+ canDelete: { type: Boolean, default: !0 },
515
+ maxHeight: { default: "" },
516
+ fill: { type: Boolean, default: !1 },
517
+ hiddenColumns: { default: () => [] },
518
+ emptyText: { default: "" },
519
+ indexOffset: { default: 0 },
520
+ sortMode: { default: "local" },
521
+ entity: { default: "" },
522
+ aiTarget: { default: "" },
523
+ reserveSelection: { type: Boolean, default: !1 },
524
+ selectable: { type: Function, default: void 0 }
525
+ },
526
+ emits: ["selection-change", "row-click", "view", "edit", "remove", "sort-change"],
527
+ setup(e, { expose: F, emit: m }) {
528
+ const l = e, v = m, u = Be("crud-table"), f = De(), $ = H(), T = H({ left: 0, max: 0 }), G = z(() => T.value.left > 1), n = z(() => T.value.max - T.value.left > 1);
529
+ let h = null;
530
+ const b = z(() => {
531
+ const t = l.actionWidth;
532
+ return typeof t == "number" ? t : Number.parseInt(String(t), 10) || 160;
533
+ }), g = z(() => l.actionFixed === !0 || l.actionFixed === "right"), c = z(
534
+ () => l.columns.filter(
535
+ (t) => t.visible !== !1 && !t.hidden && !l.hiddenColumns.includes(t.prop)
536
+ )
537
+ ), R = z(() => {
538
+ let t = B.value.reduce((s, r) => s + r, 0);
539
+ return l.selection && (t += xe), l.showIndex && (t += We), l.showActions && (t += b.value), t;
540
+ }), B = z(() => c.value.map((t) => _(t))), J = z(() => {
541
+ const t = {};
542
+ return l.maxHeight && (t.maxHeight = X(l.maxHeight)), l.fill && (t.height = "100%"), t;
543
+ }), ce = z(() => ({
544
+ width: `${R.value}px`,
545
+ minWidth: "100%"
546
+ })), ue = z(
547
+ () => c.value.length + (l.showActions ? 1 : 0) + (l.selection ? 1 : 0) + (l.showIndex ? 1 : 0)
548
+ );
549
+ function X(t) {
550
+ return typeof t == "number" ? `${t}px` : t;
551
+ }
552
+ function _(t) {
553
+ return (typeof t.width == "number" ? t.width : Number.parseInt(String(t.width), 10)) || (typeof t.minWidth == "number" ? t.minWidth : Number.parseInt(String(t.minWidth), 10)) || 160;
554
+ }
555
+ const fe = z(() => {
556
+ let t = (l.selection ? xe : 0) + (l.showIndex ? We : 0);
557
+ const s = {};
558
+ for (const r of c.value)
559
+ (r.fixed === "left" || r.fixed === !0) && (s[r.prop] = t, t += _(r));
560
+ return s;
561
+ }), U = z(() => {
562
+ let t = g.value ? b.value : 0;
563
+ const s = {};
564
+ for (const r of [...c.value].reverse())
565
+ r.fixed === "right" && (s[r.prop] = t, t += _(r));
566
+ return s;
567
+ });
568
+ function o(t, s = 3) {
569
+ const r = { position: "sticky", zIndex: String(s) };
570
+ return t.left !== void 0 && (r.left = `${t.left}px`), t.right !== void 0 && (r.right = `${t.right}px`), r;
571
+ }
572
+ function I(t, s = !1) {
573
+ const r = {
574
+ width: `${_(t)}px`,
575
+ minWidth: `${_(t)}px`,
576
+ textAlign: (s ? t.headerAlign : t.align) || t.align || "left"
577
+ };
578
+ return t.fixed === "left" || t.fixed === !0 ? Object.assign(r, o({ left: fe.value[t.prop] })) : t.fixed === "right" && Object.assign(r, o({ right: U.value[t.prop] })), s && (r.zIndex = ae(t) ? "5" : "4"), r;
579
+ }
580
+ function w(t) {
581
+ return t.sortable ? "is-sortable" : "";
582
+ }
583
+ function q(t) {
584
+ return t.showOverflowTooltip ? "is-ellipsis" : "";
585
+ }
586
+ function ae(t) {
587
+ return t.fixed === "left" || t.fixed === !0 || t.fixed === "right";
588
+ }
589
+ function ze(t) {
590
+ return t.fixed === "left" || t.fixed === !0 ? u.be("cell--fixed-left") : t.fixed === "right" ? u.be("cell--fixed-right") : "";
591
+ }
592
+ function de() {
593
+ const t = $.value;
594
+ t && (T.value = {
595
+ left: t.scrollLeft,
596
+ max: Math.max(0, t.scrollWidth - t.clientWidth)
597
+ });
598
+ }
599
+ function $e() {
600
+ de();
601
+ }
602
+ Ye(() => {
603
+ de(), Ie(de), $.value && (h = new ResizeObserver(de), h.observe($.value));
604
+ }), Ze(() => {
605
+ h == null || h.disconnect(), h = null;
606
+ }), Ge([R, () => l.data.length, c], () => Ie(de));
607
+ const ie = H({
608
+ prop: "",
609
+ order: null
610
+ }), he = (t) => ie.value.prop === t.prop ? ie.value.order : null, be = z(() => {
611
+ const t = [...l.data];
612
+ if (l.sortMode === "server" || !ie.value.prop || !ie.value.order) return t;
613
+ const s = c.value.find((N) => N.prop === ie.value.prop);
614
+ if (!s) return t;
615
+ const r = ie.value.order === "ascending" ? 1 : -1;
616
+ return t.sort((N, j) => {
617
+ const Ce = me(N, s), ke = me(j, s);
618
+ return Ce === ke ? 0 : Ce == null || Ce === "" ? -1 * r : ke == null || ke === "" ? r : (Ce > ke ? 1 : -1) * r;
619
+ });
620
+ });
621
+ function Ae(t) {
622
+ if (!t.sortable) return;
623
+ const s = he(t), r = s === "ascending" ? "descending" : s === "descending" ? null : "ascending";
624
+ ie.value = { prop: t.prop, order: r }, v("sort-change", { prop: t.prop, order: r, column: t });
625
+ }
626
+ function Fe(t, s) {
627
+ return s.split(".").reduce((r, N) => r == null ? r : r[N], t);
628
+ }
629
+ function me(t, s) {
630
+ return Fe(t, s.prop);
631
+ }
632
+ function we(t, s, r) {
633
+ const N = me(t, s), j = s.formatter ? s.formatter(t, s, N, r) : N;
634
+ return j == null ? "" : String(j);
635
+ }
636
+ function Ee(t) {
637
+ return !!f[`cell-${t}`];
638
+ }
639
+ function Pe(t) {
640
+ return !!f[`header-${t}`];
641
+ }
642
+ function M(t, s) {
643
+ return String((t == null ? void 0 : t[l.rowKey]) ?? s);
644
+ }
645
+ function Ue(t, s) {
646
+ if (l.entity)
647
+ return `crud.${l.entity}.table.row.${M(t, s)}`;
648
+ }
649
+ function ve(t, s) {
650
+ return l.selectable ? l.selectable(t, s) : !0;
651
+ }
652
+ const Y = H(/* @__PURE__ */ new Set()), O = H(/* @__PURE__ */ new Map()), Se = z(() => be.value), i = z(
653
+ () => Se.value.length > 0 && Se.value.every((t, s) => ve(t, s) && V(t))
654
+ ), k = z(
655
+ () => Se.value.some((t, s) => ve(t, s) && V(t))
656
+ );
657
+ function V(t) {
658
+ return Y.value.has(M(t, l.data.indexOf(t)));
659
+ }
660
+ function C() {
661
+ const t = l.reserveSelection ? [...Y.value].map((s) => O.value.get(s)).filter(Boolean) : l.data.filter((s) => Y.value.has(M(s, l.data.indexOf(s))));
662
+ v("selection-change", t);
663
+ }
664
+ function y(t, s) {
665
+ if (!ve(t, l.data.indexOf(t))) return;
666
+ const r = M(t, l.data.indexOf(t));
667
+ s ? (Y.value.add(r), O.value.set(r, t)) : (Y.value.delete(r), O.value.delete(r)), C();
668
+ }
669
+ function p(t) {
670
+ for (const [s, r] of l.data.entries()) {
671
+ if (!ve(r, s)) continue;
672
+ const N = M(r, s);
673
+ t ? (Y.value.add(N), O.value.set(N, r)) : (Y.value.delete(N), O.value.delete(N));
674
+ }
675
+ C();
676
+ }
677
+ Ge(
678
+ () => l.data,
679
+ () => {
680
+ if (l.reserveSelection) return;
681
+ const t = new Set(l.data.map((r, N) => M(r, N)));
682
+ let s = !1;
683
+ for (const r of Y.value)
684
+ t.has(r) || (Y.value.delete(r), O.value.delete(r), s = !0);
685
+ s && C();
686
+ }
687
+ );
688
+ function E(t) {
689
+ Y.value = new Set(t.map((s) => M(s, l.data.indexOf(s)))), O.value = new Map(t.map((s) => [M(s, l.data.indexOf(s)), s])), C();
690
+ }
691
+ function ne() {
692
+ Y.value = /* @__PURE__ */ new Set(), O.value = /* @__PURE__ */ new Map(), C();
693
+ }
694
+ return F({ setSelection: E, clearSelection: ne }), Ve({
695
+ code: l.aiTarget,
696
+ getValue: () => ({ data: l.data, selection: l.data.filter((t) => V(t)) }),
697
+ getRecords: () => {
698
+ const t = l.data.filter((s) => V(s));
699
+ return t.length ? t : l.data.slice(0, 50);
700
+ },
701
+ execute: (t, s) => t === "clearSelection" ? (ne(), !0) : t === "setSelection" && Array.isArray(s == null ? void 0 : s.rows) ? (E(s.rows), !0) : { ok: !1, reason: "unsupported" },
702
+ isEnabled: () => !l.loading,
703
+ isVisible: () => !0
704
+ }), (t, s) => it((d(), A("div", {
705
+ class: x([
706
+ a(u).b(),
707
+ e.fill ? a(u).is("fill") : "",
708
+ G.value ? a(u).is("scroll-left") : "",
709
+ n.value ? a(u).is("scroll-right") : ""
710
+ ]),
711
+ style: te(J.value),
712
+ "data-ai-target": e.aiTarget || void 0
713
+ }, [
714
+ K("div", {
715
+ ref_key: "scrollerRef",
716
+ ref: $,
717
+ class: x(a(u).be("scroller")),
718
+ onScroll: $e
719
+ }, [
720
+ K("table", {
721
+ class: x(a(u).be("table")),
722
+ style: te(ce.value),
723
+ role: "grid"
724
+ }, [
725
+ K("colgroup", null, [
726
+ e.selection ? (d(), A("col", {
727
+ key: 0,
728
+ width: xe
729
+ })) : P("", !0),
730
+ e.showIndex ? (d(), A("col", {
731
+ key: 1,
732
+ width: We
733
+ })) : P("", !0),
734
+ (d(!0), A(ge, null, le(c.value, (r) => (d(), A("col", {
735
+ key: r.prop,
736
+ width: _(r)
737
+ }, null, 8, xt))), 128)),
738
+ e.showActions ? (d(), A("col", {
739
+ key: 2,
740
+ width: b.value
741
+ }, null, 8, Vt)) : P("", !0)
742
+ ]),
743
+ K("thead", {
744
+ class: x(a(u).be("head"))
745
+ }, [
746
+ K("tr", null, [
747
+ e.selection ? (d(), A("th", {
748
+ key: 0,
749
+ class: x([a(u).be("cell"), a(u).be("cell--fixed-left")]),
750
+ style: te(o({ left: 0 }, 5))
751
+ }, [
752
+ W(a(Me), {
753
+ "model-value": i.value,
754
+ indeterminate: k.value && !i.value,
755
+ "aria-label": "全选当前页",
756
+ "onUpdate:modelValue": s[0] || (s[0] = (r) => p(!!r))
757
+ }, null, 8, ["model-value", "indeterminate"])
758
+ ], 6)) : P("", !0),
759
+ e.showIndex ? (d(), A("th", {
760
+ key: 1,
761
+ class: x([a(u).be("cell"), a(u).be("cell--fixed-left")]),
762
+ style: te(o({ left: e.selection ? xe : 0 }, 5))
763
+ }, " 序号 ", 6)) : P("", !0),
764
+ (d(!0), A(ge, null, le(c.value, (r) => (d(), A("th", {
765
+ key: r.prop,
766
+ class: x([a(u).be("cell"), w(r), ze(r)]),
767
+ style: te(I(r, !0)),
768
+ onClick: (N) => Ae(r)
769
+ }, [
770
+ Pe(r.prop) ? L(t.$slots, "header-" + r.prop, { column: r }, void 0, void 0, 0) : (d(), A("span", {
771
+ key: 1,
772
+ class: x(a(u).be("label"))
773
+ }, Q(r.label), 3)),
774
+ r.sortable ? (d(), A("span", {
775
+ key: 2,
776
+ class: x([a(u).be("sort"), he(r) ? a(u).is("active") : ""]),
777
+ "aria-hidden": "true"
778
+ }, [
779
+ K("span", {
780
+ class: x([a(u).be("caret"), "is-up", he(r) === "ascending" ? "is-active" : ""])
781
+ }, null, 2),
782
+ K("span", {
783
+ class: x([a(u).be("caret"), "is-down", he(r) === "descending" ? "is-active" : ""])
784
+ }, null, 2)
785
+ ], 2)) : P("", !0)
786
+ ], 14, Bt))), 128)),
787
+ e.showActions ? (d(), A("th", {
788
+ key: 2,
789
+ class: x([a(u).be("cell"), g.value ? a(u).be("cell--fixed-right") : ""]),
790
+ style: te(g.value ? o({ right: 0 }, 5) : void 0)
791
+ }, " 操作 ", 6)) : P("", !0)
792
+ ])
793
+ ], 2),
794
+ be.value.length ? (d(), A("tbody", {
795
+ key: 0,
796
+ class: x(a(u).be("body"))
797
+ }, [
798
+ (d(!0), A(ge, null, le(be.value, (r, N) => (d(), A("tr", {
799
+ key: M(r, N),
800
+ class: x(a(u).be("row")),
801
+ "data-ai-target": Ue(r, N),
802
+ onClick: (j) => v("row-click", r, N, j)
803
+ }, [
804
+ e.selection ? (d(), A("td", {
805
+ key: 0,
806
+ class: x([a(u).be("cell"), a(u).be("cell--fixed-left")]),
807
+ style: te(o({ left: 0 }, 5)),
808
+ onClick: s[1] || (s[1] = Ke(() => {
809
+ }, ["stop"]))
810
+ }, [
811
+ W(a(Me), {
812
+ "model-value": V(r),
813
+ disabled: !ve(r, N),
814
+ "onUpdate:modelValue": (j) => y(r, !!j)
815
+ }, null, 8, ["model-value", "disabled", "onUpdate:modelValue"])
816
+ ], 6)) : P("", !0),
817
+ e.showIndex ? (d(), A("td", {
818
+ key: 1,
819
+ class: x([a(u).be("cell"), a(u).be("cell--fixed-left")]),
820
+ style: te(o({ left: e.selection ? xe : 0 }, 5))
821
+ }, Q(e.indexOffset + N + 1), 7)) : P("", !0),
822
+ (d(!0), A(ge, null, le(c.value, (j) => (d(), A("td", {
823
+ key: j.prop,
824
+ class: x([a(u).be("cell"), q(j)]),
825
+ style: te(I(j))
826
+ }, [
827
+ Ee(j.prop) ? L(t.$slots, "cell-" + j.prop, {
828
+ row: r,
829
+ column: j,
830
+ value: me(r, j),
831
+ index: N
832
+ }, void 0, void 0, 0) : j.showOverflowTooltip ? (d(), D(a(qe), {
833
+ key: 1,
834
+ content: we(r, j, N),
835
+ placement: "top",
836
+ "max-width": 360
837
+ }, {
838
+ default: S(() => [
839
+ K("span", {
840
+ class: x(a(u).be("text"))
841
+ }, Q(we(r, j, N)), 3)
842
+ ]),
843
+ _: 2
844
+ }, 1032, ["content"])) : (d(), A("span", {
845
+ key: 2,
846
+ class: x(a(u).be("text"))
847
+ }, Q(we(r, j, N)), 3))
848
+ ], 6))), 128)),
849
+ e.showActions ? (d(), A("td", {
850
+ key: 2,
851
+ class: x([a(u).be("cell"), a(u).be("actions"), g.value ? a(u).be("cell--fixed-right") : ""]),
852
+ style: te(g.value ? o({ right: 0 }, 5) : void 0),
853
+ onClick: s[2] || (s[2] = Ke(() => {
854
+ }, ["stop"]))
855
+ }, [
856
+ L(t.$slots, "actions", {
857
+ row: r,
858
+ index: N
859
+ }, () => [
860
+ e.canView ? (d(), D(a(Z), {
861
+ key: 0,
862
+ text: "",
863
+ type: "primary",
864
+ size: "small",
865
+ onClick: (j) => v("view", r)
866
+ }, {
867
+ default: S(() => [...s[3] || (s[3] = [
868
+ ee(" 查看 ", -1)
869
+ ])]),
870
+ _: 1
871
+ }, 8, ["onClick"])) : P("", !0),
872
+ e.canEdit ? (d(), D(a(Z), {
873
+ key: 1,
874
+ text: "",
875
+ type: "primary",
876
+ size: "small",
877
+ onClick: (j) => v("edit", r)
878
+ }, {
879
+ default: S(() => [...s[4] || (s[4] = [
880
+ ee(" 编辑 ", -1)
881
+ ])]),
882
+ _: 1
883
+ }, 8, ["onClick"])) : P("", !0),
884
+ e.canDelete ? (d(), D(a(Z), {
885
+ key: 2,
886
+ text: "",
887
+ type: "danger",
888
+ size: "small",
889
+ onClick: (j) => v("remove", r)
890
+ }, {
891
+ default: S(() => [...s[5] || (s[5] = [
892
+ ee(" 删除 ", -1)
893
+ ])]),
894
+ _: 1
895
+ }, 8, ["onClick"])) : P("", !0)
896
+ ])
897
+ ], 6)) : P("", !0)
898
+ ], 10, zt))), 128))
899
+ ], 2)) : (d(), A("tbody", {
900
+ key: 1,
901
+ class: x(a(u).be("body"))
902
+ }, [
903
+ K("tr", null, [
904
+ K("td", {
905
+ colspan: ue.value,
906
+ class: x(a(u).be("empty"))
907
+ }, [
908
+ L(t.$slots, "empty", {}, () => [
909
+ W(a(mt), {
910
+ description: e.emptyText || "暂无数据",
911
+ "image-size": 96
912
+ }, null, 8, ["description"])
913
+ ])
914
+ ], 10, $t)
915
+ ])
916
+ ], 2))
917
+ ], 6)
918
+ ], 34)
919
+ ], 14, kt)), [
920
+ [a(vt), e.loading]
921
+ ]);
922
+ }
923
+ }), Ft = ["data-ai-target"], Tt = { key: 0 }, Rt = /* @__PURE__ */ pe({
924
+ name: "CrudToolbar",
925
+ __name: "crud-toolbar",
926
+ props: {
927
+ columns: {},
928
+ hiddenColumns: { default: () => [] },
929
+ selectedCount: { default: 0 },
930
+ loading: { type: Boolean, default: !1 },
931
+ showAdd: { type: Boolean, default: !0 },
932
+ showBatchDelete: { type: Boolean, default: !0 },
933
+ showRefresh: { type: Boolean, default: !0 },
934
+ showColumnSettings: { type: Boolean, default: !0 },
935
+ showExport: { type: Boolean, default: !1 },
936
+ labels: { default: () => ({}) },
937
+ aiTarget: { default: "" }
938
+ },
939
+ emits: ["add", "batch-delete", "refresh", "export", "update:hiddenColumns"],
940
+ setup(e, { emit: F }) {
941
+ const m = e, l = F, v = Be("crud-toolbar"), u = z(() => ({ ...Ne, ...m.labels || {} })), f = z(
942
+ () => m.columns.filter((h) => h.visible !== !1 && !h.hidden)
943
+ ), $ = (h) => !m.hiddenColumns.includes(h), T = z(
944
+ () => f.value.filter((h) => $(h.prop)).length
945
+ ), G = (h, b) => {
946
+ if (!b && T.value <= 1) return;
947
+ const g = b ? m.hiddenColumns.filter((c) => c !== h) : [...m.hiddenColumns, h];
948
+ l("update:hiddenColumns", g);
949
+ }, n = () => l("update:hiddenColumns", []);
950
+ return Ve({
951
+ code: m.aiTarget,
952
+ getValue: () => ({ selectedCount: m.selectedCount, hiddenColumns: m.hiddenColumns }),
953
+ trigger: (h) => {
954
+ const g = { add: "add", refresh: "refresh", export: "export", delete: "batch-delete" }[h];
955
+ g && l(g);
956
+ },
957
+ execute: (h, b) => h === "showAllColumns" ? (n(), !0) : h === "toggleColumn" && (b != null && b.prop) ? (G(String(b.prop), !!b.visible), !0) : { ok: !1, reason: "unsupported" },
958
+ isVisible: () => !0
959
+ }), (h, b) => (d(), A("div", {
960
+ class: x(a(v).b()),
961
+ "data-ai-target": e.aiTarget || void 0
962
+ }, [
963
+ K("div", {
964
+ class: x(a(v).be("info"))
965
+ }, [
966
+ L(h.$slots, "info")
967
+ ], 2),
968
+ K("div", {
969
+ class: x(a(v).be("actions"))
970
+ }, [
971
+ L(h.$slots, "actions"),
972
+ e.showBatchDelete && e.selectedCount > 0 ? (d(), D(a(Z), {
973
+ key: 0,
974
+ type: "danger",
975
+ plain: "",
976
+ disabled: e.loading,
977
+ "ai-target": e.aiTarget ? e.aiTarget + ".toolbar.batchRemove" : void 0,
978
+ onClick: b[0] || (b[0] = (g) => l("batch-delete"))
979
+ }, {
980
+ icon: S(() => [
981
+ W(a(se), {
982
+ name: "gi-Delete",
983
+ size: 14
984
+ })
985
+ ]),
986
+ default: S(() => [
987
+ ee(" " + Q(u.value.batchDelete) + " ", 1),
988
+ e.selectedCount ? (d(), A("span", Tt, "(" + Q(e.selectedCount) + ")", 1)) : P("", !0)
989
+ ]),
990
+ _: 1
991
+ }, 8, ["disabled", "ai-target"])) : P("", !0),
992
+ e.showExport ? (d(), D(a(Z), {
993
+ key: 1,
994
+ disabled: e.loading,
995
+ "ai-target": e.aiTarget ? e.aiTarget + ".toolbar.export" : void 0,
996
+ onClick: b[1] || (b[1] = (g) => l("export"))
997
+ }, {
998
+ icon: S(() => [
999
+ W(a(se), {
1000
+ name: "gi-ArrowDownload",
1001
+ size: 14
1002
+ })
1003
+ ]),
1004
+ default: S(() => [
1005
+ b[4] || (b[4] = ee(" 导出 ", -1))
1006
+ ]),
1007
+ _: 1
1008
+ }, 8, ["disabled", "ai-target"])) : P("", !0),
1009
+ e.showAdd ? (d(), D(a(Z), {
1010
+ key: 2,
1011
+ type: "primary",
1012
+ disabled: e.loading,
1013
+ "ai-target": e.aiTarget ? e.aiTarget + ".toolbar.add" : void 0,
1014
+ onClick: b[2] || (b[2] = (g) => l("add"))
1015
+ }, {
1016
+ icon: S(() => [
1017
+ W(a(se), {
1018
+ name: "gi-Add",
1019
+ size: 14
1020
+ })
1021
+ ]),
1022
+ default: S(() => [
1023
+ ee(" " + Q(u.value.add), 1)
1024
+ ]),
1025
+ _: 1
1026
+ }, 8, ["disabled", "ai-target"])) : P("", !0),
1027
+ e.showRefresh ? (d(), D(a(Z), {
1028
+ key: 3,
1029
+ circle: "",
1030
+ loading: e.loading,
1031
+ "aria-label": u.value.refresh,
1032
+ title: u.value.refresh,
1033
+ "ai-target": e.aiTarget ? e.aiTarget + ".toolbar.refresh" : void 0,
1034
+ onClick: b[3] || (b[3] = (g) => l("refresh"))
1035
+ }, {
1036
+ icon: S(() => [
1037
+ W(a(se), {
1038
+ name: "gi-ArrowSync",
1039
+ size: 15
1040
+ })
1041
+ ]),
1042
+ _: 1
1043
+ }, 8, ["loading", "aria-label", "title", "ai-target"])) : P("", !0),
1044
+ e.showColumnSettings && f.value.length ? (d(), D(a(gt), {
1045
+ key: 4,
1046
+ placement: "bottom-end",
1047
+ width: 248,
1048
+ "ai-target": e.aiTarget ? e.aiTarget + ".toolbar.columns" : void 0
1049
+ }, {
1050
+ reference: S(() => [
1051
+ W(a(Z), {
1052
+ circle: "",
1053
+ "aria-label": u.value.columnSettings,
1054
+ title: u.value.columnSettings
1055
+ }, {
1056
+ icon: S(() => [
1057
+ W(a(se), {
1058
+ name: "gi-TableSettings",
1059
+ size: 15
1060
+ })
1061
+ ]),
1062
+ _: 1
1063
+ }, 8, ["aria-label", "title"])
1064
+ ]),
1065
+ default: S(() => [
1066
+ K("div", {
1067
+ class: x(a(v).be("column-settings"))
1068
+ }, [
1069
+ K("header", {
1070
+ class: x(a(v).be("column-settings-head"))
1071
+ }, [
1072
+ K("strong", null, Q(u.value.columnSettings), 1),
1073
+ W(a(Z), {
1074
+ text: "",
1075
+ type: "primary",
1076
+ size: "small",
1077
+ onClick: n
1078
+ }, {
1079
+ default: S(() => [
1080
+ ee(Q(u.value.showAllColumns), 1)
1081
+ ]),
1082
+ _: 1
1083
+ })
1084
+ ], 2),
1085
+ K("div", {
1086
+ class: x(a(v).be("column-settings-list"))
1087
+ }, [
1088
+ (d(!0), A(ge, null, le(f.value, (g) => (d(), D(a(Me), {
1089
+ key: g.prop,
1090
+ "model-value": $(g.prop),
1091
+ disabled: T.value <= 1 && $(g.prop),
1092
+ "onUpdate:modelValue": (c) => G(g.prop, !!c)
1093
+ }, {
1094
+ default: S(() => [
1095
+ ee(Q(g.label), 1)
1096
+ ]),
1097
+ _: 2
1098
+ }, 1032, ["model-value", "disabled", "onUpdate:modelValue"]))), 128))
1099
+ ], 2),
1100
+ K("p", {
1101
+ class: x(a(v).be("column-settings-tip"))
1102
+ }, Q(u.value.columnSettingsTip), 3)
1103
+ ], 2)
1104
+ ]),
1105
+ _: 1
1106
+ }, 8, ["ai-target"])) : P("", !0)
1107
+ ], 2)
1108
+ ], 10, Ft));
1109
+ }
1110
+ }), Qe = (e) => Object.prototype.toString.call(e) === "[object Object]";
1111
+ function Je(e) {
1112
+ if (Array.isArray(e))
1113
+ return { list: e, total: e.length };
1114
+ if (!Qe(e)) return { list: [], total: 0 };
1115
+ const F = Qe(e.data) ? e.data : e, m = F.list || F.rows || F.records || F.data || [], l = Number(F.total ?? F.count ?? m.length ?? 0);
1116
+ return {
1117
+ list: Array.isArray(m) ? m : [],
1118
+ total: Number.isFinite(l) ? l : 0,
1119
+ pageNum: Number(F.pageNum ?? F.current ?? F.page ?? 1) || 1,
1120
+ pageSize: Number(F.pageSize ?? F.size ?? 10) || 10
1121
+ };
1122
+ }
1123
+ const Xe = (e) => {
1124
+ if (typeof structuredClone == "function")
1125
+ try {
1126
+ return structuredClone(e);
1127
+ } catch {
1128
+ }
1129
+ return Array.isArray(e) ? [...e] : { ...e };
1130
+ };
1131
+ function Ot(e) {
1132
+ const F = e.idKey || "id", m = z(() => ({ ...Ne, ...e.labels || {} })), l = je({ ...e.defaultQuery || {} }), v = je({ ...e.defaultForm || {} }), u = ye([]), f = ye([]), $ = H(0), T = H(1), G = H(e.pageSize || 10), n = H(!1), h = H(!1), b = H(!1), g = H("create"), c = H(null), R = ye([...e.hiddenColumns || []]), B = ye([...e.columns || []]), J = ye([...e.searchFields || []]), ce = ye([...e.formFields || []]);
1133
+ let ue = 0, X = null, _ = null;
1134
+ const fe = z(() => {
1135
+ const i = m.value[g.value];
1136
+ return e.title ? `${i}${e.title}` : i;
1137
+ }), U = (i) => i[F], o = () => {
1138
+ for (const i of Object.keys(v)) delete v[i];
1139
+ Object.assign(v, e.defaultForm || {});
1140
+ }, I = () => {
1141
+ for (const i of Object.keys(l)) delete l[i];
1142
+ Object.assign(l, e.defaultQuery || {});
1143
+ }, w = async () => {
1144
+ const i = ++ue;
1145
+ X == null || X.abort();
1146
+ const k = new AbortController();
1147
+ X = k, n.value = !0;
1148
+ try {
1149
+ const V = await e.api.list(
1150
+ { ...l, pageNum: T.value, pageSize: G.value },
1151
+ { signal: k.signal }
1152
+ );
1153
+ if (i !== ue) return;
1154
+ const C = e.api.normalizePage ? e.api.normalizePage(V) : Je(V);
1155
+ u.value = C.list, $.value = C.total, C.pageNum && (T.value = C.pageNum), C.pageSize && (G.value = C.pageSize);
1156
+ const y = new Set(C.list.map(U));
1157
+ if (f.value.length) {
1158
+ const p = f.value.filter((E) => y.has(U(E)));
1159
+ p.length !== f.value.length && (f.value = p);
1160
+ }
1161
+ } catch (V) {
1162
+ if ((V == null ? void 0 : V.name) === "AbortError" || k.signal.aborted) return;
1163
+ oe.error((V == null ? void 0 : V.message) || "加载失败"), u.value = [], $.value = 0;
1164
+ } finally {
1165
+ i === ue && (n.value = !1), X === k && (X = null);
1166
+ }
1167
+ }, q = async () => {
1168
+ T.value = 1, await w();
1169
+ }, ae = async () => {
1170
+ I(), T.value = 1, f.value = [], await w();
1171
+ }, ze = () => {
1172
+ c.value = null, o(), g.value = "create", b.value = !0;
1173
+ }, de = (i) => {
1174
+ c.value = i, o(), Object.assign(v, Xe(i)), g.value = "edit", b.value = !0;
1175
+ }, $e = (i) => {
1176
+ c.value = i, o(), Object.assign(v, Xe(i)), g.value = "view", b.value = !0;
1177
+ }, ie = () => {
1178
+ b.value = !1, c.value = null;
1179
+ }, he = (i) => {
1180
+ _ = i;
1181
+ }, be = async () => {
1182
+ if (g.value === "view" || _ && !await _())
1183
+ return !1;
1184
+ const i = e.api;
1185
+ h.value = !0;
1186
+ try {
1187
+ if (g.value === "create") {
1188
+ if (!i.create) throw new Error(m.value.noCreateApi);
1189
+ await i.create(v);
1190
+ } else {
1191
+ if (!i.update) throw new Error(m.value.noUpdateApi);
1192
+ const k = c.value ? U(c.value) : v[F];
1193
+ await i.update(k, v);
1194
+ }
1195
+ return oe.success(m.value.success), ie(), await w(), !0;
1196
+ } catch (k) {
1197
+ return (k == null ? void 0 : k.name) !== "AbortError" && oe.error((k == null ? void 0 : k.message) || "保存失败"), !1;
1198
+ } finally {
1199
+ h.value = !1;
1200
+ }
1201
+ }, Ae = async (i, k = !1) => {
1202
+ const V = e.api;
1203
+ if (!V.remove)
1204
+ return oe.error(m.value.noRemoveApi), !1;
1205
+ if (!k && (await He(m.value.deleteConfirm, "提示", { type: "warning" })).action !== "confirm")
1206
+ return !1;
1207
+ try {
1208
+ await V.remove(U(i)), oe.success(m.value.success);
1209
+ } catch (C) {
1210
+ return oe.error((C == null ? void 0 : C.message) || "删除失败"), !1;
1211
+ }
1212
+ return f.value = f.value.filter((C) => U(C) !== U(i)), await w(), !0;
1213
+ }, Fe = async (i = !1, k) => {
1214
+ const V = k != null && k.length ? k : f.value.map(U);
1215
+ if (!V.length) return !1;
1216
+ const C = e.api;
1217
+ if (!C.batchRemove)
1218
+ return oe.error(m.value.noBatchRemoveApi), !1;
1219
+ if (!i) {
1220
+ const y = m.value.batchDeleteConfirm.replace("{count}", String(V.length));
1221
+ if ((await He(y, "提示", { type: "warning" })).action !== "confirm") return !1;
1222
+ }
1223
+ try {
1224
+ await C.batchRemove(V), oe.success(m.value.success);
1225
+ } catch (y) {
1226
+ return oe.error((y == null ? void 0 : y.message) || "批量删除失败"), !1;
1227
+ }
1228
+ return f.value = [], await w(), !0;
1229
+ }, me = (i) => {
1230
+ f.value = i;
1231
+ }, we = async (i) => {
1232
+ T.value = Math.max(1, i), await w();
1233
+ }, Ee = async (i) => {
1234
+ G.value = Math.max(1, i), T.value = 1, await w();
1235
+ }, Pe = async () => {
1236
+ if (!e.exporter) {
1237
+ oe.error(m.value.noExporter);
1238
+ return;
1239
+ }
1240
+ const i = await e.api.list(
1241
+ { ...l, pageNum: 1, pageSize: 1e4 },
1242
+ { signal: void 0 }
1243
+ ), k = e.api.normalizePage ? e.api.normalizePage(i) : Je(i);
1244
+ await e.exporter(k.list, { title: e.title || "", query: { ...l } });
1245
+ }, M = (i) => e.permissions && i in e.permissions ? !!e.permissions[i] : i === "create" ? !!e.api.create : i === "edit" ? !!e.api.update : i === "view" ? !0 : i === "delete" ? !!e.api.remove : i === "batchDelete" ? !!e.api.batchRemove : i === "export" ? !!e.exporter : !1, Ue = () => {
1246
+ var k, V;
1247
+ const i = (C, y) => C.map((p) => {
1248
+ var E;
1249
+ return {
1250
+ prop: p.prop,
1251
+ label: p.label,
1252
+ type: p.type || (p.component ? "component" : "input"),
1253
+ required: y && !!(p.rules || (E = e.rules) != null && E[p.prop]),
1254
+ options: p.options,
1255
+ disabled: !!p.disabled
1256
+ };
1257
+ });
1258
+ return {
1259
+ contractVersion: "1.0",
1260
+ entity: e.entity || e.title || "",
1261
+ title: e.title || "",
1262
+ idKey: F,
1263
+ queryFields: i(J.value, !1),
1264
+ columns: B.value.map((C) => ({
1265
+ prop: C.prop,
1266
+ label: C.label,
1267
+ sortable: !!C.sortable,
1268
+ visible: !R.value.includes(C.prop) && C.visible !== !1 && !C.hidden
1269
+ })),
1270
+ formFields: i(ce.value, !0),
1271
+ capabilities: [
1272
+ "search",
1273
+ "reset",
1274
+ "refresh",
1275
+ "page",
1276
+ "select",
1277
+ "openCreate",
1278
+ "openEdit",
1279
+ "openView",
1280
+ "fillField",
1281
+ "submit",
1282
+ "remove",
1283
+ "batchRemove",
1284
+ "setColumnVisible"
1285
+ ],
1286
+ permissions: {
1287
+ create: M("create"),
1288
+ edit: M("edit"),
1289
+ view: M("view"),
1290
+ delete: M("delete"),
1291
+ batchDelete: M("batchDelete"),
1292
+ export: M("export")
1293
+ },
1294
+ page: {
1295
+ pageNum: T.value,
1296
+ pageSize: G.value,
1297
+ pageSizes: [...e.pageSizes || [10, 20, 30, 50, 100]]
1298
+ },
1299
+ policy: {
1300
+ destructive: ((k = e.aiPolicy) == null ? void 0 : k.destructive) || "confirm",
1301
+ readonly: !!((V = e.aiPolicy) != null && V.readonly)
1302
+ }
1303
+ };
1304
+ }, ve = () => ({
1305
+ query: { ...l },
1306
+ pageNum: T.value,
1307
+ pageSize: G.value,
1308
+ total: $.value,
1309
+ selectedIds: f.value.map(U),
1310
+ rowCount: u.value.length,
1311
+ loading: n.value,
1312
+ submitting: h.value,
1313
+ dialog: {
1314
+ visible: b.value,
1315
+ mode: g.value,
1316
+ title: fe.value,
1317
+ rowId: c.value ? U(c.value) : void 0
1318
+ },
1319
+ columns: B.value.map((i) => ({
1320
+ prop: i.prop,
1321
+ visible: !R.value.includes(i.prop) && i.visible !== !1 && !i.hidden
1322
+ }))
1323
+ }), Y = (i) => {
1324
+ const k = B.value.filter((p) => {
1325
+ const E = p.type;
1326
+ return !!p.prop && !p.hidden && p.visible !== !1 && !["selection", "index", "expand"].includes(E);
1327
+ }), V = {};
1328
+ k.forEach((p) => {
1329
+ const E = p.label || p.prop;
1330
+ E && (V[E] = i[p.prop]);
1331
+ });
1332
+ const C = k.find((p) => p.prop !== F) || k[0], y = C ? i[C.prop] : void 0;
1333
+ return {
1334
+ id: U(i),
1335
+ label: y == null || y === "" ? String(U(i)) : String(y),
1336
+ values: V
1337
+ };
1338
+ }, O = (i) => ({ ok: !1, reason: i }), Se = async (i) => {
1339
+ var C;
1340
+ const k = e.aiPolicy || {}, V = k.destructive || "confirm";
1341
+ if (k.readonly && ["openCreate", "openEdit", "submit", "remove", "batchRemove", "fillField"].includes(i.op))
1342
+ return O("readonly");
1343
+ switch (i.op) {
1344
+ case "search": {
1345
+ const y = new Set(J.value.map((E) => E.prop)), p = Object.fromEntries(
1346
+ Object.entries(i.query || {}).filter(([E]) => y.size === 0 || y.has(E))
1347
+ );
1348
+ return Object.assign(l, p), T.value = 1, await w(), { ok: !0, data: { ...p } };
1349
+ }
1350
+ case "reset":
1351
+ return await ae(), { ok: !0 };
1352
+ case "refresh":
1353
+ return await w(), { ok: !0 };
1354
+ case "page":
1355
+ return i.pageNum !== void 0 && (T.value = Math.max(1, i.pageNum)), i.pageSize !== void 0 && (G.value = Math.max(1, i.pageSize), T.value = 1), await w(), { ok: !0, data: { pageNum: T.value, pageSize: G.value } };
1356
+ case "select": {
1357
+ const y = new Set(i.ids), p = u.value.filter((ne) => y.has(U(ne)));
1358
+ me(p);
1359
+ const E = new Set(p.map(U));
1360
+ return {
1361
+ ok: !0,
1362
+ data: { selectedIds: p.map(U), missingIds: [...y].filter((ne) => !E.has(ne)) }
1363
+ };
1364
+ }
1365
+ case "openCreate":
1366
+ return M("create") ? (ze(), { ok: !0 }) : O("permission");
1367
+ case "openEdit": {
1368
+ if (!M("edit")) return O("permission");
1369
+ const y = u.value.find((p) => U(p) === i.id);
1370
+ return y ? (de(y), { ok: !0 }) : O("notFound");
1371
+ }
1372
+ case "openView": {
1373
+ if (!M("view")) return O("permission");
1374
+ const y = u.value.find((p) => U(p) === i.id);
1375
+ return y ? ($e(y), { ok: !0 }) : O("notFound");
1376
+ }
1377
+ case "fillField":
1378
+ return (i.target === "form" ? ce.value : J.value).some((p) => p.prop === i.field) ? (i.target === "form" ? v[i.field] = i.value : l[i.field] = i.value, { ok: !0, data: { target: i.target || "query", field: i.field, value: i.value } }) : O("unknownField");
1379
+ case "submit":
1380
+ return g.value === "view" ? O("viewOnly") : await be() ? { ok: !0 } : O("submitFailed");
1381
+ case "remove": {
1382
+ if (!M("delete")) return O("permission");
1383
+ if (V === "deny") return O("policy");
1384
+ const y = u.value.find((ne) => U(ne) === i.id);
1385
+ if (!y) return O("notFound");
1386
+ if (V === "confirm" && !i.confirmed)
1387
+ return {
1388
+ ok: !1,
1389
+ reason: "confirmRequired",
1390
+ requireConfirm: !0,
1391
+ data: {
1392
+ op: "remove",
1393
+ ids: [i.id],
1394
+ message: m.value.deleteConfirm,
1395
+ records: [Y(y)]
1396
+ }
1397
+ };
1398
+ const p = Y(y);
1399
+ return await Ae(y, !0) ? { ok: !0, data: { ids: [i.id], records: [p] } } : O("removeFailed");
1400
+ }
1401
+ case "batchRemove": {
1402
+ if (!M("batchDelete")) return O("permission");
1403
+ if (V === "deny") return O("policy");
1404
+ const y = (C = i.ids) != null && C.length ? u.value.filter((t) => i.ids.some((s) => String(s) === String(U(t)))) : f.value;
1405
+ if (!y.length) return O("emptySelection");
1406
+ const p = y.map(U), E = y.map((t) => Y(t));
1407
+ if (V === "confirm" && !i.confirmed) {
1408
+ const t = m.value.batchDeleteConfirm.replace("{count}", String(p.length));
1409
+ return {
1410
+ ok: !1,
1411
+ reason: "confirmRequired",
1412
+ requireConfirm: !0,
1413
+ data: {
1414
+ op: "batchRemove",
1415
+ ids: p,
1416
+ message: t,
1417
+ records: E
1418
+ }
1419
+ };
1420
+ }
1421
+ return await Fe(!0, p) ? { ok: !0, data: { ids: p, records: E } } : O("removeFailed");
1422
+ }
1423
+ case "setColumnVisible": {
1424
+ const y = B.value.find((p) => p.prop === i.prop);
1425
+ if (!y) return O("notFound");
1426
+ if (i.visible)
1427
+ y.hidden = !1, y.visible = !0, R.value = R.value.filter((p) => p !== i.prop);
1428
+ else if (!R.value.includes(i.prop)) {
1429
+ if (B.value.filter(
1430
+ (E) => E.visible !== !1 && !E.hidden && !R.value.includes(E.prop)
1431
+ ).length <= 1) return O("lastColumn");
1432
+ R.value = [...R.value, i.prop];
1433
+ }
1434
+ return { ok: !0, data: { prop: i.prop, visible: i.visible } };
1435
+ }
1436
+ default:
1437
+ return O("unsupported");
1438
+ }
1439
+ };
1440
+ return e.immediate !== !1 && w(), Ze(() => {
1441
+ ue += 1, X == null || X.abort(), X = null;
1442
+ }), je({
1443
+ query: l,
1444
+ form: v,
1445
+ data: u,
1446
+ selected: f,
1447
+ total: $,
1448
+ pageNum: T,
1449
+ pageSize: G,
1450
+ loading: n,
1451
+ submitting: h,
1452
+ dialogVisible: b,
1453
+ mode: g,
1454
+ dialogTitle: fe,
1455
+ columns: B,
1456
+ searchFields: J,
1457
+ formFields: ce,
1458
+ hiddenColumns: R,
1459
+ labels: m.value,
1460
+ search: q,
1461
+ reset: ae,
1462
+ refresh: w,
1463
+ load: w,
1464
+ openCreate: ze,
1465
+ openEdit: de,
1466
+ openView: $e,
1467
+ closeDialog: ie,
1468
+ submit: be,
1469
+ remove: Ae,
1470
+ batchRemove: Fe,
1471
+ selectionChange: me,
1472
+ handlePageChange: we,
1473
+ handlePageSizeChange: Ee,
1474
+ exportAll: Pe,
1475
+ getAiSchema: Ue,
1476
+ getAiSnapshot: ve,
1477
+ applyCommand: Se,
1478
+ setFormValidator: he,
1479
+ setColumns: (i) => {
1480
+ B.value = i;
1481
+ },
1482
+ setSearchFields: (i) => {
1483
+ J.value = i;
1484
+ }
1485
+ });
1486
+ }
1487
+ const Dt = ["data-ai-target"], Nt = /* @__PURE__ */ pe({
1488
+ name: "GiCrud",
1489
+ __name: "crud",
1490
+ props: pt,
1491
+ emits: ["row-click", "sort-change"],
1492
+ setup(e, { expose: F, emit: m }) {
1493
+ const l = e, v = m, u = Be("crud"), f = z(() => l.fill), $ = De(), T = H(), G = H(), n = Ot({
1494
+ api: l.api,
1495
+ title: l.title,
1496
+ entity: l.entity,
1497
+ columns: l.columns,
1498
+ searchFields: l.searchFields,
1499
+ formFields: l.formFields,
1500
+ rules: l.rules,
1501
+ labels: l.labels,
1502
+ idKey: l.idKey,
1503
+ pageSize: l.pageSize,
1504
+ pageSizes: l.pageSizes,
1505
+ defaultQuery: l.defaultQuery,
1506
+ defaultForm: l.defaultForm,
1507
+ immediate: l.immediate,
1508
+ hiddenColumns: l.hiddenColumns,
1509
+ exporter: l.exporter,
1510
+ permissions: l.permissions,
1511
+ aiPolicy: l.aiPolicy
1512
+ }), h = z(() => n.searchFields.filter((o) => !!$[`field-${o.prop}`])), b = z(() => n.columns.filter((o) => !!$[`cell-${o.prop}`])), g = z(() => n.columns.filter((o) => !!$[`header-${o.prop}`])), c = z(() => n.formFields.filter((o) => !!$[`dialog-field-${o.prop}`])), R = z(() => l.permissions.create !== !1), B = z(() => l.permissions.batchDelete !== !1), J = async () => G.value ? G.value.validate() : !0;
1513
+ Ye(() => {
1514
+ n.setFormValidator(J);
1515
+ });
1516
+ const ce = (o, I, w) => {
1517
+ v("row-click", o, I, w);
1518
+ }, ue = (o) => {
1519
+ v("sort-change", o);
1520
+ }, X = () => {
1521
+ const o = n.getAiSchema();
1522
+ return l.entity && (o.entity = l.entity), o;
1523
+ }, _ = () => n.getAiSnapshot(), fe = async () => {
1524
+ var o;
1525
+ await n.reset(), (o = T.value) == null || o.clearSelection();
1526
+ }, U = async (o) => {
1527
+ var w, q;
1528
+ const I = await n.applyCommand(o);
1529
+ return o.op === "select" && I.ok && ((w = T.value) == null || w.setSelection(n.selected)), (o.op === "reset" || o.op === "batchRemove") && ((q = T.value) == null || q.clearSelection()), I;
1530
+ };
1531
+ return Ve({
1532
+ code: l.aiTarget,
1533
+ field: l.aiTarget,
1534
+ getValue: _,
1535
+ getRecords: (o) => {
1536
+ const I = (o == null ? void 0 : o.payload) || {}, w = Array.isArray(I.ids) ? I.ids : I.id !== void 0 ? [I.id] : [];
1537
+ return w.length ? n.data.filter(
1538
+ (q) => w.some((ae) => String(ae) === String(q[l.idKey]))
1539
+ ) : (n.selected.length ? n.selected : n.data).slice();
1540
+ },
1541
+ getSchema: X,
1542
+ execute: (o, I) => {
1543
+ const q = { delete: "remove", batchDelete: "batchRemove" }[o] || o, ae = { ...I || {} };
1544
+ return q === "search" && !ae.query && (ae.query = { ...ae }), U({ ...ae, op: q });
1545
+ },
1546
+ isEnabled: () => !n.loading,
1547
+ isVisible: () => !0
1548
+ }), F({
1549
+ search: n.search,
1550
+ reset: fe,
1551
+ refresh: n.refresh,
1552
+ load: n.load,
1553
+ getData: () => n.data,
1554
+ getSelection: () => n.selected,
1555
+ openCreate: n.openCreate,
1556
+ openEdit: n.openEdit,
1557
+ openView: n.openView,
1558
+ closeDialog: n.closeDialog,
1559
+ submit: n.submit,
1560
+ remove: n.remove,
1561
+ batchRemove: n.batchRemove,
1562
+ exportAll: n.exportAll,
1563
+ getAiSchema: X,
1564
+ getAiSnapshot: _,
1565
+ applyCommand: U
1566
+ }), (o, I) => (d(), A("section", {
1567
+ class: x([a(u).b(), f.value ? a(u).is("fill") : ""]),
1568
+ style: te(f.value ? { height: "100%" } : void 0),
1569
+ "data-ai-target": o.aiTarget || void 0
1570
+ }, [
1571
+ o.showSearch && a(n).searchFields.length ? (d(), D(Ct, {
1572
+ key: 0,
1573
+ fields: a(n).searchFields,
1574
+ model: a(n).query,
1575
+ loading: a(n).loading,
1576
+ "label-width": o.searchLabelWidth,
1577
+ "visible-count": o.searchVisibleCount,
1578
+ labels: a(n).labels,
1579
+ "ai-target": o.aiTarget ? o.aiTarget + ".search" : "",
1580
+ onSearch: a(n).search,
1581
+ onReset: fe
1582
+ }, Te({ _: 2 }, [
1583
+ le(h.value, (w) => ({
1584
+ name: `field-${w.prop}`,
1585
+ fn: S((q) => [
1586
+ L(o.$slots, "field-" + w.prop, Re(Oe(q)))
1587
+ ])
1588
+ }))
1589
+ ]), 1032, ["fields", "model", "loading", "label-width", "visible-count", "labels", "ai-target", "onSearch"])) : P("", !0),
1590
+ o.showToolbar ? (d(), D(Rt, {
1591
+ key: 1,
1592
+ columns: a(n).columns,
1593
+ "hidden-columns": a(n).hiddenColumns,
1594
+ "selected-count": a(n).selected.length,
1595
+ loading: a(n).loading,
1596
+ "show-add": o.showAdd && R.value,
1597
+ "show-batch-delete": o.showBatchDelete && B.value,
1598
+ "show-refresh": o.showRefresh,
1599
+ "show-column-settings": o.showColumnSettings,
1600
+ "show-export": o.showExport,
1601
+ labels: a(n).labels,
1602
+ "ai-target": o.aiTarget ? o.aiTarget + ".toolbar" : "",
1603
+ onAdd: a(n).openCreate,
1604
+ onBatchDelete: a(n).batchRemove,
1605
+ onRefresh: a(n).refresh,
1606
+ onExport: a(n).exportAll,
1607
+ "onUpdate:hiddenColumns": I[0] || (I[0] = (w) => a(n).hiddenColumns = w)
1608
+ }, Te({ _: 2 }, [
1609
+ o.$slots["toolbar-left"] ? {
1610
+ name: "info",
1611
+ fn: S(() => [
1612
+ L(o.$slots, "toolbar-left")
1613
+ ]),
1614
+ key: "0"
1615
+ } : void 0,
1616
+ o.$slots["toolbar-right"] ? {
1617
+ name: "actions",
1618
+ fn: S(() => [
1619
+ L(o.$slots, "toolbar-right")
1620
+ ]),
1621
+ key: "1"
1622
+ } : void 0
1623
+ ]), 1032, ["columns", "hidden-columns", "selected-count", "loading", "show-add", "show-batch-delete", "show-refresh", "show-column-settings", "show-export", "labels", "ai-target", "onAdd", "onBatchDelete", "onRefresh", "onExport"])) : P("", !0),
1624
+ W(At, {
1625
+ ref_key: "tableRef",
1626
+ ref: T,
1627
+ columns: a(n).columns,
1628
+ data: a(n).data,
1629
+ loading: a(n).loading,
1630
+ "row-key": o.rowKey || o.idKey,
1631
+ selection: o.selection,
1632
+ "show-index": o.showIndex,
1633
+ "show-actions": o.showActions,
1634
+ "action-width": o.actionWidth,
1635
+ "action-fixed": o.actionFixed,
1636
+ "can-view": o.canView,
1637
+ "can-edit": o.canEdit,
1638
+ "can-delete": o.canDelete,
1639
+ "max-height": o.maxHeight,
1640
+ fill: f.value,
1641
+ "hidden-columns": a(n).hiddenColumns,
1642
+ "empty-text": o.emptyText || a(n).labels.empty,
1643
+ "index-offset": (a(n).pageNum - 1) * a(n).pageSize,
1644
+ entity: o.entity,
1645
+ "ai-target": o.aiTarget ? o.aiTarget + ".table" : "",
1646
+ "reserve-selection": "",
1647
+ onSelectionChange: a(n).selectionChange,
1648
+ onView: a(n).openView,
1649
+ onEdit: a(n).openEdit,
1650
+ onRemove: a(n).remove,
1651
+ onRowClick: ce,
1652
+ onSortChange: ue
1653
+ }, Te({ _: 2 }, [
1654
+ le(b.value, (w) => ({
1655
+ name: `cell-${w.prop}`,
1656
+ fn: S((q) => [
1657
+ L(o.$slots, "cell-" + w.prop, Re(Oe(q)))
1658
+ ])
1659
+ })),
1660
+ le(g.value, (w) => ({
1661
+ name: `header-${w.prop}`,
1662
+ fn: S((q) => [
1663
+ L(o.$slots, "header-" + w.prop, Re(Oe(q)))
1664
+ ])
1665
+ })),
1666
+ o.$slots.actions ? {
1667
+ name: "actions",
1668
+ fn: S(({ row: w, index: q }) => [
1669
+ L(o.$slots, "actions", {
1670
+ row: w,
1671
+ index: q
1672
+ })
1673
+ ]),
1674
+ key: "0"
1675
+ } : void 0,
1676
+ o.$slots.empty ? {
1677
+ name: "empty",
1678
+ fn: S(() => [
1679
+ L(o.$slots, "empty")
1680
+ ]),
1681
+ key: "1"
1682
+ } : void 0
1683
+ ]), 1032, ["columns", "data", "loading", "row-key", "selection", "show-index", "show-actions", "action-width", "action-fixed", "can-view", "can-edit", "can-delete", "max-height", "fill", "hidden-columns", "empty-text", "index-offset", "entity", "ai-target", "onSelectionChange", "onView", "onEdit", "onRemove"]),
1684
+ W(wt, {
1685
+ "page-num": a(n).pageNum,
1686
+ "page-size": a(n).pageSize,
1687
+ total: a(n).total,
1688
+ "page-sizes": o.pageSizes,
1689
+ layout: o.paginationLayout,
1690
+ onPageChange: a(n).handlePageChange,
1691
+ onSizeChange: a(n).handlePageSizeChange
1692
+ }, null, 8, ["page-num", "page-size", "total", "page-sizes", "layout", "onPageChange", "onSizeChange"]),
1693
+ W(yt, {
1694
+ ref_key: "dialogRef",
1695
+ ref: G,
1696
+ "model-value": a(n).dialogVisible,
1697
+ title: a(n).dialogTitle,
1698
+ mode: a(n).mode,
1699
+ fields: a(n).formFields,
1700
+ form: a(n).form,
1701
+ rules: o.rules,
1702
+ submitting: a(n).submitting,
1703
+ width: o.dialogWidth,
1704
+ labels: a(n).labels,
1705
+ "ai-target": o.aiTarget ? o.aiTarget + ".dialog" : "",
1706
+ "onUpdate:modelValue": I[1] || (I[1] = (w) => a(n).dialogVisible = w),
1707
+ onSubmit: a(n).submit,
1708
+ onCancel: a(n).closeDialog
1709
+ }, Te({ _: 2 }, [
1710
+ le(c.value, (w) => ({
1711
+ name: `field-${w.prop}`,
1712
+ fn: S((q) => [
1713
+ L(o.$slots, "dialog-field-" + w.prop, Re(Oe(q)))
1714
+ ])
1715
+ }))
1716
+ ]), 1032, ["model-value", "title", "mode", "fields", "form", "rules", "submitting", "width", "labels", "ai-target", "onSubmit", "onCancel"]),
1717
+ L(o.$slots, "ai", { crud: a(n) })
1718
+ ], 14, Dt));
1719
+ }
1720
+ }), la = at(Nt, "GiCrud");
1721
+ export {
1722
+ la as GiCrud,
1723
+ pt as crudProps,
1724
+ la as default,
1725
+ Ne as defaultCrudLabels,
1726
+ Je as normalizePage,
1727
+ Ot as useCrud
1728
+ };