@declarion/react 0.65.1 → 0.66.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 (467) hide show
  1. package/dist-lib/api/access-expiry.js +32 -0
  2. package/dist-lib/api/agents.js +105 -0
  3. package/dist-lib/api/auth-redirect.js +30 -0
  4. package/dist-lib/api/auth.js +67 -0
  5. package/dist-lib/api/batch.js +34 -0
  6. package/dist-lib/api/client.js +241 -0
  7. package/dist-lib/api/data.js +122 -0
  8. package/dist-lib/api/entities.js +160 -0
  9. package/dist-lib/api/events.js +120 -0
  10. package/dist-lib/api/fileReferences.js +8 -0
  11. package/dist-lib/api/params.js +20 -0
  12. package/dist-lib/api/properties.js +25 -0
  13. package/dist-lib/api/request-bounds.js +28 -0
  14. package/dist-lib/api/schema.js +71 -0
  15. package/dist-lib/api/session-renewal.js +36 -0
  16. package/dist-lib/api/status.js +17 -0
  17. package/dist-lib/app.js +262 -0
  18. package/dist-lib/components/actions/ActionButton.js +116 -0
  19. package/dist-lib/{ActionDialog-C6EG-AmC.js → components/actions/ActionDialog.js} +63 -53
  20. package/dist-lib/{ActionResultDialog.impl-BATutW8J.js → components/actions/ActionResultDialog.impl.js} +53 -48
  21. package/dist-lib/components/actions/ActionResultDialog.js +12 -0
  22. package/dist-lib/components/actions/ActionRunner.js +274 -0
  23. package/dist-lib/components/actions/ObjectActionBar.js +127 -0
  24. package/dist-lib/components/actions/PropertyGridEditor.js +202 -0
  25. package/dist-lib/components/actions/ResponsiveActionBar.js +773 -0
  26. package/dist-lib/components/actions/RowActionsKebab.js +90 -0
  27. package/dist-lib/{AgentChatPanel.impl-D5y_qEex.js → components/agents/AgentChatPanel.impl.js} +314 -362
  28. package/dist-lib/components/agents/AgentChatPanel.js +12 -0
  29. package/dist-lib/components/agents/AgentConversationDrawer.js +59 -0
  30. package/dist-lib/components/agents/AgentElicitForm.js +152 -0
  31. package/dist-lib/components/agents/AgentOpenFollower.impl.js +7 -0
  32. package/dist-lib/components/agents/AgentOpenFollower.js +12 -0
  33. package/dist-lib/components/agents/AgentPicker.js +58 -0
  34. package/dist-lib/components/agents/transcript-runs.js +52 -0
  35. package/dist-lib/components/chrome/AssociationTabs.js +176 -0
  36. package/dist-lib/components/chrome/AuditMetaStrip.js +64 -0
  37. package/dist-lib/components/chrome/Breadcrumbs.js +67 -0
  38. package/dist-lib/components/chrome/HighlightsStrip.js +39 -0
  39. package/dist-lib/{PageHeader-DiwLe7CO.js → components/chrome/PageHeader.js} +19 -15
  40. package/dist-lib/{PageShell-BJz1MiTH.js → components/chrome/PageShell.js} +3 -3
  41. package/dist-lib/components/chrome/RecordHeader.js +119 -0
  42. package/dist-lib/{headerActionZone-bef-tZZ7.js → components/chrome/headerActionZone.js} +1 -1
  43. package/dist-lib/components/detail-layout/AssociatedBlock.js +1244 -0
  44. package/dist-lib/components/detail-layout/AssociatedToolbar.js +87 -0
  45. package/dist-lib/components/detail-layout/ChildrenBlock.js +80 -0
  46. package/dist-lib/components/detail-layout/ChildrenCards.js +156 -0
  47. package/dist-lib/components/detail-layout/ChildrenList.js +135 -0
  48. package/dist-lib/components/detail-layout/ChildrenTable.js +189 -0
  49. package/dist-lib/components/detail-layout/ChildrenTimeline.js +609 -0
  50. package/dist-lib/components/detail-layout/DetailAuditStrip.js +40 -0
  51. package/dist-lib/components/detail-layout/DetailHighlights.js +54 -0
  52. package/dist-lib/{DraggableChildrenTable-Dd5SeuF6.js → components/detail-layout/DraggableChildrenTable.js} +56 -53
  53. package/dist-lib/components/detail-layout/EditableChildrenTable.js +341 -0
  54. package/dist-lib/components/detail-layout/ErrorSummary.js +89 -0
  55. package/dist-lib/components/detail-layout/EvidenceBlock.js +66 -0
  56. package/dist-lib/{FieldRow-DedGIY9R.js → components/detail-layout/FieldRow.js} +8 -7
  57. package/dist-lib/components/detail-layout/FieldsBlock.js +74 -0
  58. package/dist-lib/components/detail-layout/LayoutColumn.js +16 -0
  59. package/dist-lib/components/detail-layout/LayoutRenderer.js +54 -0
  60. package/dist-lib/components/detail-layout/LayoutRow.js +83 -0
  61. package/dist-lib/components/detail-layout/LayoutTabs.js +195 -0
  62. package/dist-lib/components/detail-layout/PropertiesBlock.js +74 -0
  63. package/dist-lib/components/detail-layout/QuickAddForm.js +81 -0
  64. package/dist-lib/components/detail-layout/SectionBlock.js +48 -0
  65. package/dist-lib/components/detail-layout/StatusesBlock.js +18 -0
  66. package/dist-lib/components/detail-layout/TimelineComposer.js +205 -0
  67. package/dist-lib/components/detail-layout/blockMeta.js +27 -0
  68. package/dist-lib/components/detail-layout/useManualColumnResize.js +94 -0
  69. package/dist-lib/components/detail-layout/useQuickAdd.js +85 -0
  70. package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +295 -0
  71. package/dist-lib/components/detail-layout/widgets/JsonDiffWidget.js +107 -0
  72. package/dist-lib/components/detail-layout/widgets/MonacoJson.js +47 -0
  73. package/dist-lib/components/detail-layout/widgets/WidgetHost.js +36 -0
  74. package/dist-lib/components/detail-layout/widgets/builtins.js +10 -0
  75. package/dist-lib/components/detail-layout/widgets/canonicalizeJson.js +32 -0
  76. package/dist-lib/components/detail-layout/widgets/monacoBootstrap.js +16 -0
  77. package/dist-lib/components/detail-layout/widgets/registry.js +13 -0
  78. package/dist-lib/components/fields/BoolField.js +13 -0
  79. package/dist-lib/components/fields/EmailField.js +16 -0
  80. package/dist-lib/components/fields/EnumField.js +38 -0
  81. package/dist-lib/components/fields/FileReferenceField.js +60 -0
  82. package/dist-lib/components/fields/IntArrayField.js +83 -0
  83. package/dist-lib/components/fields/JsonField.js +51 -0
  84. package/dist-lib/components/fields/MultilangArrayField.js +56 -0
  85. package/dist-lib/components/fields/MultilangField.js +65 -0
  86. package/dist-lib/components/fields/MultilangTextField.js +65 -0
  87. package/dist-lib/components/fields/NumberField.js +64 -0
  88. package/dist-lib/components/fields/PasswordField.js +34 -0
  89. package/dist-lib/components/fields/PhoneField.js +84 -0
  90. package/dist-lib/components/fields/RefCombobox.js +112 -0
  91. package/dist-lib/components/fields/RefField.js +45 -0
  92. package/dist-lib/components/fields/RichTextField.js +225 -0
  93. package/dist-lib/components/fields/SecretField.js +34 -0
  94. package/dist-lib/components/fields/StringArrayField.js +165 -0
  95. package/dist-lib/components/fields/StringField.js +39 -0
  96. package/dist-lib/components/fields/StructureField.js +221 -0
  97. package/dist-lib/components/fields/TextField.js +76 -0
  98. package/dist-lib/components/fields/TimestampField.js +110 -0
  99. package/dist-lib/components/fields/UrlField.js +18 -0
  100. package/dist-lib/components/fields/cells/factories/badge.js +42 -0
  101. package/dist-lib/components/fields/cells/factories/boolPill.js +17 -0
  102. package/dist-lib/components/fields/cells/factories/code.js +11 -0
  103. package/dist-lib/components/fields/cells/factories/date.js +30 -0
  104. package/dist-lib/components/fields/cells/factories/email.js +26 -0
  105. package/dist-lib/components/fields/cells/factories/emptyCell.js +10 -0
  106. package/dist-lib/components/fields/cells/factories/fileReference.js +17 -0
  107. package/dist-lib/components/fields/cells/factories/host-icons.js +146 -0
  108. package/dist-lib/components/fields/cells/factories/json.js +61 -0
  109. package/dist-lib/components/fields/cells/factories/link.js +32 -0
  110. package/dist-lib/components/fields/cells/factories/markdown.js +31 -0
  111. package/dist-lib/components/fields/cells/factories/markdownPreview.js +81 -0
  112. package/dist-lib/components/fields/cells/factories/money.js +37 -0
  113. package/dist-lib/components/fields/cells/factories/multilangInline.js +35 -0
  114. package/dist-lib/components/fields/cells/factories/nextRun.js +46 -0
  115. package/dist-lib/components/fields/cells/factories/number.js +42 -0
  116. package/dist-lib/components/fields/cells/factories/passwordMask.js +23 -0
  117. package/dist-lib/components/fields/cells/factories/phone.js +35 -0
  118. package/dist-lib/components/fields/cells/factories/refLink.js +57 -0
  119. package/dist-lib/components/fields/cells/factories/richTextPreview.js +34 -0
  120. package/dist-lib/components/fields/cells/factories/statusPill.js +35 -0
  121. package/dist-lib/components/fields/cells/factories/tagList.js +44 -0
  122. package/dist-lib/components/fields/cells/factories/text.js +5 -0
  123. package/dist-lib/components/fields/cells/factories/timestamp.js +18 -0
  124. package/dist-lib/components/fields/cells/factories/url-helpers.js +49 -0
  125. package/dist-lib/components/fields/cells/factories/url.js +45 -0
  126. package/dist-lib/components/fields/cells/registry.js +58 -0
  127. package/dist-lib/components/fields/index.js +80 -0
  128. package/dist-lib/components/fields/langMap.js +6 -0
  129. package/dist-lib/components/fields/secretValue.js +7 -0
  130. package/dist-lib/components/file-widgets/CircleImage.js +11 -0
  131. package/dist-lib/components/file-widgets/DocumentCard.js +277 -0
  132. package/dist-lib/components/file-widgets/FileList.js +213 -0
  133. package/dist-lib/{Grid-XUHm5SDe.js → components/file-widgets/Grid.js} +45 -40
  134. package/dist-lib/components/file-widgets/GridLazy.js +15 -0
  135. package/dist-lib/components/file-widgets/ImageWidget.js +354 -0
  136. package/dist-lib/components/file-widgets/LabeledSlots.js +69 -0
  137. package/dist-lib/components/file-widgets/SquareImage.js +11 -0
  138. package/dist-lib/components/file-widgets/UnknownFileWidget.js +22 -0
  139. package/dist-lib/components/file-widgets/UploadFailureText.js +10 -0
  140. package/dist-lib/components/file-widgets/WideBanner.js +11 -0
  141. package/dist-lib/components/file-widgets/builtins.js +15 -0
  142. package/dist-lib/components/file-widgets/cropper.js +13 -0
  143. package/dist-lib/components/file-widgets/draft-scope.js +59 -0
  144. package/dist-lib/components/file-widgets/helpers.js +75 -0
  145. package/dist-lib/components/file-widgets/host.js +75 -0
  146. package/dist-lib/{payload-DioMoxMX.js → components/file-widgets/payload.js} +14 -14
  147. package/dist-lib/components/file-widgets/registry.js +13 -0
  148. package/dist-lib/components/file-widgets/upload.js +180 -0
  149. package/dist-lib/components/file-widgets/useEmbedFileSrc.js +45 -0
  150. package/dist-lib/components/file-widgets/value.js +12 -0
  151. package/dist-lib/components/filters/FilterChips.js +123 -0
  152. package/dist-lib/components/filters/FilterConditionValue.js +40 -0
  153. package/dist-lib/components/filters/FilterDrawer.js +670 -0
  154. package/dist-lib/components/filters/FilterOmittedNotice.js +14 -0
  155. package/dist-lib/components/filters/filter-op-label.js +8 -0
  156. package/dist-lib/{CommandPalette.impl-DRI5kxVY.js → components/layout/CommandPalette.impl.js} +62 -61
  157. package/dist-lib/components/layout/CommandPalette.js +12 -0
  158. package/dist-lib/{DirtyTabsCloseDialog.impl-FhAiOmEb.js → components/layout/DirtyTabsCloseDialog.impl.js} +16 -14
  159. package/dist-lib/components/layout/DirtyTabsCloseDialog.js +12 -0
  160. package/dist-lib/{ImpersonationBanner.impl--g0iYwcV.js → components/layout/ImpersonationBanner.impl.js} +4 -3
  161. package/dist-lib/components/layout/ImpersonationBanner.js +12 -0
  162. package/dist-lib/components/layout/ImpersonationFrame.js +29 -0
  163. package/dist-lib/{ImpersonationStartModal.impl-BFBN0YJe.js → components/layout/ImpersonationStartModal.impl.js} +9 -9
  164. package/dist-lib/components/layout/ImpersonationStartModal.js +12 -0
  165. package/dist-lib/components/layout/Layout.js +755 -0
  166. package/dist-lib/components/layout/Rail.js +149 -0
  167. package/dist-lib/components/layout/Sidebar.js +362 -0
  168. package/dist-lib/components/layout/TabStrip.js +321 -0
  169. package/dist-lib/components/layout/TenantChip.js +355 -0
  170. package/dist-lib/components/layout/TopBar.js +305 -0
  171. package/dist-lib/components/layout/tab-close.js +24 -0
  172. package/dist-lib/components/list/ColumnPicker.js +112 -0
  173. package/dist-lib/components/list/InlineEditCell.js +107 -0
  174. package/dist-lib/components/list/PeekFieldCell.js +143 -0
  175. package/dist-lib/components/list/QuickPeek.js +263 -0
  176. package/dist-lib/components/list/ViewSwitcher.js +156 -0
  177. package/dist-lib/components/list/peekDraftStore.js +14 -0
  178. package/dist-lib/{AdminCatalogPage.impl-B-7MLqa1.js → components/pages/AdminCatalogPage.impl.js} +53 -49
  179. package/dist-lib/components/pages/AdminCatalogPage.js +12 -0
  180. package/dist-lib/components/pages/DocumentsMenu.js +150 -0
  181. package/dist-lib/components/pages/ExportMenu.js +123 -0
  182. package/dist-lib/{NotFoundPage.impl-BoX11u-P.js → components/pages/NotFoundPage.impl.js} +6 -4
  183. package/dist-lib/components/pages/NotFoundPage.js +12 -0
  184. package/dist-lib/components/pages/RecordDocumentsPanel.js +230 -0
  185. package/dist-lib/components/pages/RecordNotesPanel.js +200 -0
  186. package/dist-lib/components/pages/RecordPanels.js +18 -0
  187. package/dist-lib/components/pages/SSOCallbackPage.impl.js +28 -0
  188. package/dist-lib/components/pages/SSOCallbackPage.js +12 -0
  189. package/dist-lib/components/pages/SmartDetailPage.impl.js +986 -0
  190. package/dist-lib/components/pages/SmartDetailPage.js +12 -0
  191. package/dist-lib/components/pages/SmartListPage.impl.js +708 -0
  192. package/dist-lib/components/pages/SmartListPage.js +12 -0
  193. package/dist-lib/components/pages/SmartRecordListPage.impl.js +818 -0
  194. package/dist-lib/components/pages/SmartRecordListPage.js +12 -0
  195. package/dist-lib/components/pages/auth/AuthShell.js +350 -0
  196. package/dist-lib/{Forgot.impl-6tL6SBlS.js → components/pages/auth/Forgot.impl.js} +13 -12
  197. package/dist-lib/components/pages/auth/Forgot.js +12 -0
  198. package/dist-lib/{Reset.impl-D0pjhS6d.js → components/pages/auth/Reset.impl.js} +17 -15
  199. package/dist-lib/components/pages/auth/Reset.js +12 -0
  200. package/dist-lib/components/pages/auth/SignIn.js +252 -0
  201. package/dist-lib/{SignUp.impl-CfEXrUeg.js → components/pages/auth/SignUp.impl.js} +31 -27
  202. package/dist-lib/components/pages/auth/SignUp.js +12 -0
  203. package/dist-lib/{TwoFA.impl-B2HtPduH.js → components/pages/auth/TwoFA.impl.js} +9 -8
  204. package/dist-lib/components/pages/auth/TwoFA.js +12 -0
  205. package/dist-lib/components/pages/auth/icons.js +56 -0
  206. package/dist-lib/components/pages/exportRequest.js +17 -0
  207. package/dist-lib/components/pages/list/DataCell.js +27 -0
  208. package/dist-lib/components/pages/list/DeleteViewDialog.js +22 -0
  209. package/dist-lib/{ListCardsBody-BEoYjSZ2.js → components/pages/list/ListCardRow.js} +47 -72
  210. package/dist-lib/components/pages/list/ListCardsBody.js +31 -0
  211. package/dist-lib/components/pages/list/ListFloatbar.js +130 -0
  212. package/dist-lib/components/pages/list/ListFooter.js +138 -0
  213. package/dist-lib/components/pages/list/ListHeader.js +120 -0
  214. package/dist-lib/components/pages/list/ListNoRows.js +72 -0
  215. package/dist-lib/components/pages/list/ListTable.js +191 -0
  216. package/dist-lib/components/pages/list/ListTableRow.js +37 -0
  217. package/dist-lib/components/pages/list/ListToolbar.js +261 -0
  218. package/dist-lib/components/pages/list/ListUrlBanner.js +45 -0
  219. package/dist-lib/components/pages/list/RowActionsCell.js +49 -0
  220. package/dist-lib/components/pages/list/RowContextMenu.js +55 -0
  221. package/dist-lib/components/pages/list/SaveViewDialog.js +111 -0
  222. package/dist-lib/{SortHeaderMenu-Co5PvhTA.js → components/pages/list/SortHeaderMenu.js} +18 -17
  223. package/dist-lib/{cardProjection-Cxlogzh8.js → components/pages/list/cardProjection.js} +3 -3
  224. package/dist-lib/components/pages/list/column-sizing.js +17 -0
  225. package/dist-lib/components/pages/list/columns.js +168 -0
  226. package/dist-lib/components/pages/list/filter-meta.js +84 -0
  227. package/dist-lib/components/pages/list/page-size.js +11 -0
  228. package/dist-lib/components/pages/list/sortable-header.js +18 -0
  229. package/dist-lib/components/pages/list/table-features.js +11 -0
  230. package/dist-lib/components/pages/list/use-filter-value-labels.js +115 -0
  231. package/dist-lib/components/pages/list/useActiveView.js +98 -0
  232. package/dist-lib/components/pages/list/useHeaderReorder.js +93 -0
  233. package/dist-lib/components/pages/list/useListColumnLayout.js +56 -0
  234. package/dist-lib/components/pages/list/useListFilterPresentation.js +34 -0
  235. package/dist-lib/components/pages/list/useListQuery.js +101 -0
  236. package/dist-lib/components/pages/list/useListRowInteraction.js +120 -0
  237. package/dist-lib/components/pages/list/useListSelection.js +53 -0
  238. package/dist-lib/components/pages/list/useListSort.js +44 -0
  239. package/dist-lib/components/pages/list/useListViews.js +148 -0
  240. package/dist-lib/components/pages/list/useRowMenu.js +106 -0
  241. package/dist-lib/components/pages/list/visible-filters.js +19 -0
  242. package/dist-lib/{Preferences.impl-Ct5xwZtT.js → components/pages/profile/Preferences.impl.js} +34 -31
  243. package/dist-lib/components/pages/profile/Preferences.js +12 -0
  244. package/dist-lib/components/pages/profile/Profile.impl.js +437 -0
  245. package/dist-lib/components/pages/profile/Profile.js +12 -0
  246. package/dist-lib/{TenantParamsPage.impl-BGpdmEZg.js → components/pages/tenant-params/TenantParamsPage.impl.js} +45 -40
  247. package/dist-lib/components/pages/tenant-params/TenantParamsPage.js +12 -0
  248. package/dist-lib/components/params/ParamsBlock.js +119 -0
  249. package/dist-lib/{param-editors-TYYU7HKK.js → components/params/param-editors.js} +32 -28
  250. package/dist-lib/components/primitives/Avatar.js +33 -0
  251. package/dist-lib/components/primitives/BoolToggle.js +35 -0
  252. package/dist-lib/components/primitives/BrandGlyph.js +38 -0
  253. package/dist-lib/components/primitives/BrandLogo.js +20 -0
  254. package/dist-lib/components/primitives/Btn.js +67 -0
  255. package/dist-lib/{Check-DAfMbQIw.js → components/primitives/Check.js} +2 -2
  256. package/dist-lib/components/primitives/Chip.js +44 -0
  257. package/dist-lib/components/primitives/ClassifiedFieldLocked.js +15 -0
  258. package/dist-lib/components/primitives/Dropdown.js +85 -0
  259. package/dist-lib/components/primitives/Fields.js +751 -0
  260. package/dist-lib/components/primitives/HoverCard.js +115 -0
  261. package/dist-lib/components/primitives/IconBtn.js +37 -0
  262. package/dist-lib/{Icons-lt-7lhYR.js → components/primitives/Icons.js} +1 -1
  263. package/dist-lib/{Kbd-CNttVu0z.js → components/primitives/Kbd.js} +2 -2
  264. package/dist-lib/components/primitives/MenuItem.js +57 -0
  265. package/dist-lib/{Pill-D-wsfRhx.js → components/primitives/Pill.js} +1 -1
  266. package/dist-lib/{RecordIdBadge-wbigZaFc.js → components/primitives/RecordIdBadge.js} +5 -5
  267. package/dist-lib/components/primitives/RowField.js +47 -0
  268. package/dist-lib/{SectionCard-BYHoHWJc.js → components/primitives/SectionCard.js} +10 -10
  269. package/dist-lib/components/primitives/Spinner.js +31 -0
  270. package/dist-lib/components/primitives/StatTile.js +108 -0
  271. package/dist-lib/components/primitives/Tooltip.js +115 -0
  272. package/dist-lib/{dataTableStyles-vwD1mVOP.js → components/primitives/dataTableStyles.js} +1 -1
  273. package/dist-lib/components/shared/BlankScreen.js +13 -0
  274. package/dist-lib/{ChangePasswordDialog.impl-5hDc0wpE.js → components/shared/ChangePasswordDialog.impl.js} +27 -22
  275. package/dist-lib/{ChangePasswordDialog-C_T_3pjl.js → components/shared/ChangePasswordDialog.js} +2 -2
  276. package/dist-lib/components/shared/ConfirmDialog.js +129 -0
  277. package/dist-lib/components/shared/ConnectionNotice.js +12 -0
  278. package/dist-lib/components/shared/CopyButton.js +25 -0
  279. package/dist-lib/components/shared/DynamicIcon.js +73 -0
  280. package/dist-lib/components/shared/EmptyState.js +56 -0
  281. package/dist-lib/components/shared/ErrorBoundary.js +96 -0
  282. package/dist-lib/components/shared/LoadingSkeleton.js +117 -0
  283. package/dist-lib/components/shared/LucideIcon.js +43 -0
  284. package/dist-lib/components/shared/Markdown.js +15 -0
  285. package/dist-lib/{MarkdownRenderer-sK2TRZS-.js → components/shared/MarkdownRenderer.js} +10 -9
  286. package/dist-lib/components/shared/RefreshControl.js +42 -0
  287. package/dist-lib/components/shared/StatusGroupsDisplay.js +123 -0
  288. package/dist-lib/components/shared/StatusStepper.js +70 -0
  289. package/dist-lib/components/shared/toast/DeclarionToast.js +308 -0
  290. package/dist-lib/components/shared/useOwnRefresh.js +19 -0
  291. package/dist-lib/declarion-react.css +1 -1
  292. package/dist-lib/embed/EmbedAuthBootstrap.js +71 -0
  293. package/dist-lib/embed/EmbedContext.js +38 -0
  294. package/dist-lib/embed/EmbedDirtyReporter.js +17 -0
  295. package/dist-lib/embed/EmbedHistoryTracker.js +17 -0
  296. package/dist-lib/embed/EmbedLocationReporter.js +26 -0
  297. package/dist-lib/embed/EmbedResizeReporter.js +25 -0
  298. package/dist-lib/embed/EmbedUnsavedGuard.js +23 -0
  299. package/dist-lib/embed/embed-dirty.js +21 -0
  300. package/dist-lib/embed/embed-history.js +17 -0
  301. package/dist-lib/embed/embed-nav-guard.js +13 -0
  302. package/dist-lib/embed/file-src.js +60 -0
  303. package/dist-lib/embed/handshake.js +37 -0
  304. package/dist-lib/embed/params.js +45 -0
  305. package/dist-lib/embed/protocol.js +26 -0
  306. package/dist-lib/embed/screen-location.js +44 -0
  307. package/dist-lib/embed/theme.js +11 -0
  308. package/dist-lib/embed/token.js +54 -0
  309. package/dist-lib/embed/useEmbedNavigate.js +65 -0
  310. package/dist-lib/embed/useGlobalLinkInterceptor.js +63 -0
  311. package/dist-lib/hooks/useActionData.js +58 -0
  312. package/dist-lib/hooks/useAgentConversation.js +311 -0
  313. package/dist-lib/hooks/useAggregate.js +18 -0
  314. package/dist-lib/hooks/useAllEntityData.js +53 -0
  315. package/dist-lib/hooks/useAssociatedData.js +37 -0
  316. package/dist-lib/hooks/useAuth.js +56 -0
  317. package/dist-lib/hooks/useBranding.js +18 -0
  318. package/dist-lib/hooks/useBrandingChrome.js +58 -0
  319. package/dist-lib/hooks/useChildrenData.js +33 -0
  320. package/dist-lib/hooks/useColumns.js +44 -0
  321. package/dist-lib/hooks/useConnectionNotice.js +35 -0
  322. package/dist-lib/{useCurrentLocation-Bq1T72AW.js → hooks/useCurrentLocation.js} +2 -2
  323. package/dist-lib/hooks/useCurrentScreen.js +20 -0
  324. package/dist-lib/hooks/useCursorEntityData.js +77 -0
  325. package/dist-lib/hooks/useDebounce.js +11 -0
  326. package/dist-lib/hooks/useEntity.js +8 -0
  327. package/dist-lib/hooks/useEntityData.js +64 -0
  328. package/dist-lib/hooks/useFileReferenceJSON.js +29 -0
  329. package/dist-lib/hooks/useFilters.js +28 -0
  330. package/dist-lib/hooks/useFollowAgentOpen.js +84 -0
  331. package/dist-lib/hooks/useImpersonation.js +40 -0
  332. package/dist-lib/hooks/useIntentPrefetch.js +43 -0
  333. package/dist-lib/hooks/useJsonSnapshot.js +8 -0
  334. package/dist-lib/hooks/useLanguage.js +21 -0
  335. package/dist-lib/hooks/useLiveObject.js +17 -0
  336. package/dist-lib/hooks/useLongPress.js +49 -0
  337. package/dist-lib/hooks/useMutations.js +70 -0
  338. package/dist-lib/{useObject-B45F96rC.js → hooks/useObject.js} +2 -2
  339. package/dist-lib/hooks/useObjectStatus.js +20 -0
  340. package/dist-lib/hooks/usePageState.js +18 -0
  341. package/dist-lib/hooks/usePageStateRuntime.js +46 -0
  342. package/dist-lib/hooks/usePageStateTtl.js +10 -0
  343. package/dist-lib/hooks/useParams.js +123 -0
  344. package/dist-lib/hooks/useProperties.js +32 -0
  345. package/dist-lib/hooks/useRealtimeThresholds.js +31 -0
  346. package/dist-lib/hooks/useRegisterScreenTab.js +28 -0
  347. package/dist-lib/hooks/useResponsiveMode.js +84 -0
  348. package/dist-lib/hooks/useSSE.js +307 -0
  349. package/dist-lib/hooks/useSchema.js +73 -0
  350. package/dist-lib/hooks/useScreen.js +8 -0
  351. package/dist-lib/hooks/useScreenBack.js +60 -0
  352. package/dist-lib/hooks/useScreenTab.js +11 -0
  353. package/dist-lib/hooks/useTabNavigate.js +82 -0
  354. package/dist-lib/hooks/useTabSearchMirror.js +19 -0
  355. package/dist-lib/{useTabTitle-KrzEo118.js → hooks/useTabTitle.js} +9 -7
  356. package/dist-lib/hooks/useText.js +15 -0
  357. package/dist-lib/hooks/useTimelineData.js +44 -0
  358. package/dist-lib/hooks/useUnsavedInput.js +18 -0
  359. package/dist-lib/hooks/useVersionWatcher.js +62 -0
  360. package/dist-lib/hooks/useViews.js +88 -0
  361. package/dist-lib/hooks/useWindowConversation.js +11 -0
  362. package/dist-lib/icons.js +5 -3
  363. package/dist-lib/index.d.ts +42 -20
  364. package/dist-lib/index.js +131 -3926
  365. package/dist-lib/lib/action-dispatch.js +7 -0
  366. package/dist-lib/lib/actions.js +279 -0
  367. package/dist-lib/lib/anchor.js +41 -0
  368. package/dist-lib/lib/brand-tokens.js +95 -0
  369. package/dist-lib/lib/branding.js +25 -0
  370. package/dist-lib/lib/canonical-url.js +17 -0
  371. package/dist-lib/lib/capabilityPrefetch.js +57 -0
  372. package/dist-lib/lib/child-config.js +111 -0
  373. package/dist-lib/lib/children-validation.js +52 -0
  374. package/dist-lib/lib/decimal-text.js +15 -0
  375. package/dist-lib/lib/display-value.js +19 -0
  376. package/dist-lib/lib/document-templates.js +6 -0
  377. package/dist-lib/lib/download.js +41 -0
  378. package/dist-lib/lib/evidence-verdict.js +23 -0
  379. package/dist-lib/lib/failure.js +9 -0
  380. package/dist-lib/lib/field-classification.js +58 -0
  381. package/dist-lib/lib/field-regions.js +13 -0
  382. package/dist-lib/lib/filter-evaluator.js +98 -0
  383. package/dist-lib/lib/filters.js +118 -0
  384. package/dist-lib/lib/format-count.js +24 -0
  385. package/dist-lib/lib/html-state.js +9 -0
  386. package/dist-lib/lib/language.js +52 -0
  387. package/dist-lib/lib/longPressGesture.js +34 -0
  388. package/dist-lib/lib/mass-edit.js +65 -0
  389. package/dist-lib/{page-inset-D_kkVwwN.js → lib/page-inset.js} +1 -1
  390. package/dist-lib/lib/phone.js +28 -0
  391. package/dist-lib/lib/query-retry.js +7 -0
  392. package/dist-lib/lib/quick-add.js +23 -0
  393. package/dist-lib/lib/realtime-query-keys.js +23 -0
  394. package/dist-lib/lib/realtime-reconcile.js +148 -0
  395. package/dist-lib/lib/realtime-resync.js +192 -0
  396. package/dist-lib/lib/record-documents-key.js +4 -0
  397. package/dist-lib/lib/ref-choices.js +6 -0
  398. package/dist-lib/lib/refetch-when-idle.js +25 -0
  399. package/dist-lib/lib/rich-text.js +46 -0
  400. package/dist-lib/lib/rowClickGesture.js +10 -0
  401. package/dist-lib/lib/safe-url.js +34 -0
  402. package/dist-lib/lib/schema-routing.js +51 -0
  403. package/dist-lib/{screen-back-BtbEp5sO.js → lib/screen-back.js} +2 -2
  404. package/dist-lib/lib/scroll-restoration.js +156 -0
  405. package/dist-lib/lib/size-value.js +22 -0
  406. package/dist-lib/lib/sort.js +59 -0
  407. package/dist-lib/lib/timestamp.js +97 -0
  408. package/dist-lib/lib/toast.js +78 -0
  409. package/dist-lib/lib/ui-actions.js +81 -0
  410. package/dist-lib/{utils-D_QDpB8_.js → lib/utils.js} +1 -1
  411. package/dist-lib/lib/variants.js +63 -0
  412. package/dist-lib/lib/versionTracker.js +102 -0
  413. package/dist-lib/lib/viewport-category.js +12 -0
  414. package/dist-lib/{window-election-CHIvIZwx.js → lib/window-election.js} +1 -1
  415. package/dist-lib/stores/auth.js +84 -0
  416. package/dist-lib/stores/icon-registry.js +24 -0
  417. package/dist-lib/stores/list-layout.js +178 -0
  418. package/dist-lib/{page-state-eA6J_KIR.js → stores/page-state.js} +1 -1
  419. package/dist-lib/stores/preferences.js +126 -0
  420. package/dist-lib/stores/realtime.js +115 -0
  421. package/dist-lib/stores/screen-registry.js +10 -0
  422. package/dist-lib/stores/tabs.js +220 -0
  423. package/dist-lib/test/seed-schema.js +8 -0
  424. package/dist-lib/testing.d.ts +1 -1
  425. package/dist-lib/testing.js +80 -76
  426. package/dist-lib/types/api.js +48 -0
  427. package/dist-lib/types/fieldType.js +4 -0
  428. package/dist-lib/types/ordmap.js +50 -0
  429. package/dist-lib/types/schema.js +173 -0
  430. package/dist-lib/{useResponsiveMode-DIR1bZfo.d.ts → useResponsiveMode-DmrpMbZX.d.ts} +44 -16
  431. package/package.json +13 -12
  432. package/dist-lib/ActionRunner-DdBFhqGe.js +0 -1440
  433. package/dist-lib/AgentOpenFollower.impl-BAs_wGEZ.js +0 -81
  434. package/dist-lib/AssociatedBlock-BOoPLOjw.js +0 -1515
  435. package/dist-lib/AuthShell-C8aVwHS7.js +0 -361
  436. package/dist-lib/BlankScreen-DVc7fh8C.js +0 -61
  437. package/dist-lib/CopyButton-DRIT_f0k.js +0 -119
  438. package/dist-lib/DynamicIcon-DuBSz6TZ.js +0 -133
  439. package/dist-lib/FilterChips-Cv1tlXyo.js +0 -1031
  440. package/dist-lib/LayoutRenderer-d-tXYPze.js +0 -3239
  441. package/dist-lib/MenuItem-CfkVXPvC.js +0 -140
  442. package/dist-lib/MonacoJson-BG3S3GHX.js +0 -60
  443. package/dist-lib/Profile.impl-Cypk27ah.js +0 -527
  444. package/dist-lib/PropertyGridEditor-XrP6TZ5s.js +0 -4378
  445. package/dist-lib/RecordHeader-BfQ0_4wq.js +0 -217
  446. package/dist-lib/RefreshControl-CRdWPoF5.js +0 -195
  447. package/dist-lib/SSOCallbackPage.impl-Cfi2pQ59.js +0 -31
  448. package/dist-lib/SmartDetailPage.impl-BiIX0n7K.js +0 -1609
  449. package/dist-lib/SmartListPage.impl-Cu83Gv_G.js +0 -2818
  450. package/dist-lib/SmartRecordListPage.impl-DR6lq7HA.js +0 -795
  451. package/dist-lib/format-count-lyB4CPen.js +0 -943
  452. package/dist-lib/peekDraftStore-CaimrOhW.js +0 -200
  453. package/dist-lib/registry-CGe5kCXN.js +0 -119
  454. package/dist-lib/use-filter-value-labels-D3YDgUzg.js +0 -413
  455. package/dist-lib/useAgentConversation-rru-7hnF.js +0 -612
  456. package/dist-lib/useBranding-zcxEic2k.js +0 -41
  457. package/dist-lib/useBrandingChrome-bxaR3G1R.js +0 -170
  458. package/dist-lib/useCurrentScreen-BZOHBGQZ.js +0 -2522
  459. package/dist-lib/useImpersonation-DBIRRR70.js +0 -35
  460. package/dist-lib/useOwnRefresh-DJjaje52.js +0 -435
  461. package/dist-lib/useParams-BFLJi4n3.js +0 -133
  462. package/dist-lib/useProperties-B7opZ-iy.js +0 -81
  463. package/dist-lib/useScreenBack-DENlz844.js +0 -71
  464. package/dist-lib/useTabNavigate-CUqOmcMj.js +0 -78
  465. package/dist-lib/value-BuQVYx52.js +0 -194
  466. package/dist-lib/variants-vUtfBbE6.js +0 -1961
  467. /package/dist-lib/{JsonEditor-Dz1PQHC8.js → components/fields/JsonEditor.js} +0 -0
@@ -1,2818 +0,0 @@
1
- import { $t as e, A as t, F as n, Ft as r, It as i, L as a, M as o, Nt as s, O as c, P as l, Q as u, T as d, U as f, Xt as p, Zt as m, an as h, at as g, dt as _, en as v, f as y, g as b, in as x, j as S, l as C, on as w, pn as T, qn as E, s as D, sn as ee, ut as O, wn as k, wt as A, xt as te } from "./useCurrentScreen-BZOHBGQZ.js";
2
- import { t as j } from "./Icons-lt-7lhYR.js";
3
- import { n as M, r as N } from "./CopyButton-DRIT_f0k.js";
4
- import { t as P } from "./Pill-D-wsfRhx.js";
5
- import { t as ne } from "./Kbd-CNttVu0z.js";
6
- import { a as re, c as ie, d as ae, f as oe, l as se, m as ce, o as le, s as ue, t as de } from "./format-count-lyB4CPen.js";
7
- import { n as fe, t as F } from "./MenuItem-CfkVXPvC.js";
8
- import { A as pe, L as me, Q as he, X as ge, _ as _e, h as ve, p as ye, z as be } from "./PropertyGridEditor-XrP6TZ5s.js";
9
- import { a as xe, n as Se } from "./useBrandingChrome-bxaR3G1R.js";
10
- import { t as I } from "./Check-DAfMbQIw.js";
11
- import { t as Ce } from "./useScreenBack-DENlz844.js";
12
- import { n as we } from "./useTabNavigate-CUqOmcMj.js";
13
- import { t as Te } from "./page-inset-D_kkVwwN.js";
14
- import { d as Ee, f as De, g as Oe, h as ke, m as Ae, n as je, p as Me, v as Ne } from "./ActionRunner-DdBFhqGe.js";
15
- import { a as Pe, c as Fe, g as L, o as Ie, v as Le } from "./useOwnRefresh-DJjaje52.js";
16
- import { a as Re, c as ze, f as Be, g as Ve, i as He, l as Ue, m as We, n as Ge, p as Ke, s as qe, t as Je } from "./variants-vUtfBbE6.js";
17
- import { n as Ye, t as Xe } from "./payload-DioMoxMX.js";
18
- import { a as Ze, d as Qe, g as $e, m as et, n as tt, o as nt, t as rt, u as it } from "./FilterChips-Cv1tlXyo.js";
19
- import { a as at, i as ot, t as st } from "./RefreshControl-CRdWPoF5.js";
20
- import { a as ct, c as lt, i as ut, n as R, o as dt, s as ft, t as pt } from "./peekDraftStore-CaimrOhW.js";
21
- import { i as mt, n as ht, r as gt, t as _t } from "./cardProjection-Cxlogzh8.js";
22
- import { a as vt, i as yt, n as bt, o as xt, t as St } from "./use-filter-value-labels-D3YDgUzg.js";
23
- import { Suspense as Ct, createElement as z, lazy as wt, memo as Tt, useCallback as B, useEffect as V, useMemo as H, useRef as U, useState as W } from "react";
24
- import { useQueryClient as Et } from "@tanstack/react-query";
25
- import { Fragment as G, jsx as K, jsxs as q } from "react/jsx-runtime";
26
- import { useSearchParams as Dt } from "react-router";
27
- import { columnResizingFeature as Ot, columnSizingFeature as kt, columnVisibilityFeature as At, flexRender as J, rowSelectionFeature as Y, rowSortingFeature as jt, tableFeatures as Mt, useTable as Nt } from "@tanstack/react-table";
28
- import { useVirtualizer as Pt } from "@tanstack/react-virtual";
29
- //#region src/components/pages/list/useActiveView.ts
30
- var Ft = [], X = [], It = [
31
- "search",
32
- "per_page",
33
- "include_deleted"
34
- ];
35
- function Lt(e) {
36
- let t = new URLSearchParams();
37
- for (let n of [...It, ...m]) {
38
- let r = e.get(n);
39
- r !== null && r !== "" && t.set(n, r);
40
- }
41
- return t.set("page", "1"), t;
42
- }
43
- function Rt(e, t, n) {
44
- return `dcl:smartlist:default-view-cleared:${t ?? ""}:${n ?? ""}:${e}`;
45
- }
46
- function zt(e) {
47
- if (typeof window > "u") return !1;
48
- try {
49
- return window.sessionStorage?.getItem(e) === "1";
50
- } catch {
51
- return !1;
52
- }
53
- }
54
- function Bt(e, t, n) {
55
- return {
56
- filters: t?.filters ?? Ft,
57
- sort: b(e, t?.sort) ?? b(e, n?.sort_default)
58
- };
59
- }
60
- function Vt({ screenCode: e, screen: t, entity: n, searchParams: r, setSearchParams: i, userId: a, tenantId: o, filterError: s }) {
61
- let { views: c, isSettled: l, refetch: u } = ae(e, a), d = r.get("view"), f = H(() => c.find((e) => e.id === d), [c, d]), p = se(l && !f ? d : null, a), m = f ?? p.view, h = !!d && !m && (!l || !p.isSettled), g = r.get("filters") !== null || r.get("columns") !== null || r.get("sort") !== null, _ = `${e}|${d ?? ""}`, [v, y] = W(null), b = v === _, x = Rt(e, o, a), S = zt(x), C = H(() => {
62
- if (!(d || S || g)) return c.find((e) => e.source === "personal" && e.is_default) ?? (t?.default_view ? c.find((e) => e.source === "system" && e.id === t.default_view) : void 0);
63
- }, [
64
- d,
65
- S,
66
- g,
67
- c,
68
- t?.default_view
69
- ]);
70
- V(() => {
71
- if (b) return;
72
- if (s || d || S || g) {
73
- y(_);
74
- return;
75
- }
76
- if (!l || (y(_), !C?.id)) return;
77
- let e = Lt(r);
78
- e.set("view", C.id), i(e, { replace: !0 });
79
- }, [
80
- b,
81
- _,
82
- s,
83
- d,
84
- S,
85
- g,
86
- l,
87
- C,
88
- r,
89
- i
90
- ]);
91
- let w = h, T = !d && !s && !S && !g && (!b || !!C);
92
- return {
93
- all: c,
94
- activeId: d,
95
- active: m,
96
- defaults: H(() => ({
97
- ...Bt(n, m, t),
98
- columns: m?.columns?.length ? m.columns : t?.default_columns ?? t?.columns ?? X
99
- }), [
100
- n,
101
- m,
102
- t
103
- ]),
104
- clearedKey: x,
105
- clearActiveView: B(() => {
106
- if (typeof window < "u") try {
107
- window.sessionStorage?.setItem(x, "1");
108
- } catch {}
109
- let e = new URLSearchParams(r);
110
- e.delete("view"), e.set("page", "1"), i(e, { replace: !0 });
111
- }, [
112
- r,
113
- i,
114
- x
115
- ]),
116
- retryViews: u,
117
- isUnresolved: !!d && !m && !h,
118
- isHeld: w || T
119
- };
120
- }
121
- //#endregion
122
- //#region src/components/pages/list/table-features.ts
123
- var Ht = Mt({
124
- rowSortingFeature: jt,
125
- rowSelectionFeature: Y,
126
- columnSizingFeature: kt,
127
- columnResizingFeature: Ot,
128
- columnVisibilityFeature: At
129
- }), Ut = [
130
- 25,
131
- 50,
132
- 100,
133
- 200,
134
- 500,
135
- 1e3
136
- ];
137
- //#endregion
138
- //#region src/components/pages/list/useListSort.ts
139
- function Wt({ searchParams: e, setSearchParams: t, defaultSort: n, commitScreenTabSearch: r }) {
140
- let i = e.get("sort") ?? n ?? "", a = H(() => Me(i), [i]), o = H(() => {
141
- let e = /* @__PURE__ */ new Map();
142
- for (let t of a) t.nulls && e.set(t.field, t.nulls);
143
- return e;
144
- }, [a]), s = H(() => Oe(i), [i]), c = H(() => a.map((e) => ({
145
- id: e.field,
146
- desc: e.dir === "desc"
147
- })), [a]), l = B((i) => {
148
- let a = i.slice(0, 5), o = new URLSearchParams(e), s = a.length === 0 ? "" : ke(a);
149
- s === (n ?? "") ? o.delete("sort") : o.set("sort", s), o.set("page", "1"), r(o.toString()), t(o);
150
- }, [
151
- e,
152
- r,
153
- t,
154
- n
155
- ]);
156
- return {
157
- value: i,
158
- cols: a,
159
- nullsByField: o,
160
- forRequest: s,
161
- tableSorting: c,
162
- write: l,
163
- applyColumn: B((e, t, n) => l([{
164
- field: e,
165
- dir: t,
166
- ...n ? { nulls: n } : {}
167
- }]), [l]),
168
- shiftClickColumn: B((e) => l(De(a, e)), [a, l]),
169
- appendColumn: B((e, t, n) => l(Ee(a, {
170
- field: e,
171
- dir: t,
172
- ...n ? { nulls: n } : {}
173
- })), [a, l]),
174
- clearColumn: B((e) => l(Ae(a, e)), [a, l]),
175
- clearAll: B(() => l([]), [l])
176
- };
177
- }
178
- //#endregion
179
- //#region src/components/pages/list/useListSelection.ts
180
- var Gt = {};
181
- function Kt(e, t) {
182
- return T(e, h(e, t));
183
- }
184
- function qt(e, t, n) {
185
- if (!e || n.length === 0) return [];
186
- let r = new Set(n);
187
- return t.filter((t) => r.has(Kt(e, t))).map((t) => h(e, t));
188
- }
189
- function Jt(e, t, n) {
190
- let [r, i] = ie("selection", Gt, { scope: "path" }), a = H(() => e?.fields.names().find((t) => e.fields.get(t)?.primary) ?? "id", [e]), o = B((t) => e ? Kt(e, t) : k(t[a]), [e, a]), s = H(() => Object.keys(r).filter((e) => r[e]), [r]), c = H(() => qt(e, t, s), [
191
- e,
192
- t,
193
- s
194
- ]), l = H(() => {
195
- if (s.length === 0) return [];
196
- let e = /* @__PURE__ */ new Map();
197
- for (let n of t) e.set(o(n), n);
198
- return s.map((t) => e.get(t)).filter((e) => e !== void 0);
199
- }, [
200
- s,
201
- t,
202
- o
203
- ]);
204
- return V(() => {
205
- n || i((e) => {
206
- let n = Object.keys(e);
207
- if (n.length === 0) return e;
208
- let r = new Set(t.map((e) => o(e))), i = {}, a = !1;
209
- for (let t of n) r.has(t) ? i[t] = e[t] : a = !0;
210
- return a ? i : e;
211
- });
212
- }, [
213
- t,
214
- n,
215
- o,
216
- i
217
- ]), {
218
- state: r,
219
- setState: i,
220
- ids: s,
221
- pkValues: c,
222
- rows: l,
223
- keyOf: o
224
- };
225
- }
226
- //#endregion
227
- //#region src/components/pages/list/useListColumnLayout.ts
228
- function Yt({ screenCode: e, screen: t, searchParams: n, setSearchParams: r, defaultColumns: i }) {
229
- let a = A(), o = H(() => {
230
- let e = n.get("columns");
231
- return e ? e.split(",").filter(Boolean) : i;
232
- }, [n, i]), { widths: s, prune: c, setWidths: l, resetWidths: u, resizeEduShown: d, markResizeEduShown: p } = Le(e), [m, h] = W(() => s);
233
- V(() => {
234
- h(s);
235
- }, [s]);
236
- let g = H(() => t?.columns ?? [], [t?.columns]);
237
- V(() => {
238
- g.length > 0 && c(g);
239
- }, [g, c]);
240
- let _ = B((e) => {
241
- if (e.length === 0) return;
242
- let t = new URLSearchParams(n);
243
- e.join(",") === i.join(",") ? t.delete("columns") : t.set("columns", e.join(",")), r(t);
244
- }, [
245
- n,
246
- r,
247
- i
248
- ]);
249
- return {
250
- visible: o,
251
- sizing: m,
252
- setSizing: h,
253
- apply: _,
254
- clear: B(() => {
255
- let e = new URLSearchParams(n);
256
- e.delete("columns"), r(e);
257
- }, [n, r]),
258
- move: B((e, t) => {
259
- let n = o.indexOf(e);
260
- if (n === -1) return;
261
- let r = t === "up" ? n - 1 : n + 1;
262
- if (r < 0 || r >= o.length) return;
263
- let i = [...o];
264
- [i[n], i[r]] = [i[r], i[n]], _(i);
265
- }, [o, _]),
266
- commitResize: B((e) => {
267
- l(e), !d && (p(), f.info(a("list.columns.width_saved_title", "Column width saved on this device"), a("list.columns.width_saved_body", "Widths are personal and never shared. Column order, sort and filters can be saved into a view.")));
268
- }, [
269
- a,
270
- l,
271
- d,
272
- p
273
- ]),
274
- resetWidths: u
275
- };
276
- }
277
- function Xt(e, t, n = 10) {
278
- switch (t.type) {
279
- case "down": return {
280
- origin: {
281
- x: t.x,
282
- y: t.y
283
- },
284
- outcome: "pending"
285
- };
286
- case "move": return e ? Math.abs(t.x - e.x) > n || Math.abs(t.y - e.y) > n ? {
287
- origin: null,
288
- outcome: "idle"
289
- } : {
290
- origin: e,
291
- outcome: "pending"
292
- } : {
293
- origin: null,
294
- outcome: "idle"
295
- };
296
- case "release": return {
297
- origin: null,
298
- outcome: "idle"
299
- };
300
- case "held": return e ? {
301
- origin: null,
302
- outcome: "fire"
303
- } : {
304
- origin: null,
305
- outcome: "idle"
306
- };
307
- }
308
- }
309
- function Zt(e) {
310
- return e instanceof Element && e.closest("a, button, input, select, [role='button'], [role='menuitem']") !== null;
311
- }
312
- function Qt(e, t) {
313
- return e != null && e.rowId === t ? "double" : "single";
314
- }
315
- //#endregion
316
- //#region src/hooks/useLongPress.ts
317
- function $t(e) {
318
- let t = U(null), n = U(null), r = U(!1), i = B(() => {
319
- n.current !== null && clearTimeout(n.current), n.current = null;
320
- }, []);
321
- V(() => i, [i]);
322
- let a = B((e) => {
323
- let n = Xt(t.current, e);
324
- return t.current = n.origin, n.outcome !== "pending" && i(), n;
325
- }, [i]);
326
- return {
327
- handlers: {
328
- onPointerDown: (o) => {
329
- if (o.pointerType === "mouse" || Zt(o.target)) return;
330
- r.current = !1, i();
331
- let s = {
332
- x: o.clientX,
333
- y: o.clientY
334
- };
335
- a({
336
- type: "down",
337
- ...s
338
- }), n.current = setTimeout(() => {
339
- let i = Xt(t.current, { type: "held" });
340
- t.current = i.origin, n.current = null, i.outcome === "fire" && (r.current = !0, e(s));
341
- }, 500);
342
- },
343
- onPointerMove: (e) => {
344
- t.current && a({
345
- type: "move",
346
- x: e.clientX,
347
- y: e.clientY
348
- });
349
- },
350
- onPointerUp: () => void a({ type: "release" }),
351
- onPointerCancel: () => void a({ type: "release" }),
352
- onPointerLeave: () => void a({ type: "release" })
353
- },
354
- consumePressFired: B(() => {
355
- let e = r.current;
356
- return r.current = !1, e;
357
- }, [])
358
- };
359
- }
360
- //#endregion
361
- //#region src/components/pages/list/useListRowInteraction.ts
362
- function en({ entity: e, screen: t, screens: n, entities: r, searchParams: i, tabNavigate: a, commitScreenTabSearch: o, isPhone: s, canUpdate: c }) {
363
- let l = A(), [u, d] = W(null), [f, p] = W(null), m = U(null), _ = U(null);
364
- V(() => () => {
365
- _.current && clearTimeout(_.current.timer);
366
- }, []);
367
- let y = t?.on_row_click === "peek" && t.quick_peek?.enabled !== !1 && !s, b = B((r, s) => {
368
- if (!e || !t) return;
369
- let c = h(e, r), u = T(e, c), d = v(t, e, n, c);
370
- if (!d) return;
371
- if (s?.draft) {
372
- R(u, s.draft);
373
- let [e, t] = d.split("?", 2), n = new URLSearchParams(t ?? "");
374
- n.set("edit", "true"), d = `${e}?${n.toString()}`;
375
- }
376
- let f = ee(l, r, e) ?? l(e.display.name), p = t.display?.icon || e.display.icon;
377
- o(i.toString()), a(d, {
378
- title: f,
379
- icon: p
380
- });
381
- }, [
382
- l,
383
- e,
384
- t,
385
- n,
386
- i,
387
- a,
388
- o
389
- ]), x = $t(B((e) => {
390
- let t = m.current;
391
- t && p({
392
- x: e.x,
393
- y: e.y,
394
- row: t
395
- });
396
- }, [])), S = B((t, n) => {
397
- if (x.consumePressFired() || Zt(t.target)) return;
398
- if (!y || !e) {
399
- b(n);
400
- return;
401
- }
402
- let r = Kt(e, n);
403
- if (Qt(_.current, r) === "double") {
404
- clearTimeout(_.current.timer), _.current = null, d(null), b(n);
405
- return;
406
- }
407
- _.current && clearTimeout(_.current.timer);
408
- let i = setTimeout(() => {
409
- _.current = null, d(n);
410
- }, 250);
411
- _.current = {
412
- rowId: r,
413
- timer: i
414
- };
415
- }, [
416
- e,
417
- y,
418
- b,
419
- x
420
- ]);
421
- return {
422
- peekAllowed: y,
423
- peekRow: u,
424
- setPeekRow: d,
425
- peekFields: H(() => {
426
- if (!y || !e || !u) return [];
427
- let i = Ge(e, t, u);
428
- return gt(e, i, n).map((t) => {
429
- if (e.files?.get(t)) return {
430
- key: t,
431
- label: We(l, e, t, r),
432
- kind: "file",
433
- readOnly: !c
434
- };
435
- let n = e.fields.get(t), i = c && !n.primary && !n.auto && !n.ref && n.files?.mode !== "rich_text_inline";
436
- return {
437
- key: t,
438
- label: w(l, n, t, r),
439
- kind: "field",
440
- field: n,
441
- readOnly: !i
442
- };
443
- });
444
- }, [
445
- l,
446
- y,
447
- u,
448
- e,
449
- t,
450
- r,
451
- n,
452
- c
453
- ]),
454
- peekActions: H(() => e?.actions ?? {}, [e?.actions]),
455
- peekExecute: B(async (t, n, r) => {
456
- let i = e?.fields.names().find((t) => e.fields.get(t)?.primary), a = i && u ? [k(u[i])] : void 0, o = n.entity ? `${n.entity}.${t}` : t;
457
- return O(o, g(r, a));
458
- }, [e, u]),
459
- contextMenu: f,
460
- setContextMenu: p,
461
- pressedRow: m,
462
- longPress: x,
463
- onRowClick: S,
464
- navigateToDetail: b
465
- };
466
- }
467
- //#endregion
468
- //#region src/components/pages/list/column-sizing.ts
469
- function tn(e) {
470
- return `--header-${e}-size`;
471
- }
472
- function Z(e) {
473
- return `--col-${e}-size`;
474
- }
475
- function nn(e) {
476
- return `calc(var(${e}) * 1px)`;
477
- }
478
- function rn(e) {
479
- let t = e.getFlatHeaders(), n = {};
480
- for (let e of t) n[tn(e.id)] = e.getSize(), n[Z(e.column.id)] = e.column.getSize();
481
- return n;
482
- }
483
- //#endregion
484
- //#region src/components/pages/list/sortable-header.ts
485
- var an = /* @__PURE__ */ new Set([
486
- "secret",
487
- "password",
488
- "json",
489
- "string_array",
490
- "int_array",
491
- "uuid_array",
492
- "multilang_array"
493
- ]);
494
- function on(e, t) {
495
- if (e === "_actions" || e === "_select" || e.startsWith("$property.") || e.startsWith("$refs.")) return !1;
496
- if (e.startsWith("$status.")) return !0;
497
- let n = t?.fields.get(e);
498
- return !n || t?.list_pagination === "cursor" && n.cross_store_sortable === !1 ? !1 : !an.has(n.type);
499
- }
500
- //#endregion
501
- //#region src/components/pages/list/ListTable.tsx
502
- var sn = wt(() => import("./SortHeaderMenu-Co5PvhTA.js").then((e) => ({ default: e.SortHeaderMenu }))), cn = Tt(function({ virtualItems: e, topPad: t, bottomPad: n, colSpan: r, rows: i, renderRow: a, showsPreviousRows: o }) {
503
- return /* @__PURE__ */ q("tbody", {
504
- style: o ? {
505
- opacity: .45,
506
- transition: "opacity 120ms"
507
- } : void 0,
508
- children: [
509
- e.length > 0 && /* @__PURE__ */ K("tr", { children: /* @__PURE__ */ K("td", {
510
- style: { height: t },
511
- colSpan: r
512
- }) }),
513
- e.map((e) => a(i[e.index], e.index)),
514
- e.length > 0 && /* @__PURE__ */ K("tr", { children: /* @__PURE__ */ K("td", {
515
- style: { height: n },
516
- colSpan: r
517
- }) })
518
- ]
519
- });
520
- }, (e, t) => t.isResizing);
521
- function ln({ table: e, columns: t, rows: n, entity: r, columnSizeVars: i, totalColumnsWidth: a, theadRef: o, virtualizer: s, visibleCols: c, headerReorder: l, sortCols: u, sortNullsMap: d, shiftClickColumn: f, applyColumnSort: p, appendColumnSort: m, clearColumnSort: h, clearAllSorts: g, renderRow: _, isResizingColumn: v, showsPreviousRows: y }) {
522
- let b = A();
523
- return /* @__PURE__ */ q("table", {
524
- "data-virtual-rows": "true",
525
- "aria-busy": y || void 0,
526
- style: {
527
- ...i,
528
- tableLayout: "fixed",
529
- width: "100%",
530
- minWidth: a,
531
- borderCollapse: "separate",
532
- borderSpacing: 0,
533
- fontSize: 12.5,
534
- color: "var(--text)"
535
- },
536
- children: [/* @__PURE__ */ K("thead", {
537
- ref: o,
538
- children: e.getHeaderGroups().map((e) => /* @__PURE__ */ q("tr", {
539
- style: {
540
- height: 32,
541
- background: "var(--surface-2)"
542
- },
543
- children: [e.headers.map((e) => {
544
- let t = on(e.id, r), n = e.column.getIsSorted(), i = e.id === "_select", a = e.id === "_actions", o = n ? u.findIndex((t) => t.field === e.id) + 1 : 0, s = u.length > 1 && o > 0, _ = o > 0, v = u.length < 5, y = t ? e.column.getToggleSortingHandler() : void 0, x = t ? (t) => {
545
- t.shiftKey ? (t.preventDefault(), f(e.id)) : y?.(t);
546
- } : void 0, S = !i && !a, C = S ? c.indexOf(e.id) : -1, w = l.dragColId === e.id, T = l.isDragging && C !== -1 && l.dropIndex === C, E = l.isDragging && C !== -1 && C === c.length - 1 && l.dropIndex === c.length;
547
- return /* @__PURE__ */ q("th", {
548
- "data-col-id": S ? e.id : void 0,
549
- onMouseDown: S ? (t) => l.onHeaderMouseDown(e.id, t) : void 0,
550
- onClick: (e) => {
551
- l.consumeDragSuppression() || x?.(e);
552
- },
553
- style: {
554
- padding: i ? "0 6px 0 12px" : a ? "0 6px" : "0 10px",
555
- textAlign: "left",
556
- fontWeight: 600,
557
- fontSize: 11,
558
- letterSpacing: "0.01em",
559
- color: "var(--text-3)",
560
- whiteSpace: "nowrap",
561
- cursor: t ? "pointer" : "default",
562
- opacity: w ? .4 : 1,
563
- boxShadow: T ? "inset 2px 0 0 0 var(--accent)" : E ? "inset -2px 0 0 0 var(--accent)" : void 0,
564
- width: nn(tn(e.id)),
565
- minWidth: nn(tn(e.id)),
566
- borderBottom: "1px solid var(--border)",
567
- background: "var(--surface-2)",
568
- position: "sticky",
569
- top: 0,
570
- left: i ? 0 : "auto",
571
- zIndex: i ? 3 : 2
572
- },
573
- children: [e.isPlaceholder ? null : t ? /* @__PURE__ */ q("span", {
574
- style: {
575
- display: "inline-flex",
576
- alignItems: "center",
577
- gap: 4
578
- },
579
- children: [
580
- J(e.column.columnDef.header, e.getContext()),
581
- /* @__PURE__ */ q("span", {
582
- style: {
583
- display: "inline-flex",
584
- flexDirection: "column",
585
- alignItems: "center",
586
- lineHeight: 0
587
- },
588
- children: [n === "asc" ? /* @__PURE__ */ K(j.arrowUp, { size: 11 }) : n === "desc" ? /* @__PURE__ */ K(j.arrowDown, { size: 11 }) : /* @__PURE__ */ K(j.sort, {
589
- size: 11,
590
- style: { opacity: .35 }
591
- }), n && d.get(e.id) === "first" ? /* @__PURE__ */ K("span", {
592
- "aria-hidden": "true",
593
- style: {
594
- width: 4,
595
- height: 4,
596
- marginTop: 1,
597
- borderRadius: 9999,
598
- background: "var(--text-3)"
599
- }
600
- }) : null]
601
- }),
602
- s ? /* @__PURE__ */ K("span", {
603
- "aria-label": b("list.sort.rank", "Sort rank {rank}", { rank: o }),
604
- style: {
605
- fontSize: 10,
606
- lineHeight: 1,
607
- color: "var(--text-3)",
608
- verticalAlign: "super",
609
- fontVariantNumeric: "tabular-nums"
610
- },
611
- children: o
612
- }) : null,
613
- /* @__PURE__ */ K(Ct, {
614
- fallback: null,
615
- children: /* @__PURE__ */ K(sn, {
616
- field: e.id,
617
- activeDir: n,
618
- activeNulls: d.get(e.id),
619
- inMultiSort: _,
620
- canAppend: v,
621
- onApply: (t, n) => p(e.id, t, n),
622
- onAppend: (t, n) => m(e.id, t, n),
623
- onClearColumn: () => h(e.id),
624
- onClearAll: g
625
- })
626
- })
627
- ]
628
- }) : J(e.column.columnDef.header, e.getContext()), e.column.getCanResize() && /* @__PURE__ */ K("div", {
629
- "data-testid": "col-resize-handle",
630
- "aria-hidden": "true",
631
- onMouseDown: (t) => {
632
- t.stopPropagation(), e.getResizeHandler()(t);
633
- },
634
- onTouchStart: (t) => {
635
- t.stopPropagation(), e.getResizeHandler()(t);
636
- },
637
- onClick: (e) => e.stopPropagation(),
638
- style: {
639
- position: "absolute",
640
- top: 0,
641
- right: 0,
642
- height: "100%",
643
- width: 9,
644
- display: "flex",
645
- justifyContent: "center",
646
- cursor: "col-resize",
647
- touchAction: "none",
648
- userSelect: "none",
649
- zIndex: 3
650
- },
651
- children: /* @__PURE__ */ K("span", { style: {
652
- width: 2,
653
- height: "60%",
654
- alignSelf: "center",
655
- borderRadius: 1,
656
- background: e.column.getIsResizing() ? "var(--accent)" : "var(--border)"
657
- } })
658
- })]
659
- }, e.id);
660
- }), /* @__PURE__ */ K("th", {
661
- "aria-hidden": "true",
662
- style: {
663
- borderBottom: "1px solid var(--border)",
664
- background: "var(--surface-2)",
665
- position: "sticky",
666
- top: 0,
667
- zIndex: 2
668
- }
669
- })]
670
- }, e.id))
671
- }), /* @__PURE__ */ K(cn, {
672
- virtualItems: s.getVirtualItems(),
673
- topPad: s.getVirtualItems()[0]?.start ?? 0,
674
- bottomPad: s.getTotalSize() - (s.getVirtualItems().at(-1)?.end ?? 0),
675
- colSpan: t.length + 1,
676
- rows: n,
677
- renderRow: _,
678
- isResizing: !!v,
679
- showsPreviousRows: y
680
- })]
681
- });
682
- }
683
- //#endregion
684
- //#region src/components/pages/list/DataCell.tsx
685
- function un({ cell: e }) {
686
- let t = e.column.id === "_select", n = e.column.id === "_actions", r = e.column.columnDef.cell, i = typeof r == "function" ? r(e.getContext()) : r;
687
- return /* @__PURE__ */ K("td", {
688
- title: typeof i == "string" ? i : void 0,
689
- style: {
690
- padding: t ? "0 6px 0 12px" : n ? "0 6px" : "0 10px",
691
- verticalAlign: "middle",
692
- borderBottom: "1px solid var(--divider)",
693
- width: nn(Z(e.column.id)),
694
- whiteSpace: "nowrap",
695
- overflow: "hidden",
696
- textOverflow: "ellipsis",
697
- maxWidth: nn(Z(e.column.id)),
698
- color: "var(--text)",
699
- position: t ? "sticky" : "static",
700
- left: t ? 0 : "auto",
701
- zIndex: +!!t
702
- },
703
- onClick: t || n ? (e) => e.stopPropagation() : void 0,
704
- children: i
705
- });
706
- }
707
- //#endregion
708
- //#region src/components/pages/list/ListTableRow.tsx
709
- function dn({ row: e, rowIndex: t, entity: n, hasSoftDelete: r, zebra: i, hasDetailTarget: a, interaction: o, measureElement: s }) {
710
- let c = e.original, l = r && c[n.soft_delete] != null, u = e.getIsSelected(), d = i && t % 2 == 1;
711
- return /* @__PURE__ */ q("tr", {
712
- "data-index": t,
713
- "data-row-stripe": d ? "" : void 0,
714
- "aria-selected": u,
715
- ref: (e) => s(e),
716
- style: {
717
- height: "var(--row-h)",
718
- cursor: a || o.peekAllowed ? "pointer" : "default",
719
- opacity: l ? .5 : 1,
720
- fontStyle: l ? "italic" : "normal",
721
- transition: "background-color 120ms"
722
- },
723
- onClick: a || o.peekAllowed ? (e) => o.onRowClick(e, c) : void 0,
724
- onContextMenu: (e) => {
725
- e.preventDefault(), o.setContextMenu({
726
- x: e.clientX,
727
- y: e.clientY,
728
- row: c
729
- });
730
- },
731
- ...o.longPress.handlers,
732
- onPointerDown: (e) => {
733
- o.pressedRow.current = c, o.longPress.handlers.onPointerDown(e);
734
- },
735
- children: [e.getVisibleCells().map((e) => /* @__PURE__ */ K(un, { cell: e }, e.id)), /* @__PURE__ */ K("td", {
736
- "aria-hidden": "true",
737
- style: { borderBottom: "1px solid var(--divider)" }
738
- })]
739
- }, e.id);
740
- }
741
- //#endregion
742
- //#region src/components/pages/list/ListFooter.tsx
743
- function fn({ meta: e, isCursor: t, isPhone: n, rowsLoaded: r, selectedCount: i, countTotal: a, countStrategy: o, countLoading: c, countError: l, page: u, totalPages: d, goToPage: f, perPage: p, setPerPage: m, hasMorePages: h, fetchNextPage: g, isFetchingNextPage: _ }) {
744
- let v = Se("list"), y = A();
745
- return !e && !t ? null : /* @__PURE__ */ q("div", {
746
- style: {
747
- display: "flex",
748
- alignItems: "center",
749
- paddingTop: 8,
750
- paddingBottom: 8,
751
- ...n ? Te(12) : {
752
- paddingLeft: 14,
753
- paddingRight: 14
754
- },
755
- background: "var(--surface-2)",
756
- borderTop: "1px solid var(--border)",
757
- fontSize: 11.5,
758
- color: "var(--text-3)",
759
- gap: 12,
760
- flexWrap: "wrap"
761
- },
762
- children: [
763
- v.isVisible("show_count") && /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ K("span", {
764
- className: "num",
765
- "data-testid": "list-footer-count",
766
- style: {
767
- display: "inline-flex",
768
- alignItems: "center",
769
- gap: 5
770
- },
771
- children: a === void 0 ? c && !l ? /* @__PURE__ */ K("span", {
772
- "data-testid": "list-footer-count-pending",
773
- style: { display: "inline-flex" },
774
- children: /* @__PURE__ */ K(he, { size: 11 })
775
- }) : s(y, "list.footer.count", r, {
776
- one: "{count} record",
777
- other: "{count} records"
778
- }) : s(y, "list.footer.count_of", a, {
779
- one: "{loaded} of {total} record",
780
- other: "{loaded} of {total} records"
781
- }, {
782
- loaded: r,
783
- total: de(a, o ?? "exact", y.language)
784
- })
785
- }), /* @__PURE__ */ K("span", { children: "·" })] }),
786
- /* @__PURE__ */ q("span", { children: [
787
- y("list.footer.selected", "Selected:"),
788
- " ",
789
- /* @__PURE__ */ K("span", {
790
- className: "num",
791
- style: {
792
- color: "var(--text-2)",
793
- fontWeight: 500
794
- },
795
- children: i
796
- })
797
- ] }),
798
- /* @__PURE__ */ K("div", { style: { flex: n ? "1 1 100%" : 1 } }),
799
- !n && /* @__PURE__ */ K("span", { children: y("list.footer.rows_per_page", "Rows per page") }),
800
- /* @__PURE__ */ K("select", {
801
- "aria-label": y("list.footer.rows_per_page", "Rows per page"),
802
- value: p,
803
- onChange: (e) => m(parseInt(e.target.value, 10)),
804
- style: {
805
- fontSize: 11.5,
806
- padding: "2px 4px",
807
- background: "var(--surface)",
808
- border: "1px solid var(--border)",
809
- borderRadius: 4,
810
- color: "var(--text-2)",
811
- cursor: "pointer"
812
- },
813
- children: Ut.map((e) => /* @__PURE__ */ K("option", {
814
- value: e,
815
- children: e
816
- }, e))
817
- }),
818
- t ? h && /* @__PURE__ */ q("button", {
819
- type: "button",
820
- className: "num",
821
- "data-testid": "list-footer-load-more",
822
- onClick: g,
823
- disabled: _,
824
- style: {
825
- display: "inline-flex",
826
- alignItems: "center",
827
- gap: 6,
828
- padding: "2px 10px",
829
- background: "var(--surface)",
830
- border: "1px solid var(--border)",
831
- borderRadius: 4,
832
- color: "var(--text-2)",
833
- cursor: _ ? "default" : "pointer"
834
- },
835
- children: [_ ? /* @__PURE__ */ K(he, { size: 11 }) : null, y("list.footer.load_more", "Load more")]
836
- }) : (h || u > 1) && /* @__PURE__ */ q("div", {
837
- style: {
838
- display: "flex",
839
- alignItems: "center",
840
- gap: 4
841
- },
842
- children: [
843
- /* @__PURE__ */ K(M, {
844
- size: 22,
845
- icon: /* @__PURE__ */ K(j.left, { size: 12 }),
846
- onClick: () => f(u - 1),
847
- disabled: u <= 1
848
- }),
849
- /* @__PURE__ */ K("span", {
850
- className: "num",
851
- style: { padding: "0 6px" },
852
- children: d === void 0 ? y("list.footer.page", "Page {page}", { page: u }) : y("list.footer.page_of", "Page {page} of {total}", {
853
- page: u,
854
- total: d
855
- })
856
- }),
857
- /* @__PURE__ */ K(M, {
858
- size: 22,
859
- icon: /* @__PURE__ */ K(j.right, { size: 12 }),
860
- onClick: () => f(u + 1),
861
- disabled: d === void 0 ? !h : u >= d
862
- })
863
- ]
864
- })
865
- ]
866
- });
867
- }
868
- //#endregion
869
- //#region src/components/pages/ExportMenu.tsx
870
- function pn(e) {
871
- return !(e && e.enabled === !1);
872
- }
873
- function mn(e, t) {
874
- return t == null ? e("export.scope.current_view_all", "Current view (CSV) · all matching rows") : s(e, "export.scope.current_view", t, {
875
- one: "Current view (CSV) · {total} row",
876
- other: "Current view (CSV) · {total} rows"
877
- }, { total: t.toLocaleString(e.language) });
878
- }
879
- function hn(e) {
880
- let t = A(), n = A("errors"), { isPhone: r } = te(), { entityCode: i, entity: a, screen: o, viewState: c, visibleColumns: l, selectedRowPKs: d, totalRows: f, pageRows: p, language: m, align: h = "end", variant: g = "toolbar", onBeforeOpen: v } = e, [y, b] = W(!1), [x, S] = W(!1), [C, w] = W(null), T = U(null), D = pn(a.export), ee = pn(o?.export);
881
- if (!D || !ee) return null;
882
- async function O(e) {
883
- w(null), S(!0);
884
- try {
885
- let t = lt(c, {
886
- scope: e,
887
- visibleColumns: l,
888
- selectedRowPKs: e === "selected_rows" ? d : void 0,
889
- language: m
890
- }), { blob: n, filename: r } = await _(i, t);
891
- _n(n, r || `${i}-${gn()}.csv`), b(!1);
892
- } catch (e) {
893
- w({
894
- code: e instanceof E ? e.code : "",
895
- message: u(n, e)
896
- });
897
- } finally {
898
- S(!1);
899
- }
900
- }
901
- if (g === "selection-menu-item") {
902
- let e = x || d.length === 0;
903
- return /* @__PURE__ */ K(F, {
904
- icon: /* @__PURE__ */ K(j.download, { size: 12 }),
905
- "data-testid": "export-selection-menu-item",
906
- onClick: e ? void 0 : () => {
907
- v?.(), O("selected_rows");
908
- },
909
- children: x ? t("export.menu.exporting", "Exporting…") : t("export.menu.selection", "Export selection (CSV)")
910
- });
911
- }
912
- let k = d.length > 0, M = a.list_pagination === "cursor";
913
- return /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ K(N, {
914
- ref: T,
915
- kind: "ghost",
916
- size: "sm",
917
- icon: /* @__PURE__ */ K(j.download, { size: 12 }),
918
- onClick: () => {
919
- v?.(), b((e) => !e);
920
- },
921
- disabled: x,
922
- "aria-label": t("export.menu.export", "Export"),
923
- title: t("export.menu.export", "Export"),
924
- children: r ? null : x ? t("export.menu.exporting", "Exporting…") : t("export.menu.export", "Export")
925
- }), /* @__PURE__ */ q(fe, {
926
- open: y,
927
- anchor: T.current,
928
- onClose: () => b(!1),
929
- align: h,
930
- width: 260,
931
- children: [
932
- /* @__PURE__ */ K(F, {
933
- icon: /* @__PURE__ */ K(j.download, { size: 12 }),
934
- onClick: x ? void 0 : () => void O("current_view"),
935
- children: mn(t, f)
936
- }),
937
- k && /* @__PURE__ */ K(F, {
938
- icon: /* @__PURE__ */ K(j.check, { size: 12 }),
939
- onClick: x ? void 0 : () => void O("selected_rows"),
940
- children: t("export.scope.selected_rows", "Selected rows (CSV) · {count}", { count: d.length })
941
- }),
942
- M ? /* @__PURE__ */ K(F, {
943
- icon: /* @__PURE__ */ K(j.columns, { size: 12 }),
944
- "data-testid": "export-current-page-disabled",
945
- disabled: !0,
946
- children: t("export.scope.current_page_unavailable_cursor", "Current page · n/a (infinite scroll)")
947
- }) : /* @__PURE__ */ K(F, {
948
- icon: /* @__PURE__ */ K(j.columns, { size: 12 }),
949
- onClick: x ? void 0 : () => void O("current_page"),
950
- children: p === void 0 ? t("export.scope.current_page_window", "Current page (CSV) · page window") : s(t, "export.scope.current_page", p, {
951
- one: "Current page (CSV) · {count} row",
952
- other: "Current page (CSV) · {count} rows"
953
- })
954
- }),
955
- C && /* @__PURE__ */ K("div", {
956
- role: "alert",
957
- style: {
958
- padding: "6px 10px",
959
- marginTop: 4,
960
- fontSize: 12,
961
- color: "var(--destructive)",
962
- borderTop: "1px solid var(--border)"
963
- },
964
- children: C.message
965
- })
966
- ]
967
- })] });
968
- }
969
- function gn() {
970
- let e = /* @__PURE__ */ new Date(), t = (e) => String(e).padStart(2, "0");
971
- return `${e.getUTCFullYear()}${t(e.getUTCMonth() + 1)}${t(e.getUTCDate())}-${t(e.getUTCHours())}${t(e.getUTCMinutes())}`;
972
- }
973
- function _n(e, t) {
974
- let n = URL.createObjectURL(e), r = document.createElement("a");
975
- r.href = n, r.download = t, r.style.display = "none", document.body.appendChild(r), r.click(), document.body.removeChild(r), setTimeout(() => URL.revokeObjectURL(n), 0);
976
- }
977
- //#endregion
978
- //#region src/components/pages/list/ListToolbar.tsx
979
- function vn({ screen: e, entity: t, entityCode: n, schema: r, screenCode: i, screenName: a, isPhone: o, isCardsPresentation: s, sort: c, columns: l, views: u, query: d, selection: f, filters: p, searchValue: m, onSearchChange: h, onSaveView: g, onDeleteView: _, page: v, perPage: y, includeDeleted: b, canViewDeleted: x, onToggleDeleted: S, realtime: C, isLive: w }) {
980
- let T = A(), E = D("view")?.actions, [ee, O] = W(!1), [k, te] = W(!1), [re, ie] = W(!1), ae = U(null), oe = U(null), se = be((e) => e.density), ce = () => {
981
- let e = se === "compact" ? "comfortable" : se === "comfortable" ? "cozy" : "compact";
982
- be.getState().setMany({ density: e });
983
- }, de = !o || ee || m !== "", pe = (e) => {
984
- if (e.startsWith("$status.")) {
985
- let n = e.slice(8), r = t.status_groups?.[n];
986
- return r ? T(r.name) || n : e;
987
- }
988
- if (e.startsWith("$property.")) {
989
- let n = e.slice(10), r = t.properties?.[n];
990
- return r ? T(r.name) || n : e;
991
- }
992
- return We(T, t, e, r?.entities);
993
- }, me = (e.columns ?? []).filter((e) => on(e, t));
994
- return /* @__PURE__ */ q("div", {
995
- style: {
996
- display: "flex",
997
- alignItems: "center",
998
- gap: o ? 6 : 8,
999
- paddingTop: 0,
1000
- paddingBottom: 10,
1001
- ...o ? Te(12) : {
1002
- paddingLeft: 20,
1003
- paddingRight: 20
1004
- },
1005
- flexWrap: "wrap"
1006
- },
1007
- children: [
1008
- /* @__PURE__ */ K(le, {
1009
- views: u.all,
1010
- activeViewId: u.activeId,
1011
- isDirty: u.isDirty,
1012
- onSelect: u.apply,
1013
- onSaveAs: E?.__create ? g : void 0,
1014
- onSave: E?.__update ? () => {
1015
- u.overwriteActive().catch(() => void 0);
1016
- } : void 0,
1017
- onDiscard: u.discard,
1018
- onDelete: E?.__delete ? _ : void 0,
1019
- deletePending: u.isDeleting
1020
- }),
1021
- de ? /* @__PURE__ */ q("div", {
1022
- style: {
1023
- position: "relative",
1024
- width: o ? "100%" : 260,
1025
- order: o ? -1 : 0
1026
- },
1027
- children: [/* @__PURE__ */ K(ge, {
1028
- value: m,
1029
- onChange: h,
1030
- placeholder: T("list.toolbar.search_placeholder", "Search {name}…", { name: a }),
1031
- prefix: /* @__PURE__ */ K(j.search, { size: 13 })
1032
- }), /* @__PURE__ */ K("span", {
1033
- style: {
1034
- position: "absolute",
1035
- right: 6,
1036
- top: "50%",
1037
- transform: "translateY(-50%)",
1038
- pointerEvents: "none"
1039
- },
1040
- children: /* @__PURE__ */ K(ne, { children: "/" })
1041
- })]
1042
- }) : /* @__PURE__ */ K(M, {
1043
- icon: /* @__PURE__ */ K(j.search, { size: 14 }),
1044
- title: T("list.toolbar.search", "Search {name}", { name: a }),
1045
- onClick: () => O(!0)
1046
- }),
1047
- /* @__PURE__ */ q(N, {
1048
- icon: /* @__PURE__ */ K(j.filter, { size: 13 }),
1049
- onClick: p.onOpen,
1050
- active: p.count > 0,
1051
- children: [T("list.toolbar.filters", "Filters"), p.count > 0 && /* @__PURE__ */ K(P, {
1052
- tone: "violet",
1053
- size: "xs",
1054
- style: { marginLeft: 4 },
1055
- children: p.count
1056
- })]
1057
- }),
1058
- s && /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ q(N, {
1059
- ref: ae,
1060
- icon: /* @__PURE__ */ K(j.sort, { size: 13 }),
1061
- onClick: () => te((e) => !e),
1062
- active: k || c.cols.length > 0,
1063
- children: [T("list.toolbar.sort", "Sort"), c.cols.length > 0 && /* @__PURE__ */ K(P, {
1064
- tone: "slate",
1065
- size: "xs",
1066
- style: { marginLeft: 4 },
1067
- children: c.cols.length
1068
- })]
1069
- }), /* @__PURE__ */ q(fe, {
1070
- open: k,
1071
- anchor: ae.current,
1072
- onClose: () => te(!1),
1073
- align: "start",
1074
- width: 280,
1075
- children: [
1076
- /* @__PURE__ */ K("div", {
1077
- style: {
1078
- padding: "6px 8px 4px",
1079
- fontSize: 10,
1080
- color: "var(--text-3)",
1081
- fontWeight: 700,
1082
- letterSpacing: "0.08em",
1083
- textTransform: "uppercase"
1084
- },
1085
- children: T("list.toolbar.sort_by", "Sort by")
1086
- }),
1087
- me.map((e) => {
1088
- let t = c.cols.find((t) => t.field === e);
1089
- return /* @__PURE__ */ K(F, {
1090
- icon: t ? t.dir === "desc" ? /* @__PURE__ */ K(j.arrowDown, { size: 12 }) : /* @__PURE__ */ K(j.arrowUp, { size: 12 }) : /* @__PURE__ */ K("span", { style: {
1091
- width: 12,
1092
- display: "inline-block"
1093
- } }),
1094
- active: !!t,
1095
- onClick: () => {
1096
- c.applyColumn(e, t?.dir === "asc" ? "desc" : "asc", void 0), te(!1);
1097
- },
1098
- children: pe(e)
1099
- }, e);
1100
- }),
1101
- c.cols.length > 0 && /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ K(F, { divider: !0 }), /* @__PURE__ */ K(F, {
1102
- icon: /* @__PURE__ */ K(j.x, { size: 12 }),
1103
- onClick: () => {
1104
- c.clearAll(), te(!1);
1105
- },
1106
- children: T("list.toolbar.clear_sort", "Clear sort")
1107
- })] })
1108
- ]
1109
- })] }),
1110
- !s && /* @__PURE__ */ K(ue, {
1111
- availableColumns: e.columns ?? [],
1112
- visibleColumns: l.visible,
1113
- onToggle: (e) => {
1114
- let t = l.visible.includes(e) ? l.visible.filter((t) => t !== e) : [...l.visible, e];
1115
- l.apply(t);
1116
- },
1117
- onMove: l.move,
1118
- onReset: l.clear,
1119
- onShowAll: () => l.apply(e.columns ?? []),
1120
- onResetWidths: l.resetWidths,
1121
- columnLabel: pe
1122
- }),
1123
- !o && /* @__PURE__ */ K("span", { style: {
1124
- width: 1,
1125
- height: 20,
1126
- background: "var(--divider)"
1127
- } }),
1128
- !o && /* @__PURE__ */ K(M, {
1129
- icon: /* @__PURE__ */ K(j.grid, { size: 14 }),
1130
- title: T("list.toolbar.density", "Density"),
1131
- active: se !== "compact",
1132
- onClick: ce
1133
- }),
1134
- /* @__PURE__ */ K(st, {
1135
- liveObject: {
1136
- refetch: d.retry,
1137
- isLoading: d.isLoading,
1138
- isLive: w
1139
- },
1140
- realtime: C
1141
- }),
1142
- !o && /* @__PURE__ */ K("div", { style: { flex: 1 } }),
1143
- !o && x && /* @__PURE__ */ K(N, {
1144
- kind: "ghost",
1145
- size: "sm",
1146
- icon: K(b ? j.eyeOff : j.eye, { size: 12 }),
1147
- onClick: S,
1148
- active: b,
1149
- children: b ? T("list.toolbar.hide_deleted", "Hide deleted") : T("list.toolbar.show_deleted", "Show deleted")
1150
- }),
1151
- o && /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ K(M, {
1152
- ref: oe,
1153
- icon: /* @__PURE__ */ K(j.more, { size: 14 }),
1154
- title: T("list.toolbar.more", "More"),
1155
- active: re,
1156
- onClick: () => ie((e) => !e)
1157
- }), /* @__PURE__ */ q(fe, {
1158
- open: re,
1159
- anchor: oe.current,
1160
- onClose: () => ie(!1),
1161
- align: "end",
1162
- width: 220,
1163
- children: [/* @__PURE__ */ K(F, {
1164
- icon: /* @__PURE__ */ K(j.grid, { size: 13 }),
1165
- onClick: () => {
1166
- ce(), ie(!1);
1167
- },
1168
- children: T("list.toolbar.density", "Density")
1169
- }), x && /* @__PURE__ */ K(F, {
1170
- icon: K(b ? j.eyeOff : j.eye, { size: 13 }),
1171
- onClick: () => {
1172
- S(), ie(!1);
1173
- },
1174
- children: b ? T("list.toolbar.hide_deleted", "Hide deleted") : T("list.toolbar.show_deleted", "Show deleted")
1175
- })]
1176
- })] }),
1177
- n && t && /* @__PURE__ */ K(ft, {
1178
- entityCode: n,
1179
- scope: "list",
1180
- selectedIds: f.ids,
1181
- viewState: {
1182
- screenCode: i,
1183
- jsonFilters: p.json,
1184
- search: p.debouncedSearch,
1185
- sort: c.forRequest,
1186
- includeDeleted: b || void 0,
1187
- page: v,
1188
- perPage: y
1189
- },
1190
- capability: t.documents,
1191
- canManageTemplates: dt(r)
1192
- }),
1193
- n && t && /* @__PURE__ */ K(hn, {
1194
- entityCode: n,
1195
- entity: t,
1196
- screen: e,
1197
- viewState: {
1198
- screenCode: i,
1199
- jsonFilters: p.json,
1200
- search: p.debouncedSearch,
1201
- sort: c.forRequest,
1202
- includeDeleted: b || void 0,
1203
- page: v,
1204
- perPage: y
1205
- },
1206
- visibleColumns: l.visible,
1207
- selectedRowPKs: f.pkValues,
1208
- totalRows: d.countTotal,
1209
- pageRows: d.isLoading || d.isShowingPreviousRows ? void 0 : d.rows.length,
1210
- language: T.language
1211
- })
1212
- ]
1213
- });
1214
- }
1215
- //#endregion
1216
- //#region src/components/pages/list/useListViews.ts
1217
- function yn(e, t) {
1218
- let n = k(t.id);
1219
- n && e.setQueriesData({ queryKey: ["entity-data", "view"] }, (e) => {
1220
- if (!e) return e;
1221
- let r = e.data.findIndex((e) => k(e.id) === n);
1222
- if (r === -1) return {
1223
- ...e,
1224
- data: [t, ...e.data]
1225
- };
1226
- let i = [...e.data];
1227
- return i[r] = {
1228
- ...i[r],
1229
- ...t
1230
- }, {
1231
- ...e,
1232
- data: i
1233
- };
1234
- });
1235
- }
1236
- function bn(e) {
1237
- let t = new URLSearchParams(e);
1238
- return t.delete("filters"), t.delete("columns"), t.delete("sort"), t;
1239
- }
1240
- function xn({ screenCode: e, screen: t, entity: n, searchParams: r, setSearchParams: i, userId: a, tenantId: o, all: s, activeId: c, active: l, clearedKey: u, filters: d, visibleColumns: p, sort: m }) {
1241
- let h = A(), g = Et(), _ = Pe("view"), v = Fe("view"), y = Ie("view"), b = H(() => {
1242
- if (!c || !l) return !1;
1243
- let e = Bt(n, l, t), r = e.filters, i = l.columns?.length ? l.columns : t?.default_columns ?? t?.columns ?? [], a = e.sort ?? "";
1244
- return !Qe(d, r) || p.join(",") !== i.join(",") || m !== a;
1245
- }, [
1246
- c,
1247
- l,
1248
- d,
1249
- p,
1250
- m,
1251
- n,
1252
- t
1253
- ]), x = B((e) => {
1254
- let n = new URLSearchParams(r), a = Lt(r);
1255
- e.id ? a.set("view", e.id) : typeof window < "u" && window.sessionStorage?.setItem(u, "1"), i(a);
1256
- let o = n.get("view"), c = o ? s.find((e) => e.id === o) : void 0, l = (c?.columns?.length ? c.columns : t?.default_columns ?? t?.columns ?? []).join(",");
1257
- (n.get("columns") ?? l) !== l && f.info(h("list.view.applied_title", "View applied"), h("list.view.applied_body", "Your unsaved column changes were replaced."), { action: {
1258
- label: h("list.view.undo", "Undo"),
1259
- onClick: () => i(n)
1260
- } });
1261
- }, [
1262
- h,
1263
- r,
1264
- i,
1265
- u,
1266
- s,
1267
- t?.default_columns,
1268
- t?.columns
1269
- ]), S = B(() => {
1270
- let e = bn(r);
1271
- e.set("page", "1"), i(e);
1272
- }, [r, i]), C = B(async () => {
1273
- if (!l?.id || l.source !== "personal") return;
1274
- let e = await v.mutateAsync({
1275
- pkValues: l.id,
1276
- data: {
1277
- filters: d,
1278
- columns: p,
1279
- sort: m
1280
- }
1281
- });
1282
- e?.data && yn(g, e.data), i(bn(r)), await g.invalidateQueries({ queryKey: ["entity-data", "view"] });
1283
- }, [
1284
- l,
1285
- v,
1286
- d,
1287
- p,
1288
- m,
1289
- g,
1290
- r,
1291
- i
1292
- ]);
1293
- return {
1294
- all: s,
1295
- activeId: c,
1296
- active: l,
1297
- clearedKey: u,
1298
- isDirty: b,
1299
- apply: x,
1300
- discard: S,
1301
- saveAsNew: B(async (t) => {
1302
- if (!a || !o) return;
1303
- let n = await _.mutateAsync({
1304
- tenant_id: o,
1305
- screen_code: e,
1306
- user_id: a,
1307
- name: { en: t },
1308
- filters: d,
1309
- columns: p,
1310
- sort: m,
1311
- is_shared: !1,
1312
- is_default: !1
1313
- }), s = k(n.data.id);
1314
- if (!s) return;
1315
- yn(g, n.data);
1316
- let c = bn(r);
1317
- c.set("view", s), i(c), await g.invalidateQueries({ queryKey: ["entity-data", "view"] });
1318
- }, [
1319
- a,
1320
- o,
1321
- _,
1322
- e,
1323
- d,
1324
- p,
1325
- m,
1326
- g,
1327
- r,
1328
- i
1329
- ]),
1330
- overwriteActive: C,
1331
- deleteView: B(async (e) => {
1332
- if (e.id && e.source === "personal") {
1333
- if (await y.mutateAsync(e.id), e.id === c) {
1334
- typeof window < "u" && window.sessionStorage?.setItem(u, "1");
1335
- let e = new URLSearchParams(r);
1336
- e.delete("view"), e.set("page", "1"), i(e, { replace: !0 });
1337
- }
1338
- await g.invalidateQueries({ queryKey: ["entity-data", "view"] });
1339
- }
1340
- }, [
1341
- y,
1342
- c,
1343
- u,
1344
- r,
1345
- i,
1346
- g
1347
- ]),
1348
- isSaving: _.isPending || v.isPending,
1349
- isDeleting: y.isPending
1350
- };
1351
- }
1352
- function Sn(e, t) {
1353
- return t && t.source === "personal" ? e(t.name) : null;
1354
- }
1355
- //#endregion
1356
- //#region src/components/pages/list/DeleteViewDialog.tsx
1357
- function Cn({ view: e, onCancel: t, onConfirm: n }) {
1358
- let r = A(), i = e ? r(e.name) : "";
1359
- return /* @__PURE__ */ K(ce, {
1360
- open: e !== null,
1361
- onOpenChange: (e) => {
1362
- e || t();
1363
- },
1364
- title: r("list.view.delete_title", "Delete this view?"),
1365
- description: r("list.view.delete_body", "“{name}” and the filters saved in it are deleted permanently. This cannot be undone.", { name: i }),
1366
- confirmLabel: r("list.view.delete_confirm", "Delete view"),
1367
- destructive: !0,
1368
- onConfirm: () => {
1369
- e && n(e);
1370
- }
1371
- });
1372
- }
1373
- //#endregion
1374
- //#region src/components/pages/list/ListUrlBanner.tsx
1375
- var wn = {
1376
- margin: "0 20px 10px",
1377
- padding: "8px 10px",
1378
- border: "1px solid var(--danger)",
1379
- borderRadius: 6,
1380
- color: "var(--danger)",
1381
- fontSize: 12,
1382
- display: "flex",
1383
- alignItems: "center",
1384
- gap: 8
1385
- };
1386
- function Tn({ filterError: e, unresolvedViewId: t, onClearFilters: n, onClearView: r }) {
1387
- let i = A(), a = i("list.banner.clear", "Clear");
1388
- return e ? /* @__PURE__ */ q("div", {
1389
- role: "alert",
1390
- "data-testid": "filter-url-error",
1391
- style: wn,
1392
- children: [/* @__PURE__ */ q("span", { children: [
1393
- e,
1394
- " ",
1395
- i("list.filters.invalid_suffix", "Showing this list without URL filters.")
1396
- ] }), /* @__PURE__ */ K(N, {
1397
- kind: "ghost",
1398
- size: "xs",
1399
- onClick: n,
1400
- children: a
1401
- })]
1402
- }) : t ? /* @__PURE__ */ q("div", {
1403
- role: "alert",
1404
- "data-testid": "view-url-unresolved",
1405
- style: wn,
1406
- children: [/* @__PURE__ */ K("span", { children: i("list.view.unresolved", "The view “{id}” could not be opened - it may have been deleted, or it belongs to someone else. Showing this list without it.", { id: t }) }), /* @__PURE__ */ K(N, {
1407
- kind: "ghost",
1408
- size: "xs",
1409
- onClick: r,
1410
- children: a
1411
- })]
1412
- }) : null;
1413
- }
1414
- //#endregion
1415
- //#region src/components/pages/list/SaveViewDialog.tsx
1416
- function En({ open: e, pending: t, onClose: n, onSave: r, overwriteViewName: i, onOverwrite: a }) {
1417
- let o = A(), [s, c] = W(""), l = !!(i && a);
1418
- if (V(() => {
1419
- e && c("");
1420
- }, [e]), !e) return null;
1421
- let u = s.trim();
1422
- return /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ K("div", {
1423
- onClick: n,
1424
- style: {
1425
- position: "fixed",
1426
- inset: 0,
1427
- background: "var(--scrim)",
1428
- zIndex: 70
1429
- }
1430
- }), /* @__PURE__ */ q("div", {
1431
- role: "dialog",
1432
- "aria-label": o("list.view.save_dialog_title", "Save view"),
1433
- "aria-modal": "true",
1434
- style: {
1435
- position: "fixed",
1436
- top: "50%",
1437
- left: "50%",
1438
- transform: "translate(-50%, -50%)",
1439
- width: 360,
1440
- maxWidth: "calc(100vw - 32px)",
1441
- background: "var(--surface)",
1442
- border: "1px solid var(--border)",
1443
- borderRadius: 10,
1444
- boxShadow: "var(--shadow-lg)",
1445
- zIndex: 80,
1446
- padding: 16,
1447
- display: "flex",
1448
- flexDirection: "column",
1449
- gap: 12
1450
- },
1451
- children: [
1452
- /* @__PURE__ */ q("div", { children: [/* @__PURE__ */ K("h3", {
1453
- style: {
1454
- margin: 0,
1455
- fontSize: 14,
1456
- color: "var(--text)"
1457
- },
1458
- children: o("list.view.save_dialog_title", "Save view")
1459
- }), /* @__PURE__ */ K("p", {
1460
- style: {
1461
- margin: "4px 0 0",
1462
- fontSize: 12,
1463
- color: "var(--text-3)"
1464
- },
1465
- children: o("list.view.save_dialog_body", "Views save columns, order, filters, and sort. Widths stay personal to this device and are never part of a view.")
1466
- })] }),
1467
- /* @__PURE__ */ q("label", {
1468
- style: {
1469
- display: "flex",
1470
- flexDirection: "column",
1471
- gap: 4
1472
- },
1473
- children: [/* @__PURE__ */ K("span", {
1474
- style: {
1475
- fontSize: 11.5,
1476
- color: "var(--text-3)",
1477
- fontWeight: 500
1478
- },
1479
- children: o("list.view.name", "Name")
1480
- }), /* @__PURE__ */ K(ge, {
1481
- autoFocus: !0,
1482
- "aria-label": o("list.view.name_input", "View name"),
1483
- value: s,
1484
- onChange: c,
1485
- placeholder: o("list.view.name_placeholder", "My filtered view"),
1486
- onKeyDown: (e) => {
1487
- e.key === "Escape" && n(), e.key === "Enter" && u && !t && r(u);
1488
- }
1489
- })]
1490
- }),
1491
- /* @__PURE__ */ q("div", {
1492
- style: {
1493
- display: "flex",
1494
- justifyContent: "flex-end",
1495
- gap: 8
1496
- },
1497
- children: [
1498
- /* @__PURE__ */ K(N, {
1499
- onClick: n,
1500
- disabled: t,
1501
- children: o("dialog.cancel", "Cancel")
1502
- }),
1503
- l && /* @__PURE__ */ K(N, {
1504
- onClick: () => void a(),
1505
- disabled: t,
1506
- children: o("list.view.overwrite", "Overwrite “{name}”", { name: i ?? "" })
1507
- }),
1508
- /* @__PURE__ */ K(N, {
1509
- kind: "primary",
1510
- onClick: () => void r(u),
1511
- disabled: !u || t,
1512
- children: o("list.view.save_as", "Save as new")
1513
- })
1514
- ]
1515
- })
1516
- ]
1517
- })] });
1518
- }
1519
- //#endregion
1520
- //#region src/components/pages/list/ListHeader.tsx
1521
- function Dn({ title: e, description: n, toolbarActions: r, screenActionLayout: i, entityActionLayout: a, selectedIds: s, data: u, rowKey: d, onActionSuccess: f, widgetContext: p }) {
1522
- let m = A(), h = A("errors"), { run: _ } = je(), { isPhone: v } = te(), y = Se("list"), b = y.isVisible("show_title"), x = y.isVisible("show_actions"), C = Ce(), w = H(() => {
1523
- let e = {};
1524
- for (let { code: t, action: n } of r) e[t] = n;
1525
- return e;
1526
- }, [r]), T = H(() => l((i ?? a) || S(w, "list_toolbar"), w, void 0, "list_toolbar"), [
1527
- i,
1528
- a,
1529
- w
1530
- ]), E = H(() => o(T, w, void 0, c, m("list.toolbar.select_rows_first", "Select one or more rows first")), [
1531
- m,
1532
- T,
1533
- w
1534
- ]), D = H(() => {
1535
- if (s.length === 0) return [];
1536
- let e = /* @__PURE__ */ new Map();
1537
- for (let t of u) e.set(d(t), t);
1538
- return s.map((t) => e.get(t)).filter((e) => e !== void 0);
1539
- }, [
1540
- s,
1541
- u,
1542
- d
1543
- ]), ee = H(() => t(m, T, w, void 0, {}, D), [
1544
- m,
1545
- T,
1546
- w,
1547
- D
1548
- ]), k = s.length > 0 ? ee : E, N = (e, t) => {
1549
- let n = Ue(h, e, t, {});
1550
- if (n === null) return;
1551
- let r = m(t.display?.name) || e;
1552
- return _({
1553
- action: t,
1554
- title: r,
1555
- bulkSelection: D.length > 0 ? D : void 0,
1556
- execute: async (e) => {
1557
- let t = s.length > 0 ? s : void 0, r = await O(n, g(e, t));
1558
- return t && t.length > 0 && f(), r;
1559
- }
1560
- });
1561
- };
1562
- return !b && !x ? null : /* @__PURE__ */ q("div", {
1563
- style: {
1564
- display: "flex",
1565
- alignItems: "center",
1566
- gap: 8,
1567
- flexWrap: v ? "wrap" : "nowrap",
1568
- paddingTop: v ? 12 : 16,
1569
- paddingBottom: 10,
1570
- ...v ? Te(12) : {
1571
- paddingLeft: 20,
1572
- paddingRight: 20
1573
- }
1574
- },
1575
- children: [
1576
- b && C.hasOriginBack && /* @__PURE__ */ K(M, {
1577
- icon: /* @__PURE__ */ K(j.back, { size: 14 }),
1578
- title: m("list.header.back", "Back"),
1579
- onClick: C.goBack
1580
- }),
1581
- b && /* @__PURE__ */ K("div", {
1582
- style: {
1583
- flex: v ? "1 1 100%" : "1 1 auto",
1584
- minWidth: 0
1585
- },
1586
- children: /* @__PURE__ */ q("div", {
1587
- style: {
1588
- display: "flex",
1589
- alignItems: "baseline",
1590
- gap: 10
1591
- },
1592
- children: [/* @__PURE__ */ K("h1", {
1593
- style: {
1594
- margin: 0,
1595
- minWidth: 0,
1596
- overflow: "hidden",
1597
- textOverflow: "ellipsis",
1598
- whiteSpace: "nowrap",
1599
- fontSize: "var(--page-title-size, var(--page-title-size-list))",
1600
- lineHeight: "var(--page-title-line-height, var(--page-title-line-height-list))",
1601
- fontWeight: 600,
1602
- letterSpacing: "-0.012em",
1603
- color: "var(--text)"
1604
- },
1605
- children: e
1606
- }), n && /* @__PURE__ */ K(xe, {
1607
- label: n,
1608
- "data-testid": "list-description-info"
1609
- })]
1610
- })
1611
- }),
1612
- x && k.length > 0 && /* @__PURE__ */ K(qe, {
1613
- layout: k,
1614
- kind: "toolbar",
1615
- entityActions: w,
1616
- onRun: N,
1617
- widgetContext: p,
1618
- ariaLabel: m("list.toolbar.actions", "List toolbar actions")
1619
- })
1620
- ]
1621
- });
1622
- }
1623
- //#endregion
1624
- //#region src/components/pages/list/ListFloatbar.tsx
1625
- var On = "@keyframes floatbarIn{from{transform:translateX(-50%) translateY(8px);opacity:0}to{transform:translateX(-50%) translateY(0);opacity:1}}";
1626
- function kn({ selectedIds: e, floatbarActions: n, screenActionLayout: r, entityActionLayout: i, data: a, rowKey: o, entityCode: c, entity: u, screen: d, onClear: f, onActionSuccess: p, widgetContext: m }) {
1627
- let h = A(), _ = A("errors"), { run: v } = je(), y = H(() => {
1628
- let e = {};
1629
- for (let { code: t, action: r } of n) e[t] = r;
1630
- return e;
1631
- }, [n]), b = H(() => {
1632
- if (e.length === 0) return [];
1633
- let t = /* @__PURE__ */ new Map();
1634
- for (let e of a) t.set(o(e), e);
1635
- return e.map((e) => t.get(e)).filter((e) => e !== void 0);
1636
- }, [
1637
- e,
1638
- a,
1639
- o
1640
- ]), x = H(() => {
1641
- if (!u || !d || b.length === 0) return r;
1642
- let e = b.map((e) => He(u, d, e));
1643
- return e.some((t) => t !== e[0]) ? r : Ge(u, d, b[0])?.action_layout;
1644
- }, [
1645
- u,
1646
- d,
1647
- b,
1648
- r
1649
- ]), C = H(() => l((x ?? i) || S(y, "list_floatbar"), y, void 0, "list_floatbar"), [
1650
- x,
1651
- i,
1652
- y
1653
- ]), w = H(() => t(h, C, y, void 0, {}, b, Je(u, b)), [
1654
- h,
1655
- C,
1656
- y,
1657
- b,
1658
- u
1659
- ]);
1660
- return w.length === 0 ? null : /* @__PURE__ */ q("div", {
1661
- style: {
1662
- position: "fixed",
1663
- left: "50%",
1664
- bottom: "calc(var(--tabbar-h) + var(--safe-area-bottom) + 14px)",
1665
- transform: "translateX(-50%)",
1666
- zIndex: 45,
1667
- display: "flex",
1668
- alignItems: "center",
1669
- flexWrap: "wrap",
1670
- gap: 8,
1671
- padding: "6px 10px 6px 14px",
1672
- maxWidth: "calc(100vw - var(--safe-area-left) - var(--safe-area-right) - 24px)",
1673
- boxSizing: "border-box",
1674
- background: "var(--text)",
1675
- color: "var(--background)",
1676
- borderRadius: 10,
1677
- boxShadow: "var(--shadow-lg)",
1678
- animation: "floatbarIn .15s ease-out"
1679
- },
1680
- children: [
1681
- /* @__PURE__ */ K("style", { children: On }),
1682
- /* @__PURE__ */ q("span", {
1683
- style: {
1684
- fontSize: 12.5,
1685
- fontWeight: 600
1686
- },
1687
- children: [/* @__PURE__ */ K("span", {
1688
- style: {
1689
- padding: "1px 7px",
1690
- borderRadius: 4,
1691
- background: "var(--accent)",
1692
- color: "var(--accent-foreground)",
1693
- marginRight: 6,
1694
- fontSize: 11.5
1695
- },
1696
- children: e.length
1697
- }), s(h, "list.selection.selected", e.length, {
1698
- one: "selected",
1699
- other: "selected"
1700
- })]
1701
- }),
1702
- /* @__PURE__ */ K(qe, {
1703
- layout: w,
1704
- kind: "toolbar",
1705
- entityActions: y,
1706
- rowSelection: b,
1707
- onRun: (t, n) => {
1708
- let r = Ue(_, t, n, {}, c);
1709
- if (r !== null) return v({
1710
- action: n,
1711
- title: h(n.display?.name) || t,
1712
- bulkSelection: b,
1713
- entity: c,
1714
- execute: async (t) => {
1715
- let n = await O(r, g(t, e));
1716
- return p(), n;
1717
- }
1718
- });
1719
- },
1720
- widgetContext: m,
1721
- ariaLabel: h("list.selection.floatbar", "Floating action bar"),
1722
- constrain: !1
1723
- }),
1724
- /* @__PURE__ */ K("button", {
1725
- onClick: f,
1726
- style: {
1727
- background: "none",
1728
- border: "none",
1729
- color: "var(--background)",
1730
- cursor: "pointer",
1731
- opacity: .6,
1732
- padding: "4px 6px",
1733
- borderRadius: 6
1734
- },
1735
- title: h("list.selection.clear", "Clear selection"),
1736
- children: /* @__PURE__ */ K(j.x, { size: 14 })
1737
- })
1738
- ]
1739
- });
1740
- }
1741
- //#endregion
1742
- //#region src/components/pages/list/useRowMenu.ts
1743
- function An(e, t) {
1744
- let n = (e) => e === "__peek" && !t.peek || e === "__open" && !t.open, r = [];
1745
- for (let i of e) if (i.kind === "action") {
1746
- if (n(i.code)) continue;
1747
- r.push(i);
1748
- } else {
1749
- let e = An(i.items, t);
1750
- e.length > 0 && r.push({
1751
- ...i,
1752
- items: e
1753
- });
1754
- }
1755
- return r;
1756
- }
1757
- function jn(e, t) {
1758
- for (let n of e) if (n.kind === "action") {
1759
- if (n.code === t) return !0;
1760
- } else if (jn(n.items, t)) return !0;
1761
- return !1;
1762
- }
1763
- function Mn({ row: n, rowId: i, screen: a, fullScreen: o, entity: s, entityCode: c, rowActions: u, tabNavigate: f, peekAllowed: p, hasDetailTarget: m, onPeek: h }) {
1764
- let _ = A(), v = A("errors"), { run: y } = je(), { data: b } = r(), x = o.detail_screen === void 0 && a.detail_screen !== void 0 ? {
1765
- ...o,
1766
- detail_screen: a.detail_screen
1767
- } : o, C = Ge(s, x, n) ?? x, w = H(() => {
1768
- let e = {}, t = C.row_actions === void 0 ? void 0 : new Set(C.row_actions);
1769
- for (let { code: n, action: r } of u) (!t || t.has(n)) && (e[n] = r);
1770
- return e;
1771
- }, [u, C.row_actions]), T = H(() => ({
1772
- entity: s,
1773
- entityCode: c ?? "",
1774
- screen: C,
1775
- screenRoute: C.route,
1776
- selectedRows: [],
1777
- selectedIds: [],
1778
- t: _,
1779
- tabNavigate: (e, t) => f(e, {
1780
- title: t?.title,
1781
- icon: t?.icon,
1782
- search: t?.search
1783
- }),
1784
- runActionApi: (e, t) => O(e, t),
1785
- openPeek: (e) => h(e ?? n),
1786
- recordHref: (t) => e(C, t, s, b?.screens)
1787
- }), [
1788
- s,
1789
- c,
1790
- C,
1791
- _,
1792
- f,
1793
- h,
1794
- n,
1795
- b?.screens
1796
- ]), E = H(() => {
1797
- let e = C.action_layout ?? null, t = s.action_layout ?? null, n = e ?? t ?? S(w, "list_row");
1798
- return l(n, w, void 0, "list_row");
1799
- }, [
1800
- C,
1801
- s,
1802
- w
1803
- ]), D = H(() => An(t(_, E, w, void 0, n, [], Re(s, n)), {
1804
- peek: p,
1805
- open: m
1806
- }), [
1807
- _,
1808
- E,
1809
- w,
1810
- n,
1811
- s,
1812
- p,
1813
- m
1814
- ]);
1815
- return {
1816
- layout: D,
1817
- entityActions: w,
1818
- runRowAction: B((e, t) => {
1819
- let r = Ue(v, e, t, { row: n });
1820
- if (r !== null) return y({
1821
- action: t,
1822
- title: _(t.display?.name) || e,
1823
- row: n,
1824
- execute: (e) => O(r, g(e, [i]))
1825
- });
1826
- }, [
1827
- _,
1828
- v,
1829
- y,
1830
- i,
1831
- n
1832
- ]),
1833
- widgetContext: T,
1834
- hasPeek: H(() => jn(D, d), [D])
1835
- };
1836
- }
1837
- //#endregion
1838
- //#region src/components/pages/list/RowActionsCell.tsx
1839
- function Nn({ row: e, rowId: t, screen: n, fullScreen: r, entity: i, entityCode: a, rowActions: o, tabNavigate: s, peekAllowed: c, hasDetailTarget: l, onPeek: u }) {
1840
- let d = A(), { layout: f, entityActions: p, runRowAction: m, widgetContext: h, hasPeek: g } = Mn({
1841
- row: e,
1842
- rowId: t,
1843
- screen: n,
1844
- fullScreen: r,
1845
- entity: i,
1846
- entityCode: a,
1847
- rowActions: o,
1848
- tabNavigate: s,
1849
- peekAllowed: c,
1850
- hasDetailTarget: l,
1851
- onPeek: u
1852
- });
1853
- return /* @__PURE__ */ q("div", {
1854
- className: "sl-row-actions",
1855
- style: {
1856
- display: "flex",
1857
- alignItems: "center",
1858
- gap: 2,
1859
- justifyContent: "flex-end"
1860
- },
1861
- children: [g && /* @__PURE__ */ K(M, {
1862
- size: 22,
1863
- icon: /* @__PURE__ */ K(j.eye, { size: 12 }),
1864
- onClick: (t) => {
1865
- t.stopPropagation(), u(e);
1866
- },
1867
- title: d("list.row.peek", "Peek")
1868
- }), f.length > 0 && /* @__PURE__ */ K(qe, {
1869
- layout: f,
1870
- row: e,
1871
- kind: "row",
1872
- entityActions: p,
1873
- onRun: m,
1874
- widgetContext: h,
1875
- ariaLabel: d("list.row.actions", "Row actions")
1876
- })]
1877
- });
1878
- }
1879
- //#endregion
1880
- //#region src/components/pages/list/columns.ts
1881
- function Q(e, t, n, r, i) {
1882
- let a = C(n, r);
1883
- if (!a || a.read !== "denied") return i ? z("span", { title: i }, t) : t;
1884
- let o = a.required_permission ? e("list.columns.locked_permission", "Locked column: requires \"{permission}\"", { permission: a.required_permission }) : e("list.columns.locked_classification", "Locked column: {classification} classification", { classification: a.classification });
1885
- return z("span", {
1886
- title: o,
1887
- "aria-label": o,
1888
- className: "inline-flex items-center gap-1"
1889
- }, z(j.lock, { size: 12 }), t);
1890
- }
1891
- function $(e) {
1892
- return {
1893
- minSize: Math.min(60, e),
1894
- maxSize: Math.max(L, e)
1895
- };
1896
- }
1897
- function Pn(e) {
1898
- let { visibleCols: t, entity: n, screen: r, schema: i, entityCode: a, rowActions: o, hasBatchActions: s, hasExplicitRowActions: c, canUpdate: l, canDelete: u, peekEnabled: d, hasDetailTarget: f, t: p, tabNavigate: m, refsRef: h, rowSelectionKey: g, setPeekRow: _ } = e;
1899
- if (t.length === 0 || !n) return [];
1900
- let v = [];
1901
- s && v.push({
1902
- id: "_select",
1903
- enableResizing: !1,
1904
- header: ({ table: e }) => z(I, {
1905
- checked: e.getIsAllRowsSelected(),
1906
- indeterminate: e.getIsSomeRowsSelected(),
1907
- onChange: () => e.toggleAllRowsSelected()
1908
- }),
1909
- size: 34,
1910
- cell: ({ row: e }) => z("span", { "data-testid": "row-select-checkbox" }, z(I, {
1911
- checked: e.getIsSelected(),
1912
- onChange: () => e.toggleSelected()
1913
- }))
1914
- });
1915
- for (let e of t) {
1916
- if (e.startsWith("$status.")) {
1917
- let t = e.slice(8), r = n.status_groups?.[t];
1918
- if (!r) continue;
1919
- let i = new Map(r.statuses.map((e) => [e.code, e]));
1920
- v.push({
1921
- id: e,
1922
- header: p(r.name) || t,
1923
- size: 140,
1924
- ...$(140),
1925
- cell: ({ row: e }) => {
1926
- let n = e.original.$statuses?.find((e) => e.group_code === t);
1927
- if (!n) return z("span", { className: "text-sm text-muted-foreground" }, "-");
1928
- let r = i.get(n.status_code);
1929
- return z(P, {
1930
- tone: r?.color ?? "slate",
1931
- size: "xs"
1932
- }, p(r?.name) || n.status_code);
1933
- }
1934
- });
1935
- continue;
1936
- }
1937
- if (e.startsWith("$property.")) {
1938
- let t = e.slice(10), r = n.properties?.[t];
1939
- if (!r) continue;
1940
- v.push({
1941
- id: e,
1942
- header: () => Q(p, p(r.name) || t, n, t, p(r.description) || void 0),
1943
- size: 150,
1944
- ...$(150),
1945
- enableSorting: !1,
1946
- cell: ({ row: e }) => {
1947
- let n = e.original.$properties?.find((e) => e.property_code === t);
1948
- return !n || n.value == null ? z("span", { className: "text-sm text-muted-foreground" }, "-") : z("span", { className: "text-sm" }, k(n.value));
1949
- }
1950
- });
1951
- continue;
1952
- }
1953
- if (e === "$evidence") {
1954
- v.push({
1955
- id: e,
1956
- header: p("list.columns.evidence", "Evidence"),
1957
- size: 140,
1958
- ...$(140),
1959
- enableSorting: !1,
1960
- cell: ({ row: e }) => {
1961
- let t = e.original.$evidence?.verdict ?? "unverified";
1962
- return z(P, {
1963
- tone: ct(t),
1964
- size: "xs",
1965
- dot: !0
1966
- }, ut(p, t));
1967
- }
1968
- });
1969
- continue;
1970
- }
1971
- if (n.files?.get(e)) {
1972
- v.push({
1973
- id: e,
1974
- accessorFn: (t) => t.$files?.[e] ?? null,
1975
- header: () => Q(p, We(p, n, e, i?.entities), n, e),
1976
- size: 150,
1977
- ...$(150),
1978
- cell: ({ row: t }) => Ke({
1979
- entity: n,
1980
- entityCode: a,
1981
- fieldName: e,
1982
- record: t.original,
1983
- mode: "display",
1984
- surface: "list",
1985
- refs: h.current,
1986
- t: p
1987
- })
1988
- });
1989
- continue;
1990
- }
1991
- let t = n.fields.get(e);
1992
- if (!t) continue;
1993
- let r = w(p, t, e, i?.entities), o = t.display?.width, s = ye({
1994
- field: t,
1995
- fieldName: e,
1996
- surface: "list",
1997
- entity: n,
1998
- entityCode: a,
1999
- entities: i?.entities,
2000
- screens: i?.screens,
2001
- refs: () => h.current,
2002
- t: p
2003
- });
2004
- v.push({
2005
- id: e,
2006
- accessorKey: e,
2007
- header: () => Q(p, r, n, e, p(t.display?.description) || void 0),
2008
- enableSorting: t.type !== "json" && y(n, e),
2009
- size: o ?? 150,
2010
- ...$(o ?? 150),
2011
- cell: ({ getValue: e, row: t }) => s(e(), t.original)
2012
- });
2013
- }
2014
- return (!c && l || !c && u || o.length > 0) && v.push({
2015
- id: "_actions",
2016
- enableResizing: !1,
2017
- header: "",
2018
- size: 40,
2019
- cell: ({ row: e }) => z(Nn, {
2020
- row: e.original,
2021
- rowId: g(n, e.original),
2022
- screen: r,
2023
- fullScreen: r,
2024
- entity: n,
2025
- entityCode: a,
2026
- rowActions: o,
2027
- tabNavigate: m,
2028
- peekAllowed: d,
2029
- hasDetailTarget: f,
2030
- onPeek: _
2031
- })
2032
- }), v;
2033
- }
2034
- //#endregion
2035
- //#region src/components/pages/list/RowContextMenu.tsx
2036
- function Fn({ x: e, y: t, row: n, rowId: r, screen: i, fullScreen: a, entity: o, entityCode: s, rowActions: c, tabNavigate: l, peekAllowed: u, hasDetailTarget: d, onPeek: f, onClose: p }) {
2037
- let { layout: m, entityActions: h, runRowAction: g, widgetContext: _ } = Mn({
2038
- row: n,
2039
- rowId: r,
2040
- screen: i,
2041
- fullScreen: a,
2042
- entity: o,
2043
- entityCode: s,
2044
- rowActions: c,
2045
- tabNavigate: l,
2046
- peekAllowed: u,
2047
- hasDetailTarget: d,
2048
- onPeek: f
2049
- }), [v, y] = W(null), b = B((e, t) => (p(), g(e, t)), [p, g]);
2050
- return m.length === 0 ? null : /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ K("div", {
2051
- onClick: p,
2052
- onContextMenu: (e) => {
2053
- e.preventDefault(), p();
2054
- },
2055
- style: {
2056
- position: "fixed",
2057
- inset: 0,
2058
- zIndex: 190
2059
- }
2060
- }), /* @__PURE__ */ K(fe, {
2061
- open: !0,
2062
- anchor: null,
2063
- anchorPoint: {
2064
- x: e,
2065
- y: t
2066
- },
2067
- onClose: p,
2068
- width: 220,
2069
- children: /* @__PURE__ */ K("div", {
2070
- onClick: p,
2071
- children: /* @__PURE__ */ K(ze, {
2072
- layout: m,
2073
- entityActions: h,
2074
- onRun: b,
2075
- loading: v,
2076
- onLoadingChange: y,
2077
- row: n,
2078
- widgetContext: _
2079
- })
2080
- })
2081
- })] });
2082
- }
2083
- //#endregion
2084
- //#region src/components/pages/list/useHeaderReorder.ts
2085
- var In = 5, Ln = 48, Rn = 18;
2086
- function zn({ visibleCols: e, onReorder: t, scrollElRef: n, theadRef: r }) {
2087
- let [i, a] = W(null), [o, s] = W(null), [c, l] = W(!1), u = U(null), d = U(!1), f = U(!1), p = U([]), m = U(null), h = U(0), g = U(null), _ = U(0), v = B(() => {
2088
- g.current !== null && (cancelAnimationFrame(g.current), g.current = null);
2089
- }, []), y = B(() => {
2090
- u.current = null, d.current = !1, p.current = [], m.current = null, v(), a(null), s(null), l(!1);
2091
- }, [v]), b = B((e) => {
2092
- let t = p.current, r = e + ((n.current?.scrollLeft ?? 0) - _.current);
2093
- for (let e = 0; e < t.length; e++) if (r < (t[e].left + t[e].right) / 2) return e;
2094
- return t.length;
2095
- }, [n]), x = B(() => {
2096
- let e = n.current;
2097
- if (!d.current || !e) {
2098
- g.current = null;
2099
- return;
2100
- }
2101
- let t = e.getBoundingClientRect(), r = h.current, i = 0;
2102
- if (r < t.left + Ln ? i = -Math.ceil((t.left + Ln - r) / Ln * Rn) : r > t.right - Ln && (i = Math.ceil((r - (t.right - Ln)) / Ln * Rn)), i !== 0) {
2103
- e.scrollLeft += i;
2104
- let t = b(h.current);
2105
- m.current = t, s(t);
2106
- }
2107
- g.current = requestAnimationFrame(x);
2108
- }, [n, b]), S = B((e, t) => {
2109
- t.button === 0 && (u.current = {
2110
- colId: e,
2111
- x: t.clientX
2112
- }, d.current = !1, f.current = !1);
2113
- }, []), C = B(() => f.current ? (f.current = !1, !0) : !1, []);
2114
- return V(() => {
2115
- let i = (t) => {
2116
- let i = u.current;
2117
- if (!i) return;
2118
- if (h.current = t.clientX, !d.current) {
2119
- if (Math.abs(t.clientX - i.x) < In) return;
2120
- let o = r.current, s = [];
2121
- if (o) for (let t of e) {
2122
- let e = o.querySelector(`[data-col-id="${CSS.escape(t)}"]`);
2123
- if (e) {
2124
- let n = e.getBoundingClientRect();
2125
- s.push({
2126
- id: t,
2127
- left: n.left,
2128
- right: n.right
2129
- });
2130
- }
2131
- }
2132
- p.current = s, _.current = n.current?.scrollLeft ?? 0, d.current = !0, f.current = !0, a(i.colId), l(!0), g.current === null && (g.current = requestAnimationFrame(x));
2133
- }
2134
- let o = b(t.clientX);
2135
- m.current = o, s(o);
2136
- }, o = (n) => {
2137
- let r = u.current;
2138
- if (r && d.current && n) {
2139
- let n = e.indexOf(r.colId), i = m.current ?? n;
2140
- if (n !== -1) {
2141
- let a = e.filter((e, t) => t !== n);
2142
- i > n && --i, i = Math.max(0, Math.min(i, a.length));
2143
- let o = [
2144
- ...a.slice(0, i),
2145
- r.colId,
2146
- ...a.slice(i)
2147
- ];
2148
- o.some((t, n) => t !== e[n]) && t(o);
2149
- }
2150
- }
2151
- y();
2152
- }, c = () => o(!0), v = (e) => {
2153
- e.key === "Escape" && d.current && o(!1);
2154
- };
2155
- return window.addEventListener("mousemove", i), window.addEventListener("mouseup", c), window.addEventListener("keydown", v), () => {
2156
- window.removeEventListener("mousemove", i), window.removeEventListener("mouseup", c), window.removeEventListener("keydown", v);
2157
- };
2158
- }, [
2159
- e,
2160
- t,
2161
- r,
2162
- n,
2163
- b,
2164
- x,
2165
- y
2166
- ]), V(() => y, [y]), {
2167
- dragColId: i,
2168
- dropIndex: o,
2169
- isDragging: c,
2170
- onHeaderMouseDown: S,
2171
- consumeDragSuppression: C
2172
- };
2173
- }
2174
- //#endregion
2175
- //#region src/components/pages/SmartListPage.impl.tsx
2176
- var Bn = wt(() => import("./ListCardsBody-BEoYjSZ2.js").then((e) => ({ default: e.ListCardsBody })));
2177
- function Vn({ screenCode: e }) {
2178
- return /* @__PURE__ */ K(ve, { children: /* @__PURE__ */ K(Un, { screenCode: e }) });
2179
- }
2180
- var Hn = [];
2181
- function Un({ screenCode: t }) {
2182
- let o = A(), s = A("errors"), c = we(), [l, u] = Dt(), { data: d } = r(), [f, m] = W(!1), [h, g] = W(!1), [_, v] = W(null), y = i((e) => e.user), b = i((e) => e.activeTenant), S = _e(), C = d?.screens[t], w = C?.entity ? d?.entities[C.entity] : void 0, E = C?.entity, D = x(w, "create"), ee = x(w, "update"), j = x(w, "delete"), M = d?.actions, N = H(() => n(a(w?.actions, C?.actions, "list_toolbar", M), w), [
2183
- w,
2184
- C?.actions,
2185
- M
2186
- ]), P = H(() => n(a(w?.actions, void 0, "list_floatbar", M), w), [w, M]), ne = H(() => {
2187
- let e = /* @__PURE__ */ new Map(), t = (t) => {
2188
- for (let n of a(w?.actions, t, "list_row", M)) e.set(n.code, n);
2189
- };
2190
- t(C?.row_actions);
2191
- for (let e of C?.variants?.items() ?? []) e.row_actions !== void 0 && t(e.row_actions);
2192
- return n([...e.values()], w);
2193
- }, [
2194
- w,
2195
- C,
2196
- M
2197
- ]), ie = C?.row_actions !== void 0, ae = H(() => P.length > 0 || w?.export?.enabled !== !1 && C?.export?.enabled !== !1, [
2198
- P,
2199
- w?.export?.enabled,
2200
- C?.export?.enabled
2201
- ]), se = !!w?.soft_delete, ce = se && (y?.permissions ?? []).some((e) => e === "feature:view_deleted" || e === "feature:*" || e === "*"), le = ce && l.get("include_deleted") === "true", ue = p(), { openTab: de, updateTabSearch: fe, findTabByPathname: F } = me();
2202
- nt(C, w, l.toString()), Ze(C?.route);
2203
- let he = B((e) => {
2204
- if (!C?.route || !w || ue.enabled) return;
2205
- let t = F(C.route);
2206
- t ? fe(t.id, e) : de({
2207
- pathname: C.route,
2208
- search: e,
2209
- title: o(C.display?.name) || o(w.display.name_plural),
2210
- icon: C.display?.icon || w.display.icon,
2211
- closable: !0
2212
- });
2213
- }, [
2214
- o,
2215
- C,
2216
- w,
2217
- ue.enabled,
2218
- F,
2219
- fe,
2220
- de
2221
- ]), ge = parseInt(l.get("page") ?? "1", 10), ve = (() => {
2222
- let e = parseInt(l.get("per_page") ?? "", 10);
2223
- return !Number.isFinite(e) || e <= 0 || e > 1e3 ? 200 : e;
2224
- })(), xe = l.get("search") ?? "", Se = H(() => {
2225
- let e = et(l);
2226
- return e.error === null ? null : s(e.errorCode ?? "", e.error);
2227
- }, [s, l]), I = Vt({
2228
- screenCode: t,
2229
- screen: C,
2230
- entity: w,
2231
- searchParams: l,
2232
- setSearchParams: u,
2233
- userId: y?.id,
2234
- tenantId: b?.id,
2235
- filterError: !!Se
2236
- }), { filters: Ce, columns: Te, sort: Ee } = I.defaults, { filters: De, setFilters: Oe, clearFilters: ke } = oe({ defaults: Ce }), { visibleFilterState: Ae, filterFieldMeta: je, allFilterFieldMeta: Me, filterFieldName: Pe } = xt(C, w, d?.entities, De), L = Ae.filters, Ie = it(L), Le = B(() => Oe(Hn), [Oe]), Re = Wt({
2237
- searchParams: l,
2238
- setSearchParams: u,
2239
- defaultSort: Ee,
2240
- commitScreenTabSearch: he
2241
- }), { cols: ze, nullsByField: He, value: Ue, forRequest: We, tableSorting: Ke, write: qe, applyColumn: Je, shiftClickColumn: Qe, appendColumn: st, clearColumn: ct, clearAll: lt } = Re, ut = Yt({
2242
- screenCode: t,
2243
- screen: C,
2244
- searchParams: l,
2245
- setSearchParams: u,
2246
- defaultColumns: Te
2247
- }), { visible: R, sizing: dt, setSizing: ft, apply: gt, commitResize: z } = ut, wt = xn({
2248
- screenCode: t,
2249
- screen: C,
2250
- entity: w,
2251
- searchParams: l,
2252
- setSearchParams: u,
2253
- userId: y?.id,
2254
- tenantId: b?.id,
2255
- all: I.all,
2256
- activeId: I.activeId,
2257
- active: I.active,
2258
- clearedKey: I.clearedKey,
2259
- filters: De,
2260
- visibleColumns: R,
2261
- sort: Ue
2262
- }), { active: Tt, saveAsNew: Et, overwriteActive: Ot, isSaving: kt } = wt, At = pe(xe, 300), J = te(), Y = H(() => {
2263
- let e = C?.responsive?.[J.category]?.presentation;
2264
- return e === "table" || e === "cards" ? e : J.category === "phone" ? "cards" : "table";
2265
- }, [C?.responsive, J.category]), jt = H(() => _t({
2266
- entity: w,
2267
- screen: C,
2268
- savedViewColumns: Tt?.columns
2269
- }), [
2270
- w,
2271
- C,
2272
- Tt?.columns
2273
- ]), Mt = H(() => ht({
2274
- entity: w,
2275
- screen: C,
2276
- presentation: Y,
2277
- visibleColumns: R,
2278
- card: jt,
2279
- rowActions: ne,
2280
- toolbarActions: N,
2281
- bulkActions: P,
2282
- sort: ze,
2283
- screens: d?.screens
2284
- }), [
2285
- w,
2286
- C,
2287
- Y,
2288
- R,
2289
- jt,
2290
- ne,
2291
- N,
2292
- P,
2293
- ze,
2294
- d?.screens
2295
- ]), Ft = yt({
2296
- entity: w,
2297
- entityCode: E,
2298
- screen: C,
2299
- screenCode: t,
2300
- page: ge,
2301
- perPage: ve,
2302
- sortForRequest: We,
2303
- debouncedSearch: At,
2304
- filters: L,
2305
- isHeld: I.isHeld,
2306
- retryHeld: I.retryViews,
2307
- includeDeleted: le,
2308
- expand: Mt.expandFields,
2309
- select: Mt.selectFields,
2310
- runCountQuery: !0,
2311
- urlKey: `${E ?? ""}|${l.toString()}`
2312
- }), { rows: X, meta: It, refs: Lt, isLoading: Rt, isFetching: zt, isShowingPreviousRows: Bt, isError: Ut, error: Gt, isLoadingStale: qt, retry: Xt, countTotal: Zt, countStrategy: Qt, countLoading: $t, countError: tn, totalPages: Z, hasMorePages: nn, isCursor: an, fetchNextPage: on, isFetchingNextPage: sn } = Ft, cn = Jt(w, X, zt), { state: un, setState: pn, ids: mn, pkValues: hn, rows: gn, keyOf: _n } = cn, yn = Ne(w?.realtime, E ?? ""), bn = Fe(E ?? ""), wn = U(Lt);
2313
- wn.current = Lt;
2314
- let On = H(() => {
2315
- let e = /* @__PURE__ */ new Map();
2316
- if (!w) return e;
2317
- for (let t of mt(w, C, Tt?.columns)) {
2318
- if (t.startsWith("$") || w.files?.get(t)) continue;
2319
- let n = w.fields.get(t);
2320
- n && e.set(t, ye({
2321
- field: n,
2322
- fieldName: t,
2323
- surface: "list",
2324
- entity: w,
2325
- entityCode: E,
2326
- entities: d?.entities,
2327
- screens: d?.screens,
2328
- refs: () => wn.current,
2329
- t: o
2330
- }));
2331
- }
2332
- return e;
2333
- }, [
2334
- w,
2335
- E,
2336
- C,
2337
- Tt?.columns,
2338
- d?.entities,
2339
- d?.screens,
2340
- wn,
2341
- o
2342
- ]), { labelFor: An, refs: jn } = St(Me, L, Lt, d?.entities), Mn = en({
2343
- entity: w,
2344
- screen: C,
2345
- screens: d?.screens,
2346
- entities: d?.entities,
2347
- searchParams: l,
2348
- tabNavigate: c,
2349
- commitScreenTabSearch: he,
2350
- isPhone: J.category === "phone",
2351
- canUpdate: ee
2352
- }), { peekAllowed: Nn, peekRow: Q, setPeekRow: $, peekFields: In, peekActions: Ln, peekExecute: Rn, contextMenu: Vn, setContextMenu: Un } = Mn, Wn = H(() => !C || !w ? !1 : e(C, "_", w, d?.screens) !== null, [
2353
- C,
2354
- w,
2355
- d?.screens
2356
- ]), Gn = H(() => Pn({
2357
- visibleCols: R,
2358
- entity: w,
2359
- screen: C,
2360
- schema: d,
2361
- entityCode: E,
2362
- rowActions: ne,
2363
- hasBatchActions: ae,
2364
- hasExplicitRowActions: ie,
2365
- canUpdate: ee,
2366
- canDelete: j,
2367
- peekEnabled: Nn,
2368
- hasDetailTarget: Wn,
2369
- t: o,
2370
- tabNavigate: c,
2371
- refsRef: wn,
2372
- rowSelectionKey: Kt,
2373
- setPeekRow: $
2374
- }), [
2375
- C,
2376
- w,
2377
- R,
2378
- c,
2379
- ae,
2380
- ne,
2381
- ie,
2382
- E,
2383
- Nn,
2384
- Wn,
2385
- d,
2386
- o,
2387
- ee,
2388
- j,
2389
- wn,
2390
- $
2391
- ]), Kn = Nt({
2392
- features: Ht,
2393
- data: X,
2394
- columns: Gn,
2395
- manualSorting: !0,
2396
- enableColumnResizing: !0,
2397
- columnResizeMode: "onChange",
2398
- onColumnSizingChange: ft,
2399
- state: {
2400
- sorting: Ke,
2401
- rowSelection: un,
2402
- columnSizing: dt
2403
- },
2404
- onSortingChange: (e) => {
2405
- let t = (typeof e == "function" ? e(Ke) : e).slice(0, 5);
2406
- if (t.length === 0) {
2407
- qe([]);
2408
- return;
2409
- }
2410
- let n = t.map((e) => {
2411
- let t = He.get(e.id);
2412
- return {
2413
- field: e.id,
2414
- dir: e.desc ? "desc" : "asc",
2415
- ...t ? { nulls: t } : {}
2416
- };
2417
- });
2418
- qe(n);
2419
- },
2420
- onRowSelectionChange: pn,
2421
- getRowId: _n
2422
- }), qn = Kn.state.columnResizing.isResizingColumn, Jn = U(!1);
2423
- V(() => {
2424
- let e = !!Jn.current && !qn;
2425
- Jn.current = qn, e && z(Kn.state.columnSizing);
2426
- }, [
2427
- qn,
2428
- z,
2429
- Kn
2430
- ]);
2431
- let Yn = rn(Kn), Xn = Kn.getTotalSize();
2432
- V(() => {
2433
- let e = (e) => {
2434
- let t = e.target?.tagName;
2435
- t === "INPUT" || t === "TEXTAREA" || t === "SELECT" ? e.key === "Escape" && (e.target.blur(), m(!1)) : (e.key === "/" && !e.metaKey && !e.ctrlKey && (e.preventDefault(), document.querySelector("[placeholder*=\"Search\"]")?.focus()), e.key === "f" && !e.metaKey && !e.ctrlKey && (e.preventDefault(), m((e) => !e)), e.key === "Escape" && m(!1));
2436
- };
2437
- return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
2438
- }, []);
2439
- let Zn = U(null), { rows: Qn } = Kn.getRowModel(), $n = U(null), er = zn({
2440
- visibleCols: R,
2441
- onReorder: gt,
2442
- scrollElRef: Zn,
2443
- theadRef: $n
2444
- }), tr = be((e) => e.density), nr = be((e) => e.zebra), rr = ot(), ir = Pt({
2445
- count: Qn.length,
2446
- getScrollElement: () => Zn.current,
2447
- estimateSize: () => Y === "cards" ? 142 : 48,
2448
- overscan: 10,
2449
- initialOffset: rr
2450
- }), ar = H(() => Qn.map((e) => e.id), [Qn]);
2451
- at({
2452
- virtualizer: ir,
2453
- scrollElementRef: Zn,
2454
- rowKeys: ar
2455
- }), V(() => {
2456
- ir.measure();
2457
- }, [tr, ir]), V(() => {
2458
- ir.measure();
2459
- }, [
2460
- J.width,
2461
- J.height,
2462
- Y,
2463
- ir
2464
- ]);
2465
- let or = B((e) => {
2466
- u((t) => {
2467
- let n = new URLSearchParams(t);
2468
- return e ? n.set("search", e) : n.delete("search"), n.set("page", "1"), n;
2469
- });
2470
- }, [u]), sr = B(() => {
2471
- u((e) => {
2472
- let t = new URLSearchParams(e);
2473
- return t.get("include_deleted") ? t.delete("include_deleted") : t.set("include_deleted", "true"), t.set("page", "1"), t;
2474
- });
2475
- }, [u]), cr = B((e) => {
2476
- u((t) => {
2477
- let n = new URLSearchParams(t);
2478
- return n.set("page", String(e)), n;
2479
- });
2480
- }, [u]);
2481
- V(() => {
2482
- Z !== void 0 && ge > Z && cr(Z);
2483
- }, [
2484
- Z,
2485
- ge,
2486
- cr
2487
- ]);
2488
- let lr = B((e) => {
2489
- u((t) => {
2490
- let n = new URLSearchParams(t);
2491
- return n.set("per_page", String(e)), n.set("page", "1"), n;
2492
- });
2493
- }, [u]);
2494
- if (!C || !w) return null;
2495
- let ur = w.display, dr = o(C.display?.name) || o(ur.name), fr = C.display?.icon || ur.icon, pr = o(C.display?.description) || o(ur.description), mr = J.category === "phone", hr = Y === "cards", gr = hn.map((e) => T(w, e)), _r = {
2496
- entity: w,
2497
- entityCode: E ?? "",
2498
- screen: C,
2499
- screenRoute: C.route,
2500
- selectedRows: gn,
2501
- selectedIds: gr,
2502
- t: o,
2503
- tabNavigate: (e, t) => c(e, {
2504
- title: t?.title,
2505
- icon: t?.icon,
2506
- search: t?.search
2507
- }),
2508
- runActionApi: (e, t) => O(e, t)
2509
- };
2510
- return /* @__PURE__ */ q("div", {
2511
- style: {
2512
- display: "flex",
2513
- flexDirection: "column",
2514
- height: "100%",
2515
- background: "var(--background)"
2516
- },
2517
- children: [
2518
- /* @__PURE__ */ q(G, { children: [
2519
- /* @__PURE__ */ K(Dn, {
2520
- title: dr,
2521
- description: pr,
2522
- toolbarActions: N,
2523
- screenActionLayout: C.action_layout,
2524
- entityActionLayout: w.action_layout,
2525
- selectedIds: mn,
2526
- data: X,
2527
- rowKey: _n,
2528
- onActionSuccess: () => pn({}),
2529
- widgetContext: _r
2530
- }),
2531
- /* @__PURE__ */ K(vn, {
2532
- screen: C,
2533
- entity: w,
2534
- entityCode: E,
2535
- schema: d,
2536
- screenCode: t,
2537
- screenName: dr,
2538
- isPhone: mr,
2539
- isCardsPresentation: hr,
2540
- sort: Re,
2541
- columns: ut,
2542
- views: wt,
2543
- query: Ft,
2544
- selection: cn,
2545
- filters: {
2546
- json: L,
2547
- debouncedSearch: At,
2548
- count: Ie,
2549
- onOpen: () => m(!0)
2550
- },
2551
- searchValue: xe,
2552
- onSearchChange: or,
2553
- onSaveView: () => g(!0),
2554
- onDeleteView: v,
2555
- page: ge,
2556
- perPage: ve,
2557
- includeDeleted: le,
2558
- canViewDeleted: ce,
2559
- onToggleDeleted: sr,
2560
- realtime: w?.realtime === !0,
2561
- isLive: yn
2562
- }),
2563
- /* @__PURE__ */ K(Tn, {
2564
- filterError: Se,
2565
- unresolvedViewId: I.isUnresolved ? I.activeId : null,
2566
- onClearFilters: ke,
2567
- onClearView: I.clearActiveView
2568
- }),
2569
- Ae.omitted && /* @__PURE__ */ K(vt, { className: "px-5 pb-2.5" }),
2570
- L.length > 0 && /* @__PURE__ */ K("div", {
2571
- style: { padding: "0 20px 10px" },
2572
- children: /* @__PURE__ */ K(rt, {
2573
- filters: L,
2574
- resolveValue: An,
2575
- onRemoveAtPath: (e) => Oe($e(L, e)),
2576
- onClearAll: Le,
2577
- onChipClick: () => m(!0),
2578
- fieldLabel: Pe
2579
- })
2580
- })
2581
- ] }),
2582
- /* @__PURE__ */ K(bt, {
2583
- isLoading: Rt,
2584
- tableLoadingStale: qt,
2585
- isError: Ut,
2586
- error: Gt,
2587
- rowCount: X.length,
2588
- entity: w,
2589
- screen: C,
2590
- screenName: dr,
2591
- screenIcon: fr,
2592
- isFiltered: !!At || Ie > 0,
2593
- canCreate: D,
2594
- toolbarActions: N,
2595
- onRetry: Xt
2596
- }),
2597
- Rt || Ut || X.length === 0 ? null : /* @__PURE__ */ K("div", {
2598
- style: {
2599
- flex: 1,
2600
- minHeight: 0,
2601
- padding: "0 20px 16px",
2602
- display: "flex",
2603
- flexDirection: "column"
2604
- },
2605
- children: /* @__PURE__ */ q("div", {
2606
- style: {
2607
- background: "var(--surface)",
2608
- border: "1px solid var(--border)",
2609
- borderRadius: 8,
2610
- overflow: "hidden",
2611
- boxShadow: "var(--shadow-xs)",
2612
- display: "flex",
2613
- flexDirection: "column",
2614
- flex: 1,
2615
- minHeight: 0
2616
- },
2617
- children: [/* @__PURE__ */ K("div", {
2618
- ref: Zn,
2619
- "data-testid": "list-scroll",
2620
- "data-presentation": Y,
2621
- style: {
2622
- overflow: "auto",
2623
- flex: 1,
2624
- minHeight: 0
2625
- },
2626
- children: Y === "cards" ? /* @__PURE__ */ K(Ct, {
2627
- fallback: null,
2628
- children: /* @__PURE__ */ K(Bn, {
2629
- rows: Qn,
2630
- virtualizer: ir,
2631
- entity: w,
2632
- screen: C,
2633
- entityCode: E,
2634
- entities: d?.entities,
2635
- savedViewColumns: Tt?.columns,
2636
- refs: wn.current,
2637
- renderers: On,
2638
- rowActions: ne,
2639
- tabNavigate: c,
2640
- interaction: Mn,
2641
- hasSoftDelete: se,
2642
- zebra: nr,
2643
- hasBatchActions: ae,
2644
- hasDetailTarget: Wn,
2645
- rowKey: _n
2646
- })
2647
- }) : /* @__PURE__ */ K(ln, {
2648
- showsPreviousRows: Bt,
2649
- table: Kn,
2650
- columns: Gn,
2651
- rows: Qn,
2652
- entity: w,
2653
- columnSizeVars: Yn,
2654
- totalColumnsWidth: Xn,
2655
- theadRef: $n,
2656
- virtualizer: ir,
2657
- visibleCols: R,
2658
- headerReorder: er,
2659
- sortCols: ze,
2660
- sortNullsMap: He,
2661
- shiftClickColumn: Qe,
2662
- applyColumnSort: Je,
2663
- appendColumnSort: st,
2664
- clearColumnSort: ct,
2665
- clearAllSorts: lt,
2666
- renderRow: (e, t) => /* @__PURE__ */ K(dn, {
2667
- row: e,
2668
- rowIndex: t,
2669
- entity: w,
2670
- hasSoftDelete: se,
2671
- zebra: nr,
2672
- hasDetailTarget: Wn,
2673
- interaction: Mn,
2674
- measureElement: ir.measureElement
2675
- }, e.id),
2676
- isResizingColumn: qn
2677
- })
2678
- }), /* @__PURE__ */ K(fn, {
2679
- meta: It,
2680
- isCursor: an,
2681
- isPhone: mr,
2682
- rowsLoaded: X.length,
2683
- selectedCount: mn.length,
2684
- countTotal: Zt,
2685
- countStrategy: Qt,
2686
- countLoading: $t,
2687
- countError: tn,
2688
- page: ge,
2689
- totalPages: Z,
2690
- goToPage: cr,
2691
- perPage: ve,
2692
- setPerPage: lr,
2693
- hasMorePages: nn,
2694
- fetchNextPage: on,
2695
- isFetchingNextPage: sn
2696
- })]
2697
- })
2698
- }),
2699
- /* @__PURE__ */ K(tt, {
2700
- open: f,
2701
- onClose: () => m(!1),
2702
- filters: L,
2703
- onApply: Oe,
2704
- availableFields: je,
2705
- allFields: Me,
2706
- fieldLabel: Pe,
2707
- resolveValue: An,
2708
- defaultFilters: C?.default_filters,
2709
- refs: jn
2710
- }),
2711
- /* @__PURE__ */ K(Cn, {
2712
- view: _,
2713
- onCancel: () => v(null),
2714
- onConfirm: (e) => {
2715
- wt.deleteView(e).catch(() => void 0).finally(() => v(null));
2716
- }
2717
- }),
2718
- /* @__PURE__ */ K(En, {
2719
- open: h,
2720
- pending: kt,
2721
- onClose: () => g(!1),
2722
- overwriteViewName: Sn(o, Tt),
2723
- onOverwrite: async () => {
2724
- await Ot(), g(!1);
2725
- },
2726
- onSave: async (e) => {
2727
- await Et(e), g(!1);
2728
- }
2729
- }),
2730
- mn.length > 0 && /* @__PURE__ */ K(kn, {
2731
- selectedIds: mn,
2732
- floatbarActions: P,
2733
- screenActionLayout: C.action_layout,
2734
- entityActionLayout: w.action_layout,
2735
- data: X,
2736
- rowKey: _n,
2737
- entityCode: E,
2738
- entity: w,
2739
- screen: C,
2740
- onClear: () => pn({}),
2741
- onActionSuccess: () => pn({}),
2742
- widgetContext: _r
2743
- }),
2744
- Vn && w && C && /* @__PURE__ */ K(Fn, {
2745
- x: Vn.x,
2746
- y: Vn.y,
2747
- row: Vn.row,
2748
- rowId: _n(Vn.row),
2749
- screen: C,
2750
- fullScreen: C,
2751
- entity: w,
2752
- entityCode: E,
2753
- rowActions: ne,
2754
- tabNavigate: c,
2755
- peekAllowed: Nn,
2756
- hasDetailTarget: Wn,
2757
- onPeek: $,
2758
- onClose: () => Un(null)
2759
- }),
2760
- Nn && Q && w && /* @__PURE__ */ K(re, {
2761
- entity: w,
2762
- entityCode: E,
2763
- record: Q,
2764
- title: (() => {
2765
- let e = C.columns?.find((e) => !e.startsWith("$status.") && !e.startsWith("$property."));
2766
- return e ? k(Q[e] ?? o(w.display.name)) : o(w.display.name);
2767
- })(),
2768
- recordId: (() => {
2769
- let e = w.fields.names()?.find((e) => w.fields.get(e)?.primary);
2770
- return e ? k(Q[e]) : void 0;
2771
- })(),
2772
- fields: In,
2773
- screen: Ge(w, C, Q),
2774
- actions: Ln,
2775
- screenActionLayout: Ge(w, C, Q)?.action_layout,
2776
- entityActionLayout: w.action_layout,
2777
- executeAction: Rn,
2778
- onClose: () => {
2779
- if (w && Q) {
2780
- let e = w.fields.names()?.find((e) => w.fields.get(e)?.primary);
2781
- e && pt(k(Q[e]));
2782
- }
2783
- $(null);
2784
- },
2785
- onOpen: (e) => {
2786
- let t = Q;
2787
- $(null), Mn.navigateToDetail(t, { draft: e });
2788
- },
2789
- onSave: (e) => {
2790
- $(e);
2791
- let t = w.fields.names()?.find((e) => w.fields.get(e)?.primary);
2792
- if (!t) return;
2793
- let n = k(e[t]), r = {};
2794
- for (let t of w.fields.names()) {
2795
- let n = Be(w, e, t), i = Be(w, Q, t), a = Ve(w, t, n), o = Ve(w, t, i);
2796
- (a === "" ? null : a) !== (o === "" || o === void 0 ? null : o) && (r[t] = a);
2797
- }
2798
- let i = Xe({
2799
- entity: w,
2800
- formData: e,
2801
- record: Q,
2802
- isNew: !1
2803
- });
2804
- if (Object.keys(i).length > 0 && (r.$files = i), Object.keys(r).length === 0) return;
2805
- let a = Ye(i);
2806
- bn.mutate({
2807
- pkValues: n,
2808
- data: r
2809
- }, { onSuccess: () => {
2810
- a.forEach((e) => S.markCommitted(e));
2811
- } });
2812
- }
2813
- })
2814
- ]
2815
- });
2816
- }
2817
- //#endregion
2818
- export { Vn as SmartListPage, Nn as t };