phx-react 1.3.1833 → 1.3.1836

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 (71) hide show
  1. package/dist/cjs/components/ResourceList/component/list.js +1 -1
  2. package/dist/cjs/components/ResourceList/component/list.js.map +1 -1
  3. package/dist/cjs/components/TableSchedule/PHXScheduleTable.d.ts +11 -0
  4. package/dist/cjs/components/TableSchedule/PHXScheduleTable.js +45 -0
  5. package/dist/cjs/components/TableSchedule/PHXScheduleTable.js.map +1 -0
  6. package/dist/cjs/components/TableSchedule/components/PHXScheduleTableBody.d.ts +16 -0
  7. package/dist/cjs/components/TableSchedule/components/PHXScheduleTableBody.js +148 -0
  8. package/dist/cjs/components/TableSchedule/components/PHXScheduleTableBody.js.map +1 -0
  9. package/dist/cjs/components/TableSchedule/components/PHXScheduleTableHead.d.ts +22 -0
  10. package/dist/cjs/components/TableSchedule/components/PHXScheduleTableHead.js +49 -0
  11. package/dist/cjs/components/TableSchedule/components/PHXScheduleTableHead.js.map +1 -0
  12. package/dist/cjs/components/TableSchedule/components/PHXScheduleTableLegend.d.ts +13 -0
  13. package/dist/cjs/components/TableSchedule/components/PHXScheduleTableLegend.js +26 -0
  14. package/dist/cjs/components/TableSchedule/components/PHXScheduleTableLegend.js.map +1 -0
  15. package/dist/cjs/components/TableSchedule/components/useStickyShadow.d.ts +15 -0
  16. package/dist/cjs/components/TableSchedule/components/useStickyShadow.js +37 -0
  17. package/dist/cjs/components/TableSchedule/components/useStickyShadow.js.map +1 -0
  18. package/dist/cjs/components/TableSchedule/constants.d.ts +49 -0
  19. package/dist/cjs/components/TableSchedule/constants.js +85 -0
  20. package/dist/cjs/components/TableSchedule/constants.js.map +1 -0
  21. package/dist/cjs/components/TableSchedule/index.d.ts +1 -0
  22. package/dist/cjs/components/TableSchedule/index.js +5 -0
  23. package/dist/cjs/components/TableSchedule/index.js.map +1 -0
  24. package/dist/cjs/components/TableSchedule/renderers.d.ts +39 -0
  25. package/dist/cjs/components/TableSchedule/renderers.js +138 -0
  26. package/dist/cjs/components/TableSchedule/renderers.js.map +1 -0
  27. package/dist/cjs/components/TableSchedule/types.d.ts +112 -0
  28. package/dist/cjs/components/TableSchedule/types.js +4 -0
  29. package/dist/cjs/components/TableSchedule/types.js.map +1 -0
  30. package/dist/cjs/components/TableSchedule/utils.d.ts +160 -0
  31. package/dist/cjs/components/TableSchedule/utils.js +283 -0
  32. package/dist/cjs/components/TableSchedule/utils.js.map +1 -0
  33. package/dist/cjs/index.d.ts +2 -1
  34. package/dist/cjs/index.js +3 -1
  35. package/dist/cjs/index.js.map +1 -1
  36. package/dist/esm/components/ResourceList/component/list.js +1 -1
  37. package/dist/esm/components/ResourceList/component/list.js.map +1 -1
  38. package/dist/esm/components/TableSchedule/PHXScheduleTable.d.ts +11 -0
  39. package/dist/esm/components/TableSchedule/PHXScheduleTable.js +40 -0
  40. package/dist/esm/components/TableSchedule/PHXScheduleTable.js.map +1 -0
  41. package/dist/esm/components/TableSchedule/components/PHXScheduleTableBody.d.ts +16 -0
  42. package/dist/esm/components/TableSchedule/components/PHXScheduleTableBody.js +143 -0
  43. package/dist/esm/components/TableSchedule/components/PHXScheduleTableBody.js.map +1 -0
  44. package/dist/esm/components/TableSchedule/components/PHXScheduleTableHead.d.ts +22 -0
  45. package/dist/esm/components/TableSchedule/components/PHXScheduleTableHead.js +45 -0
  46. package/dist/esm/components/TableSchedule/components/PHXScheduleTableHead.js.map +1 -0
  47. package/dist/esm/components/TableSchedule/components/PHXScheduleTableLegend.d.ts +13 -0
  48. package/dist/esm/components/TableSchedule/components/PHXScheduleTableLegend.js +21 -0
  49. package/dist/esm/components/TableSchedule/components/PHXScheduleTableLegend.js.map +1 -0
  50. package/dist/esm/components/TableSchedule/components/useStickyShadow.d.ts +15 -0
  51. package/dist/esm/components/TableSchedule/components/useStickyShadow.js +33 -0
  52. package/dist/esm/components/TableSchedule/components/useStickyShadow.js.map +1 -0
  53. package/dist/esm/components/TableSchedule/constants.d.ts +49 -0
  54. package/dist/esm/components/TableSchedule/constants.js +81 -0
  55. package/dist/esm/components/TableSchedule/constants.js.map +1 -0
  56. package/dist/esm/components/TableSchedule/index.d.ts +1 -0
  57. package/dist/esm/components/TableSchedule/index.js +2 -0
  58. package/dist/esm/components/TableSchedule/index.js.map +1 -0
  59. package/dist/esm/components/TableSchedule/renderers.d.ts +39 -0
  60. package/dist/esm/components/TableSchedule/renderers.js +129 -0
  61. package/dist/esm/components/TableSchedule/renderers.js.map +1 -0
  62. package/dist/esm/components/TableSchedule/types.d.ts +112 -0
  63. package/dist/esm/components/TableSchedule/types.js +3 -0
  64. package/dist/esm/components/TableSchedule/types.js.map +1 -0
  65. package/dist/esm/components/TableSchedule/utils.d.ts +160 -0
  66. package/dist/esm/components/TableSchedule/utils.js +264 -0
  67. package/dist/esm/components/TableSchedule/utils.js.map +1 -0
  68. package/dist/esm/index.d.ts +2 -1
  69. package/dist/esm/index.js +2 -1
  70. package/dist/esm/index.js.map +1 -1
  71. package/package.json +1 -1
@@ -0,0 +1,129 @@
1
+ 'use client';
2
+ import React from 'react';
3
+ import { CELL_BOX_BASE_CLASSNAME, CELL_BOX_VARIANT_CLASSNAME, DEFAULT_TOOLTIP_CLASSNAME, ROW_HEADER_ALIGN_CLASSNAME, ROW_HEADER_CONTENT_CLASSNAME, ROW_HEADER_DESCRIPTION_CLASSNAME, ROW_HEADER_TITLE_CLASSNAME, SCHEDULE_CELL_CLASSNAME, SCHEDULE_EMPTY_DESCRIPTION_CLASSNAME, SCHEDULE_EMPTY_TITLE_CLASSNAME, SCHEDULE_SECTION_CLASSNAME, SCHEDULE_SECTION_LABEL_CLASSNAME, SCHEDULE_SECTION_VALUE_CLASSNAME, SCHEDULE_TITLE_CLASSNAME, SCHEDULE_TITLE_DOTTED_CLASSNAME, TOOLTIP_CONTENT_CLASSNAME, TOOLTIP_LABEL_CLASSNAME, TOOLTIP_SECTION_CLASSNAME, TOOLTIP_TITLE_CLASSNAME, TOOLTIP_VALUE_CLASSNAME, } from './constants';
4
+ /**
5
+ * Checks whether a render value is a structured person-link object.
6
+ *
7
+ * @param {ReactNode | GridPersonLink} value The render value to inspect.
8
+ * @returns {value is GridPersonLink} True when the value matches the person-link contract.
9
+ */
10
+ const isGridPersonLink = (value) => !!value && typeof value === 'object' && 'type' in value && value.type === 'person-link';
11
+ /**
12
+ * Renders a person-link value as an external profile anchor when a destination URL exists.
13
+ *
14
+ * @param {GridPersonLink} person The person-link payload to render.
15
+ * @param {string} [userDetailPageUrl] The base URL used to build the person detail link.
16
+ * @returns {React.ReactNode} The rendered link node, or null when the person has no display name.
17
+ */
18
+ const renderGridPersonLink = (person, userDetailPageUrl) => {
19
+ if (!person.name)
20
+ return null;
21
+ return (React.createElement("a", { className: 'group inline-flex items-center gap-1 whitespace-nowrap font-semibold text-gray-800 hover:text-blue-500', href: userDetailPageUrl && person.id ? `${userDetailPageUrl}${person.id}` : undefined, rel: 'noopener noreferrer', target: '_blank' },
22
+ React.createElement("span", null,
23
+ person.name,
24
+ person.code ? ` (${person.code})` : ''),
25
+ person.id && userDetailPageUrl && person.icon));
26
+ };
27
+ /**
28
+ * Renders a tooltip or schedule value that may contain raw nodes, a person link, or a list of person links.
29
+ *
30
+ * @param {ReactNode | GridPersonLink | GridPersonLink[]} value The value payload to render.
31
+ * @param {string} [userDetailPageUrl] The base URL used to build person detail links.
32
+ * @returns {React.ReactNode} The rendered value node.
33
+ */
34
+ const renderRichValue = (value, userDetailPageUrl) => {
35
+ if (Array.isArray(value)) {
36
+ return (React.createElement("div", { className: 'flex flex-col gap-1' }, value.map((item, index) => (React.createElement("div", { key: index }, isGridPersonLink(item) ? renderGridPersonLink(item, userDetailPageUrl) : item)))));
37
+ }
38
+ return isGridPersonLink(value) ? renderGridPersonLink(value, userDetailPageUrl) : value;
39
+ };
40
+ /**
41
+ * Renders the content displayed inside a sticky row-header cell.
42
+ *
43
+ * @param {GridRowHeader} header The row-header configuration object.
44
+ * @returns {React.ReactNode} The rendered header content, or null when nothing is configured.
45
+ */
46
+ export const renderRowHeaderContent = (header) => {
47
+ if (header.content)
48
+ return header.content;
49
+ if (!header.headerContent)
50
+ return null;
51
+ const { title, description, align = 'left' } = header.headerContent;
52
+ return (React.createElement("div", { className: `${ROW_HEADER_CONTENT_CLASSNAME} ${ROW_HEADER_ALIGN_CLASSNAME[align]}` },
53
+ React.createElement("div", { className: ROW_HEADER_TITLE_CLASSNAME }, title),
54
+ description && React.createElement("div", { className: ROW_HEADER_DESCRIPTION_CLASSNAME }, description)));
55
+ };
56
+ /**
57
+ * Renders the boxed visual treatment used by default-layout schedule cells.
58
+ *
59
+ * @param {GridCellData} cell The cell data to render.
60
+ * @returns {React.ReactNode} The boxed content node for the cell.
61
+ */
62
+ export const renderCellBoxContent = (cell) => {
63
+ var _a, _b;
64
+ return (React.createElement("div", { className: `${CELL_BOX_BASE_CLASSNAME} ${CELL_BOX_VARIANT_CLASSNAME[(_a = cell.variant) !== null && _a !== void 0 ? _a : 'default']}` },
65
+ React.createElement("span", { className: 'block w-full overflow-hidden text-ellipsis whitespace-nowrap' }, (_b = cell.content) !== null && _b !== void 0 ? _b : ' ')));
66
+ };
67
+ /**
68
+ * Renders the rich schedule layout used by plain schedule cells.
69
+ *
70
+ * @param {GridScheduleContent} scheduleContent The structured schedule content to render.
71
+ * @param {string} [userDetailPageUrl] The base URL used to build person detail links.
72
+ * @returns {React.ReactNode} The rendered schedule content.
73
+ */
74
+ export const renderScheduleContent = (scheduleContent, userDetailPageUrl) => {
75
+ const { title, titleVariant = 'default', sections = [], emptyTitle = 'Trống', emptyDescription = 'Chưa xếp', } = scheduleContent;
76
+ if (!title && sections.length === 0) {
77
+ return (React.createElement("div", { className: SCHEDULE_CELL_CLASSNAME },
78
+ React.createElement("div", { className: SCHEDULE_EMPTY_TITLE_CLASSNAME }, emptyTitle),
79
+ React.createElement("div", { className: SCHEDULE_EMPTY_DESCRIPTION_CLASSNAME }, emptyDescription)));
80
+ }
81
+ return (React.createElement("div", { className: SCHEDULE_CELL_CLASSNAME },
82
+ title && (React.createElement("div", { className: titleVariant === 'dotted' ? SCHEDULE_TITLE_DOTTED_CLASSNAME : SCHEDULE_TITLE_CLASSNAME }, title)),
83
+ sections.map((section, sectionIndex) => (React.createElement("div", { key: sectionIndex, className: SCHEDULE_SECTION_CLASSNAME },
84
+ section.label && (React.createElement("div", { className: SCHEDULE_SECTION_LABEL_CLASSNAME },
85
+ section.labelPrefix,
86
+ React.createElement("span", null, section.label))),
87
+ section.items.map((item, itemIndex) => (React.createElement("div", { key: itemIndex, className: SCHEDULE_SECTION_VALUE_CLASSNAME }, isGridPersonLink(item) ? renderGridPersonLink(item, userDetailPageUrl) : item))))))));
88
+ };
89
+ /**
90
+ * Renders the grouped tooltip sections for a cell.
91
+ *
92
+ * @param {GridTooltipBlock[]} blocks The tooltip blocks to render.
93
+ * @param {string} [userDetailPageUrl] The base URL used to build person detail links.
94
+ * @returns {React.ReactNode} The rendered tooltip block list.
95
+ */
96
+ const renderTooltipBlocks = (blocks, userDetailPageUrl) => (React.createElement("ul", { className: 'text-left' }, blocks.map((block, index) => {
97
+ var _a;
98
+ return (React.createElement("li", { key: index, className: index === 0 ? 'list-none' : 'mt-3 list-none border-t border-gray-200 pt-3' },
99
+ React.createElement("div", { className: TOOLTIP_CONTENT_CLASSNAME },
100
+ block.title && React.createElement("div", { className: TOOLTIP_TITLE_CLASSNAME }, block.title), (_a = block.sections) === null || _a === void 0 ? void 0 :
101
+ _a.map((section, sectionIndex) => (React.createElement("div", { key: sectionIndex, className: TOOLTIP_SECTION_CLASSNAME },
102
+ React.createElement("span", { className: `${TOOLTIP_LABEL_CLASSNAME} inline-flex items-center gap-1.5` },
103
+ section.labelPrefix,
104
+ React.createElement("span", null, section.label)),
105
+ React.createElement("span", { className: TOOLTIP_VALUE_CLASSNAME }, renderRichValue(section.value, userDetailPageUrl))))))));
106
+ })));
107
+ /**
108
+ * Resolves and renders the tooltip content for a data cell.
109
+ *
110
+ * @param {GridCellData} cell The cell whose tooltip content should be rendered.
111
+ * @param {string} [userDetailPageUrl] The base URL used to build person detail links.
112
+ * @returns {React.ReactNode} The tooltip content, or null when the cell has no tooltip payload.
113
+ */
114
+ export const renderTooltipContent = (cell, userDetailPageUrl) => {
115
+ if (cell.tooltip)
116
+ return cell.tooltip;
117
+ if (cell.tooltipBlocks && cell.tooltipBlocks.length > 0) {
118
+ return renderTooltipBlocks(cell.tooltipBlocks, userDetailPageUrl);
119
+ }
120
+ return null;
121
+ };
122
+ /**
123
+ * Resolves the tooltip container class name for a cell.
124
+ *
125
+ * @param {GridCellData} cell The cell that may override the tooltip class.
126
+ * @returns {string} The tooltip class name to apply.
127
+ */
128
+ export const resolveTooltipClassName = (cell) => { var _a; return (_a = cell.tooltipClassName) !== null && _a !== void 0 ? _a : DEFAULT_TOOLTIP_CLASSNAME; };
129
+ //# sourceMappingURL=renderers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderers.js","sourceRoot":"","sources":["../../../../src/components/TableSchedule/renderers.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,KAAoB,MAAM,OAAO,CAAA;AACxC,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,yBAAyB,EACzB,0BAA0B,EAC1B,4BAA4B,EAC5B,gCAAgC,EAChC,0BAA0B,EAC1B,uBAAuB,EACvB,oCAAoC,EACpC,8BAA8B,EAC9B,0BAA0B,EAC1B,gCAAgC,EAChC,gCAAgC,EAChC,wBAAwB,EACxB,+BAA+B,EAC/B,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,aAAa,CAAA;AAGpB;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,CAAC,KAAiC,EAA2B,EAAE,CACtF,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK,IAAK,KAAwB,CAAC,IAAI,KAA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,KAAK,CAAC,KAAK,IAAI,6BAAK,SAAS,EAAE,uBAAuB,IAAG,KAAK,CAAC,KAAK,CAAO,EAC3E,MAAA,KAAK,CAAC,QAAQ;eAAE,GAAG,CAAC,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,CAAC,CAC9C,6BAAK,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,yBAAyB;gBAC1D,8BAAM,SAAS,EAAE,GAAG,uBAAuB,mCAAmC;oBAC3E,OAAO,CAAC,WAAW;oBACpB,kCAAO,OAAO,CAAC,KAAK,CAAQ,CACvB;gBACP,8BAAM,SAAS,EAAE,uBAAuB,IAAG,eAAe,CAAC,OAAO,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAQ,CAChG,CACP,CAAC,CACE,CACH,CACN,CAAA;CAAA,CAAC,CACC,CACN,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAAkB,EAAE,iBAA0B,EAAE,EAAE;IACrF,IAAI,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC,OAAO,CAAA;IACrC,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxD,OAAO,mBAAmB,CAAC,IAAI,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAA;IACnE,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,IAAkB,EAAE,EAAE,WAAC,OAAA,MAAA,IAAI,CAAC,gBAAgB,mCAAI,yBAAyB,CAAA,EAAA,CAAA"}
@@ -0,0 +1,112 @@
1
+ import { ComponentType, CSSProperties, ReactNode } from 'react';
2
+ export type GridCellVariant = 'default' | 'moving' | 'trogiang' | 'empty';
3
+ export type GridPersonLink = {
4
+ type: 'person-link';
5
+ id?: number | string | null;
6
+ name?: ReactNode;
7
+ code?: ReactNode;
8
+ icon?: ReactNode;
9
+ };
10
+ export type GridTooltipSection = {
11
+ label: ReactNode;
12
+ labelPrefix?: ReactNode;
13
+ value: ReactNode | GridPersonLink | GridPersonLink[];
14
+ };
15
+ export type GridTooltipBlock = {
16
+ title?: ReactNode;
17
+ sections?: GridTooltipSection[];
18
+ };
19
+ export type GridCellLayout = 'boxed' | 'plain';
20
+ export type GridScheduleTitleVariant = 'default' | 'dotted';
21
+ export type GridRowHeaderAlign = 'left' | 'center' | 'right';
22
+ export type GridScheduleSection = {
23
+ label?: ReactNode;
24
+ labelPrefix?: ReactNode;
25
+ items: Array<ReactNode | GridPersonLink>;
26
+ };
27
+ export type GridScheduleContent = {
28
+ title?: ReactNode;
29
+ titleVariant?: GridScheduleTitleVariant;
30
+ sections?: GridScheduleSection[];
31
+ emptyTitle?: ReactNode;
32
+ emptyDescription?: ReactNode;
33
+ };
34
+ export type GridCellData = {
35
+ content?: ReactNode;
36
+ variant?: GridCellVariant;
37
+ layout?: GridCellLayout;
38
+ scheduleContent?: GridScheduleContent;
39
+ tooltipBlocks?: GridTooltipBlock[];
40
+ tooltip?: ReactNode;
41
+ tooltipClassName?: string;
42
+ cellStyle?: CSSProperties;
43
+ cellClassName?: string;
44
+ colSpan?: number;
45
+ rowSpan?: number;
46
+ disabled?: boolean;
47
+ data?: unknown;
48
+ };
49
+ export type GridRowHeaderContent = {
50
+ title: ReactNode;
51
+ description?: ReactNode;
52
+ align?: GridRowHeaderAlign;
53
+ };
54
+ export type GridRowHeader = {
55
+ content?: ReactNode;
56
+ headerContent?: GridRowHeaderContent;
57
+ rowSpan?: number;
58
+ width?: number;
59
+ className?: string;
60
+ style?: CSSProperties;
61
+ };
62
+ export type GridColumnAlign = 'left' | 'center' | 'right';
63
+ export type GridColumn = {
64
+ key: string;
65
+ header: ReactNode;
66
+ minWidth?: number;
67
+ align?: GridColumnAlign;
68
+ };
69
+ export type GridHeaderGroup = {
70
+ header: ReactNode;
71
+ columnKeys: string[];
72
+ };
73
+ export type TooltipComponentType = ComponentType<{
74
+ content: ReactNode;
75
+ contentClassName?: string;
76
+ children: ReactNode;
77
+ }>;
78
+ export type ButtonComponentType = ComponentType<{
79
+ tertiary?: boolean;
80
+ noPadding?: boolean;
81
+ className?: string;
82
+ onClick?: () => void;
83
+ children?: ReactNode;
84
+ }>;
85
+ export type ScheduleTableRow = {
86
+ rowHeader?: GridRowHeader;
87
+ rowHeaders?: Array<GridRowHeader | null>;
88
+ cells: Record<string, GridCellData>;
89
+ };
90
+ export type GridLegendItem = {
91
+ label: ReactNode;
92
+ variant?: GridCellVariant;
93
+ indicatorClassName?: string;
94
+ };
95
+ export type PHXScheduleTableProps = {
96
+ columns: GridColumn[];
97
+ headerGroups?: GridHeaderGroup[];
98
+ rows: ScheduleTableRow[];
99
+ onCellClick?: (params: {
100
+ rowIndex: number;
101
+ columnKey: string;
102
+ cellData: GridCellData;
103
+ }) => void;
104
+ stickyColumnWidth?: number;
105
+ stickyColumnWidths?: number[];
106
+ defaultCellLayout?: GridCellLayout;
107
+ legendItems?: GridLegendItem[];
108
+ userDetailPageUrl?: string;
109
+ className?: string;
110
+ TooltipComponent?: TooltipComponentType;
111
+ ButtonComponent?: ButtonComponentType;
112
+ };
@@ -0,0 +1,3 @@
1
+ 'use client';
2
+ export {};
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/TableSchedule/types.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA"}
@@ -0,0 +1,160 @@
1
+ import { CSSProperties } from 'react';
2
+ import { GridCellData, GridColumn, GridColumnAlign, GridCellLayout, GridRowHeader, PHXScheduleTableProps, ScheduleTableRow } from './types';
3
+ type RowHeaderCellStyleParams = {
4
+ headerIndex: number;
5
+ stickyWidths: number[];
6
+ width: number;
7
+ isLast: boolean;
8
+ customStyle?: CSSProperties;
9
+ };
10
+ /**
11
+ * Builds a lookup of covered cell coordinates created by rowSpan and colSpan values.
12
+ *
13
+ * @param {PHXScheduleTableProps['rows']} rows The schedule rows to analyze.
14
+ * @param {GridColumn[]} columns The column definitions in render order.
15
+ * @returns {Set<string>} A set of `rowIndex,columnKey` pairs that should be skipped during rendering.
16
+ */
17
+ export declare const buildSkipMap: (rows: PHXScheduleTableProps["rows"], columns: GridColumn[]) => Set<string>;
18
+ /**
19
+ * Resolves the effective alignment for a column, defaulting to left alignment.
20
+ *
21
+ * @param {GridColumnAlign} [align] The optional alignment configured for the column.
22
+ * @returns {GridColumnAlign} The resolved column alignment.
23
+ */
24
+ export declare const getColumnAlign: (align?: GridColumnAlign) => GridColumnAlign;
25
+ /**
26
+ * Returns the row-header cells that should be rendered for a schedule row.
27
+ *
28
+ * @param {ScheduleTableRow} row The schedule row to inspect.
29
+ * @param {number} stickyColumnWidth The fallback width for single rowHeader entries.
30
+ * @returns {Array<GridRowHeader | null>} The normalized row-header list for the row.
31
+ */
32
+ export declare const getRowHeaders: (row: ScheduleTableRow, stickyColumnWidth: number) => Array<GridRowHeader | null>;
33
+ /**
34
+ * Builds the sticky-column width list used for row headers.
35
+ *
36
+ * @param {ScheduleTableRow[]} rows The table rows used to infer sticky header widths.
37
+ * @param {number} stickyColumnWidth The default width used when no explicit width exists.
38
+ * @param {number[]} [stickyColumnWidths] Optional explicit sticky widths from the caller.
39
+ * @returns {number[]} The resolved sticky-column widths.
40
+ */
41
+ export declare const buildStickyColumnWidths: (rows: ScheduleTableRow[], stickyColumnWidth: number, stickyColumnWidths?: number[]) => number[];
42
+ /**
43
+ * Calculates the left offset of a sticky column from the widths before it.
44
+ *
45
+ * @param {number[]} stickyWidths The ordered list of sticky column widths.
46
+ * @param {number} index The sticky column index to position.
47
+ * @returns {number} The computed left offset in pixels.
48
+ */
49
+ export declare const getStickyLeft: (stickyWidths: number[], index: number) => number;
50
+ /**
51
+ * Normalizes a cell's row and column spans.
52
+ *
53
+ * @param {GridCellData} cell The cell data to inspect.
54
+ * @returns {{ colSpan: number; rowSpan: number }} The resolved span values with defaults applied.
55
+ */
56
+ export declare const getCellSpan: (cell: GridCellData) => {
57
+ colSpan: number;
58
+ rowSpan: number;
59
+ };
60
+ /**
61
+ * Composes the class name for a sticky header placeholder cell.
62
+ *
63
+ * @param {number} index The sticky column index being rendered.
64
+ * @param {number} stickyHeaderCount The total number of sticky columns.
65
+ * @param {boolean} showStickyShadow Whether the sticky shadow should be visible.
66
+ * @returns {string} The class name applied to the sticky header cell.
67
+ */
68
+ export declare const getStickyHeaderClassName: (index: number, stickyHeaderCount: number, showStickyShadow: boolean) => string;
69
+ /**
70
+ * Builds the inline style for a sticky header placeholder cell.
71
+ *
72
+ * @param {{
73
+ * index: number;
74
+ * stickyWidths: number[];
75
+ * zIndexBase: number;
76
+ * }} {
77
+ * index,
78
+ * stickyWidths,
79
+ * zIndexBase,
80
+ * } The sticky header positioning inputs.
81
+ * @returns {CSSProperties} The computed sticky header styles.
82
+ */
83
+ export declare const buildStickyHeaderCellStyle: ({ index, stickyWidths, zIndexBase, }: {
84
+ index: number;
85
+ stickyWidths: number[];
86
+ zIndexBase: number;
87
+ }) => CSSProperties;
88
+ /**
89
+ * Builds the shared style for grouped header cells.
90
+ *
91
+ * @returns {CSSProperties} The computed grouped-header styles.
92
+ */
93
+ export declare const buildHeaderGroupCellStyle: () => CSSProperties;
94
+ /**
95
+ * Builds the inline style for a regular column header cell.
96
+ *
97
+ * @param {GridColumnAlign} align The text alignment for the column header.
98
+ * @param {number} [minWidth] The optional minimum width of the column.
99
+ * @returns {CSSProperties} The computed column-header styles.
100
+ */
101
+ export declare const buildColumnHeaderCellStyle: (align: GridColumnAlign, minWidth?: number) => CSSProperties;
102
+ /**
103
+ * Composes the class name for a sticky row-header cell.
104
+ *
105
+ * @param {string | undefined} className An optional custom class from the row header definition.
106
+ * @param {number} headerIndex The sticky header index being rendered.
107
+ * @param {number} stickyHeaderCount The total number of sticky columns.
108
+ * @param {boolean} showStickyShadow Whether the sticky shadow should be visible.
109
+ * @returns {string | undefined} The resolved class name for the row-header cell.
110
+ */
111
+ export declare const getRowHeaderClassName: (className: string | undefined, headerIndex: number, stickyHeaderCount: number, showStickyShadow: boolean) => string | undefined;
112
+ /**
113
+ * Builds the inline style for a sticky row-header cell.
114
+ *
115
+ * @param {RowHeaderCellStyleParams} params - The row-header positioning and style inputs.
116
+ * @param {number} params.headerIndex - The zero-based index of this sticky header column.
117
+ * @param {number[]} params.stickyWidths - The ordered list of sticky column widths used to compute the left offset.
118
+ * @param {number} params.width - The explicit width applied to this header cell.
119
+ * @param {boolean} params.isLast - Whether this cell belongs to the last rendered row.
120
+ * @param {CSSProperties} [params.customStyle] - Optional style overrides merged on top of the base styles.
121
+ * @returns {CSSProperties} The computed sticky row-header styles.
122
+ *
123
+ * @example
124
+ * buildRowHeaderCellStyle({ headerIndex: 0, stickyWidths: [130], width: 130, isLast: false })
125
+ * // => { position: 'sticky', left: 0, width: 130, zIndex: 3, ... }
126
+ */
127
+ export declare const buildRowHeaderCellStyle: ({ headerIndex, stickyWidths, width, isLast, customStyle, }: RowHeaderCellStyleParams) => CSSProperties;
128
+ /**
129
+ * Composes the class name for an interactive cell wrapper.
130
+ *
131
+ * @param {GridCellLayout} layout The layout mode applied to the cell.
132
+ * @param {string} alignClassName The wrapper alignment class.
133
+ * @param {boolean} [useButtonStyles=false] Whether button-specific classes should be used.
134
+ * @returns {string} The class name for the interactive cell wrapper.
135
+ */
136
+ export declare const getClickableCellClassName: (layout: GridCellLayout, alignClassName: string, useButtonStyles?: boolean) => string;
137
+ /**
138
+ * Composes the class name for a non-clickable cell wrapper.
139
+ *
140
+ * @param {GridCellLayout} layout The layout mode applied to the cell.
141
+ * @param {string} alignClassName The wrapper alignment class.
142
+ * @returns {string} The class name for the static cell wrapper.
143
+ */
144
+ export declare const getStaticCellClassName: (layout: GridCellLayout, alignClassName: string) => string;
145
+ /**
146
+ * Builds the inline style for a body data cell.
147
+ *
148
+ * @param {boolean} isLast Whether the cell belongs to the last rendered row.
149
+ * @param {CSSProperties} [cellStyle] Optional custom style overrides from the cell data.
150
+ * @returns {CSSProperties} The computed data-cell styles.
151
+ */
152
+ export declare const buildDataCellStyle: (isLast: boolean, cellStyle?: CSSProperties) => CSSProperties;
153
+ /**
154
+ * Composes the class name for a body data cell.
155
+ *
156
+ * @param {string} [cellClassName] An optional custom class from the cell data.
157
+ * @returns {string} The class name applied to the data cell.
158
+ */
159
+ export declare const getDataCellClassName: (cellClassName?: string) => string;
160
+ export {};