@declarion/react 0.65.0 → 0.66.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (467) hide show
  1. package/dist-lib/api/access-expiry.js +32 -0
  2. package/dist-lib/api/agents.js +105 -0
  3. package/dist-lib/api/auth-redirect.js +30 -0
  4. package/dist-lib/api/auth.js +67 -0
  5. package/dist-lib/api/batch.js +34 -0
  6. package/dist-lib/api/client.js +241 -0
  7. package/dist-lib/api/data.js +122 -0
  8. package/dist-lib/api/entities.js +160 -0
  9. package/dist-lib/api/events.js +120 -0
  10. package/dist-lib/api/fileReferences.js +8 -0
  11. package/dist-lib/api/params.js +20 -0
  12. package/dist-lib/api/properties.js +25 -0
  13. package/dist-lib/api/request-bounds.js +28 -0
  14. package/dist-lib/api/schema.js +71 -0
  15. package/dist-lib/api/session-renewal.js +36 -0
  16. package/dist-lib/api/status.js +17 -0
  17. package/dist-lib/app.js +262 -0
  18. package/dist-lib/components/actions/ActionButton.js +116 -0
  19. package/dist-lib/{ActionDialog-C6EG-AmC.js → components/actions/ActionDialog.js} +63 -53
  20. package/dist-lib/{ActionResultDialog.impl-BATutW8J.js → components/actions/ActionResultDialog.impl.js} +53 -48
  21. package/dist-lib/components/actions/ActionResultDialog.js +12 -0
  22. package/dist-lib/components/actions/ActionRunner.js +274 -0
  23. package/dist-lib/components/actions/ObjectActionBar.js +127 -0
  24. package/dist-lib/components/actions/PropertyGridEditor.js +202 -0
  25. package/dist-lib/components/actions/ResponsiveActionBar.js +773 -0
  26. package/dist-lib/components/actions/RowActionsKebab.js +90 -0
  27. package/dist-lib/{AgentChatPanel.impl-D5y_qEex.js → components/agents/AgentChatPanel.impl.js} +314 -362
  28. package/dist-lib/components/agents/AgentChatPanel.js +12 -0
  29. package/dist-lib/components/agents/AgentConversationDrawer.js +59 -0
  30. package/dist-lib/components/agents/AgentElicitForm.js +152 -0
  31. package/dist-lib/components/agents/AgentOpenFollower.impl.js +7 -0
  32. package/dist-lib/components/agents/AgentOpenFollower.js +12 -0
  33. package/dist-lib/components/agents/AgentPicker.js +58 -0
  34. package/dist-lib/components/agents/transcript-runs.js +52 -0
  35. package/dist-lib/components/chrome/AssociationTabs.js +176 -0
  36. package/dist-lib/components/chrome/AuditMetaStrip.js +64 -0
  37. package/dist-lib/components/chrome/Breadcrumbs.js +67 -0
  38. package/dist-lib/components/chrome/HighlightsStrip.js +39 -0
  39. package/dist-lib/{PageHeader-DiwLe7CO.js → components/chrome/PageHeader.js} +19 -15
  40. package/dist-lib/{PageShell-BJz1MiTH.js → components/chrome/PageShell.js} +3 -3
  41. package/dist-lib/components/chrome/RecordHeader.js +119 -0
  42. package/dist-lib/{headerActionZone-bef-tZZ7.js → components/chrome/headerActionZone.js} +1 -1
  43. package/dist-lib/components/detail-layout/AssociatedBlock.js +1244 -0
  44. package/dist-lib/components/detail-layout/AssociatedToolbar.js +87 -0
  45. package/dist-lib/components/detail-layout/ChildrenBlock.js +80 -0
  46. package/dist-lib/components/detail-layout/ChildrenCards.js +156 -0
  47. package/dist-lib/components/detail-layout/ChildrenList.js +135 -0
  48. package/dist-lib/components/detail-layout/ChildrenTable.js +189 -0
  49. package/dist-lib/components/detail-layout/ChildrenTimeline.js +609 -0
  50. package/dist-lib/components/detail-layout/DetailAuditStrip.js +40 -0
  51. package/dist-lib/components/detail-layout/DetailHighlights.js +54 -0
  52. package/dist-lib/{DraggableChildrenTable-Dd5SeuF6.js → components/detail-layout/DraggableChildrenTable.js} +56 -53
  53. package/dist-lib/components/detail-layout/EditableChildrenTable.js +341 -0
  54. package/dist-lib/components/detail-layout/ErrorSummary.js +89 -0
  55. package/dist-lib/components/detail-layout/EvidenceBlock.js +66 -0
  56. package/dist-lib/{FieldRow-DedGIY9R.js → components/detail-layout/FieldRow.js} +8 -7
  57. package/dist-lib/components/detail-layout/FieldsBlock.js +74 -0
  58. package/dist-lib/components/detail-layout/LayoutColumn.js +16 -0
  59. package/dist-lib/components/detail-layout/LayoutRenderer.js +54 -0
  60. package/dist-lib/components/detail-layout/LayoutRow.js +83 -0
  61. package/dist-lib/components/detail-layout/LayoutTabs.js +195 -0
  62. package/dist-lib/components/detail-layout/PropertiesBlock.js +74 -0
  63. package/dist-lib/components/detail-layout/QuickAddForm.js +81 -0
  64. package/dist-lib/components/detail-layout/SectionBlock.js +48 -0
  65. package/dist-lib/components/detail-layout/StatusesBlock.js +18 -0
  66. package/dist-lib/components/detail-layout/TimelineComposer.js +205 -0
  67. package/dist-lib/components/detail-layout/blockMeta.js +27 -0
  68. package/dist-lib/components/detail-layout/useManualColumnResize.js +94 -0
  69. package/dist-lib/components/detail-layout/useQuickAdd.js +85 -0
  70. package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +295 -0
  71. package/dist-lib/components/detail-layout/widgets/JsonDiffWidget.js +107 -0
  72. package/dist-lib/components/detail-layout/widgets/MonacoJson.js +47 -0
  73. package/dist-lib/components/detail-layout/widgets/WidgetHost.js +36 -0
  74. package/dist-lib/components/detail-layout/widgets/builtins.js +10 -0
  75. package/dist-lib/components/detail-layout/widgets/canonicalizeJson.js +32 -0
  76. package/dist-lib/components/detail-layout/widgets/monacoBootstrap.js +16 -0
  77. package/dist-lib/components/detail-layout/widgets/registry.js +13 -0
  78. package/dist-lib/components/fields/BoolField.js +13 -0
  79. package/dist-lib/components/fields/EmailField.js +16 -0
  80. package/dist-lib/components/fields/EnumField.js +38 -0
  81. package/dist-lib/components/fields/FileReferenceField.js +60 -0
  82. package/dist-lib/components/fields/IntArrayField.js +83 -0
  83. package/dist-lib/components/fields/JsonField.js +51 -0
  84. package/dist-lib/components/fields/MultilangArrayField.js +56 -0
  85. package/dist-lib/components/fields/MultilangField.js +65 -0
  86. package/dist-lib/components/fields/MultilangTextField.js +65 -0
  87. package/dist-lib/components/fields/NumberField.js +64 -0
  88. package/dist-lib/components/fields/PasswordField.js +34 -0
  89. package/dist-lib/components/fields/PhoneField.js +84 -0
  90. package/dist-lib/components/fields/RefCombobox.js +112 -0
  91. package/dist-lib/components/fields/RefField.js +45 -0
  92. package/dist-lib/components/fields/RichTextField.js +225 -0
  93. package/dist-lib/components/fields/SecretField.js +34 -0
  94. package/dist-lib/components/fields/StringArrayField.js +165 -0
  95. package/dist-lib/components/fields/StringField.js +39 -0
  96. package/dist-lib/components/fields/StructureField.js +221 -0
  97. package/dist-lib/components/fields/TextField.js +76 -0
  98. package/dist-lib/components/fields/TimestampField.js +110 -0
  99. package/dist-lib/components/fields/UrlField.js +18 -0
  100. package/dist-lib/components/fields/cells/factories/badge.js +42 -0
  101. package/dist-lib/components/fields/cells/factories/boolPill.js +17 -0
  102. package/dist-lib/components/fields/cells/factories/code.js +11 -0
  103. package/dist-lib/components/fields/cells/factories/date.js +30 -0
  104. package/dist-lib/components/fields/cells/factories/email.js +26 -0
  105. package/dist-lib/components/fields/cells/factories/emptyCell.js +10 -0
  106. package/dist-lib/components/fields/cells/factories/fileReference.js +17 -0
  107. package/dist-lib/components/fields/cells/factories/host-icons.js +146 -0
  108. package/dist-lib/components/fields/cells/factories/json.js +61 -0
  109. package/dist-lib/components/fields/cells/factories/link.js +32 -0
  110. package/dist-lib/components/fields/cells/factories/markdown.js +31 -0
  111. package/dist-lib/components/fields/cells/factories/markdownPreview.js +81 -0
  112. package/dist-lib/components/fields/cells/factories/money.js +37 -0
  113. package/dist-lib/components/fields/cells/factories/multilangInline.js +35 -0
  114. package/dist-lib/components/fields/cells/factories/nextRun.js +46 -0
  115. package/dist-lib/components/fields/cells/factories/number.js +42 -0
  116. package/dist-lib/components/fields/cells/factories/passwordMask.js +23 -0
  117. package/dist-lib/components/fields/cells/factories/phone.js +35 -0
  118. package/dist-lib/components/fields/cells/factories/refLink.js +57 -0
  119. package/dist-lib/components/fields/cells/factories/richTextPreview.js +34 -0
  120. package/dist-lib/components/fields/cells/factories/statusPill.js +35 -0
  121. package/dist-lib/components/fields/cells/factories/tagList.js +44 -0
  122. package/dist-lib/components/fields/cells/factories/text.js +5 -0
  123. package/dist-lib/components/fields/cells/factories/timestamp.js +18 -0
  124. package/dist-lib/components/fields/cells/factories/url-helpers.js +49 -0
  125. package/dist-lib/components/fields/cells/factories/url.js +45 -0
  126. package/dist-lib/components/fields/cells/registry.js +58 -0
  127. package/dist-lib/components/fields/index.js +80 -0
  128. package/dist-lib/components/fields/langMap.js +6 -0
  129. package/dist-lib/components/fields/secretValue.js +7 -0
  130. package/dist-lib/components/file-widgets/CircleImage.js +11 -0
  131. package/dist-lib/components/file-widgets/DocumentCard.js +277 -0
  132. package/dist-lib/components/file-widgets/FileList.js +213 -0
  133. package/dist-lib/{Grid-XUHm5SDe.js → components/file-widgets/Grid.js} +45 -40
  134. package/dist-lib/components/file-widgets/GridLazy.js +15 -0
  135. package/dist-lib/components/file-widgets/ImageWidget.js +354 -0
  136. package/dist-lib/components/file-widgets/LabeledSlots.js +69 -0
  137. package/dist-lib/components/file-widgets/SquareImage.js +11 -0
  138. package/dist-lib/components/file-widgets/UnknownFileWidget.js +22 -0
  139. package/dist-lib/components/file-widgets/UploadFailureText.js +10 -0
  140. package/dist-lib/components/file-widgets/WideBanner.js +11 -0
  141. package/dist-lib/components/file-widgets/builtins.js +15 -0
  142. package/dist-lib/components/file-widgets/cropper.js +13 -0
  143. package/dist-lib/components/file-widgets/draft-scope.js +59 -0
  144. package/dist-lib/components/file-widgets/helpers.js +75 -0
  145. package/dist-lib/components/file-widgets/host.js +75 -0
  146. package/dist-lib/{payload-DioMoxMX.js → components/file-widgets/payload.js} +14 -14
  147. package/dist-lib/components/file-widgets/registry.js +13 -0
  148. package/dist-lib/components/file-widgets/upload.js +180 -0
  149. package/dist-lib/components/file-widgets/useEmbedFileSrc.js +45 -0
  150. package/dist-lib/components/file-widgets/value.js +12 -0
  151. package/dist-lib/components/filters/FilterChips.js +123 -0
  152. package/dist-lib/components/filters/FilterConditionValue.js +40 -0
  153. package/dist-lib/components/filters/FilterDrawer.js +670 -0
  154. package/dist-lib/components/filters/FilterOmittedNotice.js +14 -0
  155. package/dist-lib/components/filters/filter-op-label.js +8 -0
  156. package/dist-lib/{CommandPalette.impl-DRI5kxVY.js → components/layout/CommandPalette.impl.js} +62 -61
  157. package/dist-lib/components/layout/CommandPalette.js +12 -0
  158. package/dist-lib/{DirtyTabsCloseDialog.impl-FhAiOmEb.js → components/layout/DirtyTabsCloseDialog.impl.js} +16 -14
  159. package/dist-lib/components/layout/DirtyTabsCloseDialog.js +12 -0
  160. package/dist-lib/{ImpersonationBanner.impl--g0iYwcV.js → components/layout/ImpersonationBanner.impl.js} +4 -3
  161. package/dist-lib/components/layout/ImpersonationBanner.js +12 -0
  162. package/dist-lib/components/layout/ImpersonationFrame.js +29 -0
  163. package/dist-lib/{ImpersonationStartModal.impl-BFBN0YJe.js → components/layout/ImpersonationStartModal.impl.js} +9 -9
  164. package/dist-lib/components/layout/ImpersonationStartModal.js +12 -0
  165. package/dist-lib/components/layout/Layout.js +755 -0
  166. package/dist-lib/components/layout/Rail.js +149 -0
  167. package/dist-lib/components/layout/Sidebar.js +362 -0
  168. package/dist-lib/components/layout/TabStrip.js +321 -0
  169. package/dist-lib/components/layout/TenantChip.js +355 -0
  170. package/dist-lib/components/layout/TopBar.js +305 -0
  171. package/dist-lib/components/layout/tab-close.js +24 -0
  172. package/dist-lib/components/list/ColumnPicker.js +112 -0
  173. package/dist-lib/components/list/InlineEditCell.js +107 -0
  174. package/dist-lib/components/list/PeekFieldCell.js +143 -0
  175. package/dist-lib/components/list/QuickPeek.js +263 -0
  176. package/dist-lib/components/list/ViewSwitcher.js +156 -0
  177. package/dist-lib/components/list/peekDraftStore.js +14 -0
  178. package/dist-lib/{AdminCatalogPage.impl-B-7MLqa1.js → components/pages/AdminCatalogPage.impl.js} +53 -49
  179. package/dist-lib/components/pages/AdminCatalogPage.js +12 -0
  180. package/dist-lib/components/pages/DocumentsMenu.js +150 -0
  181. package/dist-lib/components/pages/ExportMenu.js +123 -0
  182. package/dist-lib/{NotFoundPage.impl-BoX11u-P.js → components/pages/NotFoundPage.impl.js} +6 -4
  183. package/dist-lib/components/pages/NotFoundPage.js +12 -0
  184. package/dist-lib/components/pages/RecordDocumentsPanel.js +230 -0
  185. package/dist-lib/components/pages/RecordNotesPanel.js +200 -0
  186. package/dist-lib/components/pages/RecordPanels.js +18 -0
  187. package/dist-lib/components/pages/SSOCallbackPage.impl.js +28 -0
  188. package/dist-lib/components/pages/SSOCallbackPage.js +12 -0
  189. package/dist-lib/components/pages/SmartDetailPage.impl.js +986 -0
  190. package/dist-lib/components/pages/SmartDetailPage.js +12 -0
  191. package/dist-lib/components/pages/SmartListPage.impl.js +708 -0
  192. package/dist-lib/components/pages/SmartListPage.js +12 -0
  193. package/dist-lib/components/pages/SmartRecordListPage.impl.js +818 -0
  194. package/dist-lib/components/pages/SmartRecordListPage.js +12 -0
  195. package/dist-lib/components/pages/auth/AuthShell.js +350 -0
  196. package/dist-lib/{Forgot.impl-6tL6SBlS.js → components/pages/auth/Forgot.impl.js} +13 -12
  197. package/dist-lib/components/pages/auth/Forgot.js +12 -0
  198. package/dist-lib/{Reset.impl-D0pjhS6d.js → components/pages/auth/Reset.impl.js} +17 -15
  199. package/dist-lib/components/pages/auth/Reset.js +12 -0
  200. package/dist-lib/components/pages/auth/SignIn.js +252 -0
  201. package/dist-lib/{SignUp.impl-CfEXrUeg.js → components/pages/auth/SignUp.impl.js} +31 -27
  202. package/dist-lib/components/pages/auth/SignUp.js +12 -0
  203. package/dist-lib/{TwoFA.impl-B2HtPduH.js → components/pages/auth/TwoFA.impl.js} +9 -8
  204. package/dist-lib/components/pages/auth/TwoFA.js +12 -0
  205. package/dist-lib/components/pages/auth/icons.js +56 -0
  206. package/dist-lib/components/pages/exportRequest.js +17 -0
  207. package/dist-lib/components/pages/list/DataCell.js +27 -0
  208. package/dist-lib/components/pages/list/DeleteViewDialog.js +22 -0
  209. package/dist-lib/{ListCardsBody-BEoYjSZ2.js → components/pages/list/ListCardRow.js} +47 -72
  210. package/dist-lib/components/pages/list/ListCardsBody.js +31 -0
  211. package/dist-lib/components/pages/list/ListFloatbar.js +130 -0
  212. package/dist-lib/components/pages/list/ListFooter.js +138 -0
  213. package/dist-lib/components/pages/list/ListHeader.js +120 -0
  214. package/dist-lib/components/pages/list/ListNoRows.js +72 -0
  215. package/dist-lib/components/pages/list/ListTable.js +191 -0
  216. package/dist-lib/components/pages/list/ListTableRow.js +37 -0
  217. package/dist-lib/components/pages/list/ListToolbar.js +261 -0
  218. package/dist-lib/components/pages/list/ListUrlBanner.js +45 -0
  219. package/dist-lib/components/pages/list/RowActionsCell.js +49 -0
  220. package/dist-lib/components/pages/list/RowContextMenu.js +55 -0
  221. package/dist-lib/components/pages/list/SaveViewDialog.js +111 -0
  222. package/dist-lib/{SortHeaderMenu-Co5PvhTA.js → components/pages/list/SortHeaderMenu.js} +18 -17
  223. package/dist-lib/{cardProjection-Cxlogzh8.js → components/pages/list/cardProjection.js} +3 -3
  224. package/dist-lib/components/pages/list/column-sizing.js +17 -0
  225. package/dist-lib/components/pages/list/columns.js +168 -0
  226. package/dist-lib/components/pages/list/filter-meta.js +84 -0
  227. package/dist-lib/components/pages/list/page-size.js +11 -0
  228. package/dist-lib/components/pages/list/sortable-header.js +18 -0
  229. package/dist-lib/components/pages/list/table-features.js +11 -0
  230. package/dist-lib/components/pages/list/use-filter-value-labels.js +115 -0
  231. package/dist-lib/components/pages/list/useActiveView.js +98 -0
  232. package/dist-lib/components/pages/list/useHeaderReorder.js +93 -0
  233. package/dist-lib/components/pages/list/useListColumnLayout.js +56 -0
  234. package/dist-lib/components/pages/list/useListFilterPresentation.js +34 -0
  235. package/dist-lib/components/pages/list/useListQuery.js +101 -0
  236. package/dist-lib/components/pages/list/useListRowInteraction.js +120 -0
  237. package/dist-lib/components/pages/list/useListSelection.js +53 -0
  238. package/dist-lib/components/pages/list/useListSort.js +44 -0
  239. package/dist-lib/components/pages/list/useListViews.js +148 -0
  240. package/dist-lib/components/pages/list/useRowMenu.js +106 -0
  241. package/dist-lib/components/pages/list/visible-filters.js +19 -0
  242. package/dist-lib/{Preferences.impl-Ct5xwZtT.js → components/pages/profile/Preferences.impl.js} +34 -31
  243. package/dist-lib/components/pages/profile/Preferences.js +12 -0
  244. package/dist-lib/components/pages/profile/Profile.impl.js +437 -0
  245. package/dist-lib/components/pages/profile/Profile.js +12 -0
  246. package/dist-lib/{TenantParamsPage.impl-BGpdmEZg.js → components/pages/tenant-params/TenantParamsPage.impl.js} +45 -40
  247. package/dist-lib/components/pages/tenant-params/TenantParamsPage.js +12 -0
  248. package/dist-lib/components/params/ParamsBlock.js +119 -0
  249. package/dist-lib/{param-editors-TYYU7HKK.js → components/params/param-editors.js} +32 -28
  250. package/dist-lib/components/primitives/Avatar.js +33 -0
  251. package/dist-lib/components/primitives/BoolToggle.js +35 -0
  252. package/dist-lib/components/primitives/BrandGlyph.js +38 -0
  253. package/dist-lib/components/primitives/BrandLogo.js +20 -0
  254. package/dist-lib/components/primitives/Btn.js +67 -0
  255. package/dist-lib/{Check-DAfMbQIw.js → components/primitives/Check.js} +2 -2
  256. package/dist-lib/components/primitives/Chip.js +44 -0
  257. package/dist-lib/components/primitives/ClassifiedFieldLocked.js +15 -0
  258. package/dist-lib/components/primitives/Dropdown.js +85 -0
  259. package/dist-lib/components/primitives/Fields.js +751 -0
  260. package/dist-lib/components/primitives/HoverCard.js +115 -0
  261. package/dist-lib/components/primitives/IconBtn.js +37 -0
  262. package/dist-lib/{Icons-lt-7lhYR.js → components/primitives/Icons.js} +1 -1
  263. package/dist-lib/{Kbd-CNttVu0z.js → components/primitives/Kbd.js} +2 -2
  264. package/dist-lib/components/primitives/MenuItem.js +57 -0
  265. package/dist-lib/{Pill-D-wsfRhx.js → components/primitives/Pill.js} +1 -1
  266. package/dist-lib/{RecordIdBadge-wbigZaFc.js → components/primitives/RecordIdBadge.js} +5 -5
  267. package/dist-lib/components/primitives/RowField.js +47 -0
  268. package/dist-lib/{SectionCard-BYHoHWJc.js → components/primitives/SectionCard.js} +10 -10
  269. package/dist-lib/components/primitives/Spinner.js +31 -0
  270. package/dist-lib/components/primitives/StatTile.js +108 -0
  271. package/dist-lib/components/primitives/Tooltip.js +115 -0
  272. package/dist-lib/{dataTableStyles-vwD1mVOP.js → components/primitives/dataTableStyles.js} +1 -1
  273. package/dist-lib/components/shared/BlankScreen.js +13 -0
  274. package/dist-lib/{ChangePasswordDialog.impl-5hDc0wpE.js → components/shared/ChangePasswordDialog.impl.js} +27 -22
  275. package/dist-lib/{ChangePasswordDialog-C_T_3pjl.js → components/shared/ChangePasswordDialog.js} +2 -2
  276. package/dist-lib/components/shared/ConfirmDialog.js +129 -0
  277. package/dist-lib/components/shared/ConnectionNotice.js +12 -0
  278. package/dist-lib/components/shared/CopyButton.js +25 -0
  279. package/dist-lib/components/shared/DynamicIcon.js +73 -0
  280. package/dist-lib/components/shared/EmptyState.js +56 -0
  281. package/dist-lib/components/shared/ErrorBoundary.js +96 -0
  282. package/dist-lib/components/shared/LoadingSkeleton.js +117 -0
  283. package/dist-lib/components/shared/LucideIcon.js +43 -0
  284. package/dist-lib/components/shared/Markdown.js +15 -0
  285. package/dist-lib/{MarkdownRenderer-sK2TRZS-.js → components/shared/MarkdownRenderer.js} +10 -9
  286. package/dist-lib/components/shared/RefreshControl.js +42 -0
  287. package/dist-lib/components/shared/StatusGroupsDisplay.js +123 -0
  288. package/dist-lib/components/shared/StatusStepper.js +70 -0
  289. package/dist-lib/components/shared/toast/DeclarionToast.js +308 -0
  290. package/dist-lib/components/shared/useOwnRefresh.js +19 -0
  291. package/dist-lib/declarion-react.css +1 -1
  292. package/dist-lib/embed/EmbedAuthBootstrap.js +71 -0
  293. package/dist-lib/embed/EmbedContext.js +38 -0
  294. package/dist-lib/embed/EmbedDirtyReporter.js +17 -0
  295. package/dist-lib/embed/EmbedHistoryTracker.js +17 -0
  296. package/dist-lib/embed/EmbedLocationReporter.js +26 -0
  297. package/dist-lib/embed/EmbedResizeReporter.js +25 -0
  298. package/dist-lib/embed/EmbedUnsavedGuard.js +23 -0
  299. package/dist-lib/embed/embed-dirty.js +21 -0
  300. package/dist-lib/embed/embed-history.js +17 -0
  301. package/dist-lib/embed/embed-nav-guard.js +13 -0
  302. package/dist-lib/embed/file-src.js +60 -0
  303. package/dist-lib/embed/handshake.js +37 -0
  304. package/dist-lib/embed/params.js +45 -0
  305. package/dist-lib/embed/protocol.js +26 -0
  306. package/dist-lib/embed/screen-location.js +44 -0
  307. package/dist-lib/embed/theme.js +11 -0
  308. package/dist-lib/embed/token.js +54 -0
  309. package/dist-lib/embed/useEmbedNavigate.js +65 -0
  310. package/dist-lib/embed/useGlobalLinkInterceptor.js +63 -0
  311. package/dist-lib/hooks/useActionData.js +58 -0
  312. package/dist-lib/hooks/useAgentConversation.js +311 -0
  313. package/dist-lib/hooks/useAggregate.js +18 -0
  314. package/dist-lib/hooks/useAllEntityData.js +53 -0
  315. package/dist-lib/hooks/useAssociatedData.js +37 -0
  316. package/dist-lib/hooks/useAuth.js +56 -0
  317. package/dist-lib/hooks/useBranding.js +18 -0
  318. package/dist-lib/hooks/useBrandingChrome.js +58 -0
  319. package/dist-lib/hooks/useChildrenData.js +33 -0
  320. package/dist-lib/hooks/useColumns.js +44 -0
  321. package/dist-lib/hooks/useConnectionNotice.js +35 -0
  322. package/dist-lib/{useCurrentLocation-Bq1T72AW.js → hooks/useCurrentLocation.js} +2 -2
  323. package/dist-lib/hooks/useCurrentScreen.js +20 -0
  324. package/dist-lib/hooks/useCursorEntityData.js +77 -0
  325. package/dist-lib/hooks/useDebounce.js +11 -0
  326. package/dist-lib/hooks/useEntity.js +8 -0
  327. package/dist-lib/hooks/useEntityData.js +64 -0
  328. package/dist-lib/hooks/useFileReferenceJSON.js +29 -0
  329. package/dist-lib/hooks/useFilters.js +28 -0
  330. package/dist-lib/hooks/useFollowAgentOpen.js +84 -0
  331. package/dist-lib/hooks/useImpersonation.js +40 -0
  332. package/dist-lib/hooks/useIntentPrefetch.js +43 -0
  333. package/dist-lib/hooks/useJsonSnapshot.js +8 -0
  334. package/dist-lib/hooks/useLanguage.js +21 -0
  335. package/dist-lib/hooks/useLiveObject.js +17 -0
  336. package/dist-lib/hooks/useLongPress.js +49 -0
  337. package/dist-lib/hooks/useMutations.js +70 -0
  338. package/dist-lib/{useObject-B45F96rC.js → hooks/useObject.js} +2 -2
  339. package/dist-lib/hooks/useObjectStatus.js +20 -0
  340. package/dist-lib/hooks/usePageState.js +18 -0
  341. package/dist-lib/hooks/usePageStateRuntime.js +46 -0
  342. package/dist-lib/hooks/usePageStateTtl.js +10 -0
  343. package/dist-lib/hooks/useParams.js +123 -0
  344. package/dist-lib/hooks/useProperties.js +32 -0
  345. package/dist-lib/hooks/useRealtimeThresholds.js +31 -0
  346. package/dist-lib/hooks/useRegisterScreenTab.js +28 -0
  347. package/dist-lib/hooks/useResponsiveMode.js +84 -0
  348. package/dist-lib/hooks/useSSE.js +307 -0
  349. package/dist-lib/hooks/useSchema.js +73 -0
  350. package/dist-lib/hooks/useScreen.js +8 -0
  351. package/dist-lib/hooks/useScreenBack.js +60 -0
  352. package/dist-lib/hooks/useScreenTab.js +11 -0
  353. package/dist-lib/hooks/useTabNavigate.js +82 -0
  354. package/dist-lib/hooks/useTabSearchMirror.js +19 -0
  355. package/dist-lib/{useTabTitle-KrzEo118.js → hooks/useTabTitle.js} +9 -7
  356. package/dist-lib/hooks/useText.js +15 -0
  357. package/dist-lib/hooks/useTimelineData.js +44 -0
  358. package/dist-lib/hooks/useUnsavedInput.js +18 -0
  359. package/dist-lib/hooks/useVersionWatcher.js +62 -0
  360. package/dist-lib/hooks/useViews.js +88 -0
  361. package/dist-lib/hooks/useWindowConversation.js +11 -0
  362. package/dist-lib/icons.js +5 -3
  363. package/dist-lib/index.d.ts +42 -20
  364. package/dist-lib/index.js +131 -3926
  365. package/dist-lib/lib/action-dispatch.js +7 -0
  366. package/dist-lib/lib/actions.js +279 -0
  367. package/dist-lib/lib/anchor.js +41 -0
  368. package/dist-lib/lib/brand-tokens.js +95 -0
  369. package/dist-lib/lib/branding.js +25 -0
  370. package/dist-lib/lib/canonical-url.js +17 -0
  371. package/dist-lib/lib/capabilityPrefetch.js +57 -0
  372. package/dist-lib/lib/child-config.js +111 -0
  373. package/dist-lib/lib/children-validation.js +52 -0
  374. package/dist-lib/lib/decimal-text.js +15 -0
  375. package/dist-lib/lib/display-value.js +19 -0
  376. package/dist-lib/lib/document-templates.js +6 -0
  377. package/dist-lib/lib/download.js +41 -0
  378. package/dist-lib/lib/evidence-verdict.js +23 -0
  379. package/dist-lib/lib/failure.js +9 -0
  380. package/dist-lib/lib/field-classification.js +58 -0
  381. package/dist-lib/lib/field-regions.js +13 -0
  382. package/dist-lib/lib/filter-evaluator.js +98 -0
  383. package/dist-lib/lib/filters.js +118 -0
  384. package/dist-lib/lib/format-count.js +24 -0
  385. package/dist-lib/lib/html-state.js +9 -0
  386. package/dist-lib/lib/language.js +52 -0
  387. package/dist-lib/lib/longPressGesture.js +34 -0
  388. package/dist-lib/lib/mass-edit.js +65 -0
  389. package/dist-lib/{page-inset-D_kkVwwN.js → lib/page-inset.js} +1 -1
  390. package/dist-lib/lib/phone.js +28 -0
  391. package/dist-lib/lib/query-retry.js +7 -0
  392. package/dist-lib/lib/quick-add.js +23 -0
  393. package/dist-lib/lib/realtime-query-keys.js +23 -0
  394. package/dist-lib/lib/realtime-reconcile.js +148 -0
  395. package/dist-lib/lib/realtime-resync.js +192 -0
  396. package/dist-lib/lib/record-documents-key.js +4 -0
  397. package/dist-lib/lib/ref-choices.js +6 -0
  398. package/dist-lib/lib/refetch-when-idle.js +25 -0
  399. package/dist-lib/lib/rich-text.js +46 -0
  400. package/dist-lib/lib/rowClickGesture.js +10 -0
  401. package/dist-lib/lib/safe-url.js +34 -0
  402. package/dist-lib/lib/schema-routing.js +51 -0
  403. package/dist-lib/{screen-back-BtbEp5sO.js → lib/screen-back.js} +2 -2
  404. package/dist-lib/lib/scroll-restoration.js +156 -0
  405. package/dist-lib/lib/size-value.js +22 -0
  406. package/dist-lib/lib/sort.js +59 -0
  407. package/dist-lib/lib/timestamp.js +97 -0
  408. package/dist-lib/lib/toast.js +78 -0
  409. package/dist-lib/lib/ui-actions.js +81 -0
  410. package/dist-lib/{utils-D_QDpB8_.js → lib/utils.js} +1 -1
  411. package/dist-lib/lib/variants.js +63 -0
  412. package/dist-lib/lib/versionTracker.js +102 -0
  413. package/dist-lib/lib/viewport-category.js +12 -0
  414. package/dist-lib/{window-election-CHIvIZwx.js → lib/window-election.js} +1 -1
  415. package/dist-lib/stores/auth.js +84 -0
  416. package/dist-lib/stores/icon-registry.js +24 -0
  417. package/dist-lib/stores/list-layout.js +178 -0
  418. package/dist-lib/{page-state-eA6J_KIR.js → stores/page-state.js} +1 -1
  419. package/dist-lib/stores/preferences.js +126 -0
  420. package/dist-lib/stores/realtime.js +115 -0
  421. package/dist-lib/stores/screen-registry.js +10 -0
  422. package/dist-lib/stores/tabs.js +220 -0
  423. package/dist-lib/test/seed-schema.js +8 -0
  424. package/dist-lib/testing.d.ts +1 -1
  425. package/dist-lib/testing.js +80 -76
  426. package/dist-lib/types/api.js +48 -0
  427. package/dist-lib/types/fieldType.js +4 -0
  428. package/dist-lib/types/ordmap.js +50 -0
  429. package/dist-lib/types/schema.js +173 -0
  430. package/dist-lib/{useResponsiveMode-DIR1bZfo.d.ts → useResponsiveMode-DmrpMbZX.d.ts} +44 -16
  431. package/package.json +13 -12
  432. package/dist-lib/ActionRunner-DdBFhqGe.js +0 -1440
  433. package/dist-lib/AgentOpenFollower.impl-BAs_wGEZ.js +0 -81
  434. package/dist-lib/AssociatedBlock-BOoPLOjw.js +0 -1515
  435. package/dist-lib/AuthShell-C8aVwHS7.js +0 -361
  436. package/dist-lib/BlankScreen-DVc7fh8C.js +0 -61
  437. package/dist-lib/CopyButton-DRIT_f0k.js +0 -119
  438. package/dist-lib/DynamicIcon-DuBSz6TZ.js +0 -133
  439. package/dist-lib/FilterChips-Cv1tlXyo.js +0 -1031
  440. package/dist-lib/LayoutRenderer-d-tXYPze.js +0 -3239
  441. package/dist-lib/MenuItem-CfkVXPvC.js +0 -140
  442. package/dist-lib/MonacoJson-BG3S3GHX.js +0 -60
  443. package/dist-lib/Profile.impl-Cypk27ah.js +0 -527
  444. package/dist-lib/PropertyGridEditor-XrP6TZ5s.js +0 -4378
  445. package/dist-lib/RecordHeader-BfQ0_4wq.js +0 -217
  446. package/dist-lib/RefreshControl-CRdWPoF5.js +0 -195
  447. package/dist-lib/SSOCallbackPage.impl-Cfi2pQ59.js +0 -31
  448. package/dist-lib/SmartDetailPage.impl-BiIX0n7K.js +0 -1609
  449. package/dist-lib/SmartListPage.impl-Cu83Gv_G.js +0 -2818
  450. package/dist-lib/SmartRecordListPage.impl-DR6lq7HA.js +0 -795
  451. package/dist-lib/format-count-lyB4CPen.js +0 -943
  452. package/dist-lib/peekDraftStore-CaimrOhW.js +0 -200
  453. package/dist-lib/registry-CGe5kCXN.js +0 -119
  454. package/dist-lib/use-filter-value-labels-D3YDgUzg.js +0 -413
  455. package/dist-lib/useAgentConversation-rru-7hnF.js +0 -612
  456. package/dist-lib/useBranding-zcxEic2k.js +0 -41
  457. package/dist-lib/useBrandingChrome-bxaR3G1R.js +0 -170
  458. package/dist-lib/useCurrentScreen-BZOHBGQZ.js +0 -2522
  459. package/dist-lib/useImpersonation-DBIRRR70.js +0 -35
  460. package/dist-lib/useOwnRefresh-DJjaje52.js +0 -435
  461. package/dist-lib/useParams-BFLJi4n3.js +0 -133
  462. package/dist-lib/useProperties-B7opZ-iy.js +0 -81
  463. package/dist-lib/useScreenBack-DENlz844.js +0 -71
  464. package/dist-lib/useTabNavigate-CUqOmcMj.js +0 -78
  465. package/dist-lib/value-BuQVYx52.js +0 -194
  466. package/dist-lib/variants-vUtfBbE6.js +0 -1961
  467. /package/dist-lib/{JsonEditor-Dz1PQHC8.js → components/fields/JsonEditor.js} +0 -0
@@ -1,3239 +0,0 @@
1
- import { Cn as e, Dn as t, Pt as n, Q as r, Qt as i, U as a, an as o, c as s, cn as c, ct as l, dn as u, fn as d, gn as f, hn as p, in as m, l as h, o as g, on as _, ot as v, st as y, wn as b, wt as x, xt as S, yt as C } from "./useCurrentScreen-BZOHBGQZ.js";
2
- import { t as w } from "./Icons-lt-7lhYR.js";
3
- import { n as T, r as E } from "./CopyButton-DRIT_f0k.js";
4
- import { t as D } from "./Pill-D-wsfRhx.js";
5
- import { Q as O, f as k, p as A, q as j, tt as M, u as N } from "./PropertyGridEditor-XrP6TZ5s.js";
6
- import { t as P } from "./SectionCard-BYHoHWJc.js";
7
- import { a as F, i as I, r as L, t as ee } from "./registry-CGe5kCXN.js";
8
- import { t as R } from "./DynamicIcon-DuBSz6TZ.js";
9
- import { t as z } from "./utils-D_QDpB8_.js";
10
- import { n as B } from "./useTabNavigate-CUqOmcMj.js";
11
- import { E as V, T as te, v as H } from "./ActionRunner-DdBFhqGe.js";
12
- import { g as ne, i as U, t as re, v as ie } from "./useOwnRefresh-DJjaje52.js";
13
- import { h as ae, m as oe, p as se } from "./variants-vUtfBbE6.js";
14
- import { n as ce, r as le, t as ue } from "./dataTableStyles-vwD1mVOP.js";
15
- import { n as de, t as fe } from "./AssociatedBlock-BOoPLOjw.js";
16
- import { i as pe, n as me, r as he, t as ge } from "./FieldRow-DedGIY9R.js";
17
- import { Suspense as _e, lazy as ve, useCallback as W, useEffect as G, useId as ye, useLayoutEffect as be, useMemo as xe, useRef as K, useState as q } from "react";
18
- import { useInfiniteQuery as Se, useMutation as Ce, useQueryClient as we } from "@tanstack/react-query";
19
- import { Fragment as J, jsx as Y, jsxs as X } from "react/jsx-runtime";
20
- //#region src/lib/size-value.ts
21
- var Te = /^(\d+)px$/;
22
- function Ee(e) {
23
- if (e == null || e === "") return null;
24
- if (e === "auto") return { kind: "auto" };
25
- if (e === "fill") return { kind: "fill" };
26
- let t = Te.exec(e);
27
- if (t) {
28
- let e = parseInt(t[1], 10);
29
- return e > 0 ? {
30
- kind: "px",
31
- value: e
32
- } : null;
33
- }
34
- let n = parseInt(e, 10);
35
- return !isNaN(n) && String(n) === e && n > 0 ? {
36
- kind: "weight",
37
- value: n
38
- } : null;
39
- }
40
- //#endregion
41
- //#region src/components/detail-layout/LayoutRow.tsx
42
- function De({ config: e, ctx: t }) {
43
- let { items: n, gap: r = 0, resizable: i = !1, stack_below: a } = e, o = a === "never" ? 0 : a ?? 768, [s, c] = q(!1), l = K(null);
44
- G(() => {
45
- if (o === 0) return;
46
- let e = l.current;
47
- if (!e) return;
48
- let t = new ResizeObserver((e) => {
49
- for (let t of e) c(t.contentRect.width < o);
50
- });
51
- return t.observe(e), () => t.disconnect();
52
- }, [o]);
53
- let [u, d] = q(null), f = K(null), p = W(() => n.map((t) => {
54
- let n = Ee(t.width ?? t.column?.width ?? t.row?.width ?? e.width);
55
- return n && n.kind === "weight" ? n.value : 1;
56
- }), [n, e.width]), m = W((e, t) => {
57
- t.preventDefault();
58
- let n = u ?? p();
59
- f.current = {
60
- index: e,
61
- startX: t.clientX,
62
- startSizes: [...n]
63
- };
64
- let r = (e) => {
65
- let t = f.current;
66
- if (!t || !l.current) return;
67
- let n = l.current.getBoundingClientRect().width, r = e.clientX - t.startX, i = t.startSizes.reduce((e, t) => e + t, 0), a = r / n * i, o = [...t.startSizes];
68
- o[t.index] = Math.max(.1, t.startSizes[t.index] + a), o[t.index + 1] = Math.max(.1, t.startSizes[t.index + 1] - a), d(o);
69
- }, i = () => {
70
- f.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
71
- };
72
- document.addEventListener("mousemove", r), document.addEventListener("mouseup", i);
73
- }, [u, p]), h = u ?? p(), g = e.height ? ke(e.height) : void 0;
74
- return /* @__PURE__ */ Y("div", {
75
- ref: l,
76
- className: z("flex", s && "flex-col"),
77
- style: {
78
- gap: r ? `${r}px` : void 0,
79
- ...g
80
- },
81
- children: n.map((r, a) => /* @__PURE__ */ X("div", {
82
- className: z("min-w-0 flex items-stretch", s && "w-full"),
83
- style: s ? void 0 : Oe(r.width ?? r.column?.width ?? r.row?.width ?? e.width, h[a], r.min_width, r.max_width),
84
- children: [/* @__PURE__ */ Y("div", {
85
- className: z("flex-1 min-w-0 flex flex-col", g && "overflow-y-auto overflow-x-hidden"),
86
- children: /* @__PURE__ */ Y(fn, {
87
- node: r,
88
- ctx: t
89
- })
90
- }), i && !s && a < n.length - 1 && /* @__PURE__ */ Y("div", {
91
- className: "detail-resize-handle",
92
- onMouseDown: (e) => m(a, e)
93
- })]
94
- }, a))
95
- });
96
- }
97
- function Oe(e, t, n, r) {
98
- let i = Ee(e), a;
99
- return a = !i || i.kind === "weight" ? `${t} 1 0%` : i.kind === "px" ? `0 0 ${i.value}px` : i.kind === "fill" ? "1 1 0%" : "0 0 auto", {
100
- flex: a,
101
- minWidth: n,
102
- maxWidth: r
103
- };
104
- }
105
- function ke(e) {
106
- if (!e) return;
107
- let t = Ee(e);
108
- if (t?.kind === "px") return {
109
- height: `${t.value}px`,
110
- overflow: "hidden"
111
- };
112
- if (typeof e == "string" && (e.includes("vh") || e.includes("calc") || e.includes("%"))) return {
113
- height: e,
114
- overflow: "hidden"
115
- };
116
- }
117
- //#endregion
118
- //#region src/components/detail-layout/LayoutColumn.tsx
119
- function Ae({ config: e, ctx: t }) {
120
- let { items: n, gap: r = 12 } = e;
121
- return /* @__PURE__ */ Y("div", {
122
- className: "flex flex-col h-full",
123
- style: { gap: r ? `${r}px` : void 0 },
124
- children: n.map((e, n) => /* @__PURE__ */ Y(fn, {
125
- node: e,
126
- ctx: t
127
- }, n))
128
- });
129
- }
130
- //#endregion
131
- //#region src/components/detail-layout/blockMeta.ts
132
- function je(e) {
133
- return e.children ?? e.associated;
134
- }
135
- function Me(e, t, n) {
136
- let r = je(e);
137
- if (r) {
138
- if (e.label) return n(e.label);
139
- let i = t.entity.children?.find((e) => e.entity === r);
140
- if (i?.display?.name) return n(i.display.name);
141
- let a = t.schema.entities[r];
142
- return a && (n(a.display.name_plural) || n(a.display.name)) || r;
143
- }
144
- return e.section ? n(e.section.name) : n("record.tabs.fallback", "Tab");
145
- }
146
- function Ne(e, t) {
147
- if (e.icon) return e.icon;
148
- let n = je(e);
149
- if (n) {
150
- let e = t.entity.children?.find((e) => e.entity === n);
151
- if (e?.display?.icon) return e.display.icon;
152
- let r = t.schema.entities[n];
153
- if (r) return r.display.icon;
154
- }
155
- }
156
- //#endregion
157
- //#region src/components/detail-layout/LayoutTabs.tsx
158
- function Pe({ config: e, ctx: t }) {
159
- let n = x(), { items: r } = e, [i, a] = q(0), o = S(), s = t.detailTabsPresentation ?? (o.isPhone ? "sections" : "scroll");
160
- if (r.length === 0) return null;
161
- if (s === "sections") {
162
- let e = r.map((e, t) => `detail-tab-section-${t}`);
163
- return /* @__PURE__ */ X("div", {
164
- style: {
165
- display: "flex",
166
- flexDirection: "column",
167
- gap: 10,
168
- minWidth: 0
169
- },
170
- children: [r.length > 1 && /* @__PURE__ */ Y("nav", {
171
- "aria-label": n("record.tabs.sections", "Detail sections"),
172
- style: {
173
- display: "flex",
174
- gap: 6,
175
- overflowX: "auto",
176
- padding: "0 2px 2px",
177
- WebkitOverflowScrolling: "touch"
178
- },
179
- children: r.map((r, i) => {
180
- let a = Me(r, t, n), o = Ne(r, t);
181
- return /* @__PURE__ */ X("button", {
182
- type: "button",
183
- onClick: () => document.getElementById(e[i])?.scrollIntoView({
184
- block: "start",
185
- behavior: "smooth"
186
- }),
187
- style: {
188
- display: "inline-flex",
189
- alignItems: "center",
190
- gap: 6,
191
- minHeight: 36,
192
- maxWidth: 220,
193
- padding: "7px 10px",
194
- border: "1px solid var(--border)",
195
- borderRadius: 8,
196
- background: "var(--surface)",
197
- color: "var(--text-2)",
198
- fontSize: 12.5,
199
- fontWeight: 600,
200
- whiteSpace: "nowrap",
201
- cursor: "pointer"
202
- },
203
- children: [o && /* @__PURE__ */ Y(R, {
204
- name: o,
205
- size: 13
206
- }), /* @__PURE__ */ Y("span", {
207
- style: {
208
- overflow: "hidden",
209
- textOverflow: "ellipsis"
210
- },
211
- children: a
212
- })]
213
- }, i);
214
- })
215
- }), r.map((r, i) => {
216
- let a = Me(r, t, n), o = Ne(r, t);
217
- return /* @__PURE__ */ X("section", {
218
- id: e[i],
219
- style: {
220
- background: "var(--surface)",
221
- border: "1px solid var(--border)",
222
- borderRadius: 10,
223
- boxShadow: "var(--shadow-xs)",
224
- overflow: "hidden",
225
- minWidth: 0,
226
- scrollMarginTop: 12
227
- },
228
- children: [/* @__PURE__ */ X("div", {
229
- style: {
230
- display: "flex",
231
- alignItems: "center",
232
- gap: 8,
233
- padding: "12px 14px",
234
- borderBottom: "1px solid var(--divider)",
235
- color: "var(--text)",
236
- fontSize: 13,
237
- fontWeight: 700
238
- },
239
- children: [o && /* @__PURE__ */ Y(R, {
240
- name: o,
241
- size: 14
242
- }), /* @__PURE__ */ Y("span", {
243
- style: { overflowWrap: "anywhere" },
244
- children: a
245
- })]
246
- }), /* @__PURE__ */ Y("div", {
247
- style: {
248
- padding: 14,
249
- minWidth: 0
250
- },
251
- children: /* @__PURE__ */ Y(fn, {
252
- node: r,
253
- ctx: {
254
- ...t,
255
- withinCard: !0
256
- }
257
- })
258
- })]
259
- }, i);
260
- })]
261
- });
262
- }
263
- return /* @__PURE__ */ X("div", {
264
- style: {
265
- background: "var(--surface)",
266
- border: "1px solid var(--border)",
267
- borderRadius: 10,
268
- overflow: "hidden",
269
- boxShadow: "var(--shadow-xs)",
270
- flexShrink: 0
271
- },
272
- children: [/* @__PURE__ */ Y("div", {
273
- role: "tablist",
274
- style: {
275
- display: "flex",
276
- alignItems: "stretch",
277
- gap: 4,
278
- borderBottom: "1px solid var(--divider)",
279
- padding: "6px 10px 0 10px",
280
- overflowX: "auto"
281
- },
282
- children: r.map((e, r) => {
283
- let o = Me(e, t, n), s = Ne(e, t), c = r === i;
284
- return /* @__PURE__ */ X("button", {
285
- role: "tab",
286
- "aria-selected": c,
287
- onClick: (e) => {
288
- e.stopPropagation(), a(r);
289
- },
290
- style: {
291
- position: "relative",
292
- display: "inline-flex",
293
- alignItems: "center",
294
- gap: 6,
295
- padding: "8px 12px",
296
- background: "transparent",
297
- border: 0,
298
- cursor: "pointer",
299
- fontSize: 12.5,
300
- fontWeight: 500,
301
- fontFamily: "inherit",
302
- color: c ? "var(--text)" : "var(--text-3)",
303
- whiteSpace: "nowrap",
304
- transition: "color .12s"
305
- },
306
- onMouseEnter: (e) => {
307
- c || (e.currentTarget.style.color = "var(--text-2)");
308
- },
309
- onMouseLeave: (e) => {
310
- c || (e.currentTarget.style.color = "var(--text-3)");
311
- },
312
- children: [
313
- s && /* @__PURE__ */ Y(R, {
314
- name: s,
315
- size: 13
316
- }),
317
- o,
318
- c && /* @__PURE__ */ Y("span", { style: {
319
- position: "absolute",
320
- left: 4,
321
- right: 4,
322
- bottom: -1,
323
- height: 2,
324
- background: "var(--accent)",
325
- borderRadius: 2
326
- } })
327
- ]
328
- }, r);
329
- })
330
- }), /* @__PURE__ */ Y("div", {
331
- role: "tabpanel",
332
- style: { padding: 14 },
333
- children: /* @__PURE__ */ Y(fn, {
334
- node: r[i],
335
- ctx: {
336
- ...t,
337
- withinCard: !0
338
- }
339
- }, i)
340
- })]
341
- });
342
- }
343
- //#endregion
344
- //#region src/components/detail-layout/SectionBlock.tsx
345
- function Fe({ config: e, ctx: t }) {
346
- let n = x(), { name: r, items: i, collapsed: a = !1, columns: o, icon: s, badge: c, emphasis: l } = e, u = e.hide_empty_fields === !0 && t.mode === "display";
347
- if (u && !Ie(i, t)) return null;
348
- let d = {
349
- ...t,
350
- withinCard: !0,
351
- ...o ? { columns: o } : null,
352
- ...u ? { hideEmptyFields: u } : null
353
- }, f = s ? /* @__PURE__ */ Y(R, {
354
- name: s,
355
- size: 14
356
- }) : void 0, p = c ? {
357
- text: n(c.text),
358
- tone: c.tone,
359
- dot: c.dot
360
- } : void 0;
361
- return /* @__PURE__ */ Y(P, {
362
- title: n(r),
363
- defaultOpen: !a,
364
- icon: f,
365
- badge: p,
366
- emphasis: l,
367
- headingLevel: t.withinCard ? 3 : 2,
368
- children: /* @__PURE__ */ Y("div", {
369
- style: {
370
- display: "flex",
371
- flexDirection: "column",
372
- gap: 12
373
- },
374
- children: /* @__PURE__ */ Y(dn, {
375
- nodes: i,
376
- ctx: d
377
- })
378
- })
379
- });
380
- }
381
- function Ie(e, t) {
382
- return e.some((e) => !e.fields || e.fields.some((e) => ae(t.entity, t.record, e.code)));
383
- }
384
- //#endregion
385
- //#region src/lib/child-config.ts
386
- function Le(e, t, n) {
387
- let r = e.display, i = Z(n?.mode, r?.mode, "table"), a = i === "timeline" ? 50 : 20, o = {
388
- entity: e.entity,
389
- foreign_key: e.foreign_key,
390
- name: Z(n?.label, r?.name, ze(t)),
391
- icon: Z(n?.icon, r?.icon, t.display.icon) ?? "",
392
- mode: i,
393
- columns: Z(n?.columns, r?.columns, Ve(t, e.foreign_key)),
394
- sort: Z(n?.sort, r?.sort, Be(t)),
395
- limit: Z(n?.limit, r?.limit, a),
396
- editable: Z(n?.editable, r?.editable, !0),
397
- interaction: Z(n?.interaction, r?.interaction, Re(t))
398
- }, s = Z(n?.position_field, r?.position_field, void 0);
399
- s && (o.position_field = s, o.sort = s + ":asc");
400
- let c = n?.timeline ?? r?.timeline;
401
- o.mode === "timeline" ? o.timeline = He(c ?? {}, t) : c && (o.timeline = c);
402
- let l = n?.cards ?? r?.cards;
403
- l && (o.cards = l);
404
- let u = n?.quick_add ?? e.quick_add;
405
- return u && (o.quick_add = u), o;
406
- }
407
- function Z(e, t, n) {
408
- return e ?? t ?? n;
409
- }
410
- function Re(e) {
411
- return m(e, "update") ? "inline_edit" : "readonly";
412
- }
413
- function ze(e) {
414
- return e.display.name_plural && Object.keys(e.display.name_plural).length > 0 ? e.display.name_plural : e.display.name;
415
- }
416
- function Be(e) {
417
- if (e.fields.get("created_at")?.type === "timestamp") return "created_at:desc";
418
- if (e.fields.get("updated_at")?.type === "timestamp") return "updated_at:desc";
419
- for (let t of e.fields.names()) {
420
- let n = e.fields.get(t);
421
- if (n && n.type === "timestamp") return t + ":desc";
422
- }
423
- for (let t of e.fields.names()) {
424
- let n = e.fields.get(t);
425
- if (n && n.type === "date") return t + ":desc";
426
- }
427
- let t = Je(e);
428
- return t ? t + ":asc" : "";
429
- }
430
- function Ve(e, t) {
431
- let n = new Set(Array.isArray(t) ? t : [t]), r = [];
432
- for (let t of e.fields.names()) {
433
- if (r.length >= 6) break;
434
- let i = e.fields.get(t);
435
- i && (i.primary || i.auto || i.display?.is_listable !== !1 && (n.has(t) || r.push(t)));
436
- }
437
- return r;
438
- }
439
- function He(e, t) {
440
- let n = { ...e };
441
- return n.time_field ||= Ge(t), n.type_field ||= Ke(t, "enum"), n.summary_field ||= qe(t, "string", "text", "rich_text"), n.content_field ||= qe(t, "rich_text", "text"), n.summary_field && n.content_field && n.summary_field === n.content_field && (n.summary_field = void 0), n.author_field || t.fields.get("created_by") && (n.author_field = "created_by"), n.direction_field ||= Ue(t), n.intent_field ||= We(t), n;
442
- }
443
- function Ue(e) {
444
- let t = e.fields.get("direction");
445
- if (t && t.type === "enum") return "direction";
446
- for (let t of [
447
- "is_outbound",
448
- "outbound",
449
- "is_inbound",
450
- "inbound"
451
- ]) {
452
- let n = e.fields.get(t);
453
- if (n && n.type === "bool") return t;
454
- }
455
- }
456
- function We(e) {
457
- let t = e.fields.get("intent");
458
- if (t && t.type === "enum") return "intent";
459
- }
460
- function Ge(e) {
461
- for (let t of e.fields.names()) {
462
- let n = e.fields.get(t);
463
- if (n && n.type === "timestamp" && !n.auto) return t;
464
- }
465
- if (e.fields.get("created_at")?.type === "timestamp") return "created_at";
466
- if (e.fields.get("updated_at")?.type === "timestamp") return "updated_at";
467
- for (let t of e.fields.names()) {
468
- let n = e.fields.get(t);
469
- if (n && n.type === "timestamp") return t;
470
- }
471
- }
472
- function Ke(e, t) {
473
- for (let n of e.fields.names()) {
474
- let r = e.fields.get(n);
475
- if (r && r.type === t) return n;
476
- }
477
- }
478
- function qe(e, ...t) {
479
- for (let n of e.fields.names()) {
480
- let r = e.fields.get(n);
481
- if (r) {
482
- for (let e of t) if (r.type === e) return n;
483
- }
484
- }
485
- }
486
- function Je(e) {
487
- let t = c(e);
488
- return t.length > 0 ? t[0] : void 0;
489
- }
490
- function Ye(e, t) {
491
- return e.children?.find((e) => e.entity === t);
492
- }
493
- //#endregion
494
- //#region src/lib/quick-add.ts
495
- function Xe(e, t, n, r) {
496
- let i = {
497
- ...t ?? {},
498
- ...e
499
- };
500
- if (Array.isArray(n)) {
501
- let e = Array.isArray(r) ? r.map(String) : d(String(r), n.length);
502
- if (!e || e.length !== n.length) throw Error("invalid composite parent id");
503
- for (let t = 0; t < n.length; t++) i[n[t]] = e[t];
504
- } else i[n] = Array.isArray(r) ? r[0] : r;
505
- return i;
506
- }
507
- function Ze(e, t) {
508
- for (let n of t) {
509
- let t = e[n];
510
- if (t == null || t === "") return !1;
511
- }
512
- return !0;
513
- }
514
- //#endregion
515
- //#region src/components/detail-layout/useQuickAdd.ts
516
- function Qe(t, n, r, i) {
517
- let [a, o] = q(() => {
518
- let n = t.quick_add, r = i.entities[t.entity], a = {};
519
- if (n?.fields) for (let t of n.fields) n.defaults?.[t] == null ? r?.fields.get(t)?.type === "timestamp" && (a[t] = e()) : a[t] = n.defaults[t];
520
- return a;
521
- }), s = we(), { mutate: c, isPending: l, error: d, reset: f } = Ce({
522
- mutationFn: (e) => v(t.entity, e),
523
- onMutate: async (e) => {
524
- let i = Array.isArray(r) ? u(r.map(String)) : r, a = [
525
- te,
526
- n,
527
- i,
528
- t.entity
529
- ];
530
- await s.cancelQueries({ queryKey: a });
531
- let o = s.getQueriesData({ queryKey: a }), c = {
532
- ...e,
533
- id: `__optimistic_${crypto.randomUUID()}`,
534
- __optimistic: !0
535
- };
536
- return s.setQueriesData({ queryKey: a }, (e) => {
537
- if (!e || typeof e != "object") return e;
538
- if ("pages" in e && Array.isArray(e.pages) && e.pages.length > 0) {
539
- let t = e, [n, ...r] = t.pages;
540
- return {
541
- ...t,
542
- pages: [{
543
- ...n,
544
- data: [c, ...n.data]
545
- }, ...r]
546
- };
547
- }
548
- return e;
549
- }), { snapshots: o };
550
- },
551
- onError: (e, t, n) => {
552
- if (n?.snapshots) for (let [e, t] of n.snapshots) s.setQueryData(e, t);
553
- },
554
- onSuccess: () => {
555
- let n = t.quick_add, r = i.entities[t.entity], a = {};
556
- if (n?.fields) for (let t of n.fields) a[t] = n?.defaults?.[t] == null ? r?.fields.get(t)?.type === "timestamp" ? e() : "" : n.defaults[t];
557
- o(a);
558
- },
559
- onSettled: () => {
560
- let e = Array.isArray(r) ? u(r.map(String)) : r;
561
- s.invalidateQueries({ queryKey: [
562
- te,
563
- n,
564
- e,
565
- t.entity
566
- ] });
567
- }
568
- }), p = t.quick_add, m = i.entities[t.entity], h = Ze(a, p?.fields.filter((e) => m?.fields.get(e)?.required) ?? []);
569
- function g(e) {
570
- if (e.preventDefault(), !p) return;
571
- let n = Xe(a, p.defaults, t.foreign_key, r);
572
- c(n);
573
- }
574
- function _(e, t) {
575
- d && f(), o((n) => ({
576
- ...n,
577
- [e]: t
578
- }));
579
- }
580
- return {
581
- values: a,
582
- quickAdd: p,
583
- childEntity: m,
584
- isPending: l,
585
- error: d,
586
- isReady: h,
587
- handleSubmit: g,
588
- handleFieldChange: _
589
- };
590
- }
591
- //#endregion
592
- //#region src/components/detail-layout/QuickAddForm.tsx
593
- function $e({ config: e, parentEntity: t, parentId: n, schema: i }) {
594
- let a = x(), o = x("errors"), { values: s, quickAdd: c, childEntity: l, isPending: u, error: d, isReady: f, handleSubmit: p, handleFieldChange: m } = Qe(e, t, n, i), h = S(), g = ye();
595
- return !c || c.fields.length === 0 || !l ? null : /* @__PURE__ */ X("form", {
596
- onSubmit: p,
597
- style: {
598
- display: "flex",
599
- flexDirection: h.isPhone ? "column" : "row",
600
- alignItems: "flex-end",
601
- gap: 8,
602
- padding: "8px 0",
603
- borderBottom: "1px solid var(--divider)"
604
- },
605
- children: [
606
- c.fields.map((t) => {
607
- let n = l.fields.get(t);
608
- if (!n) return null;
609
- let r = `${g}-quick-add-${e.entity}-${t}`, o = `${r}-label`;
610
- return /* @__PURE__ */ X("div", {
611
- style: {
612
- flex: 1,
613
- minWidth: 0,
614
- width: h.isPhone ? "100%" : void 0
615
- },
616
- children: [/* @__PURE__ */ Y("label", {
617
- id: o,
618
- htmlFor: r,
619
- style: {
620
- fontSize: 11,
621
- color: "var(--text-3)",
622
- marginBottom: 4,
623
- display: "block",
624
- fontWeight: 500
625
- },
626
- children: _(a, n, t, i.entities)
627
- }), k({
628
- field: n,
629
- fieldName: t,
630
- value: s[t] ?? "",
631
- mode: "edit",
632
- onChange: (e) => m(t, e),
633
- record: s,
634
- fieldId: r,
635
- labelId: o,
636
- t: a
637
- })]
638
- }, t);
639
- }),
640
- /* @__PURE__ */ Y(E, {
641
- type: "submit",
642
- kind: "primary",
643
- size: h.isPhone ? "md" : "sm",
644
- icon: /* @__PURE__ */ Y(w.plus, { size: 12 }),
645
- disabled: u || !f,
646
- style: h.isPhone ? { alignSelf: "flex-end" } : void 0,
647
- children: a("record.related.add", "Add")
648
- }),
649
- d != null && /* @__PURE__ */ Y("span", {
650
- style: {
651
- fontSize: 11,
652
- color: "var(--danger)",
653
- alignSelf: "flex-end",
654
- marginBottom: 4
655
- },
656
- children: r(o, d)
657
- })
658
- ]
659
- });
660
- }
661
- //#endregion
662
- //#region src/components/detail-layout/useManualColumnResize.tsx
663
- function et(e, t, n) {
664
- return `${e}::child::${t}.${n}`;
665
- }
666
- function tt(e) {
667
- return Math.min(ne, Math.max(60, Math.round(e)));
668
- }
669
- function nt(e) {
670
- let { widths: t, setWidths: n, resetWidths: r } = ie(e), [i, a] = q({}), o = K(null);
671
- G(() => {
672
- let e = (e) => {
673
- let t = o.current;
674
- if (!t) return;
675
- let n = tt(t.startWidth + (e.clientX - t.startX));
676
- t.current = n, a({ [t.colId]: n });
677
- }, t = () => {
678
- let e = o.current;
679
- e && (o.current = null, n({ [e.colId]: e.current }), a({}));
680
- };
681
- return window.addEventListener("mousemove", e), window.addEventListener("mouseup", t), () => {
682
- window.removeEventListener("mousemove", e), window.removeEventListener("mouseup", t);
683
- };
684
- }, [n]);
685
- let s = W((e, n) => {
686
- n.preventDefault(), n.stopPropagation();
687
- let r = n.currentTarget.closest("th")?.getBoundingClientRect().width, i = t[e] ?? (r && r > 0 ? r : 150);
688
- o.current = {
689
- colId: e,
690
- startX: n.clientX,
691
- startWidth: Math.round(i),
692
- current: Math.round(i)
693
- };
694
- }, [t]);
695
- return {
696
- headerStyle: W((e, n) => {
697
- let r = i[e] ?? t[e];
698
- return r == null ? {
699
- ...n,
700
- position: "relative"
701
- } : {
702
- ...n,
703
- position: "relative",
704
- width: r,
705
- minWidth: r,
706
- maxWidth: r
707
- };
708
- }, [i, t]),
709
- cellStyle: W((e, n) => {
710
- let r = i[e] ?? t[e];
711
- return r == null ? n : {
712
- ...n,
713
- width: r,
714
- maxWidth: r,
715
- overflow: "hidden",
716
- textOverflow: "ellipsis",
717
- whiteSpace: "nowrap"
718
- };
719
- }, [i, t]),
720
- onHandleMouseDown: s,
721
- hasWidths: Object.keys(t).length > 0,
722
- resetWidths: r
723
- };
724
- }
725
- function rt({ colId: e, onMouseDown: t }) {
726
- return /* @__PURE__ */ Y("span", {
727
- "data-testid": "col-resize-handle",
728
- "aria-hidden": "true",
729
- onMouseDown: (n) => t(e, n),
730
- onClick: (e) => e.stopPropagation(),
731
- style: {
732
- position: "absolute",
733
- top: 0,
734
- right: 0,
735
- height: "100%",
736
- width: 9,
737
- display: "flex",
738
- justifyContent: "center",
739
- cursor: "col-resize",
740
- userSelect: "none"
741
- },
742
- children: /* @__PURE__ */ Y("span", { style: {
743
- width: 2,
744
- height: "55%",
745
- alignSelf: "center",
746
- background: "var(--border)",
747
- borderRadius: 1
748
- } })
749
- });
750
- }
751
- //#endregion
752
- //#region src/components/detail-layout/ChildrenTable.tsx
753
- function it({ config: e, parentEntity: t, parentId: n, schema: r }) {
754
- let i = x(), a = x("errors"), o = r.entities[e.entity], s = Array.isArray(e.foreign_key) ? e.foreign_key.join(",") : e.foreign_key, c = nt(et(t, e.entity, s)), l = H(o?.realtime, e.entity), { data: u, isLoading: d, isError: p, refetch: m } = V(t, n, e.entity, e.foreign_key, e.sort, e.limit), { refreshing: h, refresh: g } = re(m), v = u?.data ?? [], y = u?.$refs, S = K(y);
755
- S.current = y;
756
- let C = e.columns, E = e.interaction === "navigate", k = C[0], j = E && o ? f(void 0, o, r.screens) : null, M = o ? Je(o) : void 0, N = xe(() => {
757
- let t = /* @__PURE__ */ new Map();
758
- if (!o) return t;
759
- for (let n of C) {
760
- let a = o.fields.get(n);
761
- a && t.set(n, A({
762
- field: a,
763
- fieldName: n,
764
- surface: "list",
765
- entity: o,
766
- entityCode: e.entity,
767
- entities: r.entities,
768
- screens: r.screens,
769
- refs: () => S.current,
770
- t: i
771
- }));
772
- }
773
- return t;
774
- }, [
775
- o,
776
- e.entity,
777
- C,
778
- r.entities,
779
- r.screens,
780
- i
781
- ]);
782
- if (!o) return /* @__PURE__ */ Y("div", {
783
- style: {
784
- fontSize: 12.5,
785
- color: "var(--text-3)",
786
- padding: "8px 0"
787
- },
788
- children: a("record.related_entity_not_found", "The related record type is not declared in this deployment.")
789
- });
790
- let P = /* @__PURE__ */ Y($e, {
791
- config: e,
792
- parentEntity: t,
793
- parentId: n,
794
- schema: r
795
- }), F = l ? i("record.related.live", "Live") : i("record.related.paused", "Updates paused"), I = /* @__PURE__ */ X("div", {
796
- style: {
797
- display: "flex",
798
- alignItems: "center",
799
- gap: 6,
800
- padding: "4px 0",
801
- justifyContent: "flex-end"
802
- },
803
- children: [
804
- c.hasWidths && /* @__PURE__ */ Y(T, {
805
- icon: /* @__PURE__ */ Y(w.columns, { size: 13 }),
806
- title: i("record.related.reset_widths", "Reset column widths (this device)"),
807
- size: 24,
808
- onClick: c.resetWidths
809
- }),
810
- o.realtime === !0 && /* @__PURE__ */ Y("span", {
811
- "data-testid": "children-live-indicator",
812
- role: "status",
813
- "aria-label": F,
814
- title: l ? i("record.related.live_hint", "This table updates automatically in realtime.") : i("record.related.paused_hint", "Realtime updates are paused. Refresh manually to load the latest data."),
815
- children: /* @__PURE__ */ Y(D, {
816
- tone: l ? "emerald" : "amber",
817
- size: "xs",
818
- dot: !0,
819
- children: F
820
- })
821
- }),
822
- /* @__PURE__ */ Y(T, {
823
- icon: h ? /* @__PURE__ */ Y("span", {
824
- "data-testid": "children-refresh-spinner",
825
- style: { display: "inline-flex" },
826
- children: /* @__PURE__ */ Y(O, { size: 13 })
827
- }) : /* @__PURE__ */ Y(w.refresh, { size: 13 }),
828
- title: i("record.related.refresh", "Refresh"),
829
- size: 24,
830
- disabled: h,
831
- onClick: g
832
- })
833
- ]
834
- });
835
- return p ? /* @__PURE__ */ X("div", { children: [
836
- P,
837
- I,
838
- /* @__PURE__ */ X("div", {
839
- style: {
840
- fontSize: 12.5,
841
- color: "var(--danger)",
842
- padding: "8px 0"
843
- },
844
- children: [
845
- a("record.related_rows_unreadable", "The related records could not be loaded."),
846
- " ",
847
- i("record.related.try_again", "Try again.")
848
- ]
849
- })
850
- ] }) : d ? /* @__PURE__ */ X("div", { children: [
851
- P,
852
- I,
853
- /* @__PURE__ */ Y("div", {
854
- style: {
855
- display: "flex",
856
- flexDirection: "column",
857
- gap: 6,
858
- padding: "8px 0"
859
- },
860
- children: [
861
- 0,
862
- 1,
863
- 2
864
- ].map((e) => /* @__PURE__ */ Y("div", { style: {
865
- height: 32,
866
- background: "var(--surface-3)",
867
- borderRadius: 4
868
- } }, e))
869
- })
870
- ] }) : v.length === 0 ? /* @__PURE__ */ X("div", { children: [
871
- P,
872
- I,
873
- /* @__PURE__ */ Y("div", {
874
- style: {
875
- fontSize: 12.5,
876
- color: "var(--text-3)",
877
- padding: "12px 0"
878
- },
879
- children: i("record.related.empty", "No records yet.")
880
- })
881
- ] }) : /* @__PURE__ */ X("div", { children: [
882
- P,
883
- I,
884
- /* @__PURE__ */ Y("div", {
885
- style: { overflowX: "auto" },
886
- children: /* @__PURE__ */ X("table", {
887
- style: le,
888
- children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ Y("tr", { children: C.map((e) => {
889
- let t = o.fields.get(e);
890
- return /* @__PURE__ */ X("th", {
891
- style: c.headerStyle(e, ce),
892
- children: [t ? _(i, t, e, r.entities) : e, /* @__PURE__ */ Y(rt, {
893
- colId: e,
894
- onMouseDown: c.onHandleMouseDown
895
- })]
896
- }, e);
897
- }) }) }), /* @__PURE__ */ Y("tbody", { children: v.map((e, t) => {
898
- let n = M ? b(e[M]) : "", r = E && j && n ? j.replace(/:\w+/, n) : void 0;
899
- return /* @__PURE__ */ Y("tr", { children: C.map((t) => {
900
- let n = t === k, i = N.get(t), a = i ? i(e[t], e) : b(e[t]);
901
- return /* @__PURE__ */ Y("td", {
902
- title: typeof a == "string" ? a : void 0,
903
- style: c.cellStyle(t, ue),
904
- children: n && r ? /* @__PURE__ */ Y("a", {
905
- href: r,
906
- style: {
907
- color: "var(--accent)",
908
- textDecoration: "none",
909
- fontWeight: 500
910
- },
911
- onMouseEnter: (e) => e.currentTarget.style.textDecoration = "underline",
912
- onMouseLeave: (e) => e.currentTarget.style.textDecoration = "none",
913
- children: a
914
- }) : a
915
- }, t);
916
- }) }, b(e.id ?? t));
917
- }) })]
918
- })
919
- })
920
- ] });
921
- }
922
- //#endregion
923
- //#region src/components/detail-layout/ChildrenList.tsx
924
- function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
925
- let a = r.entities[e.entity], o = x(), s = x("errors"), { data: c, isLoading: l, isError: u } = V(t, n, e.entity, e.foreign_key, e.sort, e.limit), d = c?.data ?? [], f = c?.$refs, p = e.columns;
926
- if (!a) return /* @__PURE__ */ Y("div", {
927
- style: {
928
- fontSize: 12.5,
929
- color: "var(--text-3)",
930
- padding: "8px 0"
931
- },
932
- children: s("record.related_entity_not_found", "The related record type is not declared in this deployment.")
933
- });
934
- let m = /* @__PURE__ */ Y($e, {
935
- config: e,
936
- parentEntity: t,
937
- parentId: n,
938
- schema: r
939
- });
940
- if (u) return /* @__PURE__ */ X("div", { children: [m, /* @__PURE__ */ X("div", {
941
- style: {
942
- fontSize: 12.5,
943
- color: "var(--danger)",
944
- padding: "8px 0"
945
- },
946
- children: [
947
- s("record.related_rows_unreadable", "The related records could not be loaded."),
948
- " ",
949
- o("record.related.try_again", "Try again.")
950
- ]
951
- })] });
952
- if (l) return /* @__PURE__ */ X("div", { children: [m, /* @__PURE__ */ X("div", {
953
- style: {
954
- display: "flex",
955
- flexDirection: "column",
956
- gap: 6,
957
- padding: "8px 0"
958
- },
959
- children: [
960
- /* @__PURE__ */ Y("div", { style: {
961
- height: 22,
962
- background: "var(--surface-3)",
963
- borderRadius: 4
964
- } }),
965
- /* @__PURE__ */ Y("div", { style: {
966
- height: 22,
967
- background: "var(--surface-3)",
968
- borderRadius: 4
969
- } }),
970
- /* @__PURE__ */ Y("div", { style: {
971
- height: 22,
972
- background: "var(--surface-3)",
973
- borderRadius: 4,
974
- width: "75%"
975
- } })
976
- ]
977
- })] });
978
- if (d.length === 0) return /* @__PURE__ */ X("div", { children: [m, /* @__PURE__ */ Y("div", {
979
- style: {
980
- fontSize: 12.5,
981
- color: "var(--text-3)",
982
- padding: "12px 0"
983
- },
984
- children: o("record.related.empty", "No records yet.")
985
- })] });
986
- let h = p.length > 0 ? a.display.display_field ?? p[0] : a.display.display_field;
987
- return /* @__PURE__ */ X("div", { children: [m, /* @__PURE__ */ Y("div", {
988
- style: {
989
- display: "flex",
990
- flexDirection: "column"
991
- },
992
- children: d.map((e, t) => {
993
- let n = typeof e.$display == "string" ? e[i] : "";
994
- return /* @__PURE__ */ Y("div", {
995
- style: {
996
- display: "flex",
997
- alignItems: "center",
998
- gap: 12,
999
- padding: "8px 4px",
1000
- borderBottom: "1px solid var(--divider)"
1001
- },
1002
- children: /* @__PURE__ */ X("div", {
1003
- style: {
1004
- flex: 1,
1005
- minWidth: 0
1006
- },
1007
- children: [/* @__PURE__ */ Y("div", {
1008
- style: {
1009
- fontSize: 12.5,
1010
- overflow: "hidden",
1011
- textOverflow: "ellipsis",
1012
- whiteSpace: "nowrap"
1013
- },
1014
- children: n || (h && a.fields.get(h) ? k({
1015
- field: a.fields.get(h),
1016
- fieldName: h,
1017
- value: e[h],
1018
- mode: "display",
1019
- record: e,
1020
- refs: f,
1021
- t: o
1022
- }) : h && e[h] != null ? b(e[h]) : null)
1023
- }), p.length > 1 && (() => {
1024
- let t = p.slice(1, 3).filter((t) => e[t] != null);
1025
- return t.length === 0 ? null : /* @__PURE__ */ Y("div", {
1026
- style: {
1027
- fontSize: 11.5,
1028
- color: "var(--text-3)",
1029
- overflow: "hidden",
1030
- textOverflow: "ellipsis",
1031
- whiteSpace: "nowrap"
1032
- },
1033
- children: t.map((t, n) => /* @__PURE__ */ X("span", { children: [n > 0 && " · ", a.fields.get(t) ? k({
1034
- field: a.fields.get(t),
1035
- fieldName: t,
1036
- value: e[t],
1037
- mode: "display",
1038
- record: e,
1039
- refs: f,
1040
- t: o
1041
- }) : String(e[t])] }, t))
1042
- });
1043
- })()]
1044
- })
1045
- }, b(e.id ?? t));
1046
- })
1047
- })] });
1048
- }
1049
- //#endregion
1050
- //#region src/components/detail-layout/ChildrenCards.tsx
1051
- function ot({ config: e, parentEntity: t, parentId: n, schema: r }) {
1052
- let i = r.entities[e.entity], a = x(), o = x("errors"), { data: s, isLoading: c, isError: l } = V(t, n, e.entity, e.foreign_key, e.sort, e.limit), u = s?.data ?? [], d = s?.$refs, f = e.columns, p = e.cards, m = p?.header_field ?? f[0], h = p?.badge_field, g = p?.columns_count ?? 3;
1053
- if (!i) return /* @__PURE__ */ Y("div", {
1054
- style: {
1055
- fontSize: 12.5,
1056
- color: "var(--text-3)",
1057
- padding: "8px 0"
1058
- },
1059
- children: o("record.related_entity_not_found", "The related record type is not declared in this deployment.")
1060
- });
1061
- let v = {
1062
- display: "grid",
1063
- gridTemplateColumns: `repeat(auto-fill, minmax(${g >= 4 ? 180 : 240}px, 1fr))`,
1064
- gap: 12
1065
- }, y = /* @__PURE__ */ Y($e, {
1066
- config: e,
1067
- parentEntity: t,
1068
- parentId: n,
1069
- schema: r
1070
- });
1071
- if (l) return /* @__PURE__ */ X("div", { children: [y, /* @__PURE__ */ X("div", {
1072
- style: {
1073
- fontSize: 12.5,
1074
- color: "var(--danger)",
1075
- padding: "8px 0"
1076
- },
1077
- children: [
1078
- o("record.related_rows_unreadable", "The related records could not be loaded."),
1079
- " ",
1080
- a("record.related.try_again", "Try again.")
1081
- ]
1082
- })] });
1083
- if (c) return /* @__PURE__ */ X("div", { children: [y, /* @__PURE__ */ Y("div", {
1084
- style: v,
1085
- children: [
1086
- 0,
1087
- 1,
1088
- 2
1089
- ].map((e) => /* @__PURE__ */ Y("div", { style: {
1090
- height: 96,
1091
- background: "var(--surface-3)",
1092
- borderRadius: 10
1093
- } }, e))
1094
- })] });
1095
- if (u.length === 0) return /* @__PURE__ */ X("div", { children: [y, /* @__PURE__ */ Y("div", {
1096
- style: {
1097
- fontSize: 12.5,
1098
- color: "var(--text-3)",
1099
- padding: "12px 0"
1100
- },
1101
- children: a("record.related.empty", "No records yet.")
1102
- })] });
1103
- let S = f.filter((e) => e !== m && e !== h);
1104
- return /* @__PURE__ */ X("div", { children: [y, /* @__PURE__ */ Y("div", {
1105
- style: v,
1106
- children: u.map((e, t) => /* @__PURE__ */ X("div", {
1107
- style: {
1108
- background: "var(--surface)",
1109
- border: "1px solid var(--border)",
1110
- borderRadius: 10,
1111
- overflow: "hidden"
1112
- },
1113
- children: [/* @__PURE__ */ X("div", {
1114
- style: {
1115
- padding: "10px 14px",
1116
- display: "flex",
1117
- alignItems: "center",
1118
- justifyContent: "space-between",
1119
- gap: 8,
1120
- borderBottom: S.length > 0 ? "1px solid var(--divider)" : "none"
1121
- },
1122
- children: [/* @__PURE__ */ Y("div", {
1123
- style: {
1124
- fontSize: 12.5,
1125
- fontWeight: 600,
1126
- overflow: "hidden",
1127
- textOverflow: "ellipsis",
1128
- whiteSpace: "nowrap"
1129
- },
1130
- children: m && i.fields.get(m) ? k({
1131
- field: i.fields.get(m),
1132
- fieldName: m,
1133
- value: e[m],
1134
- mode: "display",
1135
- record: e,
1136
- refs: d,
1137
- t: a
1138
- }) : a("record.related.card_title", "Record {number}", { number: t + 1 })
1139
- }), h && e[h] != null && /* @__PURE__ */ Y(D, {
1140
- tone: "slate",
1141
- size: "xs",
1142
- children: i.fields.get(h) ? k({
1143
- field: i.fields.get(h),
1144
- fieldName: h,
1145
- value: e[h],
1146
- mode: "display",
1147
- record: e,
1148
- refs: d,
1149
- t: a
1150
- }) : b(e[h])
1151
- })]
1152
- }), S.length > 0 && /* @__PURE__ */ Y("div", {
1153
- style: {
1154
- padding: "10px 14px",
1155
- display: "flex",
1156
- flexDirection: "column",
1157
- gap: 4
1158
- },
1159
- children: S.slice(0, 4).map((t) => {
1160
- let n = i.fields.get(t);
1161
- return n ? /* @__PURE__ */ X("div", {
1162
- style: {
1163
- display: "flex",
1164
- alignItems: "baseline",
1165
- gap: 8,
1166
- fontSize: 11.5
1167
- },
1168
- children: [/* @__PURE__ */ X("span", {
1169
- style: {
1170
- color: "var(--text-3)",
1171
- flexShrink: 0
1172
- },
1173
- children: [_(a, n, t, r.entities), ":"]
1174
- }), /* @__PURE__ */ Y("span", {
1175
- style: {
1176
- overflow: "hidden",
1177
- textOverflow: "ellipsis",
1178
- whiteSpace: "nowrap"
1179
- },
1180
- children: k({
1181
- field: n,
1182
- fieldName: t,
1183
- value: e[t],
1184
- mode: "display",
1185
- record: e,
1186
- refs: d,
1187
- t: a
1188
- })
1189
- })]
1190
- }, t) : null;
1191
- })
1192
- })]
1193
- }, b(e.id ?? t)))
1194
- })] });
1195
- }
1196
- //#endregion
1197
- //#region src/hooks/useTimelineData.ts
1198
- var st = 50;
1199
- function ct(e, n, r, i, a, o) {
1200
- let s = Array.isArray(i) ? i : [i], c = Array.isArray(i) ? d(n, s.length) : [n], l = o ?? st, u = Se({
1201
- queryKey: [
1202
- te,
1203
- e,
1204
- n,
1205
- r,
1206
- "timeline",
1207
- a,
1208
- l
1209
- ],
1210
- queryFn: ({ pageParam: e }) => {
1211
- let n = new URLSearchParams();
1212
- if (!c) throw Error("invalid composite parent id");
1213
- let i = s.map((e, t) => ({
1214
- field: e,
1215
- op: "eq",
1216
- value: c[t]
1217
- }));
1218
- return n.set("filters", JSON.stringify(i)), a ? n.set("sort", `${a}:desc`) : typeof console < "u" && console.warn(`[useTimelineData] no time_field for ${r}; fetch order falls back to API default`), n.set("limit", String(l)), e && n.set("after", e), t(`/api/data/${r}?${n.toString()}`);
1219
- },
1220
- getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
1221
- initialPageParam: void 0,
1222
- enabled: !!e && !!n && !!r && !!i && c !== null
1223
- });
1224
- return {
1225
- rows: xe(() => u.data?.pages.flatMap((e) => e.data) ?? [], [u.data?.pages]),
1226
- refs: u.data?.pages[0]?.$refs,
1227
- fetchNextPage: u.fetchNextPage,
1228
- hasOlder: !!u.hasNextPage,
1229
- isFetchingOlder: u.isFetchingNextPage,
1230
- isLoading: u.isLoading,
1231
- isError: u.isError
1232
- };
1233
- }
1234
- //#endregion
1235
- //#region src/components/detail-layout/TimelineComposer.tsx
1236
- var lt = "quick_entry", ut = 100, dt = 240, ft = 800, pt = 80;
1237
- function mt({ config: e, parentEntity: t, parentId: i, schema: a }) {
1238
- let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Qe(e, t, i, a), m = x(), h = x("errors"), [g, _] = q(dt), v = K(null), y = K(null), [b, S] = q(ft);
1239
- G(() => {
1240
- let e = y.current?.parentElement;
1241
- if (!e) return;
1242
- let t = () => {
1243
- let t = Math.max(ut, e.clientHeight - pt);
1244
- S(Math.min(ft, t));
1245
- };
1246
- t();
1247
- let n = new ResizeObserver(t);
1248
- return n.observe(e), () => n.disconnect();
1249
- }, []), G(() => {
1250
- _((e) => Math.min(e, b));
1251
- }, [b]);
1252
- let C = K(o);
1253
- C.current = o;
1254
- let T = K(p);
1255
- T.current = p;
1256
- let D = K({}), O = xe(() => ({
1257
- getField: (e) => C.current[e],
1258
- setField: (e, t) => {
1259
- T.current(e, t);
1260
- },
1261
- focusField: (e) => {
1262
- let t = D.current[e];
1263
- t && (t.querySelector("textarea, input, select, [contenteditable]") ?? t).focus();
1264
- }
1265
- }), []);
1266
- G(() => N(lt, O), [O]);
1267
- let A = W((e) => {
1268
- e.preventDefault(), v.current = {
1269
- startY: e.clientY,
1270
- startHeight: g
1271
- };
1272
- let t = (e) => {
1273
- if (!v.current) return;
1274
- let t = v.current.startY - e.clientY, n = Math.min(b, Math.max(ut, v.current.startHeight + t));
1275
- _(n);
1276
- }, n = () => {
1277
- v.current = null, document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
1278
- };
1279
- document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
1280
- }, [g, b]);
1281
- if (!s || s.fields.length === 0 || !c) return null;
1282
- let j = s.fields.find((e) => {
1283
- let t = c.fields.get(e);
1284
- return t && (t.type === "text" || t.type === "string");
1285
- }), M = [], P = [];
1286
- for (let e of s.fields) {
1287
- if (e === j) continue;
1288
- let t = c.fields.get(e);
1289
- t && (t.type === "enum" ? M.push(e) : P.push(e));
1290
- }
1291
- let F = (e) => {
1292
- let t = c.fields.get(e);
1293
- return t ? /* @__PURE__ */ Y("div", {
1294
- ref: (t) => {
1295
- D.current[e] = t;
1296
- },
1297
- children: k({
1298
- field: t,
1299
- fieldName: e,
1300
- value: o[e] ?? "",
1301
- mode: "edit",
1302
- onChange: (t) => p(e, t),
1303
- record: o,
1304
- t: m
1305
- })
1306
- }, e) : null;
1307
- };
1308
- return /* @__PURE__ */ X("div", {
1309
- ref: y,
1310
- style: {
1311
- flexShrink: 0,
1312
- borderTop: "1px solid var(--divider)",
1313
- background: "var(--surface)",
1314
- display: "flex",
1315
- flexDirection: "column",
1316
- height: `${g}px`
1317
- },
1318
- children: [/* @__PURE__ */ Y("div", {
1319
- onMouseDown: A,
1320
- title: m("record.layout.drag_to_resize", "Drag to resize"),
1321
- style: {
1322
- height: 12,
1323
- cursor: "row-resize",
1324
- display: "flex",
1325
- alignItems: "center",
1326
- justifyContent: "center",
1327
- flexShrink: 0
1328
- },
1329
- children: /* @__PURE__ */ Y("div", { style: {
1330
- width: 56,
1331
- height: 3,
1332
- borderRadius: 999,
1333
- background: "var(--border)"
1334
- } })
1335
- }), /* @__PURE__ */ X("form", {
1336
- onSubmit: f,
1337
- onKeyDown: (e) => {
1338
- (e.metaKey || e.ctrlKey) && e.key === "Enter" && (e.preventDefault(), e.currentTarget.requestSubmit());
1339
- },
1340
- style: {
1341
- flex: 1,
1342
- minHeight: 0,
1343
- display: "flex",
1344
- flexDirection: "column",
1345
- gap: 6,
1346
- padding: "0 12px 8px"
1347
- },
1348
- children: [
1349
- M.length > 0 && /* @__PURE__ */ Y("div", {
1350
- style: {
1351
- display: "flex",
1352
- flexWrap: "wrap",
1353
- alignItems: "center",
1354
- gap: 6,
1355
- flexShrink: 0
1356
- },
1357
- children: M.map(F)
1358
- }),
1359
- j && c.fields.get(j) && /* @__PURE__ */ Y("div", {
1360
- style: {
1361
- flex: 1,
1362
- minHeight: 0,
1363
- display: "flex"
1364
- },
1365
- ref: (e) => {
1366
- D.current[j] = e;
1367
- },
1368
- children: k({
1369
- field: c.fields.get(j),
1370
- fieldName: j,
1371
- value: o[j] ?? "",
1372
- mode: "edit",
1373
- onChange: (e) => p(j, e),
1374
- record: o,
1375
- fill: !0,
1376
- t: m
1377
- })
1378
- }),
1379
- /* @__PURE__ */ X("div", {
1380
- style: {
1381
- display: "flex",
1382
- flexWrap: "wrap",
1383
- alignItems: "center",
1384
- gap: 6,
1385
- flexShrink: 0
1386
- },
1387
- children: [P.map(F), /* @__PURE__ */ X("div", {
1388
- style: {
1389
- marginLeft: "auto",
1390
- display: "flex",
1391
- alignItems: "center",
1392
- gap: 8
1393
- },
1394
- children: [/* @__PURE__ */ Y("span", {
1395
- style: {
1396
- fontSize: 10.5,
1397
- color: "var(--text-4)"
1398
- },
1399
- children: n(m("record.related.shortcut_to_add", "{keys} to add"), { keys: /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y("span", {
1400
- className: "mono",
1401
- children: "⌘"
1402
- }), /* @__PURE__ */ Y("span", {
1403
- className: "mono",
1404
- children: "↵"
1405
- })] }) })
1406
- }), /* @__PURE__ */ Y(E, {
1407
- type: "submit",
1408
- kind: "primary",
1409
- icon: /* @__PURE__ */ Y(w.plus, { size: 13 }),
1410
- disabled: l || !d,
1411
- children: m("record.related.add", "Add")
1412
- })]
1413
- })]
1414
- }),
1415
- u != null && /* @__PURE__ */ Y("p", {
1416
- style: {
1417
- fontSize: 11,
1418
- color: "var(--danger)",
1419
- margin: 0,
1420
- flexShrink: 0
1421
- },
1422
- children: r(h, u)
1423
- })
1424
- ]
1425
- })]
1426
- });
1427
- }
1428
- //#endregion
1429
- //#region src/components/detail-layout/ChildrenTimeline.tsx
1430
- var ht = 80, gt = 200, _t = 6, vt = 2e4, yt = 280;
1431
- function bt(e) {
1432
- if (e.length > yt) return !0;
1433
- let t = 0;
1434
- for (let n of e) if (n === "\n" && ++t >= _t) return !0;
1435
- return !1;
1436
- }
1437
- function xt(e, t) {
1438
- if (St(t)) {
1439
- let e = t.id;
1440
- return e == null ? "" : b(e);
1441
- }
1442
- return l(o(e, t));
1443
- }
1444
- function St(e) {
1445
- return e.__optimistic === !0;
1446
- }
1447
- function Ct({ config: e, parentEntity: t, parentId: n, schema: r }) {
1448
- let i = x(), a = x("errors"), o = r.entities[e.entity], { rows: s, refs: c, fetchNextPage: l, hasOlder: u, isFetchingOlder: d, isLoading: f, isError: p } = ct(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), m = e.timeline, h = m?.scroll ?? !1, g = (e.sort ?? "").endsWith(":asc"), _ = xe(() => g ? [...s].reverse() : s, [s, g]), v = m?.auto_scroll ?? "none", y = K(null), b = K(null), S = K(!1), C = K(0), w = K(null), T = K(null), D = K(!0), k = K(null);
1449
- G(() => {
1450
- S.current = !1, C.current = 0, w.current = null, T.current = null, D.current = !0, k.current = null;
1451
- }, [n]), be(() => {
1452
- d && y.current && (k.current = {
1453
- scrollHeight: y.current.scrollHeight,
1454
- scrollTop: y.current.scrollTop
1455
- });
1456
- }, [d]), be(() => {
1457
- let e = y.current;
1458
- if (!e || _.length === 0 || !o) {
1459
- C.current = _.length;
1460
- return;
1461
- }
1462
- let t = xt(o, _[0]), n = xt(o, _[_.length - 1]), r = !S.current, i = _.length > C.current && C.current > 0, a = i && (g && t !== w.current && n === T.current || !g && n !== T.current && t === w.current), s = i && !a;
1463
- if (r) g && v === "bottom" && (e.scrollTop = e.scrollHeight), S.current = !0;
1464
- else if (a && k.current) {
1465
- let t = k.current;
1466
- g && (e.scrollTop = t.scrollTop + (e.scrollHeight - t.scrollHeight)), k.current = null;
1467
- } else s && g && D.current && (e.scrollTop = e.scrollHeight);
1468
- C.current = _.length, w.current = t, T.current = n;
1469
- }, [
1470
- _,
1471
- v,
1472
- g,
1473
- o
1474
- ]);
1475
- let A = W(() => {
1476
- let e = y.current;
1477
- e && (D.current = e.scrollHeight - e.scrollTop - e.clientHeight < ht);
1478
- }, []);
1479
- G(() => {
1480
- let e = b.current;
1481
- if (!e || typeof IntersectionObserver > "u") return;
1482
- let t = new IntersectionObserver((e) => {
1483
- for (let t of e) t.isIntersecting && u && !d && l();
1484
- }, {
1485
- root: y.current ?? null,
1486
- rootMargin: `${gt}px 0px 0px 0px`,
1487
- threshold: 0
1488
- });
1489
- return t.observe(e), () => t.disconnect();
1490
- }, [
1491
- u,
1492
- d,
1493
- l
1494
- ]);
1495
- let [j, M] = q(null);
1496
- if (!o) return /* @__PURE__ */ Y("div", {
1497
- style: {
1498
- fontSize: 12.5,
1499
- color: "var(--text-3)",
1500
- padding: "8px 0"
1501
- },
1502
- children: a("record.related_entity_not_found", "The related record type is not declared in this deployment.")
1503
- });
1504
- let N = e.quick_add?.fields ?? [m?.content_field].filter(Boolean), P = i(o.display?.name_plural) || i(o.display?.name) || e.entity, F = u ? /* @__PURE__ */ Y("div", {
1505
- style: {
1506
- display: "flex",
1507
- justifyContent: "center",
1508
- padding: "6px 0"
1509
- },
1510
- children: /* @__PURE__ */ Y(E, {
1511
- size: "xs",
1512
- onClick: () => l(),
1513
- disabled: d,
1514
- icon: d ? /* @__PURE__ */ Y(O, { size: 11 }) : void 0,
1515
- children: d ? i("record.loading", "Loading…") : i("record.timeline.load_older", "Load older")
1516
- })
1517
- }) : null, I = /* @__PURE__ */ Y("div", {
1518
- ref: b,
1519
- "aria-hidden": "true",
1520
- style: { height: 1 }
1521
- }), L;
1522
- if (p) L = /* @__PURE__ */ Y("div", {
1523
- style: {
1524
- fontSize: 12.5,
1525
- color: "var(--danger)",
1526
- padding: 12
1527
- },
1528
- children: a("record.related_rows_unreadable", "The related records could not be loaded.")
1529
- });
1530
- else if (f) L = /* @__PURE__ */ X("div", {
1531
- style: {
1532
- display: "flex",
1533
- flexDirection: "column",
1534
- gap: 8,
1535
- padding: 12
1536
- },
1537
- children: [/* @__PURE__ */ Y("div", { style: {
1538
- height: 64,
1539
- background: "var(--surface-3)",
1540
- borderRadius: 8
1541
- } }), /* @__PURE__ */ Y("div", { style: {
1542
- height: 64,
1543
- background: "var(--surface-3)",
1544
- borderRadius: 8
1545
- } })]
1546
- });
1547
- else if (_.length === 0) L = /* @__PURE__ */ X(J, { children: [I, /* @__PURE__ */ Y("div", {
1548
- style: {
1549
- fontSize: 12.5,
1550
- color: "var(--text-3)",
1551
- padding: 12
1552
- },
1553
- children: i("record.timeline.empty", "No activity yet.")
1554
- })] });
1555
- else {
1556
- let a = (i, a) => {
1557
- let s = xt(o, i) || String(a);
1558
- return /* @__PURE__ */ Y(wt, {
1559
- row: i,
1560
- rowId: s,
1561
- childEntity: o,
1562
- entityCode: e.entity,
1563
- parentEntity: t,
1564
- parentId: n,
1565
- timeline: m,
1566
- editableFields: N,
1567
- refs: c,
1568
- isEditing: j === s,
1569
- onStartEdit: () => M(s),
1570
- onCancelEdit: () => M(null),
1571
- onSaved: () => M(null),
1572
- schema: r,
1573
- optimistic: St(i)
1574
- }, s);
1575
- }, s = m?.time_field, l;
1576
- if (s) {
1577
- let e = [];
1578
- _.forEach((t, n) => {
1579
- let r = t[s], a = Et(r), o = e[e.length - 1];
1580
- !o || o.key !== a ? e.push({
1581
- key: a,
1582
- label: Dt(i, r),
1583
- rows: [{
1584
- row: t,
1585
- idx: n
1586
- }]
1587
- }) : o.rows.push({
1588
- row: t,
1589
- idx: n
1590
- });
1591
- }), l = e.map((e) => /* @__PURE__ */ X("div", {
1592
- style: {
1593
- display: "flex",
1594
- flexDirection: "column",
1595
- gap: 8
1596
- },
1597
- children: [/* @__PURE__ */ Y(Ot, {
1598
- label: e.label,
1599
- count: e.rows.length
1600
- }), e.rows.map(({ row: e, idx: t }) => a(e, t))]
1601
- }, `day-${e.key}`));
1602
- } else l = _.map((e, t) => a(e, t));
1603
- L = /* @__PURE__ */ X(J, { children: [
1604
- I,
1605
- F,
1606
- l
1607
- ] });
1608
- }
1609
- return h ? /* @__PURE__ */ X("div", {
1610
- style: {
1611
- display: "flex",
1612
- flexDirection: "column",
1613
- height: "100%",
1614
- borderLeft: "1px solid var(--border)",
1615
- background: "var(--surface-2)",
1616
- color: "var(--text)"
1617
- },
1618
- children: [
1619
- /* @__PURE__ */ Y("div", {
1620
- style: {
1621
- padding: "10px 16px",
1622
- borderBottom: "1px solid var(--divider)",
1623
- background: "var(--surface)"
1624
- },
1625
- children: /* @__PURE__ */ Y("h3", {
1626
- style: {
1627
- margin: 0,
1628
- fontSize: 12.5,
1629
- fontWeight: 600
1630
- },
1631
- children: P
1632
- })
1633
- }),
1634
- /* @__PURE__ */ Y("div", {
1635
- ref: y,
1636
- onScroll: A,
1637
- style: {
1638
- flex: 1,
1639
- overflowY: "auto",
1640
- padding: 12,
1641
- display: "flex",
1642
- flexDirection: "column",
1643
- gap: 8
1644
- },
1645
- children: L
1646
- }),
1647
- /* @__PURE__ */ Y(mt, {
1648
- config: e,
1649
- parentEntity: t,
1650
- parentId: n,
1651
- schema: r
1652
- })
1653
- ]
1654
- }) : /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("div", {
1655
- style: {
1656
- display: "flex",
1657
- flexDirection: "column",
1658
- gap: 8
1659
- },
1660
- children: L
1661
- }), /* @__PURE__ */ Y(mt, {
1662
- config: e,
1663
- parentEntity: t,
1664
- parentId: n,
1665
- schema: r
1666
- })] });
1667
- }
1668
- function wt({ row: e, rowId: t, childEntity: i, entityCode: o, parentEntity: s, parentId: c, timeline: l, editableFields: u, refs: d, isEditing: f, onStartEdit: p, onCancelEdit: m, onSaved: h, schema: g, optimistic: v = !1 }) {
1669
- let S = x(), A = x("errors"), j = we(), [M, N] = q({}), P = W(() => {
1670
- j.invalidateQueries({ queryKey: [
1671
- te,
1672
- s,
1673
- c,
1674
- o
1675
- ] });
1676
- }, [
1677
- j,
1678
- s,
1679
- c,
1680
- o
1681
- ]), F = Ce({
1682
- mutationFn: (n) => {
1683
- let r = e.$row_version, i = typeof r == "string" && r !== "" ? {
1684
- ...n,
1685
- $row_version: r
1686
- } : n;
1687
- return C(o, t, i);
1688
- },
1689
- onSuccess: () => {
1690
- P(), a.success(S("record.timeline.updated", "Updated")), h();
1691
- },
1692
- onError: (e) => a.error(r(A, e))
1693
- }), I = Ce({
1694
- mutationFn: () => y(o, t),
1695
- onSuccess: () => {
1696
- P(), a.success(S("record.timeline.deleted", "Deleted"));
1697
- },
1698
- onError: (e) => a.error(r(A, e))
1699
- }), L = W(() => {
1700
- let t = {};
1701
- for (let n of u) t[n] = e[n] ?? "";
1702
- N(t), p();
1703
- }, [
1704
- e,
1705
- u,
1706
- p
1707
- ]), ee = W((e, t) => {
1708
- N((n) => ({
1709
- ...n,
1710
- [e]: t
1711
- }));
1712
- }, []), R = l?.time_field, z = l?.type_field, B = l?.summary_field, V = l?.content_field, H = l?.author_field, ne = l?.direction_field, U = l?.intent_field;
1713
- return f ? /* @__PURE__ */ X("div", {
1714
- style: {
1715
- borderRadius: 10,
1716
- border: "1px solid var(--accent)",
1717
- background: "var(--surface)",
1718
- padding: 12,
1719
- display: "flex",
1720
- flexDirection: "column",
1721
- gap: 8
1722
- },
1723
- children: [u.map((e) => {
1724
- let t = i.fields.get(e);
1725
- return t ? /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("label", {
1726
- style: {
1727
- fontSize: 11,
1728
- color: "var(--text-3)",
1729
- marginBottom: 4,
1730
- display: "block"
1731
- },
1732
- children: _(S, t, e, g.entities)
1733
- }), k({
1734
- field: t,
1735
- fieldName: e,
1736
- value: M[e] ?? "",
1737
- mode: "edit",
1738
- onChange: (t) => ee(e, t),
1739
- record: M,
1740
- t: S
1741
- })] }, e) : null;
1742
- }), /* @__PURE__ */ X("div", {
1743
- style: {
1744
- display: "flex",
1745
- alignItems: "center",
1746
- gap: 6,
1747
- paddingTop: 4
1748
- },
1749
- children: [/* @__PURE__ */ Y(E, {
1750
- kind: "primary",
1751
- size: "xs",
1752
- icon: F.isPending ? /* @__PURE__ */ Y(O, { size: 12 }) : /* @__PURE__ */ Y(w.check, { size: 12 }),
1753
- onClick: () => F.mutate(M),
1754
- disabled: F.isPending,
1755
- children: F.isPending ? S("dialog.saving", "Saving…") : S("dialog.save", "Save")
1756
- }), /* @__PURE__ */ Y(E, {
1757
- size: "xs",
1758
- icon: /* @__PURE__ */ Y(w.x, { size: 12 }),
1759
- onClick: () => {
1760
- N({}), m();
1761
- },
1762
- disabled: F.isPending,
1763
- children: S("dialog.cancel", "Cancel")
1764
- })]
1765
- })]
1766
- }) : /* @__PURE__ */ X("div", {
1767
- className: "group",
1768
- "data-optimistic": v || void 0,
1769
- style: {
1770
- borderRadius: 10,
1771
- border: "1px solid var(--border)",
1772
- background: "var(--surface)",
1773
- padding: 12,
1774
- transition: "border-color .12s",
1775
- opacity: v ? .6 : 1
1776
- },
1777
- onMouseEnter: (e) => e.currentTarget.style.borderColor = "var(--border-strong)",
1778
- onMouseLeave: (e) => e.currentTarget.style.borderColor = "var(--border)",
1779
- children: [
1780
- /* @__PURE__ */ X("div", {
1781
- style: {
1782
- display: "flex",
1783
- alignItems: "center",
1784
- gap: 6,
1785
- flexWrap: "wrap",
1786
- fontSize: 11.5,
1787
- color: "var(--text-3)"
1788
- },
1789
- children: [
1790
- R && e[R] != null && i.fields.get(R) && /* @__PURE__ */ Y("span", {
1791
- style: { fontWeight: 500 },
1792
- children: k({
1793
- field: i.fields.get(R),
1794
- fieldName: R,
1795
- value: e[R],
1796
- mode: "display",
1797
- record: e,
1798
- refs: d,
1799
- t: S
1800
- })
1801
- }),
1802
- z && e[z] != null && i.fields.get(z) && /* @__PURE__ */ Y(D, {
1803
- tone: "slate",
1804
- size: "xs",
1805
- children: k({
1806
- field: i.fields.get(z),
1807
- fieldName: z,
1808
- value: e[z],
1809
- mode: "display",
1810
- record: e,
1811
- refs: d,
1812
- t: S
1813
- })
1814
- }),
1815
- ne && e[ne] != null && i.fields.get(ne) && /* @__PURE__ */ Y(kt, {
1816
- value: e[ne],
1817
- field: i.fields.get(ne)
1818
- }),
1819
- U && e[U] != null && i.fields.get(U) && /* @__PURE__ */ Y(D, {
1820
- tone: "slate",
1821
- size: "xs",
1822
- children: k({
1823
- field: i.fields.get(U),
1824
- fieldName: U,
1825
- value: e[U],
1826
- mode: "display",
1827
- record: e,
1828
- refs: d,
1829
- t: S
1830
- })
1831
- }),
1832
- H && e[H] != null && i.fields.get(H) && /* @__PURE__ */ Y("span", { children: n(S("record.timeline.by_author", "by {author}"), { author: k({
1833
- field: i.fields.get(H),
1834
- fieldName: H,
1835
- value: e[H],
1836
- mode: "display",
1837
- record: e,
1838
- refs: d,
1839
- t: S
1840
- }) }) }),
1841
- !v && /* @__PURE__ */ X("div", {
1842
- style: {
1843
- marginLeft: "auto",
1844
- display: "flex",
1845
- alignItems: "center",
1846
- gap: 2
1847
- },
1848
- children: [/* @__PURE__ */ Y(T, {
1849
- size: 22,
1850
- icon: /* @__PURE__ */ Y(w.edit, { size: 11 }),
1851
- onClick: L,
1852
- title: S("record.action.edit", "Edit")
1853
- }), /* @__PURE__ */ Y(T, {
1854
- size: 22,
1855
- icon: /* @__PURE__ */ Y(w.trash, { size: 11 }),
1856
- onClick: () => I.mutate(),
1857
- title: S("record.action.delete", "Delete")
1858
- })]
1859
- })
1860
- ]
1861
- }),
1862
- B && e[B] != null && i.fields.get(B) && /* @__PURE__ */ Y("div", {
1863
- style: {
1864
- fontSize: 12.5,
1865
- fontWeight: 500,
1866
- marginTop: 6
1867
- },
1868
- children: k({
1869
- field: i.fields.get(B),
1870
- fieldName: B,
1871
- value: e[B],
1872
- mode: "display",
1873
- record: e,
1874
- refs: d,
1875
- t: S
1876
- })
1877
- }),
1878
- V && e[V] != null && V !== B && i.fields.get(V) && /* @__PURE__ */ Y(Tt, {
1879
- rendered: k({
1880
- field: i.fields.get(V),
1881
- fieldName: V,
1882
- value: e[V],
1883
- mode: "display",
1884
- record: e,
1885
- refs: d,
1886
- t: S
1887
- }),
1888
- text: b(e[V])
1889
- })
1890
- ]
1891
- });
1892
- }
1893
- function Tt({ rendered: e, text: t }) {
1894
- let n = x(), r = {
1895
- fontSize: 12.5,
1896
- fontWeight: 400,
1897
- marginTop: 6
1898
- };
1899
- if (!bt(t)) return /* @__PURE__ */ Y("div", {
1900
- style: r,
1901
- children: e
1902
- });
1903
- let i = t.length > vt, a = i ? t.slice(0, vt) : t;
1904
- return /* @__PURE__ */ Y("div", {
1905
- style: {
1906
- ...r,
1907
- display: "-webkit-box",
1908
- WebkitBoxOrient: "vertical",
1909
- WebkitLineClamp: _t,
1910
- overflow: "hidden",
1911
- whiteSpace: "pre-wrap",
1912
- overflowWrap: "anywhere"
1913
- },
1914
- children: /* @__PURE__ */ Y(M, {
1915
- width: 380,
1916
- content: /* @__PURE__ */ X("div", {
1917
- style: {
1918
- fontSize: 12.5,
1919
- whiteSpace: "pre-wrap",
1920
- overflowWrap: "anywhere"
1921
- },
1922
- children: [a, i && /* @__PURE__ */ Y("div", {
1923
- style: {
1924
- marginTop: 8,
1925
- fontSize: 11,
1926
- color: "var(--text-3)"
1927
- },
1928
- children: n("record.timeline.truncated", "Truncated for display - open the record for the full text.")
1929
- })]
1930
- }),
1931
- children: e
1932
- })
1933
- });
1934
- }
1935
- function Et(e) {
1936
- if (e == null) return "";
1937
- let t = new Date(b(e));
1938
- return Number.isNaN(t.getTime()) ? "" : `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`;
1939
- }
1940
- function Dt(e, t) {
1941
- if (t == null) return "—";
1942
- let n = new Date(b(t));
1943
- if (Number.isNaN(n.getTime())) return "—";
1944
- let r = /* @__PURE__ */ new Date(), i = /* @__PURE__ */ new Date();
1945
- i.setDate(r.getDate() - 1);
1946
- let a = (e, t) => e.toDateString() === t.toDateString();
1947
- return a(n, r) ? e("record.timeline.today", "Today") : a(n, i) ? e("record.timeline.yesterday", "Yesterday") : n.toLocaleDateString(e.language, {
1948
- weekday: "short",
1949
- month: "short",
1950
- day: "numeric"
1951
- });
1952
- }
1953
- function Ot({ label: e, count: t }) {
1954
- return /* @__PURE__ */ X("div", {
1955
- style: {
1956
- position: "sticky",
1957
- top: -4,
1958
- zIndex: 1,
1959
- display: "flex",
1960
- alignItems: "center",
1961
- gap: 8,
1962
- padding: "4px 2px",
1963
- background: "linear-gradient(180deg, var(--surface-2) 0%, var(--surface-2) 65%, transparent 100%)"
1964
- },
1965
- children: [
1966
- /* @__PURE__ */ Y("span", {
1967
- style: {
1968
- fontSize: 11,
1969
- fontWeight: 600,
1970
- color: "var(--text-3)"
1971
- },
1972
- children: e
1973
- }),
1974
- /* @__PURE__ */ Y("span", { style: {
1975
- flex: 1,
1976
- height: 1,
1977
- background: "var(--divider)"
1978
- } }),
1979
- /* @__PURE__ */ Y("span", {
1980
- className: "num",
1981
- style: {
1982
- fontSize: 10.5,
1983
- color: "var(--text-4)"
1984
- },
1985
- children: t
1986
- })
1987
- ]
1988
- });
1989
- }
1990
- function kt({ value: e, field: t }) {
1991
- let n = x(), r = At(e, t);
1992
- return r === null ? null : /* @__PURE__ */ X("span", {
1993
- style: {
1994
- display: "inline-flex",
1995
- alignItems: "center",
1996
- gap: 3,
1997
- padding: "1px 6px 1px 4px",
1998
- borderRadius: 999,
1999
- fontSize: 10.5,
2000
- fontWeight: 600,
2001
- background: r ? "var(--accent-soft)" : "var(--info-soft)",
2002
- color: r ? "var(--accent)" : "var(--info)"
2003
- },
2004
- children: [Y(r ? w.arrowUp : w.arrowDown, { size: 10 }), r ? n("record.timeline.outbound", "Out") : n("record.timeline.inbound", "In")]
2005
- });
2006
- }
2007
- function At(e, t) {
2008
- if (t.type === "bool") return e === !0;
2009
- if (typeof e == "string") {
2010
- let t = e.toLowerCase();
2011
- if (t === "outbound" || t === "out") return !0;
2012
- if (t === "inbound" || t === "in") return !1;
2013
- }
2014
- return null;
2015
- }
2016
- //#endregion
2017
- //#region src/components/detail-layout/EditableChildrenTable.tsx
2018
- function jt({ config: e, childEntity: t, schema: n, rows: r, onChange: i, validationErrors: a, refs: o, forceTablePresentation: s = !1 }) {
2019
- let c = x(), l = S(), u = K(null), d = e.columns, f = e.position_field, p = new Set(Array.isArray(e.foreign_key) ? e.foreign_key : [e.foreign_key]), m = d.filter((n) => {
2020
- if (p.has(n) || e.position_field && n === e.position_field) return !1;
2021
- let r = t.fields.get(n);
2022
- return !(!r || r.auto || r.primary || r.source);
2023
- }), h = new Set(d.filter((n) => {
2024
- if (e.position_field && n === e.position_field) return !0;
2025
- let r = t.fields.get(n);
2026
- return r && (r.auto || r.primary || r.source);
2027
- })), g = W((e, t, n) => {
2028
- i(r.map((r) => r._key === e ? {
2029
- ...r,
2030
- [t]: n,
2031
- _dirty: !0
2032
- } : r));
2033
- }, [r, i]), v = W(() => {
2034
- let n = {
2035
- _key: crypto.randomUUID(),
2036
- _dirty: !0
2037
- };
2038
- if (f) {
2039
- let e = r.filter((e) => !e._deleted).reduce((e, t) => {
2040
- let n = typeof t[f] == "number" ? t[f] : -1;
2041
- return Math.max(e, n);
2042
- }, -1);
2043
- n[f] = e + 1;
2044
- }
2045
- let a = e.quick_add?.defaults ?? {};
2046
- for (let e of m) {
2047
- let r = t.fields.get(e);
2048
- r && (a[e] === void 0 ? r.default === void 0 ? r.type === "bool" && (n[e] = !1) : n[e] = r.default : n[e] = a[e]);
2049
- }
2050
- i([...r, n]);
2051
- }, [
2052
- r,
2053
- i,
2054
- m,
2055
- t,
2056
- e.quick_add?.defaults,
2057
- f
2058
- ]), y = W((e) => {
2059
- i(r.map((t) => t._key === e ? {
2060
- ...t,
2061
- _deleted: !0
2062
- } : t));
2063
- }, [r, i]), C = W((e) => {
2064
- i(r.map((t) => t._key === e ? {
2065
- ...t,
2066
- _deleted: !1
2067
- } : t));
2068
- }, [r, i]), D = W((e, t) => {
2069
- if (!f) return;
2070
- let n = r.filter((e) => !e._deleted), a = r.filter((e) => e._deleted), o = n.findIndex((t) => t._key === e), s = o + t;
2071
- if (o < 0 || s < 0 || s >= n.length) return;
2072
- let c = [...n], [l] = c.splice(o, 1);
2073
- c.splice(s, 0, l), i([...c.map((e, t) => ({
2074
- ...e,
2075
- [f]: t,
2076
- _dirty: e[f] !== t || e._dirty
2077
- })), ...a]);
2078
- }, [
2079
- r,
2080
- i,
2081
- f
2082
- ]), O = W((e) => {
2083
- let t = e.target, n = t.closest("td");
2084
- if (!n) return;
2085
- let r = n.closest("tr");
2086
- if (!r) return;
2087
- let i = r.closest("tbody");
2088
- if (!i) return;
2089
- let a = Array.from(r.cells).indexOf(n), o = Array.from(i.rows).indexOf(r);
2090
- if (e.key === "Tab") {
2091
- let t = e.shiftKey ? -1 : 1, n = Array.from(i.rows), r = o, s = a + t;
2092
- for (; r >= 0 && r < n.length;) if (s >= 0 && s < n[r].cells.length) {
2093
- let i = n[r].cells[s].querySelector("input, select, textarea, [tabindex]");
2094
- if (i) {
2095
- e.preventDefault(), i.focus();
2096
- return;
2097
- }
2098
- s += t;
2099
- } else r += t, s = t > 0 ? 0 : (n[r]?.cells.length ?? 1) - 1;
2100
- } else if (e.key === "Enter") {
2101
- e.preventDefault();
2102
- let t = Array.from(i.rows);
2103
- if (o < t.length - 1) {
2104
- let e = t[o + 1].cells[a]?.querySelector("input, select, textarea, [tabindex]");
2105
- e && e.focus();
2106
- } else v(), requestAnimationFrame(() => {
2107
- let e = i.querySelectorAll("tr"), t = e[e.length - 1];
2108
- if (t) {
2109
- let e = t.querySelector("input, select, textarea, [tabindex]");
2110
- e && e.focus();
2111
- }
2112
- });
2113
- } else e.key === "Escape" && t.blur?.();
2114
- }, [v]), A = ce;
2115
- return l.isPhone && !s ? /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("div", {
2116
- style: {
2117
- display: "flex",
2118
- flexDirection: "column",
2119
- gap: 10
2120
- },
2121
- children: r.map((e, i) => {
2122
- let s = !!e._deleted, l = a?.[e._key], u = f ? r.filter((e) => !e._deleted) : [], p = f ? u.findIndex((t) => t._key === e._key) : -1;
2123
- return /* @__PURE__ */ X("div", {
2124
- style: {
2125
- border: "1px solid var(--border)",
2126
- borderRadius: 8,
2127
- background: "var(--surface)",
2128
- opacity: s ? .58 : 1,
2129
- overflow: "hidden"
2130
- },
2131
- children: [/* @__PURE__ */ X("div", {
2132
- style: {
2133
- minHeight: 38,
2134
- padding: "8px 10px",
2135
- borderBottom: "1px solid var(--divider)",
2136
- display: "flex",
2137
- alignItems: "center",
2138
- justifyContent: "space-between",
2139
- gap: 8
2140
- },
2141
- children: [/* @__PURE__ */ Y("div", {
2142
- style: {
2143
- fontSize: 12,
2144
- fontWeight: 600,
2145
- color: "var(--text-2)"
2146
- },
2147
- children: c("record.row.number", "Row {number}", { number: i + 1 })
2148
- }), /* @__PURE__ */ X("div", {
2149
- style: {
2150
- display: "flex",
2151
- alignItems: "center",
2152
- gap: 4
2153
- },
2154
- children: [f && !s && /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(T, {
2155
- size: 32,
2156
- icon: /* @__PURE__ */ Y(w.up, { size: 14 }),
2157
- onClick: () => D(e._key, -1),
2158
- disabled: p <= 0,
2159
- title: c("record.row.move_up", "Move row up")
2160
- }), /* @__PURE__ */ Y(T, {
2161
- size: 32,
2162
- icon: /* @__PURE__ */ Y(w.down, { size: 14 }),
2163
- onClick: () => D(e._key, 1),
2164
- disabled: p === -1 || p >= u.length - 1,
2165
- title: c("record.row.move_down", "Move row down")
2166
- })] }), s ? /* @__PURE__ */ Y(T, {
2167
- size: 32,
2168
- icon: /* @__PURE__ */ Y(w.refresh, { size: 14 }),
2169
- onClick: () => C(e._key),
2170
- title: c("record.row.undo_delete", "Undo delete")
2171
- }) : /* @__PURE__ */ Y(T, {
2172
- size: 32,
2173
- icon: /* @__PURE__ */ Y(w.trash, { size: 14 }),
2174
- onClick: () => y(e._key),
2175
- title: c("record.row.delete", "Delete row")
2176
- })]
2177
- })]
2178
- }), /* @__PURE__ */ Y("div", {
2179
- style: {
2180
- padding: 10,
2181
- display: "flex",
2182
- flexDirection: "column",
2183
- gap: 12
2184
- },
2185
- children: d.map((r) => {
2186
- let i = t.fields.get(r), a = l?.includes(r), u = h.has(r), d = i ? _(c, i, r, n.entities) : r, f = `child-${e._key}-${r}`, p = `${f}-label`, m = {
2187
- outline: a ? "1px solid var(--danger)" : "none",
2188
- outlineOffset: 3,
2189
- borderRadius: a ? 5 : 0
2190
- }, v = {
2191
- fontSize: 11.5,
2192
- fontWeight: 600,
2193
- color: "var(--text-3)"
2194
- }, y = !s && !u && !!i;
2195
- return /* @__PURE__ */ X("div", {
2196
- style: {
2197
- display: "flex",
2198
- flexDirection: "column",
2199
- gap: 5,
2200
- minWidth: 0,
2201
- textDecoration: s ? "line-through" : "none"
2202
- },
2203
- title: a ? c("record.row.field_required", "{field} is required", { field: r }) : void 0,
2204
- children: [y ? /* @__PURE__ */ Y("label", {
2205
- id: p,
2206
- htmlFor: f,
2207
- style: v,
2208
- children: d
2209
- }) : /* @__PURE__ */ Y("div", {
2210
- id: p,
2211
- style: v,
2212
- children: d
2213
- }), /* @__PURE__ */ Y("div", {
2214
- style: m,
2215
- children: s || u ? i ? k({
2216
- field: i,
2217
- fieldName: r,
2218
- value: e[r],
2219
- mode: "display",
2220
- record: e,
2221
- refs: o,
2222
- fieldId: f,
2223
- labelId: p,
2224
- t: c
2225
- }) : b(e[r]) : i ? k({
2226
- field: i,
2227
- fieldName: r,
2228
- value: e[r],
2229
- mode: "edit",
2230
- onChange: (t) => g(e._key, r, t),
2231
- record: e,
2232
- refs: o,
2233
- compact: !0,
2234
- fieldId: f,
2235
- labelId: p,
2236
- t: c
2237
- }) : b(e[r])
2238
- })]
2239
- }, r);
2240
- })
2241
- })]
2242
- }, e._key);
2243
- })
2244
- }), /* @__PURE__ */ Y("div", {
2245
- style: { marginTop: 10 },
2246
- children: /* @__PURE__ */ Y(E, {
2247
- kind: "ghost",
2248
- size: "sm",
2249
- icon: /* @__PURE__ */ Y(w.plus, { size: 14 }),
2250
- onClick: v,
2251
- children: c("record.row.add", "Add row")
2252
- })
2253
- })] }) : /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("div", {
2254
- style: { overflowX: "auto" },
2255
- children: /* @__PURE__ */ X("table", {
2256
- ref: u,
2257
- style: le,
2258
- onKeyDown: O,
2259
- children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ X("tr", { children: [d.map((e) => {
2260
- let r = t.fields.get(e);
2261
- return /* @__PURE__ */ Y("th", {
2262
- style: A,
2263
- children: r ? _(c, r, e, n.entities) : e
2264
- }, e);
2265
- }), /* @__PURE__ */ Y("th", { style: {
2266
- ...A,
2267
- width: 40
2268
- } })] }) }), /* @__PURE__ */ Y("tbody", { children: r.map((e) => {
2269
- let n = !!e._deleted, r = a?.[e._key];
2270
- return /* @__PURE__ */ X("tr", {
2271
- style: { opacity: n ? .5 : 1 },
2272
- children: [d.map((i) => {
2273
- let a = t.fields.get(i), s = r?.includes(i), l = h.has(i);
2274
- return n || l ? /* @__PURE__ */ Y("td", {
2275
- style: {
2276
- padding: "6px 12px",
2277
- borderBottom: "1px solid var(--divider)",
2278
- verticalAlign: "middle",
2279
- textDecoration: n ? "line-through" : "none",
2280
- color: "var(--text-2)"
2281
- },
2282
- children: a ? k({
2283
- field: a,
2284
- fieldName: i,
2285
- value: e[i],
2286
- mode: "display",
2287
- record: e,
2288
- refs: o,
2289
- t: c
2290
- }) : b(e[i])
2291
- }, i) : /* @__PURE__ */ Y("td", {
2292
- style: {
2293
- padding: "4px 4px",
2294
- borderBottom: "1px solid var(--divider)",
2295
- verticalAlign: "middle",
2296
- outline: s ? "1px solid var(--danger)" : "none",
2297
- outlineOffset: -1,
2298
- borderRadius: s ? 4 : 0
2299
- },
2300
- title: s ? c("record.row.field_required", "{field} is required", { field: i }) : void 0,
2301
- children: a ? k({
2302
- field: a,
2303
- fieldName: i,
2304
- value: e[i],
2305
- mode: "edit",
2306
- onChange: (t) => g(e._key, i, t),
2307
- record: e,
2308
- refs: o,
2309
- compact: !0,
2310
- t: c
2311
- }) : b(e[i])
2312
- }, i);
2313
- }), /* @__PURE__ */ Y("td", {
2314
- style: {
2315
- padding: "4px 8px",
2316
- borderBottom: "1px solid var(--divider)",
2317
- verticalAlign: "middle"
2318
- },
2319
- children: n ? /* @__PURE__ */ Y(T, {
2320
- size: 24,
2321
- icon: /* @__PURE__ */ Y(w.refresh, { size: 12 }),
2322
- onClick: () => C(e._key),
2323
- title: c("record.row.undo_delete", "Undo delete")
2324
- }) : /* @__PURE__ */ Y(T, {
2325
- size: 24,
2326
- icon: /* @__PURE__ */ Y(w.trash, { size: 12 }),
2327
- onClick: () => y(e._key),
2328
- title: c("record.row.delete", "Delete row")
2329
- })
2330
- })]
2331
- }, e._key);
2332
- }) })]
2333
- })
2334
- }), /* @__PURE__ */ Y("div", {
2335
- style: { marginTop: 8 },
2336
- children: /* @__PURE__ */ Y(E, {
2337
- kind: "ghost",
2338
- size: "xs",
2339
- icon: /* @__PURE__ */ Y(w.plus, { size: 12 }),
2340
- onClick: v,
2341
- children: c("record.row.add", "Add row")
2342
- })
2343
- })] });
2344
- }
2345
- //#endregion
2346
- //#region src/components/detail-layout/ChildrenBlock.tsx
2347
- var Mt = ve(() => import("./DraggableChildrenTable-Dd5SeuF6.js").then((e) => ({ default: e.DraggableChildrenTable })));
2348
- function Nt({ node: e, ctx: t }) {
2349
- let n = x(), r = x("errors"), i = S(), a = e.children;
2350
- if (!a) return null;
2351
- let o = i.isPhone && t.relatedRecordsPresentation === "table";
2352
- if (t.isNew && t.mode !== "edit") return null;
2353
- let s = Ye(t.entity, a);
2354
- if (!s) return /* @__PURE__ */ X("div", {
2355
- className: "text-sm text-muted-foreground py-2",
2356
- children: [
2357
- r("record.child_relation_unknown", "This record type has no child relation by that name."),
2358
- " ",
2359
- /* @__PURE__ */ Y("code", { children: a })
2360
- ]
2361
- });
2362
- let c = t.schema.entities[s.entity];
2363
- if (!c) return /* @__PURE__ */ X("div", {
2364
- className: "text-sm text-muted-foreground py-2",
2365
- children: [
2366
- r("record.related_entity_not_found", "The related record type is not declared in this deployment."),
2367
- " ",
2368
- /* @__PURE__ */ Y("code", { children: s.entity })
2369
- ]
2370
- });
2371
- let l = Le(s, c, e), u = Me(e, t, n), d = Ne(e, t), f = (e) => l.mode === "timeline" || t.withinCard ? e : /* @__PURE__ */ Y(P, {
2372
- title: u,
2373
- icon: d ? /* @__PURE__ */ Y(R, {
2374
- name: d,
2375
- size: 14
2376
- }) : void 0,
2377
- children: e
2378
- });
2379
- if (t.mode === "edit" && l.editable && l.interaction !== "navigate" && l.interaction !== "readonly" && m(c, "update") && l.mode === "table" && t.pendingChildren !== void 0 && t.onChildrenChange) {
2380
- let e = t.pendingChildren[a] ?? [], n = t.childValidationErrors?.[a], r = l.position_field ? i.isPhone && !o ? jt : Mt : jt;
2381
- return f(/* @__PURE__ */ Y(_e, {
2382
- fallback: /* @__PURE__ */ Y(U, {}),
2383
- children: /* @__PURE__ */ Y(r, {
2384
- config: l,
2385
- childEntity: c,
2386
- schema: t.schema,
2387
- rows: e,
2388
- onChange: (e) => t.onChildrenChange(a, e),
2389
- validationErrors: n,
2390
- refs: t.refs,
2391
- forceTablePresentation: o
2392
- })
2393
- }));
2394
- }
2395
- if (t.isNew) return null;
2396
- let p = {
2397
- config: l,
2398
- parentEntity: t.entityCode,
2399
- parentId: t.recordId,
2400
- schema: t.schema
2401
- };
2402
- switch (l.mode) {
2403
- case "list": return f(/* @__PURE__ */ Y(at, { ...p }));
2404
- case "cards": return f(/* @__PURE__ */ Y(ot, { ...p }));
2405
- case "timeline": return f(/* @__PURE__ */ Y(Ct, { ...p }));
2406
- default: return i.isPhone && !o ? f(/* @__PURE__ */ Y(ot, { ...p })) : f(/* @__PURE__ */ Y(it, { ...p }));
2407
- }
2408
- }
2409
- //#endregion
2410
- //#region src/components/detail-layout/FieldsBlock.tsx
2411
- function Pt({ fields: e, ctx: t }) {
2412
- let n = x(), { entity: r, entityCode: i, record: a, mode: o, onFieldChange: c, schema: l } = t, u = t.columns ?? 2, d = t.hideEmptyFields && o === "display" ? e.filter((e) => ae(r, a, e.code)) : e, f = u === 1 && e.length === 1;
2413
- return d.length === 0 ? null : /* @__PURE__ */ Y(me, {
2414
- columns: u,
2415
- children: d.map((e) => {
2416
- let u = e.code, d = `${i ?? "field"}-${u}`, p = `${d}-label`, m = r.fields.get(u), g = !!(m?.auto || m?.readonly || m?.source), _ = h(r, u), v = _?.read === "denied", y = _?.write === "denied", b = o === "display" ? v : y || v, x = g || o === "edit" && y ? "display" : o, S = b ? /* @__PURE__ */ Y(F, {
2417
- tier: _.classification,
2418
- tierDef: s(l, r, u),
2419
- requiredPermission: _?.required_permission,
2420
- variant: x === "edit" ? "input" : "value"
2421
- }) : se({
2422
- entity: r,
2423
- entityCode: i,
2424
- fieldName: u,
2425
- record: a,
2426
- mode: x,
2427
- onChange: c && !g ? (e) => c(u, e) : void 0,
2428
- refs: t.refs,
2429
- entities: l?.entities,
2430
- screens: l?.screens,
2431
- t: n,
2432
- fieldId: d,
2433
- labelId: p,
2434
- structure: e.structure,
2435
- detailScreen: e.detail_screen
2436
- });
2437
- if (!S) return null;
2438
- let C = o === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ Y(J, { children: e.actions.map((e, t) => /* @__PURE__ */ Y(de, {
2439
- actionCode: `${u}.action[${t}]`,
2440
- action: e,
2441
- entityCode: i,
2442
- row: a,
2443
- variant: "ghost",
2444
- size: "icon"
2445
- }, t)) }) : void 0, w = !!m && he.has(m.type), T = x === "display" ? pe(m, a?.[u]) : void 0, E = n(m?.display?.description);
2446
- return f && (w || e.structure) ? /* @__PURE__ */ X("div", {
2447
- style: { gridColumn: "1 / -1" },
2448
- children: [S, x === "edit" && E && /* @__PURE__ */ Y("div", {
2449
- style: {
2450
- fontSize: 11.5,
2451
- lineHeight: 1.4,
2452
- color: "var(--text-3)",
2453
- marginTop: 3
2454
- },
2455
- children: E
2456
- })]
2457
- }, u) : /* @__PURE__ */ Y(ge, {
2458
- "data-testid": `field-${u}`,
2459
- label: oe(n, r, u, l.entities),
2460
- htmlFor: x === "edit" ? d : void 0,
2461
- labelId: p,
2462
- labelTitle: E || void 0,
2463
- required: m?.required ?? !1,
2464
- mode: x,
2465
- span: w,
2466
- error: t.fieldErrors?.[u],
2467
- hint: x === "edit" && E ? E : void 0,
2468
- actions: C,
2469
- copyValue: T,
2470
- children: S
2471
- }, u);
2472
- })
2473
- });
2474
- }
2475
- //#endregion
2476
- //#region src/components/detail-layout/PropertiesBlock.tsx
2477
- var Ft = /* @__PURE__ */ new Set([
2478
- "string",
2479
- "text",
2480
- "int",
2481
- "float",
2482
- "decimal",
2483
- "email",
2484
- "url"
2485
- ]), It = 500;
2486
- function Lt({ node: e, ctx: t }) {
2487
- let { entity: n, objectProperties: r, onSetProperty: i, isNew: a, mode: o, refs: s } = t, c = n.properties ?? {};
2488
- if (a) return null;
2489
- let l = e.properties === !0 || e.properties, u = l === !0 ? Object.entries(c).sort(([e], [t]) => e.localeCompare(t)) : l.filter((e) => c[e] != null).map((e) => [e, c[e]]);
2490
- return u.length === 0 ? null : /* @__PURE__ */ Y(me, {
2491
- columns: 2,
2492
- children: u.map(([e, a]) => {
2493
- let c = r?.find((t) => t.property_code === e), l = p(a), u = a.readonly || !i ? "display" : o;
2494
- return /* @__PURE__ */ Y(Rt, {
2495
- propCode: e,
2496
- prop: a,
2497
- field: l,
2498
- value: c?.value,
2499
- mode: u,
2500
- onSetProperty: i,
2501
- refs: s,
2502
- entity: n,
2503
- schema: t.schema
2504
- }, e);
2505
- })
2506
- });
2507
- }
2508
- function Rt({ propCode: e, prop: t, field: n, value: r, mode: i, onSetProperty: a, refs: o, entity: c, schema: l }) {
2509
- let u = x(), d = K(null);
2510
- G(() => () => {
2511
- d.current && clearTimeout(d.current);
2512
- }, []);
2513
- let f = W((n) => {
2514
- a && (Ft.has(t.type) ? (d.current && clearTimeout(d.current), d.current = setTimeout(() => a(e, n), It)) : a(e, n));
2515
- }, [
2516
- e,
2517
- t.type,
2518
- a
2519
- ]), p = h(c, e), m = p?.read === "denied", g = p?.write === "denied", _ = i === "display" ? m : g || m, v = i === "edit" && g ? "display" : i;
2520
- return /* @__PURE__ */ Y(ge, {
2521
- label: u(t.display?.name ?? t.name),
2522
- mode: v,
2523
- span: he.has(t.type),
2524
- children: _ ? /* @__PURE__ */ Y(F, {
2525
- tier: p.classification,
2526
- tierDef: s(l, c, e),
2527
- requiredPermission: p?.required_permission,
2528
- variant: v === "edit" ? "input" : "value"
2529
- }) : k({
2530
- field: n,
2531
- fieldName: e,
2532
- value: r,
2533
- mode: v,
2534
- onChange: v === "edit" ? f : void 0,
2535
- refs: o,
2536
- t: u
2537
- })
2538
- });
2539
- }
2540
- //#endregion
2541
- //#region src/components/shared/StatusStepper.tsx
2542
- function zt({ stages: e, current: t, selectable: n, onSelect: r, compact: i = !1 }) {
2543
- let a = e.findIndex((e) => e.code === t);
2544
- return /* @__PURE__ */ Y("div", {
2545
- role: "list",
2546
- style: {
2547
- display: "flex",
2548
- alignItems: "stretch",
2549
- borderRadius: 6,
2550
- overflow: "hidden",
2551
- border: "1px solid var(--border)",
2552
- background: "var(--surface)"
2553
- },
2554
- children: e.map((t, o) => {
2555
- let s = a >= 0 && o < a, c = o === a, l = a < 0 || o > a, u = !!r && (n?.has(t.code) ?? !1), d = o === 0, f = o === e.length - 1, p = c ? "var(--accent-soft)" : s ? "var(--success-soft)" : "transparent", m = c ? "var(--accent)" : s ? "var(--success)" : "var(--text-3)", h = d && f ? void 0 : d ? "polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%)" : f ? "polygon(0 0, 100% 0, 100% 100%, 0 100%, 10px 50%)" : "polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%)";
2556
- return /* @__PURE__ */ X("button", {
2557
- role: "listitem",
2558
- type: "button",
2559
- disabled: !u,
2560
- onClick: u ? () => r(t.code) : void 0,
2561
- title: t.label,
2562
- style: {
2563
- flex: 1,
2564
- minWidth: 0,
2565
- display: "flex",
2566
- alignItems: "center",
2567
- gap: 6,
2568
- padding: i ? `6px 8px 6px ${d ? 10 : 20}px` : `8px 10px 8px ${d ? 12 : 24}px`,
2569
- border: 0,
2570
- borderLeft: o > 0 ? "1px solid var(--divider)" : "none",
2571
- background: p,
2572
- color: m,
2573
- fontSize: i ? 11.5 : 12.5,
2574
- fontFamily: "inherit",
2575
- fontWeight: c ? 600 : 500,
2576
- cursor: u ? "pointer" : "default",
2577
- clipPath: h,
2578
- whiteSpace: "nowrap"
2579
- },
2580
- children: [/* @__PURE__ */ Y("span", {
2581
- style: {
2582
- width: 16,
2583
- height: 16,
2584
- borderRadius: 999,
2585
- flexShrink: 0,
2586
- background: l ? "transparent" : m,
2587
- border: l ? "1px solid var(--border-strong)" : "none",
2588
- color: l ? "var(--text-4)" : c ? "var(--accent-soft)" : "var(--success-soft)",
2589
- display: "flex",
2590
- alignItems: "center",
2591
- justifyContent: "center",
2592
- fontSize: 9.5,
2593
- fontWeight: 700
2594
- },
2595
- children: s ? /* @__PURE__ */ Y(w.check, { size: 10 }) : o + 1
2596
- }), /* @__PURE__ */ Y("span", {
2597
- style: {
2598
- overflow: "hidden",
2599
- textOverflow: "ellipsis"
2600
- },
2601
- children: t.label
2602
- })]
2603
- }, t.code);
2604
- })
2605
- });
2606
- }
2607
- //#endregion
2608
- //#region src/components/shared/StatusGroupsDisplay.tsx
2609
- function Bt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r, mode: i = "edit" }) {
2610
- let a = x();
2611
- return /* @__PURE__ */ Y("div", {
2612
- style: {
2613
- display: "flex",
2614
- flexWrap: "wrap",
2615
- alignItems: "center",
2616
- gap: 16
2617
- },
2618
- children: Object.entries(e).map(([e, o]) => {
2619
- let s = t?.find((t) => t.group_code === e)?.status_code, c = s ? o.statuses.find((e) => e.code === s) : void 0;
2620
- if (o.display_mode === "stepper") {
2621
- let t = i === "edit", c = t ? o.transitions && s ? /* @__PURE__ */ new Set([s, ...o.transitions[s] ?? []]) : new Set(o.statuses.map((e) => e.code)) : void 0;
2622
- return /* @__PURE__ */ X("div", {
2623
- style: {
2624
- display: "flex",
2625
- alignItems: "center",
2626
- gap: 8,
2627
- minWidth: 0
2628
- },
2629
- children: [/* @__PURE__ */ X("span", {
2630
- style: {
2631
- fontSize: 12,
2632
- color: "var(--text-3)",
2633
- flexShrink: 0
2634
- },
2635
- children: [a(o.name), ":"]
2636
- }), /* @__PURE__ */ Y("div", {
2637
- style: {
2638
- minWidth: 240,
2639
- opacity: r ? .6 : 1,
2640
- pointerEvents: r ? "none" : "auto"
2641
- },
2642
- children: /* @__PURE__ */ Y(zt, {
2643
- stages: o.statuses.map((e) => ({
2644
- code: e.code,
2645
- label: a(e.name)
2646
- })),
2647
- current: s,
2648
- selectable: c,
2649
- onSelect: t ? (t) => n(e, t) : void 0,
2650
- compact: !0
2651
- })
2652
- })]
2653
- }, e);
2654
- }
2655
- if (i === "display") return /* @__PURE__ */ X("div", {
2656
- style: {
2657
- display: "flex",
2658
- alignItems: "center",
2659
- gap: 8
2660
- },
2661
- children: [/* @__PURE__ */ X("span", {
2662
- style: {
2663
- fontSize: 12,
2664
- color: "var(--text-3)"
2665
- },
2666
- children: [a(o.name), ":"]
2667
- }), c ? /* @__PURE__ */ Y(D, {
2668
- tone: c.color ?? "slate",
2669
- size: "xs",
2670
- children: a(c.name)
2671
- }) : /* @__PURE__ */ Y("span", {
2672
- style: {
2673
- fontSize: 12.5,
2674
- color: "var(--text-4)"
2675
- },
2676
- children: "—"
2677
- })]
2678
- }, e);
2679
- let l = (o.transitions && s ? o.statuses.filter((e) => e.code === s || (o.transitions[s]?.includes(e.code) ?? !1)) : o.statuses).map((e) => ({
2680
- value: e.code,
2681
- label: /* @__PURE__ */ X("span", {
2682
- style: {
2683
- display: "inline-flex",
2684
- alignItems: "center",
2685
- gap: 6
2686
- },
2687
- children: [e.color && /* @__PURE__ */ Y("span", { style: {
2688
- width: 8,
2689
- height: 8,
2690
- borderRadius: 999,
2691
- background: `var(--pill-${e.color}, ${e.color})`,
2692
- display: "inline-block"
2693
- } }), a(e.name)]
2694
- })
2695
- }));
2696
- return /* @__PURE__ */ X("div", {
2697
- style: {
2698
- display: "flex",
2699
- alignItems: "center",
2700
- gap: 8
2701
- },
2702
- children: [/* @__PURE__ */ X("span", {
2703
- style: {
2704
- fontSize: 12,
2705
- color: "var(--text-3)"
2706
- },
2707
- children: [a(o.name), ":"]
2708
- }), /* @__PURE__ */ Y("div", {
2709
- style: {
2710
- minWidth: 180,
2711
- opacity: r ? .6 : 1,
2712
- pointerEvents: r ? "none" : "auto"
2713
- },
2714
- children: /* @__PURE__ */ Y(j, {
2715
- value: s ?? "",
2716
- options: l,
2717
- onChange: (t) => n(e, t)
2718
- })
2719
- })]
2720
- }, e);
2721
- })
2722
- });
2723
- }
2724
- //#endregion
2725
- //#region src/components/detail-layout/StatusesBlock.tsx
2726
- var Vt = () => {};
2727
- function Ht({ node: e, ctx: t }) {
2728
- let { entity: n, objectStatuses: r, onSetStatus: i, isStatusPending: a, isNew: o } = t, s = n.status_groups ?? {};
2729
- if (o) return null;
2730
- let c = e.statuses === !0 || e.statuses, l = Object.fromEntries(Object.entries(s).filter(([e]) => c === !0 || c.includes(e)));
2731
- return Object.keys(l).length === 0 ? null : /* @__PURE__ */ Y(Bt, {
2732
- statusGroups: l,
2733
- objectStatuses: r,
2734
- onSetStatus: i ?? Vt,
2735
- isPending: a ?? !1,
2736
- mode: t.mode
2737
- });
2738
- }
2739
- //#endregion
2740
- //#region src/components/detail-layout/widgets/canonicalizeJson.ts
2741
- function Ut(e) {
2742
- if (Array.isArray(e)) return e.map(Ut);
2743
- if (typeof e == "object" && e) {
2744
- let t = e, n = {};
2745
- for (let e of Object.keys(t).sort()) n[e] = Ut(t[e]);
2746
- return n;
2747
- }
2748
- return e;
2749
- }
2750
- function Wt(e) {
2751
- switch (typeof e) {
2752
- case "string": return e;
2753
- case "number":
2754
- case "boolean":
2755
- case "bigint":
2756
- case "symbol": return String(e);
2757
- case "function": return "[function]";
2758
- case "object": return "[unserializable]";
2759
- default: return "";
2760
- }
2761
- }
2762
- function Gt(e) {
2763
- if (e == null) return "";
2764
- try {
2765
- return JSON.stringify(Ut(e), null, 2) ?? Wt(e);
2766
- } catch {
2767
- return Wt(e);
2768
- }
2769
- }
2770
- //#endregion
2771
- //#region src/components/detail-layout/widgets/JsonDiffWidget.tsx
2772
- function Kt(e) {
2773
- return e("record.diff.editor", "Audit change diff");
2774
- }
2775
- var qt = ve(() => import("./MonacoJson-BG3S3GHX.js").then((e) => ({ default: e.MonacoJsonDiff }))), Jt = ve(() => import("./MonacoJson-BG3S3GHX.js").then((e) => ({ default: e.MonacoJsonSource }))), Yt = ve(() => import("./JsonEditor-Dz1PQHC8.js").then((e) => ({ default: e.JsonEditor })));
2776
- function Xt() {
2777
- let e = x();
2778
- return /* @__PURE__ */ Y("div", {
2779
- className: "flex h-full w-full items-center justify-center text-sm text-muted-foreground",
2780
- children: e("record.diff.loading_editor", "Loading editor…")
2781
- });
2782
- }
2783
- function Zt({ before: e, after: t }) {
2784
- let n = x();
2785
- return /* @__PURE__ */ Y(_e, {
2786
- fallback: /* @__PURE__ */ Y(Xt, {}),
2787
- children: /* @__PURE__ */ X("div", {
2788
- className: "flex h-full w-full gap-2",
2789
- role: "group",
2790
- "aria-label": Kt(n),
2791
- children: [/* @__PURE__ */ Y("div", {
2792
- className: "min-w-0 flex-1",
2793
- children: /* @__PURE__ */ Y(Yt, {
2794
- value: e,
2795
- readOnly: !0
2796
- })
2797
- }), /* @__PURE__ */ Y("div", {
2798
- className: "min-w-0 flex-1",
2799
- children: /* @__PURE__ */ Y(Yt, {
2800
- value: t,
2801
- readOnly: !0
2802
- })
2803
- })]
2804
- })
2805
- });
2806
- }
2807
- function Qt({ mode: e, onChange: t }) {
2808
- let n = x();
2809
- return /* @__PURE__ */ X("div", {
2810
- className: "inline-flex gap-1",
2811
- role: "group",
2812
- "aria-label": n("record.diff.view_mode", "Diff view mode"),
2813
- children: [/* @__PURE__ */ Y("button", {
2814
- type: "button",
2815
- "aria-pressed": e === "diff",
2816
- onClick: () => t("diff"),
2817
- className: `rounded px-2 py-0.5 text-xs ${e === "diff" ? "bg-accent text-accent-foreground" : "text-muted-foreground"}`,
2818
- children: n("record.diff.diff", "Diff")
2819
- }), /* @__PURE__ */ Y("button", {
2820
- type: "button",
2821
- "aria-pressed": e === "source",
2822
- onClick: () => t("source"),
2823
- className: `rounded px-2 py-0.5 text-xs ${e === "source" ? "bg-accent text-accent-foreground" : "text-muted-foreground"}`,
2824
- children: n("record.diff.source", "Source")
2825
- })]
2826
- });
2827
- }
2828
- function $t({ values: e, options: t }) {
2829
- let n = x(), r = e.before, i = e.after, a = t?.default_mode === "source" ? "source" : "diff", [o, s] = q(a), c = Gt(r), l = Gt(i);
2830
- return /* @__PURE__ */ X("div", {
2831
- className: "flex flex-col gap-2",
2832
- children: [/* @__PURE__ */ X("div", {
2833
- className: "flex items-center justify-between",
2834
- children: [/* @__PURE__ */ Y(Qt, {
2835
- mode: o,
2836
- onChange: s
2837
- }), c === l && /* @__PURE__ */ Y("span", {
2838
- className: "text-xs text-muted-foreground",
2839
- role: "status",
2840
- children: n("record.diff.no_changes", "No field changes")
2841
- })]
2842
- }), /* @__PURE__ */ Y("div", {
2843
- className: "h-[480px] w-full overflow-hidden rounded border",
2844
- role: "group",
2845
- "aria-label": Kt(n),
2846
- children: /* @__PURE__ */ Y(I, {
2847
- fallback: /* @__PURE__ */ Y(Zt, {
2848
- before: r,
2849
- after: i
2850
- }),
2851
- children: /* @__PURE__ */ Y(_e, {
2852
- fallback: /* @__PURE__ */ Y(Xt, {}),
2853
- children: o === "diff" ? /* @__PURE__ */ Y(qt, {
2854
- before: c,
2855
- after: l
2856
- }) : /* @__PURE__ */ X("div", {
2857
- className: "flex h-full w-full gap-2",
2858
- children: [/* @__PURE__ */ Y("div", {
2859
- className: "min-w-0 flex-1",
2860
- children: /* @__PURE__ */ Y(Jt, { value: c })
2861
- }), /* @__PURE__ */ Y("div", {
2862
- className: "min-w-0 flex-1",
2863
- children: /* @__PURE__ */ Y(Jt, { value: l })
2864
- })]
2865
- })
2866
- })
2867
- })
2868
- })]
2869
- });
2870
- }
2871
- //#endregion
2872
- //#region src/components/detail-layout/widgets/EntityScorecardWidget.tsx
2873
- function Q(e) {
2874
- return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
2875
- }
2876
- function $(e) {
2877
- let t = Q(e);
2878
- if (!t) return;
2879
- let n = Object.entries(t).filter((e) => typeof e[1] == "string");
2880
- return n.length > 0 ? Object.fromEntries(n) : void 0;
2881
- }
2882
- function en(e) {
2883
- return Array.isArray(e) ? e.flatMap((e) => {
2884
- let t = Q(e);
2885
- return !t || typeof t.field != "string" ? [] : [{
2886
- field: t.field,
2887
- label: $(t.label),
2888
- format: t.format
2889
- }];
2890
- }) : [];
2891
- }
2892
- function tn(e) {
2893
- if (!e || typeof e.entity != "string" || typeof e.scope_field != "string" || typeof e.window_field != "string") return;
2894
- let t = Array.isArray(e.windows) ? e.windows.flatMap((e) => {
2895
- let t = Q(e);
2896
- return t && typeof t.code == "string" ? [{
2897
- code: t.code,
2898
- label: $(t.label)
2899
- }] : [];
2900
- }) : [], n = Array.isArray(e.metrics) ? e.metrics.flatMap((e) => {
2901
- let t = Q(e);
2902
- if (!t || typeof t.field != "string") return [];
2903
- let n = Q(t.filtered);
2904
- return [{
2905
- field: t.field,
2906
- label: $(t.label),
2907
- help: $(t.help),
2908
- format: t.format,
2909
- attention: t.attention === !0,
2910
- drillthrough_value: typeof t.drillthrough_value == "string" ? t.drillthrough_value : void 0,
2911
- drillthrough_filter: t.drillthrough_filter !== !1,
2912
- filtered: n && typeof n.field == "string" ? {
2913
- field: n.field,
2914
- where: Q(n.where)
2915
- } : void 0
2916
- }];
2917
- }) : [];
2918
- if (t.length === 0 || n.length === 0) return;
2919
- let r = Q(e.breakdown), i = r && typeof r.entity == "string" && typeof r.scope_field == "string" && typeof r.window_field == "string" ? {
2920
- entity: r.entity,
2921
- scope_field: r.scope_field,
2922
- window_field: r.window_field,
2923
- filter_field: typeof r.filter_field == "string" ? r.filter_field : void 0,
2924
- filter_label: $(r.filter_label),
2925
- all_label: $(r.all_label),
2926
- empty_label: $(r.empty_label),
2927
- columns: en(r.columns),
2928
- sort: typeof r.sort == "string" ? r.sort : void 0,
2929
- limit: typeof r.limit == "number" ? Math.min(500, Math.max(1, r.limit)) : 200
2930
- } : void 0, a = Q(e.drillthrough), o = a && typeof a.route == "string" && typeof a.scope_field == "string" && typeof a.window_field == "string" ? {
2931
- route: a.route,
2932
- scope_field: a.scope_field,
2933
- window_field: a.window_field,
2934
- filter_field: typeof a.filter_field == "string" ? a.filter_field : void 0,
2935
- metric_field: typeof a.metric_field == "string" ? a.metric_field : void 0
2936
- } : void 0;
2937
- return {
2938
- entity: e.entity,
2939
- scope_field: e.scope_field,
2940
- window_field: e.window_field,
2941
- windows: t,
2942
- default_window: typeof e.default_window == "string" ? e.default_window : void 0,
2943
- metrics: n,
2944
- title: $(e.title),
2945
- description: $(e.description),
2946
- intended_note: $(e.intended_note),
2947
- empty_label: $(e.empty_label),
2948
- breakdown: i,
2949
- drillthrough: o
2950
- };
2951
- }
2952
- function nn(e, t) {
2953
- let n = (e, n) => new Intl.NumberFormat(t, {
2954
- style: "unit",
2955
- unit: e,
2956
- unitDisplay: "narrow"
2957
- }).format(n);
2958
- return e >= 86400 ? n("day", Math.floor(e / 86400)) : e >= 3600 ? n("hour", Math.floor(e / 3600)) : e >= 60 ? n("minute", Math.floor(e / 60)) : n("second", Math.max(0, Math.floor(e)));
2959
- }
2960
- function rn(e, t, n) {
2961
- let r = e("record.scorecard.not_available", "N/A"), i = e.language;
2962
- if (t == null || t === "") return r;
2963
- if (n === "number") return new Intl.NumberFormat(i).format(Number(t));
2964
- if (n === "percent_ratio") return new Intl.NumberFormat(i, {
2965
- style: "percent",
2966
- maximumFractionDigits: 2
2967
- }).format(Number(t));
2968
- if (n === "duration_seconds") {
2969
- let e = Number(t);
2970
- return Number.isFinite(e) ? nn(e, i) : r;
2971
- }
2972
- if (n === "timestamp") {
2973
- if (typeof t != "string" && typeof t != "number" && !(t instanceof Date)) return r;
2974
- let e = new Date(t);
2975
- return Number.isNaN(e.getTime()) ? r : e.toLocaleString(i, { timeZoneName: "short" });
2976
- }
2977
- return typeof t == "string" ? t : typeof t == "number" || typeof t == "bigint" || typeof t == "boolean" ? String(t) : r;
2978
- }
2979
- function an(e, t) {
2980
- return typeof e.id == "string" || typeof e.id == "number" ? String(e.id) : `row-${t}`;
2981
- }
2982
- function on(e, t) {
2983
- return !t || Object.entries(t).every(([t, n]) => e[t] === n);
2984
- }
2985
- function sn({ values: e, options: t }) {
2986
- let n = x(), i = x("errors"), a = xe(() => tn(t), [t]), o = B(), s = e.scope, c = a?.windows.some((e) => e.code === a.default_window) ? a.default_window : a?.windows[0]?.code ?? "", [l, u] = q(c), [d, f] = q("");
2987
- G(() => {
2988
- u(c);
2989
- }, [c]), G(() => {
2990
- f("");
2991
- }, [l]);
2992
- let p = a ? [{
2993
- field: a.scope_field,
2994
- op: "eq",
2995
- value: s
2996
- }, {
2997
- field: a.window_field,
2998
- op: "eq",
2999
- value: l
3000
- }] : [], m = g(a?.entity, {
3001
- per_page: 1,
3002
- filters: p
3003
- }, !!(a && s && l)), h = a?.breakdown, _ = h ? [{
3004
- field: h.scope_field,
3005
- op: "eq",
3006
- value: s
3007
- }, {
3008
- field: h.window_field,
3009
- op: "eq",
3010
- value: l
3011
- }] : [], v = g(h?.entity, {
3012
- per_page: h?.limit ?? 200,
3013
- sort: h?.sort,
3014
- filters: _
3015
- }, !!(h && s && l));
3016
- if (!a || !s) return /* @__PURE__ */ Y("div", {
3017
- role: "alert",
3018
- className: "rounded border border-destructive p-3 text-sm text-destructive",
3019
- children: i("record.scorecard_config_invalid", "Invalid entity_scorecard configuration.")
3020
- });
3021
- let y = m.data?.data?.[0], b = v.data?.data ?? [], S = h?.filter_field ? Array.from(new Set(b.map((e) => e[h.filter_field]).filter((e) => typeof e == "string" && e !== ""))).sort() : [], C = d && h?.filter_field ? b.filter((e) => e[h.filter_field] === d) : b, w = (e) => !d || !e.filtered || !h?.filter_field ? y?.[e.field] : b.find((t) => t[h.filter_field] === d && on(t, e.filtered?.where))?.[e.filtered.field], T = (e) => {
3022
- let t = a.drillthrough;
3023
- if (!t || !e.drillthrough_value) return;
3024
- let n = [{
3025
- field: t.scope_field,
3026
- op: "eq",
3027
- value: s
3028
- }, {
3029
- field: t.window_field,
3030
- op: "eq",
3031
- value: l
3032
- }];
3033
- t.filter_field && d && e.drillthrough_filter !== !1 && n.push({
3034
- field: t.filter_field,
3035
- op: "eq",
3036
- value: d
3037
- }), t.metric_field && n.push({
3038
- field: t.metric_field,
3039
- op: "eq",
3040
- value: e.drillthrough_value
3041
- }), o(t.route, { search: new URLSearchParams({ filters: JSON.stringify(n) }).toString() });
3042
- }, E = m.error ?? v.error, D = n(h?.filter_label) || n("record.scorecard.filter", "Filter");
3043
- return /* @__PURE__ */ X("div", {
3044
- className: "flex min-w-0 flex-col gap-4",
3045
- "aria-label": n(a.title) || n("record.scorecard.title", "Scorecard"),
3046
- children: [
3047
- /* @__PURE__ */ X("div", {
3048
- className: "flex flex-wrap items-start justify-between gap-3",
3049
- children: [/* @__PURE__ */ X("div", {
3050
- className: "min-w-0",
3051
- children: [
3052
- a.title && /* @__PURE__ */ Y("h3", {
3053
- className: "text-base font-semibold text-foreground",
3054
- children: n(a.title)
3055
- }),
3056
- a.description && /* @__PURE__ */ Y("p", {
3057
- className: "mt-1 text-sm text-muted-foreground",
3058
- children: n(a.description)
3059
- }),
3060
- a.intended_note && /* @__PURE__ */ Y("p", {
3061
- className: "mt-1 text-xs text-muted-foreground",
3062
- children: n(a.intended_note)
3063
- })
3064
- ]
3065
- }), /* @__PURE__ */ X("div", {
3066
- className: "flex flex-wrap items-center gap-2",
3067
- children: [/* @__PURE__ */ Y("div", {
3068
- role: "group",
3069
- "aria-label": n("record.scorecard.window", "Scorecard window"),
3070
- className: "inline-flex rounded border border-border p-1",
3071
- children: a.windows.map((e) => /* @__PURE__ */ Y("button", {
3072
- type: "button",
3073
- "aria-pressed": l === e.code,
3074
- onClick: () => u(e.code),
3075
- className: `rounded px-3 py-1.5 text-xs font-medium ${l === e.code ? "bg-accent text-accent-foreground" : "text-muted-foreground"}`,
3076
- children: n(e.label) || e.code
3077
- }, e.code))
3078
- }), h?.filter_field && /* @__PURE__ */ X("label", {
3079
- className: "flex items-center gap-2 text-xs text-muted-foreground",
3080
- children: [D, /* @__PURE__ */ X("select", {
3081
- "aria-label": D,
3082
- value: d,
3083
- onChange: (e) => f(e.target.value),
3084
- className: "rounded border border-border bg-background px-2 py-1.5 text-foreground",
3085
- children: [/* @__PURE__ */ Y("option", {
3086
- value: "",
3087
- children: n(h.all_label) || n("record.scorecard.all", "All")
3088
- }), S.map((e) => /* @__PURE__ */ Y("option", {
3089
- value: e,
3090
- children: e
3091
- }, e))]
3092
- })]
3093
- })]
3094
- })]
3095
- }),
3096
- E && /* @__PURE__ */ Y("div", {
3097
- role: "alert",
3098
- className: "rounded border border-destructive p-3 text-sm text-destructive",
3099
- children: r(i, E)
3100
- }),
3101
- !E && !m.isLoading && !y && /* @__PURE__ */ Y("div", {
3102
- className: "rounded border border-border p-6 text-center text-sm text-muted-foreground",
3103
- children: n(a.empty_label) || n("record.scorecard.empty", "No scorecard data.")
3104
- }),
3105
- y && /* @__PURE__ */ Y("div", {
3106
- className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",
3107
- children: a.metrics.map((e) => {
3108
- let t = w(e), r = !!(a.drillthrough && e.drillthrough_value), i = /* @__PURE__ */ X(J, { children: [
3109
- /* @__PURE__ */ Y("span", {
3110
- className: "text-xs font-medium text-muted-foreground",
3111
- children: n(e.label) || e.field
3112
- }),
3113
- /* @__PURE__ */ Y("strong", {
3114
- className: `mt-2 block text-2xl font-semibold ${e.attention && Number(t) > 0 ? "text-destructive" : "text-foreground"}`,
3115
- children: rn(n, t, e.format)
3116
- }),
3117
- e.help && /* @__PURE__ */ Y("span", {
3118
- className: "mt-1 block text-xs text-muted-foreground",
3119
- children: n(e.help)
3120
- })
3121
- ] });
3122
- return r ? /* @__PURE__ */ Y("button", {
3123
- type: "button",
3124
- onClick: () => T(e),
3125
- className: "rounded border border-border bg-card p-3 text-left hover:bg-surface",
3126
- children: i
3127
- }, e.field) : /* @__PURE__ */ Y("article", {
3128
- className: "rounded border border-border bg-card p-3",
3129
- children: i
3130
- }, e.field);
3131
- })
3132
- }),
3133
- h && /* @__PURE__ */ Y("div", {
3134
- className: "min-w-0 overflow-x-auto rounded border border-border",
3135
- children: /* @__PURE__ */ X("table", {
3136
- className: "w-full border-collapse text-sm",
3137
- children: [/* @__PURE__ */ Y("thead", {
3138
- className: "bg-surface text-left text-xs text-muted-foreground",
3139
- children: /* @__PURE__ */ Y("tr", { children: h.columns.map((e) => /* @__PURE__ */ Y("th", {
3140
- className: "border-b border-divider px-3 py-2 font-medium",
3141
- children: n(e.label) || e.field
3142
- }, e.field)) })
3143
- }), /* @__PURE__ */ X("tbody", { children: [C.map((e, t) => /* @__PURE__ */ Y("tr", {
3144
- className: "border-b border-divider last:border-0",
3145
- children: h.columns.map((t) => /* @__PURE__ */ Y("td", {
3146
- className: "px-3 py-2 text-foreground",
3147
- children: rn(n, e[t.field], t.format)
3148
- }, t.field))
3149
- }, an(e, t))), !v.isLoading && C.length === 0 && /* @__PURE__ */ Y("tr", { children: /* @__PURE__ */ Y("td", {
3150
- colSpan: Math.max(1, h.columns.length),
3151
- className: "px-3 py-6 text-center text-muted-foreground",
3152
- children: n(h.empty_label) || n("record.scorecard.breakdown_empty", "No breakdown rows.")
3153
- }) })] })]
3154
- })
3155
- })
3156
- ]
3157
- });
3158
- }
3159
- //#endregion
3160
- //#region src/components/detail-layout/widgets/builtins.ts
3161
- var cn = !1;
3162
- function ln() {
3163
- cn ||= (L("json_diff", $t), L("entity_scorecard", sn), !0);
3164
- }
3165
- //#endregion
3166
- //#region src/components/detail-layout/widgets/WidgetHost.tsx
3167
- ln();
3168
- function un({ config: e, ctx: t }) {
3169
- let n = x("errors"), r = ee(e.type);
3170
- if (!r) return /* @__PURE__ */ X("span", {
3171
- className: "text-sm text-muted-foreground",
3172
- children: [
3173
- n("record.widget_unknown", "This page names a widget this deployment does not have."),
3174
- " ",
3175
- /* @__PURE__ */ Y("code", { children: e.type })
3176
- ]
3177
- });
3178
- let i = e.inputs ?? {}, a = t.record, o = {};
3179
- for (let [e, t] of Object.entries(i)) o[e] = a[t];
3180
- return /* @__PURE__ */ Y("div", {
3181
- style: {
3182
- minWidth: 0,
3183
- maxWidth: "100%",
3184
- overflowX: "auto",
3185
- WebkitOverflowScrolling: "touch"
3186
- },
3187
- children: /* @__PURE__ */ Y(r, {
3188
- inputs: i,
3189
- values: o,
3190
- record: a,
3191
- options: e.options,
3192
- ctx: t
3193
- })
3194
- });
3195
- }
3196
- //#endregion
3197
- //#region src/components/detail-layout/LayoutRenderer.tsx
3198
- function dn({ nodes: e, ctx: t }) {
3199
- return /* @__PURE__ */ Y(J, { children: e.map((e, n) => /* @__PURE__ */ Y(fn, {
3200
- node: e,
3201
- ctx: t
3202
- }, n)) });
3203
- }
3204
- function fn({ node: e, ctx: t }) {
3205
- return e.row ? /* @__PURE__ */ Y(De, {
3206
- config: e.row,
3207
- ctx: t
3208
- }) : e.column ? /* @__PURE__ */ Y(Ae, {
3209
- config: e.column,
3210
- node: e,
3211
- ctx: t
3212
- }) : e.tabs ? /* @__PURE__ */ Y(Pe, {
3213
- config: e.tabs,
3214
- ctx: t
3215
- }) : e.section ? /* @__PURE__ */ Y(Fe, {
3216
- config: e.section,
3217
- ctx: t
3218
- }) : e.children ? /* @__PURE__ */ Y(Nt, {
3219
- node: e,
3220
- ctx: t
3221
- }) : e.associated ? /* @__PURE__ */ Y(fe, {
3222
- node: e,
3223
- ctx: t
3224
- }) : e.fields ? /* @__PURE__ */ Y(Pt, {
3225
- fields: e.fields,
3226
- ctx: t
3227
- }) : e.properties == null ? e.statuses == null ? e.widget ? /* @__PURE__ */ Y(un, {
3228
- config: e.widget,
3229
- ctx: t
3230
- }) : null : /* @__PURE__ */ Y(Ht, {
3231
- node: e,
3232
- ctx: t
3233
- }) : /* @__PURE__ */ Y(Lt, {
3234
- node: e,
3235
- ctx: t
3236
- });
3237
- }
3238
- //#endregion
3239
- export { Bt as n, dn as t };