@entifix/react-controls 0.20.3 → 0.21.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 (58) hide show
  1. package/dist/i18n/catalog/en.d.ts.map +1 -1
  2. package/dist/i18n/catalog/en.js +3 -0
  3. package/dist/i18n/catalog/en.js.map +1 -1
  4. package/dist/i18n/catalog/es.d.ts +3 -0
  5. package/dist/i18n/catalog/es.d.ts.map +1 -1
  6. package/dist/i18n/catalog/es.js +3 -0
  7. package/dist/i18n/catalog/es.js.map +1 -1
  8. package/dist/i18n/catalog/index.d.ts +6 -0
  9. package/dist/i18n/catalog/index.d.ts.map +1 -1
  10. package/dist/index.d.ts +1 -0
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +1 -0
  13. package/dist/index.js.map +1 -1
  14. package/dist/ui/atoms/cell-value/cell-value.d.ts +6 -0
  15. package/dist/ui/atoms/cell-value/cell-value.d.ts.map +1 -1
  16. package/dist/ui/atoms/cell-value/cell-value.js +97 -14
  17. package/dist/ui/atoms/cell-value/cell-value.js.map +1 -1
  18. package/dist/ui/atoms/cell-value/index.d.ts +1 -0
  19. package/dist/ui/atoms/cell-value/index.d.ts.map +1 -1
  20. package/dist/ui/atoms/cell-value/index.js +1 -0
  21. package/dist/ui/atoms/cell-value/index.js.map +1 -1
  22. package/dist/ui/atoms/cell-value/use-record-label.d.ts +16 -0
  23. package/dist/ui/atoms/cell-value/use-record-label.d.ts.map +1 -0
  24. package/dist/ui/atoms/cell-value/use-record-label.js +55 -0
  25. package/dist/ui/atoms/cell-value/use-record-label.js.map +1 -0
  26. package/dist/ui/atoms/table/table.d.ts +4 -2
  27. package/dist/ui/atoms/table/table.d.ts.map +1 -1
  28. package/dist/ui/atoms/table/table.js +3 -1
  29. package/dist/ui/atoms/table/table.js.map +1 -1
  30. package/dist/ui/organisms/entity-form/entity-form.d.ts +1 -1
  31. package/dist/ui/organisms/entity-form/entity-form.d.ts.map +1 -1
  32. package/dist/ui/organisms/entity-form/entity-form.js +7 -6
  33. package/dist/ui/organisms/entity-form/entity-form.js.map +1 -1
  34. package/dist/ui/organisms/entity-form/entity-form.types.d.ts +0 -8
  35. package/dist/ui/organisms/entity-form/entity-form.types.d.ts.map +1 -1
  36. package/dist/ui/organisms/entity-form/entity-form.types.js.map +1 -1
  37. package/dist/ui/organisms/entity-table/card-roles.d.ts +10 -0
  38. package/dist/ui/organisms/entity-table/card-roles.d.ts.map +1 -0
  39. package/dist/ui/organisms/entity-table/card-roles.js +14 -0
  40. package/dist/ui/organisms/entity-table/card-roles.js.map +1 -0
  41. package/dist/ui/organisms/entity-table/entity-table-slots.d.ts +2 -0
  42. package/dist/ui/organisms/entity-table/entity-table-slots.d.ts.map +1 -1
  43. package/dist/ui/organisms/entity-table/entity-table-slots.js.map +1 -1
  44. package/dist/ui/organisms/entity-table/entity-table.d.ts.map +1 -1
  45. package/dist/ui/organisms/entity-table/entity-table.js +217 -173
  46. package/dist/ui/organisms/entity-table/entity-table.js.map +1 -1
  47. package/dist/ui/organisms/entity-table/pivot.d.ts +32 -5
  48. package/dist/ui/organisms/entity-table/pivot.d.ts.map +1 -1
  49. package/dist/ui/organisms/entity-table/pivot.js +42 -9
  50. package/dist/ui/organisms/entity-table/pivot.js.map +1 -1
  51. package/dist/ui/organisms/entity-table/use-entity-table-columns.d.ts.map +1 -1
  52. package/dist/ui/organisms/entity-table/use-entity-table-columns.js +6 -3
  53. package/dist/ui/organisms/entity-table/use-entity-table-columns.js.map +1 -1
  54. package/dist/ui/utils/reference-labels.d.ts +59 -0
  55. package/dist/ui/utils/reference-labels.d.ts.map +1 -0
  56. package/dist/ui/utils/reference-labels.js +49 -0
  57. package/dist/ui/utils/reference-labels.js.map +1 -0
  58. package/package.json +5 -5
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/ui/organisms/entity-table/card-roles.ts"],"sourcesContent":["import { type CardRole, type Entity } from '@entifix/core';\n\nimport type { EntityTableColumn } from './entity-table.types.js';\n\n/**\n * Each column's part on a record's card: its declared `card` role, or the\n * default — an id is hidden, the first undeclared enum is the badge, and the\n * rest are meta. Shared by the cards and by the pivot, which counts a card's\n * essentials to decide when the grid no longer fits.\n */\nexport function cardRoles<TEntity extends Entity>(\n columns: readonly EntityTableColumn<TEntity>[],\n): (column: EntityTableColumn<TEntity>) => CardRole {\n const firstEnum = columns.find(\n column => column.card === undefined && column.type === 'enum',\n );\n return column =>\n column.card ??\n (column.type === 'id' ? 'hidden' : column === firstEnum ? 'badge' : 'meta');\n}\n"],"names":["cardRoles","columns","firstEnum","find","column","card","undefined","type"],"mappings":"AAIA;;;;;CAKC,GACD,OAAO,SAASA,UACdC,OAA8C;IAE9C,MAAMC,YAAYD,QAAQE,IAAI,CAC5BC,CAAAA,SAAUA,OAAOC,IAAI,KAAKC,aAAaF,OAAOG,IAAI,KAAK;IAEzD,OAAOH,CAAAA;YACLA;gBAAAA,eAAAA,OAAOC,IAAI,YAAXD,eACCA,OAAOG,IAAI,KAAK,OAAO,WAAWH,WAAWF,YAAY,UAAU;;AACxE"}
@@ -14,6 +14,8 @@ export interface EntityColumnProps<TEntity extends Entity = Entity> {
14
14
  label?: string;
15
15
  header?: ReactNode;
16
16
  type?: MetaAccessorType;
17
+ /** The narrowest the column reads at, in `rem` — what the pivot counts it as. */
18
+ minWidth?: number;
17
19
  order?: number;
18
20
  sortable?: boolean;
19
21
  filterable?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"entity-table-slots.d.ts","sourceRoot":"","sources":["../../../../src/ui/organisms/entity-table/entity-table-slots.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAA4B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE;;;;;;GAMG;AAEH,MAAM,WAAW,iBAAiB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IAChE,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,SAAS,CAAC;CACvC;AAED,qEAAqE;AACrE,wBAAgB,YAAY,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EAC1D,MAAM,EAAE,iBAAiB,CAAC,OAAO,CAAC,GACjC,SAAS,CAEX;AAED,MAAM,WAAW,sBAAsB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IACrE,4EAA4E;IAC5E,MAAM,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,KAAK,SAAS,CAAC;CACnE;AAED,wBAAgB,iBAAiB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EAC/D,MAAM,EAAE,sBAAsB,CAAC,OAAO,CAAC,GACtC,SAAS,CAEX;AAED,MAAM,WAAW,mBAAmB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IAClE,kDAAkD;IAClD,MAAM,EAAE,CACN,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,KACvC,SAAS,CAAC;CAChB;AAED,wBAAgB,cAAc,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EAC5D,MAAM,EAAE,mBAAmB,CAAC,OAAO,CAAC,GACnC,SAAS,CAEX;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,oEAAoE;AACpE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,uBAAuB,GAAG,SAAS,CAE7E;AAED,MAAM,WAAW,gBAAgB,CAAC,OAAO,SAAS,MAAM;IACtD,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3C,MAAM,CAAC,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;IACzC,GAAG,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,0EAA0E;IAC1E,IAAI,EAAE,SAAS,EAAE,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,SAAS,MAAM,EACzD,QAAQ,EAAE,SAAS,GAClB,gBAAgB,CAAC,OAAO,CAAC,CA4B3B"}
1
+ {"version":3,"file":"entity-table-slots.d.ts","sourceRoot":"","sources":["../../../../src/ui/organisms/entity-table/entity-table-slots.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAA4B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE;;;;;;GAMG;AAEH,MAAM,WAAW,iBAAiB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IAChE,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,SAAS,CAAC;CACvC;AAED,qEAAqE;AACrE,wBAAgB,YAAY,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EAC1D,MAAM,EAAE,iBAAiB,CAAC,OAAO,CAAC,GACjC,SAAS,CAEX;AAED,MAAM,WAAW,sBAAsB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IACrE,4EAA4E;IAC5E,MAAM,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,KAAK,SAAS,CAAC;CACnE;AAED,wBAAgB,iBAAiB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EAC/D,MAAM,EAAE,sBAAsB,CAAC,OAAO,CAAC,GACtC,SAAS,CAEX;AAED,MAAM,WAAW,mBAAmB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IAClE,kDAAkD;IAClD,MAAM,EAAE,CACN,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,KACvC,SAAS,CAAC;CAChB;AAED,wBAAgB,cAAc,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EAC5D,MAAM,EAAE,mBAAmB,CAAC,OAAO,CAAC,GACnC,SAAS,CAEX;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,oEAAoE;AACpE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,uBAAuB,GAAG,SAAS,CAE7E;AAED,MAAM,WAAW,gBAAgB,CAAC,OAAO,SAAS,MAAM;IACtD,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3C,MAAM,CAAC,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;IACzC,GAAG,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,0EAA0E;IAC1E,IAAI,EAAE,SAAS,EAAE,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,SAAS,MAAM,EACzD,QAAQ,EAAE,SAAS,GAClB,gBAAgB,CAAC,OAAO,CAAC,CA4B3B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/ui/organisms/entity-table/entity-table-slots.tsx"],"sourcesContent":["import type { Entity, MetaAccessorType } from '@entifix/core';\nimport { Children, isValidElement, type ReactNode } from 'react';\n\nimport type { EntityTableColumn } from './entity-table.types.js';\n\n/**\n * The declarative customization API. Slots are configuration expressed as JSX:\n * they never render themselves — `EntityTable` reads their props and decides\n * where the configuration applies. That keeps simple tables to a single\n * self-closing tag while complex ones stay declarative instead of drowning in\n * option objects.\n */\n\nexport interface EntityColumnProps<TEntity extends Entity = Entity> {\n /** Accessor name. Unknown names create an extra, entity-less column. */\n field: string;\n label?: string;\n header?: ReactNode;\n type?: MetaAccessorType;\n order?: number;\n sortable?: boolean;\n filterable?: boolean;\n render?: (item: TEntity) => ReactNode;\n}\n\n/** Overrides one metadata-derived column, or adds a computed one. */\nexport function EntityColumn<TEntity extends Entity = Entity>(\n _props: EntityColumnProps<TEntity>,\n): ReactNode {\n return null;\n}\n\nexport interface EntityTableHeaderProps<TEntity extends Entity = Entity> {\n /** Replaces the whole header row. Receives the resolved visible columns. */\n render: (columns: Array<EntityTableColumn<TEntity>>) => ReactNode;\n}\n\nexport function EntityTableHeader<TEntity extends Entity = Entity>(\n _props: EntityTableHeaderProps<TEntity>,\n): ReactNode {\n return null;\n}\n\nexport interface EntityTableRowProps<TEntity extends Entity = Entity> {\n /** Replaces the whole body row for every item. */\n render: (\n item: TEntity,\n columns: Array<EntityTableColumn<TEntity>>,\n ) => ReactNode;\n}\n\nexport function EntityTableRow<TEntity extends Entity = Entity>(\n _props: EntityTableRowProps<TEntity>,\n): ReactNode {\n return null;\n}\n\nexport interface EntityTableToolbarProps {\n children?: ReactNode;\n}\n\n/** Extra actions placed alongside the built-in toolbar controls. */\nexport function EntityTableToolbar(_props: EntityTableToolbarProps): ReactNode {\n return null;\n}\n\nexport interface EntityTableSlots<TEntity extends Entity> {\n columns: Array<EntityColumnProps<TEntity>>;\n header?: EntityTableHeaderProps<TEntity>;\n row?: EntityTableRowProps<TEntity>;\n toolbar?: ReactNode;\n /** Children that matched no slot — rendered below the table untouched. */\n rest: ReactNode[];\n}\n\n/**\n * Sorts children into slots.\n *\n * Matching is by component identity rather than by `displayName`: identity\n * survives minification and cannot collide with an unrelated component that\n * happens to share a name.\n */\nexport function readEntityTableSlots<TEntity extends Entity>(\n children: ReactNode,\n): EntityTableSlots<TEntity> {\n const slots: EntityTableSlots<TEntity> = { columns: [], rest: [] };\n\n Children.toArray(children).forEach(child => {\n if (!isValidElement(child)) {\n slots.rest.push(child);\n return;\n }\n\n switch (child.type) {\n case EntityColumn:\n slots.columns.push(child.props as EntityColumnProps<TEntity>);\n break;\n case EntityTableHeader:\n slots.header = child.props as EntityTableHeaderProps<TEntity>;\n break;\n case EntityTableRow:\n slots.row = child.props as EntityTableRowProps<TEntity>;\n break;\n case EntityTableToolbar:\n slots.toolbar = (child.props as EntityTableToolbarProps).children;\n break;\n default:\n slots.rest.push(child);\n }\n });\n\n return slots;\n}\n"],"names":["Children","isValidElement","EntityColumn","_props","EntityTableHeader","EntityTableRow","EntityTableToolbar","readEntityTableSlots","children","slots","columns","rest","toArray","forEach","child","push","type","props","header","row","toolbar"],"mappings":"AACA,SAASA,QAAQ,EAAEC,cAAc,QAAwB,QAAQ;AAwBjE,mEAAmE,GACnE,OAAO,SAASC,aACdC,MAAkC;IAElC,OAAO;AACT;AAOA,OAAO,SAASC,kBACdD,MAAuC;IAEvC,OAAO;AACT;AAUA,OAAO,SAASE,eACdF,MAAoC;IAEpC,OAAO;AACT;AAMA,kEAAkE,GAClE,OAAO,SAASG,mBAAmBH,MAA+B;IAChE,OAAO;AACT;AAWA;;;;;;CAMC,GACD,OAAO,SAASI,qBACdC,QAAmB;IAEnB,MAAMC,QAAmC;QAAEC,SAAS,EAAE;QAAEC,MAAM,EAAE;IAAC;IAEjEX,SAASY,OAAO,CAACJ,UAAUK,OAAO,CAACC,CAAAA;QACjC,IAAI,eAACb,eAAea,QAAQ;YAC1BL,MAAME,IAAI,CAACI,IAAI,CAACD;YAChB;QACF;QAEA,OAAQA,MAAME,IAAI;YAChB,KAAKd;gBACHO,MAAMC,OAAO,CAACK,IAAI,CAACD,MAAMG,KAAK;gBAC9B;YACF,KAAKb;gBACHK,MAAMS,MAAM,GAAGJ,MAAMG,KAAK;gBAC1B;YACF,KAAKZ;gBACHI,MAAMU,GAAG,GAAGL,MAAMG,KAAK;gBACvB;YACF,KAAKX;gBACHG,MAAMW,OAAO,GAAG,AAACN,MAAMG,KAAK,CAA6BT,QAAQ;gBACjE;YACF;gBACEC,MAAME,IAAI,CAACI,IAAI,CAACD;QACpB;IACF;IAEA,OAAOL;AACT"}
1
+ {"version":3,"sources":["../../../../src/ui/organisms/entity-table/entity-table-slots.tsx"],"sourcesContent":["import type { Entity, MetaAccessorType } from '@entifix/core';\nimport { Children, isValidElement, type ReactNode } from 'react';\n\nimport type { EntityTableColumn } from './entity-table.types.js';\n\n/**\n * The declarative customization API. Slots are configuration expressed as JSX:\n * they never render themselves — `EntityTable` reads their props and decides\n * where the configuration applies. That keeps simple tables to a single\n * self-closing tag while complex ones stay declarative instead of drowning in\n * option objects.\n */\n\nexport interface EntityColumnProps<TEntity extends Entity = Entity> {\n /** Accessor name. Unknown names create an extra, entity-less column. */\n field: string;\n label?: string;\n header?: ReactNode;\n type?: MetaAccessorType;\n /** The narrowest the column reads at, in `rem` — what the pivot counts it as. */\n minWidth?: number;\n order?: number;\n sortable?: boolean;\n filterable?: boolean;\n render?: (item: TEntity) => ReactNode;\n}\n\n/** Overrides one metadata-derived column, or adds a computed one. */\nexport function EntityColumn<TEntity extends Entity = Entity>(\n _props: EntityColumnProps<TEntity>,\n): ReactNode {\n return null;\n}\n\nexport interface EntityTableHeaderProps<TEntity extends Entity = Entity> {\n /** Replaces the whole header row. Receives the resolved visible columns. */\n render: (columns: Array<EntityTableColumn<TEntity>>) => ReactNode;\n}\n\nexport function EntityTableHeader<TEntity extends Entity = Entity>(\n _props: EntityTableHeaderProps<TEntity>,\n): ReactNode {\n return null;\n}\n\nexport interface EntityTableRowProps<TEntity extends Entity = Entity> {\n /** Replaces the whole body row for every item. */\n render: (\n item: TEntity,\n columns: Array<EntityTableColumn<TEntity>>,\n ) => ReactNode;\n}\n\nexport function EntityTableRow<TEntity extends Entity = Entity>(\n _props: EntityTableRowProps<TEntity>,\n): ReactNode {\n return null;\n}\n\nexport interface EntityTableToolbarProps {\n children?: ReactNode;\n}\n\n/** Extra actions placed alongside the built-in toolbar controls. */\nexport function EntityTableToolbar(_props: EntityTableToolbarProps): ReactNode {\n return null;\n}\n\nexport interface EntityTableSlots<TEntity extends Entity> {\n columns: Array<EntityColumnProps<TEntity>>;\n header?: EntityTableHeaderProps<TEntity>;\n row?: EntityTableRowProps<TEntity>;\n toolbar?: ReactNode;\n /** Children that matched no slot — rendered below the table untouched. */\n rest: ReactNode[];\n}\n\n/**\n * Sorts children into slots.\n *\n * Matching is by component identity rather than by `displayName`: identity\n * survives minification and cannot collide with an unrelated component that\n * happens to share a name.\n */\nexport function readEntityTableSlots<TEntity extends Entity>(\n children: ReactNode,\n): EntityTableSlots<TEntity> {\n const slots: EntityTableSlots<TEntity> = { columns: [], rest: [] };\n\n Children.toArray(children).forEach(child => {\n if (!isValidElement(child)) {\n slots.rest.push(child);\n return;\n }\n\n switch (child.type) {\n case EntityColumn:\n slots.columns.push(child.props as EntityColumnProps<TEntity>);\n break;\n case EntityTableHeader:\n slots.header = child.props as EntityTableHeaderProps<TEntity>;\n break;\n case EntityTableRow:\n slots.row = child.props as EntityTableRowProps<TEntity>;\n break;\n case EntityTableToolbar:\n slots.toolbar = (child.props as EntityTableToolbarProps).children;\n break;\n default:\n slots.rest.push(child);\n }\n });\n\n return slots;\n}\n"],"names":["Children","isValidElement","EntityColumn","_props","EntityTableHeader","EntityTableRow","EntityTableToolbar","readEntityTableSlots","children","slots","columns","rest","toArray","forEach","child","push","type","props","header","row","toolbar"],"mappings":"AACA,SAASA,QAAQ,EAAEC,cAAc,QAAwB,QAAQ;AA0BjE,mEAAmE,GACnE,OAAO,SAASC,aACdC,MAAkC;IAElC,OAAO;AACT;AAOA,OAAO,SAASC,kBACdD,MAAuC;IAEvC,OAAO;AACT;AAUA,OAAO,SAASE,eACdF,MAAoC;IAEpC,OAAO;AACT;AAMA,kEAAkE,GAClE,OAAO,SAASG,mBAAmBH,MAA+B;IAChE,OAAO;AACT;AAWA;;;;;;CAMC,GACD,OAAO,SAASI,qBACdC,QAAmB;IAEnB,MAAMC,QAAmC;QAAEC,SAAS,EAAE;QAAEC,MAAM,EAAE;IAAC;IAEjEX,SAASY,OAAO,CAACJ,UAAUK,OAAO,CAACC,CAAAA;QACjC,IAAI,eAACb,eAAea,QAAQ;YAC1BL,MAAME,IAAI,CAACI,IAAI,CAACD;YAChB;QACF;QAEA,OAAQA,MAAME,IAAI;YAChB,KAAKd;gBACHO,MAAMC,OAAO,CAACK,IAAI,CAACD,MAAMG,KAAK;gBAC9B;YACF,KAAKb;gBACHK,MAAMS,MAAM,GAAGJ,MAAMG,KAAK;gBAC1B;YACF,KAAKZ;gBACHI,MAAMU,GAAG,GAAGL,MAAMG,KAAK;gBACvB;YACF,KAAKX;gBACHG,MAAMW,OAAO,GAAG,AAACN,MAAMG,KAAK,CAA6BT,QAAQ;gBACjE;YACF;gBACEC,MAAME,IAAI,CAACI,IAAI,CAACD;QACpB;IACF;IAEA,OAAOL;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"entity-table.d.ts","sourceRoot":"","sources":["../../../../src/ui/organisms/entity-table/entity-table.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,MAAM,EAYZ,MAAM,eAAe,CAAC;AAqDvB,OAAO,KAAK,EAEV,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAqDjC,wBAAgB,WAAW,CAAC,OAAO,SAAS,MAAM,EAAE,EAClD,iBAAiB,EACjB,SAAS,EACT,QAAe,EACf,KAAK,EACL,KAAK,EACL,UAAU,EACV,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,OAAO,EACP,UAAyB,EACzB,QAAQ,EACR,cAAc,EACd,YAAmB,EACnB,eAAe,EACf,SAAS,EACT,OAAO,EACP,iBAAiB,EACjB,eAAe,EACf,MAAM,EACN,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACR,iBAAyB,EACzB,aAAa,EACb,SAAS,EACT,OAAO,EACP,YAAY,EACZ,aAAa,EACb,WAAW,EACX,aAAqB,EACrB,QAAQ,GACT,EAAE,gBAAgB,CAAC,OAAO,CAAC,+BAs6B3B"}
1
+ {"version":3,"file":"entity-table.d.ts","sourceRoot":"","sources":["../../../../src/ui/organisms/entity-table/entity-table.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,MAAM,EAaZ,MAAM,eAAe,CAAC;AAsDvB,OAAO,KAAK,EAEV,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAsDjC,wBAAgB,WAAW,CAAC,OAAO,SAAS,MAAM,EAAE,EAClD,iBAAiB,EACjB,SAAS,EACT,QAAe,EACf,KAAK,EACL,KAAK,EACL,UAAU,EACV,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,OAAO,EACP,UAAyB,EACzB,QAAQ,EACR,cAAc,EACd,YAAmB,EACnB,eAAe,EACf,SAAS,EACT,OAAO,EACP,iBAAiB,EACjB,eAAe,EACf,MAAM,EACN,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACR,iBAAyB,EACzB,aAAa,EACb,SAAS,EACT,OAAO,EACP,YAAY,EACZ,aAAa,EACb,WAAW,EACX,aAAqB,EACrB,QAAQ,GACT,EAAE,gBAAgB,CAAC,OAAO,CAAC,+BAo/B3B"}
@@ -1,12 +1,12 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { emptySelection, extractMetaEntity, hierarchyOf, isSelected, queryPropertyFor, selectionSize, toggleSelected } from '@entifix/core';
3
+ import { canNameRecord, emptySelection, extractMetaEntity, hierarchyOf, isSelected, queryPropertyFor, recordLabel, selectionSize, toggleSelected } from '@entifix/core';
4
4
  import { Fragment, useId, useMemo, useRef, useState } from 'react';
5
5
  import { useEntityNoun, useLocale, useT, useTranslateKey } from '../../../i18n/index.js';
6
6
  import { availableUseCases, renderAnchor, useCasesForSurface } from '../../actions/index.js';
7
7
  import { useVerbInvoker } from '../../actions/use-verb-invoker.js';
8
8
  import { Button, button } from '../../atoms/button/index.js';
9
- import { CellValue } from '../../atoms/cell-value/index.js';
9
+ import { CellValue, useRecordLabel } from '../../atoms/cell-value/index.js';
10
10
  import { Checkbox } from '../../atoms/field/index.js';
11
11
  import { Skeleton } from '../../atoms/skeleton/index.js';
12
12
  import { Table, TableBody, TableCell, TableHead, TableHeaderCell, TableMessageRow, TableRow } from '../../atoms/table/index.js';
@@ -24,10 +24,11 @@ import { RegionState } from '../../molecules/region-state/index.js';
24
24
  import { SortBuilder } from '../../molecules/sort-builder/index.js';
25
25
  import { TableToolbar } from '../../molecules/table-toolbar/index.js';
26
26
  import { useFocusOnLoss } from '../../utils/use-focus-on-arrival.js';
27
+ import { cardRoles } from './card-roles.js';
27
28
  import { readEntityTableSlots } from './entity-table-slots.js';
28
29
  import { shownTreeRows, TreeCell, treeRows } from './entity-table-tree.js';
29
30
  import { nextHeaderSorting, sortKeys } from './header-sort.js';
30
- import { ACTIONS_WIDTH, pivotClasses, pivotWidth, SELECTION_WIDTH } from './pivot.js';
31
+ import { ACTIONS_WIDTH, columnWidth, pivotClasses, pivotWidths, SELECTION_WIDTH } from './pivot.js';
31
32
  import { useEntityTableColumns } from './use-entity-table-columns.js';
32
33
  import { useResultAnnouncement } from './use-result-announcement.js';
33
34
  /**
@@ -40,7 +41,7 @@ import { useResultAnnouncement } from './use-result-announcement.js';
40
41
  */ const SKELETON_ROW_CAP = 5;
41
42
  /** How many members a card shows as meta when none declares a `card` role. */ const UNDECLARED_META_CAP = 3;
42
43
  export function EntityTable({ entityConstructor, isLoading, skeleton = true, error, items, totalItems, currentPage, pageSize, onPageChange, onPageSizeChange, hrefFor, newHref, renderLink = renderAnchor, onSelect, preferencesKey, showControls = true, pivotBreakpoint, filtering, sorting, onFilteringChange, onSortingChange, facets, selection, onSelectionChange, metadata, isMetadataLoading = false, onBulkUseCase, onUseCase, onRetry, bulkOutcomes, onBulkDismiss, onBulkRetry, isBulkRunning = false, children }) {
43
- var _ref, _ref1;
44
+ var _ref, _ref1, _visibleColumns_find, _ref2;
44
45
  const t = useT();
45
46
  // A descriptor's label is a runtime catalog key — the typed gate cannot see
46
47
  // it, which is why a host's catalog check is what catches a typo.
@@ -94,12 +95,30 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
94
95
  * table's own box picks one — at the width its visible columns need. A
95
96
  * viewport breakpoint was wrong inside a split view, a drawer or a wizard
96
97
  * step, and a JS measurement would guess during SSR and correct after mount.
97
- */ const pivot = pivotClasses(pivotWidth(visibleColumns, (selectable ? SELECTION_WIDTH : 0) + (hasRowAction ? ACTIONS_WIDTH : 0), pivotBreakpoint));
98
+ */ /**
99
+ * The column every row reads as — the entity's `labelMember`, else its
100
+ * declared card title, else the first that can name a record — held in view
101
+ * at the inline start while a grid wider than its container scrolls.
102
+ */ const stickyTitle = (_ref1 = (_visibleColumns_find = visibleColumns.find((column)=>column.name === metaEntity.labelMember)) != null ? _visibleColumns_find : visibleColumns.find((column)=>column.card === 'title')) != null ? _ref1 : visibleColumns.find(canNameRecord);
103
+ const widths = pivotWidths({
104
+ columns: visibleColumns,
105
+ title: stickyTitle,
106
+ roleOf: cardRoles(visibleColumns),
107
+ extra: (selectable ? SELECTION_WIDTH : 0) + (hasRowAction ? ACTIONS_WIDTH : 0),
108
+ breakpoint: pivotBreakpoint
109
+ });
110
+ const pivot = pivotClasses(widths.essential);
111
+ /**
112
+ * The sticky title's cells: opaque, so the columns scrolling under it never
113
+ * show through — a header cell on the header's surface, a row's on the
114
+ * row's, following its hover.
115
+ */ const stickyClass = (column, part)=>column !== stickyTitle ? undefined : part === 'header' ? 'sticky start-0 z-2 bg-surface' : 'sticky start-0 z-1 bg-surface-elevated group-hover/row:bg-surface';
98
116
  /**
99
117
  * The first load has nothing to show and is held with a skeleton; a refetch
100
118
  * already has rows, so it keeps them and only marks the region busy. Splitting
101
119
  * the two is what stops every pagination click flashing grey.
102
120
  */ const isFirstLoad = isLoading && items.length === 0;
121
+ /** Loaded, nothing came back, and nothing failed: there are no rows to lay out. */ const settledEmpty = items.length === 0 && !isLoading && error === undefined;
103
122
  /** `true`/omitted → the built-in default; a node → that node; `false` → none. */ const customSkeleton = typeof skeleton === 'boolean' ? undefined : skeleton;
104
123
  const showSkeleton = isFirstLoad && skeleton !== false;
105
124
  const skeletonRows = Array.from({
@@ -110,23 +129,28 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
110
129
  * dimming them through opacity took the text under the contrast a reader
111
130
  * needs, on every page change.
112
131
  */ const busy = isLoading || undefined;
113
- /** The column a row reads *as*: the first non-identifier one it filled in. */ const titleColumn = (item)=>visibleColumns.find((column)=>{
114
- if (column.type === 'id') return false;
132
+ const nameOf = useRecordLabel();
133
+ /**
134
+ * The column a row reads *as*: the member `recordLabel()` names it by, when
135
+ * the reader has not hidden that column; else one declared `card: 'title'`;
136
+ * else the first visible one it filled in that is not a key — an id, a
137
+ * reference or a link names a row no better than its position does.
138
+ */ const declaredTitle = visibleColumns.find((column)=>column.card === 'title');
139
+ const linkColumn = (item)=>{
140
+ var _ref;
141
+ const label = recordLabel(entityConstructor, item);
142
+ const named = label.kind === 'fallback' ? undefined : visibleColumns.find((column)=>column.name === label.member.name);
143
+ return (_ref = named != null ? named : declaredTitle) != null ? _ref : visibleColumns.find((column)=>{
115
144
  const value = item[column.name];
116
- return value != null && String(value) !== '';
145
+ return canNameRecord(column) && value != null && String(value) !== '';
117
146
  });
118
- /** The column that links to the record: one declared `card: 'title'`, else the row's title. */ const declaredTitle = visibleColumns.find((column)=>column.card === 'title');
119
- const linkColumn = (item)=>declaredTitle != null ? declaredTitle : titleColumn(item);
147
+ };
120
148
  /**
121
149
  * What a record's card shows, by each member's declared `card` role or the
122
150
  * default: an id is hidden, the first enum is the badge, and up to
123
151
  * {@link UNDECLARED_META_CAP} more members are meta — a card is a summary,
124
152
  * and the grid holds the rest.
125
- */ const firstEnum = visibleColumns.find((column)=>column.card === undefined && column.type === 'enum');
126
- const roleOf = (column)=>{
127
- var _column_card;
128
- return (_column_card = column.card) != null ? _column_card : column.type === 'id' ? 'hidden' : column === firstEnum ? 'badge' : 'meta';
129
- };
153
+ */ const roleOf = cardRoles(visibleColumns);
130
154
  const cardParts = (item)=>{
131
155
  const title = linkColumn(item);
132
156
  const rest = visibleColumns.filter((column)=>column !== title);
@@ -233,26 +257,11 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
233
257
  setSelection(next);
234
258
  };
235
259
  /**
236
- * How a row names itself to a screen reader.
237
- *
238
- * The first visible column's value, because that is what the user reads the
239
- * row *as* — "Seleccionar Acme" rather than "Seleccionar fila 3", which tells
240
- * them the position they can already see and not the thing they cannot.
241
- */ const rowLabel = (item)=>{
242
- // The first non-identifier column **that this row actually filled in**.
243
- //
244
- // An id names a row the way "row 3" does: it repeats what the user can
245
- // already see. But skipping only the id is not enough — measured against
246
- // the seeded catalog, where `code` is the first non-id column and is empty
247
- // on every brand, so the label fell straight through to the id and never
248
- // reached `name`. A column that is blank on this row names it no better
249
- // than its position does, so the search continues past it.
250
- //
251
- // The id remains the last resort, because a row with nothing rendered
252
- // still has to announce itself.
253
- const named = titleColumn(item);
254
- return named ? String(item[named.name]) : String(item.id);
255
- };
260
+ * How a row names itself — to a screen reader on its checkbox, in a confirm
261
+ * dialog, a bulk result, a tree toggle: what the reader reads the row *as*
262
+ * ("Seleccionar Acme", never "Seleccionar fila 3" and never a whole id),
263
+ * through the one derivation every surface shares.
264
+ */ const rowLabel = (item)=>nameOf(entityConstructor, item);
256
265
  const selectionCell = (item, index, // Passed in rather than closed over: this is only ever called under
257
266
  // `selectable`, which already proves the selection exists, and reading the
258
267
  // optional prop here would add a fallback arm that nothing can reach.
@@ -369,7 +378,7 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
369
378
  const locale = useLocale();
370
379
  const panelId = useId();
371
380
  const keys = sortKeys(sorting, columns);
372
- const activeFilters = (_ref1 = filtering == null ? void 0 : filtering.values.length) != null ? _ref1 : 0;
381
+ const activeFilters = (_ref2 = filtering == null ? void 0 : filtering.values.length) != null ? _ref2 : 0;
373
382
  const results = t('table.results', {
374
383
  count: totalItems
375
384
  });
@@ -402,11 +411,13 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
402
411
  var _keys_position;
403
412
  const label = (_column_header = column.header) != null ? _column_header : column.label;
404
413
  if (!column.sortable || onSortingChange === undefined) return /*#__PURE__*/ _jsx(TableHeaderCell, {
414
+ className: stickyClass(column, 'header'),
405
415
  children: label
406
416
  }, column.name);
407
417
  const position = keys.findIndex((key)=>key.member === column.name);
408
418
  const type = (_keys_position = keys[position]) == null ? void 0 : _keys_position.type;
409
419
  return /*#__PURE__*/ _jsx(TableHeaderCell, {
420
+ className: stickyClass(column, 'header'),
410
421
  "aria-sort": position === 0 ? type === 'asc' ? 'ascending' : 'descending' : undefined,
411
422
  children: /*#__PURE__*/ _jsxs("button", {
412
423
  type: "button",
@@ -432,6 +443,7 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
432
443
  };
433
444
  /** A panel toggle: its state said by `aria-expanded`, and its count shown. */ const panelToggle = (which, count)=>/*#__PURE__*/ _jsxs(Button, {
434
445
  type: "button",
446
+ id: `${panelId}-${which}`,
435
447
  variant: panel === which ? 'primary' : 'secondary',
436
448
  size: "sm",
437
449
  "aria-expanded": panel === which,
@@ -535,12 +547,19 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
535
547
  hasStaleData: items.length > 0,
536
548
  isEmpty: items.length === 0,
537
549
  isFiltered: activeFilters > 0,
538
- onClearFilters: onFilteringChange === undefined ? undefined : ()=>onFilteringChange({
550
+ onClearFilters: onFilteringChange === undefined ? undefined : ()=>{
551
+ var // The button goes with the empty state it sits in, so focus
552
+ // moves first to the control that filters — still there, and
553
+ // where a reader would go next — never to `<body>`.
554
+ _document_getElementById;
555
+ (_document_getElementById = document.getElementById(`${panelId}-filters`)) == null ? void 0 : _document_getElementById.focus();
556
+ onFilteringChange({
539
557
  // Only offered under a filter, so there is one to keep the
540
558
  // logic of.
541
559
  operator: filtering.operator,
542
560
  values: []
543
- }),
561
+ });
562
+ },
544
563
  emptyAction: mayCreate ? renderLink({
545
564
  href: newHref,
546
565
  className: button({
@@ -552,152 +571,177 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
552
571
  }
553
572
  }) : undefined
554
573
  }),
555
- /*#__PURE__*/ _jsx("div", {
556
- className: pivot.grid,
557
- "aria-busy": busy,
558
- children: /*#__PURE__*/ _jsxs(Table, {
559
- caption: caption,
560
- containerClassName: "max-h-(--table-max-block) scroll-pt-12",
561
- children: [
562
- /*#__PURE__*/ _jsx(TableHead, {
563
- children: slots.header ? slots.header.render(visibleColumns) : /*#__PURE__*/ _jsxs("tr", {
564
- children: [
565
- selectable && /*#__PURE__*/ _jsx(TableHeaderCell, {
566
- children: /*#__PURE__*/ _jsx(Checkbox, {
567
- "aria-label": t('table.selectAllOnPage'),
568
- checked: allOnPageSelected,
569
- indeterminate: someOnPageSelected,
570
- disabled: isBulkRunning || items.length === 0,
571
- onChange: (event)=>toggleAllOnPage(event.currentTarget.checked, selectionState)
572
- })
573
- }),
574
- visibleColumns.map(headerCell),
575
- hasRowAction && /*#__PURE__*/ _jsx(TableHeaderCell, {
576
- children: t('table.actions')
577
- })
578
- ]
579
- })
580
- }),
581
- /*#__PURE__*/ _jsxs(TableBody, {
574
+ !settledEmpty && /*#__PURE__*/ _jsxs(_Fragment, {
575
+ children: [
576
+ /*#__PURE__*/ _jsx("div", {
577
+ className: pivot.grid,
578
+ "aria-busy": busy,
579
+ children: /*#__PURE__*/ _jsxs(Table, {
580
+ caption: caption,
581
+ containerClassName: "max-h-(--table-max-block) scroll-pt-12",
582
+ // Never narrower than its columns side by side: between the
583
+ // essential width and that, the grid scrolls rather than crushing
584
+ // every column into an unreadable sliver.
585
+ style: {
586
+ minWidth: `${widths.full}rem`
587
+ },
588
+ // A focused cell scrolled sideways is never left under the
589
+ // sticky title column (WCAG 2.4.11).
590
+ containerStyle: stickyTitle === undefined ? undefined : {
591
+ scrollPaddingInlineStart: `${columnWidth(stickyTitle)}rem`
592
+ },
582
593
  children: [
583
- showSkeleton && (customSkeleton ? /*#__PURE__*/ _jsx(TableMessageRow, {
584
- colSpan: columnCount,
585
- children: customSkeleton
586
- }) : skeletonRows.map((row)=>/*#__PURE__*/ _jsxs(TableRow, {
594
+ /*#__PURE__*/ _jsx(TableHead, {
595
+ children: slots.header ? slots.header.render(visibleColumns) : /*#__PURE__*/ _jsxs("tr", {
587
596
  children: [
588
- selectable && /*#__PURE__*/ _jsx(TableCell, {
589
- children: /*#__PURE__*/ _jsx(Skeleton, {
590
- shape: "line",
591
- className: "w-4"
597
+ selectable && /*#__PURE__*/ _jsx(TableHeaderCell, {
598
+ children: /*#__PURE__*/ _jsx(Checkbox, {
599
+ "aria-label": t('table.selectAllOnPage'),
600
+ checked: allOnPageSelected,
601
+ indeterminate: someOnPageSelected,
602
+ disabled: isBulkRunning || items.length === 0,
603
+ onChange: (event)=>toggleAllOnPage(event.currentTarget.checked, selectionState)
592
604
  })
593
605
  }),
594
- visibleColumns.map((column)=>/*#__PURE__*/ _jsx(TableCell, {
595
- children: /*#__PURE__*/ _jsx(Skeleton, {
596
- shape: "line",
597
- className: "w-full"
598
- })
599
- }, column.name)),
600
- hasRowAction && /*#__PURE__*/ _jsx(TableCell, {
601
- children: /*#__PURE__*/ _jsx(Skeleton, {
602
- shape: "line",
603
- className: "w-16"
604
- })
605
- })
606
- ]
607
- }, row))),
608
- shown.map(({ item, depth, hasChildren }, index)=>{
609
- var _item_id, _item_id1;
610
- return slots.row ? // A Fragment carries the key without wrapping the custom row in
611
- // an element `<tbody>` would reject.
612
- /*#__PURE__*/ _jsx(Fragment, {
613
- children: slots.row.render(item, visibleColumns)
614
- }, String((_item_id = item.id) != null ? _item_id : index)) : /*#__PURE__*/ _jsxs(TableRow, {
615
- "data-record-id": `${rowScope}${String(item.id)}`,
616
- children: [
617
- selectionState && /*#__PURE__*/ _jsx(TableCell, {
618
- children: selectionCell(item, index, selectionState)
619
- }),
620
- visibleColumns.map((column, columnIndex)=>/*#__PURE__*/ _jsx(TableCell, {
621
- children: treeKeys !== undefined && columnIndex === 0 ? /*#__PURE__*/ _jsx(TreeCell, {
622
- depth: depth,
623
- hasChildren: hasChildren,
624
- expanded: !collapsed.has(treeKeys.idOf(item)),
625
- label: t(collapsed.has(treeKeys.idOf(item)) ? 'table.expandRow' : 'table.collapseRow', {
626
- record: rowLabel(item)
627
- }),
628
- onToggle: ()=>toggleCollapsed(treeKeys.idOf(item)),
629
- children: renderCell(column, item)
630
- }) : renderCell(column, item)
631
- }, column.name)),
632
- hasRowAction && /*#__PURE__*/ _jsx(TableCell, {
633
- children: recordAction(item)
606
+ visibleColumns.map(headerCell),
607
+ hasRowAction && /*#__PURE__*/ _jsx(TableHeaderCell, {
608
+ children: t('table.actions')
634
609
  })
635
610
  ]
636
- }, String((_item_id1 = item.id) != null ? _item_id1 : index));
611
+ })
612
+ }),
613
+ /*#__PURE__*/ _jsxs(TableBody, {
614
+ children: [
615
+ showSkeleton && (customSkeleton ? /*#__PURE__*/ _jsx(TableMessageRow, {
616
+ colSpan: columnCount,
617
+ children: customSkeleton
618
+ }) : skeletonRows.map((row)=>/*#__PURE__*/ _jsxs(TableRow, {
619
+ children: [
620
+ selectable && /*#__PURE__*/ _jsx(TableCell, {
621
+ children: /*#__PURE__*/ _jsx(Skeleton, {
622
+ shape: "line",
623
+ className: "w-4"
624
+ })
625
+ }),
626
+ visibleColumns.map((column)=>/*#__PURE__*/ _jsx(TableCell, {
627
+ children: /*#__PURE__*/ _jsx(Skeleton, {
628
+ shape: "line",
629
+ className: "w-full"
630
+ })
631
+ }, column.name)),
632
+ hasRowAction && /*#__PURE__*/ _jsx(TableCell, {
633
+ children: /*#__PURE__*/ _jsx(Skeleton, {
634
+ shape: "line",
635
+ className: "w-16"
636
+ })
637
+ })
638
+ ]
639
+ }, row))),
640
+ shown.map(({ item, depth, hasChildren }, index)=>{
641
+ var _item_id, _item_id1;
642
+ return slots.row ? // A Fragment carries the key without wrapping the custom row in
643
+ // an element `<tbody>` would reject.
644
+ /*#__PURE__*/ _jsx(Fragment, {
645
+ children: slots.row.render(item, visibleColumns)
646
+ }, String((_item_id = item.id) != null ? _item_id : index)) : /*#__PURE__*/ _jsxs(TableRow, {
647
+ "data-record-id": `${rowScope}${String(item.id)}`,
648
+ className: "group/row",
649
+ children: [
650
+ selectionState && /*#__PURE__*/ _jsx(TableCell, {
651
+ children: selectionCell(item, index, selectionState)
652
+ }),
653
+ visibleColumns.map((column, columnIndex)=>/*#__PURE__*/ _jsx(TableCell, {
654
+ className: stickyClass(column, 'body'),
655
+ children: treeKeys !== undefined && columnIndex === 0 ? /*#__PURE__*/ _jsx(TreeCell, {
656
+ depth: depth,
657
+ hasChildren: hasChildren,
658
+ expanded: !collapsed.has(treeKeys.idOf(item)),
659
+ label: t(collapsed.has(treeKeys.idOf(item)) ? 'table.expandRow' : 'table.collapseRow', {
660
+ record: rowLabel(item)
661
+ }),
662
+ onToggle: ()=>toggleCollapsed(treeKeys.idOf(item)),
663
+ children: renderCell(column, item)
664
+ }) : renderCell(column, item)
665
+ }, column.name)),
666
+ hasRowAction && /*#__PURE__*/ _jsx(TableCell, {
667
+ children: recordAction(item)
668
+ })
669
+ ]
670
+ }, String((_item_id1 = item.id) != null ? _item_id1 : index));
671
+ })
672
+ ]
637
673
  })
638
674
  ]
639
675
  })
640
- ]
641
- })
642
- }),
643
- /*#__PURE__*/ _jsxs("div", {
644
- className: pivot.cards,
645
- "aria-busy": busy,
646
- children: [
647
- showSkeleton && (customSkeleton != null ? customSkeleton : /*#__PURE__*/ _jsx("ul", {
648
- role: "list",
649
- className: "m-0 p-0 flex list-none flex-col gap-2xs",
650
- children: skeletonRows.map((row)=>/*#__PURE__*/ _jsx("li", {
651
- children: /*#__PURE__*/ _jsx(EntityRecordCard, {
652
- title: /*#__PURE__*/ _jsx(Skeleton, {
653
- shape: "line",
654
- className: "w-32"
655
- }),
656
- meta: visibleColumns.slice(1).map((column)=>({
657
- key: column.name,
658
- label: column.label,
659
- value: /*#__PURE__*/ _jsx(Skeleton, {
676
+ }),
677
+ /*#__PURE__*/ _jsxs("div", {
678
+ className: pivot.cards,
679
+ "aria-busy": busy,
680
+ children: [
681
+ showSkeleton && (customSkeleton != null ? customSkeleton : /*#__PURE__*/ _jsx("ul", {
682
+ role: "list",
683
+ className: "m-0 p-0 flex list-none flex-col gap-2xs",
684
+ children: skeletonRows.map((row)=>/*#__PURE__*/ _jsx("li", {
685
+ children: /*#__PURE__*/ _jsx(EntityRecordCard, {
686
+ title: /*#__PURE__*/ _jsx(Skeleton, {
660
687
  shape: "line",
661
- className: "w-24"
662
- })
663
- }))
664
- })
665
- }, row))
666
- })),
667
- shown.length > 0 && /*#__PURE__*/ _jsx("ul", {
668
- role: "list",
669
- className: "m-0 p-0 flex list-none flex-col gap-2xs",
670
- children: shown.map(({ item, depth }, index)=>{
671
- var _item_id;
672
- const parts = cardParts(item);
673
- return /*#__PURE__*/ _jsx("li", {
674
- "data-record-id": `${rowScope}${String(item.id)}`,
675
- // A tree's card says how deep it sits, as its row does.
676
- "aria-level": treeKeys === undefined ? undefined : depth + 1,
677
- style: treeKeys === undefined ? undefined : {
678
- marginInlineStart: `${depth * 1.5}rem`
679
- },
680
- children: /*#__PURE__*/ _jsx(EntityRecordCard, {
681
- // The same renderers as the grid, so the two layouts agree.
682
- title: parts.title === undefined ? rowLabel(item) : renderCell(parts.title, item),
683
- subtitle: parts.subtitle === undefined ? undefined : renderCell(parts.subtitle, item),
684
- badges: parts.badges.map((column)=>({
685
- key: column.name,
686
- value: renderCell(column, item)
687
- })),
688
- meta: parts.meta.map((column)=>{
689
- var _column_header;
690
- return {
691
- key: column.name,
692
- label: (_column_header = column.header) != null ? _column_header : column.label,
693
- value: renderCell(column, item)
694
- };
695
- }),
696
- leading: selectionState ? selectionCell(item, index, selectionState) : undefined,
697
- actions: recordAction(item)
688
+ className: "w-32"
689
+ }),
690
+ meta: visibleColumns.slice(1).map((column)=>({
691
+ key: column.name,
692
+ label: column.label,
693
+ value: /*#__PURE__*/ _jsx(Skeleton, {
694
+ shape: "line",
695
+ className: "w-24"
696
+ })
697
+ }))
698
+ })
699
+ }, row))
700
+ })),
701
+ shown.length > 0 && /*#__PURE__*/ _jsx("ul", {
702
+ role: "list",
703
+ className: "m-0 p-0 flex list-none flex-col gap-2xs",
704
+ children: shown.map(({ item, depth }, index)=>{
705
+ var _item_id;
706
+ const parts = cardParts(item);
707
+ return /*#__PURE__*/ _jsx("li", {
708
+ "data-record-id": `${rowScope}${String(item.id)}`,
709
+ // A tree's card says how deep it sits, as its row does.
710
+ "aria-level": treeKeys === undefined ? undefined : depth + 1,
711
+ style: treeKeys === undefined ? undefined : {
712
+ marginInlineStart: `${depth * 1.5}rem`
713
+ },
714
+ children: /*#__PURE__*/ _jsx(EntityRecordCard, {
715
+ // The same renderers as the grid, so the two layouts agree.
716
+ title: parts.title === undefined ? hrefFor === undefined || onSelect !== undefined ? rowLabel(item) : renderLink({
717
+ href: hrefFor(item.id),
718
+ className: linkClassName,
719
+ children: rowLabel(item),
720
+ intent: {
721
+ kind: 'open',
722
+ id: item.id
723
+ }
724
+ }) : renderCell(parts.title, item),
725
+ subtitle: parts.subtitle === undefined ? undefined : renderCell(parts.subtitle, item),
726
+ badges: parts.badges.map((column)=>({
727
+ key: column.name,
728
+ value: renderCell(column, item)
729
+ })),
730
+ meta: parts.meta.map((column)=>{
731
+ var _column_header;
732
+ return {
733
+ key: column.name,
734
+ label: (_column_header = column.header) != null ? _column_header : column.label,
735
+ value: renderCell(column, item)
736
+ };
737
+ }),
738
+ leading: selectionState ? selectionCell(item, index, selectionState) : undefined,
739
+ actions: recordAction(item)
740
+ })
741
+ }, String((_item_id = item.id) != null ? _item_id : index));
698
742
  })
699
- }, String((_item_id = item.id) != null ? _item_id : index));
700
- })
743
+ })
744
+ ]
701
745
  })
702
746
  ]
703
747
  }),