@asteby/metacore-runtime-react 53.24.0 → 53.26.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 (383) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/action-modal-dispatcher.d.ts +3 -3
  3. package/dist/action-modal-dispatcher.js +31 -31
  4. package/dist/action-priority.d.ts +1 -1
  5. package/dist/activity-diff.d.ts +1 -1
  6. package/dist/activity-diff.js +1 -1
  7. package/dist/activity-timeline.d.ts +2 -2
  8. package/dist/activity-timeline.js +3 -3
  9. package/dist/activity-value-renderer.d.ts +1 -1
  10. package/dist/activity-value-renderer.js +3 -3
  11. package/dist/addon-loader.d.ts +1 -1
  12. package/dist/addon-loader.js +3 -3
  13. package/dist/addon-page-host.js +1 -1
  14. package/dist/addon-page-loader.d.ts +2 -2
  15. package/dist/addon-page-loader.js +3 -3
  16. package/dist/api-context.js +4 -4
  17. package/dist/approval-gate.d.ts +1 -1
  18. package/dist/approval-gate.js +5 -5
  19. package/dist/assist-interview.d.ts +1 -1
  20. package/dist/assist-interview.js +1 -1
  21. package/dist/attention/index.d.ts +3 -3
  22. package/dist/attention/index.js +3 -3
  23. package/dist/attention/use-nav-badges.js +2 -2
  24. package/dist/attribute-classes.d.ts +1 -1
  25. package/dist/audit-info.d.ts +1 -1
  26. package/dist/audit-info.js +5 -5
  27. package/dist/bulk-image-dialog.d.ts +1 -1
  28. package/dist/bulk-image-dialog.js +5 -5
  29. package/dist/bulk-image-import.d.ts +2 -2
  30. package/dist/bulk-image-import.js +1 -1
  31. package/dist/bulk-image-target.d.ts +1 -1
  32. package/dist/bulk-image-target.js +1 -1
  33. package/dist/bulk-image-wizard.d.ts +1 -1
  34. package/dist/bulk-image-wizard.js +5 -5
  35. package/dist/business/catalog-product-search.d.ts +1 -1
  36. package/dist/business/customer-picker.js +4 -4
  37. package/dist/business/document-editor-model.d.ts +3 -3
  38. package/dist/business/document-editor-model.js +4 -4
  39. package/dist/business/document-editor-panels.d.ts +3 -3
  40. package/dist/business/document-editor-panels.js +1 -1
  41. package/dist/business/document-editor.d.ts +2 -2
  42. package/dist/business/document-editor.js +22 -22
  43. package/dist/business/document-lines.d.ts +2 -2
  44. package/dist/business/document-lines.js +3 -3
  45. package/dist/business/field-errors.d.ts +1 -1
  46. package/dist/business/field-errors.js +1 -1
  47. package/dist/business/format.js +1 -1
  48. package/dist/business/index.d.ts +29 -29
  49. package/dist/business/index.js +29 -29
  50. package/dist/business/inspection-checklist.d.ts +1 -1
  51. package/dist/business/inspection-checklist.js +2 -2
  52. package/dist/business/inspection.d.ts +1 -1
  53. package/dist/business/inspection.js +2 -2
  54. package/dist/business/line-items-editor.d.ts +3 -3
  55. package/dist/business/line-items-editor.js +5 -5
  56. package/dist/business/line-items.d.ts +1 -1
  57. package/dist/business/line-items.js +2 -2
  58. package/dist/business/line-product-cell.d.ts +2 -2
  59. package/dist/business/line-product-cell.js +2 -2
  60. package/dist/business/payment-allocator.d.ts +1 -1
  61. package/dist/business/payment-allocator.js +2 -2
  62. package/dist/business/payment-capture.d.ts +1 -1
  63. package/dist/business/payment-capture.js +3 -3
  64. package/dist/business/payment.js +1 -1
  65. package/dist/business/print-send-dialog.js +1 -1
  66. package/dist/business/product-display.d.ts +1 -1
  67. package/dist/business/product-options.d.ts +1 -1
  68. package/dist/business/product-options.js +4 -4
  69. package/dist/business/product-picker.d.ts +1 -1
  70. package/dist/business/product-picker.js +3 -3
  71. package/dist/business/product-search.d.ts +2 -2
  72. package/dist/business/product-search.js +1 -1
  73. package/dist/business/refund-destination.d.ts +1 -1
  74. package/dist/business/refund-destination.js +2 -2
  75. package/dist/business/refund.js +1 -1
  76. package/dist/business/relate-documents.js +1 -1
  77. package/dist/business/return-wizard.d.ts +2 -2
  78. package/dist/business/return-wizard.js +4 -4
  79. package/dist/business/return.d.ts +2 -2
  80. package/dist/business/return.js +2 -2
  81. package/dist/business/vehicle-picker.js +3 -3
  82. package/dist/cache-coherence.js +3 -3
  83. package/dist/capability-providers/index.d.ts +3 -3
  84. package/dist/capability-providers/index.js +3 -3
  85. package/dist/capability-providers/provider-sortable-list.d.ts +1 -1
  86. package/dist/capability-providers/provider-sortable-list.js +1 -1
  87. package/dist/collection-cell.js +1 -1
  88. package/dist/column-filter-field.d.ts +1 -1
  89. package/dist/column-visibility.d.ts +1 -1
  90. package/dist/custom-stages.d.ts +2 -2
  91. package/dist/custom-stages.js +1 -1
  92. package/dist/dashboard-grid.d.ts +2 -2
  93. package/dist/dashboard-grid.d.ts.map +1 -1
  94. package/dist/dashboard-grid.js +22 -20
  95. package/dist/dashboard-types.d.ts +6 -0
  96. package/dist/dashboard-types.d.ts.map +1 -1
  97. package/dist/dialogs/create-record-dialog.d.ts +1 -1
  98. package/dist/dialogs/create-record-dialog.js +1 -1
  99. package/dist/dialogs/dynamic-record.d.ts +5 -5
  100. package/dist/dialogs/dynamic-record.js +41 -41
  101. package/dist/dialogs/export.d.ts +1 -1
  102. package/dist/dialogs/export.js +2 -2
  103. package/dist/dialogs/import.d.ts +1 -1
  104. package/dist/dialogs/import.js +3 -3
  105. package/dist/dialogs/inline-relation-rows.d.ts +3 -3
  106. package/dist/dialogs/inline-relation-rows.js +3 -3
  107. package/dist/dialogs/inline-relations.d.ts +3 -3
  108. package/dist/dialogs/inline-relations.js +3 -3
  109. package/dist/dialogs/normalize-submit.d.ts +1 -1
  110. package/dist/dialogs/normalize-submit.js +3 -3
  111. package/dist/dialogs/use-inline-relations.d.ts +1 -1
  112. package/dist/dialogs/use-inline-relations.js +3 -3
  113. package/dist/dialogs/view-record-dialog.d.ts +1 -1
  114. package/dist/dialogs/view-record-dialog.js +1 -1
  115. package/dist/display-value.js +1 -1
  116. package/dist/document/action-bar.d.ts +1 -1
  117. package/dist/document/action-bar.js +1 -1
  118. package/dist/document/document-header.d.ts +2 -2
  119. package/dist/document/document-header.js +2 -2
  120. package/dist/document/document-page.d.ts +3 -3
  121. package/dist/document/document-page.js +9 -9
  122. package/dist/document/document-timeline.d.ts +2 -2
  123. package/dist/document/document-timeline.js +2 -2
  124. package/dist/document/evaluate.d.ts +1 -1
  125. package/dist/document/evaluate.js +1 -1
  126. package/dist/document/format.d.ts +1 -1
  127. package/dist/document/index.d.ts +13 -13
  128. package/dist/document/index.js +13 -13
  129. package/dist/document/registry.d.ts +1 -1
  130. package/dist/document/secondary-bar.js +2 -2
  131. package/dist/document/smart-buttons.js +1 -1
  132. package/dist/document/status-badge.d.ts +1 -1
  133. package/dist/document/use-document-sources.d.ts +1 -1
  134. package/dist/document/use-document-sources.js +2 -2
  135. package/dist/document-form-dialog.d.ts +2 -2
  136. package/dist/document-form-dialog.js +16 -16
  137. package/dist/document-template-editor.js +1 -1
  138. package/dist/dynamic-columns-shim.d.ts +1 -1
  139. package/dist/dynamic-columns.d.ts +11 -3
  140. package/dist/dynamic-columns.d.ts.map +1 -1
  141. package/dist/dynamic-columns.js +52 -26
  142. package/dist/dynamic-crud-page.d.ts +2 -2
  143. package/dist/dynamic-crud-page.d.ts.map +1 -1
  144. package/dist/dynamic-crud-page.js +22 -19
  145. package/dist/dynamic-date-field.d.ts +1 -1
  146. package/dist/dynamic-date-field.js +1 -1
  147. package/dist/dynamic-form-schema.d.ts +2 -2
  148. package/dist/dynamic-form-schema.js +4 -4
  149. package/dist/dynamic-form.d.ts +10 -10
  150. package/dist/dynamic-form.js +24 -24
  151. package/dist/dynamic-icon.js +1 -1
  152. package/dist/dynamic-kanban.d.ts +3 -3
  153. package/dist/dynamic-kanban.js +25 -25
  154. package/dist/dynamic-line-items.d.ts +1 -1
  155. package/dist/dynamic-line-items.js +6 -6
  156. package/dist/dynamic-multi-select-field.d.ts +1 -1
  157. package/dist/dynamic-multi-select-field.js +7 -7
  158. package/dist/dynamic-relation-helpers.d.ts +1 -1
  159. package/dist/dynamic-relation-helpers.js +2 -2
  160. package/dist/dynamic-relation.d.ts +2 -2
  161. package/dist/dynamic-relation.js +15 -15
  162. package/dist/dynamic-relations.d.ts +2 -2
  163. package/dist/dynamic-relations.js +1 -1
  164. package/dist/dynamic-row-actions.d.ts +1 -1
  165. package/dist/dynamic-row-actions.js +5 -5
  166. package/dist/dynamic-select-field.d.ts +3 -3
  167. package/dist/dynamic-select-field.js +11 -11
  168. package/dist/dynamic-table.d.ts +5 -3
  169. package/dist/dynamic-table.d.ts.map +1 -1
  170. package/dist/dynamic-table.js +48 -36
  171. package/dist/dynamic-view.d.ts +4 -4
  172. package/dist/dynamic-view.js +7 -7
  173. package/dist/entity-select.js +4 -4
  174. package/dist/field-validation-ui.d.ts +2 -2
  175. package/dist/field-widget-registry.d.ts +1 -1
  176. package/dist/form-layout-ui.d.ts +1 -1
  177. package/dist/form-layout.d.ts +1 -1
  178. package/dist/form-layout.js +1 -1
  179. package/dist/genui/index.d.ts +1 -1
  180. package/dist/genui/index.js +1 -1
  181. package/dist/genui/settings-block.d.ts +1 -1
  182. package/dist/genui/settings-block.js +3 -3
  183. package/dist/host-api-client.d.ts +11 -1
  184. package/dist/host-api-client.d.ts.map +1 -1
  185. package/dist/host-api-client.js +21 -14
  186. package/dist/host-api.d.ts +9 -1
  187. package/dist/host-api.d.ts.map +1 -1
  188. package/dist/host-api.js +57 -2
  189. package/dist/hotswap-reload-policy.d.ts +1 -1
  190. package/dist/hotswap-reload-policy.js +1 -1
  191. package/dist/icon-picker-field.d.ts +1 -1
  192. package/dist/icon-picker-field.js +3 -3
  193. package/dist/icon-resolvers.d.ts +1 -1
  194. package/dist/icon-resolvers.js +1 -1
  195. package/dist/icon-spec.js +1 -1
  196. package/dist/index.d.ts +165 -163
  197. package/dist/index.d.ts.map +1 -1
  198. package/dist/index.js +148 -147
  199. package/dist/license/index.d.ts +6 -6
  200. package/dist/license/index.js +6 -6
  201. package/dist/license/license-expiry-banner.d.ts +1 -1
  202. package/dist/license/license-expiry-banner.js +3 -3
  203. package/dist/license/license-gate.d.ts +1 -1
  204. package/dist/license/license-gate.js +5 -5
  205. package/dist/license/license-status-badge.d.ts +1 -1
  206. package/dist/license/license-status-badge.js +1 -1
  207. package/dist/license/use-license-t.d.ts +1 -1
  208. package/dist/license/use-license-t.js +1 -1
  209. package/dist/license/view.d.ts +1 -1
  210. package/dist/license/view.js +1 -1
  211. package/dist/list-include.d.ts +1 -1
  212. package/dist/manifest-hotswap-subscriber.d.ts +1 -1
  213. package/dist/manifest-hotswap-subscriber.js +1 -1
  214. package/dist/metadata-cache.d.ts +1 -1
  215. package/dist/metadata-cache.js +1 -1
  216. package/dist/model-action-toolbar.d.ts +1 -1
  217. package/dist/model-action-toolbar.js +7 -7
  218. package/dist/model-labels.d.ts +38 -0
  219. package/dist/model-labels.d.ts.map +1 -0
  220. package/dist/model-labels.js +35 -0
  221. package/dist/nav-permissions.d.ts +1 -1
  222. package/dist/nav-permissions.js +1 -1
  223. package/dist/navigation-builder.d.ts +1 -1
  224. package/dist/navigation-builder.js +1 -1
  225. package/dist/option-display.d.ts +1 -1
  226. package/dist/option-display.js +2 -2
  227. package/dist/option-filter.d.ts +1 -1
  228. package/dist/option-when.d.ts +1 -1
  229. package/dist/org-runtime-provider.d.ts +2 -2
  230. package/dist/org-runtime-provider.js +2 -2
  231. package/dist/permissions-context.d.ts +1 -1
  232. package/dist/permissions-manager.js +4 -4
  233. package/dist/primitives/aging.js +1 -1
  234. package/dist/primitives/allocation.js +1 -1
  235. package/dist/primitives/approvals.d.ts +1 -1
  236. package/dist/primitives/contributions.js +1 -1
  237. package/dist/primitives/document-kinds.d.ts +1 -1
  238. package/dist/primitives/index.d.ts +7 -7
  239. package/dist/primitives/index.js +7 -7
  240. package/dist/primitives/panels.d.ts +1 -1
  241. package/dist/primitives/use-contributions.d.ts +2 -2
  242. package/dist/primitives/use-contributions.js +2 -2
  243. package/dist/print-document-button.d.ts +1 -1
  244. package/dist/print-document-button.js +1 -1
  245. package/dist/provenance.js +3 -3
  246. package/dist/query-batch.d.ts +1 -1
  247. package/dist/query-batch.js +1 -1
  248. package/dist/record-actions.d.ts +2 -2
  249. package/dist/record-actions.js +2 -2
  250. package/dist/record-history.d.ts +2 -2
  251. package/dist/record-history.js +3 -3
  252. package/dist/record-picker-dialog.js +3 -3
  253. package/dist/record-picker-option.d.ts +1 -1
  254. package/dist/record-picker-option.js +1 -1
  255. package/dist/record-picker.js +2 -2
  256. package/dist/record-prefill-bar.js +1 -1
  257. package/dist/relation-gallery.js +1 -1
  258. package/dist/requires-addon.d.ts +1 -1
  259. package/dist/rich-cells.js +2 -2
  260. package/dist/rich-url.js +1 -1
  261. package/dist/row-actions-menu.js +5 -5
  262. package/dist/server-error.js +2 -2
  263. package/dist/setup/addon-config-surface.d.ts +3 -3
  264. package/dist/setup/addon-config-surface.js +10 -10
  265. package/dist/setup/connector-blocks-model.d.ts +1 -1
  266. package/dist/setup/connector-blocks.d.ts +1 -1
  267. package/dist/setup/connector-blocks.js +6 -6
  268. package/dist/setup/flow-model.d.ts +1 -1
  269. package/dist/setup/health-card.d.ts +1 -1
  270. package/dist/setup/health-card.js +2 -2
  271. package/dist/setup/index.d.ts +12 -12
  272. package/dist/setup/index.js +12 -12
  273. package/dist/setup/records-table.d.ts +1 -1
  274. package/dist/setup/records-table.js +2 -2
  275. package/dist/setup/setup-flow.d.ts +1 -1
  276. package/dist/setup/setup-flow.js +7 -7
  277. package/dist/setup/setup-form-step.d.ts +1 -1
  278. package/dist/setup/setup-form-step.js +4 -4
  279. package/dist/setup/step-status-badge.d.ts +1 -1
  280. package/dist/setup/step-status-badge.js +2 -2
  281. package/dist/setup/tone.d.ts +1 -1
  282. package/dist/setup/types.d.ts +2 -2
  283. package/dist/sidebar-layout-manager.d.ts +1 -1
  284. package/dist/sidebar-layout-manager.js +2 -2
  285. package/dist/slot.js +1 -1
  286. package/dist/slots/addon-slot.js +4 -4
  287. package/dist/slots/index.d.ts +2 -2
  288. package/dist/slots/index.js +2 -2
  289. package/dist/stage-automations.d.ts +2 -2
  290. package/dist/stage-automations.js +1 -1
  291. package/dist/stage-layout.js +1 -1
  292. package/dist/stage-overrides.d.ts +1 -1
  293. package/dist/stage-overrides.js +1 -1
  294. package/dist/supervised-action.js +1 -1
  295. package/dist/testing.d.ts +1 -1
  296. package/dist/testing.js +1 -1
  297. package/dist/tri-state-boolean.d.ts +2 -2
  298. package/dist/tri-state-boolean.js +1 -1
  299. package/dist/types.d.ts +4 -1
  300. package/dist/types.d.ts.map +1 -1
  301. package/dist/upload-field.d.ts +1 -1
  302. package/dist/upload-field.js +4 -4
  303. package/dist/use-addon-installed-probe.js +3 -3
  304. package/dist/use-addon-settings.d.ts +1 -1
  305. package/dist/use-addon-settings.js +1 -1
  306. package/dist/use-dynamic-filters.d.ts +2 -2
  307. package/dist/use-dynamic-filters.js +6 -6
  308. package/dist/use-edge-device.d.ts +1 -1
  309. package/dist/use-edge-device.js +2 -2
  310. package/dist/use-facet-loaders.d.ts +1 -1
  311. package/dist/use-facet-loaders.js +1 -1
  312. package/dist/use-flip-animation.d.ts +1 -1
  313. package/dist/use-flip-animation.js +1 -1
  314. package/dist/use-host-api-client.d.ts +2 -2
  315. package/dist/use-host-api-client.d.ts.map +1 -1
  316. package/dist/use-host-api-client.js +6 -4
  317. package/dist/use-option-ids.d.ts +1 -1
  318. package/dist/use-option-ids.js +2 -2
  319. package/dist/use-options-resolver.d.ts +2 -2
  320. package/dist/use-options-resolver.js +4 -4
  321. package/dist/use-org-document-templates.js +1 -1
  322. package/dist/use-print-document.js +1 -1
  323. package/dist/use-record-mutation-tick.js +1 -1
  324. package/dist/validator.d.ts +2 -2
  325. package/dist/validator.js +1 -1
  326. package/dist/view-system/card-spec.d.ts +1 -1
  327. package/dist/view-system/cards-view.d.ts +1 -1
  328. package/dist/view-system/cards-view.js +2 -2
  329. package/dist/view-system/index.d.ts +9 -9
  330. package/dist/view-system/index.js +9 -9
  331. package/dist/view-system/model-view.d.ts +3 -3
  332. package/dist/view-system/model-view.js +7 -7
  333. package/dist/view-system/saved-views.d.ts +1 -1
  334. package/dist/view-system/use-view-mode.d.ts +1 -1
  335. package/dist/view-system/view-state.d.ts +1 -1
  336. package/dist/view-system/view-switcher.d.ts +1 -1
  337. package/dist/view-system/view-toolbar.d.ts +1 -1
  338. package/dist/view-system/view-toolbar.js +2 -2
  339. package/dist/views/calendar-view.d.ts +1 -1
  340. package/dist/views/calendar-view.js +2 -2
  341. package/dist/views/chart-view.d.ts +2 -2
  342. package/dist/views/chart-view.js +2 -2
  343. package/dist/views/data-source.d.ts +2 -2
  344. package/dist/views/index.d.ts +3 -3
  345. package/dist/views/index.js +2 -2
  346. package/dist/views/map-view.d.ts +1 -1
  347. package/dist/views/map-view.js +3 -3
  348. package/dist/views/panels.d.ts +1 -1
  349. package/dist/views/panels.js +3 -3
  350. package/dist/views/registry.d.ts +2 -2
  351. package/dist/views/registry.js +12 -12
  352. package/dist/views/split-view.d.ts +1 -1
  353. package/dist/views/split-view.js +4 -4
  354. package/dist/views/timeline-view.d.ts +1 -1
  355. package/dist/views/timeline-view.js +3 -3
  356. package/dist/views/types.d.ts +2 -2
  357. package/dist/widgets/charts.d.ts +1 -1
  358. package/dist/widgets/charts.js +2 -2
  359. package/dist/widgets/lazy-charts.d.ts +1 -1
  360. package/dist/widgets/lazy-charts.js +2 -2
  361. package/dist/widgets/renderers.d.ts +2 -2
  362. package/dist/widgets/renderers.js +2 -2
  363. package/dist/widgets/widget-card.d.ts +1 -1
  364. package/dist/widgets/widget-card.js +2 -2
  365. package/dist/widgets/widget-renderer.d.ts +1 -1
  366. package/dist/widgets/widget-renderer.js +4 -4
  367. package/package.json +10 -10
  368. package/src/__tests__/host-api-client.test.tsx +16 -0
  369. package/src/__tests__/host-api.test.ts +50 -0
  370. package/src/__tests__/initials-avatar-cell.test.tsx +54 -0
  371. package/src/__tests__/load-guard.test.tsx +94 -0
  372. package/src/__tests__/model-labels.test.tsx +31 -0
  373. package/src/dashboard-grid.tsx +49 -35
  374. package/src/dashboard-types.ts +6 -0
  375. package/src/dynamic-columns.tsx +40 -9
  376. package/src/dynamic-crud-page.tsx +10 -7
  377. package/src/dynamic-table.tsx +38 -12
  378. package/src/host-api-client.ts +31 -14
  379. package/src/host-api.ts +54 -1
  380. package/src/index.ts +5 -1
  381. package/src/model-labels.ts +80 -0
  382. package/src/types.ts +3 -0
  383. package/src/use-host-api-client.ts +5 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asteby/metacore-runtime-react",
3
- "version": "53.24.0",
3
+ "version": "53.26.0",
4
4
  "description": "React runtime for metacore hosts — renders addon contributions dynamically",
5
5
  "repository": {
6
6
  "type": "git",
@@ -37,8 +37,8 @@
37
37
  }
38
38
  },
39
39
  "dependencies": {
40
- "@asteby/metacore-charts": "^0.1.1",
41
- "@asteby/metacore-lib": "^0.11.0",
40
+ "@asteby/metacore-charts": "^0.1.2",
41
+ "@asteby/metacore-lib": "^0.12.1",
42
42
  "@dnd-kit/core": "^6.3.0",
43
43
  "@dnd-kit/sortable": "^10.0.0",
44
44
  "@dnd-kit/utilities": "^3.2.2",
@@ -47,8 +47,8 @@
47
47
  "zod": "^4.3.0"
48
48
  },
49
49
  "peerDependencies": {
50
- "@asteby/metacore-sdk": "^3.20.0",
51
- "@asteby/metacore-ui": "^2.34.0",
50
+ "@asteby/metacore-sdk": "^3.22.0",
51
+ "@asteby/metacore-ui": "^2.37.1",
52
52
  "@tanstack/react-query": ">=5",
53
53
  "@tanstack/react-router": ">=1.100",
54
54
  "@tanstack/react-table": ">=8",
@@ -63,7 +63,7 @@
63
63
  "zustand": ">=5",
64
64
  "@module-federation/runtime": ">=2.5",
65
65
  "@testing-library/react": ">=14",
66
- "@asteby/metacore-genui": "^2.9.1"
66
+ "@asteby/metacore-genui": "^2.9.3"
67
67
  },
68
68
  "peerDependenciesMeta": {
69
69
  "@tanstack/react-router": {
@@ -83,8 +83,8 @@
83
83
  }
84
84
  },
85
85
  "devDependencies": {
86
- "@asteby/metacore-sdk": "3.20.0",
87
- "@asteby/metacore-ui": "2.34.0",
86
+ "@asteby/metacore-sdk": "3.22.0",
87
+ "@asteby/metacore-ui": "2.37.1",
88
88
  "@tanstack/react-query": "^5.95.0",
89
89
  "@tanstack/react-router": "^1.168.0",
90
90
  "@tanstack/react-table": "^8.20.0",
@@ -105,10 +105,10 @@
105
105
  "vitest": "^4.0.0",
106
106
  "zustand": "^5.0.0",
107
107
  "@module-federation/runtime": "^2.5.0",
108
- "@asteby/metacore-genui": "2.9.1"
108
+ "@asteby/metacore-genui": "2.9.3"
109
109
  },
110
110
  "scripts": {
111
- "build": "tsc -p tsconfig.json",
111
+ "build": "tsc -p tsconfig.json && node ../../scripts/fix-dist-esm-imports.mjs",
112
112
  "dev": "tsc -w -p tsconfig.json",
113
113
  "typecheck": "tsc -p tsconfig.json --noEmit",
114
114
  "test": "vitest run",
@@ -117,3 +117,19 @@ describe('useHostApiClient', () => {
117
117
  spy.mockRestore()
118
118
  })
119
119
  })
120
+
121
+ describe('request headers', () => {
122
+ it('merges defaultHeaders with per-call headers (per-call wins) and passes them to the HostApi', async () => {
123
+ const get = vi.fn(async () => ({ ok: 1 }))
124
+ const c = createHostApiClient(stub({ get: get as never }), { defaultHeaders: { 'X-A': '1', 'X-B': '1' } })
125
+ await c.get('/x', { headers: { 'X-B': '2', 'X-Correlation-ID': 'cid' } })
126
+ expect(get).toHaveBeenCalledWith('/x', { headers: { 'X-A': '1', 'X-B': '2', 'X-Correlation-ID': 'cid' } })
127
+ })
128
+
129
+ it('is additive: no headers means the config is untouched', async () => {
130
+ const post = vi.fn(async () => ({}))
131
+ const c = createHostApiClient(stub({ post: post as never }))
132
+ await c.post('/x', { a: 1 })
133
+ expect(post).toHaveBeenCalledWith('/x', { a: 1 }, undefined)
134
+ })
135
+ })
@@ -151,3 +151,53 @@ describe('createHostApi', () => {
151
151
  expect(e.message).toBe('Network error')
152
152
  })
153
153
  })
154
+
155
+ describe('createHostApi remote headers', () => {
156
+ it('forwards extra headers but never lets a remote override host-owned ones', async () => {
157
+ const client = axiosLike()
158
+ const api = createHostApi(client)
159
+ await api.post('/data/sales', { a: 1 }, {
160
+ headers: {
161
+ 'X-Correlation-ID': 'cid-1',
162
+ Authorization: 'Bearer evil',
163
+ authorization: 'Bearer evil',
164
+ 'X-Organization-ID': 'other-org',
165
+ 'x-organization-id': 'other-org',
166
+ 'X-Branch-ID': '9',
167
+ 'Accept-Language': 'xx',
168
+ Cookie: 'a=b',
169
+ 'X-Bad': 'a\r\nInjected: 1',
170
+ },
171
+ })
172
+ expect(client.post).toHaveBeenCalledWith('/data/sales', { a: 1 }, { headers: { 'X-Correlation-ID': 'cid-1' } })
173
+ await api.get('/x', { headers: { Authorization: 'Bearer evil' } })
174
+ expect(client.get).toHaveBeenLastCalledWith('/x', {})
175
+ })
176
+
177
+ it('also protects forwarding/identity headers and Proxy-*', async () => {
178
+ const client = axiosLike()
179
+ await createHostApi(client).get('/x', {
180
+ headers: {
181
+ 'X-Forwarded-Host': 'evil.example',
182
+ 'X-Forwarded-Proto': 'http',
183
+ 'X-Forwarded-For': '1.1.1.1',
184
+ Forwarded: 'for=1.1.1.1',
185
+ 'X-Real-IP': '1.1.1.1',
186
+ 'X-Storefront-Domain': 'evil.example',
187
+ 'X-API-Key': 'k',
188
+ 'X-HTTP-Method-Override': 'DELETE',
189
+ 'Proxy-Foo': 'x',
190
+ 'X-Correlation-ID': 'ok',
191
+ },
192
+ })
193
+ expect(client.get).toHaveBeenLastCalledWith('/x', { headers: { 'X-Correlation-ID': 'ok' } })
194
+ })
195
+
196
+ it('batchGets: a GET with per-call headers is not grouped into POST /q', async () => {
197
+ const client = axiosLike()
198
+ const api = createHostApi(client, { batchGets: true })
199
+ await api.get('/data/Shipment', { headers: { 'X-Correlation-ID': 'c1' } })
200
+ expect(client.get).toHaveBeenCalledWith('/data/Shipment', { headers: { 'X-Correlation-ID': 'c1' } })
201
+ expect(client.post).not.toHaveBeenCalled()
202
+ })
203
+ })
@@ -0,0 +1,54 @@
1
+ // @vitest-environment happy-dom
2
+ // Celda `initial`/`avatar` sin imagen: iniciales + color estable por texto, sin red.
3
+ import { afterEach, describe, expect, it } from 'vitest'
4
+ import { cleanup, render } from '@testing-library/react'
5
+ import { looksLikeImageRef, makeDefaultGetDynamicColumns, resolveAvatarSrc } from '../dynamic-columns'
6
+ import type { ColumnDefinition, TableMetadata } from '../types'
7
+
8
+ afterEach(cleanup)
9
+
10
+ function renderCell(col: Record<string, unknown>, row: Record<string, unknown>) {
11
+ const meta = {
12
+ title: 't', endpoint: '/x', columns: [{ label: 'C', ...col }], actions: [],
13
+ perPageOptions: [10], defaultPerPage: 10, searchPlaceholder: '',
14
+ enableCRUDActions: false, hasActions: false,
15
+ } as unknown as TableMetadata
16
+ const cols = makeDefaultGetDynamicColumns({ getImageUrl: (p: string) => p, apiBaseUrl: 'https://api.test' })(meta, undefined, undefined, 'es')
17
+ const key = col.key as string
18
+ const c = cols.find((x) => (x as { accessorKey?: string }).accessorKey === key || x.id === key)
19
+ if (!c || typeof c.cell !== 'function') throw new Error('columna no encontrada')
20
+ const node = (c.cell as (ctx: unknown) => React.ReactNode)({ row: { original: row }, getValue: () => row[key] })
21
+ return render(<>{node}</>).container
22
+ }
23
+
24
+ const bg = (el: HTMLElement) => el.style.backgroundColor
25
+
26
+ describe('looksLikeImageRef', () => {
27
+ it('acepta urls, rutas y archivos de imagen; rechaza etiquetas', () => {
28
+ for (const ok of ['https://x/y', '/a/b.png', 'a/b', '2.png', 'data:image/png;base64,AA', 'f.JPG?v=1']) expect(looksLikeImageRef(ok)).toBe(true)
29
+ for (const no of ['', 'Ana Perez', 'Ana', 'j.perez']) expect(looksLikeImageRef(no)).toBe(false)
30
+ })
31
+ it('resolveAvatarSrc no fabrica una URL a partir de un nombre', () => {
32
+ const c = { key: 'avatar', label: 'A', type: 'avatar' } as unknown as ColumnDefinition
33
+ expect(resolveAvatarSrc(c, { avatar: 'Ana Perez' }, 'Ana Perez', 'https://api.test')).toBeUndefined()
34
+ expect(resolveAvatarSrc(c, { avatar: '2.png' }, '2.png', 'https://api.test')).toBe('https://api.test2.png')
35
+ })
36
+ })
37
+
38
+ describe('cellStyle initial / avatar sin imagen', () => {
39
+ it.each([['initial', undefined], ['avatar', { tone: 'auto' }]])('%s: iniciales, sin <img>, color estable', (style, styleConfig) => {
40
+ const col = { key: 'name', type: 'text', cellStyle: style, styleConfig }
41
+ const a = renderCell(col, { name: 'Ana Perez', avatar: 'Ana Perez' })
42
+ expect(a.querySelector('img')).toBeNull()
43
+ expect(a.textContent).toContain('AP')
44
+ const colorA = bg(a.querySelector('[data-slot="avatar-fallback"], span[style]') as HTMLElement)
45
+ cleanup()
46
+ const b = renderCell(col, { name: 'Ana Perez' })
47
+ expect(bg(b.querySelector('[data-slot="avatar-fallback"], span[style]') as HTMLElement)).toBe(colorA)
48
+ expect(colorA).not.toBe('')
49
+ })
50
+ it('initial ignora una url aunque el valor la parezca (sin red)', () => {
51
+ const c = renderCell({ key: 'name', type: 'text', cellStyle: 'initial' }, { name: 'Zed' })
52
+ expect(c.querySelector('img')).toBeNull()
53
+ })
54
+ })
@@ -0,0 +1,94 @@
1
+ // @vitest-environment happy-dom
2
+ //
3
+ // Loading states must resolve: a request that fails or never answers turns the
4
+ // skeleton into an actionable error (message + retry) instead of an eternal
5
+ // placeholder. Covers the shared guard in DashboardGrid and DynamicTable.
6
+ import { afterEach, describe, expect, it, vi } from 'vitest'
7
+ import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
8
+
9
+ vi.mock('@tanstack/react-router', () => ({ useNavigate: () => () => {} }))
10
+
11
+ class ResizeObserverStub {
12
+ observe() {}
13
+ unobserve() {}
14
+ disconnect() {}
15
+ }
16
+ ;(globalThis as any).ResizeObserver = (globalThis as any).ResizeObserver ?? ResizeObserverStub
17
+
18
+ import { ApiProvider, type ApiClient } from '../api-context'
19
+ import { DashboardGrid } from '../dashboard-grid'
20
+ import { DynamicTable } from '../dynamic-table'
21
+
22
+ afterEach(() => {
23
+ cleanup()
24
+ vi.useRealTimers()
25
+ })
26
+
27
+ const widgets = [{ key: 'k1', kind: 'stat', title: 'Revenue' }] as any
28
+
29
+ describe('DashboardGrid — loading guard', () => {
30
+ it('shows skeletons with aria-busy while loading', () => {
31
+ render(<DashboardGrid widgets={widgets} loadData={() => new Promise(() => {})} />)
32
+ expect(screen.getByRole('status').getAttribute('aria-busy')).toBe('true')
33
+ })
34
+
35
+ it('a request that never resolves turns into an error with retry after the timeout', async () => {
36
+ const loadData = vi.fn(() => new Promise<any>(() => {}))
37
+ render(<DashboardGrid widgets={widgets} loadData={loadData} loadTimeoutMs={100} />)
38
+ expect(screen.queryByRole('alert')).toBeNull()
39
+ expect(await screen.findByRole('alert')).toBeTruthy()
40
+ fireEvent.click(screen.getByRole('button', { name: 'Retry' }))
41
+ expect(loadData).toHaveBeenCalledTimes(2)
42
+ // retry restarts the loading state (skeleton again, no stale alert)
43
+ expect(screen.queryByRole('alert')).toBeNull()
44
+ })
45
+
46
+ it('a rejected batch shows the error and retry recovers', async () => {
47
+ const loadData = vi
48
+ .fn()
49
+ .mockRejectedValueOnce(new Error('boom'))
50
+ .mockResolvedValueOnce({ k1: { value: 5 } })
51
+ render(<DashboardGrid widgets={widgets} loadData={loadData} />)
52
+ const retry = await screen.findByRole('button', { name: 'Retry' })
53
+ fireEvent.click(retry)
54
+ await waitFor(() => expect(screen.queryByRole('alert')).toBeNull())
55
+ expect(loadData).toHaveBeenCalledTimes(2)
56
+ })
57
+
58
+ it('timeoutMs=0 disables the guard', async () => {
59
+ render(<DashboardGrid widgets={widgets} loadData={() => new Promise(() => {})} loadTimeoutMs={0} />)
60
+ await new Promise((r) => setTimeout(r, 300))
61
+ expect(screen.queryByRole('alert')).toBeNull()
62
+ })
63
+ })
64
+
65
+ describe('DynamicTable — metadata that never resolves', () => {
66
+ it('shows an error with retry (not an endless skeleton) and retry refetches metadata', async () => {
67
+ const get = vi.fn(() => new Promise<any>(() => {}))
68
+ const client = { get, post: vi.fn(), put: vi.fn(), delete: vi.fn() } as unknown as ApiClient
69
+ render(
70
+ <ApiProvider client={client}>
71
+ <DynamicTable model="guard_never" enableUrlSync={false} loadTimeoutMs={150} />
72
+ </ApiProvider>,
73
+ )
74
+ expect(screen.getByRole('status').getAttribute('aria-busy')).toBe('true')
75
+ expect(await screen.findByRole('alert')).toBeTruthy()
76
+ const before = get.mock.calls.length
77
+ fireEvent.click(screen.getByRole('button', { name: 'Retry' }))
78
+ await waitFor(() => expect(get.mock.calls.length).toBeGreaterThan(before))
79
+ })
80
+
81
+ it('a failed metadata request shows the error state with retry', async () => {
82
+ vi.spyOn(console, 'error').mockImplementation(() => {})
83
+ const get = vi.fn(async () => {
84
+ throw new Error('down')
85
+ })
86
+ const client = { get, post: vi.fn(), put: vi.fn(), delete: vi.fn() } as unknown as ApiClient
87
+ render(
88
+ <ApiProvider client={client}>
89
+ <DynamicTable model="guard_fail" enableUrlSync={false} />
90
+ </ApiProvider>,
91
+ )
92
+ expect(await screen.findByRole('button', { name: 'Retry' })).toBeTruthy()
93
+ })
94
+ })
@@ -0,0 +1,31 @@
1
+ import { describe, expect, it } from 'vitest'
2
+ import { resolveModelLabels, defaultSingular } from '../model-labels'
3
+
4
+ const makeT = (dict: Record<string, string>) => (key: string, opts?: Record<string, unknown>) =>
5
+ dict[key] ?? (opts?.defaultValue as string | undefined) ?? key
6
+
7
+ describe('resolveModelLabels', () => {
8
+ it('falls back to the backend title and a generic New <singular>', () => {
9
+ const l = resolveModelLabels(makeT({}), { model: 'clients', title: 'Clients' })
10
+ expect(l).toEqual({ title: 'Clients', singular: 'Client', newLabel: 'New Client' })
11
+ })
12
+ it('resolves title, singular and create label from models.<model>.*', () => {
13
+ const t = makeT({ 'models.clients.title': 'Clientes', 'models.clients.singular': 'Cliente', 'models.clients.new': 'Nuevo cliente' })
14
+ expect(resolveModelLabels(t, { model: 'clients', title: 'Clients' })).toEqual({
15
+ title: 'Clientes', singular: 'Cliente', newLabel: 'Nuevo cliente',
16
+ })
17
+ })
18
+ it('uses titleKey first and the common.new prefix when no per-model label', () => {
19
+ const t = makeT({ 'custom.t': 'Mis socios', 'common.new': 'Nuevo', 'models.x.title': 'ignored' })
20
+ const l = resolveModelLabels(t, { model: 'x', title: 'X', titleKey: 'custom.t' })
21
+ expect(l.title).toBe('Mis socios')
22
+ expect(l.newLabel).toBe('Nuevo Mis socio')
23
+ })
24
+ it('explicit overrides win', () => {
25
+ const t = makeT({ 'models.x.title': 'T', 'models.x.new': 'N' })
26
+ const l = resolveModelLabels(t, { model: 'x', titleOverride: 'Mine', newLabelOverride: 'Add' })
27
+ expect(l.title).toBe('Mine')
28
+ expect(l.newLabel).toBe('Add')
29
+ })
30
+ it('singular helper', () => expect(defaultSingular('orders')).toBe('Order'))
31
+ })
@@ -7,6 +7,7 @@
7
7
  import * as React from 'react'
8
8
  import { useTranslation } from 'react-i18next'
9
9
  import { cn } from '@asteby/metacore-ui/lib'
10
+ import { LoadState } from '@asteby/metacore-ui/primitives'
10
11
  import { useCan, usePermissionsActive } from './permissions-context'
11
12
  import type {
12
13
  DashboardGridProps,
@@ -58,6 +59,7 @@ export function DashboardGrid({
58
59
  groups,
59
60
  widgets,
60
61
  loadData,
62
+ loadTimeoutMs,
61
63
  isAdmin,
62
64
  locale,
63
65
  currency,
@@ -102,6 +104,9 @@ export function DashboardGrid({
102
104
  Record<string, import('./dashboard-types').WidgetData> | null
103
105
  >(null)
104
106
  const [loading, setLoading] = React.useState(true)
107
+ // Batch failure / hung request -> actionable error with retry (not an eternal skeleton).
108
+ const [loadFailed, setLoadFailed] = React.useState(false)
109
+ const [reloadTick, setReloadTick] = React.useState(0)
105
110
 
106
111
  React.useEffect(() => {
107
112
  let cancelled = false
@@ -111,6 +116,7 @@ export function DashboardGrid({
111
116
  return
112
117
  }
113
118
  setLoading(true)
119
+ setLoadFailed(false)
114
120
  loadData(keys)
115
121
  .then((res) => {
116
122
  if (!cancelled) {
@@ -119,10 +125,9 @@ export function DashboardGrid({
119
125
  }
120
126
  })
121
127
  .catch(() => {
122
- // Batch failure: still render the grid; every widget falls to
123
- // its empty/error state rather than blanking the page.
124
128
  if (!cancelled) {
125
129
  setData({})
130
+ setLoadFailed(true)
126
131
  setLoading(false)
127
132
  }
128
133
  })
@@ -130,7 +135,7 @@ export function DashboardGrid({
130
135
  cancelled = true
131
136
  }
132
137
  // eslint-disable-next-line react-hooks/exhaustive-deps
133
- }, [keySig, loadData])
138
+ }, [keySig, loadData, reloadTick])
134
139
 
135
140
  // Flatten every group into ONE ordered list (compact KPIs before charts) for
136
141
  // the masonry grid. MUST run before any early return — it is a hook, and a
@@ -166,41 +171,50 @@ export function DashboardGrid({
166
171
  )
167
172
  }
168
173
 
174
+ const gridClass = cn(
175
+ // Masonry: balanced CSS columns. Cards take their natural height
176
+ // (compact stats, taller charts) and flow to equalize column
177
+ // height, so there are NO blank cells.
178
+ 'columns-1 gap-4 md:columns-2 xl:columns-3',
179
+ className,
180
+ )
181
+ const translated = (spec: DashboardWidgetSpec) => ({
182
+ ...spec,
183
+ title: tr(spec.title, spec.title),
184
+ subtitle: tr(spec.subtitle, spec.subtitle),
185
+ })
186
+
169
187
  return (
170
- <div
171
- data-testid="dashboard-grid"
172
- className={cn(
173
- // Masonry: balanced CSS columns. Cards take their natural height
174
- // (compact stats, taller charts) and flow to equalize column
175
- // height, so there are NO blank cells — the gaps a fixed grid
176
- // leaves around mixed 1×1 / 2×2 tiles simply don't exist here.
177
- 'columns-1 gap-4 md:columns-2 xl:columns-3',
178
- className,
179
- )}
188
+ <LoadState
189
+ loading={loading}
190
+ error={loadFailed}
191
+ timeoutMs={loadTimeoutMs}
192
+ onRetry={() => setReloadTick((n) => n + 1)}
193
+ labels={{ title: s.loadErrorTitle, hint: s.loadErrorHint, retry: s.retry }}
194
+ skeleton={
195
+ <div data-testid="dashboard-grid" className={gridClass}>
196
+ {ordered.map((spec) => (
197
+ <div key={spec.key} className="mb-4 break-inside-avoid">
198
+ <WidgetSkeleton spec={translated(spec)} />
199
+ </div>
200
+ ))}
201
+ </div>
202
+ }
180
203
  >
181
- {ordered.map((spec) => {
182
- const rspec = {
183
- ...spec,
184
- title: tr(spec.title, spec.title),
185
- subtitle: tr(spec.subtitle, spec.subtitle),
186
- }
187
- return (
204
+ <div data-testid="dashboard-grid" className={gridClass}>
205
+ {ordered.map((spec) => (
188
206
  <div key={spec.key} className="mb-4 break-inside-avoid">
189
- {loading ? (
190
- <WidgetSkeleton spec={rspec} />
191
- ) : (
192
- <WidgetRenderer
193
- spec={rspec}
194
- data={data?.[spec.key]}
195
- locale={locale}
196
- currency={currency}
197
- emptyText={spec.empty ? tr(spec.empty, spec.empty) : s.widgetEmpty}
198
- errorText={s.widgetError}
199
- />
200
- )}
207
+ <WidgetRenderer
208
+ spec={translated(spec)}
209
+ data={data?.[spec.key]}
210
+ locale={locale}
211
+ currency={currency}
212
+ emptyText={spec.empty ? tr(spec.empty, spec.empty) : s.widgetEmpty}
213
+ errorText={s.widgetError}
214
+ />
201
215
  </div>
202
- )
203
- })}
204
- </div>
216
+ ))}
217
+ </div>
218
+ </LoadState>
205
219
  )
206
220
  }
@@ -152,6 +152,8 @@ export interface DashboardGridProps {
152
152
  currency?: string
153
153
  /** Extra class on the grid root. */
154
154
  className?: string
155
+ /** Max ms the batch load may take before an error + retry replaces the skeletons. Default 15000; 0 disables. */
156
+ loadTimeoutMs?: number
155
157
  /** Optional override for empty/loading/error copy. */
156
158
  strings?: Partial<DashboardGridStrings>
157
159
  }
@@ -166,4 +168,8 @@ export interface DashboardGridStrings {
166
168
  widgetError: string
167
169
  /** Per-widget empty (no data) fallback when the spec has no `empty` key. */
168
170
  widgetEmpty: string
171
+ /** Optional overrides of the load-failure state (default: i18n `loadState.*`). */
172
+ loadErrorTitle?: string
173
+ loadErrorHint?: string
174
+ retry?: string
169
175
  }
@@ -35,6 +35,7 @@ import {
35
35
  import {
36
36
  generateBadgeStyles,
37
37
  getInitials,
38
+ optionColor,
38
39
  relationChipStyles,
39
40
  } from '@asteby/metacore-ui/lib'
40
41
  import { Progress } from './dialogs/_primitives'
@@ -697,6 +698,21 @@ export function resolveActorDisplayName(raw: unknown): string | undefined {
697
698
  * any backend that stores just `"2.png"` next to a nested key) and the value
698
699
  * branch injected basePath into already-rooted paths (junk URLs).
699
700
  */
701
+ /**
702
+ * Whether `raw` can plausibly be an image reference (URL, data/blob URI,
703
+ * rooted/relative path or a file name with an image extension). A plain label
704
+ * such as "Ana Perez" — what a backend sends when it fills `avatar` with the
705
+ * display name instead of a file — is NOT, and must never be turned into a
706
+ * request (it used to become `apiBaseUrl + "Ana Perez"`, a 404 per row).
707
+ */
708
+ export const looksLikeImageRef = (raw: string): boolean => {
709
+ const v = raw.trim()
710
+ if (!v) return false
711
+ if (/^(https?:|data:image\/|blob:)/i.test(v) || v.startsWith('/')) return true
712
+ if (/\s/.test(v)) return false
713
+ return v.includes('/') || /\.(png|jpe?g|gif|webp|avif|svg|bmp|ico)(\?.*)?$/i.test(v)
714
+ }
715
+
700
716
  export const resolveAvatarSrc = (
701
717
  col: ColumnDefinition,
702
718
  row: any,
@@ -718,7 +734,7 @@ export const resolveAvatarSrc = (
718
734
  if (sibling) raw = String(sibling)
719
735
  }
720
736
  if (!raw && value !== undefined && value !== null && value !== '') raw = String(value)
721
- if (!raw) return undefined
737
+ if (!raw || !looksLikeImageRef(raw)) return undefined
722
738
  if (raw.startsWith('http') || raw.startsWith('/')) return raw
723
739
  const basePath = styleCfg(col, 'base_path', 'basePath') ?? col.basePath ?? ''
724
740
  return `${apiBaseUrl}${basePath}${raw}`
@@ -898,17 +914,23 @@ const AvatarCell: React.FC<{
898
914
  shape?: 'rounded' | 'circle'
899
915
  /** Per-row brand colour (hex) for the initials fallback. */
900
916
  color?: string
901
- }> = ({ name, desc, avatarSrc, getImageUrl, shape, color }) => {
917
+ /** Paint the initials fallback with a stable colour derived from `name`. */
918
+ autoColor?: boolean
919
+ }> = ({ name, desc, avatarSrc, getImageUrl, shape, color, autoColor }) => {
902
920
  const radius = shape === 'circle' ? 'rounded-full' : 'rounded-lg'
903
- const brand = brandAvatarColors(color)
921
+ // Brand colour wins; with `autoColor` a stable per-name colour (same hash as
922
+ // every other avatar in the platform) so the imageless case needs no backend colour.
923
+ const brand = brandAvatarColors(color) ?? (autoColor ? brandAvatarColors(`#${optionColor(name)}`) : undefined)
904
924
  return (
905
925
  <div className="flex items-center gap-3 min-w-0">
906
926
  <Avatar className={`h-8 w-8 ${radius} ring-1 ring-border/50`}>
907
- <AvatarImage
908
- src={avatarSrc ? getImageUrl(avatarSrc) : ''}
909
- alt={name}
910
- className={shape === 'circle' ? 'object-cover' : 'object-contain p-0.5'}
911
- />
927
+ {avatarSrc ? (
928
+ <AvatarImage
929
+ src={getImageUrl(avatarSrc)}
930
+ alt={name}
931
+ className={shape === 'circle' ? 'object-cover' : 'object-contain p-0.5'}
932
+ />
933
+ ) : null}
912
934
  <AvatarFallback
913
935
  className={`text-[10px] font-bold ${radius} ${brand ? '' : 'bg-primary/5 text-primary'}`}
914
936
  style={brand ? { backgroundColor: brand.background, color: brand.color } : undefined}
@@ -1284,6 +1306,8 @@ export function makeDefaultGetDynamicColumns(
1284
1306
  )
1285
1307
  }
1286
1308
 
1309
+ case 'initial':
1310
+ case 'initials':
1287
1311
  case 'search':
1288
1312
  case 'avatar':
1289
1313
  case 'creator':
@@ -1344,7 +1368,13 @@ export function makeDefaultGetDynamicColumns(
1344
1368
  )
1345
1369
  }
1346
1370
 
1347
- const avatarSrc = resolveAvatarSrc(col, row.original, value, apiBaseUrl)
1371
+ // `initial`/`initials`: declarative imageless avatar — never
1372
+ // resolves a source, so it can't hit the network.
1373
+ const isInitialStyle = renderAs === 'initial' || renderAs === 'initials'
1374
+ const avatarSrc =
1375
+ isInitialStyle
1376
+ ? undefined
1377
+ : resolveAvatarSrc(col, row.original, value, apiBaseUrl)
1348
1378
 
1349
1379
  return (
1350
1380
  <AvatarCell
@@ -1354,6 +1384,7 @@ export function makeDefaultGetDynamicColumns(
1354
1384
  getImageUrl={getImageUrl}
1355
1385
  shape={avatarShape}
1356
1386
  color={brandColor ? String(brandColor) : undefined}
1387
+ autoColor={isInitialStyle || styleCfg(col, 'tone') === 'auto'}
1357
1388
  />
1358
1389
  )
1359
1390
  }
@@ -42,6 +42,7 @@ import {
42
42
  } from './document-form-dialog'
43
43
  import { ExportDialog } from './dialogs/export'
44
44
  import { ImportDialog } from './dialogs/import'
45
+ import { useModelLabels } from './model-labels'
45
46
  import { getModelExtension } from './model-extension-registry'
46
47
  import { ModelActionToolbar } from './model-action-toolbar'
47
48
  import { BulkImageImportButton } from './bulk-image-dialog'
@@ -187,12 +188,14 @@ export function DynamicCRUDPage(props: DynamicCRUDPageProps) {
187
188
  }
188
189
  }, [model, cachedMeta, api])
189
190
 
190
- const title = titleOverride ?? ext?.title ?? metadata?.title ?? model
191
- const resolvedNewLabel = newLabel ?? ext?.newLabel
192
- const singular = useMemo(() => {
193
- const t = title.replace(/s$/i, '')
194
- return t.charAt(0).toUpperCase() + t.slice(1)
195
- }, [title])
191
+ const { title, newLabel: resolvedNewLabel } = useModelLabels({
192
+ model,
193
+ title: metadata?.title,
194
+ titleKey: metadata?.titleKey ?? metadata?.title_key,
195
+ titleOverride: titleOverride ?? ext?.title,
196
+ newLabelOverride: newLabel ?? ext?.newLabel,
197
+ newPrefix: strings.newPrefix,
198
+ })
196
199
 
197
200
  const enableCRUD = metadata?.enableCRUDActions ?? false
198
201
  // Una sola primaria: placement create, replaces_create, create_mode o la
@@ -310,7 +313,7 @@ export function DynamicCRUDPage(props: DynamicCRUDPageProps) {
310
313
  className='inline-flex items-center gap-2 h-9 px-3 rounded-md bg-primary text-primary-foreground hover:opacity-90 text-sm font-medium'
311
314
  >
312
315
  <Plus className='size-4' />
313
- {resolvedNewLabel ?? `${strings.newPrefix} ${singular}`}
316
+ {resolvedNewLabel}
314
317
  </button>
315
318
  )}
316
319
  </div>