@ganpatiinfo/gids-web-dom-reference 12.0.0 → 14.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 +131 -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/GidsCrossTable/GidsCrossTable.d.ts +18 -0
- package/dist/components/GidsCrossTable/GidsCrossTable.d.ts.map +1 -0
- package/dist/components/GidsCrossTable/GidsCrossTable.js +141 -0
- package/dist/components/GidsCrossTable/GidsCrossTable.js.map +1 -0
- package/dist/components/GidsCrossTableBody/GidsCrossTableBody.d.ts +13 -0
- package/dist/components/GidsCrossTableBody/GidsCrossTableBody.d.ts.map +1 -0
- package/dist/components/GidsCrossTableBody/GidsCrossTableBody.js +79 -0
- package/dist/components/GidsCrossTableBody/GidsCrossTableBody.js.map +1 -0
- package/dist/components/GidsCrossTableRow/GidsCrossTableRow.d.ts +13 -0
- package/dist/components/GidsCrossTableRow/GidsCrossTableRow.d.ts.map +1 -0
- package/dist/components/GidsCrossTableRow/GidsCrossTableRow.js +128 -0
- package/dist/components/GidsCrossTableRow/GidsCrossTableRow.js.map +1 -0
- package/dist/components/GidsDialog/GidsDialog.d.ts +13 -0
- package/dist/components/GidsDialog/GidsDialog.d.ts.map +1 -0
- package/dist/components/GidsDialog/GidsDialog.js +102 -0
- package/dist/components/GidsDialog/GidsDialog.js.map +1 -0
- package/dist/components/GidsMatrixTable/GidsMatrixTable.d.ts +32 -0
- package/dist/components/GidsMatrixTable/GidsMatrixTable.d.ts.map +1 -0
- package/dist/components/GidsMatrixTable/GidsMatrixTable.js +75 -0
- package/dist/components/GidsMatrixTable/GidsMatrixTable.js.map +1 -0
- package/dist/components/GidsMatrixTableBody/GidsMatrixTableBody.d.ts +32 -0
- package/dist/components/GidsMatrixTableBody/GidsMatrixTableBody.d.ts.map +1 -0
- package/dist/components/GidsMatrixTableBody/GidsMatrixTableBody.js +75 -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/GidsMenu/GidsMenu.d.ts +1 -1
- package/dist/components/GidsMenu/GidsMenu.d.ts.map +1 -1
- package/dist/components/GidsMenu/GidsMenu.js +10 -1
- package/dist/components/GidsMenu/GidsMenu.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/GidsSkeleton/GidsSkeleton.d.ts +8 -0
- package/dist/components/GidsSkeleton/GidsSkeleton.d.ts.map +1 -0
- package/dist/components/GidsSkeleton/GidsSkeleton.js +16 -0
- package/dist/components/GidsSkeleton/GidsSkeleton.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 +121 -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 +53 -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 +99 -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 +49 -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/GidsTransferList/GidsTransferList.d.ts +8 -0
- package/dist/components/GidsTransferList/GidsTransferList.d.ts.map +1 -0
- package/dist/components/GidsTransferList/GidsTransferList.js +25 -0
- package/dist/components/GidsTransferList/GidsTransferList.js.map +1 -0
- package/dist/components/_GidsDialogControl/GidsDialogControl.d.ts +10 -0
- package/dist/components/_GidsDialogControl/GidsDialogControl.d.ts.map +1 -0
- package/dist/components/_GidsDialogControl/GidsDialogControl.js +133 -0
- package/dist/components/_GidsDialogControl/GidsDialogControl.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 +118 -97
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +118 -97
- 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/GidsCrossTable/GidsCrossTable.ts +259 -0
- package/src/components/GidsCrossTableBody/GidsCrossTableBody.ts +171 -0
- package/src/components/GidsCrossTableRow/GidsCrossTableRow.ts +230 -0
- package/src/components/GidsDialog/GidsDialog.ts +161 -0
- package/src/components/GidsMatrixTable/GidsMatrixTable.ts +187 -0
- package/src/components/GidsMatrixTableBody/GidsMatrixTableBody.ts +185 -0
- package/src/components/GidsMdTable/GidsMdTable.ts +14 -2
- package/src/components/GidsMenu/GidsMenu.ts +15 -0
- 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/GidsSkeleton/GidsSkeleton.ts +40 -0
- package/src/components/GidsTable/GidsTable.ts +240 -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 +119 -0
- package/src/components/GidsTableFooterControl/GidsTableFooterControl.ts +166 -0
- package/src/components/GidsTableHeader/GidsTableHeader.ts +112 -0
- package/src/components/GidsTableRow/GidsTableRow.ts +152 -0
- package/src/components/GidsTableToolbar/GidsTableToolbar.ts +180 -0
- package/src/components/GidsTransferList/GidsTransferList.ts +58 -0
- package/src/components/_GidsDialogControl/GidsDialogControl.ts +198 -0
- package/src/components/_GidsPaginationItem/GidsPaginationItem.ts +14 -2
- package/src/index.ts +118 -97
- 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,185 @@
|
|
|
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
|
+
/**
|
|
24
|
+
* @deprecated
|
|
25
|
+
*
|
|
26
|
+
* Use `GidsCrossTableBody` and its props and functions instead.
|
|
27
|
+
*/
|
|
28
|
+
type GidsMatrixTableBodyBaseWebProps = GidsMatrixTableBodyWebProps<
|
|
29
|
+
GidsTableCellTypographyStyle,
|
|
30
|
+
IconName,
|
|
31
|
+
IconAppearance
|
|
32
|
+
>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated
|
|
36
|
+
*
|
|
37
|
+
* Use `GidsCrossTableBody` and its props and functions instead.
|
|
38
|
+
*/
|
|
39
|
+
export type GidsMatrixTableBodyActionButtonBaseEvent =
|
|
40
|
+
GidsMatrixTableBodyActionButtonEvent<
|
|
41
|
+
Event,
|
|
42
|
+
GidsTableCellTypographyStyle,
|
|
43
|
+
IconName,
|
|
44
|
+
IconAppearance
|
|
45
|
+
>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated
|
|
49
|
+
*
|
|
50
|
+
* Use `GidsCrossTableBody` and its props and functions instead.
|
|
51
|
+
*/
|
|
52
|
+
export interface GidsMatrixTableBodyDomProps extends GidsMatrixTableBodyBaseWebProps {
|
|
53
|
+
extraClasses?: string;
|
|
54
|
+
onClickMatrixBodyCellActionBtn?: (
|
|
55
|
+
event: GidsMatrixTableBodyActionButtonBaseEvent,
|
|
56
|
+
) => void;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated
|
|
61
|
+
*
|
|
62
|
+
* Use `GidsCrossTableBody` and its props and functions instead.
|
|
63
|
+
*/
|
|
64
|
+
export const GidsMatrixTableBodyDom = ({
|
|
65
|
+
width = 'full',
|
|
66
|
+
tableBodyItems = [],
|
|
67
|
+
tableBorders = 'none',
|
|
68
|
+
rowAppearance = 'none',
|
|
69
|
+
rowLabelTypography = 'label-medium',
|
|
70
|
+
rowTextAlignment = 'center',
|
|
71
|
+
matrixHeaderAppearance = 'none',
|
|
72
|
+
matrixHeaderLabelTypography = 'label-medium',
|
|
73
|
+
matrixHeaderTextAlignment = 'center',
|
|
74
|
+
rowCellPrimaryActionButtons = [],
|
|
75
|
+
rowCellSecondaryActionButtons = [],
|
|
76
|
+
matrixHeaderCellPrimaryActionButtons = [],
|
|
77
|
+
matrixHeaderCellSecondaryActionButtons = [],
|
|
78
|
+
onClickMatrixBodyCellActionBtn,
|
|
79
|
+
extraClasses,
|
|
80
|
+
}: GidsMatrixTableBodyDomProps): HTMLElement => {
|
|
81
|
+
const matrixTableBody = document.createElement('tbody');
|
|
82
|
+
matrixTableBody.className = getGidsMatrixTableBodyClassNames(
|
|
83
|
+
{ width },
|
|
84
|
+
extraClasses,
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
if (tableBodyItems && tableBodyItems.length > 0) {
|
|
88
|
+
const constructedTableBodyItems = getConstructedMatrixTableBodyItems<
|
|
89
|
+
GidsTableCellTypographyStyle,
|
|
90
|
+
IconName,
|
|
91
|
+
IconAppearance
|
|
92
|
+
>({
|
|
93
|
+
rowAppearance,
|
|
94
|
+
rowLabelTypography,
|
|
95
|
+
rowTextAlignment,
|
|
96
|
+
matrixHeaderAppearance,
|
|
97
|
+
matrixHeaderLabelTypography,
|
|
98
|
+
matrixHeaderTextAlignment,
|
|
99
|
+
tableBodyItems,
|
|
100
|
+
tableBorders,
|
|
101
|
+
matrixHeaderCellPrimaryActionButtons,
|
|
102
|
+
matrixHeaderCellSecondaryActionButtons,
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
function onMatrixBodyCellActionBtnClick({
|
|
106
|
+
event,
|
|
107
|
+
rowIndex,
|
|
108
|
+
columnIndex,
|
|
109
|
+
item,
|
|
110
|
+
}: {
|
|
111
|
+
event: GidsTableCellActionButtonBaseEvent;
|
|
112
|
+
rowIndex: number;
|
|
113
|
+
columnIndex?: number;
|
|
114
|
+
item?:
|
|
115
|
+
| GidsMatrixTableBodyConstructedRowItem<
|
|
116
|
+
GidsTableCellTypographyStyle,
|
|
117
|
+
IconName,
|
|
118
|
+
IconAppearance
|
|
119
|
+
>
|
|
120
|
+
| GidsMatrixTableBodyContructedMatrixHeaderItem<
|
|
121
|
+
GidsTableCellTypographyStyle,
|
|
122
|
+
IconName,
|
|
123
|
+
IconAppearance
|
|
124
|
+
>;
|
|
125
|
+
}) {
|
|
126
|
+
if (onClickMatrixBodyCellActionBtn) {
|
|
127
|
+
onClickMatrixBodyCellActionBtn({
|
|
128
|
+
...event,
|
|
129
|
+
details: {
|
|
130
|
+
...event.details,
|
|
131
|
+
rowIndex,
|
|
132
|
+
columnIndex,
|
|
133
|
+
isHeaderCell: item?.isHeader,
|
|
134
|
+
headerType: item?.headerType ?? 'none',
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
constructedTableBodyItems.forEach((constructedTableBodyItem, indexI) => {
|
|
141
|
+
const { headerItem, rowItems = [] } = constructedTableBodyItem;
|
|
142
|
+
const tableRowEl = document.createElement('tr');
|
|
143
|
+
|
|
144
|
+
tableRowEl.append(
|
|
145
|
+
GidsTableCellDom({
|
|
146
|
+
...headerItem,
|
|
147
|
+
width,
|
|
148
|
+
isHeaderCell: headerItem?.isHeader ?? true,
|
|
149
|
+
cellPrimaryActionButtons: matrixHeaderCellPrimaryActionButtons,
|
|
150
|
+
cellSecondaryActionButtons: matrixHeaderCellSecondaryActionButtons,
|
|
151
|
+
onClickCellActionBtn: (event: GidsTableCellActionButtonBaseEvent) =>
|
|
152
|
+
onMatrixBodyCellActionBtnClick({
|
|
153
|
+
event,
|
|
154
|
+
rowIndex: indexI,
|
|
155
|
+
columnIndex: undefined,
|
|
156
|
+
item: headerItem,
|
|
157
|
+
}),
|
|
158
|
+
}),
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
rowItems.forEach((rowItem, indexJ) => {
|
|
162
|
+
tableRowEl.append(
|
|
163
|
+
GidsTableCellDom({
|
|
164
|
+
...rowItem,
|
|
165
|
+
width,
|
|
166
|
+
isHeaderCell: rowItem?.isHeader ?? false,
|
|
167
|
+
cellPrimaryActionButtons: rowCellPrimaryActionButtons,
|
|
168
|
+
cellSecondaryActionButtons: rowCellSecondaryActionButtons,
|
|
169
|
+
onClickCellActionBtn: (event: GidsTableCellActionButtonBaseEvent) =>
|
|
170
|
+
onMatrixBodyCellActionBtnClick({
|
|
171
|
+
event,
|
|
172
|
+
rowIndex: indexI,
|
|
173
|
+
columnIndex: indexJ,
|
|
174
|
+
item: rowItem,
|
|
175
|
+
}),
|
|
176
|
+
}),
|
|
177
|
+
);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
matrixTableBody.appendChild(tableRowEl);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return matrixTableBody;
|
|
185
|
+
};
|
|
@@ -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 = [],
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
DomNodeOrString,
|
|
9
9
|
} from '../../utils/domUtils.js';
|
|
10
10
|
import { GidsHeadingDom } from '../GidsHeading/GidsHeading.js';
|
|
11
|
+
import { GidsDividerDom } from '../GidsDivider/GidsDivider.js';
|
|
11
12
|
|
|
12
13
|
const { getGidsMenuClassNames } = GidsMenuWebUtils;
|
|
13
14
|
|
|
@@ -24,6 +25,7 @@ export const GidsMenuDom = ({
|
|
|
24
25
|
heading,
|
|
25
26
|
supportingText,
|
|
26
27
|
supportingTextTypography,
|
|
28
|
+
isHeaderDividerVisible = false,
|
|
27
29
|
...restProps
|
|
28
30
|
}: GidsMenuDomProps): HTMLDivElement => {
|
|
29
31
|
const menu = document.createElement('div');
|
|
@@ -45,6 +47,19 @@ export const GidsMenuDom = ({
|
|
|
45
47
|
);
|
|
46
48
|
}
|
|
47
49
|
|
|
50
|
+
if (isHeaderDividerVisible) {
|
|
51
|
+
const dividerContainer = document.createElement('div');
|
|
52
|
+
dividerContainer.className = 'gids-menu__header-divider';
|
|
53
|
+
|
|
54
|
+
dividerContainer.append(
|
|
55
|
+
GidsDividerDom({
|
|
56
|
+
orientation: 'horizontal',
|
|
57
|
+
}),
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
menu.append(dividerContainer);
|
|
61
|
+
}
|
|
62
|
+
|
|
48
63
|
if (children !== undefined && children !== null) {
|
|
49
64
|
const childrenContainer = document.createElement('div');
|
|
50
65
|
childrenContainer.className = 'gids-menu__children';
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type GidsSkeletonWebProps,
|
|
3
|
+
GidsSkeletonWebUtils,
|
|
4
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
5
|
+
|
|
6
|
+
const { getGidsSkeletonClassNames } = GidsSkeletonWebUtils;
|
|
7
|
+
|
|
8
|
+
type GidsSkeletonBaseWebProps = GidsSkeletonWebProps;
|
|
9
|
+
|
|
10
|
+
type GidsSkeletonElement = HTMLElement & GidsSkeletonBaseWebProps;
|
|
11
|
+
|
|
12
|
+
export interface GidsSkeletonDomProps extends GidsSkeletonBaseWebProps {
|
|
13
|
+
extraClasses?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const GidsSkeletonDom = ({
|
|
17
|
+
variant = 'text',
|
|
18
|
+
animation = 'none',
|
|
19
|
+
width,
|
|
20
|
+
height,
|
|
21
|
+
extraClasses,
|
|
22
|
+
}: GidsSkeletonDomProps): HTMLElement => {
|
|
23
|
+
const skeleton = document.createElement(
|
|
24
|
+
'gids-skeleton',
|
|
25
|
+
) as GidsSkeletonElement;
|
|
26
|
+
|
|
27
|
+
skeleton.variant = variant;
|
|
28
|
+
skeleton.animation = animation;
|
|
29
|
+
|
|
30
|
+
if (width) {
|
|
31
|
+
skeleton.width = width;
|
|
32
|
+
}
|
|
33
|
+
if (height) {
|
|
34
|
+
skeleton.height = height;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
skeleton.className = getGidsSkeletonClassNames(extraClasses);
|
|
38
|
+
|
|
39
|
+
return skeleton;
|
|
40
|
+
};
|