@ganpatiinfo/gids-web-dom-reference 13.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 +47 -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 +20 -0
- package/dist/components/GidsMatrixTable/GidsMatrixTable.d.ts.map +1 -1
- package/dist/components/GidsMatrixTable/GidsMatrixTable.js +5 -0
- package/dist/components/GidsMatrixTable/GidsMatrixTable.js.map +1 -1
- package/dist/components/GidsMatrixTableBody/GidsMatrixTableBody.d.ts +20 -0
- package/dist/components/GidsMatrixTableBody/GidsMatrixTableBody.d.ts.map +1 -1
- package/dist/components/GidsMatrixTableBody/GidsMatrixTableBody.js +5 -0
- package/dist/components/GidsMatrixTableBody/GidsMatrixTableBody.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/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 +1 -1
- package/dist/components/GidsTable/GidsTable.d.ts.map +1 -1
- package/dist/components/GidsTable/GidsTable.js +27 -2
- package/dist/components/GidsTable/GidsTable.js.map +1 -1
- package/dist/components/GidsTableFooter/GidsTableFooter.d.ts +2 -2
- package/dist/components/GidsTableFooter/GidsTableFooter.d.ts.map +1 -1
- package/dist/components/GidsTableFooter/GidsTableFooter.js +2 -24
- package/dist/components/GidsTableFooter/GidsTableFooter.js.map +1 -1
- package/dist/components/GidsTableFooterControl/GidsTableFooterControl.d.ts +1 -1
- package/dist/components/GidsTableFooterControl/GidsTableFooterControl.d.ts.map +1 -1
- package/dist/components/GidsTableFooterControl/GidsTableFooterControl.js +5 -3
- package/dist/components/GidsTableFooterControl/GidsTableFooterControl.js.map +1 -1
- package/dist/components/GidsTableHeader/GidsTableHeader.d.ts +1 -1
- package/dist/components/GidsTableHeader/GidsTableHeader.d.ts.map +1 -1
- package/dist/components/GidsTableHeader/GidsTableHeader.js +1 -3
- package/dist/components/GidsTableHeader/GidsTableHeader.js.map +1 -1
- package/dist/components/GidsTableRow/GidsTableRow.d.ts +1 -1
- package/dist/components/GidsTableRow/GidsTableRow.d.ts.map +1 -1
- package/dist/components/GidsTableRow/GidsTableRow.js +3 -3
- package/dist/components/GidsTableRow/GidsTableRow.js.map +1 -1
- 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/index.d.ts +115 -108
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +115 -108
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- 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 +20 -0
- package/src/components/GidsMatrixTableBody/GidsMatrixTableBody.ts +21 -0
- package/src/components/GidsMenu/GidsMenu.ts +15 -0
- package/src/components/GidsSkeleton/GidsSkeleton.ts +40 -0
- package/src/components/GidsTable/GidsTable.ts +41 -4
- package/src/components/GidsTableFooter/GidsTableFooter.ts +1 -39
- package/src/components/GidsTableFooterControl/GidsTableFooterControl.ts +9 -2
- package/src/components/GidsTableHeader/GidsTableHeader.ts +0 -4
- package/src/components/GidsTableRow/GidsTableRow.ts +2 -4
- package/src/components/GidsTransferList/GidsTransferList.ts +58 -0
- package/src/components/_GidsDialogControl/GidsDialogControl.ts +198 -0
- package/src/index.ts +115 -108
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GidsCrossTableRowWebProps,
|
|
3
|
+
GidsTableEntryTypographyStyle,
|
|
4
|
+
GidsCrossTableRowWebUtils,
|
|
5
|
+
isValidChildren,
|
|
6
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
7
|
+
import {
|
|
8
|
+
IconAppearance,
|
|
9
|
+
IconName,
|
|
10
|
+
} from '@ganpatiinfo/gids-web-theme-interface';
|
|
11
|
+
import { DomChildren, appendAsChildren } from '../../utils/domUtils';
|
|
12
|
+
import {
|
|
13
|
+
GidsTableEntryActionBaseEvent,
|
|
14
|
+
GidsTableEntryDom,
|
|
15
|
+
} from '../GidsTableEntry/GidsTableEntry';
|
|
16
|
+
import { GidsCrossTableRowActionEvent } from '@ganpatiinfo/gids-core-shared';
|
|
17
|
+
|
|
18
|
+
const { getGidsCrossTableRowClassNames } = GidsCrossTableRowWebUtils;
|
|
19
|
+
|
|
20
|
+
type GidsCrossTableRowBaseWebProps = GidsCrossTableRowWebProps<
|
|
21
|
+
GidsTableEntryTypographyStyle,
|
|
22
|
+
IconName,
|
|
23
|
+
IconAppearance,
|
|
24
|
+
DomChildren
|
|
25
|
+
>;
|
|
26
|
+
export type GidsCrossTableRowActionBaseEvent = GidsCrossTableRowActionEvent<
|
|
27
|
+
Event,
|
|
28
|
+
GidsTableEntryTypographyStyle,
|
|
29
|
+
IconName,
|
|
30
|
+
IconAppearance
|
|
31
|
+
>;
|
|
32
|
+
|
|
33
|
+
export interface GidsCrossTableRowDomProps extends GidsCrossTableRowBaseWebProps {
|
|
34
|
+
extraClasses?: string;
|
|
35
|
+
onCrossTableRowAction?: (event: GidsCrossTableRowActionBaseEvent) => void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const GidsCrossTableRowDom = ({
|
|
39
|
+
rows = [],
|
|
40
|
+
crossHeaderItem,
|
|
41
|
+
crossHeaderSettings,
|
|
42
|
+
onCrossTableRowAction,
|
|
43
|
+
textAlignment = 'center',
|
|
44
|
+
appearance = 'none',
|
|
45
|
+
labelTypography = 'label-medium',
|
|
46
|
+
entryAlignment = 'center',
|
|
47
|
+
colorSwatchLabelColor = 'default',
|
|
48
|
+
colorSwatchLabelPosition = 'left',
|
|
49
|
+
colorSwatchLabelTypography = 'label-medium',
|
|
50
|
+
colorSwatchSize = 'sm',
|
|
51
|
+
colorSwatchShape = 'oval',
|
|
52
|
+
colorSwatchShadow = 'shadow-overlay',
|
|
53
|
+
colorSwatchBorderRadius = 'none',
|
|
54
|
+
colorSwatchApplyBorders = true,
|
|
55
|
+
colorSwatchBorderWidth = 'thick',
|
|
56
|
+
progressBarSize = 'sm',
|
|
57
|
+
progressBarEndCap = true,
|
|
58
|
+
avatarSize = 'sm',
|
|
59
|
+
avatarGroupAppearance,
|
|
60
|
+
avatarGroupLayout,
|
|
61
|
+
statusTagAppearance = 'subtle',
|
|
62
|
+
statusTagSize = 'sm',
|
|
63
|
+
progressBarContainerMinWidth = 200,
|
|
64
|
+
displayTagsOrientation = 'horizontal',
|
|
65
|
+
statusTagsOrientation = 'horizontal',
|
|
66
|
+
progressBarsOrientation = 'horizontal',
|
|
67
|
+
colorSwatchesOrientation = 'horizontal',
|
|
68
|
+
badgesOrientation = 'horizontal',
|
|
69
|
+
actionsBackgroundColor,
|
|
70
|
+
actionsContentColor,
|
|
71
|
+
backgroundColor,
|
|
72
|
+
contentColor,
|
|
73
|
+
children,
|
|
74
|
+
extraClasses,
|
|
75
|
+
}: GidsCrossTableRowDomProps): HTMLTableRowElement => {
|
|
76
|
+
const crossTableRow = document.createElement('tr');
|
|
77
|
+
crossTableRow.className = getGidsCrossTableRowClassNames(extraClasses);
|
|
78
|
+
|
|
79
|
+
if (isValidChildren<DomChildren>(children)) {
|
|
80
|
+
appendAsChildren(crossTableRow, children);
|
|
81
|
+
|
|
82
|
+
return crossTableRow;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function onEntryActionBtnClick({
|
|
86
|
+
event,
|
|
87
|
+
entryIndex,
|
|
88
|
+
}: {
|
|
89
|
+
event: GidsTableEntryActionBaseEvent;
|
|
90
|
+
entryIndex: number;
|
|
91
|
+
}) {
|
|
92
|
+
if (onCrossTableRowAction) {
|
|
93
|
+
onCrossTableRowAction({
|
|
94
|
+
...event,
|
|
95
|
+
details: {
|
|
96
|
+
...event.details,
|
|
97
|
+
entryIndex,
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/*
|
|
104
|
+
* Cross Header
|
|
105
|
+
*
|
|
106
|
+
* IMPORTANT:
|
|
107
|
+
* Cross header settings are completely independent
|
|
108
|
+
* from the body row settings.
|
|
109
|
+
*/
|
|
110
|
+
if (crossHeaderItem && Object.keys(crossHeaderItem).length > 0) {
|
|
111
|
+
crossTableRow.append(
|
|
112
|
+
GidsTableEntryDom({
|
|
113
|
+
...crossHeaderItem,
|
|
114
|
+
...crossHeaderSettings,
|
|
115
|
+
label: crossHeaderItem?.label,
|
|
116
|
+
entryType: 'header',
|
|
117
|
+
/*
|
|
118
|
+
* Cross header uses its own settings first.
|
|
119
|
+
*/
|
|
120
|
+
leadingActions: crossHeaderItem?.leadingActions ?? [],
|
|
121
|
+
trailingActions: crossHeaderItem?.trailingActions ?? [],
|
|
122
|
+
entryAlignment: crossHeaderSettings?.entryAlignment ?? 'center',
|
|
123
|
+
colorSwatchLabelColor:
|
|
124
|
+
crossHeaderSettings?.colorSwatchLabelColor ?? 'default',
|
|
125
|
+
colorSwatchLabelPosition:
|
|
126
|
+
crossHeaderSettings?.colorSwatchLabelPosition ?? 'left',
|
|
127
|
+
colorSwatchLabelTypography:
|
|
128
|
+
crossHeaderSettings?.colorSwatchLabelTypography ?? 'label-medium',
|
|
129
|
+
colorSwatchSize: crossHeaderSettings?.colorSwatchSize ?? 'sm',
|
|
130
|
+
colorSwatchShape: crossHeaderSettings?.colorSwatchShape ?? 'oval',
|
|
131
|
+
colorSwatchShadow:
|
|
132
|
+
crossHeaderSettings?.colorSwatchShadow ?? 'shadow-overlay',
|
|
133
|
+
colorSwatchBorderRadius:
|
|
134
|
+
crossHeaderSettings?.colorSwatchBorderRadius ?? 'none',
|
|
135
|
+
colorSwatchApplyBorders:
|
|
136
|
+
crossHeaderSettings?.colorSwatchApplyBorders ?? true,
|
|
137
|
+
colorSwatchBorderWidth:
|
|
138
|
+
crossHeaderSettings?.colorSwatchBorderWidth ?? 'thick',
|
|
139
|
+
progressBarSize: crossHeaderSettings?.progressBarSize ?? 'sm',
|
|
140
|
+
progressBarEndCap: crossHeaderSettings?.progressBarEndCap ?? true,
|
|
141
|
+
avatarSize: crossHeaderSettings?.avatarSize ?? 'sm',
|
|
142
|
+
avatarGroupAppearance:
|
|
143
|
+
crossHeaderSettings?.avatarGroupAppearance ?? 'spread',
|
|
144
|
+
avatarGroupLayout: crossHeaderSettings?.avatarGroupLayout ?? 'wrap',
|
|
145
|
+
statusTagAppearance:
|
|
146
|
+
crossHeaderSettings?.statusTagAppearance ?? 'subtle',
|
|
147
|
+
statusTagSize: crossHeaderSettings?.statusTagSize ?? 'sm',
|
|
148
|
+
progressBarContainerMinWidth:
|
|
149
|
+
crossHeaderSettings?.progressBarContainerMinWidth ?? 200,
|
|
150
|
+
displayTagsOrientation:
|
|
151
|
+
crossHeaderSettings?.displayTagsOrientation ?? 'horizontal',
|
|
152
|
+
statusTagsOrientation:
|
|
153
|
+
crossHeaderSettings?.statusTagsOrientation ?? 'horizontal',
|
|
154
|
+
progressBarsOrientation:
|
|
155
|
+
crossHeaderSettings?.progressBarsOrientation ?? 'horizontal',
|
|
156
|
+
colorSwatchesOrientation:
|
|
157
|
+
crossHeaderSettings?.colorSwatchesOrientation ?? 'horizontal',
|
|
158
|
+
badgesOrientation:
|
|
159
|
+
crossHeaderSettings?.badgesOrientation ?? 'horizontal',
|
|
160
|
+
textAlignment: crossHeaderSettings?.textAlignment ?? 'center',
|
|
161
|
+
labelTypography: crossHeaderSettings?.labelTypography ?? 'label-medium',
|
|
162
|
+
appearance: crossHeaderSettings?.appearance ?? 'none',
|
|
163
|
+
/*
|
|
164
|
+
* Most importantly, colors come from crossHeaderSettings,
|
|
165
|
+
* never from the body row.
|
|
166
|
+
*/
|
|
167
|
+
onEntryAction: (event: GidsTableEntryActionBaseEvent) =>
|
|
168
|
+
onEntryActionBtnClick({
|
|
169
|
+
event,
|
|
170
|
+
entryIndex: -1,
|
|
171
|
+
}),
|
|
172
|
+
}),
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/*
|
|
177
|
+
* Body Cells
|
|
178
|
+
*
|
|
179
|
+
* These continue using the normal row settings.
|
|
180
|
+
*/
|
|
181
|
+
if (rows && rows.length > 0) {
|
|
182
|
+
rows.forEach((row, index) => {
|
|
183
|
+
crossTableRow.append(
|
|
184
|
+
GidsTableEntryDom({
|
|
185
|
+
...row,
|
|
186
|
+
entryType: 'body',
|
|
187
|
+
leadingActions: row?.leadingActions ?? [],
|
|
188
|
+
trailingActions: row?.trailingActions ?? [],
|
|
189
|
+
entryAlignment,
|
|
190
|
+
colorSwatchLabelColor,
|
|
191
|
+
colorSwatchLabelPosition,
|
|
192
|
+
colorSwatchLabelTypography,
|
|
193
|
+
colorSwatchSize,
|
|
194
|
+
colorSwatchShape,
|
|
195
|
+
colorSwatchShadow,
|
|
196
|
+
colorSwatchBorderRadius,
|
|
197
|
+
colorSwatchApplyBorders,
|
|
198
|
+
colorSwatchBorderWidth,
|
|
199
|
+
progressBarSize,
|
|
200
|
+
progressBarEndCap,
|
|
201
|
+
avatarSize,
|
|
202
|
+
avatarGroupAppearance,
|
|
203
|
+
avatarGroupLayout,
|
|
204
|
+
statusTagAppearance,
|
|
205
|
+
statusTagSize,
|
|
206
|
+
progressBarContainerMinWidth,
|
|
207
|
+
displayTagsOrientation,
|
|
208
|
+
statusTagsOrientation,
|
|
209
|
+
progressBarsOrientation,
|
|
210
|
+
colorSwatchesOrientation,
|
|
211
|
+
badgesOrientation,
|
|
212
|
+
textAlignment,
|
|
213
|
+
labelTypography,
|
|
214
|
+
appearance,
|
|
215
|
+
backgroundColor,
|
|
216
|
+
contentColor,
|
|
217
|
+
actionsBackgroundColor,
|
|
218
|
+
actionsContentColor,
|
|
219
|
+
onEntryAction: (event: GidsTableEntryActionBaseEvent) =>
|
|
220
|
+
onEntryActionBtnClick({
|
|
221
|
+
event,
|
|
222
|
+
entryIndex: index,
|
|
223
|
+
}),
|
|
224
|
+
}),
|
|
225
|
+
);
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return crossTableRow;
|
|
230
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GidsDialogWebUtils,
|
|
3
|
+
type GidsDialogWebProps,
|
|
4
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
5
|
+
import { DomNodeOrString } from '../../utils/domUtils.js';
|
|
6
|
+
import {
|
|
7
|
+
IconAppearance,
|
|
8
|
+
IconName,
|
|
9
|
+
} from '@ganpatiinfo/gids-web-theme-interface';
|
|
10
|
+
import { GidsDialogControlDom } from '../_GidsDialogControl/GidsDialogControl.js';
|
|
11
|
+
import { GidsDialogControlCloseEvent } from '@ganpatiinfo/gids-core-shared';
|
|
12
|
+
|
|
13
|
+
const { getGidsDialogClassNames } = GidsDialogWebUtils;
|
|
14
|
+
|
|
15
|
+
type GidsDialogBaseWebProps = GidsDialogWebProps<
|
|
16
|
+
DomNodeOrString,
|
|
17
|
+
Event,
|
|
18
|
+
IconName,
|
|
19
|
+
IconAppearance
|
|
20
|
+
>;
|
|
21
|
+
|
|
22
|
+
// 1. Create a custom type that represents your modified element
|
|
23
|
+
export type GidsDialogCustomElement = HTMLDialogElement & {
|
|
24
|
+
element: HTMLDialogElement;
|
|
25
|
+
open: (parent?: HTMLElement) => void;
|
|
26
|
+
close: () => void;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type GidsDialogDomProps = GidsDialogBaseWebProps;
|
|
30
|
+
|
|
31
|
+
export const GidsDialogDom = ({
|
|
32
|
+
variant = 'alert',
|
|
33
|
+
maxWidth = 'sm',
|
|
34
|
+
scrollMode = 'paper',
|
|
35
|
+
draggable = false,
|
|
36
|
+
headerTitle,
|
|
37
|
+
closeVisible = true,
|
|
38
|
+
children,
|
|
39
|
+
footerActions = [],
|
|
40
|
+
headerDividerVisible = false,
|
|
41
|
+
footerDividerVisible = false,
|
|
42
|
+
transition = 'none',
|
|
43
|
+
cancellable,
|
|
44
|
+
onCloseDialog,
|
|
45
|
+
onDialogFooterAction,
|
|
46
|
+
}: GidsDialogDomProps): GidsDialogCustomElement => {
|
|
47
|
+
const nativeClose = HTMLDialogElement.prototype.close;
|
|
48
|
+
|
|
49
|
+
function executeClose(event: GidsDialogControlCloseEvent<Event>) {
|
|
50
|
+
if (onCloseDialog) {
|
|
51
|
+
onCloseDialog({ originalEvent: event?.originalEvent });
|
|
52
|
+
}
|
|
53
|
+
dialog.close();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// 1. Generate the pristine native dialog instance directly from the control function
|
|
57
|
+
const dialog = GidsDialogControlDom({
|
|
58
|
+
variant,
|
|
59
|
+
maxWidth,
|
|
60
|
+
scrollMode,
|
|
61
|
+
draggable,
|
|
62
|
+
headerTitle,
|
|
63
|
+
closeVisible,
|
|
64
|
+
children,
|
|
65
|
+
footerActions,
|
|
66
|
+
headerDividerVisible,
|
|
67
|
+
footerDividerVisible,
|
|
68
|
+
onCloseDialogControl: executeClose,
|
|
69
|
+
onDialogControlFooterAction: onDialogFooterAction,
|
|
70
|
+
}) as unknown as GidsDialogCustomElement;
|
|
71
|
+
|
|
72
|
+
// 2. CRITICAL BODY SCROLL PROTECTION: Inject layout protections inline immediately
|
|
73
|
+
if (scrollMode === 'body') {
|
|
74
|
+
dialog.style.setProperty('position', 'absolute', 'important');
|
|
75
|
+
dialog.style.setProperty('max-height', 'none', 'important');
|
|
76
|
+
dialog.style.setProperty('overflow', 'visible', 'important');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// 3. RESTORED: Backdrop-only click cancellation logic for DOM target implementation
|
|
80
|
+
if (cancellable) {
|
|
81
|
+
dialog.addEventListener('click', (event: MouseEvent) => {
|
|
82
|
+
if (event.target === dialog) {
|
|
83
|
+
const rect = dialog.getBoundingClientRect();
|
|
84
|
+
const isOutside =
|
|
85
|
+
event.clientX < rect.left ||
|
|
86
|
+
event.clientX > rect.right ||
|
|
87
|
+
event.clientY < rect.top ||
|
|
88
|
+
event.clientY > rect.bottom;
|
|
89
|
+
|
|
90
|
+
if (isOutside) {
|
|
91
|
+
executeClose({ originalEvent: event });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
dialog.element = dialog as unknown as HTMLDialogElement;
|
|
98
|
+
|
|
99
|
+
// 4. Overwrite orchestration controllers cleanly via Object.defineProperty
|
|
100
|
+
Object.defineProperty(dialog, 'open', {
|
|
101
|
+
value: (parent: HTMLElement = document.body) => {
|
|
102
|
+
// Append the node directly to the DOM tree first
|
|
103
|
+
if (!dialog.isConnected) {
|
|
104
|
+
parent.appendChild(dialog);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (scrollMode === 'body') {
|
|
108
|
+
document.body.style.overflow = 'hidden';
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Add base classes and transition modifiers ONLY when open() runs to stop the jumping bug
|
|
112
|
+
dialog.classList.add('gids-dialog');
|
|
113
|
+
|
|
114
|
+
const transitionClasses = getGidsDialogClassNames({ transition });
|
|
115
|
+
if (transitionClasses) {
|
|
116
|
+
transitionClasses.split(' ').forEach((className) => {
|
|
117
|
+
if (className.trim()) {
|
|
118
|
+
dialog.classList.add(className.trim());
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Force a quick layout reflow to initialize your animation coordinates perfectly
|
|
124
|
+
void dialog.offsetHeight;
|
|
125
|
+
|
|
126
|
+
// Open modal cleanly on the top layer
|
|
127
|
+
dialog.showModal();
|
|
128
|
+
},
|
|
129
|
+
writable: true,
|
|
130
|
+
configurable: true,
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
Object.defineProperty(dialog, 'close', {
|
|
134
|
+
value: () => {
|
|
135
|
+
if (scrollMode === 'body') {
|
|
136
|
+
document.body.style.overflow = '';
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Clean up all added classes on close so they completely reset for the next run
|
|
140
|
+
dialog.classList.remove('gids-dialog');
|
|
141
|
+
const transitionClasses = getGidsDialogClassNames({ transition });
|
|
142
|
+
if (transitionClasses) {
|
|
143
|
+
transitionClasses.split(' ').forEach((className) => {
|
|
144
|
+
if (className.trim()) {
|
|
145
|
+
dialog.classList.remove(className.trim());
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
nativeClose.call(dialog);
|
|
151
|
+
|
|
152
|
+
if (dialog.isConnected) {
|
|
153
|
+
dialog.remove();
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
writable: true,
|
|
157
|
+
configurable: true,
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
return dialog;
|
|
161
|
+
};
|
|
@@ -21,12 +21,22 @@ const {
|
|
|
21
21
|
getMatrixTableClasses,
|
|
22
22
|
} = GidsMatrixTableWebUtils;
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated
|
|
26
|
+
*
|
|
27
|
+
* Use `GidsCrossTable` and its props and functions instead.
|
|
28
|
+
*/
|
|
24
29
|
type GidsMatrixTableBaseWebProps = GidsMatrixTableWebProps<
|
|
25
30
|
GidsTableCellTypographyStyle,
|
|
26
31
|
IconName,
|
|
27
32
|
IconAppearance
|
|
28
33
|
>;
|
|
29
34
|
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated
|
|
37
|
+
*
|
|
38
|
+
* Use `GidsCrossTable` and its props and functions instead.
|
|
39
|
+
*/
|
|
30
40
|
type GidsMatrixTableActionButtonBaseEvent =
|
|
31
41
|
GidsMatrixTableBodyActionButtonEvent<
|
|
32
42
|
Event,
|
|
@@ -35,6 +45,11 @@ type GidsMatrixTableActionButtonBaseEvent =
|
|
|
35
45
|
IconAppearance
|
|
36
46
|
>;
|
|
37
47
|
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated
|
|
50
|
+
*
|
|
51
|
+
* Use `GidsCrossTable` and its props and functions instead.
|
|
52
|
+
*/
|
|
38
53
|
export interface GidsMatrixTableDomProps extends GidsMatrixTableBaseWebProps {
|
|
39
54
|
extraClasses?: string;
|
|
40
55
|
onClickMatrixTableActionBtn?: (
|
|
@@ -42,6 +57,11 @@ export interface GidsMatrixTableDomProps extends GidsMatrixTableBaseWebProps {
|
|
|
42
57
|
) => void;
|
|
43
58
|
}
|
|
44
59
|
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated
|
|
62
|
+
*
|
|
63
|
+
* Use `GidsCrossTable` and its props and functions instead.
|
|
64
|
+
*/
|
|
45
65
|
export const GidsMatrixTableDom = ({
|
|
46
66
|
topHeaderCells = [],
|
|
47
67
|
tableBodyItems = [],
|
|
@@ -20,11 +20,22 @@ import {
|
|
|
20
20
|
const { getGidsMatrixTableBodyClassNames, getConstructedMatrixTableBodyItems } =
|
|
21
21
|
GidsMatrixTableBodyWebUtils;
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated
|
|
25
|
+
*
|
|
26
|
+
* Use `GidsCrossTableBody` and its props and functions instead.
|
|
27
|
+
*/
|
|
23
28
|
type GidsMatrixTableBodyBaseWebProps = GidsMatrixTableBodyWebProps<
|
|
24
29
|
GidsTableCellTypographyStyle,
|
|
25
30
|
IconName,
|
|
26
31
|
IconAppearance
|
|
27
32
|
>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated
|
|
36
|
+
*
|
|
37
|
+
* Use `GidsCrossTableBody` and its props and functions instead.
|
|
38
|
+
*/
|
|
28
39
|
export type GidsMatrixTableBodyActionButtonBaseEvent =
|
|
29
40
|
GidsMatrixTableBodyActionButtonEvent<
|
|
30
41
|
Event,
|
|
@@ -33,6 +44,11 @@ export type GidsMatrixTableBodyActionButtonBaseEvent =
|
|
|
33
44
|
IconAppearance
|
|
34
45
|
>;
|
|
35
46
|
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated
|
|
49
|
+
*
|
|
50
|
+
* Use `GidsCrossTableBody` and its props and functions instead.
|
|
51
|
+
*/
|
|
36
52
|
export interface GidsMatrixTableBodyDomProps extends GidsMatrixTableBodyBaseWebProps {
|
|
37
53
|
extraClasses?: string;
|
|
38
54
|
onClickMatrixBodyCellActionBtn?: (
|
|
@@ -40,6 +56,11 @@ export interface GidsMatrixTableBodyDomProps extends GidsMatrixTableBodyBaseWebP
|
|
|
40
56
|
) => void;
|
|
41
57
|
}
|
|
42
58
|
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated
|
|
61
|
+
*
|
|
62
|
+
* Use `GidsCrossTableBody` and its props and functions instead.
|
|
63
|
+
*/
|
|
43
64
|
export const GidsMatrixTableBodyDom = ({
|
|
44
65
|
width = 'full',
|
|
45
66
|
tableBodyItems = [],
|
|
@@ -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';
|