@ganpatiinfo/gids-web-dom-reference 12.0.0 → 13.0.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.
- package/CHANGELOG.md +84 -2
- package/dist/components/GidsAdvancedTooltip/GidsAdvancedTooltip.d.ts +8 -0
- package/dist/components/GidsAdvancedTooltip/GidsAdvancedTooltip.d.ts.map +1 -0
- package/dist/components/GidsAdvancedTooltip/GidsAdvancedTooltip.js +14 -0
- package/dist/components/GidsAdvancedTooltip/GidsAdvancedTooltip.js.map +1 -0
- package/dist/components/GidsBasicTableBody/GidsBasicTableBody.d.ts +26 -3
- package/dist/components/GidsBasicTableBody/GidsBasicTableBody.d.ts.map +1 -1
- package/dist/components/GidsBasicTableBody/GidsBasicTableBody.js +22 -3
- package/dist/components/GidsBasicTableBody/GidsBasicTableBody.js.map +1 -1
- package/dist/components/GidsBasicTableHead/GidsBasicTableHead.d.ts +15 -0
- package/dist/components/GidsBasicTableHead/GidsBasicTableHead.d.ts.map +1 -1
- package/dist/components/GidsBasicTableHead/GidsBasicTableHead.js +5 -0
- package/dist/components/GidsBasicTableHead/GidsBasicTableHead.js.map +1 -1
- package/dist/components/GidsBasicTableHeader/GidsBasicTableHeader.d.ts +26 -3
- package/dist/components/GidsBasicTableHeader/GidsBasicTableHeader.d.ts.map +1 -1
- package/dist/components/GidsBasicTableHeader/GidsBasicTableHeader.js +9 -1
- package/dist/components/GidsBasicTableHeader/GidsBasicTableHeader.js.map +1 -1
- package/dist/components/GidsBasicTableRow/GidsBasicTableRow.d.ts +22 -3
- package/dist/components/GidsBasicTableRow/GidsBasicTableRow.d.ts.map +1 -1
- package/dist/components/GidsBasicTableRow/GidsBasicTableRow.js +27 -6
- package/dist/components/GidsBasicTableRow/GidsBasicTableRow.js.map +1 -1
- package/dist/components/GidsBsTable/GidsBsTable.d.ts +26 -3
- package/dist/components/GidsBsTable/GidsBsTable.d.ts.map +1 -1
- package/dist/components/GidsBsTable/GidsBsTable.js +36 -14
- package/dist/components/GidsBsTable/GidsBsTable.js.map +1 -1
- package/dist/components/GidsChartLegendItem/GidsChartLegendItem.d.ts +1 -1
- package/dist/components/GidsChartLegendItem/GidsChartLegendItem.d.ts.map +1 -1
- package/dist/components/GidsChartLegendItem/GidsChartLegendItem.js +2 -1
- package/dist/components/GidsChartLegendItem/GidsChartLegendItem.js.map +1 -1
- package/dist/components/GidsColorSwatch/GidsColorSwatch.d.ts +8 -0
- package/dist/components/GidsColorSwatch/GidsColorSwatch.d.ts.map +1 -0
- package/dist/components/GidsColorSwatch/GidsColorSwatch.js +62 -0
- package/dist/components/GidsColorSwatch/GidsColorSwatch.js.map +1 -0
- package/dist/components/GidsMatrixTable/GidsMatrixTable.d.ts +12 -0
- package/dist/components/GidsMatrixTable/GidsMatrixTable.d.ts.map +1 -0
- package/dist/components/GidsMatrixTable/GidsMatrixTable.js +70 -0
- package/dist/components/GidsMatrixTable/GidsMatrixTable.js.map +1 -0
- package/dist/components/GidsMatrixTableBody/GidsMatrixTableBody.d.ts +12 -0
- package/dist/components/GidsMatrixTableBody/GidsMatrixTableBody.d.ts.map +1 -0
- package/dist/components/GidsMatrixTableBody/GidsMatrixTableBody.js +70 -0
- package/dist/components/GidsMatrixTableBody/GidsMatrixTableBody.js.map +1 -0
- package/dist/components/GidsMdTable/GidsMdTable.d.ts +11 -2
- package/dist/components/GidsMdTable/GidsMdTable.d.ts.map +1 -1
- package/dist/components/GidsMdTable/GidsMdTable.js +3 -0
- package/dist/components/GidsMdTable/GidsMdTable.js.map +1 -1
- package/dist/components/GidsPagination/GidsPagination.d.ts +10 -0
- package/dist/components/GidsPagination/GidsPagination.d.ts.map +1 -1
- package/dist/components/GidsPagination/GidsPagination.js +5 -0
- package/dist/components/GidsPagination/GidsPagination.js.map +1 -1
- package/dist/components/GidsPaginator/GidsPaginator.d.ts +8 -0
- package/dist/components/GidsPaginator/GidsPaginator.d.ts.map +1 -0
- package/dist/components/GidsPaginator/GidsPaginator.js +154 -0
- package/dist/components/GidsPaginator/GidsPaginator.js.map +1 -0
- package/dist/components/GidsPaginatorItem/GidsPaginatorItem.d.ts +9 -0
- package/dist/components/GidsPaginatorItem/GidsPaginatorItem.d.ts.map +1 -0
- package/dist/components/GidsPaginatorItem/GidsPaginatorItem.js +33 -0
- package/dist/components/GidsPaginatorItem/GidsPaginatorItem.js.map +1 -0
- package/dist/components/GidsTable/GidsTable.d.ts +18 -0
- package/dist/components/GidsTable/GidsTable.d.ts.map +1 -0
- package/dist/components/GidsTable/GidsTable.js +96 -0
- package/dist/components/GidsTable/GidsTable.js.map +1 -0
- package/dist/components/GidsTableBody/GidsTableBody.d.ts +13 -0
- package/dist/components/GidsTableBody/GidsTableBody.d.ts.map +1 -0
- package/dist/components/GidsTableBody/GidsTableBody.js +61 -0
- package/dist/components/GidsTableBody/GidsTableBody.js.map +1 -0
- package/dist/components/GidsTableCell/GidsTableCell.d.ts +28 -0
- package/dist/components/GidsTableCell/GidsTableCell.d.ts.map +1 -0
- package/dist/components/GidsTableCell/GidsTableCell.js +146 -0
- package/dist/components/GidsTableCell/GidsTableCell.js.map +1 -0
- package/dist/components/GidsTableEntry/GidsTableEntry.d.ts +13 -0
- package/dist/components/GidsTableEntry/GidsTableEntry.d.ts.map +1 -0
- package/dist/components/GidsTableEntry/GidsTableEntry.js +305 -0
- package/dist/components/GidsTableEntry/GidsTableEntry.js.map +1 -0
- package/dist/components/GidsTableFooter/GidsTableFooter.d.ts +13 -0
- package/dist/components/GidsTableFooter/GidsTableFooter.d.ts.map +1 -0
- package/dist/components/GidsTableFooter/GidsTableFooter.js +75 -0
- package/dist/components/GidsTableFooter/GidsTableFooter.js.map +1 -0
- package/dist/components/GidsTableFooterControl/GidsTableFooterControl.d.ts +11 -0
- package/dist/components/GidsTableFooterControl/GidsTableFooterControl.d.ts.map +1 -0
- package/dist/components/GidsTableFooterControl/GidsTableFooterControl.js +97 -0
- package/dist/components/GidsTableFooterControl/GidsTableFooterControl.js.map +1 -0
- package/dist/components/GidsTableHeader/GidsTableHeader.d.ts +13 -0
- package/dist/components/GidsTableHeader/GidsTableHeader.d.ts.map +1 -0
- package/dist/components/GidsTableHeader/GidsTableHeader.js +51 -0
- package/dist/components/GidsTableHeader/GidsTableHeader.js.map +1 -0
- package/dist/components/GidsTableRow/GidsTableRow.d.ts +13 -0
- package/dist/components/GidsTableRow/GidsTableRow.d.ts.map +1 -0
- package/dist/components/GidsTableRow/GidsTableRow.js +71 -0
- package/dist/components/GidsTableRow/GidsTableRow.js.map +1 -0
- package/dist/components/GidsTableToolbar/GidsTableToolbar.d.ts +11 -0
- package/dist/components/GidsTableToolbar/GidsTableToolbar.d.ts.map +1 -0
- package/dist/components/GidsTableToolbar/GidsTableToolbar.js +92 -0
- package/dist/components/GidsTableToolbar/GidsTableToolbar.js.map +1 -0
- package/dist/components/_GidsPaginationItem/GidsPaginationItem.d.ts +10 -0
- package/dist/components/_GidsPaginationItem/GidsPaginationItem.d.ts.map +1 -1
- package/dist/components/_GidsPaginationItem/GidsPaginationItem.js +5 -0
- package/dist/components/_GidsPaginationItem/GidsPaginationItem.js.map +1 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/components/GidsAdvancedTooltip/GidsAdvancedTooltip.ts +42 -0
- package/src/components/GidsBasicTableBody/GidsBasicTableBody.ts +66 -5
- package/src/components/GidsBasicTableHead/GidsBasicTableHead.ts +15 -0
- package/src/components/GidsBasicTableHeader/GidsBasicTableHeader.ts +45 -5
- package/src/components/GidsBasicTableRow/GidsBasicTableRow.ts +65 -7
- package/src/components/GidsBsTable/GidsBsTable.ts +81 -19
- package/src/components/GidsChartLegendItem/GidsChartLegendItem.ts +2 -0
- package/src/components/GidsColorSwatch/GidsColorSwatch.ts +107 -0
- package/src/components/GidsMatrixTable/GidsMatrixTable.ts +167 -0
- package/src/components/GidsMatrixTableBody/GidsMatrixTableBody.ts +164 -0
- package/src/components/GidsMdTable/GidsMdTable.ts +14 -2
- package/src/components/GidsPagination/GidsPagination.ts +14 -2
- package/src/components/GidsPaginator/GidsPaginator.ts +241 -0
- package/src/components/GidsPaginatorItem/GidsPaginatorItem.ts +72 -0
- package/src/components/GidsTable/GidsTable.ts +203 -0
- package/src/components/GidsTableBody/GidsTableBody.ts +137 -0
- package/src/components/GidsTableCell/GidsTableCell.ts +276 -0
- package/src/components/GidsTableEntry/GidsTableEntry.ts +515 -0
- package/src/components/GidsTableFooter/GidsTableFooter.ts +157 -0
- package/src/components/GidsTableFooterControl/GidsTableFooterControl.ts +159 -0
- package/src/components/GidsTableHeader/GidsTableHeader.ts +116 -0
- package/src/components/GidsTableRow/GidsTableRow.ts +154 -0
- package/src/components/GidsTableToolbar/GidsTableToolbar.ts +180 -0
- package/src/components/_GidsPaginationItem/GidsPaginationItem.ts +14 -2
- package/src/index.ts +15 -1
- package/dist/components/GidsBasicTableCell/GidsBasicTableCell.d.ts +0 -9
- package/dist/components/GidsBasicTableCell/GidsBasicTableCell.d.ts.map +0 -1
- package/dist/components/GidsBasicTableCell/GidsBasicTableCell.js +0 -48
- package/dist/components/GidsBasicTableCell/GidsBasicTableCell.js.map +0 -1
- package/src/components/GidsBasicTableCell/GidsBasicTableCell.ts +0 -99
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { GidsMatrixTableBodyActionButtonEvent } from '@ganpatiinfo/gids-core-shared';
|
|
2
|
+
import {
|
|
3
|
+
GidsMatrixTableWebProps,
|
|
4
|
+
GidsMatrixTableWebUtils,
|
|
5
|
+
GidsTableCellTypographyStyle,
|
|
6
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
7
|
+
import {
|
|
8
|
+
IconAppearance,
|
|
9
|
+
IconName,
|
|
10
|
+
} from '@ganpatiinfo/gids-web-theme-interface';
|
|
11
|
+
import {
|
|
12
|
+
GidsBasicTableHeaderActionButtonBaseEvent,
|
|
13
|
+
GidsBasicTableHeaderDom,
|
|
14
|
+
} from '../GidsBasicTableHeader/GidsBasicTableHeader';
|
|
15
|
+
import { GidsMatrixTableBodyDom } from '../GidsMatrixTableBody/GidsMatrixTableBody';
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
getGidsMatrixTableClassNames,
|
|
19
|
+
getCustomisedTopHeaderMatrixTableCells,
|
|
20
|
+
getMatrixTableBodyBorder,
|
|
21
|
+
getMatrixTableClasses,
|
|
22
|
+
} = GidsMatrixTableWebUtils;
|
|
23
|
+
|
|
24
|
+
type GidsMatrixTableBaseWebProps = GidsMatrixTableWebProps<
|
|
25
|
+
GidsTableCellTypographyStyle,
|
|
26
|
+
IconName,
|
|
27
|
+
IconAppearance
|
|
28
|
+
>;
|
|
29
|
+
|
|
30
|
+
type GidsMatrixTableActionButtonBaseEvent =
|
|
31
|
+
GidsMatrixTableBodyActionButtonEvent<
|
|
32
|
+
Event,
|
|
33
|
+
GidsTableCellTypographyStyle,
|
|
34
|
+
IconName,
|
|
35
|
+
IconAppearance
|
|
36
|
+
>;
|
|
37
|
+
|
|
38
|
+
export interface GidsMatrixTableDomProps extends GidsMatrixTableBaseWebProps {
|
|
39
|
+
extraClasses?: string;
|
|
40
|
+
onClickMatrixTableActionBtn?: (
|
|
41
|
+
event: GidsMatrixTableActionButtonBaseEvent,
|
|
42
|
+
) => void;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const GidsMatrixTableDom = ({
|
|
46
|
+
topHeaderCells = [],
|
|
47
|
+
tableBodyItems = [],
|
|
48
|
+
width = 'full',
|
|
49
|
+
isTopHeaderVisible = false,
|
|
50
|
+
topHeaderAppearance = 'none',
|
|
51
|
+
topHeaderLabelTypography = 'eyebrow-small',
|
|
52
|
+
topHeaderTextAlignment = 'left',
|
|
53
|
+
rowAppearance = 'none',
|
|
54
|
+
rowLabelTypography = 'label-small',
|
|
55
|
+
rowTextAlignment = 'left',
|
|
56
|
+
tableBorders = 'none',
|
|
57
|
+
tableBorderRadius = [],
|
|
58
|
+
tableBodyMaxHeight = 200,
|
|
59
|
+
rowCellPrimaryActionButtons = [],
|
|
60
|
+
rowCellSecondaryActionButtons = [],
|
|
61
|
+
topHeaderPrimaryActionButtons = [],
|
|
62
|
+
topHeaderSecondaryActionButtons = [],
|
|
63
|
+
onClickMatrixTableActionBtn,
|
|
64
|
+
matrixHeaderAppearance = 'none',
|
|
65
|
+
matrixHeaderLabelTypography = 'label-medium',
|
|
66
|
+
matrixHeaderTextAlignment = 'left',
|
|
67
|
+
matrixHeaderCellPrimaryActionButtons = [],
|
|
68
|
+
matrixHeaderCellSecondaryActionButtons = [],
|
|
69
|
+
extraClasses,
|
|
70
|
+
}: GidsMatrixTableDomProps): HTMLElement => {
|
|
71
|
+
const matrixTableDiv = document.createElement('div');
|
|
72
|
+
matrixTableDiv.className = getGidsMatrixTableClassNames<
|
|
73
|
+
GidsTableCellTypographyStyle,
|
|
74
|
+
IconName,
|
|
75
|
+
IconAppearance
|
|
76
|
+
>({ width, tableBorders, tableBorderRadius }, extraClasses);
|
|
77
|
+
|
|
78
|
+
// Wrapper Container to safely handle scroll containment
|
|
79
|
+
const matrixTableScrollContainer = document.createElement('div');
|
|
80
|
+
matrixTableScrollContainer.className = 'gids-matrix-table__scroll-container';
|
|
81
|
+
|
|
82
|
+
// Safe injection of the custom property value into the container element
|
|
83
|
+
if (tableBodyMaxHeight) {
|
|
84
|
+
matrixTableScrollContainer.style.setProperty(
|
|
85
|
+
'--gidsMatrixTable-body-max-height',
|
|
86
|
+
`${tableBodyMaxHeight}px`,
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const matrixTable = document.createElement('table');
|
|
91
|
+
matrixTable.className = getMatrixTableClasses<
|
|
92
|
+
GidsTableCellTypographyStyle,
|
|
93
|
+
IconName,
|
|
94
|
+
IconAppearance
|
|
95
|
+
>({ width });
|
|
96
|
+
|
|
97
|
+
if (isTopHeaderVisible && topHeaderCells && topHeaderCells.length > 0) {
|
|
98
|
+
function onTopHeaderActionBtnClick(
|
|
99
|
+
event: GidsBasicTableHeaderActionButtonBaseEvent,
|
|
100
|
+
) {
|
|
101
|
+
if (onClickMatrixTableActionBtn) {
|
|
102
|
+
onClickMatrixTableActionBtn({
|
|
103
|
+
...event,
|
|
104
|
+
details: {
|
|
105
|
+
...event.details,
|
|
106
|
+
columnIndex: event?.details?.cellIndex,
|
|
107
|
+
headerType: 'top',
|
|
108
|
+
rowIndex: event?.details?.cellIndex,
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Append Table Header
|
|
115
|
+
matrixTable.append(
|
|
116
|
+
GidsBasicTableHeaderDom({
|
|
117
|
+
appearance: topHeaderAppearance,
|
|
118
|
+
labelTypography: topHeaderLabelTypography,
|
|
119
|
+
textAlignment: topHeaderTextAlignment,
|
|
120
|
+
extraClasses: 'gids-matrix-table__top-thead',
|
|
121
|
+
headerCells: getCustomisedTopHeaderMatrixTableCells<
|
|
122
|
+
GidsTableCellTypographyStyle,
|
|
123
|
+
IconName,
|
|
124
|
+
IconAppearance
|
|
125
|
+
>({
|
|
126
|
+
topHeaderCells,
|
|
127
|
+
tableBorders,
|
|
128
|
+
}),
|
|
129
|
+
width,
|
|
130
|
+
cellPrimaryActionButtons: topHeaderPrimaryActionButtons,
|
|
131
|
+
cellSecondaryActionButtons: topHeaderSecondaryActionButtons,
|
|
132
|
+
onClickHeaderActionBtn: onTopHeaderActionBtnClick,
|
|
133
|
+
}),
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (tableBodyItems && tableBodyItems.length > 0) {
|
|
138
|
+
matrixTable.append(
|
|
139
|
+
GidsMatrixTableBodyDom({
|
|
140
|
+
width,
|
|
141
|
+
tableBodyItems,
|
|
142
|
+
tableBorders: getMatrixTableBodyBorder<
|
|
143
|
+
GidsTableCellTypographyStyle,
|
|
144
|
+
IconName,
|
|
145
|
+
IconAppearance
|
|
146
|
+
>({ tableBorders }),
|
|
147
|
+
rowAppearance,
|
|
148
|
+
rowLabelTypography,
|
|
149
|
+
rowTextAlignment,
|
|
150
|
+
matrixHeaderAppearance,
|
|
151
|
+
matrixHeaderLabelTypography,
|
|
152
|
+
matrixHeaderTextAlignment,
|
|
153
|
+
rowCellPrimaryActionButtons,
|
|
154
|
+
rowCellSecondaryActionButtons,
|
|
155
|
+
matrixHeaderCellPrimaryActionButtons,
|
|
156
|
+
matrixHeaderCellSecondaryActionButtons,
|
|
157
|
+
onClickMatrixBodyCellActionBtn: onClickMatrixTableActionBtn,
|
|
158
|
+
}),
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Structural Append hierarchy: matrixTable -> scroll wrapper -> root container
|
|
163
|
+
matrixTableScrollContainer.appendChild(matrixTable);
|
|
164
|
+
matrixTableDiv.appendChild(matrixTableScrollContainer);
|
|
165
|
+
|
|
166
|
+
return matrixTableDiv;
|
|
167
|
+
};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GidsMatrixTableBodyWebProps,
|
|
3
|
+
GidsMatrixTableBodyWebUtils,
|
|
4
|
+
GidsTableCellTypographyStyle,
|
|
5
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
6
|
+
import {
|
|
7
|
+
IconAppearance,
|
|
8
|
+
IconName,
|
|
9
|
+
} from '@ganpatiinfo/gids-web-theme-interface';
|
|
10
|
+
import {
|
|
11
|
+
GidsMatrixTableBodyActionButtonEvent,
|
|
12
|
+
GidsMatrixTableBodyConstructedRowItem,
|
|
13
|
+
GidsMatrixTableBodyContructedMatrixHeaderItem,
|
|
14
|
+
} from '@ganpatiinfo/gids-core-shared';
|
|
15
|
+
import {
|
|
16
|
+
GidsTableCellActionButtonBaseEvent,
|
|
17
|
+
GidsTableCellDom,
|
|
18
|
+
} from '../GidsTableCell/GidsTableCell';
|
|
19
|
+
|
|
20
|
+
const { getGidsMatrixTableBodyClassNames, getConstructedMatrixTableBodyItems } =
|
|
21
|
+
GidsMatrixTableBodyWebUtils;
|
|
22
|
+
|
|
23
|
+
type GidsMatrixTableBodyBaseWebProps = GidsMatrixTableBodyWebProps<
|
|
24
|
+
GidsTableCellTypographyStyle,
|
|
25
|
+
IconName,
|
|
26
|
+
IconAppearance
|
|
27
|
+
>;
|
|
28
|
+
export type GidsMatrixTableBodyActionButtonBaseEvent =
|
|
29
|
+
GidsMatrixTableBodyActionButtonEvent<
|
|
30
|
+
Event,
|
|
31
|
+
GidsTableCellTypographyStyle,
|
|
32
|
+
IconName,
|
|
33
|
+
IconAppearance
|
|
34
|
+
>;
|
|
35
|
+
|
|
36
|
+
export interface GidsMatrixTableBodyDomProps extends GidsMatrixTableBodyBaseWebProps {
|
|
37
|
+
extraClasses?: string;
|
|
38
|
+
onClickMatrixBodyCellActionBtn?: (
|
|
39
|
+
event: GidsMatrixTableBodyActionButtonBaseEvent,
|
|
40
|
+
) => void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const GidsMatrixTableBodyDom = ({
|
|
44
|
+
width = 'full',
|
|
45
|
+
tableBodyItems = [],
|
|
46
|
+
tableBorders = 'none',
|
|
47
|
+
rowAppearance = 'none',
|
|
48
|
+
rowLabelTypography = 'label-medium',
|
|
49
|
+
rowTextAlignment = 'center',
|
|
50
|
+
matrixHeaderAppearance = 'none',
|
|
51
|
+
matrixHeaderLabelTypography = 'label-medium',
|
|
52
|
+
matrixHeaderTextAlignment = 'center',
|
|
53
|
+
rowCellPrimaryActionButtons = [],
|
|
54
|
+
rowCellSecondaryActionButtons = [],
|
|
55
|
+
matrixHeaderCellPrimaryActionButtons = [],
|
|
56
|
+
matrixHeaderCellSecondaryActionButtons = [],
|
|
57
|
+
onClickMatrixBodyCellActionBtn,
|
|
58
|
+
extraClasses,
|
|
59
|
+
}: GidsMatrixTableBodyDomProps): HTMLElement => {
|
|
60
|
+
const matrixTableBody = document.createElement('tbody');
|
|
61
|
+
matrixTableBody.className = getGidsMatrixTableBodyClassNames(
|
|
62
|
+
{ width },
|
|
63
|
+
extraClasses,
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
if (tableBodyItems && tableBodyItems.length > 0) {
|
|
67
|
+
const constructedTableBodyItems = getConstructedMatrixTableBodyItems<
|
|
68
|
+
GidsTableCellTypographyStyle,
|
|
69
|
+
IconName,
|
|
70
|
+
IconAppearance
|
|
71
|
+
>({
|
|
72
|
+
rowAppearance,
|
|
73
|
+
rowLabelTypography,
|
|
74
|
+
rowTextAlignment,
|
|
75
|
+
matrixHeaderAppearance,
|
|
76
|
+
matrixHeaderLabelTypography,
|
|
77
|
+
matrixHeaderTextAlignment,
|
|
78
|
+
tableBodyItems,
|
|
79
|
+
tableBorders,
|
|
80
|
+
matrixHeaderCellPrimaryActionButtons,
|
|
81
|
+
matrixHeaderCellSecondaryActionButtons,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
function onMatrixBodyCellActionBtnClick({
|
|
85
|
+
event,
|
|
86
|
+
rowIndex,
|
|
87
|
+
columnIndex,
|
|
88
|
+
item,
|
|
89
|
+
}: {
|
|
90
|
+
event: GidsTableCellActionButtonBaseEvent;
|
|
91
|
+
rowIndex: number;
|
|
92
|
+
columnIndex?: number;
|
|
93
|
+
item?:
|
|
94
|
+
| GidsMatrixTableBodyConstructedRowItem<
|
|
95
|
+
GidsTableCellTypographyStyle,
|
|
96
|
+
IconName,
|
|
97
|
+
IconAppearance
|
|
98
|
+
>
|
|
99
|
+
| GidsMatrixTableBodyContructedMatrixHeaderItem<
|
|
100
|
+
GidsTableCellTypographyStyle,
|
|
101
|
+
IconName,
|
|
102
|
+
IconAppearance
|
|
103
|
+
>;
|
|
104
|
+
}) {
|
|
105
|
+
if (onClickMatrixBodyCellActionBtn) {
|
|
106
|
+
onClickMatrixBodyCellActionBtn({
|
|
107
|
+
...event,
|
|
108
|
+
details: {
|
|
109
|
+
...event.details,
|
|
110
|
+
rowIndex,
|
|
111
|
+
columnIndex,
|
|
112
|
+
isHeaderCell: item?.isHeader,
|
|
113
|
+
headerType: item?.headerType ?? 'none',
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
constructedTableBodyItems.forEach((constructedTableBodyItem, indexI) => {
|
|
120
|
+
const { headerItem, rowItems = [] } = constructedTableBodyItem;
|
|
121
|
+
const tableRowEl = document.createElement('tr');
|
|
122
|
+
|
|
123
|
+
tableRowEl.append(
|
|
124
|
+
GidsTableCellDom({
|
|
125
|
+
...headerItem,
|
|
126
|
+
width,
|
|
127
|
+
isHeaderCell: headerItem?.isHeader ?? true,
|
|
128
|
+
cellPrimaryActionButtons: matrixHeaderCellPrimaryActionButtons,
|
|
129
|
+
cellSecondaryActionButtons: matrixHeaderCellSecondaryActionButtons,
|
|
130
|
+
onClickCellActionBtn: (event: GidsTableCellActionButtonBaseEvent) =>
|
|
131
|
+
onMatrixBodyCellActionBtnClick({
|
|
132
|
+
event,
|
|
133
|
+
rowIndex: indexI,
|
|
134
|
+
columnIndex: undefined,
|
|
135
|
+
item: headerItem,
|
|
136
|
+
}),
|
|
137
|
+
}),
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
rowItems.forEach((rowItem, indexJ) => {
|
|
141
|
+
tableRowEl.append(
|
|
142
|
+
GidsTableCellDom({
|
|
143
|
+
...rowItem,
|
|
144
|
+
width,
|
|
145
|
+
isHeaderCell: rowItem?.isHeader ?? false,
|
|
146
|
+
cellPrimaryActionButtons: rowCellPrimaryActionButtons,
|
|
147
|
+
cellSecondaryActionButtons: rowCellSecondaryActionButtons,
|
|
148
|
+
onClickCellActionBtn: (event: GidsTableCellActionButtonBaseEvent) =>
|
|
149
|
+
onMatrixBodyCellActionBtnClick({
|
|
150
|
+
event,
|
|
151
|
+
rowIndex: indexI,
|
|
152
|
+
columnIndex: indexJ,
|
|
153
|
+
item: rowItem,
|
|
154
|
+
}),
|
|
155
|
+
}),
|
|
156
|
+
);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
matrixTableBody.appendChild(tableRowEl);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return matrixTableBody;
|
|
164
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
GidsTableCellTypographyStyle,
|
|
3
3
|
GidsMdTableWebProps,
|
|
4
4
|
GidsMdTableWebUtils,
|
|
5
5
|
} from '@ganpatiinfo/gids-web-shared';
|
|
@@ -10,18 +10,30 @@ import {
|
|
|
10
10
|
|
|
11
11
|
const { getGidsMdTableClassNames } = GidsMdTableWebUtils;
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Use `GidsBmdTable` and its props instead. `GidsMdTable` will be removed in a future release.
|
|
15
|
+
*/
|
|
13
16
|
type GidsMdTableBaseWebProps = GidsMdTableWebProps<
|
|
14
|
-
|
|
17
|
+
GidsTableCellTypographyStyle,
|
|
15
18
|
IconName,
|
|
16
19
|
IconAppearance
|
|
17
20
|
>;
|
|
18
21
|
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Use `GidsBmdTable` and its props instead. `GidsMdTable` will be removed in a future release.
|
|
24
|
+
*/
|
|
19
25
|
type GidsMdTableElement = HTMLElement & GidsMdTableBaseWebProps;
|
|
20
26
|
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Use `GidsBmdTable` and its props instead. `GidsMdTable` will be removed in a future release.
|
|
29
|
+
*/
|
|
21
30
|
export interface GidsMdTableDomProps extends GidsMdTableBaseWebProps {
|
|
22
31
|
extraClasses?: string;
|
|
23
32
|
}
|
|
24
33
|
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated Use `GidsBmdTable` and its props instead. `GidsMdTable` will be removed in a future release.
|
|
36
|
+
*/
|
|
25
37
|
export const GidsMdTableDom = ({
|
|
26
38
|
topHeaderCells = [],
|
|
27
39
|
tableBody = [],
|
|
@@ -14,8 +14,15 @@ const { getGidsPaginationClassNames, getGidsPaginationDotsClassNames } =
|
|
|
14
14
|
GidsPaginationWebUtils;
|
|
15
15
|
const { getPaginationsArr } = GidsPaginationCommonUtils;
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated
|
|
19
|
+
*
|
|
20
|
+
* Use `GidsPaginator` and its props and functions instead.
|
|
21
|
+
*/
|
|
22
|
+
export interface GidsPaginationDomProps extends Omit<
|
|
23
|
+
GidsPaginationCommonProps<string>,
|
|
24
|
+
'onClickItem'
|
|
25
|
+
> {
|
|
19
26
|
extraClasses?: ClassValue;
|
|
20
27
|
onClickItem?: ({
|
|
21
28
|
event,
|
|
@@ -26,6 +33,11 @@ export interface GidsPaginationDomProps
|
|
|
26
33
|
}: GidsPaginationButtonParamsProps<MouseEvent>) => void;
|
|
27
34
|
}
|
|
28
35
|
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated
|
|
38
|
+
*
|
|
39
|
+
* Use `GidsPaginator` and its props and functions instead.
|
|
40
|
+
*/
|
|
29
41
|
export const GidsPaginationDom = ({
|
|
30
42
|
selectColor = 'default',
|
|
31
43
|
variant = 'default',
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GidsPaginatorWebProps,
|
|
3
|
+
GidsPaginatorWebUtils,
|
|
4
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
5
|
+
import {
|
|
6
|
+
GidsPaginatorItemDom,
|
|
7
|
+
GidsPaginatorItemDomProps,
|
|
8
|
+
} from '../GidsPaginatorItem/GidsPaginatorItem.js';
|
|
9
|
+
import { IconName } from '@ganpatiinfo/gids-web-theme-interface';
|
|
10
|
+
import {
|
|
11
|
+
GidsPaginatorEventDetails,
|
|
12
|
+
GidsPaginatorItemEvent,
|
|
13
|
+
} from '@ganpatiinfo/gids-core-shared';
|
|
14
|
+
|
|
15
|
+
const { getGidsPaginatorClassNames } = GidsPaginatorWebUtils;
|
|
16
|
+
|
|
17
|
+
export type GidsPaginatorBaseWebProps = GidsPaginatorWebProps<IconName, Event>;
|
|
18
|
+
|
|
19
|
+
export interface GidsPaginatorDomProps extends GidsPaginatorBaseWebProps {
|
|
20
|
+
extraClasses?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const GidsPaginatorDom = ({
|
|
24
|
+
currentPage = 1,
|
|
25
|
+
totalPages = 1,
|
|
26
|
+
size = 'sm',
|
|
27
|
+
disabled = false,
|
|
28
|
+
selectColor = 'default',
|
|
29
|
+
variant = 'default',
|
|
30
|
+
shape = 'circled',
|
|
31
|
+
showFirstPageBtn,
|
|
32
|
+
showLastPageBtn,
|
|
33
|
+
showNextBtn,
|
|
34
|
+
showPreviousBtn,
|
|
35
|
+
onPageChange,
|
|
36
|
+
extraClasses,
|
|
37
|
+
}: GidsPaginatorDomProps): HTMLDivElement => {
|
|
38
|
+
const paginator = document.createElement('div');
|
|
39
|
+
paginator.className = getGidsPaginatorClassNames(extraClasses);
|
|
40
|
+
|
|
41
|
+
/*
|
|
42
|
+
* Container for pagination items.
|
|
43
|
+
*/
|
|
44
|
+
const paginatorItems = document.createElement('div');
|
|
45
|
+
paginatorItems.className =
|
|
46
|
+
variant === 'outlined'
|
|
47
|
+
? 'gids-paginator__shaped-items'
|
|
48
|
+
: 'gids-paginator__items';
|
|
49
|
+
|
|
50
|
+
const createPaginatorItem = ({
|
|
51
|
+
children,
|
|
52
|
+
isIcon = false,
|
|
53
|
+
iconName,
|
|
54
|
+
selected = false,
|
|
55
|
+
disabled: itemDisabled = false,
|
|
56
|
+
onPaginatorItemClick,
|
|
57
|
+
ellipsis = false,
|
|
58
|
+
}: Partial<GidsPaginatorItemDomProps> & { ellipsis?: boolean }) => {
|
|
59
|
+
return GidsPaginatorItemDom({
|
|
60
|
+
children,
|
|
61
|
+
isIcon: ellipsis ? false : isIcon,
|
|
62
|
+
iconName,
|
|
63
|
+
selected: ellipsis ? false : selected,
|
|
64
|
+
disabled: disabled || itemDisabled,
|
|
65
|
+
size,
|
|
66
|
+
selectColor,
|
|
67
|
+
variant: ellipsis ? 'default' : variant,
|
|
68
|
+
shape,
|
|
69
|
+
onPaginatorItemClick,
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const handlePageChange = ({
|
|
74
|
+
page,
|
|
75
|
+
event,
|
|
76
|
+
}: {
|
|
77
|
+
page: number;
|
|
78
|
+
event: GidsPaginatorItemEvent<Event>;
|
|
79
|
+
}) => {
|
|
80
|
+
if (disabled || page < 1 || page > totalPages || page === currentPage) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (onPageChange) {
|
|
85
|
+
const pageChangeEventDetail: GidsPaginatorEventDetails<IconName, Event> =
|
|
86
|
+
{
|
|
87
|
+
currentPage: page,
|
|
88
|
+
totalPages,
|
|
89
|
+
size,
|
|
90
|
+
variant,
|
|
91
|
+
shape,
|
|
92
|
+
selectColor,
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
onPageChange({
|
|
96
|
+
originalEvent: event?.originalEvent,
|
|
97
|
+
details: pageChangeEventDetail,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
if (showFirstPageBtn) {
|
|
103
|
+
/*
|
|
104
|
+
* First page button
|
|
105
|
+
*/
|
|
106
|
+
paginatorItems.appendChild(
|
|
107
|
+
createPaginatorItem({
|
|
108
|
+
isIcon: true,
|
|
109
|
+
iconName: 'backward',
|
|
110
|
+
disabled: currentPage <= 1,
|
|
111
|
+
onPaginatorItemClick: (event: GidsPaginatorItemEvent<Event>) => {
|
|
112
|
+
handlePageChange({ page: 1, event });
|
|
113
|
+
},
|
|
114
|
+
}),
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (showPreviousBtn) {
|
|
119
|
+
/*
|
|
120
|
+
* Previous button
|
|
121
|
+
*/
|
|
122
|
+
paginatorItems.appendChild(
|
|
123
|
+
createPaginatorItem({
|
|
124
|
+
isIcon: true,
|
|
125
|
+
iconName: 'chevron-left',
|
|
126
|
+
disabled: currentPage <= 1,
|
|
127
|
+
onPaginatorItemClick: (event: GidsPaginatorItemEvent<Event>) => {
|
|
128
|
+
handlePageChange({ page: currentPage - 1, event });
|
|
129
|
+
},
|
|
130
|
+
}),
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/*
|
|
135
|
+
* Page calculation
|
|
136
|
+
*
|
|
137
|
+
* Example:
|
|
138
|
+
*
|
|
139
|
+
* totalPages = 5
|
|
140
|
+
* currentPage = 3
|
|
141
|
+
*
|
|
142
|
+
* Result:
|
|
143
|
+
*
|
|
144
|
+
* 1 2 3 4 5
|
|
145
|
+
*
|
|
146
|
+
* For larger page counts:
|
|
147
|
+
*
|
|
148
|
+
* 1 2 3 4 ... 10
|
|
149
|
+
*/
|
|
150
|
+
const pages: Array<number | 'ellipsis'> = [];
|
|
151
|
+
|
|
152
|
+
if (totalPages <= 7) {
|
|
153
|
+
for (let page = 1; page <= totalPages; page++) {
|
|
154
|
+
pages.push(page);
|
|
155
|
+
}
|
|
156
|
+
} else if (currentPage <= 4) {
|
|
157
|
+
pages.push(1, 2, 3, 4, 'ellipsis', totalPages);
|
|
158
|
+
} else if (currentPage >= totalPages - 3) {
|
|
159
|
+
pages.push(
|
|
160
|
+
1,
|
|
161
|
+
'ellipsis',
|
|
162
|
+
totalPages - 3,
|
|
163
|
+
totalPages - 2,
|
|
164
|
+
totalPages - 1,
|
|
165
|
+
totalPages,
|
|
166
|
+
);
|
|
167
|
+
} else {
|
|
168
|
+
pages.push(
|
|
169
|
+
1,
|
|
170
|
+
'ellipsis',
|
|
171
|
+
currentPage - 1,
|
|
172
|
+
currentPage,
|
|
173
|
+
currentPage + 1,
|
|
174
|
+
'ellipsis',
|
|
175
|
+
totalPages,
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/*
|
|
180
|
+
* Page buttons
|
|
181
|
+
*/
|
|
182
|
+
pages.forEach((page) => {
|
|
183
|
+
if (page === 'ellipsis') {
|
|
184
|
+
paginatorItems.appendChild(
|
|
185
|
+
createPaginatorItem({
|
|
186
|
+
children: '...',
|
|
187
|
+
disabled: true,
|
|
188
|
+
ellipsis: true,
|
|
189
|
+
}),
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
paginatorItems.appendChild(
|
|
196
|
+
createPaginatorItem({
|
|
197
|
+
children: String(page),
|
|
198
|
+
selected: page === currentPage,
|
|
199
|
+
onPaginatorItemClick: (event: GidsPaginatorItemEvent<Event>) => {
|
|
200
|
+
handlePageChange({ page, event });
|
|
201
|
+
},
|
|
202
|
+
}),
|
|
203
|
+
);
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
if (showNextBtn) {
|
|
207
|
+
/*
|
|
208
|
+
* Next button
|
|
209
|
+
*/
|
|
210
|
+
paginatorItems.appendChild(
|
|
211
|
+
createPaginatorItem({
|
|
212
|
+
isIcon: true,
|
|
213
|
+
iconName: 'chevron-right',
|
|
214
|
+
disabled: currentPage >= totalPages,
|
|
215
|
+
onPaginatorItemClick: (event: GidsPaginatorItemEvent<Event>) => {
|
|
216
|
+
handlePageChange({ page: currentPage + 1, event });
|
|
217
|
+
},
|
|
218
|
+
}),
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (showLastPageBtn) {
|
|
223
|
+
/*
|
|
224
|
+
* Last page button
|
|
225
|
+
*/
|
|
226
|
+
paginatorItems.appendChild(
|
|
227
|
+
createPaginatorItem({
|
|
228
|
+
isIcon: true,
|
|
229
|
+
iconName: 'forward',
|
|
230
|
+
disabled: currentPage >= totalPages,
|
|
231
|
+
onPaginatorItemClick: (event: GidsPaginatorItemEvent<Event>) => {
|
|
232
|
+
handlePageChange({ page: totalPages, event });
|
|
233
|
+
},
|
|
234
|
+
}),
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
paginator.appendChild(paginatorItems);
|
|
239
|
+
|
|
240
|
+
return paginator;
|
|
241
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { GidsPaginatorItemCommonUtils } from '@ganpatiinfo/gids-core-shared';
|
|
2
|
+
import {
|
|
3
|
+
ClassValue,
|
|
4
|
+
GidsPaginatorItemWebProps,
|
|
5
|
+
GidsPaginatorItemWebUtils,
|
|
6
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
7
|
+
import { appendAsChildren, DomChildren } from '../../utils/domUtils.js';
|
|
8
|
+
import { GidsIconDom } from '../GidsIcon/GidsIcon.js';
|
|
9
|
+
import { IconName } from '@ganpatiinfo/gids-web-theme-interface';
|
|
10
|
+
|
|
11
|
+
const { getGidsPaginatorItemClassNames } = GidsPaginatorItemWebUtils;
|
|
12
|
+
const { getPaginatorItemIconSize } = GidsPaginatorItemCommonUtils;
|
|
13
|
+
|
|
14
|
+
export type GidsPaginatorItemBaseWebProps = GidsPaginatorItemWebProps<
|
|
15
|
+
DomChildren,
|
|
16
|
+
IconName,
|
|
17
|
+
Event
|
|
18
|
+
>;
|
|
19
|
+
|
|
20
|
+
export interface GidsPaginatorItemDomProps extends GidsPaginatorItemBaseWebProps {
|
|
21
|
+
extraClasses?: ClassValue;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const GidsPaginatorItemDom = ({
|
|
25
|
+
selectColor = 'default',
|
|
26
|
+
variant = 'default',
|
|
27
|
+
shape = 'circled',
|
|
28
|
+
size = 'sm',
|
|
29
|
+
children,
|
|
30
|
+
isIcon = false,
|
|
31
|
+
iconName,
|
|
32
|
+
disabled = false,
|
|
33
|
+
selected = false,
|
|
34
|
+
extraClasses,
|
|
35
|
+
onPaginatorItemClick,
|
|
36
|
+
}: GidsPaginatorItemDomProps): HTMLButtonElement => {
|
|
37
|
+
const paginatorItem = document.createElement('button');
|
|
38
|
+
paginatorItem.className = getGidsPaginatorItemClassNames(
|
|
39
|
+
{ selectColor, shape, size, variant, disabled, selected },
|
|
40
|
+
extraClasses,
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
if (!isIcon && children) {
|
|
44
|
+
appendAsChildren(paginatorItem, children);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (
|
|
48
|
+
isIcon &&
|
|
49
|
+
iconName &&
|
|
50
|
+
iconName.toString() !== '' &&
|
|
51
|
+
iconName.toString() !== '(none)'
|
|
52
|
+
) {
|
|
53
|
+
paginatorItem.appendChild(
|
|
54
|
+
GidsIconDom({
|
|
55
|
+
size: getPaginatorItemIconSize({ size }),
|
|
56
|
+
name: iconName,
|
|
57
|
+
appearance: 'regular',
|
|
58
|
+
alt: '',
|
|
59
|
+
}),
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (onPaginatorItemClick && !disabled) {
|
|
64
|
+
paginatorItem.addEventListener('click', (event: Event) => {
|
|
65
|
+
onPaginatorItemClick({
|
|
66
|
+
originalEvent: event,
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return paginatorItem;
|
|
72
|
+
};
|