@asam-ui/pro 0.0.0-stage → 2.0.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 (344) hide show
  1. package/EDITOR_THIRD_PARTY_NOTICES.md +225 -0
  2. package/LICENSE +68 -0
  3. package/README.md +250 -2
  4. package/THIRD_PARTY_NOTICES.md +9 -0
  5. package/dist/AsamAdminLayout-DMsByuNN.js +205 -0
  6. package/dist/Controller-DF6lMt-H.js +3817 -0
  7. package/dist/Index-DpcRToBH.js +1263 -0
  8. package/dist/Navigation-D9wz-rqJ.js +202 -0
  9. package/dist/Resolve-Cq2BDFwo.js +7 -0
  10. package/dist/_plugin-vue_export-helper-C05QHVBA.js +8 -0
  11. package/dist/application/composables/environment/index.d.ts +2 -0
  12. package/dist/application/composables/environment/index.js +2 -0
  13. package/dist/application/composables/index.d.ts +14 -0
  14. package/dist/application/composables/index.js +40 -0
  15. package/dist/application/composables/on-mounted-or-activated/index.d.ts +2 -0
  16. package/dist/application/composables/on-mounted-or-activated/index.js +2 -0
  17. package/dist/application/composables/raf/index.d.ts +2 -0
  18. package/dist/application/composables/raf/index.js +2 -0
  19. package/dist/application/composables/use-click-away/index.d.ts +3 -0
  20. package/dist/application/composables/use-click-away/index.js +2 -0
  21. package/dist/application/composables/use-count-down/index.d.ts +3 -0
  22. package/dist/application/composables/use-count-down/index.js +2 -0
  23. package/dist/application/composables/use-custom-field-value/AsamCustomField.vue.d.ts +118 -0
  24. package/dist/application/composables/use-custom-field-value/Types.d.ts +27 -0
  25. package/dist/application/composables/use-custom-field-value/index.d.ts +6 -0
  26. package/dist/application/composables/use-custom-field-value/index.js +2 -0
  27. package/dist/application/composables/use-event-listener/index.d.ts +5 -0
  28. package/dist/application/composables/use-event-listener/index.js +7 -0
  29. package/dist/application/composables/use-page-visibility/index.d.ts +2 -0
  30. package/dist/application/composables/use-page-visibility/index.js +2 -0
  31. package/dist/application/composables/use-raf/index.d.ts +2 -0
  32. package/dist/application/composables/use-raf/index.js +2 -0
  33. package/dist/application/composables/use-rect/index.d.ts +2 -0
  34. package/dist/application/composables/use-rect/index.js +2 -0
  35. package/dist/application/composables/use-relation/index.d.ts +10 -0
  36. package/dist/application/composables/use-relation/index.js +17 -0
  37. package/dist/application/composables/use-scroll-parent/index.d.ts +2 -0
  38. package/dist/application/composables/use-scroll-parent/index.js +2 -0
  39. package/dist/application/composables/use-toggle/index.d.ts +2 -0
  40. package/dist/application/composables/use-toggle/index.js +2 -0
  41. package/dist/application/composables/use-window-size/index.d.ts +2 -0
  42. package/dist/application/composables/use-window-size/index.js +2 -0
  43. package/dist/application/index.d.ts +5 -0
  44. package/dist/application/index.js +16 -0
  45. package/dist/application/navigation/EmbedPage.vue.d.ts +18 -0
  46. package/dist/application/navigation/Navigation.d.ts +48 -0
  47. package/dist/application/navigation/NavigationMenuItems.vue.d.ts +8 -0
  48. package/dist/application/navigation/NavigationPage.vue.d.ts +10 -0
  49. package/dist/application/navigation/NavigationShell.vue.d.ts +22 -0
  50. package/dist/application/navigation/NavigationToolbar.vue.d.ts +11 -0
  51. package/dist/application/navigation/NavigationView.vue.d.ts +8 -0
  52. package/dist/application/navigation/Types.d.ts +53 -0
  53. package/dist/application/navigation/index.d.ts +6 -0
  54. package/dist/application/navigation/index.js +3 -0
  55. package/dist/application/preferences/Cache.d.ts +25 -0
  56. package/dist/application/preferences/I18n.d.ts +25 -0
  57. package/dist/application/preferences/LocaleLoader.d.ts +22 -0
  58. package/dist/application/preferences/Preferences.d.ts +16 -0
  59. package/dist/application/preferences/Storage.d.ts +9 -0
  60. package/dist/application/preferences/Types.d.ts +38 -0
  61. package/dist/application/preferences/index.d.ts +9 -0
  62. package/dist/application/preferences/index.js +2 -0
  63. package/dist/application/security/Navigation.d.ts +107 -0
  64. package/dist/application/security/Security.d.ts +74 -0
  65. package/dist/application/security/Types.d.ts +49 -0
  66. package/dist/application/security/index.d.ts +4 -0
  67. package/dist/application/security/index.js +2 -0
  68. package/dist/application/transport/Client.d.ts +17 -0
  69. package/dist/application/transport/Latest.d.ts +7 -0
  70. package/dist/application/transport/Provider.d.ts +4 -0
  71. package/dist/application/transport/Types.d.ts +60 -0
  72. package/dist/application/transport/index.d.ts +4 -0
  73. package/dist/application/transport/index.js +2 -0
  74. package/dist/chunk-DmhlhrBa.js +11 -0
  75. package/dist/components/index.d.ts +50 -0
  76. package/dist/components/index.js +4 -0
  77. package/dist/components-ST0i0Wqf.js +17084 -0
  78. package/dist/configuration/AsamApplicationProvider.vue.d.ts +13 -0
  79. package/dist/configuration/AsamPermission.vue.d.ts +13 -0
  80. package/dist/configuration/Context.d.ts +7 -0
  81. package/dist/configuration/Index.d.ts +5 -0
  82. package/dist/configuration/Permission.d.ts +5 -0
  83. package/dist/configuration/Types.d.ts +65 -0
  84. package/dist/detail/AsamDetailDialog.vue.d.ts +26 -0
  85. package/dist/detail/AsamDetailDrawer.vue.d.ts +26 -0
  86. package/dist/detail/AsamDetailPanel.vue.d.ts +36 -0
  87. package/dist/detail/Controller.d.ts +2 -0
  88. package/dist/detail/OverlayTypes.d.ts +61 -0
  89. package/dist/detail/Types.d.ts +50 -0
  90. package/dist/display/cards/Animation.d.ts +6 -0
  91. package/dist/display/cards/AsamCardGroup.vue.d.ts +14 -0
  92. package/dist/display/cards/AsamCountTo.vue.d.ts +13 -0
  93. package/dist/display/cards/AsamDisplayCard.vue.d.ts +15 -0
  94. package/dist/display/cards/AsamNumberDisplay.vue.d.ts +6 -0
  95. package/dist/display/cards/AsamProAvatarGroup.vue.d.ts +15 -0
  96. package/dist/display/cards/AsamStatisticCard.vue.d.ts +13 -0
  97. package/dist/display/cards/AsamTrend.vue.d.ts +6 -0
  98. package/dist/display/cards/Format.d.ts +5 -0
  99. package/dist/display/cards/Index.d.ts +9 -0
  100. package/dist/display/cards/Types.d.ts +106 -0
  101. package/dist/display/guidance/AsamGuidedTour.vue.d.ts +29 -0
  102. package/dist/display/guidance/AsamHelpPanel.vue.d.ts +27 -0
  103. package/dist/display/guidance/AsamNotificationMenu.vue.d.ts +19 -0
  104. package/dist/display/guidance/AsamNotificationPanel.vue.d.ts +34 -0
  105. package/dist/display/guidance/Async.d.ts +9 -0
  106. package/dist/display/guidance/Focus.d.ts +2 -0
  107. package/dist/display/guidance/Index.d.ts +5 -0
  108. package/dist/display/guidance/Model.d.ts +7 -0
  109. package/dist/display/guidance/Types.d.ts +107 -0
  110. package/dist/display/shared/OverlayStyle.d.ts +6 -0
  111. package/dist/display/states/AsamErrorBoundary.vue.d.ts +22 -0
  112. package/dist/display/states/AsamException.vue.d.ts +21 -0
  113. package/dist/display/states/AsamFieldAnnotation.vue.d.ts +19 -0
  114. package/dist/display/states/AsamPageSkeleton.vue.d.ts +20 -0
  115. package/dist/display/states/AsamPageWatermark.vue.d.ts +16 -0
  116. package/dist/display/states/AsamStatePanel.vue.d.ts +25 -0
  117. package/dist/display/states/Index.d.ts +8 -0
  118. package/dist/display/states/Tools.d.ts +29 -0
  119. package/dist/display/states/Types.d.ts +114 -0
  120. package/dist/display/text-time/AsamProCalendar.vue.d.ts +17 -0
  121. package/dist/display/text-time/AsamProCountdown.vue.d.ts +17 -0
  122. package/dist/display/text-time/AsamRelativeTime.vue.d.ts +11 -0
  123. package/dist/display/text-time/AsamTextEllipsis.vue.d.ts +10 -0
  124. package/dist/display/text-time/AsamWordCount.vue.d.ts +11 -0
  125. package/dist/display/text-time/Clock.d.ts +6 -0
  126. package/dist/display/text-time/Core.d.ts +10 -0
  127. package/dist/display/text-time/Index.d.ts +7 -0
  128. package/dist/display/text-time/Types.d.ts +99 -0
  129. package/dist/editor/AsamEditorActions.vue.d.ts +17 -0
  130. package/dist/editor/AsamEditorFields.vue.d.ts +38 -0
  131. package/dist/editor/AsamEditorForm.vue.d.ts +32 -0
  132. package/dist/editor/AsamFormDialog.vue.d.ts +28 -0
  133. package/dist/editor/Controller.d.ts +2 -0
  134. package/dist/editor/Coordinator.d.ts +3 -0
  135. package/dist/editor/EditorFormTypes.d.ts +65 -0
  136. package/dist/editor/Layout.d.ts +10 -0
  137. package/dist/editor/Snapshot.d.ts +4 -0
  138. package/dist/editor/Types.d.ts +92 -0
  139. package/dist/en-CcfyIwWv.js +1023 -0
  140. package/dist/fields/AsamField.d.ts +36 -0
  141. package/dist/fields/I18n.d.ts +70 -0
  142. package/dist/fields/Model.d.ts +13 -0
  143. package/dist/fields/Options.d.ts +37 -0
  144. package/dist/fields/Schema.d.ts +8 -0
  145. package/dist/fields/Types.d.ts +106 -0
  146. package/dist/fields/choice/AsamChoiceCard.vue.d.ts +74 -0
  147. package/dist/fields/choice/AsamChoiceGroup.vue.d.ts +25 -0
  148. package/dist/fields/choice/Color.d.ts +2 -0
  149. package/dist/fields/choice/Fields.d.ts +8 -0
  150. package/dist/fields/choice/Index.d.ts +6 -0
  151. package/dist/fields/choice/Selection.d.ts +5 -0
  152. package/dist/fields/choice/Types.d.ts +97 -0
  153. package/dist/fields/editors/AsamContentEditor.vue.d.ts +25 -0
  154. package/dist/fields/editors/AsamEditorResourceStatus.vue.d.ts +19 -0
  155. package/dist/fields/editors/Fields.d.ts +13 -0
  156. package/dist/fields/editors/Index.d.ts +5 -0
  157. package/dist/fields/editors/Markdown.d.ts +3 -0
  158. package/dist/fields/editors/Model.d.ts +5 -0
  159. package/dist/fields/editors/Types.d.ts +52 -0
  160. package/dist/fields/modes/AsamFieldView.d.ts +37 -0
  161. package/dist/fields/modes/Binding.d.ts +2 -0
  162. package/dist/fields/modes/Index.d.ts +5 -0
  163. package/dist/fields/modes/Read.d.ts +3 -0
  164. package/dist/fields/modes/Resource.d.ts +4 -0
  165. package/dist/fields/modes/Transform.d.ts +21 -0
  166. package/dist/fields/modes/Types.d.ts +72 -0
  167. package/dist/fields/numeric/Fields.d.ts +6 -0
  168. package/dist/fields/numeric/Index.d.ts +3 -0
  169. package/dist/fields/numeric/MoneyInput.d.ts +3 -0
  170. package/dist/fields/numeric/Types.d.ts +61 -0
  171. package/dist/fields/numeric/Validation.d.ts +12 -0
  172. package/dist/fields/options/Fields.d.ts +15 -0
  173. package/dist/fields/options/Hierarchy.d.ts +13 -0
  174. package/dist/fields/options/Index.d.ts +5 -0
  175. package/dist/fields/options/Paged.d.ts +23 -0
  176. package/dist/fields/options/Region.d.ts +9 -0
  177. package/dist/fields/options/Types.d.ts +48 -0
  178. package/dist/fields/resources/AsamResourceField.vue.d.ts +32 -0
  179. package/dist/fields/resources/Controller.d.ts +46 -0
  180. package/dist/fields/resources/Fields.d.ts +5 -0
  181. package/dist/fields/resources/Index.d.ts +5 -0
  182. package/dist/fields/resources/Model.d.ts +8 -0
  183. package/dist/fields/resources/Types.d.ts +86 -0
  184. package/dist/fields/temporal/Core.d.ts +10 -0
  185. package/dist/fields/temporal/Fields.d.ts +4 -0
  186. package/dist/fields/temporal/Index.d.ts +3 -0
  187. package/dist/fields/temporal/Types.d.ts +48 -0
  188. package/dist/fields/text/Captcha.d.ts +3 -0
  189. package/dist/fields/text/Fields.d.ts +6 -0
  190. package/dist/fields/text/Index.d.ts +3 -0
  191. package/dist/fields/text/Types.d.ts +80 -0
  192. package/dist/form/flows/AsamFilterPopover.vue.d.ts +51 -0
  193. package/dist/form/flows/AsamFormDrawer.vue.d.ts +34 -0
  194. package/dist/form/flows/AsamLoginForm.vue.d.ts +42 -0
  195. package/dist/form/flows/AsamLoginPage.vue.d.ts +51 -0
  196. package/dist/form/flows/AsamStepsForm.vue.d.ts +52 -0
  197. package/dist/form/flows/FlowFields.vue.d.ts +33 -0
  198. package/dist/form/flows/Focus.d.ts +2 -0
  199. package/dist/form/flows/Index.d.ts +6 -0
  200. package/dist/form/flows/LoginTemplateMessages.d.ts +45 -0
  201. package/dist/form/flows/OverlayStyle.d.ts +1 -0
  202. package/dist/form/flows/Session.d.ts +33 -0
  203. package/dist/form/flows/Types.d.ts +63 -0
  204. package/dist/form/schema/AsamSchemaForm.vue.d.ts +42 -0
  205. package/dist/form/schema/Controller.d.ts +47 -0
  206. package/dist/form/schema/Index.d.ts +6 -0
  207. package/dist/form/schema/Path.d.ts +10 -0
  208. package/dist/form/schema/Schema.d.ts +31 -0
  209. package/dist/form/schema/SchemaNodes.d.ts +34 -0
  210. package/dist/form/schema/Types.d.ts +114 -0
  211. package/dist/form/shared/ValidationSummary.vue.d.ts +17 -0
  212. package/dist/i18n/Parameters.d.ts +78 -0
  213. package/dist/i18n/Types.d.ts +10 -0
  214. package/dist/i18n/application/Parameters.d.ts +55 -0
  215. package/dist/i18n/application/Resolve.d.ts +7 -0
  216. package/dist/i18n/application/en.d.ts +53 -0
  217. package/dist/i18n/application/zh-CN.d.ts +53 -0
  218. package/dist/i18n/en.d.ts +1014 -0
  219. package/dist/i18n/en.js +2 -0
  220. package/dist/i18n/fields/Parameters.d.ts +467 -0
  221. package/dist/i18n/fields/en.d.ts +349 -0
  222. package/dist/i18n/fields/zh-CN.d.ts +349 -0
  223. package/dist/i18n/index.d.ts +11 -0
  224. package/dist/i18n/index.js +4 -0
  225. package/dist/i18n/tables/Parameters.d.ts +687 -0
  226. package/dist/i18n/tables/en.d.ts +542 -0
  227. package/dist/i18n/tables/zh-CN.d.ts +542 -0
  228. package/dist/i18n/zh-CN.d.ts +1008 -0
  229. package/dist/i18n/zh-CN.js +2 -0
  230. package/dist/i18n-CJTJI6vg.js +172 -0
  231. package/dist/index.d.ts +62 -0
  232. package/dist/index.js +13 -0
  233. package/dist/layout/AsamActionBar.vue.d.ts +16 -0
  234. package/dist/layout/AsamAdminLayout.vue.d.ts +25 -0
  235. package/dist/layout/AsamContentGrid.vue.d.ts +14 -0
  236. package/dist/layout/AsamFooter.vue.d.ts +11 -0
  237. package/dist/layout/AsamLayoutSettings.vue.d.ts +31 -0
  238. package/dist/layout/AsamPageContainer.vue.d.ts +20 -0
  239. package/dist/layout/Context.d.ts +2 -0
  240. package/dist/layout/Index.d.ts +8 -0
  241. package/dist/layout/Settings.d.ts +4 -0
  242. package/dist/layout/Types.d.ts +118 -0
  243. package/dist/list/AsamListRowActions.d.ts +23 -0
  244. package/dist/list/AsamProTable.d.ts +29 -0
  245. package/dist/list/AsamSearchForm.d.ts +67 -0
  246. package/dist/list/Controller.d.ts +3 -0
  247. package/dist/list/QueryBoundary.d.ts +8 -0
  248. package/dist/list/RowActionAdapter.d.ts +9 -0
  249. package/dist/list/Types.d.ts +134 -0
  250. package/dist/lists/AsamCardList.d.ts +15 -0
  251. package/dist/lists/AsamListCover.vue.d.ts +7 -0
  252. package/dist/lists/AsamProList.d.ts +9 -0
  253. package/dist/lists/AsamProTaskCard.vue.d.ts +21 -0
  254. package/dist/lists/Index.d.ts +4 -0
  255. package/dist/lists/Types.d.ts +135 -0
  256. package/dist/navigation-BVLFymx7.js +395 -0
  257. package/dist/preferences-DgHizA2w.js +335 -0
  258. package/dist/public-api.d.ts +3662 -0
  259. package/dist/resolver/index.d.ts +33 -0
  260. package/dist/resolver/index.js +4447 -0
  261. package/dist/security-B_pdVCWk.js +299 -0
  262. package/dist/style.css +2 -0
  263. package/dist/table/ActionIcon.d.ts +5 -0
  264. package/dist/table/Appearance.d.ts +37 -0
  265. package/dist/table/ColumnVisibility.d.ts +71 -0
  266. package/dist/table/Density.d.ts +3 -0
  267. package/dist/table/Empty.d.ts +14 -0
  268. package/dist/table/I18n.d.ts +73 -0
  269. package/dist/table/RowActionPresentation.d.ts +5 -0
  270. package/dist/table/RowActions.d.ts +80 -0
  271. package/dist/table/TableDensity.vue.d.ts +19 -0
  272. package/dist/table/TablePagination.vue.d.ts +24 -0
  273. package/dist/table/TableToolbar.vue.d.ts +18 -0
  274. package/dist/table/TableViewport.vue.d.ts +13 -0
  275. package/dist/table/editing/AsamEditableTable.d.ts +69 -0
  276. package/dist/table/editing/AsamEditableTable.vue.d.ts +61 -0
  277. package/dist/table/editing/AsamSortableTable.vue.d.ts +61 -0
  278. package/dist/table/editing/AsamTableEditingHost.vue.d.ts +52 -0
  279. package/dist/table/editing/CellEditor.vue.d.ts +20 -0
  280. package/dist/table/editing/Controller.d.ts +2 -0
  281. package/dist/table/editing/ControllerCell.vue.d.ts +18 -0
  282. package/dist/table/editing/Drag.d.ts +29 -0
  283. package/dist/table/editing/EntryForm.vue.d.ts +20 -0
  284. package/dist/table/editing/Host.d.ts +11 -0
  285. package/dist/table/editing/HostTypes.d.ts +53 -0
  286. package/dist/table/editing/Index.d.ts +9 -0
  287. package/dist/table/editing/InlineModel.d.ts +24 -0
  288. package/dist/table/editing/InlineTypes.d.ts +135 -0
  289. package/dist/table/editing/LegacyEditableTable.d.ts +66 -0
  290. package/dist/table/editing/LegacyMotion.d.ts +10 -0
  291. package/dist/table/editing/Motion.d.ts +19 -0
  292. package/dist/table/editing/Order.d.ts +7 -0
  293. package/dist/table/editing/SaveFeedback.d.ts +4 -0
  294. package/dist/table/editing/Types.d.ts +71 -0
  295. package/dist/table/operations/Coordinator.d.ts +3 -0
  296. package/dist/table/operations/Index.d.ts +6 -0
  297. package/dist/table/operations/Preferences.d.ts +7 -0
  298. package/dist/table/operations/Selection.d.ts +2 -0
  299. package/dist/table/operations/Snapshot.d.ts +5 -0
  300. package/dist/table/operations/Types.d.ts +157 -0
  301. package/dist/table/operations/View.d.ts +108 -0
  302. package/dist/table/range/AsamTableRange.vue.d.ts +19 -0
  303. package/dist/table/range/Controller.d.ts +3 -0
  304. package/dist/table/range/Index.d.ts +3 -0
  305. package/dist/table/range/Types.d.ts +127 -0
  306. package/dist/table/renderTableInViewport.d.ts +6 -0
  307. package/dist/table/structured/AsamStructuredTable.d.ts +2 -0
  308. package/dist/table/structured/Controller.d.ts +7 -0
  309. package/dist/table/structured/Forest.d.ts +4 -0
  310. package/dist/table/structured/Index.d.ts +6 -0
  311. package/dist/table/structured/Span.d.ts +5 -0
  312. package/dist/table/structured/Summary.d.ts +8 -0
  313. package/dist/table/structured/Types.d.ts +137 -0
  314. package/dist/table/transfer/AsamTableTransfer.vue.d.ts +11 -0
  315. package/dist/table/transfer/Controller.d.ts +3 -0
  316. package/dist/table/transfer/Gate.d.ts +3 -0
  317. package/dist/table/transfer/Index.d.ts +6 -0
  318. package/dist/table/transfer/Text.d.ts +25 -0
  319. package/dist/table/transfer/Types.d.ts +170 -0
  320. package/dist/table/virtual/AsamProVirtualTable.d.ts +22 -0
  321. package/dist/table/virtual/Index.d.ts +4 -0
  322. package/dist/table/virtual/Model.d.ts +16 -0
  323. package/dist/table/virtual/Styles.d.ts +2 -0
  324. package/dist/table/virtual/Types.d.ts +68 -0
  325. package/dist/templates/crud/AsamCrudPage.vue.d.ts +52 -0
  326. package/dist/templates/crud/Controller.d.ts +3 -0
  327. package/dist/templates/crud/DetailEntry.d.ts +46 -0
  328. package/dist/templates/crud/Index.d.ts +4 -0
  329. package/dist/templates/crud/Index.js +2 -0
  330. package/dist/templates/crud/Readonly.d.ts +3 -0
  331. package/dist/templates/crud/Structure.d.ts +8 -0
  332. package/dist/templates/crud/Types.d.ts +272 -0
  333. package/dist/templates/index.d.ts +1 -0
  334. package/dist/templates/index.js +10 -0
  335. package/dist/transport-Cky1a5c-.js +161 -0
  336. package/dist/types/application.d.ts +5 -0
  337. package/dist/types/components.d.ts +1 -0
  338. package/dist/types/index.d.ts +6 -0
  339. package/dist/types/index.js +0 -0
  340. package/dist/types/templates.d.ts +1 -0
  341. package/dist/use-custom-field-value-DgA3wo05.js +108 -0
  342. package/dist/zh-CN-B5pAhh4V.js +56 -0
  343. package/dist/zh-CN-BBWziFEy.js +966 -0
  344. package/package.json +177 -3
@@ -0,0 +1,3817 @@
1
+ import { c as e, d as t, f as n, g as r, h as i, l as a, n as o, p as s, r as c, s as l, u } from "./i18n-CJTJI6vg.js";
2
+ import { t as d } from "./_plugin-vue_export-helper-C05QHVBA.js";
3
+ import { Comment as f, Fragment as p, computed as m, createBlock as h, createCommentVNode as g, createElementBlock as _, createElementVNode as v, createSlots as y, createTextVNode as b, createVNode as x, defineComponent as S, effectScope as C, getCurrentInstance as w, getCurrentScope as T, guardReactiveProps as E, h as D, inject as O, isVNode as k, mergeProps as A, nextTick as j, normalizeClass as M, normalizeProps as N, normalizeStyle as P, onBeforeUnmount as F, onMounted as I, onScopeDispose as L, openBlock as R, readonly as z, ref as B, renderList as V, renderSlot as H, resolveDynamicComponent as ee, shallowRef as U, toDisplayString as W, toRaw as te, toValue as G, unref as K, useId as ne, watch as q, withCtx as J, withKeys as re, withModifiers as ie } from "vue";
4
+ import { formatAsamDataError as ae } from "@asam-ui/ui/i18n";
5
+ import { AsamButton as Y, AsamCard as oe, AsamCheckboxItem as se, AsamDialog as ce, AsamDrawer as le, AsamDropdown as ue, AsamDropdownItem as de, AsamDropdownMenu as fe, AsamEmpty as pe, AsamForm as me, AsamFormItem as he, AsamInputNumber as ge, AsamMessage as _e, AsamPagination as ve, AsamPopover as ye, AsamSelect as be, AsamTable as xe, AsamTableColumn as Se, AsamTooltip as Ce, asamFormControls as we, createAsamSchema as Te, defineAsamControl as Ee, defineAsamOptions as De, getAsamDataRuntime as Oe, resolveAsamOptions as ke, useAsamDictOptions as Ae, useAsamPagedData as je, useAsamRemoteOptions as Me } from "@asam-ui/ui";
6
+ //#region src/fields/Model.ts
7
+ function X(e) {
8
+ if (typeof e != "object" || !e) return e;
9
+ if (e instanceof Date) return new Date(e.getTime());
10
+ if (Array.isArray(e)) return e.map(X);
11
+ if (Object.getPrototypeOf(e) !== Object.prototype && Object.getPrototypeOf(e) !== null) throw s(/* @__PURE__ */ TypeError("自定义非普通模型需要显式 clone"), a("pro.fields.cloneRequired", "自定义非普通模型需要显式 clone", {}));
12
+ return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, X(t)]));
13
+ }
14
+ function Ne(e) {
15
+ return typeof e == "string" || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e);
16
+ }
17
+ function Pe(e, t) {
18
+ return t === void 0 ? !0 : e.kind === "custom" ? e.isValue(t) : e.kind === "text" || e.kind === "textarea" ? t === null || typeof t == "string" : e.kind === "single" ? t === null || Ne(t) : Array.isArray(t) && t.every(Ne);
19
+ }
20
+ function Fe(e) {
21
+ return e.kind === "custom" ? Ie(e, e.emptyValue()) : e.kind === "single" ? null : e.kind === "multiple" ? [] : "";
22
+ }
23
+ function Ie(e, t) {
24
+ return e.clone ? e.clone(t) : X(t);
25
+ }
26
+ function Le(e, t) {
27
+ return Object.fromEntries(Object.entries(t).map(([t, n]) => {
28
+ let r = e.find((e) => e.key === t);
29
+ return [t, r ? Ie(r, n) : X(n)];
30
+ }));
31
+ }
32
+ function Re(e) {
33
+ let t = /* @__PURE__ */ new Set();
34
+ for (let n of e) {
35
+ if (!/^[a-zA-Z_$][\w$]*$/.test(n.key) || [
36
+ "__proto__",
37
+ "constructor",
38
+ "prototype"
39
+ ].includes(n.key) || t.has(n.key)) throw s(/* @__PURE__ */ TypeError(`无效或重复字段:${n.key}`), a("pro.fields.fieldDuplicate", `无效或重复字段:${n.key}`, { key: String(n.key) }));
40
+ if (t.add(n.key), "source" in n && n.source && n.remote) throw s(/* @__PURE__ */ TypeError(`${n.key}: source 与 remote 互斥`), a("pro.fields.sourceConflict", `${n.key}: source 与 remote 互斥`, { key: String(n.key) }));
41
+ if (n.kind === "custom" && (!n.control?.component || !n.isValue || !n.emptyValue || !n.isEmpty || !n.format || !n.query || !n.submit)) throw s(/* @__PURE__ */ TypeError(`${n.key}: 自定义字段契约不完整`), a("pro.fields.contractIncomplete", `${n.key}: 自定义字段契约不完整`, { key: String(n.key) }));
42
+ }
43
+ return e;
44
+ }
45
+ function ze(e, t, n, r = {}) {
46
+ Re(e);
47
+ let i = {};
48
+ for (let [n, r] of Object.entries(t)) {
49
+ let t = e.find((e) => e.key === n);
50
+ Object.defineProperty(i, n, {
51
+ value: t ? Ie(t, r) : X(r),
52
+ enumerable: !0,
53
+ writable: !0,
54
+ configurable: !0
55
+ });
56
+ }
57
+ for (let t of e) {
58
+ let e = Object.hasOwn(i, t.key) ? i[t.key] : void 0;
59
+ if (e === void 0 && (n === "create" || r.defaultsOnEdit) && t.defaultValue && (e = t.defaultValue(), i[t.key] = Ie(t, e)), e !== void 0 && t.adaptInput && (i[t.key] = Ie(t, t.adaptInput(e))), !Pe(t, Object.hasOwn(i, t.key) ? i[t.key] : void 0)) throw s(/* @__PURE__ */ TypeError(`${t.key}: 模型类型不兼容`), a("pro.fields.modelKey", `${t.key}: 模型类型不兼容`, { key: String(t.key) }));
60
+ }
61
+ return i;
62
+ }
63
+ function Be(e, t, n, r) {
64
+ Re(e);
65
+ let o = {}, c = [];
66
+ for (let l of r) {
67
+ let r = e.find((e) => e.key === l);
68
+ if (!r) {
69
+ c.push(i(a("pro.fields.whitelistMissing", "白名单字段未注册", {}), {
70
+ key: l,
71
+ cause: void 0
72
+ }));
73
+ continue;
74
+ }
75
+ if (!(r.modes?.[n === "query" ? "query" : "edit"]?.hidden && !(n === "submit" && r.submitHidden && r.submit)) && !(!Object.hasOwn(t, l) || t[l] === void 0)) try {
76
+ let i = Ie(r, t[l]);
77
+ if (!Pe(r, i)) throw s(/* @__PURE__ */ TypeError("模型类型不兼容"), a("pro.fields.modelInvalid", "模型类型不兼容", {}));
78
+ let c = r.kind === "custom" ? r.isEmpty(i) : i === null || (r.kind === "text" || r.kind === "textarea") && i === "" || Array.isArray(i) && i.length === 0, u = r[n];
79
+ if (n === "query" && c && !u) continue;
80
+ let d = u ? u(i, {
81
+ mode: n === "query" ? "query" : "edit",
82
+ model: Le(e, t)
83
+ }) : i;
84
+ if (d && typeof d.then == "function") throw Promise.resolve(d).catch(() => {}), s(/* @__PURE__ */ TypeError("字段转换必须同步"), a("pro.fields.fieldSync", "字段转换必须同步", {}));
85
+ d !== void 0 && (o[l] = u ? X(d) : Ie(r, d));
86
+ } catch (e) {
87
+ c.push({
88
+ key: l,
89
+ message: e instanceof Error ? e.message : String(e),
90
+ cause: e
91
+ });
92
+ }
93
+ }
94
+ return c.length ? {
95
+ status: "error",
96
+ issues: c
97
+ } : {
98
+ status: "success",
99
+ data: o
100
+ };
101
+ }
102
+ //#endregion
103
+ //#region src/fields/Options.ts
104
+ function Ve(e) {
105
+ let t = m(() => G(e.field)), n = B(""), r = B(e.runtime.epoch), i = () => e.active === void 0 || G(e.active), o = m(() => {
106
+ if (t.value.kind !== "single" && t.value.kind !== "multiple") return [];
107
+ let n = G(e.value);
108
+ return Array.isArray(n) ? n.filter(Ne) : Ne(n) ? [n] : [];
109
+ }), s = U([]), c = m(() => t.value.kind === "single" || t.value.kind === "multiple" ? t.value : void 0), l = () => e.session === void 0 ? void 0 : G(e.session), d = e.runtime.onInvalidate(() => {
110
+ r.value = e.runtime.epoch;
111
+ });
112
+ function f(t, n) {
113
+ let r, a = U(), o = q(n, () => {
114
+ r?.stop(), a.value = void 0, i() && (r = C(), r.run(() => {
115
+ let n = U([]), r = B(!1), i = U(null), o = B(!1), s;
116
+ try {
117
+ let e = t();
118
+ s = e && te(e);
119
+ } catch (e) {
120
+ i.value = e;
121
+ }
122
+ if (s && s.kind !== "static" || i.value && c.value?.remote) {
123
+ let n = (s?.kind === "dict" ? Ae : Me)({
124
+ source: s ?? (() => {
125
+ let e = t();
126
+ return e && te(e);
127
+ }),
128
+ runtime: e.runtime
129
+ });
130
+ a.value = {
131
+ data: n.data,
132
+ loading: n.loading,
133
+ error: n.error,
134
+ succeeded: n.hasSucceeded,
135
+ retry: async () => {
136
+ await n.reload({ force: !0 });
137
+ }
138
+ };
139
+ } else {
140
+ let t = 0, c = async () => {
141
+ if (!s) return;
142
+ let a = ++t, c = e.runtime.createContext();
143
+ r.value = !0, i.value = null;
144
+ try {
145
+ let r = await ke(s, {
146
+ provider: e.runtime.provider,
147
+ context: c
148
+ });
149
+ a === t && e.runtime.isCurrent(c) && (n.value = r, o.value = !0);
150
+ } catch (n) {
151
+ a === t && e.runtime.isCurrent(c) && (i.value = n);
152
+ } finally {
153
+ e.runtime.release(c), a === t && (r.value = !1);
154
+ }
155
+ };
156
+ L(() => {
157
+ t++;
158
+ }), a.value = {
159
+ data: n,
160
+ loading: r,
161
+ error: i,
162
+ succeeded: o,
163
+ retry: c
164
+ }, c();
165
+ }
166
+ }));
167
+ }, {
168
+ immediate: !0,
169
+ flush: "sync"
170
+ });
171
+ T() && L(() => {
172
+ o(), r?.stop();
173
+ });
174
+ let s = m(() => a.value?.data.value ?? []), l = m(() => a.value?.loading.value ?? !1), u = m(() => a.value?.error.value ?? null);
175
+ return {
176
+ data: s,
177
+ loading: l,
178
+ error: u,
179
+ status: m(() => u.value ? "error" : l.value ? "loading" : a.value?.succeeded.value ? s.value.length ? "ready" : "empty" : "idle"),
180
+ retry: async () => {
181
+ await a.value?.retry();
182
+ }
183
+ };
184
+ }
185
+ let p = () => [
186
+ c.value?.source,
187
+ c.value?.remote,
188
+ l(),
189
+ r.value,
190
+ i()
191
+ ], h = f(() => c.value?.remote?.search(n.value) ?? c.value?.source, () => [...p(), n.value]), g = f(() => o.value.length ? c.value?.remote?.resolve([...o.value]) : void 0, () => [...p(), ...o.value.map((e) => `${typeof e}:${String(e)}`)]);
192
+ q(p, () => {
193
+ s.value = [], _();
194
+ }, { flush: "sync" });
195
+ function _() {
196
+ let e = [
197
+ ...g.data.value,
198
+ ...h.data.value,
199
+ ...s.value
200
+ ];
201
+ s.value = o.value.flatMap((t) => {
202
+ let n = e.find((e) => e.value === t), r = h.data.value.find((e) => e.value === t);
203
+ return n ? [{
204
+ ...n,
205
+ disabled: n.disabled === !0 || r?.disabled === !0
206
+ }] : [];
207
+ });
208
+ }
209
+ q([
210
+ o,
211
+ h.data,
212
+ g.data
213
+ ], _, {
214
+ immediate: !0,
215
+ flush: "sync"
216
+ });
217
+ let v = m(() => o.value.map((t) => {
218
+ let n = s.value.find((e) => e.value === t);
219
+ return {
220
+ value: t,
221
+ label: n?.label ?? u(a("pro.fields.optionTypedUnresolved", `${String(t)} (${typeof t},未解析)`, {
222
+ value: String(t),
223
+ type: typeof t
224
+ }), e.i18n),
225
+ resolved: !!n,
226
+ disabled: n?.disabled === !0
227
+ };
228
+ })), y = m(() => [...h.data.value.map((e) => s.value.find((t) => t.value === e.value) ?? e), ...s.value.filter((e) => !h.data.value.some((t) => t.value === e.value))]), b = m(() => o.value.length ? g.loading.value ? "loading" : g.error.value ? "error" : v.value.some((e) => !e.resolved) ? "unresolved" : "ready" : "idle");
229
+ async function x() {
230
+ await Promise.all([h.retry(), g.retry()]);
231
+ }
232
+ return T() && L(d), {
233
+ keyword: n,
234
+ search: h,
235
+ resolution: g,
236
+ labels: v,
237
+ labelStatus: b,
238
+ options: y,
239
+ refresh: x
240
+ };
241
+ }
242
+ //#endregion
243
+ //#region src/fields/AsamField.ts
244
+ var He = S({
245
+ name: "AsamField",
246
+ inheritAttrs: !1,
247
+ props: {
248
+ field: {
249
+ type: Object,
250
+ required: !0
251
+ },
252
+ displayLabel: {
253
+ type: String,
254
+ default: void 0
255
+ },
256
+ modelValue: { type: null },
257
+ mode: {
258
+ type: String,
259
+ default: "edit"
260
+ },
261
+ disabled: Boolean,
262
+ session: {
263
+ type: [String, Number],
264
+ default: void 0
265
+ },
266
+ active: {
267
+ type: Boolean,
268
+ default: !0
269
+ },
270
+ popupOwner: {
271
+ type: String,
272
+ default: void 0
273
+ }
274
+ },
275
+ emits: {
276
+ "popup-visible-change": (e) => typeof e == "boolean",
277
+ "update:modelValue": (e) => !0
278
+ },
279
+ setup(t, { attrs: n, emit: r, expose: i }) {
280
+ let s = o(), c = w(), l = U(), u = U(null), d = e(), f = d.value;
281
+ q(() => t.modelValue, () => {
282
+ f.value = "";
283
+ });
284
+ let p = m(() => t.field.modes?.[t.mode ?? "edit"]), h = m(() => t.mode === "detail" || p.value?.readonly === !0), g = m(() => t.disabled || p.value?.disabled === !0 || t.active === !1), _ = Ve({
285
+ i18n: s,
286
+ field: () => t.field,
287
+ value: () => t.modelValue,
288
+ session: () => t.session,
289
+ active: () => t.active !== !1 && !p.value?.hidden,
290
+ runtime: Oe(c.appContext.app)
291
+ }), v = m(() => De().static({
292
+ options: _.options.value,
293
+ fieldNames: {
294
+ label: "label",
295
+ value: "value",
296
+ disabled: "disabled"
297
+ }
298
+ }));
299
+ i({
300
+ closePopup: () => {
301
+ l.value?.handleClose?.(), l.value?.blur ? l.value.blur() : u.value?.querySelector("input,textarea")?.blur();
302
+ },
303
+ refresh: async () => {
304
+ if (t.field.kind === "custom") {
305
+ t.active !== !1 && !h.value && !p.value?.hidden && await l.value?.refresh?.();
306
+ return;
307
+ }
308
+ await _.refresh();
309
+ },
310
+ focus: () => {
311
+ !h.value && !g.value && !p.value?.hidden && (l.value?.focus ? l.value.focus() : u.value?.querySelector("input,textarea,button,[tabindex=\"0\"]")?.focus());
312
+ }
313
+ });
314
+ function y(e) {
315
+ if (!(g.value || h.value || p.value?.hidden || t.active === !1)) {
316
+ if (!Pe(t.field, e)) {
317
+ d.set(a("pro.fields.modelInput", "控件返回了不兼容的模型类型"));
318
+ return;
319
+ }
320
+ f.value = "", r("update:modelValue", t.field.clone ? t.field.clone(e) : X(e));
321
+ }
322
+ }
323
+ function b() {
324
+ let e = t.field, n = t.modelValue;
325
+ return e.kind === "custom" ? e.format(e.clone ? e.clone(n) : X(n), { i18n: s }) : n == null || (e.kind === "text" || e.kind === "textarea") && n === "" || Array.isArray(n) && !n.length ? "—" : e.format ? e.format(e.clone ? e.clone(n) : X(n), { i18n: s }) : e.kind === "single" || e.kind === "multiple" ? _.labels.value.map((e) => e.label).join(s.t("pro.fields.listSeparator")) : String(n);
326
+ }
327
+ return () => {
328
+ if (p.value?.hidden) return null;
329
+ let e = t.field;
330
+ if (!Pe(e, t.modelValue)) return D("p", {
331
+ role: "alert",
332
+ style: {
333
+ maxWidth: "100%",
334
+ overflowWrap: "anywhere"
335
+ }
336
+ }, s.t("pro.fields.modelLabel", { label: String(t.displayLabel ?? e.label) }));
337
+ let i = [];
338
+ f.value && i.push(D("span", { role: "alert" }, d.format(s))), _.search.loading.value && i.push(D("span", { role: "status" }, s.t("pro.fields.loadingOptions"))), _.search.status.value === "empty" && i.push(D("span", { role: "status" }, s.t("pro.fields.emptyOptions"))), _.search.error.value && i.push(D("span", { role: "alert" }, [s.t("pro.fields.failedOptions"), D(Y, {
339
+ class: "asam-pro-message-button",
340
+ nativeType: "button",
341
+ size: p.value?.componentProps?.size ?? n.size,
342
+ disabled: g.value,
343
+ type: "default",
344
+ plain: !0,
345
+ onClick: _.search.retry
346
+ }, { default: () => s.t("pro.fields.retryOptions") })])), _.labelStatus.value === "loading" && i.push(D("span", { role: "status" }, s.t("pro.fields.resolvingLabels"))), _.labelStatus.value === "unresolved" && i.push(D("span", { role: "status" }, s.t("pro.fields.unresolvedList", { value: String(_.labels.value.filter((e) => !e.resolved).map((e) => e.label).join(s.t("pro.fields.listSeparator"))) }))), _.resolution.error.value && i.push(D("span", { role: "alert" }, [s.t("pro.fields.failedLabels"), D(Y, {
347
+ class: "asam-pro-message-button",
348
+ nativeType: "button",
349
+ size: p.value?.componentProps?.size ?? n.size,
350
+ disabled: g.value,
351
+ type: "default",
352
+ plain: !0,
353
+ onClick: _.resolution.retry
354
+ }, { default: () => s.t("pro.fields.retryLabels") })]));
355
+ let a;
356
+ if (h.value) a = e.kind === "custom" && e.display ? D(e.display, { value: e.clone ? e.clone(t.modelValue) : X(t.modelValue) }) : D("span", {
357
+ class: "asam-field-display",
358
+ style: {
359
+ whiteSpace: "pre-wrap",
360
+ userSelect: "text"
361
+ }
362
+ }, b());
363
+ else {
364
+ let i = e.kind === "custom" ? e.control : e.kind === "text" ? we.Input : e.kind === "textarea" ? we.Textarea : "control" in e && (e.control === "radio" || e.control === "radio-button") ? we.Radio : "control" in e && (e.control === "checkbox" || e.control === "checkbox-button") ? we.Checkbox : e.kind === "multiple" ? we.SelectMultiple : we.Select, o = e.kind === "single" || e.kind === "multiple", s = t.popupOwner && (e.popup || o && (!e.control || e.control === "select")) ? {
365
+ teleported: !0,
366
+ ...o ? { appendTo: "body" } : {},
367
+ popperClass: M([
368
+ n.popperClass,
369
+ n["popper-class"],
370
+ p.value?.componentProps?.popperClass,
371
+ t.popupOwner
372
+ ]),
373
+ onVisibleChange: (e) => r("popup-visible-change", e)
374
+ } : {}, c = e.kind === "text" || e.kind === "textarea" ? t.modelValue ?? "" : e.kind === "multiple" ? t.modelValue ?? [] : t.modelValue;
375
+ a = D(i.component, {
376
+ ...t.popupOwner ? A(n, p.value?.componentProps ?? {}, s) : {
377
+ ...n,
378
+ ...p.value?.componentProps
379
+ },
380
+ ...e.kind === "custom" ? {
381
+ session: t.session,
382
+ active: t.active
383
+ } : {},
384
+ ref: l,
385
+ modelValue: e.clone ? e.clone(c) : X(c),
386
+ "aria-label": t.displayLabel ?? e.label,
387
+ disabled: g.value,
388
+ ...o ? {
389
+ ...e.control === "radio" || e.control === "radio-button" || e.control === "checkbox" || e.control === "checkbox-button" ? { style: {
390
+ display: "flex",
391
+ flexWrap: "wrap",
392
+ maxWidth: "100%"
393
+ } } : {},
394
+ dataSource: v.value,
395
+ type: e.control?.endsWith("button") ? "button" : void 0,
396
+ emptyValues: [void 0, null],
397
+ valueOnClear: null,
398
+ ...e.remote ? {
399
+ filterable: !0,
400
+ remote: !0,
401
+ remoteMethod: (e) => {
402
+ _.keyword.value = e;
403
+ },
404
+ loading: _.search.loading.value
405
+ } : {}
406
+ } : {},
407
+ "onUpdate:modelValue": y
408
+ });
409
+ }
410
+ return D("div", {
411
+ class: "asam-field",
412
+ style: {
413
+ width: "100%",
414
+ minWidth: 0,
415
+ maxWidth: "100%",
416
+ overflowWrap: "anywhere"
417
+ },
418
+ ref: u,
419
+ "data-field": e.key,
420
+ "data-mode": t.mode,
421
+ "aria-busy": _.search.loading.value || _.resolution.loading.value
422
+ }, [a, ...i]);
423
+ };
424
+ }
425
+ });
426
+ //#endregion
427
+ //#region src/fields/Schema.ts
428
+ function Ue(e, t) {
429
+ Re(e);
430
+ let n = { "custom:pro-field": Ee({
431
+ component: He,
432
+ emptyValue: () => void 0,
433
+ sourceKinds: []
434
+ }) }, i = Te()({
435
+ ...we,
436
+ ...n
437
+ });
438
+ return {
439
+ schema: e.map((e) => {
440
+ let n = e.modes?.[t];
441
+ return i.field({
442
+ field: e.key,
443
+ component: "custom:pro-field",
444
+ label: e.label,
445
+ hidden: n?.hidden,
446
+ disabled: n?.disabled,
447
+ componentProps: {
448
+ field: e,
449
+ mode: t
450
+ },
451
+ rules: n?.hidden ? [] : [{ validator: (t, n, i) => {
452
+ i(Pe(e, n) ? void 0 : s(/* @__PURE__ */ Error(`${e.label}:模型类型不兼容`), r(a("pro.fields.modelLabel", `${e.label}:模型类型不兼容`, { label: String(e.label) }))));
453
+ } }, ...n?.rules ?? []],
454
+ onHide: "retain"
455
+ });
456
+ }),
457
+ registry: n
458
+ };
459
+ }
460
+ //#endregion
461
+ //#region src/editor/Layout.ts
462
+ function We(e, t, n) {
463
+ let r = /* @__PURE__ */ new Map();
464
+ for (let n of e) {
465
+ if (n.modes?.[t]?.hidden) continue;
466
+ let e = n.modes?.[t]?.layout?.group, i = e === void 0 ? "default:" : `host:${e}`;
467
+ r.has(i) || r.set(i, []), r.get(i).push(n);
468
+ }
469
+ return Array.from(r, ([e, r]) => ({
470
+ id: e,
471
+ title: e === "default:" ? u(a("pro.editor.basicGroup", "基本资料"), n) : e.slice(5),
472
+ fields: r,
473
+ collapsible: r.some((e) => e.modes?.[t]?.layout?.collapsed !== void 0),
474
+ collapsed: r.some((e) => e.modes?.[t]?.layout?.collapsed)
475
+ }));
476
+ }
477
+ function Ge(e) {
478
+ let t = e.modes?.edit;
479
+ return !t?.hidden && !t?.disabled && !t?.readonly;
480
+ }
481
+ //#endregion
482
+ //#region src/editor/Snapshot.ts
483
+ function Ke(e, t) {
484
+ return Object.fromEntries(Object.entries(t).map(([t, n]) => {
485
+ let r = e.find((e) => e.key === t);
486
+ return [t, r?.clone ? r.clone(n) : X(n)];
487
+ }));
488
+ }
489
+ function qe(e, t) {
490
+ return Object.is(e, t) ? !0 : e instanceof Date && t instanceof Date ? e.getTime() === t.getTime() : Array.isArray(e) && Array.isArray(t) ? e.length === t.length && e.every((e, n) => qe(e, t[n])) : !1;
491
+ }
492
+ //#endregion
493
+ //#region src/editor/Controller.ts
494
+ function Je(n) {
495
+ let r = Re(n.fields), o = (e) => n.equals && Object.hasOwn(n.equals, e) ? n.equals[e] : void 0, l = (e, t) => Object.hasOwn(e, t) ? e[t] : void 0;
496
+ for (let e of r) if (e.kind === "custom" && Ge(e) && !o(e.key)) throw s(/* @__PURE__ */ TypeError(`${e.key}:自定义字段必须声明 equals`), a("pro.editor.editorEquals", `${e.key}:自定义字段必须声明 equals`, { key: e.key }));
497
+ let u = U({}), d = {}, f = B("closed"), p = B(!1), h = B(0), g = U([]), _ = e(n.formatError), v = _.value, y, b, x = !1, S, C, w = m(() => n.canWrite?.() !== !1), E = () => r.map((e) => {
498
+ let t = e.modes?.edit;
499
+ return `${e.key}:${Number(!!t?.hidden)}${Number(!!t?.disabled)}${Number(!!t?.readonly)}`;
500
+ }).join("|"), D = m(() => [
501
+ "validating",
502
+ "transforming",
503
+ "saving",
504
+ "verifying"
505
+ ].includes(f.value)), O = m(() => r.filter(Ge).some((e) => Object.hasOwn(u.value, e.key) !== Object.hasOwn(d, e.key) || !(o(e.key) ?? qe)(l(u.value, e.key), l(d, e.key)))), k = (e) => Ke(r, e), A = (e) => X(e);
506
+ function j() {
507
+ b && n.runtime.release(b), b = void 0;
508
+ }
509
+ function M(e) {
510
+ f.value !== "validating" && f.value !== "transforming" || (++h.value, j(), g.value = [], typeof e == "string" ? v.value = e : _.set(e), f.value = "editing");
511
+ }
512
+ function N() {
513
+ ++h.value, j(), u.value = {}, d = {}, g.value = [], v.value = "", p.value = !1, f.value = "closed", y = void 0;
514
+ }
515
+ let P = n.runtime.onInvalidate(N), F = n.canWrite ? q(n.canWrite, () => M(a("pro.editor.permissionChanged", "权限已变化,本次尚未发送的保存已失效")), { flush: "sync" }) : () => {}, I = q(E, () => M(a("pro.editor.applicabilityChanged", "字段适用性已变化,请重新校验后保存")), { flush: "sync" });
516
+ function R() {
517
+ x || (x = !0, N(), P(), F(), I());
518
+ }
519
+ T() && L(R);
520
+ function V(e, t) {
521
+ return !x && e === h.value && p.value && n.runtime.isCurrent(t);
522
+ }
523
+ function H(e) {
524
+ return e instanceof Error ? e.message : String(e);
525
+ }
526
+ function ee(e, t) {
527
+ n.runtime.reportError({
528
+ kind: "request",
529
+ message: H(e),
530
+ cause: e,
531
+ notified: !!(e && typeof e == "object" && Reflect.get(e, "notified"))
532
+ }, t);
533
+ }
534
+ async function W(e) {
535
+ if (x) return;
536
+ if (N(), !e.operationId || e.mode === "edit" && e.id === void 0) {
537
+ p.value = !0, f.value = "load-error", _.set(a("pro.editor.missingOperation", "缺少操作标识或编辑记录 id"));
538
+ return;
539
+ }
540
+ y = { ...e }, p.value = !0;
541
+ let t = n.coordinator.get(n.runtime.scope, e.operationId);
542
+ if (t && t.status !== "not-applied") {
543
+ u.value = k(t.input), d = k(t.input), f.value = "unknown", _.set(t.status === "success" ? a("pro.editor.alreadySaved", "此操作已保存,请核实结果后只刷新读取") : a("pro.editor.pendingWrite", "此操作存在未决写入,请核实;关闭不撤销服务器写入"));
544
+ return;
545
+ }
546
+ f.value = "loading";
547
+ let i = h.value, o = b = n.runtime.createContext();
548
+ try {
549
+ let t = e.mode === "create" ? n.defaults ? await n.defaults(e, o) : {} : await n.load(e, o);
550
+ if (!V(i, o)) return;
551
+ u.value = ze(r, t, e.mode), d = k(u.value), f.value = "editing";
552
+ } catch (e) {
553
+ V(i, o) && (f.value = "load-error", _.from(e), ee(e, o));
554
+ } finally {
555
+ n.runtime.release(o), b === o && (b = void 0);
556
+ }
557
+ }
558
+ async function te() {
559
+ if (D.value) return !1;
560
+ let e = h.value;
561
+ if (S === e) return !1;
562
+ if (f.value === "editing" && O.value) {
563
+ S = e;
564
+ try {
565
+ if (!await n.confirmDiscard()) return !1;
566
+ } catch {
567
+ return !1;
568
+ } finally {
569
+ S === e && (S = void 0);
570
+ }
571
+ if (e !== h.value || D.value) return !1;
572
+ }
573
+ return N(), !0;
574
+ }
575
+ function G(e) {
576
+ return f.value !== "editing" || !w.value ? (_.set(a("pro.editor.modelBlocked", "当前过程拒绝模型更新,请在过程结束后重新编辑或加载")), !1) : (u.value = k(e), !0);
577
+ }
578
+ function K(e, t) {
579
+ let n = r.find((t) => t.key === e);
580
+ return !n || n.modes?.edit?.hidden || n.modes?.edit?.disabled || n.modes?.edit?.readonly || !Pe(n, t) ? !1 : G({
581
+ ...u.value,
582
+ [e]: t
583
+ });
584
+ }
585
+ function ne(e) {
586
+ return {
587
+ ...e,
588
+ target: { ...e.target },
589
+ input: k(e.input),
590
+ payload: A(e.payload)
591
+ };
592
+ }
593
+ function J(e, t) {
594
+ f.value = "success";
595
+ let r = {
596
+ ...ne(e),
597
+ result: t
598
+ };
599
+ if (N(), n.coordinator.claimSuccess(e.scope, e.target.operationId)) try {
600
+ Promise.resolve(n.onSaved?.(r)).catch((e) => console.error("ASAM 保存结果处理失败", e));
601
+ } catch (e) {
602
+ console.error("ASAM 保存结果处理失败", e);
603
+ }
604
+ }
605
+ async function re() {
606
+ if (f.value !== "editing" || !y || !w.value) return;
607
+ let e = h.value, t = E(), o = b = n.runtime.createContext(), l = { ...y };
608
+ f.value = "validating", g.value = [], v.value = "";
609
+ let d = !1, p;
610
+ function m() {
611
+ return V(e, o) ? t === E() ? !0 : (M(a("pro.editor.applicabilityChanged", "字段适用性已变化,请重新校验后保存")), !1) : !1;
612
+ }
613
+ try {
614
+ if (!m()) return;
615
+ let t = k(u.value);
616
+ if (!C) throw s(/* @__PURE__ */ Error("表单尚未就绪,不能绕过字段校验"), a("pro.editor.editorValidatorRequired", "表单尚未就绪,不能绕过字段校验", {}));
617
+ let h = await C();
618
+ if (!m()) return;
619
+ if (h.length) {
620
+ g.value = h, f.value = "editing";
621
+ return;
622
+ }
623
+ f.value = "transforming";
624
+ let v = Be(r, t, "submit", r.map((e) => e.key));
625
+ if (!m()) return;
626
+ if (v.status === "error") {
627
+ g.value = v.issues, f.value = "editing";
628
+ return;
629
+ }
630
+ let y = A(v.data), b = await (n.validatePayload?.(A(y)) ?? Promise.resolve([]));
631
+ if (!m()) return;
632
+ if (b.length) {
633
+ g.value = b, f.value = "editing";
634
+ return;
635
+ }
636
+ if (!w.value) {
637
+ f.value = "editing", _.set(a("pro.editor.permissionUnsent", "权限已变化,未发送保存"));
638
+ return;
639
+ }
640
+ if (!m()) return;
641
+ let x = n.coordinator.get(o.scope, l.operationId);
642
+ if (x && x.status !== "not-applied") {
643
+ f.value = "unknown", _.set(a("pro.editor.duplicateWrite", "同一操作已有未决或已成功写入,请核实"));
644
+ return;
645
+ }
646
+ p = {
647
+ target: l,
648
+ scope: o.scope,
649
+ startedAt: Date.now(),
650
+ input: t,
651
+ payload: y
652
+ }, n.coordinator.set({
653
+ ...ne(p),
654
+ status: "saving"
655
+ }), f.value = "saving", d = !0;
656
+ let S, T = !1, E;
657
+ try {
658
+ S = await n.save(A(y), ne(p), o);
659
+ } catch (t) {
660
+ S = c({
661
+ status: "unknown",
662
+ message: H(t)
663
+ }, t), T = !0, E = t, V(e, o) && ee(t, o);
664
+ }
665
+ if ((!S || ![
666
+ "success",
667
+ "failure",
668
+ "unknown"
669
+ ].includes(S.status)) && (S = i(a("pro.editor.invalidSaveResult", "保存适配返回无效结果,写入仍未知,禁止重发"), { status: "unknown" })), S.status === "success" ? n.coordinator.set({
670
+ ...ne(p),
671
+ status: "success",
672
+ result: S.data
673
+ }) : n.coordinator.set({
674
+ ...ne(p),
675
+ status: S.status === "failure" ? "not-applied" : "unknown"
676
+ }), !V(e, o)) return;
677
+ S.status === "success" ? J(p, S.data) : (f.value = S.status === "unknown" ? "unknown" : "editing", _.from(T ? E : S), g.value = S.status === "failure" ? S.issues ?? [] : [], S.status === "failure" && ee(S, o));
678
+ } catch (t) {
679
+ d && p && n.coordinator.set({
680
+ ...ne(p),
681
+ status: "unknown"
682
+ }), V(e, o) && (f.value = d ? "unknown" : "editing", _.from(t));
683
+ } finally {
684
+ n.runtime.release(o), b === o && (b = void 0);
685
+ }
686
+ }
687
+ async function ie() {
688
+ if (f.value !== "unknown" || !y) return;
689
+ let e = n.coordinator.get(n.runtime.scope, y.operationId);
690
+ if (!e) {
691
+ _.set(a("pro.editor.appVerify", "未决操作由应用核实,请勿重发"));
692
+ return;
693
+ }
694
+ if (e.status === "success") {
695
+ J(e, e.result);
696
+ return;
697
+ }
698
+ if (e.status === "not-applied") {
699
+ f.value = "editing", _.set(a("pro.editor.appNotApplied", "应用已核实未生效,可显式再次保存"));
700
+ return;
701
+ }
702
+ if (!n.verify) {
703
+ _.set(a("pro.editor.verifyUnavailable", "没有可用核实接口,仍未知,请联系业务处理;可关闭但不能重发"));
704
+ return;
705
+ }
706
+ f.value = "verifying";
707
+ let r = h.value, i = b = n.runtime.createContext();
708
+ try {
709
+ let t = await n.verify({
710
+ ...ne(e),
711
+ status: e.status
712
+ }, i), o = n.coordinator.get(e.scope, e.target.operationId);
713
+ if (t.status === "not-applied" && o?.status === "saving") {
714
+ V(r, i) && (f.value = "unknown", _.set(a("pro.editor.saveStillRunning", "原保存仍在进行,暂不能解除未决状态")));
715
+ return;
716
+ }
717
+ if (t.status !== "unknown" && n.coordinator.set({
718
+ ...e,
719
+ status: t.status,
720
+ result: "data" in t ? t.data : void 0
721
+ }), !V(r, i)) return;
722
+ t.status === "success" ? J(e, t.data) : (f.value = t.status === "not-applied" ? "editing" : "unknown", _.set(t.status === "not-applied" ? a("pro.editor.notApplied", "已核实未生效,可显式再次保存") : a("pro.editor.stillUnknown", "核实仍未知,禁止重发")));
723
+ } catch (e) {
724
+ V(r, i) && (f.value = "unknown", _.set(a("pro.editor.verifyFailed", `核实失败,仍未知:${H(e)}`, { message: String(H(e)) }, (r) => ({ message: t(e, r, n.formatError) }))), ee(e, i));
725
+ } finally {
726
+ n.runtime.release(i), b === i && (b = void 0);
727
+ }
728
+ }
729
+ return {
730
+ fields: r,
731
+ model: z(u),
732
+ status: z(f),
733
+ issues: z(g),
734
+ message: z(v),
735
+ formatMessage: (e) => _.format(e, n.formatError),
736
+ visible: z(p),
737
+ dirty: O,
738
+ busy: D,
739
+ writable: w,
740
+ session: z(h),
741
+ canVerify: n.verify !== void 0,
742
+ open: W,
743
+ reload: async () => {
744
+ y && !D.value && f.value !== "unknown" && await W(y);
745
+ },
746
+ close: te,
747
+ invalidate: N,
748
+ dispose: R,
749
+ replace: G,
750
+ update: K,
751
+ submit: re,
752
+ verify: ie,
753
+ setValidator: (e) => {
754
+ C = e;
755
+ }
756
+ };
757
+ }
758
+ //#endregion
759
+ //#region src/form/shared/ValidationSummary.vue?vue&type=script&setup=true&lang.ts
760
+ var Ye = { class: "asam-validation-summary" }, Xe = ["aria-label"], Ze = /* @__PURE__ */ d(/* @__PURE__ */ S({
761
+ __name: "ValidationSummary",
762
+ props: {
763
+ count: {},
764
+ label: {}
765
+ },
766
+ setup(e) {
767
+ let t = B(), n = B();
768
+ function r(e = !1) {
769
+ t.value && (t.value.open = !1), e && n.value?.focus();
770
+ }
771
+ function i(e) {
772
+ t.value?.open && (e.preventDefault(), e.stopPropagation(), r(!0));
773
+ }
774
+ function a(e) {
775
+ e.target instanceof Element && e.target.closest("button") && r();
776
+ }
777
+ return (r, o) => (R(), _("div", Ye, [e.count ? (R(), _("details", {
778
+ key: 0,
779
+ ref_key: "details",
780
+ ref: t,
781
+ onKeydown: re(i, ["esc"])
782
+ }, [v("summary", {
783
+ ref_key: "trigger",
784
+ ref: n
785
+ }, [v("span", {
786
+ role: "alert",
787
+ "aria-label": e.label
788
+ }, W(e.label) + "(" + W(e.count) + ")", 9, Xe)], 512), v("div", {
789
+ class: "asam-validation-summary__panel",
790
+ onClick: a
791
+ }, [H(r.$slots, "default", {}, void 0, !0)])], 544)) : g("", !0)]));
792
+ }
793
+ }), [["__scopeId", "data-v-4b6c3d43"]]), Qe = ["data-state", "aria-busy"], $e = {
794
+ key: 0,
795
+ class: "asam-pro-editor-group-title"
796
+ }, et = {
797
+ key: 1,
798
+ class: "asam-pro-editor-group-title"
799
+ }, tt = { class: "el-form-item__error asam-form-error-text" }, nt = { key: 1 }, rt = /* @__PURE__ */ d(/* @__PURE__ */ S({
800
+ name: "AsamEditorFields",
801
+ __name: "AsamEditorFields",
802
+ props: {
803
+ fields: {},
804
+ modelValue: {},
805
+ issues: { default: () => [] },
806
+ fieldLabels: {},
807
+ columns: { default: 2 },
808
+ size: { default: "default" },
809
+ disabled: {
810
+ type: Boolean,
811
+ default: !1
812
+ },
813
+ writable: {
814
+ type: Boolean,
815
+ default: !0
816
+ },
817
+ busy: {
818
+ type: Boolean,
819
+ default: !1
820
+ },
821
+ status: { default: "editing" },
822
+ session: { default: 0 },
823
+ active: {
824
+ type: Boolean,
825
+ default: !0
826
+ },
827
+ autoFocus: {
828
+ type: Boolean,
829
+ default: !1
830
+ }
831
+ },
832
+ emits: ["update:field", "submit"],
833
+ setup(e, { expose: t, emit: r }) {
834
+ let s = l(), u = o(), d = e, f = r, y = B(), S = B(), C = /* @__PURE__ */ new Map(), w = m(() => We(d.fields, "edit", u)), T = m(() => Object.fromEntries([...Object.entries(d.modelValue), ...d.fields.filter((e) => !Object.hasOwn(d.modelValue, e.key)).map((e) => [e.key, void 0])])), E = m(() => d.disabled || d.status !== "editing" || !d.writable);
835
+ function D(e, t) {
836
+ f("update:field", e, t);
837
+ }
838
+ function O(e) {
839
+ return u.t("pro.editor.issueUnavailable", { message: n(e, u, { label: e.key ? d.fieldLabels?.[e.key] : void 0 }) });
840
+ }
841
+ let k = m(() => Ue(d.fields, "edit").schema), A = m(() => ![
842
+ "closed",
843
+ "loading",
844
+ "load-error"
845
+ ].includes(d.status)), M = (e) => d.fieldLabels?.[e.key] ?? e.label;
846
+ function N(e) {
847
+ return Ge(e) ? s.rules(e.key, k.value.find((t) => t.field === e.key)?.rules ?? []) : [];
848
+ }
849
+ function F(e) {
850
+ return !!e && d.writable && d.fields.some((t) => t.key === e && Ge(t));
851
+ }
852
+ function I(e) {
853
+ return F(e) ? d.issues.filter((t) => t.key === e).map((e) => n(e, u, { label: e.key ? d.fieldLabels?.[e.key] : void 0 })).join(u.t("pro.fields.issueSeparator")) : "";
854
+ }
855
+ function L(e, t) {
856
+ t ? C.set(e, t) : C.delete(e);
857
+ }
858
+ async function z(e) {
859
+ if (!F(e)) return;
860
+ let t = d.fields.find((t) => t.key === e), n = w.value.find((e) => e.fields.includes(t)), r = [...y.value?.querySelectorAll("details.asam-pro-editor-group") ?? []].find((e) => e.dataset.group === n?.id);
861
+ r && (r.open = !0), await j(), C.get(e)?.focus();
862
+ }
863
+ async function U() {
864
+ await j();
865
+ let e = d.fields.find(Ge);
866
+ A.value && d.writable && e ? await z(e.key) : y.value?.focus();
867
+ }
868
+ async function te() {
869
+ if (await j(), !S.value) return [i(a("pro.editor.formNotReady", "表单尚未就绪"))];
870
+ try {
871
+ return await S.value.validate() ? [] : [i(a("pro.editor.invalidFields", "字段校验未通过"))];
872
+ } catch (e) {
873
+ return e instanceof Error ? [c({ message: e.message }, e)] : !e || typeof e != "object" ? [{ message: String(e) }] : Object.entries(e).flatMap(([t, n]) => Array.isArray(n) ? n.map((e) => {
874
+ let n = e.message === void 0 ? i(a("pro.editor.fieldValidation", "字段校验失败")) : s.issue(t, e.message);
875
+ return c({
876
+ key: t,
877
+ message: n.message
878
+ }, n);
879
+ }) : [{ message: String(e) }]);
880
+ }
881
+ }
882
+ return q(() => d.status, async (e, t) => {
883
+ d.autoFocus && e === "editing" && t === "loading" && await U();
884
+ }), q(() => d.issues, async (e) => {
885
+ if (e.length) {
886
+ let t = e.find((e) => F(e.key));
887
+ t && await z(t.key);
888
+ }
889
+ }), t({
890
+ focusInitial: U,
891
+ focusField: z,
892
+ validate: te
893
+ }), (t, r) => (R(), _("div", {
894
+ ref_key: "root",
895
+ ref: y,
896
+ class: "asam-pro-editor",
897
+ "data-state": e.status,
898
+ tabindex: "-1",
899
+ "aria-busy": e.busy || e.status === "loading"
900
+ }, [
901
+ A.value ? (R(), h(K(me), {
902
+ key: 0,
903
+ ref_key: "form",
904
+ ref: S,
905
+ "model-value": T.value,
906
+ size: e.size,
907
+ inline: !1,
908
+ "label-position": "top",
909
+ "require-asterisk-position": "right",
910
+ "label-width": "",
911
+ "show-search": !1,
912
+ "show-reset": !1,
913
+ disabled: E.value,
914
+ onSubmit: r[0] ||= ie((e) => f("submit"), ["prevent"])
915
+ }, {
916
+ default: J(() => [(R(!0), _(p, null, V(w.value, (t) => (R(), h(ee(t.collapsible ? "details" : "section"), {
917
+ key: `${e.session}-${t.id}`,
918
+ class: "asam-pro-editor-group",
919
+ open: t.collapsible ? !t.collapsed : void 0,
920
+ "data-group": t.id
921
+ }, {
922
+ default: J(() => [t.collapsible ? (R(), _("summary", $e, W(t.title), 1)) : (R(), _("h3", et, W(t.title), 1)), v("div", {
923
+ class: "asam-pro-grid",
924
+ style: P({ "--asam-pro-columns": e.columns })
925
+ }, [(R(!0), _(p, null, V(t.fields, (t) => (R(), h(K(he), {
926
+ key: t.key,
927
+ prop: K(Ge)(t) ? t.key : void 0,
928
+ label: M(t),
929
+ rules: N(t),
930
+ error: I(t.key),
931
+ "data-edit-key": t.key,
932
+ style: P({ "--asam-pro-span": Math.min(t.modes?.edit?.layout?.span ?? 1, e.columns) })
933
+ }, {
934
+ error: J(({ error: e }) => [v("div", tt, W(I(t.key) || K(s).format(t.key, e, K(u), { label: M(t) })), 1)]),
935
+ default: J(() => [x(K(He), {
936
+ ref_for: !0,
937
+ ref: (e) => L(t.key, e),
938
+ field: t,
939
+ "display-label": M(t),
940
+ "model-value": T.value[t.key],
941
+ mode: "edit",
942
+ session: e.session,
943
+ active: e.active,
944
+ disabled: E.value,
945
+ "onUpdate:modelValue": (e) => D(t.key, e)
946
+ }, null, 8, [
947
+ "field",
948
+ "display-label",
949
+ "model-value",
950
+ "session",
951
+ "active",
952
+ "disabled",
953
+ "onUpdate:modelValue"
954
+ ])]),
955
+ _: 2
956
+ }, 1032, [
957
+ "prop",
958
+ "label",
959
+ "rules",
960
+ "error",
961
+ "data-edit-key",
962
+ "style"
963
+ ]))), 128))], 4)]),
964
+ _: 2
965
+ }, 1032, ["open", "data-group"]))), 128))]),
966
+ _: 1
967
+ }, 8, [
968
+ "model-value",
969
+ "size",
970
+ "disabled"
971
+ ])) : g("", !0),
972
+ x(Ze, {
973
+ count: e.issues.length,
974
+ label: K(u).t("pro.editor.errorSummary")
975
+ }, {
976
+ default: J(() => [
977
+ v("p", null, W(K(u).t("pro.editor.checkIssues")), 1),
978
+ v("ul", null, [(R(!0), _(p, null, V(e.issues, (t, r) => (R(), _("li", { key: r }, [F(t.key) ? (R(), h(K(Y), {
979
+ key: 0,
980
+ class: "asam-pro-message-button",
981
+ size: e.size,
982
+ "native-type": "button",
983
+ type: "default",
984
+ plain: "",
985
+ onClick: (e) => z(t.key)
986
+ }, {
987
+ default: J(() => [b(W(K(n)(t, K(u), { label: t.key ? d.fieldLabels?.[t.key] : void 0 })), 1)]),
988
+ _: 2
989
+ }, 1032, ["size", "onClick"])) : (R(), _("p", nt, W(O(t)), 1))]))), 128))]),
990
+ H(t.$slots, "error-help", { issues: e.issues }, void 0, !0)
991
+ ]),
992
+ _: 3
993
+ }, 8, ["count", "label"]),
994
+ H(t.$slots, "append", { status: e.status }, void 0, !0)
995
+ ], 8, Qe));
996
+ }
997
+ }), [["__scopeId", "data-v-f9736ae8"]]), it = { class: "asam-pro-editor-actions" }, at = /* @__PURE__ */ d(/* @__PURE__ */ S({
998
+ __name: "AsamEditorActions",
999
+ props: {
1000
+ controller: {},
1001
+ saveButtonType: { default: "primary" },
1002
+ cancelButtonType: { default: "default" },
1003
+ cancelButtonPlain: { type: Boolean },
1004
+ size: { default: "default" },
1005
+ disabled: { type: Boolean }
1006
+ },
1007
+ setup(e) {
1008
+ let t = e, n = o(), r = m(() => t.controller.status.value === "unknown" && t.controller.canVerify), i = m(() => t.controller.writable.value && !["unknown", "verifying"].includes(t.controller.status.value));
1009
+ async function a() {
1010
+ await t.controller.close();
1011
+ }
1012
+ return (t, o) => (R(), _("div", it, [
1013
+ r.value ? (R(), h(K(Y), {
1014
+ key: 0,
1015
+ class: "asam-pro-message-button",
1016
+ size: e.size,
1017
+ disabled: e.disabled,
1018
+ onClick: o[0] ||= (t) => e.controller.verify()
1019
+ }, {
1020
+ default: J(() => [b(W(K(n).t("pro.editor.verify")), 1)]),
1021
+ _: 1
1022
+ }, 8, ["size", "disabled"])) : g("", !0),
1023
+ e.controller.status.value === "unknown" ? H(t.$slots, "unknown-help", { key: 1 }, void 0, !0) : g("", !0),
1024
+ x(K(Y), {
1025
+ class: "asam-pro-message-button",
1026
+ size: e.size,
1027
+ type: e.cancelButtonType,
1028
+ plain: e.cancelButtonPlain,
1029
+ disabled: e.disabled || e.controller.busy.value,
1030
+ onClick: o[1] ||= (e) => a()
1031
+ }, {
1032
+ default: J(() => [b(W(e.controller.status.value === "unknown" ? K(n).t("pro.editor.closePending") : K(n).t("pro.fields.cancel")), 1)]),
1033
+ _: 1
1034
+ }, 8, [
1035
+ "size",
1036
+ "type",
1037
+ "plain",
1038
+ "disabled"
1039
+ ]),
1040
+ i.value ? (R(), h(K(Y), {
1041
+ key: 2,
1042
+ class: "asam-pro-message-button",
1043
+ size: e.size,
1044
+ type: e.saveButtonType,
1045
+ disabled: e.disabled || e.controller.status.value !== "editing",
1046
+ onClick: o[2] ||= (t) => e.controller.submit()
1047
+ }, {
1048
+ default: J(() => [b(W(K(n).t("pro.editor.save")), 1)]),
1049
+ _: 1
1050
+ }, 8, [
1051
+ "size",
1052
+ "type",
1053
+ "disabled"
1054
+ ])) : g("", !0)
1055
+ ]));
1056
+ }
1057
+ }), [["__scopeId", "data-v-0df9e41a"]]), ot = ["data-state", "aria-busy"], st = {
1058
+ key: 0,
1059
+ role: "status",
1060
+ "aria-live": "polite"
1061
+ }, ct = {
1062
+ key: 1,
1063
+ role: "alert"
1064
+ }, lt = /* @__PURE__ */ S({
1065
+ name: "AsamEditorForm",
1066
+ __name: "AsamEditorForm",
1067
+ props: {
1068
+ fieldLabels: {},
1069
+ columns: { default: 2 },
1070
+ showActions: {
1071
+ type: Boolean,
1072
+ default: void 0
1073
+ },
1074
+ autoFocus: {
1075
+ type: Boolean,
1076
+ default: !1
1077
+ },
1078
+ issues: { default: () => [] },
1079
+ readonly: {
1080
+ type: Boolean,
1081
+ default: !1
1082
+ },
1083
+ busy: {
1084
+ type: Boolean,
1085
+ default: !1
1086
+ },
1087
+ active: {
1088
+ type: Boolean,
1089
+ default: !0
1090
+ },
1091
+ session: { default: 0 },
1092
+ saveButtonType: { default: "primary" },
1093
+ cancelButtonType: {},
1094
+ cancelButtonPlain: { type: Boolean },
1095
+ size: { default: "default" },
1096
+ disabled: {
1097
+ type: Boolean,
1098
+ default: !1
1099
+ },
1100
+ controller: {},
1101
+ fields: {},
1102
+ modelValue: {}
1103
+ },
1104
+ emits: ["update:modelValue", "submit"],
1105
+ setup(e, { expose: t, emit: n }) {
1106
+ let r = e, s = n;
1107
+ if (!r.controller && (!r.fields || !r.modelValue)) throw TypeError("AsamEditorForm 需要 controller 或 fields/modelValue");
1108
+ let c = o(), l = m(() => r.controller), u = U(), d = m(() => r.controller?.fields ?? r.fields ?? []), f = m(() => r.controller?.model.value ?? r.modelValue ?? {}), p = m(() => r.controller?.issues.value ?? r.issues), v = m(() => r.controller?.status.value ?? "editing"), y = m(() => !r.readonly && (r.controller?.writable.value ?? !0)), S = m(() => r.disabled || r.busy || !y.value || v.value !== "editing"), C = m(() => r.controller ? {
1109
+ closed: "",
1110
+ loading: c.t("pro.editor.loading"),
1111
+ "load-error": c.t("pro.editor.failedLoad"),
1112
+ editing: y.value ? "" : c.t("pro.editor.readOnly"),
1113
+ validating: c.t("pro.editor.validating"),
1114
+ transforming: c.t("pro.editor.transforming"),
1115
+ saving: c.t("pro.editor.saving"),
1116
+ unknown: c.t("pro.editor.saveUnknown"),
1117
+ verifying: c.t("pro.editor.verifying"),
1118
+ success: c.t("pro.editor.saved")
1119
+ }[v.value] : "");
1120
+ function w(e, t) {
1121
+ S.value || (r.controller ? r.controller.update(e, t) : r.modelValue && s("update:modelValue", Object.assign({}, r.modelValue, { [e]: t })));
1122
+ }
1123
+ async function T() {
1124
+ S.value || (r.controller ? await r.controller.submit() : s("submit"));
1125
+ }
1126
+ async function D() {
1127
+ return await j(), u.value?.validate() ?? [i(a("pro.editor.formNotReady", "表单尚未就绪"))];
1128
+ }
1129
+ async function O() {
1130
+ await j(), await u.value?.focusInitial();
1131
+ }
1132
+ async function k(e) {
1133
+ await j(), await u.value?.focusField(e);
1134
+ }
1135
+ return q(() => r.controller, (e, t) => {
1136
+ t?.setValidator(void 0), e?.setValidator(D);
1137
+ }, {
1138
+ immediate: !0,
1139
+ flush: "sync"
1140
+ }), F(() => r.controller?.setValidator(void 0)), t({
1141
+ validate: D,
1142
+ focusInitial: O,
1143
+ focusField: k
1144
+ }), (t, n) => (R(), _("div", {
1145
+ class: "asam-pro-editor-shell",
1146
+ "data-state": v.value,
1147
+ "aria-busy": e.busy || l.value?.busy.value
1148
+ }, [
1149
+ C.value ? (R(), _("p", st, W(C.value), 1)) : g("", !0),
1150
+ l.value?.message.value ? (R(), _("p", ct, W(l.value.formatMessage?.(K(c)) ?? l.value.message.value), 1)) : g("", !0),
1151
+ l.value?.status.value === "load-error" ? (R(), h(K(Y), {
1152
+ key: 2,
1153
+ size: e.size,
1154
+ onClick: n[0] ||= (e) => l.value.reload()
1155
+ }, {
1156
+ default: J(() => [b(W(K(c).t("pro.editor.retryLoad")), 1)]),
1157
+ _: 1
1158
+ }, 8, ["size"])) : g("", !0),
1159
+ x(rt, {
1160
+ ref_key: "content",
1161
+ ref: u,
1162
+ fields: d.value,
1163
+ "model-value": f.value,
1164
+ issues: p.value,
1165
+ columns: e.columns,
1166
+ "field-labels": e.fieldLabels,
1167
+ size: e.size,
1168
+ disabled: S.value,
1169
+ writable: y.value,
1170
+ busy: e.busy || l.value?.busy.value,
1171
+ status: v.value,
1172
+ session: l.value?.session.value ?? e.session,
1173
+ active: l.value?.visible.value ?? e.active,
1174
+ "auto-focus": e.autoFocus,
1175
+ "onUpdate:field": w,
1176
+ onSubmit: T
1177
+ }, {
1178
+ "error-help": J((e) => [H(t.$slots, "error-help", N(E(e)))]),
1179
+ append: J((e) => [H(t.$slots, "append", N(E(e)))]),
1180
+ _: 3
1181
+ }, 8, [
1182
+ "fields",
1183
+ "model-value",
1184
+ "issues",
1185
+ "columns",
1186
+ "field-labels",
1187
+ "size",
1188
+ "disabled",
1189
+ "writable",
1190
+ "busy",
1191
+ "status",
1192
+ "session",
1193
+ "active",
1194
+ "auto-focus"
1195
+ ]),
1196
+ l.value && e.showActions !== !1 ? (R(), h(at, {
1197
+ key: 3,
1198
+ controller: l.value,
1199
+ size: e.size,
1200
+ "save-button-type": e.saveButtonType,
1201
+ "cancel-button-type": e.cancelButtonType,
1202
+ "cancel-button-plain": e.cancelButtonPlain,
1203
+ disabled: e.disabled || e.busy || e.readonly
1204
+ }, {
1205
+ "unknown-help": J(() => [H(t.$slots, "unknown-help")]),
1206
+ _: 3
1207
+ }, 8, [
1208
+ "controller",
1209
+ "size",
1210
+ "save-button-type",
1211
+ "cancel-button-type",
1212
+ "cancel-button-plain",
1213
+ "disabled"
1214
+ ])) : g("", !0)
1215
+ ], 8, ot));
1216
+ }
1217
+ }), ut = { class: "asam-pro-form-dialog-footer" }, dt = {
1218
+ key: 0,
1219
+ class: "asam-pro-form-dialog-footer-leading"
1220
+ }, ft = /* @__PURE__ */ d(/* @__PURE__ */ S({
1221
+ name: "AsamFormDialog",
1222
+ __name: "AsamFormDialog",
1223
+ props: {
1224
+ fieldLabels: {},
1225
+ columns: { default: 2 },
1226
+ title: { default: void 0 },
1227
+ width: { default: "min(960px, calc(100% - 32px))" },
1228
+ fallbackFocus: {
1229
+ type: Function,
1230
+ default: void 0
1231
+ },
1232
+ controller: {},
1233
+ saveButtonType: { default: "primary" },
1234
+ cancelButtonType: {},
1235
+ cancelButtonPlain: { type: Boolean },
1236
+ size: { default: "default" },
1237
+ disabled: { type: Boolean }
1238
+ },
1239
+ setup(e) {
1240
+ let t = e, n = o(), r = m(() => t.title ?? n.t("pro.editor.editTitle")), i = U(), a = null;
1241
+ q(() => t.controller.visible.value, (e) => {
1242
+ e && typeof document < "u" && (a = document.activeElement instanceof HTMLElement ? document.activeElement : null);
1243
+ }, {
1244
+ immediate: !0,
1245
+ flush: "sync"
1246
+ }), q(() => t.controller, (e, t) => t?.invalidate());
1247
+ async function s() {
1248
+ await j(), await i.value?.focusInitial();
1249
+ }
1250
+ function c() {
1251
+ (a?.isConnected ? a : t.fallbackFocus?.())?.focus();
1252
+ }
1253
+ async function l() {
1254
+ await t.controller.close();
1255
+ }
1256
+ return F(() => {
1257
+ t.controller.invalidate(), c();
1258
+ }), (t, n) => (R(), h(K(ce), {
1259
+ "model-value": e.controller.visible.value,
1260
+ title: r.value,
1261
+ width: e.width,
1262
+ "before-close": l,
1263
+ "close-on-click-modal": !0,
1264
+ "close-on-press-escape": !0,
1265
+ "destroy-on-close": "",
1266
+ onOpenAutoFocus: s,
1267
+ onCloseAutoFocus: c
1268
+ }, {
1269
+ footer: J(() => [v("div", ut, [t.$slots["footer-leading"] ? (R(), _("div", dt, [H(t.$slots, "footer-leading", {}, void 0, !0)])) : g("", !0), x(at, {
1270
+ controller: e.controller,
1271
+ size: e.size,
1272
+ "save-button-type": e.saveButtonType,
1273
+ "cancel-button-type": e.cancelButtonType,
1274
+ "cancel-button-plain": e.cancelButtonPlain
1275
+ }, {
1276
+ "unknown-help": J(() => [H(t.$slots, "unknown-help", {}, void 0, !0)]),
1277
+ _: 3
1278
+ }, 8, [
1279
+ "controller",
1280
+ "size",
1281
+ "save-button-type",
1282
+ "cancel-button-type",
1283
+ "cancel-button-plain"
1284
+ ])])]),
1285
+ default: J(() => [x(lt, {
1286
+ ref_key: "editorForm",
1287
+ ref: i,
1288
+ controller: e.controller,
1289
+ columns: e.columns,
1290
+ "field-labels": e.fieldLabels,
1291
+ size: e.size,
1292
+ "show-actions": !1,
1293
+ "auto-focus": ""
1294
+ }, {
1295
+ "error-help": J((e) => [H(t.$slots, "error-help", N(E(e)), void 0, !0)]),
1296
+ append: J((e) => [H(t.$slots, "append", N(E(e)), void 0, !0)]),
1297
+ _: 3
1298
+ }, 8, [
1299
+ "controller",
1300
+ "columns",
1301
+ "field-labels",
1302
+ "size"
1303
+ ])]),
1304
+ _: 3
1305
+ }, 8, [
1306
+ "model-value",
1307
+ "title",
1308
+ "width"
1309
+ ]));
1310
+ }
1311
+ }), [["__scopeId", "data-v-fdf9e82f"]]);
1312
+ //#endregion
1313
+ //#region src/detail/Controller.ts
1314
+ function pt(t) {
1315
+ let n = Re(t.fields), r = U(), i = B("idle"), o = e(), c = o.value, l = B(!1), u = B(!1), d = B(0), f, p, m = !1;
1316
+ function h() {
1317
+ ++d.value, p && t.runtime.release(p), p = void 0, r.value = void 0, f = void 0, c.value = "", i.value = "idle", l.value = !1, u.value = !1;
1318
+ }
1319
+ let g = t.runtime.onInvalidate(h);
1320
+ function _() {
1321
+ m || (m = !0, h(), g());
1322
+ }
1323
+ T() && L(_);
1324
+ function v(e) {
1325
+ return typeof e == "object" && !!e && !Array.isArray(e);
1326
+ }
1327
+ function y(e) {
1328
+ return !!e && e.id !== void 0 && (e.mode === "direct" && !Object.hasOwn(e, "load") && typeof e.status == "string" && [
1329
+ "idle",
1330
+ "loading",
1331
+ "ready",
1332
+ "missing",
1333
+ "forbidden",
1334
+ "error"
1335
+ ].includes(e.status) && (e.status !== "ready" || v(e.data)) || e.mode === "load" && typeof e.load == "function" && !Object.hasOwn(e, "data") && !Object.hasOwn(e, "status"));
1336
+ }
1337
+ function b() {
1338
+ r.value = void 0, i.value = "config-error", o.set(a("pro.detail.detailSource", "详情来源配置冲突或缺失:直接数据与主动加载必须显式互斥"));
1339
+ }
1340
+ function x(e) {
1341
+ r.value = e.status === "ready" && e.data ? Ke(n, e.data) : void 0, i.value = e.status, c.value = e.message ?? "";
1342
+ }
1343
+ async function S() {
1344
+ if (!f || f.mode !== "load" || !l.value || m || i.value === "loading") return;
1345
+ let e = d.value, u = p = t.runtime.createContext();
1346
+ i.value = "loading", r.value = void 0, c.value = "";
1347
+ let h = () => !m && l.value && e === d.value && t.runtime.isCurrent(u);
1348
+ try {
1349
+ let e = await f.load(f.id, u);
1350
+ if (!h()) return;
1351
+ if (!e || ![
1352
+ "ready",
1353
+ "missing",
1354
+ "forbidden"
1355
+ ].includes(e.status)) throw s(/* @__PURE__ */ TypeError("详情响应状态无效"), a("pro.detail.detailResponseStatus", "详情响应状态无效", {}));
1356
+ if (e.status === "ready") {
1357
+ if (!v(e.data)) throw s(/* @__PURE__ */ TypeError("详情就绪但缺少数据"), a("pro.detail.detailMissingData", "详情就绪但缺少数据", {}));
1358
+ r.value = Ke(n, e.data);
1359
+ } else c.value = e.message ?? "";
1360
+ i.value = e.status;
1361
+ } catch (e) {
1362
+ h() && (i.value = "error", o.from(e), t.runtime.reportError({
1363
+ kind: "request",
1364
+ message: c.value,
1365
+ cause: e,
1366
+ notified: !!(e && typeof e == "object" && Reflect.get(e, "notified"))
1367
+ }, u));
1368
+ } finally {
1369
+ t.runtime.release(u), p === u && (p = void 0);
1370
+ }
1371
+ }
1372
+ async function C(e) {
1373
+ if (!m) {
1374
+ if (h(), l.value = !0, !y(e)) {
1375
+ b();
1376
+ return;
1377
+ }
1378
+ if (f = { ...e }, u.value = e.mode === "load", e.mode === "direct") try {
1379
+ x(e);
1380
+ } catch (e) {
1381
+ b(), o.from(e, String(e));
1382
+ }
1383
+ else await S();
1384
+ }
1385
+ }
1386
+ function w(e) {
1387
+ if (!(!l.value || m)) {
1388
+ if (!y(e) || f?.mode !== "direct" || e.mode !== "direct" || f.id !== e.id) {
1389
+ h(), l.value = !0, b();
1390
+ return;
1391
+ }
1392
+ f = { ...e };
1393
+ try {
1394
+ x(e);
1395
+ } catch (e) {
1396
+ b(), o.from(e, String(e));
1397
+ }
1398
+ }
1399
+ }
1400
+ return {
1401
+ fields: n,
1402
+ data: z(r),
1403
+ status: z(i),
1404
+ message: z(c),
1405
+ formatMessage: o.format,
1406
+ active: z(l),
1407
+ canRefresh: z(u),
1408
+ session: z(d),
1409
+ open: C,
1410
+ update: w,
1411
+ refresh: S,
1412
+ close: h,
1413
+ dispose: _
1414
+ };
1415
+ }
1416
+ //#endregion
1417
+ //#region src/detail/AsamDetailPanel.vue?vue&type=script&setup=true&lang.ts
1418
+ var mt = [
1419
+ "data-state",
1420
+ "aria-labelledby",
1421
+ "aria-label",
1422
+ "aria-busy"
1423
+ ], ht = ["id"], gt = {
1424
+ key: 1,
1425
+ role: "status",
1426
+ "aria-live": "polite"
1427
+ }, _t = ["role"], vt = ["data-kind"], yt = { key: 0 }, bt = /* @__PURE__ */ d(/* @__PURE__ */ S({
1428
+ name: "AsamDetailPanel",
1429
+ __name: "AsamDetailPanel",
1430
+ props: {
1431
+ controller: {},
1432
+ fieldLabels: {},
1433
+ title: { default: void 0 },
1434
+ emptyText: { default: "—" },
1435
+ columns: { default: 2 },
1436
+ appearance: { default: "plain" },
1437
+ embedded: {
1438
+ type: Boolean,
1439
+ default: !1
1440
+ },
1441
+ fallbackFocus: {
1442
+ type: Function,
1443
+ default: void 0
1444
+ }
1445
+ },
1446
+ setup(e) {
1447
+ let t = o(), n = e, r = ne(), i = B(), a = B(), s = null, c = m(() => We(n.controller.fields, "detail", t));
1448
+ function l(e) {
1449
+ let t = n.controller.data.value;
1450
+ return t && Object.hasOwn(t, e) ? t[e] : void 0;
1451
+ }
1452
+ let u = m(() => ({
1453
+ idle: t.t("pro.detail.detailIdle"),
1454
+ loading: t.t("pro.detail.detailLoading"),
1455
+ ready: "",
1456
+ missing: t.t("pro.detail.detailMissing"),
1457
+ forbidden: t.t("pro.detail.detailForbidden"),
1458
+ error: t.t("pro.detail.detailFailed"),
1459
+ "config-error": t.t("pro.detail.detailConfig")
1460
+ })[n.controller.status.value]);
1461
+ function d(e, t) {
1462
+ return t === void 0 ? !0 : e.kind === "custom" ? e.isValue(t) && e.isEmpty(e.clone ? e.clone(t) : X(t)) : t == null || t === "" || Array.isArray(t) && t.length === 0;
1463
+ }
1464
+ function f() {
1465
+ (s?.isConnected ? s : n.fallbackFocus?.())?.focus();
1466
+ }
1467
+ q(() => [n.controller.active.value, n.controller.session.value], async ([e]) => {
1468
+ n.embedded || (e ? (s = document.activeElement instanceof HTMLElement ? document.activeElement : null, await j(), i.value?.focus()) : f());
1469
+ }, { flush: "post" }), F(() => {
1470
+ n.embedded || (n.controller.close(), f());
1471
+ });
1472
+ let y = m(() => n.title ?? t.t("pro.detail.detailTitle"));
1473
+ return (n, o) => e.controller.active.value ? (R(), _("section", {
1474
+ key: 0,
1475
+ ref_key: "root",
1476
+ ref: a,
1477
+ class: M(["asam-pro-detail", { "asam-pro-detail-grouped": e.appearance === "grouped" }]),
1478
+ "data-state": e.controller.status.value,
1479
+ "aria-labelledby": e.embedded ? void 0 : K(r),
1480
+ "aria-label": e.embedded ? K(y) : void 0,
1481
+ "aria-busy": e.controller.status.value === "loading"
1482
+ }, [
1483
+ e.embedded ? g("", !0) : (R(), _("h3", {
1484
+ key: 0,
1485
+ id: K(r),
1486
+ ref_key: "heading",
1487
+ ref: i,
1488
+ tabindex: "-1"
1489
+ }, W(K(y)), 9, ht)),
1490
+ u.value ? (R(), _("p", gt, W(u.value), 1)) : g("", !0),
1491
+ e.controller.message.value ? (R(), _("p", {
1492
+ key: 2,
1493
+ role: [
1494
+ "error",
1495
+ "forbidden",
1496
+ "config-error"
1497
+ ].includes(e.controller.status.value) ? "alert" : "status"
1498
+ }, W(e.controller.formatMessage?.(K(t)) ?? e.controller.message.value), 9, _t)) : g("", !0),
1499
+ e.controller.status.value === "ready" && e.controller.data.value ? (R(!0), _(p, { key: 3 }, V(c.value, (t) => (R(), _("section", { key: t.id }, [v("h4", null, W(t.title), 1), v("dl", {
1500
+ class: "asam-pro-detail-grid",
1501
+ style: P({ "--asam-pro-columns": e.columns })
1502
+ }, [(R(!0), _(p, null, V(t.fields, (t) => (R(), _("div", {
1503
+ key: `${e.controller.session.value}-${t.key}`,
1504
+ "data-kind": t.kind,
1505
+ style: P({ "--asam-pro-span": Math.min(t.modes?.detail?.layout?.span ?? (e.appearance === "grouped" && t.kind === "textarea" ? e.columns : 1), e.columns) })
1506
+ }, [v("dt", null, W(e.fieldLabels?.[t.key] ?? t.label), 1), v("dd", null, [d(t, l(t.key)) ? (R(), _("p", yt, W(e.emptyText), 1)) : (R(), h(K(He), {
1507
+ key: 1,
1508
+ field: t,
1509
+ "display-label": e.fieldLabels?.[t.key],
1510
+ "model-value": l(t.key),
1511
+ mode: "detail",
1512
+ session: e.controller.session.value,
1513
+ active: e.controller.active.value
1514
+ }, null, 8, [
1515
+ "field",
1516
+ "display-label",
1517
+ "model-value",
1518
+ "session",
1519
+ "active"
1520
+ ]))])], 12, vt))), 128))], 4)]))), 128)) : g("", !0),
1521
+ H(n.$slots, "default", {
1522
+ data: e.controller.data.value,
1523
+ status: e.controller.status.value
1524
+ }, void 0, !0)
1525
+ ], 10, mt)) : g("", !0);
1526
+ }
1527
+ }), [["__scopeId", "data-v-ee33586f"]]), xt = /* @__PURE__ */ S({
1528
+ name: "AsamDetailDialog",
1529
+ __name: "AsamDetailDialog",
1530
+ props: {
1531
+ width: { default: "min(900px, calc(100% - 24px))" },
1532
+ controller: {},
1533
+ title: {},
1534
+ fieldLabels: {},
1535
+ emptyText: {},
1536
+ columns: {},
1537
+ appearance: { default: "grouped" },
1538
+ closeDisabled: { type: Boolean },
1539
+ closeOnClickModal: {
1540
+ type: Boolean,
1541
+ default: void 0
1542
+ },
1543
+ closeOnPressEscape: {
1544
+ type: Boolean,
1545
+ default: void 0
1546
+ }
1547
+ },
1548
+ emits: [
1549
+ "open",
1550
+ "opened",
1551
+ "close",
1552
+ "closed"
1553
+ ],
1554
+ setup(e, { emit: t }) {
1555
+ let n = e, r = t, i = o(), a = m(() => n.title ?? i.t("pro.detail.detailTitle"));
1556
+ function s() {
1557
+ !n.closeDisabled && n.controller.active.value && n.controller.close();
1558
+ }
1559
+ return (t, n) => (R(), h(K(ce), {
1560
+ "model-value": e.controller.active.value,
1561
+ title: a.value,
1562
+ width: e.width,
1563
+ "close-on-click-modal": e.closeOnClickModal,
1564
+ "close-on-press-escape": e.closeOnPressEscape,
1565
+ "before-close": s,
1566
+ onOpen: n[0] ||= (e) => r("open"),
1567
+ onOpened: n[1] ||= (e) => r("opened"),
1568
+ onClose: n[2] ||= (e) => r("close"),
1569
+ onClosed: n[3] ||= (e) => r("closed")
1570
+ }, y({
1571
+ default: J(() => [H(t.$slots, "content", {}, () => [x(bt, {
1572
+ embedded: "",
1573
+ controller: e.controller,
1574
+ title: a.value,
1575
+ appearance: e.appearance,
1576
+ columns: e.columns,
1577
+ "field-labels": e.fieldLabels,
1578
+ "empty-text": e.emptyText
1579
+ }, {
1580
+ default: J((e) => [H(t.$slots, "default", N(E(e)))]),
1581
+ _: 3
1582
+ }, 8, [
1583
+ "controller",
1584
+ "title",
1585
+ "appearance",
1586
+ "columns",
1587
+ "field-labels",
1588
+ "empty-text"
1589
+ ])])]),
1590
+ _: 2
1591
+ }, [t.$slots.header ? {
1592
+ name: "header",
1593
+ fn: J((e) => [H(t.$slots, "header", N(E(e)))]),
1594
+ key: "0"
1595
+ } : void 0, t.$slots.footer ? {
1596
+ name: "footer",
1597
+ fn: J(() => [H(t.$slots, "footer", { close: s })]),
1598
+ key: "1"
1599
+ } : void 0]), 1032, [
1600
+ "model-value",
1601
+ "title",
1602
+ "width",
1603
+ "close-on-click-modal",
1604
+ "close-on-press-escape"
1605
+ ]));
1606
+ }
1607
+ }), St = /* @__PURE__ */ S({
1608
+ name: "AsamDetailDrawer",
1609
+ __name: "AsamDetailDrawer",
1610
+ props: {
1611
+ size: { default: "min(800px, 100vw)" },
1612
+ direction: {},
1613
+ resizable: { type: Boolean },
1614
+ controller: {},
1615
+ title: {},
1616
+ fieldLabels: {},
1617
+ emptyText: {},
1618
+ columns: {},
1619
+ appearance: { default: "grouped" },
1620
+ closeDisabled: { type: Boolean },
1621
+ closeOnClickModal: {
1622
+ type: Boolean,
1623
+ default: void 0
1624
+ },
1625
+ closeOnPressEscape: {
1626
+ type: Boolean,
1627
+ default: void 0
1628
+ }
1629
+ },
1630
+ emits: [
1631
+ "open",
1632
+ "opened",
1633
+ "close",
1634
+ "closed"
1635
+ ],
1636
+ setup(e, { emit: t }) {
1637
+ let n = e, r = t, i = o(), a = m(() => n.title ?? i.t("pro.detail.detailTitle"));
1638
+ function s() {
1639
+ !n.closeDisabled && n.controller.active.value && n.controller.close();
1640
+ }
1641
+ return (t, n) => (R(), h(K(le), {
1642
+ "model-value": e.controller.active.value,
1643
+ title: a.value,
1644
+ size: e.size,
1645
+ direction: e.direction,
1646
+ resizable: e.resizable,
1647
+ "close-on-click-modal": e.closeOnClickModal,
1648
+ "close-on-press-escape": e.closeOnPressEscape,
1649
+ "before-close": s,
1650
+ onOpen: n[0] ||= (e) => r("open"),
1651
+ onOpened: n[1] ||= (e) => r("opened"),
1652
+ onClose: n[2] ||= (e) => r("close"),
1653
+ onClosed: n[3] ||= (e) => r("closed")
1654
+ }, y({
1655
+ default: J(() => [H(t.$slots, "content", {}, () => [x(bt, {
1656
+ embedded: "",
1657
+ controller: e.controller,
1658
+ title: a.value,
1659
+ appearance: e.appearance,
1660
+ columns: e.columns,
1661
+ "field-labels": e.fieldLabels,
1662
+ "empty-text": e.emptyText
1663
+ }, {
1664
+ default: J((e) => [H(t.$slots, "default", N(E(e)))]),
1665
+ _: 3
1666
+ }, 8, [
1667
+ "controller",
1668
+ "title",
1669
+ "appearance",
1670
+ "columns",
1671
+ "field-labels",
1672
+ "empty-text"
1673
+ ])])]),
1674
+ _: 2
1675
+ }, [t.$slots.header ? {
1676
+ name: "header",
1677
+ fn: J((e) => [H(t.$slots, "header", N(E(e)))]),
1678
+ key: "0"
1679
+ } : void 0, t.$slots.footer ? {
1680
+ name: "footer",
1681
+ fn: J(() => [H(t.$slots, "footer", { close: s })]),
1682
+ key: "1"
1683
+ } : void 0]), 1032, [
1684
+ "model-value",
1685
+ "title",
1686
+ "size",
1687
+ "direction",
1688
+ "resizable",
1689
+ "close-on-click-modal",
1690
+ "close-on-press-escape"
1691
+ ]));
1692
+ }
1693
+ }), Ct = Symbol("AsamTableMessage"), wt = Symbol("AsamTableMessageRef"), Tt = Symbol("AsamTableFieldOrigin"), Et = /* @__PURE__ */ new WeakMap();
1694
+ function Z(...[e, t, n = {}, r]) {
1695
+ let i = { message: t };
1696
+ return Object.defineProperty(i, Ct, {
1697
+ value: Object.freeze({
1698
+ key: e,
1699
+ values: n,
1700
+ nested: r
1701
+ }),
1702
+ configurable: !0
1703
+ }), i;
1704
+ }
1705
+ function Dt(...e) {
1706
+ let t = Z(...e);
1707
+ return Lt(t, { reason: t.message });
1708
+ }
1709
+ function Ot(e, ...[t, n = {}, r]) {
1710
+ let i = { ...e };
1711
+ return Object.defineProperty(i, Ct, {
1712
+ value: Object.freeze({
1713
+ key: t,
1714
+ values: n,
1715
+ nested: r
1716
+ }),
1717
+ enumerable: !1,
1718
+ configurable: !0
1719
+ }), Object.isFrozen(e) ? Object.freeze(i) : i;
1720
+ }
1721
+ function kt(e, t) {
1722
+ let n = { message: t };
1723
+ return At(e, n), Object.defineProperty(n, Tt, {
1724
+ value: e?.[Tt] ?? e,
1725
+ enumerable: !1,
1726
+ configurable: !0
1727
+ }), n;
1728
+ }
1729
+ function At(e, t) {
1730
+ if (!e || typeof e != "object") return;
1731
+ c(t, e);
1732
+ let n = Reflect.get(e, Vt);
1733
+ n && Object.defineProperty(t, Vt, {
1734
+ value: n,
1735
+ enumerable: !1,
1736
+ configurable: !0
1737
+ });
1738
+ let r = e[Tt];
1739
+ r && Object.defineProperty(t, Tt, {
1740
+ value: r,
1741
+ enumerable: !1,
1742
+ configurable: !0
1743
+ });
1744
+ let i = e[Ct] ?? e[wt];
1745
+ i && Object.defineProperty(t, Ct, {
1746
+ value: i,
1747
+ enumerable: !1,
1748
+ configurable: !0
1749
+ });
1750
+ }
1751
+ function Q(e, t) {
1752
+ let n = Et.get(e);
1753
+ if (!n) {
1754
+ n = U(), Et.set(e, n);
1755
+ let t = n;
1756
+ Object.defineProperty(e, wt, {
1757
+ get: () => t.value,
1758
+ configurable: !0
1759
+ });
1760
+ }
1761
+ n.value = typeof t == "string" ? void 0 : t[Ct];
1762
+ for (let n of [Tt, Vt]) Object.defineProperty(e, n, {
1763
+ value: typeof t == "string" ? void 0 : Reflect.get(t, n),
1764
+ configurable: !0
1765
+ });
1766
+ e.value = typeof t == "string" ? t : t.message;
1767
+ }
1768
+ function jt(e) {
1769
+ let t = () => typeof e == "function" ? e() : e, n = m(() => t().value);
1770
+ for (let e of [Tt, Vt]) Object.defineProperty(n, e, {
1771
+ get: () => Reflect.get(t(), e),
1772
+ configurable: !0
1773
+ });
1774
+ return Object.defineProperty(n, wt, {
1775
+ get: () => t()[wt],
1776
+ configurable: !0
1777
+ }), n;
1778
+ }
1779
+ function Mt(e, r) {
1780
+ if (typeof e == "string") return e;
1781
+ if (e == null) return "";
1782
+ let i = e, a = i.message ?? i.reason ?? i.error ?? i.label ?? i.value ?? (e instanceof Error ? e.message : ""), o = Reflect.get(i, Vt);
1783
+ if (o && r.enabled.value) return o.map((e) => zt(e, r)).join(";");
1784
+ let s = i[Ct] ?? i[wt];
1785
+ if (!r.enabled.value) return a;
1786
+ if (!s) {
1787
+ let e = n(i, r);
1788
+ if (typeof e == "string" && e !== a) return e;
1789
+ let o = i[Tt];
1790
+ if (o && typeof o == "object") {
1791
+ let e = o, i = o instanceof Error ? t(o, r) : typeof e.message == "string" ? n(e, r) : a;
1792
+ return i === e.message ? a : i;
1793
+ }
1794
+ return a;
1795
+ }
1796
+ let c = { ...s.values };
1797
+ for (let [e, t] of Object.entries(s.nested ?? {})) c[e] = Mt(t, r);
1798
+ return Reflect.apply(r.t, r, [s.key, c]);
1799
+ }
1800
+ function $(e, ...[t, n = {}]) {
1801
+ return Object.defineProperty(e, Ct, {
1802
+ value: Object.freeze({
1803
+ key: t,
1804
+ values: n
1805
+ }),
1806
+ enumerable: !1,
1807
+ configurable: !0
1808
+ }), e;
1809
+ }
1810
+ function Nt(e, t) {
1811
+ let n = { message: e instanceof Error ? e.message : t?.message ?? String(e) };
1812
+ return At(e instanceof Error ? e : t, n), n;
1813
+ }
1814
+ var Pt = Object.freeze({
1815
+ preparing: Object.freeze(Z("pro.table.status.preparing", "preparing")),
1816
+ confirming: Object.freeze(Z("pro.table.status.confirming", "confirming")),
1817
+ running: Object.freeze(Z("pro.table.status.running", "running")),
1818
+ settled: Object.freeze(Z("pro.table.status.settled", "settled")),
1819
+ cancelled: Object.freeze(Z("pro.table.status.cancelled", "cancelled")),
1820
+ unsent: Object.freeze(Z("pro.table.status.unsent", "unsent")),
1821
+ success: Object.freeze(Z("pro.table.status.success", "success")),
1822
+ failure: Object.freeze(Z("pro.table.status.failure", "failure")),
1823
+ unknown: Object.freeze(Z("pro.table.status.unknown", "unknown")),
1824
+ "not-applied": Object.freeze(Z("pro.table.status.not-applied", "not-applied")),
1825
+ error: Object.freeze(Z("pro.table.status.error", "error")),
1826
+ invalid: Object.freeze(Z("pro.table.status.invalid", "invalid")),
1827
+ blocked: Object.freeze(Z("pro.table.status.blocked", "blocked")),
1828
+ conflict: Object.freeze(Z("pro.table.status.conflict", "conflict")),
1829
+ idle: Object.freeze(Z("pro.table.status.idle", "idle")),
1830
+ loading: Object.freeze(Z("pro.table.status.loading", "loading")),
1831
+ editing: Object.freeze(Z("pro.table.status.editing", "editing")),
1832
+ saving: Object.freeze(Z("pro.table.status.saving", "saving")),
1833
+ row: Object.freeze(Z("pro.table.status.row", "row")),
1834
+ cell: Object.freeze(Z("pro.table.status.cell", "cell")),
1835
+ batch: Object.freeze(Z("pro.table.status.batch", "batch")),
1836
+ order: Object.freeze(Z("pro.table.status.order", "order"))
1837
+ });
1838
+ function Ft(e, t) {
1839
+ return Mt(It(t), e);
1840
+ }
1841
+ function It(e) {
1842
+ return Object.hasOwn(Pt, e) ? Reflect.get(Pt, e) : { message: e };
1843
+ }
1844
+ function Lt(e, t) {
1845
+ return At(e, t), t;
1846
+ }
1847
+ function Rt(e, t) {
1848
+ return Lt(e, { error: t });
1849
+ }
1850
+ function zt(e, t) {
1851
+ return e[Ct] || e[Tt] ? Mt(e, t) : n(e, t);
1852
+ }
1853
+ function Bt(e, t) {
1854
+ return e[Ct] ? Mt(e, t) : ae(e, t);
1855
+ }
1856
+ var Vt = Symbol("AsamTableIssueList");
1857
+ function Ht(e) {
1858
+ let t = { message: e.map((e) => e.message).join(";") };
1859
+ return Object.defineProperty(t, Vt, {
1860
+ value: Object.freeze([...e]),
1861
+ enumerable: !1,
1862
+ configurable: !0
1863
+ }), t;
1864
+ }
1865
+ function Ut(e, n, r, i = e instanceof Error ? e.message : String(e)) {
1866
+ return n.enabled.value ? e && typeof e == "object" && (Reflect.get(e, Ct) || Reflect.get(e, wt) || Reflect.get(e, Vt) || Reflect.get(e, Tt)) ? Mt(e, n) : t(e, n, (e, t) => {
1867
+ if (r) try {
1868
+ let n = r(e, t);
1869
+ if (typeof n == "string") return n;
1870
+ } catch {}
1871
+ return i;
1872
+ }) : i;
1873
+ }
1874
+ function Wt(...e) {
1875
+ let t = {};
1876
+ for (let n of e) {
1877
+ let e = {
1878
+ ...t,
1879
+ ...n
1880
+ };
1881
+ At([
1882
+ "message",
1883
+ "reason",
1884
+ "error"
1885
+ ].some((e) => Object.hasOwn(n, e)) ? n : t, e), t = e;
1886
+ }
1887
+ return t;
1888
+ }
1889
+ //#endregion
1890
+ //#region src/list/QueryBoundary.ts
1891
+ var Gt = /* @__PURE__ */ new WeakMap();
1892
+ function Kt(e, t) {
1893
+ let n = Gt.get(e) ?? /* @__PURE__ */ new Set(), r = !0;
1894
+ return n.add(t), Gt.set(e, n), () => {
1895
+ r && (r = !1, n.delete(t), !n.size && Gt.get(e) === n && Gt.delete(e));
1896
+ };
1897
+ }
1898
+ function qt(e) {
1899
+ for (let t of [...Gt.get(e) ?? []]) t();
1900
+ }
1901
+ async function Jt(e, t, n, r) {
1902
+ let i = e.value, a = r(), o = !1, s = Kt(e, () => {
1903
+ o = !0, r() === a && n();
1904
+ });
1905
+ try {
1906
+ let s = await t(), c = s?.status === "success" || s?.status === "error" || s?.status === "cancelled" && e.value !== i;
1907
+ return !o && c && r() === a && n(), s;
1908
+ } finally {
1909
+ s();
1910
+ }
1911
+ }
1912
+ //#endregion
1913
+ //#region src/list/Controller.ts
1914
+ var Yt = (e) => X(e), Xt = (e, t) => {
1915
+ if (Object.is(e, t)) return !0;
1916
+ if (e instanceof Date && t instanceof Date) return e.getTime() === t.getTime();
1917
+ if (!e || !t || typeof e != "object" || typeof t != "object") return !1;
1918
+ let n = Object.keys(e);
1919
+ return n.length === Object.keys(t).length && n.every((n) => Object.hasOwn(t, n) && Xt(Reflect.get(e, n), Reflect.get(t, n)));
1920
+ };
1921
+ function Zt(e) {
1922
+ let t = w(), n = e.runtime ?? (t ? Oe(t.appContext.app) : void 0);
1923
+ if (!n) throw $(/* @__PURE__ */ TypeError("列表需要应用或显式runtime"), "pro.list.query.theListRequiresAnApplicationOrAnExplicit");
1924
+ let r = n, i = m(() => G(e.fields));
1925
+ function a(e) {
1926
+ return Object.fromEntries(Object.entries(e).map(([e, t]) => {
1927
+ let n = i.value.find((t) => t.key === e);
1928
+ return [e, n?.clone ? n.clone(t) : Yt(t)];
1929
+ }));
1930
+ }
1931
+ let o = ze(i.value, e.initial, "create"), s = U(a(o)), c = U(a(o)), l = U(null), u = U(null), d = U([]), f = U(!1), p = U(!0), h = U(0), g = U(""), _ = U(), v = U(/* @__PURE__ */ new Set()), y = !1, b = 0, x = 0, S, C, T = e.pageSize ?? 10;
1932
+ if (![
1933
+ 10,
1934
+ 20,
1935
+ 50,
1936
+ 100
1937
+ ].includes(T)) throw $(/* @__PURE__ */ TypeError("无效每页数量"), "pro.list.query.invalidPageSize");
1938
+ let E = (e, t) => ({
1939
+ ...Yt(e),
1940
+ ...t
1941
+ }), D = (e) => e, O = je({
1942
+ runtime: r,
1943
+ source: () => ({
1944
+ api: e.api,
1945
+ query: {
1946
+ query: l.value?.query ?? {},
1947
+ sort: l.value?.sort ?? null
1948
+ },
1949
+ buildPageParams: E,
1950
+ transform: D,
1951
+ rowKey: e.rowKey,
1952
+ immediate: !1,
1953
+ pageSize: l.value?.pageSize ?? T,
1954
+ currentPage: l.value?.currentPage ?? 1
1955
+ }),
1956
+ onSuccess: () => {
1957
+ !p.value || !l.value || (l.value = {
1958
+ ...l.value,
1959
+ currentPage: O.currentPage.value
1960
+ }, u.value = Yt(l.value));
1961
+ }
1962
+ }), k = m(() => p.value && O.hasSucceeded.value && !O.loading.value && !O.error.value && !O.stale.value), A = m(() => !Xt(s.value, c.value));
1963
+ q(i, () => {
1964
+ b++;
1965
+ }, {
1966
+ deep: !0,
1967
+ flush: "sync"
1968
+ });
1969
+ function M(e) {
1970
+ s.value = a(e), b++, d.value = [];
1971
+ }
1972
+ function N() {
1973
+ return !y && p.value;
1974
+ }
1975
+ async function P(e) {
1976
+ if (!N()) return { status: "blocked" };
1977
+ O.clearSelection(), l.value = Yt(e);
1978
+ let t = O.reload({ force: !0 }).then((e) => e.status === "success" ? { status: "success" } : e.status === "error" ? {
1979
+ status: "error",
1980
+ error: e.error
1981
+ } : { status: "cancelled" });
1982
+ C = t;
1983
+ try {
1984
+ return await t;
1985
+ } finally {
1986
+ C === t && (C = void 0);
1987
+ }
1988
+ }
1989
+ async function F(t) {
1990
+ if (!N() || f.value) return { status: "blocked" };
1991
+ let n = ++x, o = b, u = r.epoch, p = a(s.value), m = i.value;
1992
+ f.value = !0;
1993
+ try {
1994
+ let n = t ?? S ?? e.validate, f = [];
1995
+ if (n) {
1996
+ let e = await n();
1997
+ e !== !0 && (f = e === !1 ? [Wt({ key: "" }, Z("pro.list.query.queryValidationFailed", "查询校验失败"), { cause: void 0 })] : e);
1998
+ } else m.some((e) => !e.modes?.query?.hidden && e.modes?.query?.rules?.length) && (f = [Wt({ key: "" }, Z("pro.list.query.queryValidationIsNotReady", "查询校验尚未就绪"), { cause: void 0 })]);
1999
+ if (!N() || r.epoch !== u || b !== o || !Xt(s.value, p) || i.value !== m) return { status: "cancelled" };
2000
+ if (f.length) return d.value = f, { status: "invalid" };
2001
+ let h = Be(m, p, "query", e.queryKeys ?? m.map((e) => e.key));
2002
+ return h.status === "error" ? (d.value = h.issues, { status: "invalid" }) : (d.value = [], c.value = a(p), qt(B.intent), P({
2003
+ query: h.data,
2004
+ sort: l.value?.sort ?? null,
2005
+ currentPage: 1,
2006
+ pageSize: l.value?.pageSize ?? T,
2007
+ scope: r.scope,
2008
+ epoch: u
2009
+ }));
2010
+ } catch (e) {
2011
+ return !N() || r.epoch !== u || b !== o ? { status: "cancelled" } : (d.value = [{
2012
+ key: "",
2013
+ message: e instanceof Error ? e.message : String(e),
2014
+ cause: e
2015
+ }], { status: "invalid" });
2016
+ } finally {
2017
+ n === x && !y && (f.value = !1);
2018
+ }
2019
+ }
2020
+ async function I() {
2021
+ return C || (l.value ? P(l.value) : F());
2022
+ }
2023
+ function R(e, t) {
2024
+ return !N() || v.value.has(e.busyKey ?? e.id) || e.visible?.(t) === !1 || e.enabled?.(t) === !1 ? !1 : e.scope === "independent" ? !0 : !k.value || t && !O.data.value.list.includes(t) ? !1 : e.scope !== "selection" || O.selection.value.rows.length > 0;
2025
+ }
2026
+ let z = r.onInvalidate(() => {
2027
+ b++, x++, f.value = !1, C = void 0, h.value++, p.value = !1, l.value = null, u.value = null, s.value = {}, o = {}, c.value = {}, d.value = [], g.value = "", _.value = void 0, v.value = /* @__PURE__ */ new Set(), O.cancel();
2028
+ });
2029
+ L(() => {
2030
+ y = !0, b++, x++, z(), O.cancel();
2031
+ });
2032
+ let B = {
2033
+ fields: i,
2034
+ draft: s,
2035
+ intent: m(() => l.value),
2036
+ successfulSource: m(() => u.value),
2037
+ dirty: A,
2038
+ issues: m(() => d.value),
2039
+ validating: m(() => f.value),
2040
+ scopeReady: m(() => p.value),
2041
+ session: m(() => h.value),
2042
+ page: O,
2043
+ rowKey: e.rowKey,
2044
+ resultReady: k,
2045
+ actionError: m(() => g.value),
2046
+ formatActionError: (e) => _.value ? Ut(_.value.cause, e, _.value.format, g.value) : g.value,
2047
+ busy: m(() => v.value),
2048
+ setDraft: M,
2049
+ submit: F,
2050
+ refresh: I,
2051
+ retry: I,
2052
+ reset: async (e) => !N() || f.value ? { status: "blocked" } : (M(o), F(e)),
2053
+ setPage: async (e) => !k.value || !Number.isSafeInteger(e) || e < 1 || e > Math.max(1, Math.ceil(O.data.value.total / O.pageSize.value)) || !l.value ? { status: "blocked" } : e === l.value.currentPage ? { status: "success" } : P({
2054
+ ...l.value,
2055
+ currentPage: e
2056
+ }),
2057
+ setPageSize: async (e) => ![
2058
+ 10,
2059
+ 20,
2060
+ 50,
2061
+ 100
2062
+ ].includes(e) || !N() || !l.value ? { status: "blocked" } : P({
2063
+ ...l.value,
2064
+ currentPage: 1,
2065
+ pageSize: e
2066
+ }),
2067
+ setSort: async (e) => e && (!e.field.trim() || !["ascending", "descending"].includes(e.order)) ? { status: "invalid" } : l.value ? P({
2068
+ ...l.value,
2069
+ currentPage: 1,
2070
+ sort: e
2071
+ }) : { status: "blocked" },
2072
+ setResetBaseline: (e) => {
2073
+ o = ze(i.value, e, "edit");
2074
+ },
2075
+ replaceConditions: async (e, t) => !N() || f.value ? { status: "blocked" } : A.value && !t.force ? { status: "conflict" } : (M(ze(i.value, e, "edit")), t.mode === "submit" ? F() : { status: "success" }),
2076
+ resumeScope: (e) => {
2077
+ y || (o = ze(i.value, e, "create"), M(o), c.value = a(o), p.value = !0);
2078
+ },
2079
+ registerValidation: (e) => (S = e, () => {
2080
+ S === e && (S = void 0);
2081
+ }),
2082
+ clearSelection: O.clearSelection,
2083
+ select: (e) => {
2084
+ k.value && e.every((e) => O.data.value.list.includes(e)) && O.selectPage(e);
2085
+ },
2086
+ canAction: R,
2087
+ runAction: async (e, t, n) => {
2088
+ if (!R(e, t)) return { status: "blocked" };
2089
+ let i = e.busyKey ?? e.id, a = r.epoch;
2090
+ v.value = new Set([...v.value, i]), g.value = "", _.value = void 0;
2091
+ try {
2092
+ return await e.run({
2093
+ row: t ? Yt(t) : void 0,
2094
+ selected: Yt(O.selection.value.rows),
2095
+ scope: r.scope,
2096
+ epoch: a,
2097
+ trigger: n
2098
+ }), N() && a === r.epoch ? { status: "success" } : { status: "cancelled" };
2099
+ } catch (t) {
2100
+ return !N() || a !== r.epoch ? { status: "cancelled" } : (g.value = t instanceof Error ? t.message : String(t), _.value = {
2101
+ cause: t,
2102
+ format: e.formatError
2103
+ }, {
2104
+ status: "error",
2105
+ error: t
2106
+ });
2107
+ } finally {
2108
+ if (!y && a === r.epoch) {
2109
+ let e = new Set(v.value);
2110
+ e.delete(i), v.value = e;
2111
+ }
2112
+ }
2113
+ }
2114
+ };
2115
+ return e.immediate !== !1 && j(() => {
2116
+ N() && !l.value && F();
2117
+ }), B;
2118
+ }
2119
+ //#endregion
2120
+ //#region src/list/AsamSearchForm.ts
2121
+ var Qt = {}, $t = [], en = [
2122
+ "controller",
2123
+ "fields",
2124
+ "modelValue",
2125
+ "resetValues",
2126
+ "columns",
2127
+ "collapsedCount",
2128
+ "compact",
2129
+ "card",
2130
+ "size",
2131
+ "fieldLabels",
2132
+ "actionButtonType",
2133
+ "disabled",
2134
+ "loading",
2135
+ "showReset",
2136
+ "submitLabel",
2137
+ "resetLabel"
2138
+ ], tn = S((e, { slots: t, emit: n, expose: r }) => {
2139
+ let i = o(), a = U(), s = U(), c = U(!1), l = U(640), u = U(220), d = U(), f = U(0), p = U([]), h = U(!1), g = `asam-search-${ne()}`, _ = 0, v = m(() => e.compact ?? !e.controller), y = m(() => e.card ?? !e.controller), b = m(() => e.controller?.fields.value ?? e.fields ?? $t), x = m(() => e.controller?.draft.value ?? e.modelValue ?? Qt), S = m(() => e.controller?.issues.value ?? p.value), C = m(() => e.controller?.session.value ?? f.value), w = m(() => e.controller?.validating.value ?? h.value), T = m(() => !e.disabled && (e.controller?.scopeReady.value ?? !0)), E = m(() => Ue(b.value, "query")), O = m(() => b.value.filter((e) => !e.modes?.query?.hidden)), k = m(() => l.value - u.value - 24), A = m(() => v.value ? k.value >= 280 : l.value >= 720), M = m(() => !v.value && e.columns === void 0 && O.value.length === 1 && !O.value[0]?.modes?.query?.layout), N = m(() => v.value ? Math.min(e.columns ?? 3, Math.max(1, Math.floor((k.value + 24) / 304))) : l.value < 480 ? 1 : e.columns ?? 2), P = m(() => v.value ? Math.min(e.collapsedCount ?? 3, N.value) : e.collapsedCount ?? 2), F = (e) => !c.value && O.value.findIndex((t) => t.key === e) >= P.value;
2140
+ async function I(e) {
2141
+ O.value.some((t) => t.key === e) && (F(e) && (c.value = !0), await j(), (a.value?.querySelector(`[data-query-field="${e}"]`))?.querySelector("input,textarea,button,[tabindex=\"0\"]")?.focus());
2142
+ }
2143
+ async function L() {
2144
+ if (await j(), !s.value) return !1;
2145
+ try {
2146
+ return await s.value.validate();
2147
+ } catch (e) {
2148
+ return e instanceof Error ? [{
2149
+ key: "",
2150
+ message: e.message,
2151
+ cause: e
2152
+ }] : Object.entries(e).flatMap(([t, n]) => n.map((n) => Wt({ key: t }, n.message === void 0 ? Z("pro.list.query.validationFailed", "校验失败") : { message: n.message }, { cause: e })));
2153
+ }
2154
+ }
2155
+ function R(t) {
2156
+ e.controller ? e.controller.setDraft(t) : n("update:modelValue", t);
2157
+ }
2158
+ async function z(t) {
2159
+ if (!T.value || e.loading) return { status: "blocked" };
2160
+ if (e.controller) return e.controller[t](L);
2161
+ if (h.value) return { status: "blocked" };
2162
+ h.value = !0;
2163
+ try {
2164
+ t === "reset" && (R(ze(b.value, e.resetValues ?? {}, "create")), f.value++), await j();
2165
+ let r = x.value, o = b.value, s = _, c = await L();
2166
+ if (!a.value || !T.value || e.controller || s !== _) return { status: "cancelled" };
2167
+ if (c !== !0) return p.value = c === !1 ? [{
2168
+ key: "",
2169
+ message: i.t("pro.list.query.queryValidationFailed"),
2170
+ cause: void 0
2171
+ }] : c, { status: "invalid" };
2172
+ let l = Be(o, r, "query", o.map((e) => e.key));
2173
+ return l.status === "error" ? (p.value = l.issues, { status: "invalid" }) : (p.value = [], n(t === "reset" ? "reset" : "submit", l.data), { status: "success" });
2174
+ } catch (e) {
2175
+ return p.value = [{
2176
+ key: "",
2177
+ message: e instanceof Error ? e.message : String(e),
2178
+ cause: e
2179
+ }], { status: "invalid" };
2180
+ } finally {
2181
+ h.value = !1;
2182
+ }
2183
+ }
2184
+ return q(() => e.controller, (e, t, n) => {
2185
+ e && n(e.registerValidation(L));
2186
+ }, { immediate: !0 }), q(C, () => s.value?.clearValidate(), { flush: "sync" }), q([x, b], () => {
2187
+ e.controller || (_++, p.value = []);
2188
+ }, {
2189
+ deep: !0,
2190
+ flush: "sync"
2191
+ }), q(S, (e) => {
2192
+ let t = e[0]?.key;
2193
+ t && I(t);
2194
+ }), q([a, d], ([e, t], n, r) => {
2195
+ if (!e || !t || typeof ResizeObserver > "u") return;
2196
+ let i = new ResizeObserver((n) => {
2197
+ for (let r of n) r.target === e && (l.value = r.contentRect.width), r.target === t && (u.value = r.contentRect.width);
2198
+ });
2199
+ i.observe(e), i.observe(t), r(() => i.disconnect());
2200
+ }, { flush: "post" }), r({
2201
+ submit: () => z("submit"),
2202
+ reset: () => z("reset"),
2203
+ focus: I
2204
+ }), () => {
2205
+ let n = e.controller, r = M.value ? 1 : N.value, o = D("div", {
2206
+ ref: d,
2207
+ class: "asam-pro-search-actions",
2208
+ style: {
2209
+ display: "flex",
2210
+ flexWrap: "wrap",
2211
+ justifyContent: "flex-end",
2212
+ alignItems: "center",
2213
+ width: v.value ? "max-content" : void 0,
2214
+ maxWidth: "100%",
2215
+ justifySelf: "end",
2216
+ minWidth: 0,
2217
+ flex: M.value ? "0 1 auto" : void 0,
2218
+ gap: "var(--asam-space-2, 8px)"
2219
+ }
2220
+ }, [
2221
+ D(Y, {
2222
+ class: "asam-pro-message-button",
2223
+ type: e.actionButtonType ?? "primary",
2224
+ size: e.size,
2225
+ disabled: !T.value || w.value || e.loading,
2226
+ loading: e.loading,
2227
+ onClick: () => z("submit")
2228
+ }, () => w.value ? i.t("pro.list.query.validating") : e.submitLabel ?? i.t("pro.list.query.search")),
2229
+ e.showReset === !1 ? null : D(Y, {
2230
+ class: "asam-pro-message-button",
2231
+ size: e.size,
2232
+ type: e.actionButtonType ?? "primary",
2233
+ plain: !0,
2234
+ disabled: !T.value || w.value || e.loading,
2235
+ onClick: () => z("reset")
2236
+ }, () => e.resetLabel ?? i.t("pro.list.query.reset")),
2237
+ O.value.length > P.value ? D(Y, {
2238
+ class: "asam-pro-message-button asam-pro-search-toggle",
2239
+ size: e.size,
2240
+ text: !0,
2241
+ type: e.actionButtonType ?? "primary",
2242
+ autoInsertSpace: !1,
2243
+ title: i.t("pro.list.query.expandCollapsedFieldsStillParticipateInQueries"),
2244
+ iconPosition: "right",
2245
+ icon: () => D("svg", {
2246
+ width: 14,
2247
+ height: 14,
2248
+ viewBox: "0 0 24 24",
2249
+ fill: "none",
2250
+ stroke: "currentColor",
2251
+ "stroke-width": 2,
2252
+ "aria-hidden": !0
2253
+ }, [D("path", { d: c.value ? "M6 15l6-6 6 6" : "M6 9l6 6 6-6" })]),
2254
+ "aria-expanded": c.value,
2255
+ "aria-controls": `${g}-fields`,
2256
+ onClick: () => {
2257
+ c.value = !c.value;
2258
+ }
2259
+ }, () => c.value ? i.t("pro.list.query.collapse") : i.t("pro.list.query.expand")) : null,
2260
+ n ? t.actions?.({ controller: n }) : null
2261
+ ]), l = () => D("div", {
2262
+ id: `${g}-fields`,
2263
+ style: {
2264
+ display: "grid",
2265
+ width: M.value ? void 0 : "100%",
2266
+ minWidth: 0,
2267
+ flex: M.value ? N.value === 1 ? "1 1 100%" : "1 1 calc((100% - var(--asam-space-4, 16px)) / 2)" : void 0,
2268
+ gridTemplateColumns: `repeat(${r}, minmax(0, 1fr))`,
2269
+ gap: v.value ? "16px 24px" : "var(--asam-space-4, 16px)"
2270
+ }
2271
+ }, O.value.flatMap((t, n) => {
2272
+ let i = t.modes?.query, a = E.value.schema.find((e) => e.field === t.key), o = F(t.key), s = i?.layout?.group;
2273
+ return [s && O.value[n - 1]?.modes?.query?.layout?.group !== s ? D("h3", { style: {
2274
+ gridColumn: "1 / -1",
2275
+ display: o ? "none" : void 0,
2276
+ margin: "0"
2277
+ } }, s) : null, D(he, {
2278
+ key: `${C.value}-${t.key}`,
2279
+ class: "asam-pro-search-field",
2280
+ prop: t.key,
2281
+ label: e.fieldLabels?.[t.key] ?? t.label,
2282
+ rules: a?.rules ? [...a.rules] : [],
2283
+ style: {
2284
+ display: o ? "none" : void 0,
2285
+ minWidth: "0",
2286
+ margin: 0,
2287
+ overflowWrap: "anywhere",
2288
+ gridColumn: `span ${Math.min(r, i?.layout?.span ?? 1)}`
2289
+ }
2290
+ }, { default: () => D("div", {
2291
+ "data-query-field": t.key,
2292
+ style: {
2293
+ width: "100%",
2294
+ minWidth: "0"
2295
+ }
2296
+ }, [D(He, {
2297
+ field: t,
2298
+ displayLabel: e.fieldLabels?.[t.key],
2299
+ modelValue: Object.hasOwn(x.value, t.key) ? x.value[t.key] : void 0,
2300
+ mode: "query",
2301
+ session: C.value,
2302
+ active: T.value,
2303
+ disabled: w.value,
2304
+ "aria-label": e.fieldLabels?.[t.key] ?? t.label,
2305
+ "aria-describedby": S.value.some((e) => e.key === t.key) ? `${g}-errors` : void 0,
2306
+ "onUpdate:modelValue": (e) => R({
2307
+ ...x.value,
2308
+ [t.key]: e
2309
+ })
2310
+ })]) })];
2311
+ })), u = D("section", {
2312
+ ref: a,
2313
+ class: ["asam-pro-search-form", { "asam-pro-search-compact": v.value }],
2314
+ "aria-label": i.t("pro.list.query.queryConditions"),
2315
+ style: {
2316
+ minWidth: "0",
2317
+ width: "100%",
2318
+ "--asam-layout-control-width": "100%",
2319
+ "--asam-layout-date-control-width": "100%",
2320
+ display: "grid",
2321
+ gap: "var(--asam-space-4, 16px)"
2322
+ }
2323
+ }, [
2324
+ D(Ze, {
2325
+ class: "asam-pro-search-validation",
2326
+ id: `${g}-errors`,
2327
+ count: S.value.length,
2328
+ label: i.t("pro.list.query.validationFailed")
2329
+ }, { default: () => S.value.map((e, t) => D("div", { key: t }, e.key ? D(Y, {
2330
+ type: "default",
2331
+ text: !0,
2332
+ class: "asam-pro-message-button",
2333
+ onClick: () => I(e.key)
2334
+ }, () => zt(e, i)) : zt(e, i))) }),
2335
+ D(me, {
2336
+ ref: s,
2337
+ modelValue: x.value,
2338
+ schema: [],
2339
+ showSearch: !1,
2340
+ showReset: !1,
2341
+ labelPosition: "left",
2342
+ labelWidth: "",
2343
+ inline: !0,
2344
+ size: e.size,
2345
+ onKeydownCapture: (e) => {
2346
+ let t = e.target, n = t.closest("[data-query-field]")?.dataset.queryField;
2347
+ b.value.some((e) => e.key === n && e.kind === "text") && e.key === "Enter" && !e.isComposing && e.keyCode !== 229 && t.tagName === "INPUT" && [
2348
+ "text",
2349
+ "search",
2350
+ "number",
2351
+ "email",
2352
+ ""
2353
+ ].includes(t.type) && (e.preventDefault(), e.stopPropagation(), z("submit"));
2354
+ }
2355
+ }, {
2356
+ default: () => D("div", {
2357
+ class: "asam-pro-search-layout",
2358
+ style: {
2359
+ display: M.value ? "flex" : "grid",
2360
+ flexWrap: M.value ? "wrap" : void 0,
2361
+ minWidth: 0,
2362
+ gridTemplateColumns: A.value ? "minmax(0, 1fr) auto" : "minmax(0, 1fr)",
2363
+ gap: v.value ? "16px 24px" : "var(--asam-space-4, 16px)",
2364
+ alignItems: v.value && !c.value ? "center" : "end"
2365
+ }
2366
+ }, [l(), o]),
2367
+ actions: () => null
2368
+ }),
2369
+ t.footer?.()
2370
+ ]);
2371
+ return y.value ? D(oe, {
2372
+ class: ["asam-pro-search-card", { "asam-pro-search-card-compact": v.value }],
2373
+ bodyClass: "asam-pro-search-card-body",
2374
+ bordered: !v.value,
2375
+ shadow: "never"
2376
+ }, () => u) : u;
2377
+ };
2378
+ }, {
2379
+ name: "AsamSearchForm",
2380
+ props: [...en],
2381
+ emits: [
2382
+ "update:modelValue",
2383
+ "submit",
2384
+ "reset"
2385
+ ]
2386
+ });
2387
+ Object.assign(tn, { props: {
2388
+ ...Object.fromEntries(en.map((e) => [e, null])),
2389
+ compact: {
2390
+ type: Boolean,
2391
+ default: void 0
2392
+ },
2393
+ card: {
2394
+ type: Boolean,
2395
+ default: void 0
2396
+ },
2397
+ disabled: Boolean,
2398
+ loading: Boolean,
2399
+ showReset: {
2400
+ type: Boolean,
2401
+ default: void 0
2402
+ }
2403
+ } });
2404
+ //#endregion
2405
+ //#region src/table/ActionIcon.ts
2406
+ function nn(e, t, n, r, i = !1, a, o, s = !1) {
2407
+ return D(Ce, {
2408
+ content: e,
2409
+ triggerKeys: []
2410
+ }, { default: () => D("span", { style: { display: "inline-flex" } }, [D(Y, {
2411
+ class: "asam-pro-table-action-icon",
2412
+ size: r,
2413
+ disabled: i,
2414
+ loading: s,
2415
+ "aria-label": e,
2416
+ "aria-expanded": a,
2417
+ "aria-pressed": o,
2418
+ type: "primary",
2419
+ text: !o,
2420
+ onClick: t,
2421
+ style: {
2422
+ marginInlineStart: 0,
2423
+ paddingInline: "var(--asam-space-2, 8px)"
2424
+ }
2425
+ }, () => D("svg", {
2426
+ width: 16,
2427
+ height: 16,
2428
+ viewBox: "0 0 24 24",
2429
+ fill: "none",
2430
+ stroke: "currentColor",
2431
+ "stroke-width": 1.8,
2432
+ "aria-hidden": "true",
2433
+ focusable: "false"
2434
+ }, n === "refresh" ? [D("path", { d: "M20 7v5h-5M4 17v-5h5M5.5 8a7 7 0 0 1 11.6-3L20 8M4 16l2.9 3A7 7 0 0 0 18.5 16" })] : n === "density" || n === "fullscreen" ? [D("path", { d: n === "density" ? "M4 6h16M4 12h16M4 18h16M8 3v6M16 9v6M10 15v6" : "M9 4H4v5M15 4h5v5M4 15v5h5M20 15v5h-5" })] : [D("rect", {
2435
+ x: 3,
2436
+ y: 4,
2437
+ width: 18,
2438
+ height: 16,
2439
+ rx: 2
2440
+ }), D("path", { d: n === "border" ? "M3 10h18M3 15h18M10 4v16M16 4v16" : "M9 4v16M15 4v16" })]))]) });
2441
+ }
2442
+ //#endregion
2443
+ //#region src/table/Appearance.ts
2444
+ var rn = {
2445
+ stripe: {
2446
+ type: Boolean,
2447
+ default: void 0
2448
+ },
2449
+ border: {
2450
+ type: Boolean,
2451
+ default: void 0
2452
+ }
2453
+ };
2454
+ function an(e, t) {
2455
+ Object.assign(e, { props: {
2456
+ ...Object.fromEntries(t.map((e) => [e, null])),
2457
+ ...rn
2458
+ } });
2459
+ }
2460
+ function on(e, t) {
2461
+ let n = o(), r = U(e.border ?? !1);
2462
+ return q(() => e.border, (e) => {
2463
+ r.value = e ?? !1;
2464
+ }), {
2465
+ border: r,
2466
+ resizeBindings: (e) => ({
2467
+ border: r.value || e,
2468
+ "data-asam-pro-visual-border": String(r.value)
2469
+ }),
2470
+ toggleButton: (i = !1) => nn(n.t("pro.table.appearance.showBorders"), () => {
2471
+ i || (r.value = !r.value, t(r.value));
2472
+ }, "border", e.size, i, void 0, r.value)
2473
+ };
2474
+ }
2475
+ //#endregion
2476
+ //#region src/table/TableToolbar.vue?vue&type=script&setup=true&lang.ts
2477
+ var sn = ["aria-label"], cn = {
2478
+ key: 0,
2479
+ class: "asam-operations-tools"
2480
+ }, ln = /* @__PURE__ */ S({
2481
+ __name: "TableToolbar",
2482
+ props: { label: {} },
2483
+ setup(e) {
2484
+ return (t, n) => (R(), _("div", {
2485
+ class: "asam-operations-toolbar",
2486
+ role: "toolbar",
2487
+ "aria-label": e.label
2488
+ }, [H(t.$slots, "default"), t.$slots.tools ? (R(), _("div", cn, [H(t.$slots, "tools")])) : g("", !0)], 8, sn));
2489
+ }
2490
+ }), un = {}, dn = { class: "asam-operations-viewport" };
2491
+ function fn(e, t) {
2492
+ return R(), _("div", dn, [H(e.$slots, "default")]);
2493
+ }
2494
+ var pn = /* @__PURE__ */ d(un, [["render", fn]]);
2495
+ //#endregion
2496
+ //#region src/table/renderTableInViewport.ts
2497
+ function mn(e, t, n) {
2498
+ return D(pn, null, { default: () => [n, D(xe, e, { ...t })] });
2499
+ }
2500
+ //#endregion
2501
+ //#region src/table/TablePagination.vue?vue&type=script&setup=true&lang.ts
2502
+ var hn = { class: "asam-operations-pagination" }, gn = { "data-asam-field-caption": "" }, _n = /* @__PURE__ */ S({
2503
+ __name: "TablePagination",
2504
+ props: {
2505
+ size: { default: void 0 },
2506
+ currentPage: {},
2507
+ pageSize: {},
2508
+ pageSizes: { default: () => [
2509
+ 10,
2510
+ 20,
2511
+ 50,
2512
+ 100
2513
+ ] },
2514
+ total: {},
2515
+ disabled: { type: Boolean },
2516
+ sizeDisabled: {
2517
+ type: Boolean,
2518
+ default: void 0
2519
+ },
2520
+ perPageLabels: { type: Boolean }
2521
+ },
2522
+ emits: ["page-change", "page-size-change"],
2523
+ setup(e, { emit: t }) {
2524
+ let n = e, r = t, i = o(), a = m(() => n.pageSizes.map((e) => ({
2525
+ value: e,
2526
+ label: n.perPageLabels ? i.t("pro.list.query.perPage", { value1: e }) : String(e),
2527
+ raw: { value: e }
2528
+ })));
2529
+ function s(e) {
2530
+ typeof e == "number" && n.pageSizes.includes(e) && r("page-size-change", e);
2531
+ }
2532
+ return (t, n) => (R(), _("div", hn, [v("div", gn, [b(W(K(i).t("pro.table.operations.itemsPerPage")) + " ", 1), x(K(be), {
2533
+ "aria-label": K(i).t("pro.table.operations.itemsPerPage"),
2534
+ size: e.size,
2535
+ "model-value": e.pageSize,
2536
+ options: a.value,
2537
+ disabled: e.sizeDisabled ?? e.disabled,
2538
+ "onUpdate:modelValue": s
2539
+ }, null, 8, [
2540
+ "aria-label",
2541
+ "size",
2542
+ "model-value",
2543
+ "options",
2544
+ "disabled"
2545
+ ])]), x(K(ve), {
2546
+ size: e.size,
2547
+ "current-page": e.currentPage,
2548
+ "page-size": e.pageSize,
2549
+ total: e.total,
2550
+ disabled: e.disabled,
2551
+ layout: "total, prev, pager, next",
2552
+ onPageChange: n[0] ||= (e) => r("page-change", e)
2553
+ }, null, 8, [
2554
+ "size",
2555
+ "current-page",
2556
+ "page-size",
2557
+ "total",
2558
+ "disabled"
2559
+ ])]));
2560
+ }
2561
+ });
2562
+ //#endregion
2563
+ //#region src/list/RowActionAdapter.ts
2564
+ function vn(e, t = {}) {
2565
+ let n = U();
2566
+ return (r, i) => r.filter((e) => e.visible?.(i) !== !1).map((a) => {
2567
+ let o = e(), s = t.context?.(), c = () => o === e() && s === t.context?.() && r.includes(a) && a.visible?.(i) !== !1 && t.current?.(a, i) !== !1, l = () => t.blocked?.(a, i) === !0, u = o.busy.value.has(a.busyKey ?? a.id);
2568
+ return {
2569
+ key: `list:${a.id}`,
2570
+ label: a.label,
2571
+ presentation: a.button,
2572
+ busy: u || t.busy?.(a) === !0,
2573
+ disabled: !c() || l() || !o.canAction(a, i),
2574
+ retainFocus: !!a.retainFocusWhileBusy && c() && !l() && n.value?.controller === o && n.value.action === a && n.value.context === s && n.value.row === i && n.value.element.isConnected && a.enabled?.(i) !== !1 && u,
2575
+ invoke: async (e) => {
2576
+ if (!c() || l() || !o.canAction(a, i)) return;
2577
+ let t = a.retainFocusWhileBusy && e ? {
2578
+ controller: o,
2579
+ action: a,
2580
+ row: i,
2581
+ context: s,
2582
+ element: e
2583
+ } : void 0;
2584
+ t && (n.value = t);
2585
+ try {
2586
+ return await o.runAction(a, i, e);
2587
+ } finally {
2588
+ n.value === t && (n.value = void 0);
2589
+ }
2590
+ }
2591
+ };
2592
+ });
2593
+ }
2594
+ //#endregion
2595
+ //#region src/display/shared/OverlayStyle.ts
2596
+ function yn(e, t) {
2597
+ let n = U({}), r, i;
2598
+ function a() {
2599
+ let t = e.value, r = t?.ownerDocument.defaultView;
2600
+ if (!t || !r) return;
2601
+ let i = r.getComputedStyle(t), a = {
2602
+ colorScheme: i.colorScheme,
2603
+ fontFamily: i.fontFamily
2604
+ };
2605
+ for (let e = 0; e < i.length; e++) {
2606
+ let t = i.item(e);
2607
+ (t.startsWith("--asam-") || t.startsWith("--el-")) && (a[t] = i.getPropertyValue(t));
2608
+ }
2609
+ (Object.keys(a).length !== Object.keys(n.value).length || Object.entries(a).some(([e, t]) => t !== n.value[e])) && (n.value = a);
2610
+ }
2611
+ function o() {
2612
+ r?.disconnect(), r = void 0, i?.removeEventListener("resize", a), i = void 0;
2613
+ }
2614
+ function s() {
2615
+ o();
2616
+ let t = e.value, n = t?.ownerDocument.defaultView;
2617
+ if (!(!t || !n)) {
2618
+ i = n, a(), r = new n.MutationObserver(a);
2619
+ for (let e = t; e; e = e.parentElement) r.observe(e, {
2620
+ attributes: !0,
2621
+ attributeFilter: [
2622
+ "class",
2623
+ "style",
2624
+ "data-color-mode",
2625
+ "data-size"
2626
+ ]
2627
+ });
2628
+ n.addEventListener("resize", a, { passive: !0 });
2629
+ }
2630
+ }
2631
+ return I(() => {
2632
+ t ? q(t, (e) => e ? s() : o(), { immediate: !0 }) : s();
2633
+ }), F(o), {
2634
+ style: n,
2635
+ refresh: a
2636
+ };
2637
+ }
2638
+ //#endregion
2639
+ //#region src/table/RowActionPresentation.ts
2640
+ function bn(e) {
2641
+ return {
2642
+ type: e?.type ?? "primary",
2643
+ plain: e?.type === "danger" || (e?.plain ?? !0),
2644
+ link: !1,
2645
+ text: !1
2646
+ };
2647
+ }
2648
+ //#endregion
2649
+ //#region src/table/RowActions.ts
2650
+ var xn = Symbol("asam-row-action-hover-intent");
2651
+ function Sn() {
2652
+ let e, t, n = (n) => {
2653
+ e = {
2654
+ x: Math.trunc(n.clientX),
2655
+ y: Math.trunc(n.clientY)
2656
+ }, t && (t.x !== e.x || t.y !== e.y) && (t = void 0);
2657
+ }, r = () => {
2658
+ t = void 0;
2659
+ };
2660
+ return I(() => {
2661
+ document.addEventListener("pointermove", n, {
2662
+ capture: !0,
2663
+ passive: !0
2664
+ }), document.addEventListener("pointerdown", r, {
2665
+ capture: !0,
2666
+ passive: !0
2667
+ });
2668
+ }), F(() => {
2669
+ document.removeEventListener("pointermove", n, !0), document.removeEventListener("pointerdown", r, !0);
2670
+ }), {
2671
+ dismiss: () => {
2672
+ t = e;
2673
+ },
2674
+ accepts: (e) => !t || Math.trunc(e.clientX) !== t.x || Math.trunc(e.clientY) !== t.y
2675
+ };
2676
+ }
2677
+ var Cn = S({
2678
+ name: "AsamInternalRowActions",
2679
+ props: {
2680
+ items: {
2681
+ type: Array,
2682
+ required: !0
2683
+ },
2684
+ size: {
2685
+ type: String,
2686
+ default: void 0
2687
+ },
2688
+ identity: {
2689
+ type: Object,
2690
+ default: void 0
2691
+ },
2692
+ rowToken: {
2693
+ type: Object,
2694
+ required: !0
2695
+ },
2696
+ hoverIntent: {
2697
+ type: Object,
2698
+ required: !0
2699
+ },
2700
+ session: {
2701
+ type: Number,
2702
+ default: void 0
2703
+ },
2704
+ ready: Boolean
2705
+ },
2706
+ setup(e) {
2707
+ let t = o(), n = U(), r = U(!1), { style: i, refresh: a } = yn(n, r), s = U(), c = U(), l = () => e.items.length > 3 ? 2 : e.items.length, u = U(l()), d = m(() => e.items.slice(0, u.value)), f = m(() => e.items.slice(u.value)), p, h = -1, g = !1, _ = 0, v, y, b, x, S = () => s.value?.handleClose(), C = () => c.value?.ref, w = (t) => {
2708
+ e.hoverIntent.accepts(t) || t.stopImmediatePropagation();
2709
+ };
2710
+ function T(e) {
2711
+ let t = e?.getAttribute("aria-controls");
2712
+ return (t ? e?.ownerDocument.getElementById(t) : void 0)?.closest(".asam-pro-row-action-menu");
2713
+ }
2714
+ async function E() {
2715
+ if (await j(), g) return;
2716
+ let e = T(C()) ?? void 0;
2717
+ e !== b && (b?.removeEventListener("mouseenter", w, !0), b = e, b?.addEventListener("mouseenter", w, !0));
2718
+ }
2719
+ function O() {
2720
+ y?.(), v !== void 0 && cancelAnimationFrame(v), v = void 0;
2721
+ }
2722
+ function k(e) {
2723
+ let t = T(e);
2724
+ return !t || !t.getClientRects().length ? Promise.resolve(!0) : new Promise((e) => {
2725
+ let n = (t) => {
2726
+ i.disconnect(), y === r && (y = void 0), e(t);
2727
+ }, r = () => n(!1), i = new MutationObserver(() => {
2728
+ (!t.isConnected || !t.getClientRects().length) && n(!0);
2729
+ });
2730
+ y = r, i.observe(t, {
2731
+ attributes: !0,
2732
+ attributeFilter: [
2733
+ "style",
2734
+ "class",
2735
+ "hidden"
2736
+ ]
2737
+ }), t.parentElement && i.observe(t.parentElement, { childList: !0 });
2738
+ });
2739
+ }
2740
+ async function A(t) {
2741
+ if (t.key !== "Escape") return;
2742
+ t.preventDefault(), t.stopPropagation(), e.hoverIntent.dismiss();
2743
+ let n = x ?? C(), r = M();
2744
+ O(), S(), await j(), !(g || r.some((e, t) => e !== M()[t])) && await k(n) && (v = requestAnimationFrame(() => {
2745
+ v = void 0, !g && e.ready && r.every((e, t) => e === M()[t]) && n?.isConnected && !n.matches(":disabled") && !n.closest("[inert]") && n.focus({ preventScroll: !0 });
2746
+ }));
2747
+ }
2748
+ let M = () => [
2749
+ e.identity,
2750
+ e.rowToken,
2751
+ e.session,
2752
+ e.ready
2753
+ ];
2754
+ async function N(t = !1) {
2755
+ if (e.items.some((e) => e.retainFocus)) return;
2756
+ let r = ++_;
2757
+ for (t && (u.value = l()), await j(); !g && r === _ && n.value && u.value > 0 && !(n.value.scrollWidth <= n.value.clientWidth + 1);) u.value--, await j();
2758
+ }
2759
+ q(() => JSON.stringify([
2760
+ e.items.map((e) => [e.key, e.label]),
2761
+ e.size,
2762
+ e.items.some((e) => e.retainFocus)
2763
+ ]), () => void N(!0), { deep: !0 }), q(M, () => {
2764
+ O(), x = void 0, S();
2765
+ }), q(() => e.items.length > 0 && e.items.every((e) => e.disabled) && !e.items.some((e) => e.retainFocus), (e) => {
2766
+ e && S();
2767
+ }), I(() => {
2768
+ p = new ResizeObserver(([e]) => {
2769
+ e && e.contentRect.width !== h && (h = e.contentRect.width, N(!0));
2770
+ }), n.value && p.observe(n.value), N(!0);
2771
+ }), F(() => {
2772
+ g = !0, O(), b?.removeEventListener("mouseenter", w, !0), p?.disconnect(), S();
2773
+ });
2774
+ async function P(t) {
2775
+ let n = M();
2776
+ if (e.hoverIntent.dismiss(), S(), await j(), g || n.some((e, t) => e !== M()[t])) return;
2777
+ let r = f.value.find((e) => e.key === t);
2778
+ if (!r || r.disabled) return;
2779
+ let i = C();
2780
+ i?.focus({ preventScroll: !0 });
2781
+ try {
2782
+ await r.invoke(i ?? void 0);
2783
+ } finally {
2784
+ !g && n.every((e, t) => e === M()[t]) && e.hoverIntent.dismiss();
2785
+ }
2786
+ }
2787
+ return () => D("div", {
2788
+ ref: n,
2789
+ class: "asam-pro-table-row-actions asam-pro-row-actions-inline",
2790
+ "aria-busy": e.items.some((e) => e.busy) || void 0
2791
+ }, [...d.value.map((t) => D(Y, {
2792
+ key: t.key,
2793
+ class: "asam-pro-message-button",
2794
+ size: e.size,
2795
+ ...bn(t.presentation),
2796
+ disabled: t.disabled && !t.retainFocus,
2797
+ "aria-disabled": t.disabled || void 0,
2798
+ "aria-busy": t.busy || void 0,
2799
+ onClick: (e) => !t.disabled && t.invoke(e.currentTarget instanceof HTMLElement ? e.currentTarget : void 0)
2800
+ }, () => t.label)), f.value.length ? D(ue, {
2801
+ key: "more",
2802
+ ref: s,
2803
+ class: "asam-pro-row-more",
2804
+ popperClass: "asam-pro-row-action-menu",
2805
+ popperStyle: i.value,
2806
+ trigger: "click",
2807
+ offset: 4,
2808
+ disabled: f.value.every((e) => e.disabled),
2809
+ size: e.size,
2810
+ onCommand: P,
2811
+ onVisibleChange: (e) => {
2812
+ r.value = e, e && (a(), E(), O(), x = C());
2813
+ }
2814
+ }, {
2815
+ default: () => D(Y, {
2816
+ ref: c,
2817
+ size: e.size,
2818
+ onKeydown: A,
2819
+ onMouseenterCapture: w,
2820
+ type: "primary",
2821
+ plain: !0,
2822
+ disabled: f.value.every((e) => e.disabled) && !f.value.some((e) => e.retainFocus),
2823
+ "aria-disabled": f.value.every((e) => e.disabled) || void 0
2824
+ }, () => t.t("pro.table.actions.more")),
2825
+ dropdown: () => D(fe, { onKeydownCapture: A }, () => f.value.map((e) => D(de, {
2826
+ key: e.key,
2827
+ command: e.key,
2828
+ disabled: e.disabled,
2829
+ class: { "asam-pro-row-action-danger": e.presentation?.type === "danger" }
2830
+ }, () => e.label)))
2831
+ }) : null]);
2832
+ }
2833
+ }), wn = S({
2834
+ name: "AsamInternalColumnVisibility",
2835
+ props: {
2836
+ items: {
2837
+ type: Array,
2838
+ required: !0
2839
+ },
2840
+ setVisible: {
2841
+ type: Function,
2842
+ required: !0
2843
+ },
2844
+ message: {
2845
+ type: String,
2846
+ default: void 0
2847
+ },
2848
+ popperClass: {
2849
+ type: String,
2850
+ default: "asam-pro-column-visibility"
2851
+ },
2852
+ ready: Boolean,
2853
+ session: {
2854
+ type: [String, Number],
2855
+ default: void 0
2856
+ },
2857
+ size: {
2858
+ type: String,
2859
+ default: void 0
2860
+ }
2861
+ },
2862
+ setup(e) {
2863
+ let t = o(), n = U(!1), r = U();
2864
+ q(() => e.ready, (e) => {
2865
+ e || (n.value = !1);
2866
+ }), q(() => e.session, () => {
2867
+ n.value = !1;
2868
+ });
2869
+ async function i(e) {
2870
+ e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), n.value = !1, await j(), r.value?.querySelector("button")?.focus());
2871
+ }
2872
+ return () => D(ye, {
2873
+ visible: n.value,
2874
+ "onUpdate:visible": (e) => {
2875
+ n.value = e;
2876
+ },
2877
+ trigger: "click",
2878
+ placement: "bottom-end",
2879
+ width: 240,
2880
+ title: t.t("pro.table.operations.columnSettings"),
2881
+ popperClass: e.popperClass,
2882
+ disabled: !e.ready
2883
+ }, {
2884
+ reference: () => D("span", { ref: r }, [nn(t.t("pro.table.operations.columnSettings"), () => void 0, "columns", e.size, !e.ready, n.value)]),
2885
+ default: () => D("div", {
2886
+ onKeydown: i,
2887
+ style: {
2888
+ display: "grid",
2889
+ gap: "var(--asam-space-2, 8px)"
2890
+ }
2891
+ }, [...e.items.map((t) => D(se, {
2892
+ key: t.key,
2893
+ modelValue: t.visible,
2894
+ size: e.size,
2895
+ disabled: !e.ready || !!t.required || t.visible && e.items.filter((e) => e.visible).length === 1,
2896
+ "onUpdate:modelValue": (n) => {
2897
+ e.ready && e.setVisible(t.key, n === !0);
2898
+ }
2899
+ }, () => t.label)), e.message ? D("p", { role: "status" }, e.message) : null])
2900
+ });
2901
+ }
2902
+ });
2903
+ //#endregion
2904
+ //#region src/table/structured/Forest.ts
2905
+ function Tn(e) {
2906
+ if (typeof e == "number" && Number.isFinite(e)) return `n:${e}`;
2907
+ if (typeof e == "string") return `s:${e}`;
2908
+ throw $(/* @__PURE__ */ TypeError("rowKey 必须为字符串或有限数值"), "pro.table.structured.rowKeysMustBeStringsOrFiniteNumbers");
2909
+ }
2910
+ function En(e, t, n) {
2911
+ if (![
2912
+ "flat",
2913
+ "tree",
2914
+ "lazy-tree"
2915
+ ].includes(t.mode)) throw $(/* @__PURE__ */ TypeError("未知结构表格模式"), "pro.table.structured.unknownStructuredTableMode");
2916
+ let r = t.maxNodes ?? 1e3, i = t.maxDepth ?? 16;
2917
+ if (![r, i].every((e) => Number.isSafeInteger(e) && e > 0)) throw $(/* @__PURE__ */ TypeError("节点和深度上限必须为正整数"), "pro.table.structured.nodeAndDepthLimitsMustBePositiveIntegers");
2918
+ let a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = e, c;
2919
+ if (t.parentKey !== void 0) {
2920
+ if (t.mode !== "tree" || t.children !== void 0 || e.length > r) throw $(/* @__PURE__ */ TypeError("parentKey 仅用于预算内的预加载平铺 tree,不能同时指定 children"), "pro.table.structured.parentKeyRequiresPreloadedTree");
2921
+ let n = /* @__PURE__ */ new Map(), i = (e) => Tn(typeof t.rowKey == "function" ? t.rowKey(e) : e[t.rowKey]);
2922
+ for (let t of e) {
2923
+ if (!t || typeof t != "object") throw $(/* @__PURE__ */ TypeError("行必须为对象"), "pro.table.structured.rowsMustBeObjects");
2924
+ let e = i(t);
2925
+ if (n.has(e)) throw $(/* @__PURE__ */ TypeError("森林存在重复 rowKey"), "pro.table.structured.theForestContainsDuplicateRowKeys");
2926
+ n.set(e, t);
2927
+ }
2928
+ c = /* @__PURE__ */ new Map();
2929
+ let a = [];
2930
+ for (let r of e) {
2931
+ let e = typeof t.parentKey == "function" ? t.parentKey(r) : r[t.parentKey], i = e == null ? void 0 : n.get(Tn(e));
2932
+ if (i) {
2933
+ let e = c.get(i) ?? [];
2934
+ e.push(r), c.set(i, e);
2935
+ } else a.push(r);
2936
+ }
2937
+ s = a;
2938
+ }
2939
+ let l = 0;
2940
+ function u(e, s) {
2941
+ if (!Array.isArray(e)) throw $(/* @__PURE__ */ TypeError("children 必须为数组"), "pro.table.structured.childrenMustBeAnArray");
2942
+ if (l + e.length > r) throw $(/* @__PURE__ */ TypeError("树超过节点或深度预算"), "pro.table.structured.theTreeExceedsItsNodeOrDepthBudget");
2943
+ let d = [];
2944
+ for (let f of e) {
2945
+ if (!f || typeof f != "object") throw $(/* @__PURE__ */ TypeError("行必须为对象"), "pro.table.structured.rowsMustBeObjects");
2946
+ if (++l > r || s > i) throw $(/* @__PURE__ */ TypeError("树超过节点或深度预算"), "pro.table.structured.theTreeExceedsItsNodeOrDepthBudget");
2947
+ if (o.has(f)) throw $(/* @__PURE__ */ TypeError("循环或同节点多归属"), "pro.table.structured.theTreeContainsACycleOrANode");
2948
+ o.add(f);
2949
+ let e = typeof t.rowKey == "function" ? t.rowKey(f) : f[t.rowKey];
2950
+ if (typeof e != "string" && typeof e != "number") throw $(/* @__PURE__ */ TypeError("缺失 rowKey"), "pro.table.structured.missingRowKey");
2951
+ let p = Tn(e);
2952
+ if (a.has(p)) throw $(/* @__PURE__ */ TypeError("森林存在重复 rowKey"), "pro.table.structured.theForestContainsDuplicateRowKeys");
2953
+ a.add(p);
2954
+ let m = t.mode === "flat" ? void 0 : c ? c.get(f) : f[t.children ?? "children"], h = t.mode === "flat" ? [] : n.get(e) ?? m ?? [];
2955
+ if (!Array.isArray(h)) throw $(/* @__PURE__ */ TypeError("children 必须为数组"), "pro.table.structured.childrenMustBeAnArray");
2956
+ let g = u(h, s + 1);
2957
+ (!t.filter || t.filter(f) || g.length) && d.push({
2958
+ key: e,
2959
+ nativeKey: p,
2960
+ original: f,
2961
+ children: g,
2962
+ expandable: g.length > 0 || t.mode === "lazy-tree" && !n.has(e) && !!t.hasChildren?.(f)
2963
+ });
2964
+ }
2965
+ return d;
2966
+ }
2967
+ let d = u(s, 1);
2968
+ if (c && l !== e.length) throw $(/* @__PURE__ */ TypeError("循环或同节点多归属"), "pro.table.structured.theTreeContainsACycleOrANode");
2969
+ return d;
2970
+ }
2971
+ //#endregion
2972
+ //#region src/table/operations/Snapshot.ts
2973
+ function Dn(e) {
2974
+ let t = /* @__PURE__ */ new Set();
2975
+ function n(e) {
2976
+ if (e === null || typeof e == "string" || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e)) return e;
2977
+ if (typeof e != "object" || !e || t.has(e)) throw $(/* @__PURE__ */ TypeError("操作快照只支持无循环的普通数据"), "pro.table.operations.operationSnapshotsRequirePlainDataWithoutCycles");
2978
+ if (!Array.isArray(e) && Object.getPrototypeOf(e) !== Object.prototype) throw $(/* @__PURE__ */ TypeError("操作快照不支持实例"), "pro.table.operations.operationSnapshotsDoNotSupportClassInstances");
2979
+ t.add(e);
2980
+ let r = Array.isArray(e) ? e.map(n) : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, n(t)]));
2981
+ return t.delete(e), At(e, r), Object.freeze(r);
2982
+ }
2983
+ return n(e);
2984
+ }
2985
+ function On(e) {
2986
+ return typeof e == "string" || typeof e == "number" && Number.isFinite(e);
2987
+ }
2988
+ function kn(e) {
2989
+ return e instanceof Date ? `date:${e.getTime()}` : Array.isArray(e) ? `[${e.map(kn).join(",")}]` : e && typeof e == "object" ? `{${Object.keys(e).sort().map((t) => `${JSON.stringify(t)}:${kn(Reflect.get(e, t))}`).join(",")}}` : JSON.stringify(e) ?? "undefined";
2990
+ }
2991
+ //#endregion
2992
+ //#region src/table/operations/View.ts
2993
+ function An(e) {
2994
+ return Array.isArray(e) ? e.some(An) : k(e) ? e.type === f ? !1 : e.type !== p || Array.isArray(e.children) && e.children.some(An) : typeof e == "number" || typeof e == "string" && !!e.trim();
2995
+ }
2996
+ var jn = Symbol("asam-list-table-presentation"), Mn = S((e, { slots: t, emit: n, expose: r }) => {
2997
+ let i = o(), a = O(jn), s = O(xn) ?? Sn(), c = on(e, (e) => n("update:border", e)), l = (t) => e.structure ? t.original : t, u = m(() => e.structure ? [...e.structure.nodes.value] : g.value), d = m(() => {
2998
+ if (!e.structure) return u.value;
2999
+ let t = [], n = (e) => {
3000
+ for (let r of e) t.push(r), n(r.children);
3001
+ };
3002
+ return n(e.structure.nodes.value), t;
3003
+ }), f = U(), p = U(!1), h = U(0);
3004
+ q(() => e.columnSettingsDisabled, (e) => {
3005
+ e && (p.value = !1);
3006
+ });
3007
+ let g = m(() => [...e.controller.page.data.value.list]), _ = m(() => e.readonly ? [] : e.coordinator.records.value), v = () => !e.readonly && !!e.coordinator.busy.value.length, y = (t) => e.readonly ? void 0 : e.coordinator.verify(t), b = (t) => e.readonly ? void 0 : e.coordinator.retry(t, e.selection), x = !1, S = "", C = !1, w = (t) => {
3008
+ let n = typeof e.controller.rowKey == "function" ? e.controller.rowKey(t) : Reflect.get(t, e.controller.rowKey);
3009
+ if (!On(n)) throw $(/* @__PURE__ */ TypeError("行标识缺失或不支持"), "pro.table.operations.theRowIdentityIsMissingOrUnsupported");
3010
+ return n;
3011
+ };
3012
+ function T() {
3013
+ x = !0;
3014
+ try {
3015
+ if (f.value?.clearSelection(), e.selection.ready.value) for (let t of d.value) e.selection.keys.value.includes(w(l(t))) && f.value?.toggleRowSelection(t, !0);
3016
+ e.selection.ready.value && e.controller.select(g.value.filter((t) => e.selection.keys.value.includes(w(t))));
3017
+ } finally {
3018
+ x = !1;
3019
+ }
3020
+ }
3021
+ q([
3022
+ f,
3023
+ u,
3024
+ () => e.selection.keys.value,
3025
+ () => e.selection.ready.value
3026
+ ], T, { flush: "post" }), q([f, () => e.controller.intent.value?.sort], ([e, t]) => {
3027
+ t ? e?.sort(t.field, t.order) : e?.clearSort();
3028
+ }, { flush: "post" }), F(() => {
3029
+ S = "", C = !0;
3030
+ }), r({
3031
+ clearSelection: () => e.selection.clear(),
3032
+ loadPreferences: () => e.preferences.load()
3033
+ });
3034
+ let E = {
3035
+ display: "flex",
3036
+ flexWrap: "wrap",
3037
+ gap: "var(--asam-space-2, 8px)",
3038
+ alignItems: "center"
3039
+ }, k = (t, n, r = !1, i = !1, a, o = !1, s, c = e.size) => D(Y, {
3040
+ class: "asam-pro-message-button",
3041
+ key: a,
3042
+ size: c,
3043
+ ...o ? bn(s) : s,
3044
+ disabled: r && !i,
3045
+ "aria-disabled": r || void 0,
3046
+ style: { marginInlineStart: 0 },
3047
+ onClick: (e) => !r && n(e)
3048
+ }, () => t), A = (t) => !e.readonly && e.coordinator.busy.value.includes(kn([
3049
+ e.controller.intent.value?.scope ?? "",
3050
+ e.controller.session.value,
3051
+ t.busyKey ?? t.id
3052
+ ])), j = (t, n) => e.readonly ? [] : e.coordinator.conflictingKeys(t, n, e.selection.context()?.scope ?? ""), M = vn(() => e.controller, {
3053
+ blocked: A,
3054
+ busy: A
3055
+ }), N = m(() => e.readonly ? [] : e.operations.filter((e) => e.visible?.() !== !1));
3056
+ function P(t) {
3057
+ return N.value.map((n) => ({
3058
+ key: `operation:${n.id}`,
3059
+ label: `${t ? i.t("pro.table.editing.row") : i.t("pro.table.operations.batch")}${n.label}`,
3060
+ presentation: n.button,
3061
+ busy: A(n) || e.controller.busy.value.has(n.busyKey ?? n.id),
3062
+ disabled: n.enabled?.() === !1 || !e.selection.ready.value || !t && !e.selection.keys.value.length || A(n) || j(n, t ? [w(t)] : e.selection.keys.value).length > 0 || e.controller.busy.value.has(n.busyKey ?? n.id),
3063
+ retainFocus: !1,
3064
+ invoke: () => e.readonly ? void 0 : e.coordinator.run(n, e.operationId(n.id), t ? [w(t)] : e.selection.keys.value, e.selection)
3065
+ }));
3066
+ }
3067
+ let I = (t, n) => k(t.label, (e) => t.invoke(e.currentTarget instanceof HTMLElement ? e.currentTarget : void 0), t.disabled, t.retainFocus, t.key, !!n, t.presentation, n ? e.rowActionSize ?? e.size : e.size), L = (e, t) => M(e, t).map((e) => I(e, t)), R = (e) => P(e).map((t) => I(t, e)), z = async () => {
3068
+ let t = e.controller, n = t.session.value, r = await t.refresh();
3069
+ !C && e.controller === t && r.status === "success" && t.scopeReady.value && t.session.value === n && _e.success(i.t("pro.table.operations.refreshed"));
3070
+ };
3071
+ return () => {
3072
+ let r = e.controller, o = e.selection, d = e.preferences, m = Number.isFinite(e.actionColumnWidth) ? Math.max(120, e.actionColumnWidth) : 200, C = /* @__PURE__ */ new Map(), O = e.rowActions ?? [], A = !1;
3073
+ for (let n of e.structure?.rows("visible") ?? g.value) {
3074
+ let e = t.rowActions?.({ row: n });
3075
+ C.set(n, e), e == null ? A ||= N.value.length > 0 || O.some((e) => e.visible?.(n) !== !1) : A ||= An(e);
3076
+ }
3077
+ let j = d.columns.value.reduce((e, t) => e + (t.width ?? 160), 52 + (A ? m : 0)), F = a?.(r) === !0, I = "";
3078
+ return r.scopeReady.value ? F ? r.page.loading.value ? I = i.t("pro.table.editing.loading") : r.page.error.value ? I = i.t("pro.list.query.unableToLoadTheList") : r.page.empty.value ? I = i.t("pro.table.editing.noData") : r.page.hasSucceeded.value || (I = i.t("pro.list.query.notLoaded")) : !r.page.loading.value && r.page.error.value && (I = i.t("pro.table.operations.unableToLoad", { value1: Bt(r.page.error.value, i) })) : I = i.t(F ? "pro.list.query.theDataScopeIsInvalidPrepareANew" : "pro.table.operations.theScopeIsInvalid"), D("section", {
3079
+ class: "asam-operations-table",
3080
+ "aria-label": i.t(F ? "pro.list.query.queryResults" : "pro.table.operations.tableWithOperationsAcrossPages"),
3081
+ "aria-busy": r.page.loading.value,
3082
+ style: {
3083
+ minWidth: 0,
3084
+ maxWidth: "100%",
3085
+ display: "grid",
3086
+ gap: "var(--asam-operations-gap, var(--asam-space-3, 12px))"
3087
+ }
3088
+ }, [
3089
+ D(ln, { label: i.t(F ? "pro.list.query.listActions" : "pro.table.operations.operationsAcrossPages") }, {
3090
+ default: () => [
3091
+ t.toolbar?.(),
3092
+ ...L(e.actions ?? []),
3093
+ ...R()
3094
+ ],
3095
+ tools: () => [
3096
+ nn(i.t("pro.table.editing.refresh"), z, "refresh", e.size, !r.scopeReady.value || r.page.loading.value, void 0, void 0, r.page.loading.value),
3097
+ t.tools?.(),
3098
+ F ? null : e.columnSettings === "popover" ? D(wn, {
3099
+ items: d.items.value.map((e) => {
3100
+ let t = (d.definitions ?? d.columns.value).find(({ key: t }) => t === e.key);
3101
+ return {
3102
+ ...e,
3103
+ label: t?.label ?? e.key,
3104
+ required: t?.required
3105
+ };
3106
+ }),
3107
+ message: Mt(d.message, i),
3108
+ setVisible: (e, t) => {
3109
+ d.visible(e, t) && d.save();
3110
+ },
3111
+ ready: r.scopeReady.value && !e.columnSettingsDisabled,
3112
+ session: r.session.value,
3113
+ size: e.size
3114
+ }) : nn(p.value ? i.t("pro.table.operations.closeColumnSettings") : i.t("pro.table.operations.columnSettings"), () => {
3115
+ p.value = !p.value;
3116
+ }, "columns", e.size, !!e.columnSettingsDisabled, p.value),
3117
+ c.toggleButton(!r.scopeReady.value),
3118
+ t["tools-end"]?.()
3119
+ ]
3120
+ }),
3121
+ I ? D("p", {
3122
+ role: "status",
3123
+ "aria-live": "polite",
3124
+ style: { margin: 0 }
3125
+ }, I) : null,
3126
+ F && (r.page.loading.value || r.page.error.value || r.page.stale.value) && r.successfulSource.value ? D("p", {
3127
+ "data-result-source": "",
3128
+ style: { overflowWrap: "anywhere" }
3129
+ }, i.t("pro.list.query.previousResultSourceResultActionsArePaused", { value1: JSON.stringify(r.successfulSource.value) })) : null,
3130
+ r.page.error.value ? t.error?.({
3131
+ error: r.page.error.value,
3132
+ retry: r.retry
3133
+ }) ?? (F ? D("div", { role: "alert" }, [Bt(r.page.error.value, i), k(i.t("pro.table.structured.retryb8784"), () => r.retry(), r.page.loading.value || !r.scopeReady.value)]) : null) : null,
3134
+ r.actionError.value ? D("p", { role: "alert" }, r.formatActionError?.(i) ?? r.actionError.value) : null,
3135
+ Mt(o.error, i) ? D("p", {
3136
+ role: "alert",
3137
+ style: { margin: 0 }
3138
+ }, Mt(o.error, i)) : null,
3139
+ p.value && e.columnSettings !== "popover" ? D("fieldset", {
3140
+ "aria-label": i.t("pro.table.operations.columnPreferences"),
3141
+ style: {
3142
+ minWidth: 0,
3143
+ maxWidth: "100%",
3144
+ border: "1px solid var(--asam-color-border, #ddd)"
3145
+ }
3146
+ }, [
3147
+ D("legend", i.t("pro.table.operations.columnPreferences")),
3148
+ ...d.items.value.map((t, n) => D("div", {
3149
+ key: t.key,
3150
+ draggable: !0,
3151
+ "data-column-key": t.key,
3152
+ style: {
3153
+ ...E,
3154
+ padding: "var(--asam-space-2, 8px)"
3155
+ },
3156
+ onDragstart: (e) => {
3157
+ S = t.key, e.dataTransfer?.setData("text/plain", t.key);
3158
+ },
3159
+ onDragover: (e) => e.preventDefault(),
3160
+ onDrop: (e) => {
3161
+ e.preventDefault(), d.move(S || e.dataTransfer?.getData("text/plain") || "", n), S = "";
3162
+ },
3163
+ onDragend: () => {
3164
+ S = "";
3165
+ }
3166
+ }, [
3167
+ D(se, {
3168
+ modelValue: t.visible,
3169
+ size: e.size,
3170
+ "aria-label": i.t("pro.table.operations.show", { value1: t.key }),
3171
+ "onUpdate:modelValue": (e) => d.visible(t.key, e === !0)
3172
+ }, () => t.key),
3173
+ k(i.t("pro.table.operations.moveUp", { value1: t.key }), () => d.move(t.key, n - 1), n === 0),
3174
+ k(i.t("pro.table.operations.moveDown", { value1: t.key }), () => d.move(t.key, n + 1), n === d.items.value.length - 1),
3175
+ D("div", { style: E }, [D("span", i.t("pro.table.operations.columnWidth", { value1: t.key })), D(ge, {
3176
+ modelValue: t.width,
3177
+ size: e.size,
3178
+ controls: !1,
3179
+ ariaLabel: i.t("pro.table.operations.columnWidth", { value1: t.key }),
3180
+ style: { width: "7em" },
3181
+ onChange: (e) => d.width(t.key, e ?? NaN)
3182
+ })])
3183
+ ])),
3184
+ k(i.t("pro.table.operations.savePreferences"), d.save, d.pending.value),
3185
+ k(i.t("pro.table.operations.loadPreferences"), d.load, d.pending.value),
3186
+ k(i.t("pro.table.operations.restoreDefaults"), d.reset, d.pending.value),
3187
+ D("p", { role: "status" }, Mt(d.message, i))
3188
+ ]) : null,
3189
+ mn({
3190
+ ref: f,
3191
+ "onRow-dblclick": (t, r, i) => n("row-dblclick", l(t), e.structure ? null : r, i),
3192
+ data: u.value,
3193
+ loading: r.page.loading.value,
3194
+ rowKey: (t) => e.structure ? t.nativeKey : `${typeof w(l(t))}:${w(l(t))}`,
3195
+ treeProps: e.structure ? {
3196
+ children: "children",
3197
+ hasChildren: "unused",
3198
+ checkStrictly: !0
3199
+ } : void 0,
3200
+ expandRowKeys: e.structure?.expandedKeys.value.map(Tn),
3201
+ "onExpand-change": (t, r) => {
3202
+ !e.structure || !e.controller.scopeReady.value || typeof r != "boolean" || (e.structure.toggle(t.key, r), n("expand-change", l(t), r));
3203
+ },
3204
+ reserveSelection: !1,
3205
+ size: e.tableSize,
3206
+ stripe: e.stripe,
3207
+ ...c.resizeBindings(d.columns.value.some((t) => t.resizable ?? e.resizable ?? !0)),
3208
+ fit: e.widthMode === "fill",
3209
+ tableLayout: "fixed",
3210
+ minWidth: "0",
3211
+ style: {
3212
+ width: e.widthMode === "fill" ? "100%" : `${j}px`,
3213
+ minWidth: 0
3214
+ },
3215
+ "onSelection-change": (e) => {
3216
+ x || (o.selectPage(e.map(l)), T());
3217
+ },
3218
+ "onHeader-dragend": (e, t, n) => {
3219
+ d.width(n.property, e) || h.value++;
3220
+ },
3221
+ "onSort-change": (e) => {
3222
+ let t = e.prop && e.order ? {
3223
+ field: e.prop,
3224
+ order: e.order
3225
+ } : null;
3226
+ (t?.field !== r.intent.value?.sort?.field || t?.order !== r.intent.value?.sort?.order) && r.setSort(t);
3227
+ }
3228
+ }, {
3229
+ default: () => [
3230
+ D(Se, {
3231
+ type: "selection",
3232
+ resizable: !1,
3233
+ width: 52,
3234
+ selectable: () => o.ready.value
3235
+ }),
3236
+ ...d.columns.value.map((n) => D(Se, {
3237
+ key: `${n.key}:${h.value}`,
3238
+ columnKey: n.key,
3239
+ prop: n.key,
3240
+ className: "asam-pro-data-column",
3241
+ label: n.label,
3242
+ width: e.widthMode === "fill" && n.flex !== !1 ? void 0 : n.width,
3243
+ minWidth: n.width,
3244
+ resizable: n.resizable ?? e.resizable ?? !0,
3245
+ fixed: n.fixed,
3246
+ sortable: n.sortable ? "custom" : !1
3247
+ }, {
3248
+ header: e.columnSettings === "popover" ? () => D("span", {
3249
+ class: "asam-pro-column-title",
3250
+ "data-column": n.key,
3251
+ draggable: n.movable !== !1,
3252
+ tabindex: n.movable === !1 ? void 0 : 0,
3253
+ title: n.movable === !1 ? void 0 : i.t("pro.table.columns.reorder"),
3254
+ onDragstart: (e) => {
3255
+ S = n.key, e.dataTransfer?.setData("text/plain", n.key);
3256
+ },
3257
+ onDragover: (e) => e.preventDefault(),
3258
+ onDrop: (e) => {
3259
+ e.preventDefault(), e.stopPropagation(), r.scopeReady.value && d.move(S || e.dataTransfer?.getData("text/plain") || "", d.items.value.findIndex((e) => e.key === n.key)) && d.save(), S = "";
3260
+ },
3261
+ onDragend: () => {
3262
+ S = "";
3263
+ },
3264
+ onKeydown: (e) => {
3265
+ if (!e.altKey || !["ArrowLeft", "ArrowRight"].includes(e.key)) return;
3266
+ e.preventDefault();
3267
+ let t = d.items.value.findIndex((e) => e.key === n.key);
3268
+ r.scopeReady.value && d.move(n.key, t + (e.key === "ArrowLeft" ? -1 : 1)) && d.save();
3269
+ }
3270
+ }, n.label) : void 0,
3271
+ default: ({ row: e }) => {
3272
+ let r = l(e);
3273
+ return t.cell?.({
3274
+ row: r,
3275
+ column: n
3276
+ }) ?? n.render?.(r) ?? String(Reflect.get(r, n.key) ?? "—");
3277
+ }
3278
+ })),
3279
+ A ? D(Se, {
3280
+ label: i.t("pro.table.editing.actions"),
3281
+ align: "right",
3282
+ headerAlign: "right",
3283
+ resizable: !1,
3284
+ fixed: e.actionColumnFixed ?? "right",
3285
+ width: m
3286
+ }, { default: ({ row: t }) => {
3287
+ let n = l(t);
3288
+ return C.has(n) ? C.get(n) ?? (e.rowActionOverflow ? D(Cn, {
3289
+ hoverIntent: s,
3290
+ items: [...M(e.rowActions ?? [], n), ...P(n)],
3291
+ size: e.rowActionSize ?? e.size,
3292
+ identity: r.successfulSource.value ?? void 0,
3293
+ rowToken: n,
3294
+ session: r.session.value,
3295
+ ready: r.resultReady.value
3296
+ }) : D("div", {
3297
+ class: "asam-pro-table-row-actions",
3298
+ style: {
3299
+ ...E,
3300
+ justifyContent: "flex-end"
3301
+ }
3302
+ }, [...L(e.rowActions ?? [], n), ...R(n)])) : null;
3303
+ } }) : null
3304
+ ],
3305
+ empty: () => t.empty?.() ?? D(pe, { description: I || i.t("pro.table.operations.empty") }, { default: () => D(Y, {
3306
+ type: "primary",
3307
+ plain: !0,
3308
+ size: e.size,
3309
+ disabled: !r.scopeReady.value,
3310
+ loading: r.page.loading.value,
3311
+ onClick: z
3312
+ }, () => i.t("pro.table.operations.reload")) })
3313
+ }, e.structure?.issues.value.length ? D("div", { role: "alert" }, e.structure.issues.value.map((e) => zt(e, i))) : null),
3314
+ e.pagination === !1 ? null : D(_n, {
3315
+ size: e.size,
3316
+ currentPage: r.intent.value?.currentPage ?? 1,
3317
+ pageSize: r.intent.value?.pageSize ?? 10,
3318
+ total: r.page.data.value.total,
3319
+ disabled: !r.resultReady.value,
3320
+ sizeDisabled: !r.scopeReady.value || r.page.loading.value,
3321
+ perPageLabels: F,
3322
+ "onPage-change": (e) => r.setPage(e),
3323
+ "onPage-size-change": (e) => r.setPageSize(e)
3324
+ }),
3325
+ ..._.value.map((n) => D("article", {
3326
+ key: n.snapshot.operationId,
3327
+ "aria-label": e.operationRecordLabel ?? i.t("pro.table.operations.operationRecord", { value1: n.snapshot.operationId }),
3328
+ style: { overflowWrap: "anywhere" }
3329
+ }, t.record?.({ record: n }) ?? [
3330
+ D("p", { role: "status" }, i.t("pro.table.operations.originalScope", {
3331
+ value1: n.snapshot.operationId,
3332
+ value2: n.snapshot.context.scope,
3333
+ value3: Ft(i, n.phase),
3334
+ value4: Mt(n, i)
3335
+ })),
3336
+ D("ul", n.results.map((e) => D("li", { key: `${typeof e.key}:${e.key}` }, `${typeof e.key}:${e.key} ${Ft(i, e.status)} ${Mt(e, i) ?? ""}`))),
3337
+ k(i.t("pro.table.operations.verifyPendingItems"), () => y(n.snapshot.operationId), !n.results.some((e) => e.status === "unknown") || v()),
3338
+ k(i.t("pro.table.operations.retryFailedAndUnsentItems"), () => b(n.snapshot.operationId), !o.ready.value || v() || n.results.some((e) => e.status === "unknown") || !n.results.some((e) => e.status === "failure" || e.status === "unsent"))
3339
+ ]))
3340
+ ]);
3341
+ };
3342
+ }, {
3343
+ name: "AsamOperationsTable",
3344
+ props: [
3345
+ "readonly",
3346
+ "controller",
3347
+ "selection",
3348
+ "coordinator",
3349
+ "preferences",
3350
+ "operations",
3351
+ "operationId",
3352
+ "actions",
3353
+ "rowActions",
3354
+ "size",
3355
+ "tableSize",
3356
+ "widthMode",
3357
+ "actionColumnWidth",
3358
+ "actionColumnFixed",
3359
+ "structure",
3360
+ "pagination",
3361
+ "rowActionSize",
3362
+ "rowActionOverflow",
3363
+ "resizable",
3364
+ "columnSettings",
3365
+ "columnSettingsDisabled",
3366
+ "operationRecordLabel",
3367
+ "stripe",
3368
+ "border"
3369
+ ],
3370
+ emits: [
3371
+ "update:border",
3372
+ "row-dblclick",
3373
+ "expand-change"
3374
+ ]
3375
+ });
3376
+ Object.assign(Mn, { props: {
3377
+ readonly: Boolean,
3378
+ controller: null,
3379
+ selection: null,
3380
+ coordinator: null,
3381
+ preferences: null,
3382
+ operations: null,
3383
+ operationId: null,
3384
+ actions: null,
3385
+ rowActions: null,
3386
+ size: null,
3387
+ tableSize: String,
3388
+ widthMode: null,
3389
+ actionColumnWidth: null,
3390
+ actionColumnFixed: null,
3391
+ structure: null,
3392
+ pagination: {
3393
+ type: Boolean,
3394
+ default: !0
3395
+ },
3396
+ rowActionSize: null,
3397
+ rowActionOverflow: Boolean,
3398
+ resizable: {
3399
+ type: Boolean,
3400
+ default: !0
3401
+ },
3402
+ columnSettings: null,
3403
+ columnSettingsDisabled: Boolean,
3404
+ operationRecordLabel: null,
3405
+ ...rn
3406
+ } });
3407
+ //#endregion
3408
+ //#region src/table/TableDensity.vue?vue&type=script&setup=true&lang.ts
3409
+ var Nn = ["onKeydown"], Pn = { "aria-hidden": "true" }, Fn = /* @__PURE__ */ S({
3410
+ __name: "TableDensity",
3411
+ props: {
3412
+ size: {},
3413
+ controlSize: { default: void 0 },
3414
+ disabled: { type: Boolean },
3415
+ session: { default: void 0 },
3416
+ popperClass: { default: void 0 }
3417
+ },
3418
+ emits: ["update:size"],
3419
+ setup(e, { emit: t }) {
3420
+ let n = e, r = t, i = o(), a = B(!1), s = B(), c = [
3421
+ {
3422
+ value: "large",
3423
+ label: "pro.crud.densityLarge"
3424
+ },
3425
+ {
3426
+ value: "default",
3427
+ label: "pro.crud.densityDefault"
3428
+ },
3429
+ {
3430
+ value: "small",
3431
+ label: "pro.crud.densitySmall"
3432
+ },
3433
+ {
3434
+ value: "mini",
3435
+ label: "pro.crud.densityMini"
3436
+ }
3437
+ ];
3438
+ q(() => [n.disabled, n.session], () => {
3439
+ a.value = !1;
3440
+ });
3441
+ async function l() {
3442
+ a.value = !1, await j(), s.value?.querySelector("button")?.focus();
3443
+ }
3444
+ return (t, n) => (R(), h(K(ye), {
3445
+ visible: a.value,
3446
+ "onUpdate:visible": n[0] ||= (e) => a.value = e,
3447
+ trigger: "click",
3448
+ placement: "bottom-end",
3449
+ width: 180,
3450
+ disabled: e.disabled,
3451
+ "popper-class": e.popperClass ?? "asam-crud-density-popover"
3452
+ }, {
3453
+ reference: J(() => [v("span", {
3454
+ ref_key: "trigger",
3455
+ ref: s
3456
+ }, [(R(), h(ee(K(nn)(K(i).t("pro.crud.tableDensity"), () => void 0, "density", e.controlSize, e.disabled, a.value))))], 512)]),
3457
+ default: J(() => [v("div", {
3458
+ class: "asam-crud-density-options",
3459
+ onKeydown: re(ie(l, ["prevent", "stop"]), ["esc"])
3460
+ }, [(R(), _(p, null, V(c, (t) => x(K(Y), {
3461
+ key: t.value,
3462
+ type: "primary",
3463
+ text: e.size !== t.value,
3464
+ "aria-pressed": e.size === t.value,
3465
+ disabled: e.disabled,
3466
+ block: "",
3467
+ onClick: (e) => r("update:size", t.value)
3468
+ }, {
3469
+ default: J(() => [b(W(K(i).t(t.label)), 1), v("span", Pn, W(e.size === t.value ? "✓" : ""), 1)]),
3470
+ _: 2
3471
+ }, 1032, [
3472
+ "text",
3473
+ "aria-pressed",
3474
+ "disabled",
3475
+ "onClick"
3476
+ ])), 64))], 40, Nn)]),
3477
+ _: 1
3478
+ }, 8, [
3479
+ "visible",
3480
+ "disabled",
3481
+ "popper-class"
3482
+ ]));
3483
+ }
3484
+ });
3485
+ //#endregion
3486
+ //#region src/table/operations/Selection.ts
3487
+ function In(e) {
3488
+ let t = e.controller, n = e.selectionLimit ?? 1e3;
3489
+ if (!Number.isSafeInteger(n) || n < 1) throw $(/* @__PURE__ */ TypeError("selectionLimit须为正整数"), "pro.table.operations.theSelectionLimitMustBeAPositiveInteger");
3490
+ let r = U(Object.freeze([])), i = U(""), a = U(!1), o = U(0), s = m(() => {
3491
+ let n = t.intent.value;
3492
+ return !n || !t.scopeReady.value || !G(e.dataset) ? null : {
3493
+ scope: n.scope,
3494
+ session: t.session.value,
3495
+ dataset: G(e.dataset),
3496
+ query: kn({
3497
+ query: n.query,
3498
+ sort: n.sort,
3499
+ epoch: n.epoch
3500
+ })
3501
+ };
3502
+ });
3503
+ function c() {
3504
+ o.value++, r.value = Object.freeze([]), Q(i, "");
3505
+ }
3506
+ let l = q(() => kn(s.value), c, { flush: "sync" }), u = Kt(t.intent, c), d = m(() => !a.value && !!s.value && t.resultReady.value);
3507
+ function f(e) {
3508
+ let n = typeof t.rowKey == "function" ? t.rowKey(e) : Reflect.get(e, t.rowKey);
3509
+ if (!On(n)) throw $(/* @__PURE__ */ TypeError("行标识缺失或不支持"), "pro.table.operations.theRowIdentityIsMissingOrUnsupported");
3510
+ return n;
3511
+ }
3512
+ function p(e) {
3513
+ if (!d.value) return Q(i, Z("pro.table.operations.theCurrentResultsCannotBeSelectedWaitFor", "当前结果不可选择,请等待有效结果")), !1;
3514
+ try {
3515
+ let a = t.page.data.value.list, o = a.map(f);
3516
+ if (new Set(o).size !== o.length) throw $(/* @__PURE__ */ TypeError("当前页行标识重复"), "pro.table.operations.theCurrentPageContainsDuplicateRowIdentities");
3517
+ if (!e.every((e) => a.includes(e))) throw $(/* @__PURE__ */ TypeError("选择含非当前页记录"), "pro.table.operations.theSelectionContainsRecordsOutsideTheCurrentPage");
3518
+ let s = e.map(f);
3519
+ if (new Set(s).size !== s.length) throw $(/* @__PURE__ */ TypeError("选择行标识重复"), "pro.table.operations.theSelectionContainsDuplicateRowIdentities");
3520
+ let c = [...r.value.filter((e) => !o.includes(e)), ...s];
3521
+ if (c.length > n) throw $(/* @__PURE__ */ RangeError(`选择上限${n},本次选择未生效`), "pro.table.operations.theSelectionLimitIsThisSelectionWasNot", { value1: n });
3522
+ return r.value = Object.freeze(c), Q(i, ""), !0;
3523
+ } catch (e) {
3524
+ return Q(i, kt(e, String(e))), !1;
3525
+ }
3526
+ }
3527
+ function h() {
3528
+ a.value = !0, l(), u(), c();
3529
+ }
3530
+ return T() && L(h), {
3531
+ limit: n,
3532
+ keys: m(() => r.value),
3533
+ error: jt(i),
3534
+ ready: d,
3535
+ context: () => !a.value && s.value ? Dn({
3536
+ ...s.value,
3537
+ generation: o.value
3538
+ }) : null,
3539
+ selectPage: p,
3540
+ clear: c,
3541
+ reset: c,
3542
+ dispose: h
3543
+ };
3544
+ }
3545
+ //#endregion
3546
+ //#region src/table/operations/Preferences.ts
3547
+ var Ln = /* @__PURE__ */ new WeakMap(), Rn = /* @__PURE__ */ new WeakMap();
3548
+ function zn(e, t) {
3549
+ let n = Rn.get(e);
3550
+ n || (n = /* @__PURE__ */ new Map(), Rn.set(e, n));
3551
+ let r = kn(t), i = n.get(r);
3552
+ return i || (i = {
3553
+ active: 0,
3554
+ version: 0
3555
+ }, n.set(r, i)), i;
3556
+ }
3557
+ function Bn(e, t) {
3558
+ let n = (Ln.get(e) ?? Promise.resolve()).catch(() => {}).then(t);
3559
+ return Ln.set(e, n), n;
3560
+ }
3561
+ function Vn(e) {
3562
+ let t = e.columns;
3563
+ if (!t.length || new Set(t.map((e) => e.key)).size !== t.length || t.some((e) => !e.key || !Number.isFinite(e.minWidth ?? 60) || !Number.isFinite(e.maxWidth ?? 1200) || (e.minWidth ?? 60) > (e.maxWidth ?? 1200))) throw $(/* @__PURE__ */ TypeError("列配置无效"), "pro.table.operations.theColumnConfigurationIsInvalid");
3564
+ function n() {
3565
+ let e = t.map((e) => ({
3566
+ key: e.key,
3567
+ visible: e.required || e.defaultVisible !== !1,
3568
+ width: Math.max(e.minWidth ?? 60, Math.min(e.maxWidth ?? 1200, e.width ?? 160))
3569
+ }));
3570
+ return e.some((e) => e.visible) || (e[0].visible = !0), Dn(e);
3571
+ }
3572
+ let r = U(n()), i = U(""), a = U(!1), o = U(!1), s = !1, c = 0, l = 0;
3573
+ function u() {
3574
+ let t = G(e.scope);
3575
+ if ([
3576
+ "application",
3577
+ "principal",
3578
+ "table",
3579
+ "version"
3580
+ ].some((e) => typeof Reflect.get(t, e) != "string" || !Reflect.get(t, e))) throw $(/* @__PURE__ */ TypeError("偏好scope须包含应用、身份、表格、版本"), "pro.table.operations.thePreferenceScopeMustIdentifyTheApplicationPrincipal");
3581
+ return Dn({
3582
+ application: t.application,
3583
+ principal: t.principal,
3584
+ table: t.table,
3585
+ version: t.version
3586
+ });
3587
+ }
3588
+ function d(e) {
3589
+ return s ? !1 : (r.value = Dn(e), c++, o.value = !0, Q(i, Z("pro.table.operations.theCurrentViewHasNotBeenSaved", "当前视图未保存")), !0);
3590
+ }
3591
+ function f(e) {
3592
+ return Q(i, e), !1;
3593
+ }
3594
+ function p(e, r) {
3595
+ if (!e || typeof e != "object" || Reflect.get(e, "schema") !== 1 || kn(Reflect.get(e, "scope")) !== kn(r) || !Array.isArray(Reflect.get(e, "columns"))) throw $(/* @__PURE__ */ TypeError("偏好损坏或版本不匹配,已恢复默认"), "pro.table.operations.preferencesAreCorruptOrUseAnotherVersionDefaults");
3596
+ let i = Reflect.get(e, "columns"), a = /* @__PURE__ */ new Set();
3597
+ for (let e of i) {
3598
+ if (!e || typeof e != "object" || typeof Reflect.get(e, "key") != "string" || typeof Reflect.get(e, "visible") != "boolean" || !Number.isFinite(Reflect.get(e, "width")) || a.has(Reflect.get(e, "key"))) throw $(/* @__PURE__ */ TypeError("偏好列schema无效,已恢复默认"), "pro.table.operations.thePreferenceColumnSchemaIsInvalidDefaultsWere");
3599
+ a.add(Reflect.get(e, "key"));
3600
+ }
3601
+ let o = n(), s = i.flatMap((e) => {
3602
+ let n = Reflect.get(e, "key"), r = t.find((e) => e.key === n);
3603
+ return r ? [{
3604
+ key: n,
3605
+ visible: r.required || Reflect.get(e, "visible"),
3606
+ width: Math.max(r.minWidth ?? 60, Math.min(r.maxWidth ?? 1200, Reflect.get(e, "width")))
3607
+ }] : [];
3608
+ });
3609
+ for (let e of o) a.has(e.key) || s.push(e);
3610
+ let c = s.filter((e) => t.find((t) => t.key === e.key)?.movable !== !1), l = t.map((e) => e.movable === !1 ? s.find((t) => t.key === e.key) : c.shift());
3611
+ return l.some((e) => e.visible) || (l[0] = {
3612
+ ...l[0],
3613
+ visible: !0
3614
+ }), Dn(l);
3615
+ }
3616
+ async function h() {
3617
+ let t = u(), d = zn(e.adapter, t);
3618
+ if (d.active) {
3619
+ Q(i, Z("pro.table.operations.preferencesAreBeingSavedLoadingWasSkippedRetry", "偏好写入进行中,本次未载入;完成后可重试"));
3620
+ return;
3621
+ }
3622
+ let f = d.version, m = ++l, h = c;
3623
+ a.value = !0;
3624
+ try {
3625
+ let a = await e.adapter.load(t);
3626
+ if (s || m !== l || c !== h) return;
3627
+ if (d.version !== f || d.active) {
3628
+ o.value = !0, Q(i, Z("pro.table.operations.preferencesChangedWhileLoadingTheCurrentUnsavedView", "载入期间偏好发生写入,保留当前未保存视图;请重新载入"));
3629
+ return;
3630
+ }
3631
+ r.value = a == null ? n() : p(a, t), o.value = !1, Q(i, Z("pro.table.operations.preferencesLoadedObsoleteColumnsWereRemovedAndNew", "偏好已载入(未知旧列移除,新列加入默认)"));
3632
+ } catch (e) {
3633
+ !s && m === l && c === h && (d.version === f && !d.active && (r.value = n()), o.value = !0, Q(i, kt(e, String(e))));
3634
+ } finally {
3635
+ !s && m === l && (a.value = !1);
3636
+ }
3637
+ }
3638
+ async function g(t) {
3639
+ let f = u(), p = ++l;
3640
+ t && d(n());
3641
+ let m = c, h = Dn({
3642
+ schema: 1,
3643
+ scope: f,
3644
+ columns: r.value
3645
+ }), g = zn(e.adapter, f);
3646
+ g.active++, g.version++, a.value = !0;
3647
+ try {
3648
+ await Bn(e.adapter, () => t ? e.adapter.reset(f) : e.adapter.save(f, h)), !s && p === l && m === c && (o.value = !1, Q(i, t ? Z("pro.table.operations.defaultPreferencesWereRestoredAndStoredPreferencesReset", "默认偏好已恢复并重置存储") : Z("pro.table.operations.preferencesSaved", "偏好已保存")));
3649
+ } catch (e) {
3650
+ !s && p === l && (o.value = !0, Q(i, Z("pro.table.operations.savingPreferencesFailedTheCurrentUnsavedViewWas", `持久化失败,保留当前未保存视图:${String(e)}`, { value1: String(e) }, { value1: kt(e, String(e)) })));
3651
+ } finally {
3652
+ g.active--, !s && p === l && (a.value = !1);
3653
+ }
3654
+ }
3655
+ let _ = q(() => kn(G(e.scope)), () => {
3656
+ l++, c++, r.value = n(), o.value = !1, h();
3657
+ }, { flush: "sync" });
3658
+ function v() {
3659
+ s = !0, l++, _();
3660
+ }
3661
+ return T() && L(v), {
3662
+ items: m(() => r.value),
3663
+ definitions: t,
3664
+ columns: m(() => r.value.filter((e) => e.visible).map((e) => ({
3665
+ ...t.find((t) => t.key === e.key),
3666
+ width: e.width
3667
+ }))),
3668
+ message: jt(i),
3669
+ pending: m(() => a.value),
3670
+ dirty: m(() => o.value),
3671
+ load: h,
3672
+ save: () => g(!1),
3673
+ reset: () => g(!0),
3674
+ dispose: v,
3675
+ visible(e, n) {
3676
+ let i = t.find((t) => t.key === e);
3677
+ if (!i || i.required && !n) return f(Z("pro.table.operations.requiredColumnsCannotBeHidden", "必显列不能隐藏"));
3678
+ let a = r.value.map((t) => t.key === e ? {
3679
+ ...t,
3680
+ visible: n
3681
+ } : t);
3682
+ return a.some((e) => e.visible) ? d(a) : f(Z("pro.table.operations.keepAtLeastOneDataColumnVisible", "至少保留一列数据"));
3683
+ },
3684
+ move(e, n) {
3685
+ let i = r.value.findIndex((t) => t.key === e);
3686
+ if (i < 0 || !Number.isInteger(n) || n < 0 || n >= r.value.length || t.find((t) => t.key === e)?.movable === !1 || r.value.slice(Math.min(i, n), Math.max(i, n) + 1).some((e) => t.find((t) => t.key === e.key)?.movable === !1)) return f(Z("pro.table.operations.columnsCannotMoveBeyondFixedColumnsOrTable", "不能越过固定列或边界"));
3687
+ let a = [...r.value], o = a.splice(i, 1)[0];
3688
+ return a.splice(n, 0, o), d(a);
3689
+ },
3690
+ width(e, n) {
3691
+ let i = t.find((t) => t.key === e);
3692
+ return !i || !Number.isFinite(n) || n < (i.minWidth ?? 60) || n > (i.maxWidth ?? 1200) ? f(Z("pro.table.operations.theColumnWidthIsOutsideTheAllowedRange", "列宽超出允许范围")) : d(r.value.map((t) => t.key === e ? {
3693
+ ...t,
3694
+ width: n
3695
+ } : t));
3696
+ }
3697
+ };
3698
+ }
3699
+ //#endregion
3700
+ //#region src/table/structured/Controller.ts
3701
+ function Hn(e) {
3702
+ let t = U([]), n = U([]), r = U(e.initialExpandedKeys ?? []), i = U(/* @__PURE__ */ new Map()), a = U(0), o = m(() => G(e.scope)), s = /* @__PURE__ */ new Map(), c = !1, l = /* @__PURE__ */ new Map(), u = m(() => t.value), d = () => {
3703
+ let e = /* @__PURE__ */ new Map(), t = (n) => n.forEach((n) => {
3704
+ e.set(n.key, n), t(n.children);
3705
+ });
3706
+ return t(u.value), e;
3707
+ };
3708
+ function f(t = s) {
3709
+ return En(G(e.rows), e, t);
3710
+ }
3711
+ function p(e) {
3712
+ t.value = e;
3713
+ let n = d();
3714
+ r.value = r.value.filter((e) => n.has(e));
3715
+ }
3716
+ function h() {
3717
+ a.value++;
3718
+ for (let e of l.values()) e.abort.abort();
3719
+ l.clear(), s = /* @__PURE__ */ new Map(), i.value = /* @__PURE__ */ new Map();
3720
+ }
3721
+ function g(e) {
3722
+ if (!c) {
3723
+ h(), e && (r.value = []);
3724
+ try {
3725
+ p(f()), n.value = [];
3726
+ } catch (e) {
3727
+ t.value = [], r.value = [], n.value = [Wt({ code: "forest" }, kt(e, String(e)))];
3728
+ }
3729
+ }
3730
+ }
3731
+ let _ = !1, v = q([() => {
3732
+ try {
3733
+ return { forest: En(G(e.rows), e, /* @__PURE__ */ new Map()) };
3734
+ } catch (e) {
3735
+ return { error: e };
3736
+ }
3737
+ }, o], ([, t], n) => {
3738
+ g(_ && (!e.preserveExpandedKeys || t !== n?.[1])), _ = !0;
3739
+ }, {
3740
+ immediate: !0,
3741
+ flush: "sync"
3742
+ });
3743
+ function y(e, t) {
3744
+ i.value = new Map(i.value).set(e, t);
3745
+ }
3746
+ function b(t) {
3747
+ let r = l.get(t);
3748
+ if (r) return r.promise;
3749
+ let i = d().get(t);
3750
+ if (c || !i || e.mode !== "lazy-tree" || s.has(t) || i.children.length > 0 || !i.expandable) return Promise.resolve();
3751
+ let u = new AbortController(), m = a.value, h = o.value, g = {
3752
+ abort: u,
3753
+ promise: Promise.resolve()
3754
+ }, _ = () => !c && a.value === m && o.value === h && l.get(t) === g && d().get(t)?.original === i.original;
3755
+ return l.set(t, g), y(t, { status: "loading" }), g.promise = Promise.resolve().then(() => {
3756
+ if (_()) {
3757
+ if (!e.loader) throw $(/* @__PURE__ */ TypeError("lazy-tree 需要 loader"), "pro.table.structured.lazyTreesRequireALoader");
3758
+ return e.loader(i.original, {
3759
+ scope: h,
3760
+ generation: m,
3761
+ signal: u.signal
3762
+ });
3763
+ }
3764
+ }).then((e) => {
3765
+ if (!_()) return;
3766
+ if (!Array.isArray(e)) throw $(/* @__PURE__ */ TypeError("loader 必须返回 children 数组"), "pro.table.structured.theLoaderMustReturnAChildrenArray");
3767
+ let r = new Map(s).set(t, e), i = f(r);
3768
+ s = r, p(i), y(t, { status: e.length ? "loaded" : "empty" }), n.value = n.value.filter((e) => e.key !== t);
3769
+ }).catch((e) => {
3770
+ _() && (y(t, {
3771
+ status: "error",
3772
+ error: String(e)
3773
+ }), n.value = [...n.value.filter((e) => e.key !== t), Wt({
3774
+ code: "load",
3775
+ key: t
3776
+ }, kt(e, String(e)))]);
3777
+ }).finally(() => {
3778
+ l.get(t) === g && l.delete(t);
3779
+ }), g.promise;
3780
+ }
3781
+ function x(e) {
3782
+ if (c) return;
3783
+ let t = d();
3784
+ r.value = [...new Set(e)].filter((e) => t.get(e)?.expandable);
3785
+ for (let e of r.value) i.value.get(e)?.status !== "error" && b(e);
3786
+ }
3787
+ function S(e, t = !r.value.includes(e)) {
3788
+ x(t ? [...r.value, e] : r.value.filter((t) => t !== e));
3789
+ }
3790
+ function C(e) {
3791
+ let t = [];
3792
+ function n(i) {
3793
+ for (let a of i) (e !== "loaded-leaves" || !a.expandable) && t.push(a.original), (e !== "visible" || r.value.includes(a.key)) && n(a.children);
3794
+ }
3795
+ return n(u.value), t;
3796
+ }
3797
+ function w() {
3798
+ c || (c = !0, v(), h(), t.value = [], r.value = []);
3799
+ }
3800
+ return T() && L(w), x(r.value), {
3801
+ nodes: u,
3802
+ issues: n,
3803
+ expandedKeys: r,
3804
+ loads: i,
3805
+ generation: a,
3806
+ scope: o,
3807
+ mode: e.mode,
3808
+ load: b,
3809
+ toggle: S,
3810
+ setExpandedKeys: x,
3811
+ refresh: () => g(!0),
3812
+ rows: C,
3813
+ dispose: w
3814
+ };
3815
+ }
3816
+ //#endregion
3817
+ export { at as $, Lt as A, jt as B, on as C, Jt as D, Zt as E, Ut as F, Ft as G, kt as H, Ht as I, xt as J, It as K, zt as L, $ as M, Nt as N, Q as O, Rt as P, lt as Q, Wt as R, an as S, tn as T, Ot as U, Mt as V, Dt as W, pt as X, bt as Y, ft as Z, vn as _, Mn as a, He as at, pn as b, Dn as c, X as ct, wn as d, Pe as dt, Ze as et, Cn as f, Be as ft, yn as g, bn as h, Fn as i, Ue as it, Bt as j, At as k, On as l, ze as lt, Sn as m, Vn as n, Ke as nt, jn as o, Ve as ot, xn as p, St as q, In as r, Ge as rt, kn as s, Fe as st, Hn as t, Je as tt, Tn as u, Re as ut, _n as v, nn as w, ln as x, mn as y, Z as z };