@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.
Files changed (172) hide show
  1. package/CHANGELOG.md +131 -2
  2. package/dist/components/GidsAdvancedTooltip/GidsAdvancedTooltip.d.ts +8 -0
  3. package/dist/components/GidsAdvancedTooltip/GidsAdvancedTooltip.d.ts.map +1 -0
  4. package/dist/components/GidsAdvancedTooltip/GidsAdvancedTooltip.js +14 -0
  5. package/dist/components/GidsAdvancedTooltip/GidsAdvancedTooltip.js.map +1 -0
  6. package/dist/components/GidsBasicTableBody/GidsBasicTableBody.d.ts +26 -3
  7. package/dist/components/GidsBasicTableBody/GidsBasicTableBody.d.ts.map +1 -1
  8. package/dist/components/GidsBasicTableBody/GidsBasicTableBody.js +22 -3
  9. package/dist/components/GidsBasicTableBody/GidsBasicTableBody.js.map +1 -1
  10. package/dist/components/GidsBasicTableHead/GidsBasicTableHead.d.ts +15 -0
  11. package/dist/components/GidsBasicTableHead/GidsBasicTableHead.d.ts.map +1 -1
  12. package/dist/components/GidsBasicTableHead/GidsBasicTableHead.js +5 -0
  13. package/dist/components/GidsBasicTableHead/GidsBasicTableHead.js.map +1 -1
  14. package/dist/components/GidsBasicTableHeader/GidsBasicTableHeader.d.ts +26 -3
  15. package/dist/components/GidsBasicTableHeader/GidsBasicTableHeader.d.ts.map +1 -1
  16. package/dist/components/GidsBasicTableHeader/GidsBasicTableHeader.js +9 -1
  17. package/dist/components/GidsBasicTableHeader/GidsBasicTableHeader.js.map +1 -1
  18. package/dist/components/GidsBasicTableRow/GidsBasicTableRow.d.ts +22 -3
  19. package/dist/components/GidsBasicTableRow/GidsBasicTableRow.d.ts.map +1 -1
  20. package/dist/components/GidsBasicTableRow/GidsBasicTableRow.js +27 -6
  21. package/dist/components/GidsBasicTableRow/GidsBasicTableRow.js.map +1 -1
  22. package/dist/components/GidsBsTable/GidsBsTable.d.ts +26 -3
  23. package/dist/components/GidsBsTable/GidsBsTable.d.ts.map +1 -1
  24. package/dist/components/GidsBsTable/GidsBsTable.js +36 -14
  25. package/dist/components/GidsBsTable/GidsBsTable.js.map +1 -1
  26. package/dist/components/GidsChartLegendItem/GidsChartLegendItem.d.ts +1 -1
  27. package/dist/components/GidsChartLegendItem/GidsChartLegendItem.d.ts.map +1 -1
  28. package/dist/components/GidsChartLegendItem/GidsChartLegendItem.js +2 -1
  29. package/dist/components/GidsChartLegendItem/GidsChartLegendItem.js.map +1 -1
  30. package/dist/components/GidsColorSwatch/GidsColorSwatch.d.ts +8 -0
  31. package/dist/components/GidsColorSwatch/GidsColorSwatch.d.ts.map +1 -0
  32. package/dist/components/GidsColorSwatch/GidsColorSwatch.js +62 -0
  33. package/dist/components/GidsColorSwatch/GidsColorSwatch.js.map +1 -0
  34. package/dist/components/GidsCrossTable/GidsCrossTable.d.ts +18 -0
  35. package/dist/components/GidsCrossTable/GidsCrossTable.d.ts.map +1 -0
  36. package/dist/components/GidsCrossTable/GidsCrossTable.js +141 -0
  37. package/dist/components/GidsCrossTable/GidsCrossTable.js.map +1 -0
  38. package/dist/components/GidsCrossTableBody/GidsCrossTableBody.d.ts +13 -0
  39. package/dist/components/GidsCrossTableBody/GidsCrossTableBody.d.ts.map +1 -0
  40. package/dist/components/GidsCrossTableBody/GidsCrossTableBody.js +79 -0
  41. package/dist/components/GidsCrossTableBody/GidsCrossTableBody.js.map +1 -0
  42. package/dist/components/GidsCrossTableRow/GidsCrossTableRow.d.ts +13 -0
  43. package/dist/components/GidsCrossTableRow/GidsCrossTableRow.d.ts.map +1 -0
  44. package/dist/components/GidsCrossTableRow/GidsCrossTableRow.js +128 -0
  45. package/dist/components/GidsCrossTableRow/GidsCrossTableRow.js.map +1 -0
  46. package/dist/components/GidsDialog/GidsDialog.d.ts +13 -0
  47. package/dist/components/GidsDialog/GidsDialog.d.ts.map +1 -0
  48. package/dist/components/GidsDialog/GidsDialog.js +102 -0
  49. package/dist/components/GidsDialog/GidsDialog.js.map +1 -0
  50. package/dist/components/GidsMatrixTable/GidsMatrixTable.d.ts +32 -0
  51. package/dist/components/GidsMatrixTable/GidsMatrixTable.d.ts.map +1 -0
  52. package/dist/components/GidsMatrixTable/GidsMatrixTable.js +75 -0
  53. package/dist/components/GidsMatrixTable/GidsMatrixTable.js.map +1 -0
  54. package/dist/components/GidsMatrixTableBody/GidsMatrixTableBody.d.ts +32 -0
  55. package/dist/components/GidsMatrixTableBody/GidsMatrixTableBody.d.ts.map +1 -0
  56. package/dist/components/GidsMatrixTableBody/GidsMatrixTableBody.js +75 -0
  57. package/dist/components/GidsMatrixTableBody/GidsMatrixTableBody.js.map +1 -0
  58. package/dist/components/GidsMdTable/GidsMdTable.d.ts +11 -2
  59. package/dist/components/GidsMdTable/GidsMdTable.d.ts.map +1 -1
  60. package/dist/components/GidsMdTable/GidsMdTable.js +3 -0
  61. package/dist/components/GidsMdTable/GidsMdTable.js.map +1 -1
  62. package/dist/components/GidsMenu/GidsMenu.d.ts +1 -1
  63. package/dist/components/GidsMenu/GidsMenu.d.ts.map +1 -1
  64. package/dist/components/GidsMenu/GidsMenu.js +10 -1
  65. package/dist/components/GidsMenu/GidsMenu.js.map +1 -1
  66. package/dist/components/GidsPagination/GidsPagination.d.ts +10 -0
  67. package/dist/components/GidsPagination/GidsPagination.d.ts.map +1 -1
  68. package/dist/components/GidsPagination/GidsPagination.js +5 -0
  69. package/dist/components/GidsPagination/GidsPagination.js.map +1 -1
  70. package/dist/components/GidsPaginator/GidsPaginator.d.ts +8 -0
  71. package/dist/components/GidsPaginator/GidsPaginator.d.ts.map +1 -0
  72. package/dist/components/GidsPaginator/GidsPaginator.js +154 -0
  73. package/dist/components/GidsPaginator/GidsPaginator.js.map +1 -0
  74. package/dist/components/GidsPaginatorItem/GidsPaginatorItem.d.ts +9 -0
  75. package/dist/components/GidsPaginatorItem/GidsPaginatorItem.d.ts.map +1 -0
  76. package/dist/components/GidsPaginatorItem/GidsPaginatorItem.js +33 -0
  77. package/dist/components/GidsPaginatorItem/GidsPaginatorItem.js.map +1 -0
  78. package/dist/components/GidsSkeleton/GidsSkeleton.d.ts +8 -0
  79. package/dist/components/GidsSkeleton/GidsSkeleton.d.ts.map +1 -0
  80. package/dist/components/GidsSkeleton/GidsSkeleton.js +16 -0
  81. package/dist/components/GidsSkeleton/GidsSkeleton.js.map +1 -0
  82. package/dist/components/GidsTable/GidsTable.d.ts +18 -0
  83. package/dist/components/GidsTable/GidsTable.d.ts.map +1 -0
  84. package/dist/components/GidsTable/GidsTable.js +121 -0
  85. package/dist/components/GidsTable/GidsTable.js.map +1 -0
  86. package/dist/components/GidsTableBody/GidsTableBody.d.ts +13 -0
  87. package/dist/components/GidsTableBody/GidsTableBody.d.ts.map +1 -0
  88. package/dist/components/GidsTableBody/GidsTableBody.js +61 -0
  89. package/dist/components/GidsTableBody/GidsTableBody.js.map +1 -0
  90. package/dist/components/GidsTableCell/GidsTableCell.d.ts +28 -0
  91. package/dist/components/GidsTableCell/GidsTableCell.d.ts.map +1 -0
  92. package/dist/components/GidsTableCell/GidsTableCell.js +146 -0
  93. package/dist/components/GidsTableCell/GidsTableCell.js.map +1 -0
  94. package/dist/components/GidsTableEntry/GidsTableEntry.d.ts +13 -0
  95. package/dist/components/GidsTableEntry/GidsTableEntry.d.ts.map +1 -0
  96. package/dist/components/GidsTableEntry/GidsTableEntry.js +305 -0
  97. package/dist/components/GidsTableEntry/GidsTableEntry.js.map +1 -0
  98. package/dist/components/GidsTableFooter/GidsTableFooter.d.ts +13 -0
  99. package/dist/components/GidsTableFooter/GidsTableFooter.d.ts.map +1 -0
  100. package/dist/components/GidsTableFooter/GidsTableFooter.js +53 -0
  101. package/dist/components/GidsTableFooter/GidsTableFooter.js.map +1 -0
  102. package/dist/components/GidsTableFooterControl/GidsTableFooterControl.d.ts +11 -0
  103. package/dist/components/GidsTableFooterControl/GidsTableFooterControl.d.ts.map +1 -0
  104. package/dist/components/GidsTableFooterControl/GidsTableFooterControl.js +99 -0
  105. package/dist/components/GidsTableFooterControl/GidsTableFooterControl.js.map +1 -0
  106. package/dist/components/GidsTableHeader/GidsTableHeader.d.ts +13 -0
  107. package/dist/components/GidsTableHeader/GidsTableHeader.d.ts.map +1 -0
  108. package/dist/components/GidsTableHeader/GidsTableHeader.js +49 -0
  109. package/dist/components/GidsTableHeader/GidsTableHeader.js.map +1 -0
  110. package/dist/components/GidsTableRow/GidsTableRow.d.ts +13 -0
  111. package/dist/components/GidsTableRow/GidsTableRow.d.ts.map +1 -0
  112. package/dist/components/GidsTableRow/GidsTableRow.js +71 -0
  113. package/dist/components/GidsTableRow/GidsTableRow.js.map +1 -0
  114. package/dist/components/GidsTableToolbar/GidsTableToolbar.d.ts +11 -0
  115. package/dist/components/GidsTableToolbar/GidsTableToolbar.d.ts.map +1 -0
  116. package/dist/components/GidsTableToolbar/GidsTableToolbar.js +92 -0
  117. package/dist/components/GidsTableToolbar/GidsTableToolbar.js.map +1 -0
  118. package/dist/components/GidsTransferList/GidsTransferList.d.ts +8 -0
  119. package/dist/components/GidsTransferList/GidsTransferList.d.ts.map +1 -0
  120. package/dist/components/GidsTransferList/GidsTransferList.js +25 -0
  121. package/dist/components/GidsTransferList/GidsTransferList.js.map +1 -0
  122. package/dist/components/_GidsDialogControl/GidsDialogControl.d.ts +10 -0
  123. package/dist/components/_GidsDialogControl/GidsDialogControl.d.ts.map +1 -0
  124. package/dist/components/_GidsDialogControl/GidsDialogControl.js +133 -0
  125. package/dist/components/_GidsDialogControl/GidsDialogControl.js.map +1 -0
  126. package/dist/components/_GidsPaginationItem/GidsPaginationItem.d.ts +10 -0
  127. package/dist/components/_GidsPaginationItem/GidsPaginationItem.d.ts.map +1 -1
  128. package/dist/components/_GidsPaginationItem/GidsPaginationItem.js +5 -0
  129. package/dist/components/_GidsPaginationItem/GidsPaginationItem.js.map +1 -1
  130. package/dist/index.d.ts +118 -97
  131. package/dist/index.d.ts.map +1 -1
  132. package/dist/index.js +118 -97
  133. package/dist/index.js.map +1 -1
  134. package/package.json +4 -4
  135. package/src/components/GidsAdvancedTooltip/GidsAdvancedTooltip.ts +42 -0
  136. package/src/components/GidsBasicTableBody/GidsBasicTableBody.ts +66 -5
  137. package/src/components/GidsBasicTableHead/GidsBasicTableHead.ts +15 -0
  138. package/src/components/GidsBasicTableHeader/GidsBasicTableHeader.ts +45 -5
  139. package/src/components/GidsBasicTableRow/GidsBasicTableRow.ts +65 -7
  140. package/src/components/GidsBsTable/GidsBsTable.ts +81 -19
  141. package/src/components/GidsChartLegendItem/GidsChartLegendItem.ts +2 -0
  142. package/src/components/GidsColorSwatch/GidsColorSwatch.ts +107 -0
  143. package/src/components/GidsCrossTable/GidsCrossTable.ts +259 -0
  144. package/src/components/GidsCrossTableBody/GidsCrossTableBody.ts +171 -0
  145. package/src/components/GidsCrossTableRow/GidsCrossTableRow.ts +230 -0
  146. package/src/components/GidsDialog/GidsDialog.ts +161 -0
  147. package/src/components/GidsMatrixTable/GidsMatrixTable.ts +187 -0
  148. package/src/components/GidsMatrixTableBody/GidsMatrixTableBody.ts +185 -0
  149. package/src/components/GidsMdTable/GidsMdTable.ts +14 -2
  150. package/src/components/GidsMenu/GidsMenu.ts +15 -0
  151. package/src/components/GidsPagination/GidsPagination.ts +14 -2
  152. package/src/components/GidsPaginator/GidsPaginator.ts +241 -0
  153. package/src/components/GidsPaginatorItem/GidsPaginatorItem.ts +72 -0
  154. package/src/components/GidsSkeleton/GidsSkeleton.ts +40 -0
  155. package/src/components/GidsTable/GidsTable.ts +240 -0
  156. package/src/components/GidsTableBody/GidsTableBody.ts +137 -0
  157. package/src/components/GidsTableCell/GidsTableCell.ts +276 -0
  158. package/src/components/GidsTableEntry/GidsTableEntry.ts +515 -0
  159. package/src/components/GidsTableFooter/GidsTableFooter.ts +119 -0
  160. package/src/components/GidsTableFooterControl/GidsTableFooterControl.ts +166 -0
  161. package/src/components/GidsTableHeader/GidsTableHeader.ts +112 -0
  162. package/src/components/GidsTableRow/GidsTableRow.ts +152 -0
  163. package/src/components/GidsTableToolbar/GidsTableToolbar.ts +180 -0
  164. package/src/components/GidsTransferList/GidsTransferList.ts +58 -0
  165. package/src/components/_GidsDialogControl/GidsDialogControl.ts +198 -0
  166. package/src/components/_GidsPaginationItem/GidsPaginationItem.ts +14 -2
  167. package/src/index.ts +118 -97
  168. package/dist/components/GidsBasicTableCell/GidsBasicTableCell.d.ts +0 -9
  169. package/dist/components/GidsBasicTableCell/GidsBasicTableCell.d.ts.map +0 -1
  170. package/dist/components/GidsBasicTableCell/GidsBasicTableCell.js +0 -48
  171. package/dist/components/GidsBasicTableCell/GidsBasicTableCell.js.map +0 -1
  172. package/src/components/GidsBasicTableCell/GidsBasicTableCell.ts +0 -99
@@ -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
+ };
@@ -0,0 +1,259 @@
1
+ import {
2
+ GidsCrossTableActionEvent,
3
+ GidsCrossTableToolbarSettings,
4
+ GidsInputStatus,
5
+ } from '@ganpatiinfo/gids-core-shared';
6
+ import { appendAsChildren, DomChildren } from '../../utils/domUtils';
7
+ import { HtmlInputAttributes } from '../GidsInput/GidsInput';
8
+ import {
9
+ GidsTableToolbarDom,
10
+ GidsTableToolbarDomProps,
11
+ } from '../GidsTableToolbar/GidsTableToolbar';
12
+ import {
13
+ GidsCrossTableWebProps,
14
+ GidsCrossTableWebUtils,
15
+ GidsTableEntryTypographyStyle,
16
+ isValidChildren,
17
+ } from '@ganpatiinfo/gids-web-shared';
18
+ import {
19
+ IconAppearance,
20
+ IconName,
21
+ } from '@ganpatiinfo/gids-web-theme-interface';
22
+ import {
23
+ GidsTableHeaderActionBaseEvent,
24
+ GidsTableHeaderDom,
25
+ } from '../GidsTableHeader/GidsTableHeader';
26
+ import {
27
+ GidsCrossTableBodyActionBaseEvent,
28
+ GidsCrossTableBodyDom,
29
+ } from '../GidsCrossTableBody/GidsCrossTableBody';
30
+ import { GidsTableFooterDom } from '../GidsTableFooter/GidsTableFooter';
31
+ import { GidsTableFooterControlDom } from '../GidsTableFooterControl/GidsTableFooterControl';
32
+
33
+ const {
34
+ getGidsCrossTableClassNames,
35
+ getCustomisedCrossTableHeaderEntries,
36
+ getCustomisedCrossTableFooterEntries,
37
+ getCrossTableBodyBorder,
38
+ } = GidsCrossTableWebUtils;
39
+
40
+ export type GidsCrossTableToolbarBaseSettings = GidsCrossTableToolbarSettings<
41
+ DomChildren,
42
+ Event,
43
+ Element,
44
+ HtmlInputAttributes,
45
+ GidsInputStatus
46
+ > &
47
+ Pick<
48
+ GidsTableToolbarDomProps,
49
+ 'onChange' | 'onInput' | 'onFocus' | 'onBlur' | 'onGidsSearchBarClear'
50
+ >;
51
+
52
+ type GidsCrossTableBaseWebProps = Omit<
53
+ GidsCrossTableWebProps<
54
+ DomChildren,
55
+ GidsTableEntryTypographyStyle,
56
+ IconName,
57
+ IconAppearance,
58
+ DomChildren,
59
+ Event,
60
+ Element,
61
+ HtmlInputAttributes
62
+ >,
63
+ 'toolbarSettings'
64
+ > & {
65
+ toolbarSettings?: GidsCrossTableToolbarBaseSettings;
66
+ };
67
+
68
+ type GidsCrossTableActionBaseEvent = GidsCrossTableActionEvent<
69
+ Event,
70
+ GidsTableEntryTypographyStyle,
71
+ IconName,
72
+ IconAppearance
73
+ >;
74
+
75
+ export interface GidsCrossTableDomProps extends GidsCrossTableBaseWebProps {
76
+ extraClasses?: string;
77
+ onCrossTableAction?: (event: GidsCrossTableActionBaseEvent) => void;
78
+ }
79
+
80
+ export const GidsCrossTableDom = ({
81
+ toolbar,
82
+ toolbarChildren,
83
+ children,
84
+ headerItems = [],
85
+ bodyContent = [],
86
+ isHeaderVisible,
87
+ isToolbarVisible,
88
+ bodySettings,
89
+ toolbarSettings,
90
+ headerSettings,
91
+ tableBorders,
92
+ tableBorderRadius,
93
+ tableBodyMaxHeight = 200,
94
+ horizontalScroll = false,
95
+ crossHeaderSettings,
96
+ onCrossTableAction,
97
+ footerItems = [],
98
+ footerSettings,
99
+ isFooterVisible = false,
100
+ isFooterControlVisible = false,
101
+ footerControlSettings,
102
+ footerControl,
103
+ extraClasses,
104
+ }: GidsCrossTableDomProps): HTMLDivElement => {
105
+ /*
106
+ * Cross Table Root
107
+ */
108
+ const crossTableDiv = document.createElement('div');
109
+ crossTableDiv.className = getGidsCrossTableClassNames(
110
+ { tableBorders, tableBorderRadius },
111
+ extraClasses,
112
+ );
113
+
114
+ /*
115
+ * Toolbar
116
+ */
117
+ if (isValidChildren<DomChildren>(toolbar)) {
118
+ appendAsChildren(crossTableDiv, toolbar);
119
+ } else if (isToolbarVisible) {
120
+ const tableToolbar = GidsTableToolbarDom({
121
+ ...toolbarSettings,
122
+ children: toolbarChildren as Element,
123
+ });
124
+
125
+ crossTableDiv.append(tableToolbar);
126
+ }
127
+
128
+ /*
129
+ * Scroll Container
130
+ */
131
+ const tableScrollContainer = document.createElement('div');
132
+ tableScrollContainer.className = [
133
+ 'gids-cross-table__scroll-container',
134
+ horizontalScroll
135
+ ? 'gids-cross-table__scroll-container--horizontal-scroll'
136
+ : '',
137
+ ]
138
+ .filter(Boolean)
139
+ .join(' ');
140
+
141
+ if (tableBodyMaxHeight) {
142
+ tableScrollContainer.style.maxHeight = `${tableBodyMaxHeight}px`;
143
+ }
144
+
145
+ /*
146
+ * Cross Table
147
+ */
148
+ const crossTable = document.createElement('table');
149
+ crossTable.className = 'gids-cross-table__main-table';
150
+
151
+ /*
152
+ * Horizontal scroll is enabled:
153
+ *
154
+ * The table is allowed to become wider than the viewport.
155
+ *
156
+ * Horizontal scroll is disabled:
157
+ *
158
+ * The table stays 100% wide and cells wrap exactly like GidsTable.
159
+ */
160
+ if (horizontalScroll) {
161
+ crossTable.classList.add('gids-cross-table__main-table--horizontal-scroll');
162
+ }
163
+
164
+ /*
165
+ * Custom Children
166
+ */
167
+ if (isValidChildren(children)) {
168
+ appendAsChildren(crossTable, children);
169
+ } else {
170
+ function onActionBtnClick(
171
+ event: GidsTableHeaderActionBaseEvent | GidsCrossTableBodyActionBaseEvent,
172
+ ) {
173
+ if (onCrossTableAction) {
174
+ onCrossTableAction({
175
+ ...event,
176
+ details: {
177
+ ...event.details,
178
+ columnIndex: event?.details?.entryIndex,
179
+ },
180
+ });
181
+ }
182
+ }
183
+
184
+ /*
185
+ * Header
186
+ */
187
+ if (isHeaderVisible && headerItems && headerItems.length > 0) {
188
+ const crossTableHeader = GidsTableHeaderDom({
189
+ ...headerSettings,
190
+ headerItems: getCustomisedCrossTableHeaderEntries({
191
+ headerItems: [{}, ...headerItems],
192
+ tableBorders,
193
+ }),
194
+ onHeaderAction: onActionBtnClick,
195
+ });
196
+
197
+ crossTable.append(crossTableHeader);
198
+ }
199
+
200
+ /*
201
+ * Body
202
+ */
203
+ if (bodyContent && bodyContent.length > 0) {
204
+ crossTable.append(
205
+ GidsCrossTableBodyDom({
206
+ bodyBorder: getCrossTableBodyBorder({
207
+ tableBorders,
208
+ }),
209
+ bodyContent,
210
+ bodySettings,
211
+ crossHeaderSettings,
212
+ onCrossTableBodyAction: onActionBtnClick,
213
+ }),
214
+ );
215
+ }
216
+
217
+ /*
218
+ * Footer
219
+ */
220
+ if (isFooterVisible && footerItems && footerItems.length > 0) {
221
+ const crossTableFooter = GidsTableFooterDom({
222
+ ...footerSettings,
223
+ footerItems: getCustomisedCrossTableFooterEntries({
224
+ footerItems: [{}, ...footerItems],
225
+ tableBorders,
226
+ }),
227
+ onFooterAction: onActionBtnClick,
228
+ });
229
+
230
+ crossTable.append(crossTableFooter);
231
+ }
232
+ }
233
+
234
+ /*
235
+ * Put cross table inside scroll container
236
+ */
237
+ tableScrollContainer.appendChild(crossTable);
238
+
239
+ /*
240
+ * Put scroll container inside Cross Table div
241
+ */
242
+ crossTableDiv.appendChild(tableScrollContainer);
243
+
244
+ /*
245
+ * Footer Control
246
+ */
247
+ if (isFooterControlVisible || isValidChildren(footerControl)) {
248
+ crossTableDiv.append(
249
+ GidsTableFooterControlDom({
250
+ ...footerControlSettings,
251
+ tableViewControllerSettings:
252
+ footerControlSettings?.tableViewControllerSettings,
253
+ children: footerControl,
254
+ }),
255
+ );
256
+ }
257
+
258
+ return crossTableDiv;
259
+ };
@@ -0,0 +1,171 @@
1
+ import { GidsCrossTableBodyActionEvent } from '@ganpatiinfo/gids-core-shared';
2
+ import {
3
+ GidsCrossTableBodyWebProps,
4
+ GidsCrossTableBodyWebUtils,
5
+ GidsTableEntryTypographyStyle,
6
+ isValidChildren,
7
+ } from '@ganpatiinfo/gids-web-shared';
8
+ import {
9
+ IconAppearance,
10
+ IconName,
11
+ } from '@ganpatiinfo/gids-web-theme-interface';
12
+ import { appendAsChildren, DomChildren } from '../../utils/domUtils';
13
+ import {
14
+ GidsCrossTableRowActionBaseEvent,
15
+ GidsCrossTableRowDom,
16
+ } from '../GidsCrossTableRow/GidsCrossTableRow';
17
+
18
+ const {
19
+ getGidsCrossTableBodyClassNames,
20
+ getConstructedCrossTableBodyContent,
21
+ getCrossTableBodyRowEntryBackgroundColor,
22
+ getCrossTableBodyRowEntryContentColor,
23
+ getCrossTableBodyRowEntryActionsBackgroundColor,
24
+ getCrossTableBodyRowEntryActionsContentColor,
25
+ } = GidsCrossTableBodyWebUtils;
26
+
27
+ type GidsCrossTableBodyBaseWebProps = GidsCrossTableBodyWebProps<
28
+ GidsTableEntryTypographyStyle,
29
+ IconName,
30
+ IconAppearance,
31
+ DomChildren
32
+ >;
33
+
34
+ export type GidsCrossTableBodyActionBaseEvent = GidsCrossTableBodyActionEvent<
35
+ Event,
36
+ GidsTableEntryTypographyStyle,
37
+ IconName,
38
+ IconAppearance
39
+ >;
40
+
41
+ export interface GidsCrossTableBodyDomProps extends GidsCrossTableBodyBaseWebProps {
42
+ extraClasses?: string;
43
+ onCrossTableBodyAction?: (event: GidsCrossTableBodyActionBaseEvent) => void;
44
+ }
45
+
46
+ export const GidsCrossTableBodyDom = ({
47
+ bodySettings,
48
+ bodyContent = [],
49
+ bodyBorder = 'none',
50
+ crossHeaderSettings,
51
+ children,
52
+ onCrossTableBodyAction,
53
+ extraClasses,
54
+ }: GidsCrossTableBodyDomProps): HTMLElement => {
55
+ const crossTableBody = document.createElement('tbody');
56
+
57
+ crossTableBody.className = getGidsCrossTableBodyClassNames(extraClasses);
58
+
59
+ if (isValidChildren<DomChildren>(children)) {
60
+ appendAsChildren(crossTableBody, children);
61
+
62
+ return crossTableBody;
63
+ }
64
+
65
+ if (bodyContent && bodyContent.length > 0) {
66
+ const constructedCrossTableBodyContent =
67
+ getConstructedCrossTableBodyContent({
68
+ bodyContent,
69
+ bodyBorder,
70
+ });
71
+
72
+ function onCrossTableRowActionBtnClick({
73
+ event,
74
+ rowIndex,
75
+ }: {
76
+ event: GidsCrossTableRowActionBaseEvent;
77
+ rowIndex: number;
78
+ }) {
79
+ if (onCrossTableBodyAction) {
80
+ onCrossTableBodyAction({
81
+ ...event,
82
+ details: {
83
+ ...event.details,
84
+ rowIndex,
85
+ },
86
+ });
87
+ }
88
+ }
89
+
90
+ constructedCrossTableBodyContent.forEach(
91
+ (constructedCrossTableBody, indexI) => {
92
+ const constructedBodyRowItems =
93
+ constructedCrossTableBody?.rowItems ?? [];
94
+
95
+ const rowBgColor = getCrossTableBodyRowEntryBackgroundColor<
96
+ GidsTableEntryTypographyStyle,
97
+ IconName,
98
+ IconAppearance
99
+ >({
100
+ bodySettings,
101
+ rowIndex: indexI,
102
+ });
103
+
104
+ const rowContentColor = getCrossTableBodyRowEntryContentColor<
105
+ GidsTableEntryTypographyStyle,
106
+ IconName,
107
+ IconAppearance
108
+ >({
109
+ bodySettings,
110
+ rowIndex: indexI,
111
+ });
112
+
113
+ const rowActionsBgColor =
114
+ getCrossTableBodyRowEntryActionsBackgroundColor<
115
+ GidsTableEntryTypographyStyle,
116
+ IconName,
117
+ IconAppearance
118
+ >({
119
+ bodySettings,
120
+ rowIndex: indexI,
121
+ });
122
+
123
+ const rowActionsContentColor =
124
+ getCrossTableBodyRowEntryActionsContentColor<
125
+ GidsTableEntryTypographyStyle,
126
+ IconName,
127
+ IconAppearance
128
+ >({
129
+ bodySettings,
130
+ rowIndex: indexI,
131
+ });
132
+
133
+ crossTableBody.append(
134
+ GidsCrossTableRowDom({
135
+ ...bodySettings,
136
+
137
+ rows: constructedBodyRowItems,
138
+ /*
139
+ * Cross Header
140
+ *
141
+ * sideHeaderItem = actual content
142
+ * for this specific row.
143
+ */
144
+ crossHeaderItem: constructedCrossTableBody?.crossHeaderItem,
145
+ /*
146
+ * Cross Header Settings
147
+ *
148
+ * Shared configuration/style for
149
+ * all side-header cells.
150
+ */
151
+ crossHeaderSettings,
152
+ /*
153
+ * Body row styling
154
+ */
155
+ backgroundColor: rowBgColor,
156
+ contentColor: rowContentColor,
157
+ actionsBackgroundColor: rowActionsBgColor,
158
+ actionsContentColor: rowActionsContentColor,
159
+ onCrossTableRowAction: (event: GidsCrossTableRowActionBaseEvent) =>
160
+ onCrossTableRowActionBtnClick({
161
+ event,
162
+ rowIndex: indexI,
163
+ }),
164
+ }),
165
+ );
166
+ },
167
+ );
168
+ }
169
+
170
+ return crossTableBody;
171
+ };