@ganpatiinfo/gids-web-dom-reference 11.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 +108 -1
- 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 +27 -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 +27 -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 +23 -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 +27 -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 +12 -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 +78 -4
- package/src/components/GidsBasicTableHead/GidsBasicTableHead.ts +15 -0
- package/src/components/GidsBasicTableHeader/GidsBasicTableHeader.ts +69 -12
- package/src/components/GidsBasicTableRow/GidsBasicTableRow.ts +73 -6
- package/src/components/GidsBsTable/GidsBsTable.ts +101 -18
- 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 +22 -1
- 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 -8
- package/dist/components/GidsBasicTableCell/GidsBasicTableCell.d.ts.map +0 -1
- package/dist/components/GidsBasicTableCell/GidsBasicTableCell.js +0 -16
- package/dist/components/GidsBasicTableCell/GidsBasicTableCell.js.map +0 -1
- package/src/components/GidsBasicTableCell/GidsBasicTableCell.ts +0 -45
|
@@ -1,19 +1,61 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
GidsTableCellTypographyStyle,
|
|
3
3
|
GidsBasicTableHeaderWebProps,
|
|
4
4
|
GidsBasicTableHeaderWebUtils,
|
|
5
5
|
} from '@ganpatiinfo/gids-web-shared';
|
|
6
6
|
import { GidsBasicTableRowDom } from '../GidsBasicTableRow/GidsBasicTableRow';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
GidsBasicTableHeaderActionButtonEvent,
|
|
9
|
+
GidsBasicTableRowItem,
|
|
10
|
+
} from '@ganpatiinfo/gids-core-shared';
|
|
11
|
+
import {
|
|
12
|
+
IconAppearance,
|
|
13
|
+
IconName,
|
|
14
|
+
} from '@ganpatiinfo/gids-web-theme-interface';
|
|
8
15
|
|
|
9
16
|
const { getGidsBasicTableHeaderClassNames } = GidsBasicTableHeaderWebUtils;
|
|
10
17
|
|
|
11
|
-
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated
|
|
20
|
+
*
|
|
21
|
+
* Use `GidsTableHeader` and its props and functions instead.
|
|
22
|
+
*/
|
|
23
|
+
type GidsBasicTableHeaderBaseWebProps = GidsBasicTableHeaderWebProps<
|
|
24
|
+
GidsTableCellTypographyStyle,
|
|
25
|
+
IconName,
|
|
26
|
+
IconAppearance
|
|
27
|
+
>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated
|
|
31
|
+
*
|
|
32
|
+
* Use `GidsTableHeader` and its props and functions instead.
|
|
33
|
+
*/
|
|
34
|
+
export type GidsBasicTableHeaderActionButtonBaseEvent =
|
|
35
|
+
GidsBasicTableHeaderActionButtonEvent<
|
|
36
|
+
Event,
|
|
37
|
+
GidsTableCellTypographyStyle,
|
|
38
|
+
IconName,
|
|
39
|
+
IconAppearance
|
|
40
|
+
>;
|
|
12
41
|
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated
|
|
44
|
+
*
|
|
45
|
+
* Use `GidsTableHeader` and its props and functions instead.
|
|
46
|
+
*/
|
|
13
47
|
export interface GidsBasicTableHeaderDomProps extends GidsBasicTableHeaderBaseWebProps {
|
|
14
48
|
extraClasses?: string;
|
|
49
|
+
onClickHeaderActionBtn?: (
|
|
50
|
+
event: GidsBasicTableHeaderActionButtonBaseEvent,
|
|
51
|
+
) => void;
|
|
15
52
|
}
|
|
16
53
|
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated
|
|
56
|
+
*
|
|
57
|
+
* Use `GidsTableHeader` and its props and functions instead.
|
|
58
|
+
*/
|
|
17
59
|
export const GidsBasicTableHeaderDom = ({
|
|
18
60
|
width = 'full',
|
|
19
61
|
headerCells = [],
|
|
@@ -21,6 +63,9 @@ export const GidsBasicTableHeaderDom = ({
|
|
|
21
63
|
labelTypography = 'label-medium',
|
|
22
64
|
textAlignment = 'center',
|
|
23
65
|
layout = 'horizontal',
|
|
66
|
+
cellPrimaryActionButtons,
|
|
67
|
+
cellSecondaryActionButtons,
|
|
68
|
+
onClickHeaderActionBtn,
|
|
24
69
|
extraClasses,
|
|
25
70
|
}: GidsBasicTableHeaderDomProps) => {
|
|
26
71
|
const basicTableHeader = document.createElement('thead');
|
|
@@ -31,15 +76,24 @@ export const GidsBasicTableHeaderDom = ({
|
|
|
31
76
|
|
|
32
77
|
if (headerCells && headerCells.length > 0) {
|
|
33
78
|
// 1. Map cells to forward global table header styles/props into each row item
|
|
34
|
-
const mappedHeaderCells: GidsBasicTableRowItem<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
79
|
+
const mappedHeaderCells: GidsBasicTableRowItem<
|
|
80
|
+
GidsTableCellTypographyStyle,
|
|
81
|
+
IconName,
|
|
82
|
+
IconAppearance
|
|
83
|
+
>[] = headerCells.map(
|
|
84
|
+
(
|
|
85
|
+
cell,
|
|
86
|
+
): GidsBasicTableRowItem<
|
|
87
|
+
GidsTableCellTypographyStyle,
|
|
88
|
+
IconName,
|
|
89
|
+
IconAppearance
|
|
90
|
+
> => ({
|
|
91
|
+
appearance, // Falling back to header level appearance
|
|
92
|
+
labelTypography, // Falling back to header level typography
|
|
93
|
+
textAlignment, // Falling back to header level text alignment
|
|
94
|
+
...cell, // Individual cell settings override header properties if explicitly passed
|
|
95
|
+
}),
|
|
96
|
+
);
|
|
43
97
|
|
|
44
98
|
// 2. Feed the combined data payload into your Row builder safely
|
|
45
99
|
const rowContent = GidsBasicTableRowDom({
|
|
@@ -47,6 +101,9 @@ export const GidsBasicTableHeaderDom = ({
|
|
|
47
101
|
layout,
|
|
48
102
|
rows: mappedHeaderCells,
|
|
49
103
|
isHeaderRow: true,
|
|
104
|
+
cellPrimaryActionButtons,
|
|
105
|
+
cellSecondaryActionButtons,
|
|
106
|
+
onClickRowActionBtn: onClickHeaderActionBtn,
|
|
50
107
|
});
|
|
51
108
|
|
|
52
109
|
basicTableHeader.append(rowContent);
|
|
@@ -1,42 +1,105 @@
|
|
|
1
1
|
import {
|
|
2
|
+
GidsTableCellTypographyStyle,
|
|
2
3
|
type GidsBasicTableRowWebProps,
|
|
3
4
|
GidsBasicTableRowWebUtils,
|
|
4
5
|
} from '@ganpatiinfo/gids-web-shared';
|
|
5
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
GidsTableCellActionButtonBaseEvent,
|
|
8
|
+
GidsTableCellDom,
|
|
9
|
+
} from '../GidsTableCell/GidsTableCell.js';
|
|
10
|
+
import {
|
|
11
|
+
IconAppearance,
|
|
12
|
+
IconName,
|
|
13
|
+
} from '@ganpatiinfo/gids-web-theme-interface';
|
|
14
|
+
import { GidsBasicTableRowActionButtonEvent } from '@ganpatiinfo/gids-core-shared';
|
|
6
15
|
|
|
7
16
|
const { getGidsBasicTableRowClassNames } = GidsBasicTableRowWebUtils;
|
|
8
17
|
|
|
9
|
-
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated
|
|
20
|
+
* Use `GidsTableRow` and its props and functions instead.
|
|
21
|
+
*/
|
|
22
|
+
type GidsBasicTableRowBaseWebProps = GidsBasicTableRowWebProps<
|
|
23
|
+
GidsTableCellTypographyStyle,
|
|
24
|
+
IconName,
|
|
25
|
+
IconAppearance
|
|
26
|
+
>;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated
|
|
30
|
+
* Use `GidsTableRow` and its props and functions instead.
|
|
31
|
+
*/
|
|
32
|
+
export type GidsBasicTableRowActionButtonBaseEvent =
|
|
33
|
+
GidsBasicTableRowActionButtonEvent<
|
|
34
|
+
Event,
|
|
35
|
+
GidsTableCellTypographyStyle,
|
|
36
|
+
IconName,
|
|
37
|
+
IconAppearance
|
|
38
|
+
>;
|
|
10
39
|
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated
|
|
42
|
+
* Use `GidsTableRow` and its props and functions instead.
|
|
43
|
+
*/
|
|
11
44
|
export interface GidsBasicTableRowDomProps extends GidsBasicTableRowBaseWebProps {
|
|
12
45
|
extraClasses?: string;
|
|
46
|
+
onClickRowActionBtn?: (event: GidsBasicTableRowActionButtonBaseEvent) => void;
|
|
13
47
|
}
|
|
14
48
|
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated
|
|
51
|
+
* Use `GidsTableRow` and its props and functions instead.
|
|
52
|
+
*/
|
|
15
53
|
export const GidsBasicTableRowDom = ({
|
|
16
54
|
width = 'full',
|
|
17
55
|
layout = 'horizontal',
|
|
18
56
|
rows,
|
|
19
57
|
isHeaderRow = false,
|
|
58
|
+
cellPrimaryActionButtons,
|
|
59
|
+
cellSecondaryActionButtons,
|
|
60
|
+
onClickRowActionBtn,
|
|
20
61
|
extraClasses,
|
|
21
62
|
}: GidsBasicTableRowDomProps): HTMLElement | DocumentFragment => {
|
|
22
63
|
const rowClassName = getGidsBasicTableRowClassNames({ width }, extraClasses);
|
|
23
64
|
|
|
65
|
+
function onCellActionBtnClick({
|
|
66
|
+
event,
|
|
67
|
+
cellIndex,
|
|
68
|
+
}: {
|
|
69
|
+
event: GidsTableCellActionButtonBaseEvent;
|
|
70
|
+
cellIndex: number;
|
|
71
|
+
}) {
|
|
72
|
+
if (onClickRowActionBtn) {
|
|
73
|
+
onClickRowActionBtn({
|
|
74
|
+
...event,
|
|
75
|
+
details: {
|
|
76
|
+
...event.details,
|
|
77
|
+
cellIndex,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
24
83
|
// 2. Handling Vertical Layout
|
|
25
84
|
if (layout === 'vertical' && rows && rows.length > 0) {
|
|
26
85
|
const fragment = document.createDocumentFragment();
|
|
27
86
|
|
|
28
|
-
rows.forEach((tableRow) => {
|
|
87
|
+
rows.forEach((tableRow, indexI) => {
|
|
29
88
|
// Create a clean, independent <tr> wrapper for each vertical entry
|
|
30
89
|
const singleRowEl = document.createElement('tr');
|
|
31
90
|
singleRowEl.className = rowClassName;
|
|
32
91
|
|
|
33
92
|
const rowLabel = tableRow?.label;
|
|
34
93
|
singleRowEl.append(
|
|
35
|
-
|
|
94
|
+
GidsTableCellDom({
|
|
36
95
|
...tableRow,
|
|
37
96
|
width: width,
|
|
38
97
|
label: rowLabel,
|
|
39
98
|
isHeaderCell: isHeaderRow,
|
|
99
|
+
cellPrimaryActionButtons,
|
|
100
|
+
cellSecondaryActionButtons,
|
|
101
|
+
onClickCellActionBtn: (event: GidsTableCellActionButtonBaseEvent) =>
|
|
102
|
+
onCellActionBtnClick({ event, cellIndex: indexI }),
|
|
40
103
|
}),
|
|
41
104
|
);
|
|
42
105
|
|
|
@@ -52,15 +115,19 @@ export const GidsBasicTableRowDom = ({
|
|
|
52
115
|
basicTableRow.className = rowClassName;
|
|
53
116
|
|
|
54
117
|
if (rows && rows.length > 0) {
|
|
55
|
-
rows.forEach((tableRow) => {
|
|
118
|
+
rows.forEach((tableRow, indexJ) => {
|
|
56
119
|
const rowLabel = tableRow?.label;
|
|
57
120
|
|
|
58
121
|
basicTableRow.append(
|
|
59
|
-
|
|
122
|
+
GidsTableCellDom({
|
|
60
123
|
...tableRow,
|
|
61
124
|
width: width,
|
|
62
125
|
label: rowLabel,
|
|
63
126
|
isHeaderCell: isHeaderRow,
|
|
127
|
+
cellPrimaryActionButtons,
|
|
128
|
+
cellSecondaryActionButtons,
|
|
129
|
+
onClickCellActionBtn: (event: GidsTableCellActionButtonBaseEvent) =>
|
|
130
|
+
onCellActionBtnClick({ event, cellIndex: indexJ }),
|
|
64
131
|
}),
|
|
65
132
|
);
|
|
66
133
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
GidsTableCellTypographyStyle,
|
|
2
3
|
GidsBsTableWebProps,
|
|
3
4
|
GidsBsTableWebUtils,
|
|
4
5
|
} from '@ganpatiinfo/gids-web-shared';
|
|
@@ -8,8 +9,19 @@ import {
|
|
|
8
9
|
GidsBasicTableHeadDom,
|
|
9
10
|
GidsBasicTableHeadDomProps,
|
|
10
11
|
} from '../GidsBasicTableHead/GidsBasicTableHead';
|
|
11
|
-
import {
|
|
12
|
-
|
|
12
|
+
import {
|
|
13
|
+
GidsBasicTableHeaderActionButtonBaseEvent,
|
|
14
|
+
GidsBasicTableHeaderDom,
|
|
15
|
+
} from '../GidsBasicTableHeader/GidsBasicTableHeader';
|
|
16
|
+
import {
|
|
17
|
+
GidsBasicTableBodyActionButtonBaseEvent,
|
|
18
|
+
GidsBasicTableBodyDom,
|
|
19
|
+
} from '../GidsBasicTableBody/GidsBasicTableBody';
|
|
20
|
+
import {
|
|
21
|
+
IconAppearance,
|
|
22
|
+
IconName,
|
|
23
|
+
} from '@ganpatiinfo/gids-web-theme-interface';
|
|
24
|
+
import { GidsBsTableActionButtonEvent } from '@ganpatiinfo/gids-core-shared';
|
|
13
25
|
|
|
14
26
|
const {
|
|
15
27
|
getGidsBsTableClassNames,
|
|
@@ -18,7 +30,15 @@ const {
|
|
|
18
30
|
getBsTableBodyBorder,
|
|
19
31
|
} = GidsBsTableWebUtils;
|
|
20
32
|
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated
|
|
35
|
+
*
|
|
36
|
+
* Use `GidsTable` and its props and functions instead.
|
|
37
|
+
*/
|
|
21
38
|
type GidsBsTableBaseWebProps = GidsBsTableWebProps<
|
|
39
|
+
GidsTableCellTypographyStyle,
|
|
40
|
+
IconName,
|
|
41
|
+
IconAppearance,
|
|
22
42
|
DomChildren,
|
|
23
43
|
Event,
|
|
24
44
|
Element,
|
|
@@ -29,10 +49,33 @@ type GidsBsTableBaseWebProps = GidsBsTableWebProps<
|
|
|
29
49
|
'onChange' | 'onInput' | 'onFocus' | 'onBlur' | 'onGidsSearchBarClear'
|
|
30
50
|
>;
|
|
31
51
|
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated
|
|
54
|
+
*
|
|
55
|
+
* Use `GidsTable` and its props and functions instead.
|
|
56
|
+
*/
|
|
57
|
+
type GidsBsTableActionButtonBaseEvent = GidsBsTableActionButtonEvent<
|
|
58
|
+
Event,
|
|
59
|
+
GidsTableCellTypographyStyle,
|
|
60
|
+
IconName,
|
|
61
|
+
IconAppearance
|
|
62
|
+
>;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated
|
|
66
|
+
*
|
|
67
|
+
* Use `GidsTable` and its props and functions instead.
|
|
68
|
+
*/
|
|
32
69
|
export interface GidsBsTableDomProps extends GidsBsTableBaseWebProps {
|
|
33
70
|
extraClasses?: string;
|
|
71
|
+
onClickBsTableActionBtn?: (event: GidsBsTableActionButtonBaseEvent) => void;
|
|
34
72
|
}
|
|
35
73
|
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated
|
|
76
|
+
*
|
|
77
|
+
* Use `GidsTable` and its props and functions instead.
|
|
78
|
+
*/
|
|
36
79
|
export const GidsBsTableDom = ({
|
|
37
80
|
// Table properties
|
|
38
81
|
topHeaderCells = [],
|
|
@@ -49,6 +92,11 @@ export const GidsBsTableDom = ({
|
|
|
49
92
|
tableBorders = 'none',
|
|
50
93
|
tableBorderRadius = [],
|
|
51
94
|
tableBodyMaxHeight = 200,
|
|
95
|
+
tableBodyPrimaryActionButtons = [],
|
|
96
|
+
tableBodySecondaryActionButtons = [],
|
|
97
|
+
topHeaderPrimaryActionButtons = [],
|
|
98
|
+
topHeaderSecondaryActionButtons = [],
|
|
99
|
+
onClickBsTableActionBtn,
|
|
52
100
|
extraClasses,
|
|
53
101
|
|
|
54
102
|
// Table Head properties
|
|
@@ -96,15 +144,16 @@ export const GidsBsTableDom = ({
|
|
|
96
144
|
headAppearance = 'surface-default',
|
|
97
145
|
...restProps
|
|
98
146
|
}: GidsBsTableDomProps): HTMLDivElement => {
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
147
|
+
const bsTableDiv = document.createElement('div');
|
|
148
|
+
bsTableDiv.className = getGidsBsTableClassNames<
|
|
149
|
+
GidsTableCellTypographyStyle,
|
|
150
|
+
IconName,
|
|
151
|
+
IconAppearance
|
|
152
|
+
>({ width, tableBorders, tableBorderRadius }, extraClasses);
|
|
104
153
|
|
|
105
154
|
// Table Head properties
|
|
106
155
|
if (isHeadVisible) {
|
|
107
|
-
|
|
156
|
+
bsTableDiv.append(
|
|
108
157
|
GidsBasicTableHeadDom({
|
|
109
158
|
actionGroup,
|
|
110
159
|
allFiltersTabVisible,
|
|
@@ -166,41 +215,75 @@ export const GidsBsTableDom = ({
|
|
|
166
215
|
}
|
|
167
216
|
|
|
168
217
|
// Table properties
|
|
169
|
-
const
|
|
170
|
-
|
|
218
|
+
const bsTable = document.createElement('table');
|
|
219
|
+
bsTable.className = getBsTableClasses<
|
|
220
|
+
GidsTableCellTypographyStyle,
|
|
221
|
+
IconName,
|
|
222
|
+
IconAppearance
|
|
223
|
+
>({ width, isHeadVisible });
|
|
224
|
+
|
|
225
|
+
function onActionBtnClick(
|
|
226
|
+
event:
|
|
227
|
+
| GidsBasicTableHeaderActionButtonBaseEvent
|
|
228
|
+
| GidsBasicTableBodyActionButtonBaseEvent,
|
|
229
|
+
) {
|
|
230
|
+
if (onClickBsTableActionBtn) {
|
|
231
|
+
onClickBsTableActionBtn({
|
|
232
|
+
...event,
|
|
233
|
+
details: {
|
|
234
|
+
...event.details,
|
|
235
|
+
columnIndex: event?.details?.cellIndex,
|
|
236
|
+
},
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
171
240
|
|
|
172
241
|
if (isTopHeaderVisible && topHeaderCells && topHeaderCells.length > 0) {
|
|
173
242
|
// Append Table Header
|
|
174
|
-
|
|
243
|
+
bsTable.append(
|
|
175
244
|
GidsBasicTableHeaderDom({
|
|
176
245
|
appearance: topHeaderAppearance,
|
|
177
246
|
labelTypography: topHeaderLabelTypography,
|
|
178
247
|
textAlignment: topHeaderTextAlignment,
|
|
179
|
-
headerCells: getCustomisedTopHeaderCells
|
|
248
|
+
headerCells: getCustomisedTopHeaderCells<
|
|
249
|
+
GidsTableCellTypographyStyle,
|
|
250
|
+
IconName,
|
|
251
|
+
IconAppearance
|
|
252
|
+
>({
|
|
180
253
|
topHeaderCells,
|
|
181
254
|
tableBorders,
|
|
182
255
|
}),
|
|
183
256
|
width: isHeadVisible ? 'full' : width,
|
|
257
|
+
cellPrimaryActionButtons: topHeaderPrimaryActionButtons,
|
|
258
|
+
cellSecondaryActionButtons: topHeaderSecondaryActionButtons,
|
|
259
|
+
onClickHeaderActionBtn: onActionBtnClick,
|
|
184
260
|
}),
|
|
185
261
|
);
|
|
186
262
|
}
|
|
187
263
|
|
|
188
264
|
if (tableBody && tableBody.length > 0) {
|
|
189
|
-
|
|
265
|
+
bsTable.append(
|
|
190
266
|
GidsBasicTableBodyDom({
|
|
191
267
|
width: isHeadVisible ? 'full' : width,
|
|
192
|
-
tableBorders: getBsTableBodyBorder
|
|
268
|
+
tableBorders: getBsTableBodyBorder<
|
|
269
|
+
GidsTableCellTypographyStyle,
|
|
270
|
+
IconName,
|
|
271
|
+
IconAppearance
|
|
272
|
+
>({ tableBorders }),
|
|
193
273
|
tableBodyData: tableBody,
|
|
194
274
|
rowAppearance,
|
|
195
275
|
rowLabelTypography,
|
|
196
276
|
rowTextAlignment,
|
|
277
|
+
tableBodyCellPrimaryActionButtons: tableBodyPrimaryActionButtons,
|
|
278
|
+
tableBodyCellSecondaryActionButtons: tableBodySecondaryActionButtons,
|
|
279
|
+
onClickBodyCellActionBtn: onActionBtnClick,
|
|
197
280
|
}),
|
|
198
281
|
);
|
|
199
282
|
}
|
|
200
283
|
|
|
201
|
-
// Structural Append hierarchy:
|
|
202
|
-
tableScrollContainer.appendChild(
|
|
203
|
-
|
|
284
|
+
// Structural Append hierarchy: bsTable -> scroll wrapper -> root container
|
|
285
|
+
tableScrollContainer.appendChild(bsTable);
|
|
286
|
+
bsTableDiv.appendChild(tableScrollContainer);
|
|
204
287
|
|
|
205
|
-
return
|
|
288
|
+
return bsTableDiv;
|
|
206
289
|
};
|
|
@@ -17,6 +17,7 @@ export interface GidsChartLegendItemDomProps extends GidsChartLegendItemWebProps
|
|
|
17
17
|
export const GidsChartLegendItemDom = ({
|
|
18
18
|
children,
|
|
19
19
|
seriesType = '1',
|
|
20
|
+
seriesColor,
|
|
20
21
|
orientation = 'horizontal',
|
|
21
22
|
extraClasses,
|
|
22
23
|
}: GidsChartLegendItemDomProps): HTMLElement => {
|
|
@@ -29,6 +30,7 @@ export const GidsChartLegendItemDom = ({
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
chartLegendItem.seriesType = seriesType;
|
|
33
|
+
chartLegendItem.seriesColor = seriesColor;
|
|
32
34
|
chartLegendItem.orientation = orientation;
|
|
33
35
|
|
|
34
36
|
chartLegendItem.className = getGidsChartLegendItemClassNames(
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GidsColorSwatchTypographyStyle,
|
|
3
|
+
type GidsColorSwatchWebProps,
|
|
4
|
+
GidsColorSwatchWebUtils,
|
|
5
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
getGidsColorSwatchClassNames,
|
|
9
|
+
getGidsColorSwatchPanelClasses,
|
|
10
|
+
getGidsColorSwatchLabelClasses,
|
|
11
|
+
} = GidsColorSwatchWebUtils;
|
|
12
|
+
|
|
13
|
+
type GidsColorSwatchBaseWebProps =
|
|
14
|
+
GidsColorSwatchWebProps<GidsColorSwatchTypographyStyle>;
|
|
15
|
+
|
|
16
|
+
export interface GidsColorSwatchDomProps extends GidsColorSwatchBaseWebProps {
|
|
17
|
+
extraClasses?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const GidsColorSwatchDom = ({
|
|
21
|
+
label,
|
|
22
|
+
labelColor = 'default',
|
|
23
|
+
labelTypography = 'label-x-small',
|
|
24
|
+
labelPosition = 'left',
|
|
25
|
+
swatchColor,
|
|
26
|
+
swatchSize = 'xs',
|
|
27
|
+
swatchShape = 'rectangle',
|
|
28
|
+
swatchShadow = 'none',
|
|
29
|
+
borderRadius = 'none',
|
|
30
|
+
applyBorders = false,
|
|
31
|
+
borderColor = 'input',
|
|
32
|
+
borderWidth = 'default',
|
|
33
|
+
extraClasses,
|
|
34
|
+
}: GidsColorSwatchDomProps): HTMLDivElement => {
|
|
35
|
+
const colorSwatch = document.createElement('div');
|
|
36
|
+
colorSwatch.className = getGidsColorSwatchClassNames(
|
|
37
|
+
{ labelPosition },
|
|
38
|
+
extraClasses,
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
colorSwatch.setAttribute('swatch-shape', swatchShape);
|
|
42
|
+
if (swatchColor) {
|
|
43
|
+
colorSwatch.setAttribute('swatch-color', swatchColor);
|
|
44
|
+
}
|
|
45
|
+
colorSwatch.setAttribute('swatch-shadow', swatchShadow);
|
|
46
|
+
colorSwatch.setAttribute('swatch-size', swatchSize);
|
|
47
|
+
colorSwatch.setAttribute('border-radius', borderRadius);
|
|
48
|
+
colorSwatch.setAttribute('border-color', borderColor);
|
|
49
|
+
colorSwatch.setAttribute('label-color', labelColor);
|
|
50
|
+
|
|
51
|
+
if (applyBorders) {
|
|
52
|
+
colorSwatch.setAttribute('apply-borders', 'true');
|
|
53
|
+
} else {
|
|
54
|
+
colorSwatch.removeAttribute('apply-borders');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const spanLabel = document.createElement('span');
|
|
58
|
+
spanLabel.className = getGidsColorSwatchLabelClasses({
|
|
59
|
+
labelTypography,
|
|
60
|
+
});
|
|
61
|
+
spanLabel.style.color =
|
|
62
|
+
labelColor === 'swatch-color'
|
|
63
|
+
? `${swatchColor}`
|
|
64
|
+
: `var(--gids-color-text-default)`;
|
|
65
|
+
|
|
66
|
+
if (
|
|
67
|
+
label &&
|
|
68
|
+
label !== '' &&
|
|
69
|
+
(labelPosition === 'top' || labelPosition === 'left')
|
|
70
|
+
) {
|
|
71
|
+
spanLabel.textContent = label;
|
|
72
|
+
colorSwatch.appendChild(spanLabel);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (swatchColor && swatchColor !== '') {
|
|
76
|
+
const colorSwatchPanel = document.createElement('div');
|
|
77
|
+
colorSwatchPanel.className = getGidsColorSwatchPanelClasses({
|
|
78
|
+
swatchShape,
|
|
79
|
+
swatchSize,
|
|
80
|
+
applyPanelClass: true,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
colorSwatchPanel.style.backgroundColor = `${swatchColor}`;
|
|
84
|
+
if (applyBorders) {
|
|
85
|
+
colorSwatchPanel.style.border = `var(--gids-border-width-${borderWidth}) solid var(--gids-color-border-${borderColor})`;
|
|
86
|
+
}
|
|
87
|
+
if (swatchShadow !== 'none') {
|
|
88
|
+
colorSwatchPanel.style.boxShadow = `var(--gids-elevation-${swatchShadow})`;
|
|
89
|
+
}
|
|
90
|
+
if (swatchShape === 'rectangle' || swatchShape === 'square') {
|
|
91
|
+
colorSwatchPanel.style.borderRadius = `var(--gids-border-radius-${borderRadius})`;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
colorSwatch.appendChild(colorSwatchPanel);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (
|
|
98
|
+
label &&
|
|
99
|
+
label !== '' &&
|
|
100
|
+
(labelPosition === 'bottom' || labelPosition === 'right')
|
|
101
|
+
) {
|
|
102
|
+
spanLabel.textContent = label;
|
|
103
|
+
colorSwatch.appendChild(spanLabel);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return colorSwatch;
|
|
107
|
+
};
|