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