phx-react 1.3.1832 → 1.3.1835
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.
- package/dist/cjs/components/MainWrapV4/MainWrapV4.d.ts +0 -1
- package/dist/cjs/components/MainWrapV4/MainWrapV4.js +3 -56
- package/dist/cjs/components/MainWrapV4/MainWrapV4.js.map +1 -1
- package/dist/cjs/components/TableSchedule/PHXScheduleTable.d.ts +11 -0
- package/dist/cjs/components/TableSchedule/PHXScheduleTable.js +45 -0
- package/dist/cjs/components/TableSchedule/PHXScheduleTable.js.map +1 -0
- package/dist/cjs/components/TableSchedule/components/PHXScheduleTableBody.d.ts +16 -0
- package/dist/cjs/components/TableSchedule/components/PHXScheduleTableBody.js +148 -0
- package/dist/cjs/components/TableSchedule/components/PHXScheduleTableBody.js.map +1 -0
- package/dist/cjs/components/TableSchedule/components/PHXScheduleTableHead.d.ts +22 -0
- package/dist/cjs/components/TableSchedule/components/PHXScheduleTableHead.js +49 -0
- package/dist/cjs/components/TableSchedule/components/PHXScheduleTableHead.js.map +1 -0
- package/dist/cjs/components/TableSchedule/components/PHXScheduleTableLegend.d.ts +13 -0
- package/dist/cjs/components/TableSchedule/components/PHXScheduleTableLegend.js +26 -0
- package/dist/cjs/components/TableSchedule/components/PHXScheduleTableLegend.js.map +1 -0
- package/dist/cjs/components/TableSchedule/components/useStickyShadow.d.ts +15 -0
- package/dist/cjs/components/TableSchedule/components/useStickyShadow.js +37 -0
- package/dist/cjs/components/TableSchedule/components/useStickyShadow.js.map +1 -0
- package/dist/cjs/components/TableSchedule/constants.d.ts +49 -0
- package/dist/cjs/components/TableSchedule/constants.js +85 -0
- package/dist/cjs/components/TableSchedule/constants.js.map +1 -0
- package/dist/cjs/components/TableSchedule/index.d.ts +1 -0
- package/dist/cjs/components/TableSchedule/index.js +5 -0
- package/dist/cjs/components/TableSchedule/index.js.map +1 -0
- package/dist/cjs/components/TableSchedule/renderers.d.ts +39 -0
- package/dist/cjs/components/TableSchedule/renderers.js +138 -0
- package/dist/cjs/components/TableSchedule/renderers.js.map +1 -0
- package/dist/cjs/components/TableSchedule/types.d.ts +112 -0
- package/dist/cjs/components/TableSchedule/types.js +4 -0
- package/dist/cjs/components/TableSchedule/types.js.map +1 -0
- package/dist/cjs/components/TableSchedule/utils.d.ts +160 -0
- package/dist/cjs/components/TableSchedule/utils.js +283 -0
- package/dist/cjs/components/TableSchedule/utils.js.map +1 -0
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/MainWrapV4/MainWrapV4.d.ts +0 -1
- package/dist/esm/components/MainWrapV4/MainWrapV4.js +5 -58
- package/dist/esm/components/MainWrapV4/MainWrapV4.js.map +1 -1
- package/dist/esm/components/TableSchedule/PHXScheduleTable.d.ts +11 -0
- package/dist/esm/components/TableSchedule/PHXScheduleTable.js +40 -0
- package/dist/esm/components/TableSchedule/PHXScheduleTable.js.map +1 -0
- package/dist/esm/components/TableSchedule/components/PHXScheduleTableBody.d.ts +16 -0
- package/dist/esm/components/TableSchedule/components/PHXScheduleTableBody.js +143 -0
- package/dist/esm/components/TableSchedule/components/PHXScheduleTableBody.js.map +1 -0
- package/dist/esm/components/TableSchedule/components/PHXScheduleTableHead.d.ts +22 -0
- package/dist/esm/components/TableSchedule/components/PHXScheduleTableHead.js +45 -0
- package/dist/esm/components/TableSchedule/components/PHXScheduleTableHead.js.map +1 -0
- package/dist/esm/components/TableSchedule/components/PHXScheduleTableLegend.d.ts +13 -0
- package/dist/esm/components/TableSchedule/components/PHXScheduleTableLegend.js +21 -0
- package/dist/esm/components/TableSchedule/components/PHXScheduleTableLegend.js.map +1 -0
- package/dist/esm/components/TableSchedule/components/useStickyShadow.d.ts +15 -0
- package/dist/esm/components/TableSchedule/components/useStickyShadow.js +33 -0
- package/dist/esm/components/TableSchedule/components/useStickyShadow.js.map +1 -0
- package/dist/esm/components/TableSchedule/constants.d.ts +49 -0
- package/dist/esm/components/TableSchedule/constants.js +81 -0
- package/dist/esm/components/TableSchedule/constants.js.map +1 -0
- package/dist/esm/components/TableSchedule/index.d.ts +1 -0
- package/dist/esm/components/TableSchedule/index.js +2 -0
- package/dist/esm/components/TableSchedule/index.js.map +1 -0
- package/dist/esm/components/TableSchedule/renderers.d.ts +39 -0
- package/dist/esm/components/TableSchedule/renderers.js +129 -0
- package/dist/esm/components/TableSchedule/renderers.js.map +1 -0
- package/dist/esm/components/TableSchedule/types.d.ts +112 -0
- package/dist/esm/components/TableSchedule/types.js +3 -0
- package/dist/esm/components/TableSchedule/types.js.map +1 -0
- package/dist/esm/components/TableSchedule/utils.d.ts +160 -0
- package/dist/esm/components/TableSchedule/utils.js +264 -0
- package/dist/esm/components/TableSchedule/utils.js.map +1 -0
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Tracks whether the sticky-header shadow should be visible based on horizontal scroll.
|
|
5
|
+
*
|
|
6
|
+
* @param {UseStickyShadowParams} params Dependencies required to recalculate shadow visibility.
|
|
7
|
+
* @returns {boolean} True when the table has been horizontally scrolled.
|
|
8
|
+
*/
|
|
9
|
+
export const useStickyShadow = ({ scrollContainerRef, columnsLength, rowsLength, stickyHeaderCount, }) => {
|
|
10
|
+
const [showStickyShadow, setShowStickyShadow] = useState(false);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const container = scrollContainerRef.current;
|
|
13
|
+
if (!container)
|
|
14
|
+
return;
|
|
15
|
+
/**
|
|
16
|
+
* Synchronizes the sticky shadow state with the container's horizontal scroll position.
|
|
17
|
+
*
|
|
18
|
+
* @returns {void}
|
|
19
|
+
*/
|
|
20
|
+
const updateStickyShadow = () => {
|
|
21
|
+
setShowStickyShadow(container.scrollLeft > 0);
|
|
22
|
+
};
|
|
23
|
+
updateStickyShadow();
|
|
24
|
+
container.addEventListener('scroll', updateStickyShadow, { passive: true });
|
|
25
|
+
window.addEventListener('resize', updateStickyShadow);
|
|
26
|
+
return () => {
|
|
27
|
+
container.removeEventListener('scroll', updateStickyShadow);
|
|
28
|
+
window.removeEventListener('resize', updateStickyShadow);
|
|
29
|
+
};
|
|
30
|
+
}, [columnsLength, rowsLength, stickyHeaderCount, scrollContainerRef]);
|
|
31
|
+
return showStickyShadow;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=useStickyShadow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStickyShadow.js","sourceRoot":"","sources":["../../../../../src/components/TableSchedule/components/useStickyShadow.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAGZ,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAS3C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC9B,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,iBAAiB,GACK,EAAE,EAAE;IAC1B,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAE/D,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,SAAS,GAAG,kBAAkB,CAAC,OAAO,CAAA;QAC5C,IAAI,CAAC,SAAS;YAAE,OAAM;QAEtB;;;;WAIG;QACH,MAAM,kBAAkB,GAAG,GAAG,EAAE;YAC9B,mBAAmB,CAAC,SAAS,CAAC,UAAU,GAAG,CAAC,CAAC,CAAA;QAC/C,CAAC,CAAA;QAED,kBAAkB,EAAE,CAAA;QACpB,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA;QAC3E,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAA;QAErD,OAAO,GAAG,EAAE;YACV,SAAS,CAAC,mBAAmB,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAA;YAC3D,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAA;QAC1D,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,aAAa,EAAE,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,CAAC,CAAC,CAAA;IAEtE,OAAO,gBAAgB,CAAA;AACzB,CAAC,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { GridCellVariant, GridColumnAlign, GridRowHeaderAlign } from './types';
|
|
3
|
+
export declare const BORDER = "0.5px solid var(--color-border-tertiary, #e5e7eb)";
|
|
4
|
+
export declare const stickyBase: CSSProperties;
|
|
5
|
+
export declare const thBase: CSSProperties;
|
|
6
|
+
export declare const HEADER_TH_CLASSNAME = "whitespace-nowrap bg-white px-3 py-2 text-xs font-semibold text-gray-900";
|
|
7
|
+
export declare const STICKY_SHADOW_CLASSNAME = "drop-shadow-[4px_0_4px_rgba(0,0,0,0.1)]";
|
|
8
|
+
export declare const LEGEND_WRAPPER_CLASSNAME = "mb-3 flex w-fit items-center gap-2 rounded-lg bg-white p-2";
|
|
9
|
+
export declare const LEGEND_ITEM_CLASSNAME = "ml-2 flex items-center gap-1";
|
|
10
|
+
export declare const LEGEND_LAST_ITEM_CLASSNAME = "ml-2 mr-2 flex items-center gap-1";
|
|
11
|
+
export declare const LEGEND_LABEL_CLASSNAME = "text-xs font-normal text-gray-900";
|
|
12
|
+
export declare const TABLE_SCROLL_CONTAINER_CLASSNAME = "overflow-x-auto rounded-lg bg-white";
|
|
13
|
+
export declare const TABLE_CLASSNAME = "w-full border-collapse";
|
|
14
|
+
export declare const TABLE_SCROLL_CONTAINER_STYLE: CSSProperties;
|
|
15
|
+
export declare const TABLE_STYLE: CSSProperties;
|
|
16
|
+
export declare const ROW_HEADER_CONTENT_CLASSNAME = "flex flex-col";
|
|
17
|
+
export declare const ROW_HEADER_ALIGN_CLASSNAME: Record<GridRowHeaderAlign, string>;
|
|
18
|
+
export declare const ROW_HEADER_TITLE_CLASSNAME = "text-xs font-semibold text-gray-900";
|
|
19
|
+
export declare const ROW_HEADER_DESCRIPTION_CLASSNAME = "text-xs text-gray-600";
|
|
20
|
+
export declare const CELL_BOX_BASE_CLASSNAME = "flex h-[30px] w-[176px] items-center overflow-hidden rounded-lg border-[0.5px] px-2.5 text-left text-xs font-normal shadow-sm";
|
|
21
|
+
export declare const CELL_BOX_VARIANT_CLASSNAME: Record<GridCellVariant, string>;
|
|
22
|
+
export declare const LEGEND_INDICATOR_CLASSNAME: Record<GridCellVariant, string>;
|
|
23
|
+
export declare const CELL_WRAPPER_ALIGN_CLASSNAME: Record<GridColumnAlign, string>;
|
|
24
|
+
/**
|
|
25
|
+
* Returns the wrapper alignment class for a cell based on the column alignment.
|
|
26
|
+
*
|
|
27
|
+
* @param {GridColumnAlign} align The alignment configured for the column.
|
|
28
|
+
* @returns {string} The Tailwind class used to align the cell wrapper content.
|
|
29
|
+
*/
|
|
30
|
+
export declare const getCellWrapperAlignClassName: (align: GridColumnAlign) => string;
|
|
31
|
+
export declare const TOOLTIP_CONTENT_CLASSNAME = "flex max-w-[320px] flex-col gap-2 text-left";
|
|
32
|
+
export declare const TOOLTIP_TITLE_CLASSNAME = "text-xs font-semibold leading-5 text-gray-800";
|
|
33
|
+
export declare const TOOLTIP_SECTION_CLASSNAME = "flex flex-col gap-0.5";
|
|
34
|
+
export declare const TOOLTIP_LABEL_CLASSNAME = "text-xs leading-5 text-gray-500";
|
|
35
|
+
export declare const TOOLTIP_VALUE_CLASSNAME = "text-xs font-semibold leading-5 text-gray-800";
|
|
36
|
+
export declare const DEFAULT_TOOLTIP_CLASSNAME = "w-fit !px-5 !py-4";
|
|
37
|
+
export declare const SCHEDULE_CELL_CLASSNAME = "flex flex-col gap-2 text-left";
|
|
38
|
+
export declare const SCHEDULE_TITLE_CLASSNAME = "text-sm font-semibold leading-5 text-gray-800";
|
|
39
|
+
export declare const SCHEDULE_TITLE_DOTTED_CLASSNAME = "inline-block w-fit border-b-2 border-dotted border-gray-300 text-sm font-semibold leading-5 text-gray-800";
|
|
40
|
+
export declare const SCHEDULE_SECTION_CLASSNAME = "flex flex-col gap-1";
|
|
41
|
+
export declare const SCHEDULE_SECTION_LABEL_CLASSNAME = "flex items-center gap-1.5 text-xs font-normal leading-5 text-gray-500";
|
|
42
|
+
export declare const SCHEDULE_SECTION_VALUE_CLASSNAME = "text-sm font-semibold leading-5 text-gray-800";
|
|
43
|
+
export declare const SCHEDULE_EMPTY_TITLE_CLASSNAME = "text-sm font-semibold leading-5 text-gray-800";
|
|
44
|
+
export declare const SCHEDULE_EMPTY_DESCRIPTION_CLASSNAME = "text-xs font-normal leading-5 text-gray-500";
|
|
45
|
+
export declare const BOXED_CELL_PADDING_CLASSNAME = "px-1 py-1";
|
|
46
|
+
export declare const PLAIN_CELL_PADDING_CLASSNAME = "px-2 py-1.5";
|
|
47
|
+
export declare const BUTTON_BASE_CLASSNAME = "!shadow-none !flex !w-full !rounded-none !text-left";
|
|
48
|
+
export declare const CELL_CONTENT_BASE_CLASSNAME = "flex w-full text-left";
|
|
49
|
+
export declare const DATA_CELL_BASE_CLASSNAME = "align-middle border-l p-0";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
export const BORDER = '0.5px solid var(--color-border-tertiary, #e5e7eb)';
|
|
3
|
+
export const stickyBase = {
|
|
4
|
+
position: 'sticky',
|
|
5
|
+
left: 0,
|
|
6
|
+
zIndex: 2,
|
|
7
|
+
background: 'var(--color-background-primary, #fff)',
|
|
8
|
+
borderRight: BORDER,
|
|
9
|
+
};
|
|
10
|
+
export const thBase = {
|
|
11
|
+
borderBottom: BORDER,
|
|
12
|
+
textAlign: 'center',
|
|
13
|
+
};
|
|
14
|
+
export const HEADER_TH_CLASSNAME = 'whitespace-nowrap bg-white px-3 py-2 text-xs font-semibold text-gray-900';
|
|
15
|
+
export const STICKY_SHADOW_CLASSNAME = 'drop-shadow-[4px_0_4px_rgba(0,0,0,0.1)]';
|
|
16
|
+
export const LEGEND_WRAPPER_CLASSNAME = 'mb-3 flex w-fit items-center gap-2 rounded-lg bg-white p-2';
|
|
17
|
+
export const LEGEND_ITEM_CLASSNAME = 'ml-2 flex items-center gap-1';
|
|
18
|
+
export const LEGEND_LAST_ITEM_CLASSNAME = 'ml-2 mr-2 flex items-center gap-1';
|
|
19
|
+
export const LEGEND_LABEL_CLASSNAME = 'text-xs font-normal text-gray-900';
|
|
20
|
+
export const TABLE_SCROLL_CONTAINER_CLASSNAME = 'overflow-x-auto rounded-lg bg-white';
|
|
21
|
+
export const TABLE_CLASSNAME = 'w-full border-collapse';
|
|
22
|
+
export const TABLE_SCROLL_CONTAINER_STYLE = {
|
|
23
|
+
border: BORDER,
|
|
24
|
+
};
|
|
25
|
+
export const TABLE_STYLE = {
|
|
26
|
+
width: '100%',
|
|
27
|
+
borderCollapse: 'collapse',
|
|
28
|
+
};
|
|
29
|
+
export const ROW_HEADER_CONTENT_CLASSNAME = 'flex flex-col';
|
|
30
|
+
export const ROW_HEADER_ALIGN_CLASSNAME = {
|
|
31
|
+
left: 'items-start text-left',
|
|
32
|
+
center: 'items-center text-center',
|
|
33
|
+
right: 'items-end text-right',
|
|
34
|
+
};
|
|
35
|
+
export const ROW_HEADER_TITLE_CLASSNAME = 'text-xs font-semibold text-gray-900';
|
|
36
|
+
export const ROW_HEADER_DESCRIPTION_CLASSNAME = 'text-xs text-gray-600';
|
|
37
|
+
export const CELL_BOX_BASE_CLASSNAME = 'flex h-[30px] w-[176px] items-center overflow-hidden rounded-lg border-[0.5px] px-2.5 text-left text-xs font-normal shadow-sm';
|
|
38
|
+
export const CELL_BOX_VARIANT_CLASSNAME = {
|
|
39
|
+
default: 'border-gray-500 bg-white text-gray-900',
|
|
40
|
+
moving: 'border-gray-500 bg-[#FFD6A4] text-gray-900',
|
|
41
|
+
trogiang: 'border-[#00527C] bg-[#E0F0FF] text-[#00527C]',
|
|
42
|
+
empty: 'border-gray-500 bg-white text-gray-900',
|
|
43
|
+
};
|
|
44
|
+
export const LEGEND_INDICATOR_CLASSNAME = {
|
|
45
|
+
default: '',
|
|
46
|
+
moving: 'bg-[#FFD6A4]',
|
|
47
|
+
trogiang: 'border-[#00527C] bg-[#E0F0FF]',
|
|
48
|
+
empty: '',
|
|
49
|
+
};
|
|
50
|
+
export const CELL_WRAPPER_ALIGN_CLASSNAME = {
|
|
51
|
+
left: 'justify-start',
|
|
52
|
+
center: 'justify-center',
|
|
53
|
+
right: 'justify-end',
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Returns the wrapper alignment class for a cell based on the column alignment.
|
|
57
|
+
*
|
|
58
|
+
* @param {GridColumnAlign} align The alignment configured for the column.
|
|
59
|
+
* @returns {string} The Tailwind class used to align the cell wrapper content.
|
|
60
|
+
*/
|
|
61
|
+
export const getCellWrapperAlignClassName = (align) => CELL_WRAPPER_ALIGN_CLASSNAME[align];
|
|
62
|
+
export const TOOLTIP_CONTENT_CLASSNAME = 'flex max-w-[320px] flex-col gap-2 text-left';
|
|
63
|
+
export const TOOLTIP_TITLE_CLASSNAME = 'text-xs font-semibold leading-5 text-gray-800';
|
|
64
|
+
export const TOOLTIP_SECTION_CLASSNAME = 'flex flex-col gap-0.5';
|
|
65
|
+
export const TOOLTIP_LABEL_CLASSNAME = 'text-xs leading-5 text-gray-500';
|
|
66
|
+
export const TOOLTIP_VALUE_CLASSNAME = 'text-xs font-semibold leading-5 text-gray-800';
|
|
67
|
+
export const DEFAULT_TOOLTIP_CLASSNAME = 'w-fit !px-5 !py-4';
|
|
68
|
+
export const SCHEDULE_CELL_CLASSNAME = 'flex flex-col gap-2 text-left';
|
|
69
|
+
export const SCHEDULE_TITLE_CLASSNAME = 'text-sm font-semibold leading-5 text-gray-800';
|
|
70
|
+
export const SCHEDULE_TITLE_DOTTED_CLASSNAME = 'inline-block w-fit border-b-2 border-dotted border-gray-300 text-sm font-semibold leading-5 text-gray-800';
|
|
71
|
+
export const SCHEDULE_SECTION_CLASSNAME = 'flex flex-col gap-1';
|
|
72
|
+
export const SCHEDULE_SECTION_LABEL_CLASSNAME = 'flex items-center gap-1.5 text-xs font-normal leading-5 text-gray-500';
|
|
73
|
+
export const SCHEDULE_SECTION_VALUE_CLASSNAME = 'text-sm font-semibold leading-5 text-gray-800';
|
|
74
|
+
export const SCHEDULE_EMPTY_TITLE_CLASSNAME = 'text-sm font-semibold leading-5 text-gray-800';
|
|
75
|
+
export const SCHEDULE_EMPTY_DESCRIPTION_CLASSNAME = 'text-xs font-normal leading-5 text-gray-500';
|
|
76
|
+
export const BOXED_CELL_PADDING_CLASSNAME = 'px-1 py-1';
|
|
77
|
+
export const PLAIN_CELL_PADDING_CLASSNAME = 'px-2 py-1.5';
|
|
78
|
+
export const BUTTON_BASE_CLASSNAME = '!shadow-none !flex !w-full !rounded-none !text-left';
|
|
79
|
+
export const CELL_CONTENT_BASE_CLASSNAME = 'flex w-full text-left';
|
|
80
|
+
export const DATA_CELL_BASE_CLASSNAME = 'align-middle border-l p-0';
|
|
81
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/components/TableSchedule/constants.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAKZ,MAAM,CAAC,MAAM,MAAM,GAAG,mDAAmD,CAAA;AAEzE,MAAM,CAAC,MAAM,UAAU,GAAkB;IACvC,QAAQ,EAAE,QAAQ;IAClB,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,UAAU,EAAE,uCAAuC;IACnD,WAAW,EAAE,MAAM;CACpB,CAAA;AAED,MAAM,CAAC,MAAM,MAAM,GAAkB;IACnC,YAAY,EAAE,MAAM;IACpB,SAAS,EAAE,QAAQ;CACpB,CAAA;AA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C,MAAM,wBAAwB,GAAG,2BAA2B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './PHXScheduleTable';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/TableSchedule/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { GridCellData, GridRowHeader, GridScheduleContent } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Renders the content displayed inside a sticky row-header cell.
|
|
5
|
+
*
|
|
6
|
+
* @param {GridRowHeader} header The row-header configuration object.
|
|
7
|
+
* @returns {React.ReactNode} The rendered header content, or null when nothing is configured.
|
|
8
|
+
*/
|
|
9
|
+
export declare const renderRowHeaderContent: (header: GridRowHeader) => string | number | bigint | true | Iterable<React.ReactNode> | Promise<React.AwaitedReactNode> | React.JSX.Element | null;
|
|
10
|
+
/**
|
|
11
|
+
* Renders the boxed visual treatment used by default-layout schedule cells.
|
|
12
|
+
*
|
|
13
|
+
* @param {GridCellData} cell The cell data to render.
|
|
14
|
+
* @returns {React.ReactNode} The boxed content node for the cell.
|
|
15
|
+
*/
|
|
16
|
+
export declare const renderCellBoxContent: (cell: GridCellData) => React.JSX.Element;
|
|
17
|
+
/**
|
|
18
|
+
* Renders the rich schedule layout used by plain schedule cells.
|
|
19
|
+
*
|
|
20
|
+
* @param {GridScheduleContent} scheduleContent The structured schedule content to render.
|
|
21
|
+
* @param {string} [userDetailPageUrl] The base URL used to build person detail links.
|
|
22
|
+
* @returns {React.ReactNode} The rendered schedule content.
|
|
23
|
+
*/
|
|
24
|
+
export declare const renderScheduleContent: (scheduleContent: GridScheduleContent, userDetailPageUrl?: string) => React.JSX.Element;
|
|
25
|
+
/**
|
|
26
|
+
* Resolves and renders the tooltip content for a data cell.
|
|
27
|
+
*
|
|
28
|
+
* @param {GridCellData} cell The cell whose tooltip content should be rendered.
|
|
29
|
+
* @param {string} [userDetailPageUrl] The base URL used to build person detail links.
|
|
30
|
+
* @returns {React.ReactNode} The tooltip content, or null when the cell has no tooltip payload.
|
|
31
|
+
*/
|
|
32
|
+
export declare const renderTooltipContent: (cell: GridCellData, userDetailPageUrl?: string) => string | number | bigint | true | Iterable<React.ReactNode> | Promise<React.AwaitedReactNode> | React.JSX.Element | null;
|
|
33
|
+
/**
|
|
34
|
+
* Resolves the tooltip container class name for a cell.
|
|
35
|
+
*
|
|
36
|
+
* @param {GridCellData} cell The cell that may override the tooltip class.
|
|
37
|
+
* @returns {string} The tooltip class name to apply.
|
|
38
|
+
*/
|
|
39
|
+
export declare const resolveTooltipClassName: (cell: GridCellData) => string;
|
|
@@ -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,KAAK,aAAa,CAAA;AAE7G;;;;;;GAMG;AACH,MAAM,oBAAoB,GAAG,CAAC,MAAsB,EAAE,iBAA0B,EAAE,EAAE;IAClF,IAAI,CAAC,MAAM,CAAC,IAAI;QAAE,OAAO,IAAI,CAAA;IAE7B,OAAO,CACL,2BACE,SAAS,EAAC,wGAAwG,EAClH,IAAI,EAAE,iBAAiB,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,iBAAiB,GAAG,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,EACrF,GAAG,EAAC,qBAAqB,EACzB,MAAM,EAAC,QAAQ;QAEf;YACG,MAAM,CAAC,IAAI;YACX,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,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ACP,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 @@
|
|
|
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 {};
|