@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.
Files changed (132) hide show
  1. package/CHANGELOG.md +84 -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/GidsMatrixTable/GidsMatrixTable.d.ts +12 -0
  35. package/dist/components/GidsMatrixTable/GidsMatrixTable.d.ts.map +1 -0
  36. package/dist/components/GidsMatrixTable/GidsMatrixTable.js +70 -0
  37. package/dist/components/GidsMatrixTable/GidsMatrixTable.js.map +1 -0
  38. package/dist/components/GidsMatrixTableBody/GidsMatrixTableBody.d.ts +12 -0
  39. package/dist/components/GidsMatrixTableBody/GidsMatrixTableBody.d.ts.map +1 -0
  40. package/dist/components/GidsMatrixTableBody/GidsMatrixTableBody.js +70 -0
  41. package/dist/components/GidsMatrixTableBody/GidsMatrixTableBody.js.map +1 -0
  42. package/dist/components/GidsMdTable/GidsMdTable.d.ts +11 -2
  43. package/dist/components/GidsMdTable/GidsMdTable.d.ts.map +1 -1
  44. package/dist/components/GidsMdTable/GidsMdTable.js +3 -0
  45. package/dist/components/GidsMdTable/GidsMdTable.js.map +1 -1
  46. package/dist/components/GidsPagination/GidsPagination.d.ts +10 -0
  47. package/dist/components/GidsPagination/GidsPagination.d.ts.map +1 -1
  48. package/dist/components/GidsPagination/GidsPagination.js +5 -0
  49. package/dist/components/GidsPagination/GidsPagination.js.map +1 -1
  50. package/dist/components/GidsPaginator/GidsPaginator.d.ts +8 -0
  51. package/dist/components/GidsPaginator/GidsPaginator.d.ts.map +1 -0
  52. package/dist/components/GidsPaginator/GidsPaginator.js +154 -0
  53. package/dist/components/GidsPaginator/GidsPaginator.js.map +1 -0
  54. package/dist/components/GidsPaginatorItem/GidsPaginatorItem.d.ts +9 -0
  55. package/dist/components/GidsPaginatorItem/GidsPaginatorItem.d.ts.map +1 -0
  56. package/dist/components/GidsPaginatorItem/GidsPaginatorItem.js +33 -0
  57. package/dist/components/GidsPaginatorItem/GidsPaginatorItem.js.map +1 -0
  58. package/dist/components/GidsTable/GidsTable.d.ts +18 -0
  59. package/dist/components/GidsTable/GidsTable.d.ts.map +1 -0
  60. package/dist/components/GidsTable/GidsTable.js +96 -0
  61. package/dist/components/GidsTable/GidsTable.js.map +1 -0
  62. package/dist/components/GidsTableBody/GidsTableBody.d.ts +13 -0
  63. package/dist/components/GidsTableBody/GidsTableBody.d.ts.map +1 -0
  64. package/dist/components/GidsTableBody/GidsTableBody.js +61 -0
  65. package/dist/components/GidsTableBody/GidsTableBody.js.map +1 -0
  66. package/dist/components/GidsTableCell/GidsTableCell.d.ts +28 -0
  67. package/dist/components/GidsTableCell/GidsTableCell.d.ts.map +1 -0
  68. package/dist/components/GidsTableCell/GidsTableCell.js +146 -0
  69. package/dist/components/GidsTableCell/GidsTableCell.js.map +1 -0
  70. package/dist/components/GidsTableEntry/GidsTableEntry.d.ts +13 -0
  71. package/dist/components/GidsTableEntry/GidsTableEntry.d.ts.map +1 -0
  72. package/dist/components/GidsTableEntry/GidsTableEntry.js +305 -0
  73. package/dist/components/GidsTableEntry/GidsTableEntry.js.map +1 -0
  74. package/dist/components/GidsTableFooter/GidsTableFooter.d.ts +13 -0
  75. package/dist/components/GidsTableFooter/GidsTableFooter.d.ts.map +1 -0
  76. package/dist/components/GidsTableFooter/GidsTableFooter.js +75 -0
  77. package/dist/components/GidsTableFooter/GidsTableFooter.js.map +1 -0
  78. package/dist/components/GidsTableFooterControl/GidsTableFooterControl.d.ts +11 -0
  79. package/dist/components/GidsTableFooterControl/GidsTableFooterControl.d.ts.map +1 -0
  80. package/dist/components/GidsTableFooterControl/GidsTableFooterControl.js +97 -0
  81. package/dist/components/GidsTableFooterControl/GidsTableFooterControl.js.map +1 -0
  82. package/dist/components/GidsTableHeader/GidsTableHeader.d.ts +13 -0
  83. package/dist/components/GidsTableHeader/GidsTableHeader.d.ts.map +1 -0
  84. package/dist/components/GidsTableHeader/GidsTableHeader.js +51 -0
  85. package/dist/components/GidsTableHeader/GidsTableHeader.js.map +1 -0
  86. package/dist/components/GidsTableRow/GidsTableRow.d.ts +13 -0
  87. package/dist/components/GidsTableRow/GidsTableRow.d.ts.map +1 -0
  88. package/dist/components/GidsTableRow/GidsTableRow.js +71 -0
  89. package/dist/components/GidsTableRow/GidsTableRow.js.map +1 -0
  90. package/dist/components/GidsTableToolbar/GidsTableToolbar.d.ts +11 -0
  91. package/dist/components/GidsTableToolbar/GidsTableToolbar.d.ts.map +1 -0
  92. package/dist/components/GidsTableToolbar/GidsTableToolbar.js +92 -0
  93. package/dist/components/GidsTableToolbar/GidsTableToolbar.js.map +1 -0
  94. package/dist/components/_GidsPaginationItem/GidsPaginationItem.d.ts +10 -0
  95. package/dist/components/_GidsPaginationItem/GidsPaginationItem.d.ts.map +1 -1
  96. package/dist/components/_GidsPaginationItem/GidsPaginationItem.js +5 -0
  97. package/dist/components/_GidsPaginationItem/GidsPaginationItem.js.map +1 -1
  98. package/dist/index.d.ts +15 -1
  99. package/dist/index.d.ts.map +1 -1
  100. package/dist/index.js +15 -1
  101. package/dist/index.js.map +1 -1
  102. package/package.json +4 -4
  103. package/src/components/GidsAdvancedTooltip/GidsAdvancedTooltip.ts +42 -0
  104. package/src/components/GidsBasicTableBody/GidsBasicTableBody.ts +66 -5
  105. package/src/components/GidsBasicTableHead/GidsBasicTableHead.ts +15 -0
  106. package/src/components/GidsBasicTableHeader/GidsBasicTableHeader.ts +45 -5
  107. package/src/components/GidsBasicTableRow/GidsBasicTableRow.ts +65 -7
  108. package/src/components/GidsBsTable/GidsBsTable.ts +81 -19
  109. package/src/components/GidsChartLegendItem/GidsChartLegendItem.ts +2 -0
  110. package/src/components/GidsColorSwatch/GidsColorSwatch.ts +107 -0
  111. package/src/components/GidsMatrixTable/GidsMatrixTable.ts +167 -0
  112. package/src/components/GidsMatrixTableBody/GidsMatrixTableBody.ts +164 -0
  113. package/src/components/GidsMdTable/GidsMdTable.ts +14 -2
  114. package/src/components/GidsPagination/GidsPagination.ts +14 -2
  115. package/src/components/GidsPaginator/GidsPaginator.ts +241 -0
  116. package/src/components/GidsPaginatorItem/GidsPaginatorItem.ts +72 -0
  117. package/src/components/GidsTable/GidsTable.ts +203 -0
  118. package/src/components/GidsTableBody/GidsTableBody.ts +137 -0
  119. package/src/components/GidsTableCell/GidsTableCell.ts +276 -0
  120. package/src/components/GidsTableEntry/GidsTableEntry.ts +515 -0
  121. package/src/components/GidsTableFooter/GidsTableFooter.ts +157 -0
  122. package/src/components/GidsTableFooterControl/GidsTableFooterControl.ts +159 -0
  123. package/src/components/GidsTableHeader/GidsTableHeader.ts +116 -0
  124. package/src/components/GidsTableRow/GidsTableRow.ts +154 -0
  125. package/src/components/GidsTableToolbar/GidsTableToolbar.ts +180 -0
  126. package/src/components/_GidsPaginationItem/GidsPaginationItem.ts +14 -2
  127. package/src/index.ts +15 -1
  128. package/dist/components/GidsBasicTableCell/GidsBasicTableCell.d.ts +0 -9
  129. package/dist/components/GidsBasicTableCell/GidsBasicTableCell.d.ts.map +0 -1
  130. package/dist/components/GidsBasicTableCell/GidsBasicTableCell.js +0 -48
  131. package/dist/components/GidsBasicTableCell/GidsBasicTableCell.js.map +0 -1
  132. package/src/components/GidsBasicTableCell/GidsBasicTableCell.ts +0 -99
@@ -0,0 +1,515 @@
1
+ import {
2
+ GidsTableEntryTypographyStyle,
3
+ GidsTableEntryWebProps,
4
+ GidsTableEntryWebUtils,
5
+ isValidChildren,
6
+ } from '@ganpatiinfo/gids-web-shared';
7
+ import { appendAsChildren, DomChildren } from '../../utils/domUtils';
8
+ import {
9
+ IconAppearance,
10
+ IconName,
11
+ } from '@ganpatiinfo/gids-web-theme-interface';
12
+ import { GidsDisplayTagDom } from '../GidsDisplayTag/GidsDisplayTag';
13
+ import { GidsIconDom } from '../GidsIcon/GidsIcon.js';
14
+ import {
15
+ GetTableEntryButtonIconNeedType,
16
+ GidsTableEntryActionEvent,
17
+ GidsTableEntryActionsSharedDataTypes,
18
+ GidsTableEntryCommonUtils,
19
+ GidsTableEntryActionsPositionSharedDataType,
20
+ } from '@ganpatiinfo/gids-core-shared';
21
+ import { GidsButtonDom } from '../GidsButton/GidsButton.js';
22
+ import { GidsAvatarGroupDom } from '../GidsAvatarGroup/GidsAvatarGroup';
23
+ import { GidsAvatarDom } from '../GidsAvatar/GidsAvatar';
24
+ import { GidsProgressBarDom } from '../GidsProgressBar/GidsProgressBar';
25
+ import { GidsStatusTagDom } from '../GidsStatusTag/GidsStatusTag';
26
+ import { GidsBadgeDom } from '../GidsBadge/GidsBadge';
27
+ import { GidsColorSwatchDom } from '../GidsColorSwatch/GidsColorSwatch';
28
+
29
+ const {
30
+ getGidsTableEntryClassNames,
31
+ getGidsTableEntryLabelTypographyClass,
32
+ getTableEntryAlignment,
33
+ } = GidsTableEntryWebUtils;
34
+ const { isTableEntryActionButtonVisible, getTableEntryActionBtnIcon } =
35
+ GidsTableEntryCommonUtils;
36
+
37
+ type GidsTableEntryBaseWebProps = GidsTableEntryWebProps<
38
+ GidsTableEntryTypographyStyle,
39
+ IconName,
40
+ IconAppearance,
41
+ DomChildren
42
+ >;
43
+ export type GidsTableEntryActionBaseEvent = GidsTableEntryActionEvent<
44
+ Event,
45
+ GidsTableEntryTypographyStyle,
46
+ IconName,
47
+ IconAppearance
48
+ >;
49
+
50
+ export interface GidsTableEntryDomProps extends GidsTableEntryBaseWebProps {
51
+ extraClasses?: string;
52
+ onEntryAction?: (event: GidsTableEntryActionBaseEvent) => void;
53
+ }
54
+
55
+ export const GidsTableEntryDom = ({
56
+ id,
57
+ uniqueKey,
58
+ extraData,
59
+ colSpan,
60
+ label,
61
+ entryDataTypes = ['text'],
62
+ displayTags = [],
63
+ statusTags = [],
64
+ badges = [],
65
+ avatars = [],
66
+ colorSwatches = [],
67
+ progressBars = [],
68
+ borderSides = [],
69
+ borderRadiusSides = [],
70
+ appearance = 'none',
71
+ textAlignment = 'center',
72
+ entryAlignment = 'center',
73
+ labelTypography = 'label-medium',
74
+ entryType = 'body',
75
+ leadingActions = [],
76
+ trailingActions = [],
77
+ onEntryAction,
78
+ colorSwatchLabelColor = 'default',
79
+ colorSwatchLabelPosition = 'left',
80
+ colorSwatchLabelTypography = 'label-medium',
81
+ colorSwatchSize = 'sm',
82
+ colorSwatchShape = 'oval',
83
+ colorSwatchShadow = 'shadow-overlay',
84
+ colorSwatchBorderRadius = 'none',
85
+ colorSwatchApplyBorders = true,
86
+ colorSwatchBorderWidth = 'thick',
87
+ progressBarSize = 'sm',
88
+ progressBarEndCap = true,
89
+ avatarSize = 'sm',
90
+ avatarGroupAppearance,
91
+ avatarGroupLayout,
92
+ statusTagAppearance = 'subtle',
93
+ statusTagSize = 'sm',
94
+ progressBarContainerMinWidth = 200,
95
+ displayTagsOrientation = 'horizontal',
96
+ statusTagsOrientation = 'horizontal',
97
+ progressBarsOrientation = 'horizontal',
98
+ colorSwatchesOrientation = 'horizontal',
99
+ badgesOrientation = 'horizontal',
100
+ children,
101
+ backgroundColor,
102
+ contentColor,
103
+ actionsBackgroundColor,
104
+ actionsContentColor,
105
+ extraClasses,
106
+ }: GidsTableEntryDomProps): HTMLTableCellElement => {
107
+ let entryTag = 'td';
108
+ if (entryType === 'header') {
109
+ entryTag = 'th';
110
+ } else if (entryType === 'footer') {
111
+ entryTag = 'td';
112
+ }
113
+
114
+ const tableEntry = document.createElement(entryTag) as HTMLTableCellElement;
115
+ tableEntry.className = getGidsTableEntryClassNames(
116
+ {
117
+ borderSides,
118
+ borderRadiusSides,
119
+ appearance,
120
+ textAlignment,
121
+ backgroundColor,
122
+ },
123
+ extraClasses,
124
+ );
125
+ if (backgroundColor && backgroundColor !== '') {
126
+ tableEntry.style.backgroundColor = backgroundColor;
127
+ }
128
+ if (contentColor && contentColor !== '') {
129
+ tableEntry.style.color = contentColor;
130
+ tableEntry.style.setProperty('--gidsIcon-color', contentColor);
131
+ tableEntry.style.setProperty(
132
+ '--gidsButton-color-default-text',
133
+ contentColor,
134
+ );
135
+ tableEntry.style.setProperty('--gidsButton-color-icon', contentColor);
136
+ }
137
+ if (actionsBackgroundColor && actionsBackgroundColor !== '') {
138
+ tableEntry.style.setProperty(
139
+ '--gidsButton-color-default-bg',
140
+ actionsBackgroundColor,
141
+ );
142
+ tableEntry.style.setProperty(
143
+ '--gidsButton-color-primary-bg',
144
+ actionsBackgroundColor,
145
+ );
146
+ tableEntry.style.setProperty(
147
+ '--gidsButton-color-subtle-bg',
148
+ actionsBackgroundColor,
149
+ );
150
+ }
151
+ if (actionsContentColor && contentColor !== '') {
152
+ tableEntry.style.setProperty(
153
+ '--gidsButton-color-default-text',
154
+ actionsContentColor,
155
+ );
156
+ tableEntry.style.setProperty(
157
+ '--gidsButton-color-icon',
158
+ actionsContentColor,
159
+ );
160
+ }
161
+
162
+ if (colSpan && colSpan > 0) {
163
+ tableEntry.colSpan = colSpan;
164
+ }
165
+
166
+ if (id) {
167
+ tableEntry.setAttribute('id', id);
168
+ }
169
+
170
+ if (uniqueKey) {
171
+ tableEntry.setAttribute('unique-key', uniqueKey);
172
+ }
173
+
174
+ if (extraData) {
175
+ tableEntry.setAttribute('extra-data', JSON.stringify(extraData));
176
+ }
177
+
178
+ if (isValidChildren<DomChildren | undefined>(children)) {
179
+ appendAsChildren(tableEntry, children);
180
+ } else {
181
+ const entryContainer = document.createElement('div');
182
+ entryContainer.className = getTableEntryAlignment({ entryAlignment });
183
+
184
+ function makeEntryActionBtnIcon({
185
+ entryActionBtn,
186
+ neededIconType = 'leading',
187
+ }: {
188
+ entryActionBtn?: GidsTableEntryActionsSharedDataTypes<
189
+ IconName,
190
+ IconAppearance
191
+ >;
192
+ neededIconType?: GetTableEntryButtonIconNeedType;
193
+ }) {
194
+ const tableEntryBtnIcon = getTableEntryActionBtnIcon<
195
+ IconName,
196
+ IconAppearance
197
+ >({
198
+ entryActionButton: entryActionBtn,
199
+ neededIconType,
200
+ });
201
+
202
+ return tableEntryBtnIcon?.entryIconName &&
203
+ tableEntryBtnIcon.entryIconName.toString() !== ''
204
+ ? GidsIconDom({
205
+ name: tableEntryBtnIcon.entryIconName,
206
+ size: tableEntryBtnIcon.entryIconSize,
207
+ appearance: tableEntryBtnIcon.entryIconAppearance,
208
+ })
209
+ : undefined;
210
+ }
211
+
212
+ function onActionBtnClick({
213
+ event,
214
+ actionIndex,
215
+ actionPosition,
216
+ }: {
217
+ event: Event;
218
+ actionIndex: number;
219
+ actionPosition: GidsTableEntryActionsPositionSharedDataType;
220
+ }) {
221
+ if (onEntryAction) {
222
+ onEntryAction({
223
+ originalEvent: event,
224
+ details: {
225
+ appearance,
226
+ entryDataTypes,
227
+ displayTags,
228
+ statusTags,
229
+ colorSwatches,
230
+ progressBars,
231
+ badges,
232
+ avatars,
233
+ label,
234
+ id,
235
+ extraData,
236
+ entryType,
237
+ uniqueKey,
238
+ actionNumber: `action-btn-${actionIndex + 1}`,
239
+ actionIndex: actionIndex,
240
+ actionPosition: actionPosition ?? 'trailing',
241
+ },
242
+ });
243
+ }
244
+ }
245
+
246
+ function makeEntryActionButton({
247
+ entryActionBtn,
248
+ actionIndex,
249
+ actionPosition,
250
+ }: {
251
+ entryActionBtn?: GidsTableEntryActionsSharedDataTypes<
252
+ IconName,
253
+ IconAppearance
254
+ >;
255
+ actionIndex: number;
256
+ actionPosition: GidsTableEntryActionsPositionSharedDataType;
257
+ }) {
258
+ return GidsButtonDom({
259
+ as: 'button',
260
+ appearance: entryActionBtn?.appearance ?? 'default',
261
+ size: entryActionBtn?.size ?? 'md',
262
+ disabled: entryActionBtn?.disabled,
263
+ destructive: entryActionBtn?.destructive,
264
+ positive: entryActionBtn?.positive,
265
+ loading: entryActionBtn?.loading,
266
+ width: entryActionBtn?.width ?? 'intrinsic',
267
+ children: entryActionBtn?.buttonLabel ?? '',
268
+ type: 'button',
269
+ leadingIcon: makeEntryActionBtnIcon({
270
+ entryActionBtn,
271
+ neededIconType: 'leading',
272
+ }),
273
+ trailingIcon: makeEntryActionBtnIcon({
274
+ entryActionBtn,
275
+ neededIconType: 'trailing',
276
+ }),
277
+ onClick: (event: Event) =>
278
+ onActionBtnClick({ event, actionIndex, actionPosition }),
279
+ });
280
+ }
281
+
282
+ if (leadingActions && leadingActions.length > 0) {
283
+ const entryPrimaryActionBtnContainer = document.createElement('div');
284
+ entryPrimaryActionBtnContainer.className =
285
+ 'gids-table-entry__leading-actions-container';
286
+
287
+ Array.from({ length: leadingActions.length }, (_, indexI) => {
288
+ const entryPrimaryActionBtnIndex = leadingActions.length - indexI - 1;
289
+ const entryPrimaryActionBtn =
290
+ leadingActions[entryPrimaryActionBtnIndex];
291
+ const entryActionBtnVisible = isTableEntryActionButtonVisible<
292
+ IconName,
293
+ IconAppearance
294
+ >(entryPrimaryActionBtn);
295
+ if (entryActionBtnVisible) {
296
+ entryPrimaryActionBtnContainer.append(
297
+ makeEntryActionButton({
298
+ entryActionBtn: entryPrimaryActionBtn,
299
+ actionIndex: entryPrimaryActionBtnIndex,
300
+ actionPosition: 'leading',
301
+ }),
302
+ );
303
+ }
304
+ });
305
+
306
+ entryContainer.appendChild(entryPrimaryActionBtnContainer);
307
+ }
308
+
309
+ if (entryDataTypes.includes('text') && label && label !== '') {
310
+ const labelSpan = document.createElement('span');
311
+ labelSpan.textContent = label;
312
+ labelSpan.className = `${getGidsTableEntryLabelTypographyClass(labelTypography)}`;
313
+
314
+ appendAsChildren(entryContainer, labelSpan);
315
+ }
316
+
317
+ if (
318
+ entryDataTypes.includes('display-tag') &&
319
+ displayTags &&
320
+ displayTags.length > 0
321
+ ) {
322
+ const displayTagsContainer = document.createElement('div');
323
+ displayTagsContainer.className =
324
+ displayTagsOrientation === 'horizontal'
325
+ ? 'gids-table-entry__common-items-container-horizontal'
326
+ : 'gids-table-entry__common-items-container-vertical';
327
+
328
+ displayTags.forEach((displayTag) => {
329
+ displayTagsContainer.append(
330
+ GidsDisplayTagDom({
331
+ label: displayTag?.label ?? '',
332
+ appearance: displayTag?.displayTagAppearance ?? 'subtle',
333
+ size: displayTag?.displayTagSize ?? 'xs',
334
+ icon: displayTag?.displayTagIcon
335
+ ? GidsIconDom({
336
+ name: displayTag.displayTagIcon,
337
+ size: displayTag?.displayTagSize ?? 'xs',
338
+ appearance: displayTag?.displayTagIconAppearance ?? 'regular',
339
+ })
340
+ : undefined,
341
+ color: displayTag?.displayTagColor ?? 'accent-5',
342
+ }),
343
+ );
344
+ });
345
+
346
+ appendAsChildren(entryContainer, displayTagsContainer);
347
+ }
348
+
349
+ if (entryDataTypes.includes('avatar') && avatars && avatars.length > 0) {
350
+ const avatarGroup = GidsAvatarGroupDom({
351
+ appearance: avatarGroupAppearance ? avatarGroupAppearance : 'spread',
352
+ layout: avatarGroupLayout ? avatarGroupLayout : 'wrap',
353
+ children: Array.from({ length: avatars.length }, (_, indexI) => {
354
+ const avatar = avatars[indexI];
355
+ return GidsAvatarDom({
356
+ size: avatarSize,
357
+ alt: avatar?.avatarAlt ?? '',
358
+ appearance: avatar?.avatarAppearance ?? 'icon',
359
+ badge: GidsBadgeDom({
360
+ appearance: avatar?.avatarBadge?.badgeAppearance ?? 'information',
361
+ count: avatar?.avatarBadge?.badgeCount ?? undefined,
362
+ accessibleText: avatar?.avatarBadge?.badgeAccessibleText ?? '',
363
+ type: avatar?.avatarBadge?.badgeType ?? 'dot',
364
+ outline: avatar?.avatarBadge?.badgeOutline ?? false,
365
+ }),
366
+ color: avatar?.avatarColor ?? 'default',
367
+ imageSrc: avatar?.avatarImageSrc ?? '',
368
+ text: avatar?.avatarText ?? '',
369
+ });
370
+ }),
371
+ });
372
+
373
+ appendAsChildren(entryContainer, avatarGroup);
374
+ }
375
+
376
+ if (
377
+ entryDataTypes.includes('progress-bar') &&
378
+ progressBars &&
379
+ progressBars.length > 0
380
+ ) {
381
+ const progressBarsContainer = document.createElement('div');
382
+ progressBarsContainer.className =
383
+ progressBarsOrientation === 'horizontal'
384
+ ? 'gids-table-entry__progress-bars-container-horizontal'
385
+ : 'gids-table-entry__progress-bars-container-vertical';
386
+ progressBarsContainer.style.setProperty(
387
+ '--gidsProgressBarContainer-min-width',
388
+ `${progressBarContainerMinWidth}px`,
389
+ );
390
+
391
+ progressBars.forEach((progressBar) => {
392
+ progressBarsContainer.appendChild(
393
+ GidsProgressBarDom({
394
+ size: progressBarSize,
395
+ color: progressBar?.progressBarColor ?? 'default',
396
+ indeterminate: progressBar?.progressBarIndeterminate ?? true,
397
+ value: progressBar?.progressBarValue,
398
+ max: progressBar?.progressBarMax ?? 1,
399
+ endCap: progressBarEndCap,
400
+ }),
401
+ );
402
+ });
403
+
404
+ appendAsChildren(entryContainer, progressBarsContainer);
405
+ }
406
+
407
+ if (
408
+ entryDataTypes.includes('status-tag') &&
409
+ statusTags &&
410
+ statusTags.length > 0
411
+ ) {
412
+ const statusTagsContainer = document.createElement('div');
413
+ statusTagsContainer.className =
414
+ statusTagsOrientation === 'horizontal'
415
+ ? 'gids-table-entry__common-items-container-horizontal'
416
+ : 'gids-table-entry__common-items-container-vertical';
417
+
418
+ statusTags.forEach((statusTag) => {
419
+ statusTagsContainer.appendChild(
420
+ GidsStatusTagDom({
421
+ type: statusTag?.statusTagType ?? 'unknown',
422
+ appearance: statusTagAppearance ?? 'subtle',
423
+ size: statusTagSize ?? 'sm',
424
+ }),
425
+ );
426
+ });
427
+
428
+ appendAsChildren(entryContainer, statusTagsContainer);
429
+ }
430
+
431
+ if (
432
+ entryDataTypes.includes('color-swatch') &&
433
+ colorSwatches &&
434
+ colorSwatches.length > 0
435
+ ) {
436
+ const colorSwatchesContainer = document.createElement('div');
437
+ colorSwatchesContainer.className =
438
+ colorSwatchesOrientation === 'horizontal'
439
+ ? 'gids-table-entry__common-items-container-horizontal'
440
+ : 'gids-table-entry__common-items-container-vertical';
441
+
442
+ colorSwatches.forEach((colorSwatch) => {
443
+ colorSwatchesContainer.appendChild(
444
+ GidsColorSwatchDom({
445
+ label: colorSwatch?.colorSwatchLabel,
446
+ labelColor: colorSwatchLabelColor,
447
+ labelTypography: colorSwatchLabelTypography,
448
+ labelPosition: colorSwatchLabelPosition,
449
+ swatchColor: colorSwatch?.colorSwatchColor,
450
+ swatchSize: colorSwatchSize,
451
+ swatchShape: colorSwatchShape,
452
+ swatchShadow: colorSwatchShadow,
453
+ borderRadius: colorSwatchBorderRadius,
454
+ applyBorders: colorSwatchApplyBorders,
455
+ borderColor: colorSwatch?.colorSwatchBorderColor,
456
+ borderWidth: colorSwatchBorderWidth,
457
+ }),
458
+ );
459
+ });
460
+
461
+ appendAsChildren(entryContainer, colorSwatchesContainer);
462
+ }
463
+
464
+ if (entryDataTypes.includes('badge') && badges && badges.length > 0) {
465
+ const badgesContainer = document.createElement('div');
466
+ badgesContainer.className =
467
+ badgesOrientation === 'horizontal'
468
+ ? 'gids-table-entry__common-items-container-horizontal'
469
+ : 'gids-table-entry__common-items-container-vertical';
470
+
471
+ badges.forEach((badge) => {
472
+ badgesContainer.appendChild(
473
+ GidsBadgeDom({
474
+ appearance: badge.badgeAppearance ?? 'information',
475
+ count: badge?.badgeCount ?? undefined,
476
+ accessibleText: badge?.badgeAccessibleText ?? '',
477
+ type: badge?.badgeType ?? 'dot',
478
+ outline: badge?.badgeOutline ?? true,
479
+ }),
480
+ );
481
+ });
482
+
483
+ appendAsChildren(entryContainer, badgesContainer);
484
+ }
485
+
486
+ if (trailingActions && trailingActions.length > 0) {
487
+ const entrySecondaryActionBtnContainer = document.createElement('div');
488
+ entrySecondaryActionBtnContainer.className =
489
+ 'gids-table-entry__trailing-actions-container';
490
+
491
+ Array.from({ length: trailingActions.length }, (_, indexJ) => {
492
+ const entrySecondaryActionBtn = trailingActions[indexJ];
493
+ const entryActionBtnVisible = isTableEntryActionButtonVisible<
494
+ IconName,
495
+ IconAppearance
496
+ >(entrySecondaryActionBtn);
497
+ if (entryActionBtnVisible) {
498
+ entrySecondaryActionBtnContainer.append(
499
+ makeEntryActionButton({
500
+ entryActionBtn: entrySecondaryActionBtn,
501
+ actionIndex: indexJ,
502
+ actionPosition: 'trailing',
503
+ }),
504
+ );
505
+ }
506
+ });
507
+
508
+ entryContainer.appendChild(entrySecondaryActionBtnContainer);
509
+ }
510
+
511
+ appendAsChildren(tableEntry, entryContainer);
512
+ }
513
+
514
+ return tableEntry;
515
+ };
@@ -0,0 +1,157 @@
1
+ import {
2
+ GidsTableEntryTypographyStyle,
3
+ GidsTableFooterWebUtils,
4
+ isValidChildren,
5
+ type GidsTableFooterWebProps,
6
+ } from '@ganpatiinfo/gids-web-shared';
7
+ import {
8
+ IconAppearance,
9
+ IconName,
10
+ } from '@ganpatiinfo/gids-web-theme-interface';
11
+ import { appendAsChildren, DomChildren } from '../../utils/domUtils';
12
+ import { GidsTableFooterActionEvent } from '@ganpatiinfo/gids-core-shared';
13
+ import { GidsTableRowDom } from '../GidsTableRow/GidsTableRow';
14
+ import { GidsTableFooterControlDom } from '../GidsTableFooterControl/GidsTableFooterControl';
15
+ import { GidsTableEntryDom } from '../GidsTableEntry/GidsTableEntry';
16
+
17
+ const { getGidsTableFooterClassNames } = GidsTableFooterWebUtils;
18
+
19
+ export type GidsTableFooterNativeInputForwardedDomProps = Partial<
20
+ Omit<HTMLInputElement, 'value' | 'readOnly' | 'name' | 'disabled'>
21
+ >;
22
+
23
+ export type GidsTableFooterBaseWebProps = GidsTableFooterWebProps<
24
+ GidsTableEntryTypographyStyle,
25
+ IconName,
26
+ IconAppearance,
27
+ DomChildren,
28
+ DomChildren,
29
+ GidsTableFooterNativeInputForwardedDomProps,
30
+ Event
31
+ >;
32
+
33
+ export type GidsTableFooterActionBaseEvent = GidsTableFooterActionEvent<
34
+ Event,
35
+ GidsTableEntryTypographyStyle,
36
+ IconName,
37
+ IconAppearance
38
+ >;
39
+
40
+ export interface GidsTableFooterDomProps extends GidsTableFooterBaseWebProps {
41
+ extraClasses?: string;
42
+ onFooterAction?: (event: GidsTableFooterActionBaseEvent) => void;
43
+ }
44
+
45
+ export const GidsTableFooterDom = ({
46
+ // Table Entry Props
47
+ appearance = 'none',
48
+ labelTypography = 'label-medium',
49
+ textAlignment = 'center',
50
+ leadingActions = [],
51
+ trailingActions = [],
52
+ entryAlignment = 'center',
53
+ colorSwatchLabelColor = 'default',
54
+ colorSwatchLabelPosition = 'left',
55
+ colorSwatchLabelTypography = 'label-medium',
56
+ colorSwatchSize = 'sm',
57
+ colorSwatchShape = 'oval',
58
+ colorSwatchShadow = 'shadow-overlay',
59
+ colorSwatchBorderRadius = 'none',
60
+ colorSwatchApplyBorders = true,
61
+ colorSwatchBorderWidth = 'thick',
62
+ progressBarSize = 'sm',
63
+ progressBarEndCap = true,
64
+ avatarSize = 'sm',
65
+ avatarGroupAppearance = 'spread',
66
+ avatarGroupLayout = 'wrap',
67
+ statusTagAppearance = 'subtle',
68
+ statusTagSize = 'sm',
69
+ progressBarContainerMinWidth = 200,
70
+ displayTagsOrientation = 'horizontal',
71
+ statusTagsOrientation = 'horizontal',
72
+ progressBarsOrientation = 'horizontal',
73
+ colorSwatchesOrientation = 'horizontal',
74
+ badgesOrientation = 'horizontal',
75
+
76
+ // Footer Props
77
+ footerControlSettings,
78
+ footerControlChildren,
79
+ children,
80
+ footerItems,
81
+ onFooterAction,
82
+ extraClasses,
83
+ }: GidsTableFooterDomProps) => {
84
+ const tableFooter = document.createElement('tfoot');
85
+ tableFooter.className = getGidsTableFooterClassNames(extraClasses);
86
+
87
+ if (isValidChildren<DomChildren>(children)) {
88
+ appendAsChildren(tableFooter, children);
89
+ } else {
90
+ if (footerItems && footerItems.length > 0) {
91
+ const rowContent = GidsTableRowDom({
92
+ rows: footerItems,
93
+ rowType: 'footer',
94
+ leadingActions,
95
+ trailingActions,
96
+ entryAlignment,
97
+ colorSwatchLabelColor,
98
+ colorSwatchLabelPosition,
99
+ colorSwatchLabelTypography,
100
+ colorSwatchSize,
101
+ colorSwatchShape,
102
+ colorSwatchShadow,
103
+ colorSwatchBorderRadius,
104
+ colorSwatchApplyBorders,
105
+ colorSwatchBorderWidth,
106
+ progressBarSize,
107
+ progressBarEndCap,
108
+ avatarSize,
109
+ avatarGroupAppearance,
110
+ avatarGroupLayout,
111
+ statusTagAppearance,
112
+ statusTagSize,
113
+ progressBarContainerMinWidth,
114
+ displayTagsOrientation,
115
+ statusTagsOrientation,
116
+ progressBarsOrientation,
117
+ colorSwatchesOrientation,
118
+ badgesOrientation,
119
+ textAlignment,
120
+ labelTypography,
121
+ appearance,
122
+ onRowAction: onFooterAction,
123
+ });
124
+
125
+ tableFooter.append(rowContent);
126
+ }
127
+ }
128
+
129
+ const isValidFooterChildren = isValidChildren<DomChildren>(
130
+ footerControlChildren,
131
+ );
132
+
133
+ if (
134
+ isValidFooterChildren ||
135
+ (footerControlSettings && Object.keys(footerControlSettings).length > 0)
136
+ ) {
137
+ const colSpan = footerItems?.length ?? 1;
138
+
139
+ tableFooter.append(
140
+ GidsTableRowDom({
141
+ appearance,
142
+ rowType: 'footer',
143
+ children: GidsTableEntryDom({
144
+ appearance,
145
+ colSpan,
146
+ entryType: 'footer',
147
+ children: GidsTableFooterControlDom({
148
+ ...footerControlSettings,
149
+ children: footerControlChildren,
150
+ }),
151
+ }),
152
+ }),
153
+ );
154
+ }
155
+
156
+ return tableFooter;
157
+ };