@contember/bindx-dataview 0.1.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 (114) hide show
  1. package/dist/DataGrid.d.ts +38 -0
  2. package/dist/DataGrid.d.ts.map +1 -0
  3. package/dist/DataViewContext.d.ts +39 -0
  4. package/dist/DataViewContext.d.ts.map +1 -0
  5. package/dist/DataViewKeyProvider.d.ts +8 -0
  6. package/dist/DataViewKeyProvider.d.ts.map +1 -0
  7. package/dist/HasManyDataGrid.d.ts +51 -0
  8. package/dist/HasManyDataGrid.d.ts.map +1 -0
  9. package/dist/columnLeaf.d.ts +72 -0
  10. package/dist/columnLeaf.d.ts.map +1 -0
  11. package/dist/columnTypes.d.ts +35 -0
  12. package/dist/columnTypes.d.ts.map +1 -0
  13. package/dist/columns.d.ts +115 -0
  14. package/dist/columns.d.ts.map +1 -0
  15. package/dist/contextHooks.d.ts +45 -0
  16. package/dist/contextHooks.d.ts.map +1 -0
  17. package/dist/createColumn.d.ts +37 -0
  18. package/dist/createColumn.d.ts.map +1 -0
  19. package/dist/createRelationColumn.d.ts +57 -0
  20. package/dist/createRelationColumn.d.ts.map +1 -0
  21. package/dist/dataAttribute.d.ts +6 -0
  22. package/dist/dataAttribute.d.ts.map +1 -0
  23. package/dist/export.d.ts +46 -0
  24. package/dist/export.d.ts.map +1 -0
  25. package/dist/filterComponents.d.ts +127 -0
  26. package/dist/filterComponents.d.ts.map +1 -0
  27. package/dist/filterContext.d.ts +10 -0
  28. package/dist/filterContext.d.ts.map +1 -0
  29. package/dist/filterHooks.d.ts +74 -0
  30. package/dist/filterHooks.d.ts.map +1 -0
  31. package/dist/filterScope.d.ts +54 -0
  32. package/dist/filterScope.d.ts.map +1 -0
  33. package/dist/filterWrappers.d.ts +66 -0
  34. package/dist/filterWrappers.d.ts.map +1 -0
  35. package/dist/index.d.ts +28 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/infiniteLoad.d.ts +32 -0
  38. package/dist/infiniteLoad.d.ts.map +1 -0
  39. package/dist/loaderComponents.d.ts +75 -0
  40. package/dist/loaderComponents.d.ts.map +1 -0
  41. package/dist/markers.d.ts +36 -0
  42. package/dist/markers.d.ts.map +1 -0
  43. package/dist/pagingComponents.d.ts +50 -0
  44. package/dist/pagingComponents.d.ts.map +1 -0
  45. package/dist/renderCellValue.d.ts +9 -0
  46. package/dist/renderCellValue.d.ts.map +1 -0
  47. package/dist/select/MultiSelect.d.ts +27 -0
  48. package/dist/select/MultiSelect.d.ts.map +1 -0
  49. package/dist/select/Select.d.ts +27 -0
  50. package/dist/select/Select.d.ts.map +1 -0
  51. package/dist/select/SelectDataView.d.ts +46 -0
  52. package/dist/select/SelectDataView.d.ts.map +1 -0
  53. package/dist/select/SelectEachValue.d.ts +20 -0
  54. package/dist/select/SelectEachValue.d.ts.map +1 -0
  55. package/dist/select/SelectItemTrigger.d.ts +25 -0
  56. package/dist/select/SelectItemTrigger.d.ts.map +1 -0
  57. package/dist/select/SelectOption.d.ts +23 -0
  58. package/dist/select/SelectOption.d.ts.map +1 -0
  59. package/dist/select/SelectPlaceholder.d.ts +16 -0
  60. package/dist/select/SelectPlaceholder.d.ts.map +1 -0
  61. package/dist/select/index.d.ts +9 -0
  62. package/dist/select/index.d.ts.map +1 -0
  63. package/dist/select/selectContext.d.ts +20 -0
  64. package/dist/select/selectContext.d.ts.map +1 -0
  65. package/dist/selectionComponents.d.ts +62 -0
  66. package/dist/selectionComponents.d.ts.map +1 -0
  67. package/dist/sortingComponents.d.ts +39 -0
  68. package/dist/sortingComponents.d.ts.map +1 -0
  69. package/dist/stateStorage.d.ts +20 -0
  70. package/dist/stateStorage.d.ts.map +1 -0
  71. package/dist/useDataGridSetup.d.ts +53 -0
  72. package/dist/useDataGridSetup.d.ts.map +1 -0
  73. package/dist/useDataView.d.ts +57 -0
  74. package/dist/useDataView.d.ts.map +1 -0
  75. package/dist/useDataViewState.d.ts +89 -0
  76. package/dist/useDataViewState.d.ts.map +1 -0
  77. package/package.json +33 -0
  78. package/src/DataGrid.tsx +173 -0
  79. package/src/DataViewContext.tsx +56 -0
  80. package/src/DataViewKeyProvider.tsx +16 -0
  81. package/src/HasManyDataGrid.tsx +319 -0
  82. package/src/columnLeaf.ts +148 -0
  83. package/src/columnTypes.ts +160 -0
  84. package/src/columns.tsx +306 -0
  85. package/src/contextHooks.ts +157 -0
  86. package/src/createColumn.ts +128 -0
  87. package/src/createRelationColumn.tsx +203 -0
  88. package/src/dataAttribute.ts +7 -0
  89. package/src/export.tsx +219 -0
  90. package/src/filterComponents.tsx +617 -0
  91. package/src/filterContext.ts +27 -0
  92. package/src/filterHooks.ts +386 -0
  93. package/src/filterScope.tsx +89 -0
  94. package/src/filterWrappers.tsx +187 -0
  95. package/src/index.ts +356 -0
  96. package/src/infiniteLoad.tsx +188 -0
  97. package/src/loaderComponents.tsx +239 -0
  98. package/src/markers.ts +54 -0
  99. package/src/pagingComponents.tsx +149 -0
  100. package/src/select/MultiSelect.tsx +88 -0
  101. package/src/select/Select.tsx +88 -0
  102. package/src/select/SelectDataView.tsx +231 -0
  103. package/src/select/SelectEachValue.tsx +34 -0
  104. package/src/select/SelectItemTrigger.tsx +51 -0
  105. package/src/select/SelectOption.tsx +40 -0
  106. package/src/select/SelectPlaceholder.tsx +22 -0
  107. package/src/select/index.ts +17 -0
  108. package/src/select/selectContext.ts +82 -0
  109. package/src/selectionComponents.tsx +160 -0
  110. package/src/sortingComponents.tsx +104 -0
  111. package/src/stateStorage.ts +188 -0
  112. package/src/useDataGridSetup.ts +230 -0
  113. package/src/useDataView.ts +148 -0
  114. package/src/useDataViewState.ts +404 -0
@@ -0,0 +1,38 @@
1
+ /**
2
+ * DataGrid component — headless data grid for top-level entity lists.
3
+ * Uses useEntityList for data loading.
4
+ *
5
+ * For has-many relation grids, use HasManyDataGrid instead.
6
+ */
7
+ import { type ReactElement, type ReactNode } from 'react';
8
+ import type { EntityDef, EntityAccessor, OrderDirection, DataViewLayout, SelectionValues, CommonEntity } from '@contember/bindx';
9
+ import type { StateStorageOrName } from './stateStorage.js';
10
+ import { QUERY_FILTER_NAME } from './useDataGridSetup.js';
11
+ export { QUERY_FILTER_NAME };
12
+ export interface DataGridProps<TRoleMap extends Record<string, object> = Record<string, object>> {
13
+ /** Entity definition */
14
+ entity: EntityDef<TRoleMap>;
15
+ /** Children render function: receives entity proxy `it`, returns column markers + layout */
16
+ children: (it: EntityAccessor<CommonEntity<TRoleMap>>) => ReactNode;
17
+ /** Initial sorting (supports multi-column: { title: 'asc', date: 'desc' }) */
18
+ initialSorting?: Partial<Record<string, OrderDirection>>;
19
+ /** Items per page. null = show all. Default: 50 */
20
+ itemsPerPage?: number | null;
21
+ /** Static filter (combined with dynamic filters) */
22
+ filter?: Record<string, unknown>;
23
+ /** Available layouts */
24
+ layouts?: readonly DataViewLayout[];
25
+ /** Initial selection (layout + visibility) */
26
+ initialSelection?: SelectionValues;
27
+ /** State storage for filter/sorting/selection state */
28
+ stateStorage?: StateStorageOrName;
29
+ /** State storage for current page */
30
+ currentPageStateStorage?: StateStorageOrName;
31
+ /** State storage for page size preference */
32
+ pagingSettingsStorage?: StateStorageOrName;
33
+ /** Storage key prefix for isolation */
34
+ storageKey?: string;
35
+ }
36
+ declare function DataGridImpl<TRoleMap extends Record<string, object>>({ entity, children, initialSorting, itemsPerPage, filter: staticFilter, layouts, initialSelection, stateStorage, currentPageStateStorage, pagingSettingsStorage, storageKey, }: DataGridProps<TRoleMap>): ReactElement | null;
37
+ export declare const DataGrid: typeof DataGridImpl;
38
+ //# sourceMappingURL=DataGrid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataGrid.d.ts","sourceRoot":"","sources":["../src/DataGrid.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAQ,KAAK,YAAY,EAAE,KAAK,SAAS,EAAqD,MAAM,OAAO,CAAA;AAClH,OAAO,KAAK,EACX,SAAS,EACT,cAAc,EACd,cAAc,EAC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,MAAM,EAAE,YAAY,EACpB,OAAO,EACP,gBAAgB,EAChB,YAAY,EACZ,uBAAuB,EACvB,qBAAqB,EACrB,UAAU,GACV,EAAE,aAAa,CAAC,QAAQ,CAAC,GAAG,YAAY,GAAG,IAAI,CA8F/C;AAMD,eAAO,MAAM,QAAQ,EAAoC,OAAO,YAAY,CAAA"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * DataView context — provides filtering, sorting, paging, selection state,
3
+ * and utility methods to descendant components.
4
+ */
5
+ import React from 'react';
6
+ import type { FilteringState, SortingStateResult, PagingStateResult, SelectionStateResult } from './useDataViewState.js';
7
+ import type { ColumnLeafProps } from './columnLeaf.js';
8
+ import type { EntityAccessor, SelectionMeta } from '@contember/bindx';
9
+ export type DataViewLoaderState = 'initial' | 'loaded' | 'refreshing' | 'failed';
10
+ export type DataViewItem = EntityAccessor<object>;
11
+ export interface DataViewElementData {
12
+ readonly name: string;
13
+ readonly label?: React.ReactNode;
14
+ readonly fallback?: boolean;
15
+ }
16
+ export interface DataViewContextValue {
17
+ readonly filtering: FilteringState;
18
+ readonly sorting: SortingStateResult;
19
+ readonly paging: PagingStateResult;
20
+ readonly selection: SelectionStateResult;
21
+ readonly columns: readonly ColumnLeafProps[];
22
+ readonly entityType: string;
23
+ readonly items: readonly DataViewItem[];
24
+ readonly itemCount: number;
25
+ readonly loaderState: DataViewLoaderState;
26
+ readonly reload: () => void;
27
+ readonly highlightIndex: number | null;
28
+ readonly setHighlightIndex: (index: number | null) => void;
29
+ readonly selectionMeta: SelectionMeta;
30
+ readonly toolbarContent?: React.ReactNode;
31
+ /** Named layout render callbacks — analyzed during collection, called per item at runtime */
32
+ readonly layoutRenders: ReadonlyMap<string, (item: DataViewItem) => React.ReactNode>;
33
+ /** Elements per layout — extracted from layout render callbacks during collection */
34
+ readonly layoutElements: ReadonlyMap<string, readonly DataViewElementData[]>;
35
+ }
36
+ export declare function useDataViewContext(): DataViewContextValue;
37
+ export declare function useOptionalDataViewContext(): DataViewContextValue | null;
38
+ export declare const DataViewProvider: React.Provider<DataViewContextValue | null>;
39
+ //# sourceMappingURL=DataViewContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataViewContext.d.ts","sourceRoot":"","sources":["../src/DataViewContext.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAoC,MAAM,OAAO,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACxH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAErE,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,YAAY,GAAG,QAAQ,CAAA;AAEhF,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,MAAM,CAAC,CAAA;AAEjD,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAC3B;AAED,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAA;IAClC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAA;IACpC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAA;IAClC,QAAQ,CAAC,SAAS,EAAE,oBAAoB,CAAA;IACxC,QAAQ,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,CAAA;IAC5C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAA;IACvC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAA;IACzC,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAA;IAC3B,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IACtC,QAAQ,CAAC,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IAC1D,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAA;IACrC,QAAQ,CAAC,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACzC,6FAA6F;IAC7F,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,KAAK,CAAC,SAAS,CAAC,CAAA;IACpF,qFAAqF;IACrF,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,mBAAmB,EAAE,CAAC,CAAA;CAC5E;AAID,wBAAgB,kBAAkB,IAAI,oBAAoB,CAMzD;AAED,wBAAgB,0BAA0B,IAAI,oBAAoB,GAAG,IAAI,CAExE;AAED,eAAO,MAAM,gBAAgB,6CAA2B,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { type ReactNode } from 'react';
2
+ export interface DataViewKeyProviderProps {
3
+ readonly value: string;
4
+ readonly children: ReactNode;
5
+ }
6
+ export declare function DataViewKeyProvider({ value, children }: DataViewKeyProviderProps): ReactNode;
7
+ export declare function useDataViewKey(fallback?: string): string;
8
+ //# sourceMappingURL=DataViewKeyProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataViewKeyProvider.d.ts","sourceRoot":"","sources":["../src/DataViewKeyProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjE,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;CAC5B;AAED,wBAAgB,mBAAmB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,wBAAwB,GAAG,SAAS,CAE5F;AAED,wBAAgB,cAAc,CAAC,QAAQ,SAAa,GAAG,MAAM,CAE5D"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * HasManyDataGrid — headless data grid for has-many relation fields.
3
+ * Fetches relation data from the parent entity with dynamic filter/sort/page params.
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * <Entity entity={schema.Author} by={{ id }}>
8
+ * {(author) => (
9
+ * <HasManyDataGrid field={author.articles}>
10
+ * {(it) => (
11
+ * <>
12
+ * <TextColumn field={it.title} />
13
+ * <BooleanColumn field={it.active} />
14
+ * </>
15
+ * )}
16
+ * </HasManyDataGrid>
17
+ * )}
18
+ * </Entity>
19
+ * ```
20
+ */
21
+ import { type ReactElement, type ReactNode } from 'react';
22
+ import type { EntityAccessor, HasManyRef, OrderDirection, DataViewLayout, SelectionValues } from '@contember/bindx';
23
+ import type { StateStorageOrName } from './stateStorage.js';
24
+ export interface HasManyDataGridProps<TEntity extends object = object> {
25
+ /** Has-many relation field from parent entity */
26
+ field: HasManyRef<TEntity, any>;
27
+ /** Children render function: receives entity proxy `it`, returns column markers + layout */
28
+ children: (it: EntityAccessor<TEntity>) => ReactNode;
29
+ /** Initial sorting */
30
+ initialSorting?: Partial<Record<string, OrderDirection>>;
31
+ /** Items per page. null = show all. Default: 50 */
32
+ itemsPerPage?: number | null;
33
+ /** Static filter (combined with dynamic filters) */
34
+ filter?: Record<string, unknown>;
35
+ /** Available layouts */
36
+ layouts?: readonly DataViewLayout[];
37
+ /** Initial selection (layout + visibility) */
38
+ initialSelection?: SelectionValues;
39
+ /** State storage for filter/sorting/selection state */
40
+ stateStorage?: StateStorageOrName;
41
+ /** State storage for current page */
42
+ currentPageStateStorage?: StateStorageOrName;
43
+ /** State storage for page size preference */
44
+ pagingSettingsStorage?: StateStorageOrName;
45
+ /** Storage key prefix for isolation */
46
+ storageKey?: string;
47
+ }
48
+ declare function HasManyDataGridImpl<TEntity extends object>({ field, children, initialSorting, itemsPerPage, filter: staticFilter, layouts, initialSelection, stateStorage, currentPageStateStorage, pagingSettingsStorage, storageKey, }: HasManyDataGridProps<TEntity>): ReactElement | null;
49
+ export declare const HasManyDataGrid: typeof HasManyDataGridImpl;
50
+ export {};
51
+ //# sourceMappingURL=HasManyDataGrid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HasManyDataGrid.d.ts","sourceRoot":"","sources":["../src/HasManyDataGrid.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAQ,KAAK,YAAY,EAAE,KAAK,SAAS,EAAqD,MAAM,OAAO,CAAA;AAClH,OAAO,KAAK,EACX,cAAc,EACd,UAAU,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,MAAM,kBAAkB,CAAA;AASzB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAY3D,MAAM,WAAW,oBAAoB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IACpE,iDAAiD;IAEjD,KAAK,EAAE,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;IAC/B,4FAA4F;IAC5F,QAAQ,EAAE,CAAC,EAAE,EAAE,cAAc,CAAC,OAAO,CAAC,KAAK,SAAS,CAAA;IACpD,sBAAsB;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAA;IACxD,mDAAmD;IACnD,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,wBAAwB;IACxB,OAAO,CAAC,EAAE,SAAS,cAAc,EAAE,CAAA;IACnC,8CAA8C;IAC9C,gBAAgB,CAAC,EAAE,eAAe,CAAA;IAClC,uDAAuD;IACvD,YAAY,CAAC,EAAE,kBAAkB,CAAA;IACjC,qCAAqC;IACrC,uBAAuB,CAAC,EAAE,kBAAkB,CAAA;IAC5C,6CAA6C;IAC7C,qBAAqB,CAAC,EAAE,kBAAkB,CAAA;IAC1C,uCAAuC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB;AAkBD,iBAAS,mBAAmB,CAAC,OAAO,SAAS,MAAM,EAAE,EACpD,KAAK,EACL,QAAQ,EACR,cAAc,EACd,YAAiB,EACjB,MAAM,EAAE,YAAY,EACpB,OAAO,EACP,gBAAgB,EAChB,YAAY,EACZ,uBAAuB,EACvB,qBAAqB,EACrB,UAAU,GACV,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG,YAAY,GAAG,IAAI,CAiNrD;AAMD,eAAO,MAAM,eAAe,EAA2C,OAAO,mBAAmB,CAAA"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * ColumnLeaf — the data carrier for extracted column metadata.
3
+ *
4
+ * `ColumnLeaf` is a marker React component (returns null) whose props carry
5
+ * all column metadata. `analyzeChildren()` walks a JSX element tree,
6
+ * resolving components with `staticRender` and collecting props from registered
7
+ * marker types — a lightweight equivalent of contember-oss's ChildrenAnalyzer.
8
+ */
9
+ import React from 'react';
10
+ import type { FieldRefBase, FilterHandler, FilterArtifact, EntityAccessor } from '@contember/bindx';
11
+ /** All known column type literals for type narrowing */
12
+ export type ColumnType = 'text' | 'number' | 'date' | 'dateTime' | 'boolean' | 'uuid' | 'isDefined' | 'enum' | 'enumList' | 'hasOne' | 'hasMany' | 'action' | (string & {});
13
+ export interface ColumnLeafProps {
14
+ readonly name: string;
15
+ readonly fieldName: string | null;
16
+ readonly fieldRef: FieldRefBase<unknown> | null;
17
+ readonly sortingField: string | null;
18
+ readonly filterName: string | null;
19
+ readonly filterHandler: FilterHandler<FilterArtifact> | undefined;
20
+ readonly isTextSearchable: boolean;
21
+ readonly columnType?: ColumnType;
22
+ readonly collectSelection?: (collectorProxy: unknown) => void;
23
+ /** Enum type name for resolving options from context (e.g. 'DeploymentStatus') */
24
+ readonly enumName?: string;
25
+ /** Explicit enum options — value → label (overrides context-resolved options) */
26
+ readonly enumOptions?: Readonly<Record<string, React.ReactNode>>;
27
+ readonly relatedEntityName?: string;
28
+ readonly relatedSelection?: import('@contember/bindx').SelectionMeta;
29
+ readonly renderFilterItem?: (accessor: EntityAccessor<object>) => React.ReactNode;
30
+ readonly header?: React.ReactNode;
31
+ readonly renderCell: (accessor: EntityAccessor<object>) => React.ReactNode;
32
+ readonly renderFilter?: (props: {
33
+ artifact: FilterArtifact;
34
+ setArtifact: (artifact: FilterArtifact) => void;
35
+ }) => React.ReactNode;
36
+ readonly renderCellWrapper?: (content: React.ReactNode, item: EntityAccessor<object>) => React.ReactNode;
37
+ }
38
+ /** Type guard for relation columns */
39
+ export declare function isRelationColumn(col: ColumnLeafProps): col is ColumnLeafProps & {
40
+ columnType: 'hasOne' | 'hasMany';
41
+ relatedEntityName: string;
42
+ renderFilterItem: (accessor: EntityAccessor<object>) => React.ReactNode;
43
+ };
44
+ /**
45
+ * Marker component — returns null at runtime.
46
+ * Its props are the column metadata extracted by `analyzeChildren()`.
47
+ */
48
+ export declare function ColumnLeaf(_props: ColumnLeafProps): null;
49
+ /**
50
+ * Result of analyzing a JSX element tree for marker components.
51
+ */
52
+ export interface ChildrenAnalysisResult {
53
+ /** Get all collected props for a given marker type */
54
+ getAll<TProps>(marker: React.ComponentType<TProps>): TProps[];
55
+ /** Get the first collected props for a given marker type, or undefined */
56
+ getFirst<TProps>(marker: React.ComponentType<TProps>): TProps | undefined;
57
+ }
58
+ /**
59
+ * Walk a JSX element tree and collect props from registered marker types.
60
+ *
61
+ * For each element:
62
+ * 1. If its type is in `markerTypes` → collect its props
63
+ * 2. If it's a `React.Fragment` → recurse into children
64
+ * 3. If it has a `staticRender` static method → call it and recurse into result
65
+ * 4. Otherwise → skip (renders normally at runtime)
66
+ */
67
+ export declare function analyzeChildren(elements: React.ReactNode, markerTypes: ReadonlySet<React.ComponentType<any>>): ChildrenAnalysisResult;
68
+ /**
69
+ * Convenience wrapper: extract `ColumnLeafProps` from a JSX element tree.
70
+ */
71
+ export declare function extractColumnLeaves(elements: React.ReactNode): ColumnLeafProps[];
72
+ //# sourceMappingURL=columnLeaf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"columnLeaf.d.ts","sourceRoot":"","sources":["../src/columnLeaf.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAUnG,wDAAwD;AACxD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AAE3K,MAAM,WAAW,eAAe;IAE/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;IAC/C,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IAClC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC,cAAc,CAAC,GAAG,SAAS,CAAA;IACjE,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAA;IAClC,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAA;IAChC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,KAAK,IAAI,CAAA;IAG7D,kFAAkF;IAClF,QAAQ,CAA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,GAAG,IAAI,CAExD;AAcD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC,sDAAsD;IACtD,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAAA;IAC7D,0EAA0E;IAC1E,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,SAAS,CAAA;CACzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,EAEzB,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,GAChD,sBAAsB,CAkBxB;AAuBD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,eAAe,EAAE,CAEhF"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Column type definitions — headless behavior layer for DataGrid columns.
3
+ *
4
+ * Each column type defines how to extract values, create filter handlers,
5
+ * and whether sorting/text search is supported by default.
6
+ *
7
+ * These are framework-agnostic — no React dependency.
8
+ */
9
+ import type { FilterHandler, FilterArtifact, EntityAccessor } from '@contember/bindx';
10
+ import type { TextFilterArtifact, NumberRangeFilterArtifact, DateFilterArtifact, BooleanFilterArtifact, EnumFilterArtifact, EnumListFilterArtifact, IsDefinedFilterArtifact, RelationFilterArtifact } from '@contember/bindx';
11
+ export interface ColumnTypeDef<TValue = unknown, TFilterArtifact extends FilterArtifact = FilterArtifact> {
12
+ readonly name: string;
13
+ readonly defaultSortable: boolean;
14
+ readonly isTextSearchable: boolean;
15
+ readonly createFilterHandler: (fieldName: string) => FilterHandler<TFilterArtifact>;
16
+ readonly extractValue: (accessor: EntityAccessor<object>, fieldName: string) => TValue;
17
+ }
18
+ export declare function defineColumnType<TValue, TFilterArtifact extends FilterArtifact>(def: ColumnTypeDef<TValue, TFilterArtifact>): ColumnTypeDef<TValue, TFilterArtifact>;
19
+ /**
20
+ * Access a field on an EntityAccessor by name.
21
+ * EntityAccessor is a Proxy — bracket notation triggers the proxy get trap.
22
+ */
23
+ export declare function accessField(accessor: EntityAccessor<object>, fieldName: string): unknown;
24
+ export declare const textColumnDef: ColumnTypeDef<string | null, TextFilterArtifact>;
25
+ export declare const numberColumnDef: ColumnTypeDef<number | null, NumberRangeFilterArtifact>;
26
+ export declare const dateColumnDef: ColumnTypeDef<string | null, DateFilterArtifact>;
27
+ export declare const dateTimeColumnDef: ColumnTypeDef<string | null, DateFilterArtifact>;
28
+ export declare const booleanColumnDef: ColumnTypeDef<boolean | null, BooleanFilterArtifact>;
29
+ export declare const enumColumnDef: ColumnTypeDef<string | null, EnumFilterArtifact>;
30
+ export declare const enumListColumnDef: ColumnTypeDef<readonly string[] | null, EnumListFilterArtifact>;
31
+ export declare const uuidColumnDef: ColumnTypeDef<string | null, TextFilterArtifact>;
32
+ export declare const isDefinedColumnDef: ColumnTypeDef<unknown, IsDefinedFilterArtifact>;
33
+ export declare const hasOneColumnDef: ColumnTypeDef<unknown, RelationFilterArtifact>;
34
+ export declare const hasManyColumnDef: ColumnTypeDef<unknown, RelationFilterArtifact>;
35
+ //# sourceMappingURL=columnTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"columnTypes.d.ts","sourceRoot":"","sources":["../src/columnTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACrF,OAAO,KAAK,EACX,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,MAAM,kBAAkB,CAAA;AAgBzB,MAAM,WAAW,aAAa,CAAC,MAAM,GAAG,OAAO,EAAE,eAAe,SAAS,cAAc,GAAG,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AAG,IAAI,EAAE,sBAAsB,CAM5F,CAAA;AAEF,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,MAAM,GAAG,IAAI,EAAE,kBAAkB,CAMzE,CAAA;AAEF,eAAO,MAAM,kBAAkB,EAAE,aAAa,CAAC,OAAO,EAAE,uBAAuB,CAM7E,CAAA;AAEF,eAAO,MAAM,eAAe,EAAE,aAAa,CAAC,OAAO,EAAE,sBAAsB,CAMzE,CAAA;AAEF,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC,OAAO,EAAE,sBAAsB,CAM1E,CAAA"}
@@ -0,0 +1,115 @@
1
+ /**
2
+ * DataGrid column components.
3
+ *
4
+ * These are "metadata" components — they are not rendered directly.
5
+ * Instead, they carry `staticRender` methods that produce `ColumnLeaf`
6
+ * elements, which the DataGrid extracts for column metadata.
7
+ *
8
+ * Scalar columns are built via `createColumn()` + column type defs.
9
+ * Relation/action/generic columns use manual `staticRender`.
10
+ */
11
+ import React, { ReactNode } from 'react';
12
+ import type { FieldRefBase, HasOneRef, HasManyRef, FilterHandler, FilterArtifact, EntityAccessor } from '@contember/bindx';
13
+ import { FIELD_REF_META } from '@contember/bindx-react';
14
+ import { type RelationColumnProps } from './createRelationColumn.jsx';
15
+ import { type ColumnLeafProps } from './columnLeaf.js';
16
+ export type ColumnMeta = ColumnLeafProps;
17
+ interface FieldRefMetaCarrier {
18
+ readonly [FIELD_REF_META]: {
19
+ readonly entityType: string;
20
+ readonly fieldName: string;
21
+ readonly isArray: boolean;
22
+ readonly isRelation: boolean;
23
+ readonly enumName?: string;
24
+ };
25
+ }
26
+ /** Type guard: checks if a value carries FIELD_REF_META symbol. */
27
+ export declare function hasFieldRefMeta(ref: unknown): ref is FieldRefMetaCarrier;
28
+ /** Extract field name from a field ref (works in both collector and runtime proxies). */
29
+ export declare function extractFieldName(ref: unknown): string | null;
30
+ /** Extract enum name from a field ref (if field is an enum). */
31
+ export declare function extractEnumName(ref: unknown): string | undefined;
32
+ /** Extract related entity type name from a relation field ref. */
33
+ export declare function extractRelatedEntityName(ref: unknown): string | null;
34
+ /**
35
+ * Access a related entity accessor from a parent row accessor by field name.
36
+ * EntityAccessor is a Proxy — bracket notation triggers the get trap.
37
+ */
38
+ export declare function getRelatedAccessor(item: EntityAccessor<object>, fieldName: string): EntityAccessor<object> | null;
39
+ interface DataGridScalarColumnPropsBase<T> {
40
+ field: FieldRefBase<T> | FieldRefBase<T | undefined>;
41
+ header?: React.ReactNode;
42
+ sortable?: boolean;
43
+ filter?: boolean;
44
+ children?: (value: T | null) => React.ReactNode;
45
+ }
46
+ export interface DataGridTextColumnProps<T> extends DataGridScalarColumnPropsBase<T> {
47
+ }
48
+ export interface DataGridNumberColumnProps<T> extends DataGridScalarColumnPropsBase<T> {
49
+ }
50
+ export interface DataGridDateColumnProps<T> extends DataGridScalarColumnPropsBase<T> {
51
+ }
52
+ export interface DataGridDateTimeColumnProps<T> extends DataGridScalarColumnPropsBase<T> {
53
+ }
54
+ export interface DataGridBooleanColumnProps<T> extends DataGridScalarColumnPropsBase<T> {
55
+ }
56
+ export interface DataGridUuidColumnProps<T> extends DataGridScalarColumnPropsBase<T> {
57
+ }
58
+ export interface DataGridIsDefinedColumnProps<T> extends DataGridScalarColumnPropsBase<T> {
59
+ }
60
+ interface EnumExtraProps<T extends string> {
61
+ options: readonly T[] | Record<T, ReactNode>;
62
+ }
63
+ export interface DataGridEnumColumnProps<T extends string> extends DataGridScalarColumnPropsBase<T>, EnumExtraProps<NoInfer<T>> {
64
+ }
65
+ export interface DataGridEnumListColumnProps<T extends string> extends DataGridScalarColumnPropsBase<T>, EnumExtraProps<NoInfer<T>> {
66
+ }
67
+ export declare const DataGridTextColumn: import("./createColumn.js").ColumnComponent<object>;
68
+ export declare const DataGridNumberColumn: import("./createColumn.js").ColumnComponent<object>;
69
+ export declare const DataGridDateColumn: import("./createColumn.js").ColumnComponent<object>;
70
+ export declare const DataGridDateTimeColumn: import("./createColumn.js").ColumnComponent<object>;
71
+ export declare const DataGridBooleanColumn: import("./createColumn.js").ColumnComponent<object>;
72
+ export declare const DataGridEnumColumn: <TValue extends string>(props: DataGridEnumColumnProps<TValue>) => ReactNode;
73
+ export declare const DataGridEnumListColumn: <TValue extends string>(props: DataGridEnumListColumnProps<TValue>) => ReactNode;
74
+ export declare const DataGridUuidColumn: import("./createColumn.js").ColumnComponent<object>;
75
+ export declare const DataGridIsDefinedColumn: import("./createColumn.js").ColumnComponent<object>;
76
+ export interface DataGridHasOneColumnProps<TEntity, TSelected> extends RelationColumnProps<TEntity, TSelected> {
77
+ field: HasOneRef<TEntity, TSelected>;
78
+ }
79
+ /** Headless HasOne column — no filter UI or cell tooltip. Use @contember/bindx-ui for styled version. */
80
+ declare const _DataGridHasOneColumn: import("./createRelationColumn.jsx").RelationColumnComponent;
81
+ export declare const DataGridHasOneColumn: {
82
+ <TEntity, TSelected>(props: DataGridHasOneColumnProps<TEntity, TSelected>): null;
83
+ staticRender: typeof _DataGridHasOneColumn.staticRender;
84
+ buildLeaf: typeof _DataGridHasOneColumn.buildLeaf;
85
+ };
86
+ export interface DataGridHasManyColumnProps<TEntity, TSelected> extends RelationColumnProps<TEntity, TSelected> {
87
+ field: HasManyRef<TEntity, TSelected>;
88
+ }
89
+ /** Headless HasMany column — no filter UI or cell tooltip. Use @contember/bindx-ui for styled version. */
90
+ declare const _DataGridHasManyColumn: import("./createRelationColumn.jsx").RelationColumnComponent;
91
+ export declare const DataGridHasManyColumn: {
92
+ <TEntity, TSelected>(props: DataGridHasManyColumnProps<TEntity, TSelected>): null;
93
+ staticRender: typeof _DataGridHasManyColumn.staticRender;
94
+ buildLeaf: typeof _DataGridHasManyColumn.buildLeaf;
95
+ };
96
+ export interface DataGridActionColumnProps {
97
+ children: React.ReactNode | ((entity: EntityAccessor<object>) => React.ReactNode);
98
+ header?: React.ReactNode;
99
+ }
100
+ export declare const DataGridActionColumn: ((_props: DataGridActionColumnProps) => null) & {
101
+ staticRender: (props: Record<string, unknown>) => React.ReactNode;
102
+ };
103
+ export interface DataGridColumnProps<T> {
104
+ field?: FieldRefBase<T>;
105
+ header?: React.ReactNode;
106
+ sortable?: boolean;
107
+ filter?: boolean;
108
+ filterHandler?: FilterHandler<FilterArtifact>;
109
+ children?: (value: T | null, accessor: EntityAccessor<object>) => React.ReactNode;
110
+ }
111
+ export declare const DataGridColumn: (<T>(_props: DataGridColumnProps<T>) => null) & {
112
+ staticRender: (props: Record<string, unknown>) => React.ReactNode;
113
+ };
114
+ export {};
115
+ //# sourceMappingURL=columns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"columns.d.ts","sourceRoot":"","sources":["../src/columns.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAA6D,MAAM,kBAAkB,CAAA;AAErL,OAAO,EAAE,cAAc,EAAwB,MAAM,wBAAwB,CAAA;AAG7E,OAAO,EAA6D,KAAK,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAchI,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAMlE,MAAM,MAAM,UAAU,GAAG,eAAe,CAAA;AAMxC,UAAU,mBAAmB;IAC5B,QAAQ,CAAC,CAAC,cAAc,CAAC,EAAE;QAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;QAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;QACzB,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;QAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAC1B,CAAA;CACD;AAED,mEAAmE;AACnE,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,mBAAmB,CAExE;A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,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,aAAa,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IAC7C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC,SAAS,CAAA;CACjF;AAED,eAAO,MAAM,cAAc,IACF,CAAC,UAAU,mBAAmB,CAAC,CAAC,CAAC,KAAG,IAAI;0BAIzC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,KAAK,CAAC,SAAS;CAkChE,CAAA"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Fine-grained context hooks matching Contember's react-dataview API.
3
+ *
4
+ * These hooks provide convenient access to specific parts of the DataView context,
5
+ * matching Contember's pattern of separate state/methods hooks per concern.
6
+ */
7
+ import type { DataViewElementData } from './DataViewContext.js';
8
+ import type { FilteringState } from './useDataViewState.js';
9
+ import type { SortingState, SortingDirectionAction, PagingState, PagingInfo, OrderDirection, FilterHandler, FilterArtifact, DataViewLayout, FieldRefBase } from '@contember/bindx';
10
+ export interface DataViewSortingMethods {
11
+ setOrderBy<T>(field: FieldRefBase<T>, action: SortingDirectionAction, append?: boolean): void;
12
+ }
13
+ export declare function useDataViewSortingState(): SortingState;
14
+ export declare function useDataViewSortingMethods(): DataViewSortingMethods;
15
+ export declare function useDataViewSortingDirection<T>(field: FieldRefBase<T>): OrderDirection | null;
16
+ export interface DataViewPagingMethods {
17
+ goToPage(page: number | 'first' | 'next' | 'previous' | 'last'): void;
18
+ setItemsPerPage(count: number | null): void;
19
+ refreshTotalCount(): void;
20
+ }
21
+ export declare function useDataViewPagingState(): PagingState;
22
+ export declare function useDataViewPagingInfo(): PagingInfo;
23
+ export declare function useDataViewPagingMethods(): DataViewPagingMethods;
24
+ export interface DataViewFilteringMethods {
25
+ setFilter(name: string, artifact: FilterArtifact): void;
26
+ }
27
+ export declare function useDataViewFilteringState(): FilteringState;
28
+ export declare function useDataViewFilteringMethods(): DataViewFilteringMethods;
29
+ export declare function useDataViewFilterHandlerRegistry(): ReadonlyMap<string, {
30
+ handler: FilterHandler<FilterArtifact>;
31
+ }>;
32
+ export interface DataViewSelectionState {
33
+ readonly layout: string | undefined;
34
+ readonly visibility: Record<string, boolean | undefined>;
35
+ readonly layouts: readonly DataViewLayout[];
36
+ }
37
+ export interface DataViewSelectionMethods {
38
+ setLayout(layout: string | undefined): void;
39
+ setVisibility(name: string, visible: boolean): void;
40
+ }
41
+ export declare function useDataViewSelectionState(): DataViewSelectionState;
42
+ export declare function useDataViewSelectionMethods(): DataViewSelectionMethods;
43
+ export type { DataViewElementData } from './DataViewContext.js';
44
+ export declare function useDataViewElements(): readonly DataViewElementData[];
45
+ //# sourceMappingURL=contextHooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contextHooks.d.ts","sourceRoot":"","sources":["../src/contextHooks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAA+D,MAAM,uBAAuB,CAAA;AACxH,OAAO,KAAK,EACX,YAAY,EACZ,sBAAsB,EACtB,WAAW,EACX,UAAU,EACV,cAAc,EACd,aAAa,EACb,cAAc,EACd,cAAc,EACd,YAAY,EACZ,MAAM,kBAAkB,CAAA;AAMzB,MAAM,WAAW,sBAAsB;IACtC,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;CAC7F;AAED,wBAAgB,uBAAuB,IAAI,YAAY,CAEtD;AAED,wBAAgB,yBAAyB,IAAI,sBAAsB,CAGlE;AAED,w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AgB,2BAA2B,IAAI,wBAAwB,CAMtE;AAMD,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAE/D,wBAAgB,mBAAmB,IAAI,SAAS,mBAAmB,EAAE,CAoBpE"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * `createColumn()` — factory for building column components from a column type definition.
3
+ *
4
+ * Layer 2 in the column architecture: wraps a headless `ColumnTypeDef` with
5
+ * rendering configuration (cell renderer, optional filter renderer) to produce
6
+ * a React component usable inside a DataGrid children render function.
7
+ */
8
+ import React from 'react';
9
+ import type { FieldRefBase, FilterArtifact, EntityAccessor } from '@contember/bindx';
10
+ import type { ColumnTypeDef } from './columnTypes.js';
11
+ export interface ColumnRenderProps<TValue> {
12
+ readonly value: TValue;
13
+ readonly accessor: EntityAccessor<object>;
14
+ readonly fieldRef: FieldRefBase<unknown> | null;
15
+ readonly fieldName: string | null;
16
+ }
17
+ export interface FilterRenderProps<TFilterArtifact> {
18
+ readonly artifact: TFilterArtifact;
19
+ readonly setArtifact: (artifact: TFilterArtifact) => void;
20
+ }
21
+ export interface CreateColumnConfig<TValue, TFilterArtifact extends FilterArtifact> {
22
+ readonly renderCell: (props: ColumnRenderProps<TValue>) => React.ReactNode;
23
+ readonly renderFilter?: (props: FilterRenderProps<TFilterArtifact>) => React.ReactNode;
24
+ }
25
+ export interface ColumnComponentProps<TValue = unknown> {
26
+ field: FieldRefBase<TValue>;
27
+ header?: React.ReactNode;
28
+ sortable?: boolean;
29
+ filter?: boolean;
30
+ children?: (value: TValue | null, accessor: EntityAccessor<object>) => React.ReactNode;
31
+ }
32
+ export interface ColumnComponent<TExtraProps = object> {
33
+ <T>(props: ColumnComponentProps<T> & TExtraProps): null;
34
+ staticRender: (props: Record<string, unknown>) => React.ReactNode;
35
+ }
36
+ export declare function createColumn<TValue, TFilterArtifact extends FilterArtifact, TExtraProps = object>(columnType: ColumnTypeDef<TValue, TFilterArtifact>, config: CreateColumnConfig<TValue, TFilterArtifact>): Colum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AAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC,SAAS,CAAA;CACtF;AAMD,MAAM,WAAW,eAAe,CAAC,WAAW,GAAG,MAAM;IACpD,CAAC,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,WAAW,GAAG,IAAI,CAAA;IACvD,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,KAAK,CAAC,SAAS,CAAA;CACjE;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,eAAe,SAAS,cAAc,EAAE,WAAW,GAAG,MAAM,EAChG,UAAU,EAAE,aAAa,CAAC,MAAM,EAAE,eAAe,CAAC,EAClD,MAAM,EAAE,kBAAkB,CAAC,MAAM,EAAE,eAAe,CAAC,GACjD,eAAe,CAAC,WAAW,CAAC,CAgE9B"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * `createRelationColumn()` — factory for building relation column components (hasOne, hasMany).
3
+ *
4
+ * Parallel to `createColumn()` for scalar types. Handles:
5
+ * - Related entity metadata extraction (entityName, selection)
6
+ * - Collection phase (collectSelection)
7
+ * - Filter item rendering (renderFilterItem)
8
+ * - Cell rendering with children render function
9
+ *
10
+ * UI layers provide renderFilter and renderCellWrapper via config.
11
+ */
12
+ import React from 'react';
13
+ import type { FieldRefBase, FilterArtifact, EntityAccessor, SelectionMeta } from '@contember/bindx';
14
+ import type { ColumnTypeDef } from './columnTypes.js';
15
+ import { type ColumnLeafProps } from './columnLeaf.js';
16
+ export interface RelationColumnConfig {
17
+ /** Renders the filter UI in column header popover. Receives relation context. */
18
+ readonly renderFilter?: (ctx: RelationFilterContext) => React.ReactNode;
19
+ /** Wraps cell content (e.g. tooltip with filter actions). */
20
+ readonly renderCellWrapper?: (ctx: RelationCellWrapperContext) => React.ReactNode;
21
+ }
22
+ export interface RelationFilterContext {
23
+ readonly filterName: string;
24
+ readonly entityName: string;
25
+ readonly selection: SelectionMeta;
26
+ readonly renderItem: (accessor: EntityAccessor<object>) => React.ReactNode;
27
+ }
28
+ export interface RelationCellWrapperContext {
29
+ readonly content: React.ReactNode;
30
+ readonly item: EntityAccessor<object>;
31
+ readonly fieldName: string;
32
+ readonly filterName: string;
33
+ readonly fieldRef: FieldRefBase<unknown>;
34
+ }
35
+ export interface RelationColumnProps<TEntity, TSelected> {
36
+ field: object;
37
+ header?: React.ReactNode;
38
+ filter?: boolean;
39
+ renderCellWrapper?: (content: React.ReactNode, item: EntityAccessor<object>) => React.ReactNode;
40
+ children: (entity: EntityAccessor<TEntity, TSelected>) => React.ReactNode;
41
+ }
42
+ interface RelationCellConfig {
43
+ /** How to collect selection for the relation (differs between hasOne and hasMany) */
44
+ collectSelection: (renderer: (ref: unknown) => React.ReactNode, fieldRef: FieldRefBase<unknown>) => void;
45
+ /** How to render the cell content (differs between hasOne and hasMany) */
46
+ renderCell: (accessor: EntityAccessor<object>, fieldName: string, renderer: (ref: unknown) => React.ReactNode) => React.ReactNode;
47
+ }
48
+ export declare function createRelationColumn<TFilterArtifact extends FilterArtifact>(columnType: ColumnTypeDef<unknown, TFilterArtifact>, cellConfig: RelationCellConfig, uiConfig?: RelationColumnConfig): RelationColumnComponent;
49
+ export interface RelationColumnComponent {
50
+ <TEntity, TSelected>(props: RelationColumnProps<TEntity, TSelected>): null;
51
+ staticRender: (props: Record<string, unknown>) => React.ReactNode;
52
+ buildLeaf: (props: Record<string, unknown>) => ColumnLeafProps;
53
+ }
54
+ export declare const hasOneCellConfig: RelationCellConfig;
55
+ export declare const hasManyCellConfig: RelationCellConfig;
56
+ export {};
57
+ //# sourceMappingURL=createRelationColumn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createRelationColumn.d.ts","sourceRoot":"","sources":["../src/createRelationColumn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AAA;AAED,eAAO,MAAM,iBAAiB,EAAE,kBAc/B,CAAA"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Converts a boolean to a data attribute value.
3
+ * Returns '' (present) for true, undefined (absent) for false.
4
+ */
5
+ export declare function dataAttribute(value: boolean): '' | undefined;
6
+ //# sourceMappingURL=dataAttribute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataAttribute.d.ts","sourceRoot":"","sources":["../src/dataAttribute.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,EAAE,GAAG,SAAS,CAE5D"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * DataView export functionality.
3
+ *
4
+ * Provides CSV export and a trigger component that downloads all matching data.
5
+ *
6
+ * Usage:
7
+ * ```tsx
8
+ * <DataViewExportTrigger baseName="articles">
9
+ * <button>Export CSV</button>
10
+ * </DataViewExportTrigger>
11
+ * ```
12
+ */
13
+ import React from 'react';
14
+ export interface ExportResult {
15
+ readonly blob: Blob;
16
+ readonly extension: string;
17
+ }
18
+ export interface ExportFactoryArgs {
19
+ readonly data: readonly Record<string, unknown>[];
20
+ readonly columns: readonly {
21
+ name: string;
22
+ fieldName: string | null;
23
+ }[];
24
+ }
25
+ export interface ExportFactory {
26
+ create(args: ExportFactoryArgs): ExportResult;
27
+ }
28
+ export declare class CsvExportFactory implements ExportFactory {
29
+ create({ data, columns }: ExportFactoryArgs): ExportResult;
30
+ }
31
+ export interface DataViewExportTriggerProps {
32
+ /** Button element */
33
+ children: React.ReactElement;
34
+ /** Base file name. Default: entityType-date */
35
+ baseName?: string;
36
+ /** Export factory. Default: CSV */
37
+ exportFactory?: ExportFactory;
38
+ /** Only export visible columns (respects selection state). Default: false */
39
+ onlyVisible?: boolean;
40
+ }
41
+ export declare const DataViewExportTrigger: React.ForwardRefExoticComponent<DataViewExportTriggerProps & React.RefAttributes<HTMLButtonElement>>;
42
+ export interface FetchAllDataResult {
43
+ data: readonly Record<string, unknown>[];
44
+ }
45
+ export declare function useDataViewFetchAllData(): () => Promise<FetchAllDataResult | null>;
46
+ //# sourceMappingURL=export.d.ts.map