@absreim/react-bootstrap-data-grid 3.0.0 → 4.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/common/constants.d.ts +2 -0
- package/common/constants.js +2 -0
- package/common/editing/types.d.ts +7 -0
- package/{filtering → common/filtering}/FilterOptionsTable.d.ts +4 -4
- package/{filtering → common/filtering}/types.d.ts +6 -6
- package/common/filtering/useFilterFormState.d.ts +3 -0
- package/{index.d.ts → common/index.d.ts} +8 -7
- package/{index.js → common/index.js} +8 -7
- package/{pagination → common/pagination}/PageSelector.d.ts +1 -1
- package/{pagination → common/pagination}/PageSizeSelector.d.ts +1 -1
- package/{pagination → common/pagination}/types.d.ts +2 -1
- package/{pipeline → common/pipeline}/useAugFormattedRows.d.ts +1 -1
- package/common/pipeline/useColNameToWidth.d.ts +3 -0
- package/common/pipeline/useColNameToWidth.js +12 -0
- package/{pipeline → common/pipeline}/useCombinedPipeline/index.d.ts +4 -4
- package/{pipeline → common/pipeline}/useCombinedPipeline/useCurrentPageRows.d.ts +1 -1
- package/{pipeline → common/pipeline}/useCombinedPipeline/useDisplayRows.d.ts +1 -1
- package/{pipeline → common/pipeline}/useCombinedPipeline/useDisplayRows.js +1 -2
- package/common/pipeline/useCombinedPipeline/useFilter.d.ts +4 -0
- package/common/pipeline/useCombinedPipeline/useFilterStateFromEditable.d.ts +4 -0
- package/{pipeline → common/pipeline}/useCombinedPipeline/useSortedRows.d.ts +2 -2
- package/{pipeline → common/pipeline}/useGridSelectionFns.d.ts +2 -2
- package/{sorting → common/sorting}/types.d.ts +3 -3
- package/{main/ColHeaderCell → common/sorting}/useSortHeaderStates.d.ts +2 -2
- package/{main/ColHeaderCell → common/sorting}/useSortHeaderStates.js +4 -4
- package/common/styling/types.d.ts +21 -0
- package/{types.d.ts → common/types.d.ts} +21 -30
- package/common/util/index.d.ts +5 -0
- package/common/util/index.js +5 -0
- package/community/index.d.ts +4 -0
- package/community/index.js +4 -0
- package/grid/constants.d.ts +2 -0
- package/grid/constants.js +2 -0
- package/grid/index.d.ts +3 -0
- package/grid/index.js +3 -0
- package/{Grid.d.ts → grid/main/Grid.d.ts} +0 -1
- package/grid/main/Grid.js +60 -0
- package/grid/main/GridBody.d.ts +4 -0
- package/grid/main/GridBody.js +17 -0
- package/grid/main/GridHeader.d.ts +4 -0
- package/grid/main/GridHeader.js +12 -0
- package/grid/main/getWidthStyles.d.ts +3 -0
- package/grid/main/getWidthStyles.js +6 -0
- package/grid/main/types.d.ts +32 -0
- package/grid/main/types.js +1 -0
- package/grid.css +1 -0
- package/grid.scss +231 -0
- package/package.json +1 -1
- package/{InternalGrid.d.ts → table/InternalTable.d.ts} +6 -6
- package/{InternalGrid.js → table/InternalTable.js} +7 -7
- package/table/Table.d.ts +5 -0
- package/{Grid.js → table/Table.js} +10 -17
- package/{editing → table/editing}/EditableRow.d.ts +1 -2
- package/{editing → table/editing}/EditableRow.js +2 -2
- package/table/index.d.ts +5 -0
- package/table/index.js +5 -0
- package/{main → table/main}/BodyRows.d.ts +7 -7
- package/{main → table/main}/BodyRows.js +1 -1
- package/{main → table/main}/ColHeaderCell/index.js +3 -3
- package/{selection → table/selection}/SelectAllHeaderCell.d.ts +1 -1
- package/{styling → table/styling}/types.d.ts +1 -21
- package/table/styling/types.js +1 -0
- package/table/types.d.ts +19 -0
- package/table/types.js +1 -0
- package/editing/types.d.ts +0 -16
- package/filtering/useFilterFormState.d.ts +0 -3
- package/main/ToggleButton.d.ts +0 -9
- package/main/ToggleButton.js +0 -14
- package/pipeline/useCombinedPipeline/useEditableFromFilterState.d.ts +0 -3
- package/pipeline/useCombinedPipeline/useEditableFromFilterState.js +0 -14
- package/pipeline/useCombinedPipeline/useFilter.d.ts +0 -4
- package/pipeline/useCombinedPipeline/useFilterStateFromEditable.d.ts +0 -4
- /package/{editing → common/editing}/inputStrsToRowData.d.ts +0 -0
- /package/{editing → common/editing}/inputStrsToRowData.js +0 -0
- /package/{editing → common/editing}/types.js +0 -0
- /package/{export → common/export}/ExportForm.d.ts +0 -0
- /package/{export → common/export}/ExportForm.js +0 -0
- /package/{export → common/export}/types.d.ts +0 -0
- /package/{export → common/export}/types.js +0 -0
- /package/{export → common/export}/useExportFn.d.ts +0 -0
- /package/{export → common/export}/useExportFn.js +0 -0
- /package/{filtering → common/filtering}/DateFilterRow.d.ts +0 -0
- /package/{filtering → common/filtering}/DateFilterRow.js +0 -0
- /package/{filtering → common/filtering}/FilterOptionsTable.js +0 -0
- /package/{filtering → common/filtering}/FilterRow.d.ts +0 -0
- /package/{filtering → common/filtering}/FilterRow.js +0 -0
- /package/{filtering → common/filtering}/NumberFilterRow.d.ts +0 -0
- /package/{filtering → common/filtering}/NumberFilterRow.js +0 -0
- /package/{filtering → common/filtering}/StringFilterRow.d.ts +0 -0
- /package/{filtering → common/filtering}/StringFilterRow.js +0 -0
- /package/{filtering → common/filtering}/types.js +0 -0
- /package/{filtering → common/filtering}/useFilterFormState.js +0 -0
- /package/{pagination → common/pagination}/PageSelector.js +0 -0
- /package/{pagination → common/pagination}/PageSizeSelector.js +0 -0
- /package/{pagination → common/pagination}/Pagination.d.ts +0 -0
- /package/{pagination → common/pagination}/Pagination.js +0 -0
- /package/{pagination → common/pagination}/types.js +0 -0
- /package/{pipeline → common/pipeline}/types.d.ts +0 -0
- /package/{pipeline → common/pipeline}/types.js +0 -0
- /package/{pipeline → common/pipeline}/useAugFormattedRows.js +0 -0
- /package/{pipeline → common/pipeline}/useCombinedPipeline/index.js +0 -0
- /package/{pipeline → common/pipeline}/useCombinedPipeline/useCurrentPageRows.js +0 -0
- /package/{pipeline → common/pipeline}/useCombinedPipeline/useFilter.js +0 -0
- /package/{pipeline → common/pipeline}/useCombinedPipeline/useFilterStateFromEditable.js +0 -0
- /package/{pipeline → common/pipeline}/useCombinedPipeline/useFilterStateStore.d.ts +0 -0
- /package/{pipeline → common/pipeline}/useCombinedPipeline/useFilterStateStore.js +0 -0
- /package/{pipeline → common/pipeline}/useCombinedPipeline/useSortedRows.js +0 -0
- /package/{pipeline → common/pipeline}/useGetInputStrSubmitCallback.d.ts +0 -0
- /package/{pipeline → common/pipeline}/useGetInputStrSubmitCallback.js +0 -0
- /package/{pipeline → common/pipeline}/useGridSelectionFns.js +0 -0
- /package/{selection → common/selection}/types.d.ts +0 -0
- /package/{selection → common/selection}/types.js +0 -0
- /package/{sorting → common/sorting}/arrowPlaceholder.d.ts +0 -0
- /package/{sorting → common/sorting}/arrowPlaceholder.js +0 -0
- /package/{sorting → common/sorting}/downArrow.d.ts +0 -0
- /package/{sorting → common/sorting}/downArrow.js +0 -0
- /package/{sorting → common/sorting}/sortOrderToAriaSort.d.ts +0 -0
- /package/{sorting → common/sorting}/sortOrderToAriaSort.js +0 -0
- /package/{sorting → common/sorting}/types.js +0 -0
- /package/{sorting → common/sorting}/upArrow.d.ts +0 -0
- /package/{sorting → common/sorting}/upArrow.js +0 -0
- /package/{styling → common/styling}/types.js +0 -0
- /package/{toolbar → common/toolbar}/Toolbar.d.ts +0 -0
- /package/{toolbar → common/toolbar}/Toolbar.js +0 -0
- /package/{toolbar → common/toolbar}/ToolbarContainer.d.ts +0 -0
- /package/{toolbar → common/toolbar}/ToolbarContainer.js +0 -0
- /package/{toolbar → common/toolbar}/types.d.ts +0 -0
- /package/{toolbar → common/toolbar}/types.js +0 -0
- /package/{toolbar → common/toolbar}/useInterfaces.d.ts +0 -0
- /package/{toolbar → common/toolbar}/useInterfaces.js +0 -0
- /package/{types.js → common/types.js} +0 -0
- /package/{util → common/util}/datetime.d.ts +0 -0
- /package/{util → common/util}/datetime.js +0 -0
- /package/{util → common/util}/getWidthStyle.d.ts +0 -0
- /package/{util → common/util}/getWidthStyle.js +0 -0
- /package/{util → common/util}/isSubset.d.ts +0 -0
- /package/{util → common/util}/isSubset.js +0 -0
- /package/{util → common/util}/trueModulo.d.ts +0 -0
- /package/{util → common/util}/trueModulo.js +0 -0
- /package/{util → common/util}/useControlledHover.d.ts +0 -0
- /package/{util → common/util}/useControlledHover.js +0 -0
- /package/{editing → table/editing}/EditControlsCell.d.ts +0 -0
- /package/{editing → table/editing}/EditControlsCell.js +0 -0
- /package/{main → table/main}/ColHeaderCell/index.d.ts +0 -0
- /package/{selection → table/selection}/SelectAllHeaderCell.js +0 -0
- /package/{selection → table/selection}/SelectionInput.d.ts +0 -0
- /package/{selection → table/selection}/SelectionInput.js +0 -0
- /package/{style.css → table.css} +0 -0
- /package/{style.scss → table.scss} +0 -0
package/grid.scss
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
@use "sass:color";
|
|
2
|
+
@use "sass:math";
|
|
3
|
+
|
|
4
|
+
$rbdg-prefix: "rbdg-";
|
|
5
|
+
|
|
6
|
+
.rbdg-grid > div,
|
|
7
|
+
.rbdg-grid > div > div,
|
|
8
|
+
.rbdg-grid > div > div > div {
|
|
9
|
+
border-color: inherit;
|
|
10
|
+
border-style: solid;
|
|
11
|
+
border-width: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// While these rules seem to work, the way that the three border modes, default; bordered; and borderless override each
|
|
15
|
+
// other is quite hard to understand.
|
|
16
|
+
// Consider refactoring so that each type mode, including default, has a separate class that contains rules for just
|
|
17
|
+
// that mode.
|
|
18
|
+
// The way that each border mode that interacts with dividers with quite complicated. Each combination should be tested
|
|
19
|
+
// separately.
|
|
20
|
+
|
|
21
|
+
.rbdg-grid {
|
|
22
|
+
// In Bootstrap's _tables.scss file, there are variable declarations here to reset some variables to the initial
|
|
23
|
+
// value to facilitate nesting of tables styled with Bootstrap's "table" CSS class. Unlike _tables.scss, there is no
|
|
24
|
+
// reset in this file because the RBDG flex grid is not meant to be nested.
|
|
25
|
+
|
|
26
|
+
--#{$rbdg-prefix}grid-color: #{$table-color};
|
|
27
|
+
--#{$rbdg-prefix}grid-bg: #{$table-bg};
|
|
28
|
+
--#{$rbdg-prefix}grid-border-color: #{$table-border-color};
|
|
29
|
+
--#{$rbdg-prefix}grid-accent-bg: #{$table-accent-bg};
|
|
30
|
+
--#{$rbdg-prefix}grid-striped-color: #{$table-striped-color};
|
|
31
|
+
--#{$rbdg-prefix}grid-striped-bg: #{$table-striped-bg};
|
|
32
|
+
--#{$rbdg-prefix}grid-active-color: #{$table-active-color};
|
|
33
|
+
--#{$rbdg-prefix}grid-active-bg: #{$table-active-bg};
|
|
34
|
+
--#{$rbdg-prefix}grid-hover-color: #{$table-hover-color};
|
|
35
|
+
--#{$rbdg-prefix}grid-hover-bg: #{$table-hover-bg};
|
|
36
|
+
|
|
37
|
+
border-color: var(--#{$rbdg-prefix}grid-border-color);
|
|
38
|
+
|
|
39
|
+
> div {
|
|
40
|
+
width: min-content;
|
|
41
|
+
|
|
42
|
+
> div > div {
|
|
43
|
+
text-overflow: ellipsis;
|
|
44
|
+
white-space: nowrap;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
padding: $table-cell-padding-y $table-cell-padding-x;
|
|
47
|
+
color: var(
|
|
48
|
+
--#{$rbdg-prefix}grid-color-state,
|
|
49
|
+
var(--#{$rbdg-prefix}grid-color-type, var(--#{$rbdg-prefix}grid-color))
|
|
50
|
+
);
|
|
51
|
+
background-color: var(--#{$rbdg-prefix}grid-bg);
|
|
52
|
+
border-bottom-width: $table-border-width;
|
|
53
|
+
box-shadow: inset 0 0 0 9999px
|
|
54
|
+
var(
|
|
55
|
+
--#{$rbdg-prefix}grid-bg-state,
|
|
56
|
+
var(
|
|
57
|
+
--#{$rbdg-prefix}grid-bg-type,
|
|
58
|
+
var(--#{$rbdg-prefix}grid-accent-bg)
|
|
59
|
+
)
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// These properties are overridden by the "> div > div > div:not(:last-child)" properties when rbdg-grid-bordered is
|
|
65
|
+
// applied.
|
|
66
|
+
> div:first-child > div > div {
|
|
67
|
+
border-bottom-width: var(
|
|
68
|
+
--#{$rbdg-prefix}grid-divider-border-width,
|
|
69
|
+
var(--#{$rbdg-prefix}grid-divider-borderless-width, $table-border-width)
|
|
70
|
+
);
|
|
71
|
+
border-bottom-style: var(
|
|
72
|
+
--#{$rbdg-prefix}grid-divider-border-style,
|
|
73
|
+
inherit
|
|
74
|
+
);
|
|
75
|
+
border-bottom-color: var(
|
|
76
|
+
--#{$rbdg-prefix}grid-divider-border-color,
|
|
77
|
+
inherit
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.rbdg-grid-group-divider {
|
|
83
|
+
--#{$rbdg-prefix}grid-divider-border-width: calc(#{$table-border-width} * 2);
|
|
84
|
+
--#{$rbdg-prefix}grid-divider-border-style: solid;
|
|
85
|
+
--#{$rbdg-prefix}grid-divider-border-color: #{$table-group-separator-color};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.rbdg-grid-sm {
|
|
89
|
+
> div > div > div {
|
|
90
|
+
padding: $table-cell-padding-y-sm $table-cell-padding-x-sm;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.rbdg-grid-bordered {
|
|
95
|
+
border-width: $table-border-width;
|
|
96
|
+
border-style: solid;
|
|
97
|
+
|
|
98
|
+
> div > div {
|
|
99
|
+
> div:not(:last-child) {
|
|
100
|
+
border-width: 0 $table-border-width 0 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
> div:last-child {
|
|
104
|
+
border-width: 0;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
> div:first-child > div {
|
|
109
|
+
border-top-width: 0;
|
|
110
|
+
border-right-width: 0;
|
|
111
|
+
border-left-width: 0;
|
|
112
|
+
border-bottom-width: var(
|
|
113
|
+
--#{$rbdg-prefix}grid-divider-border-width,
|
|
114
|
+
var(--#{$rbdg-prefix}grid-divider-borderless-width, $table-border-width)
|
|
115
|
+
);
|
|
116
|
+
border-bottom-style: var(
|
|
117
|
+
--#{$rbdg-prefix}grid-divider-border-style,
|
|
118
|
+
inherit
|
|
119
|
+
);
|
|
120
|
+
border-bottom-color: var(
|
|
121
|
+
--#{$rbdg-prefix}grid-divider-border-color,
|
|
122
|
+
inherit
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
> div:last-child {
|
|
127
|
+
> div:not(:last-child) {
|
|
128
|
+
border-width: 0 0 $table-border-width 0;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.rbdg-grid-borderless {
|
|
134
|
+
--#{$rbdg-prefix}grid-divider-borderless-width: 0;
|
|
135
|
+
|
|
136
|
+
> div > div > div {
|
|
137
|
+
border-bottom-width: 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
> :not(:first-child) {
|
|
141
|
+
border-top-width: 0;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.rbdg-grid-striped {
|
|
146
|
+
> div:nth-of-type(2) > div:nth-of-type(#{$table-striped-order}) > div {
|
|
147
|
+
--#{$rbdg-prefix}grid-color-type: var(--#{$rbdg-prefix}grid-striped-color);
|
|
148
|
+
--#{$rbdg-prefix}grid-bg-type: var(--#{$rbdg-prefix}grid-striped-bg);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.rbdg-grid-striped-columns {
|
|
153
|
+
> div > div > :nth-child(#{$table-striped-columns-order}) {
|
|
154
|
+
--#{$rbdg-prefix}grid-color-type: var(--#{$rbdg-prefix}grid-striped-color);
|
|
155
|
+
--#{$rbdg-prefix}grid-bg-type: var(--#{$rbdg-prefix}grid-striped-bg);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.rbdg-grid-active {
|
|
160
|
+
--#{$rbdg-prefix}grid-color-state: var(--#{$prefix}grid-active-color);
|
|
161
|
+
--#{$rbdg-prefix}grid-bg-state: var(--#{$rbdg-prefix}grid-active-bg);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.rbdg-grid-hover {
|
|
165
|
+
> div:nth-of-type(2) > div:hover > div {
|
|
166
|
+
--#{$rbdg-prefix}grid-color-state: var(--#{$rbdg-prefix}grid-hover-color);
|
|
167
|
+
--#{$rbdg-prefix}grid-bg-state: var(--#{$rbdg-prefix}grid-hover-bg);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
@mixin rbdg-grid-variant($state, $background) {
|
|
172
|
+
.rbdg-grid-#{$state} {
|
|
173
|
+
$color: color-contrast(opaque($body-bg, $background));
|
|
174
|
+
$hover-bg: color.mix(
|
|
175
|
+
$color,
|
|
176
|
+
$background,
|
|
177
|
+
math.percentage($table-hover-bg-factor)
|
|
178
|
+
);
|
|
179
|
+
$striped-bg: color.mix(
|
|
180
|
+
$color,
|
|
181
|
+
$background,
|
|
182
|
+
math.percentage($table-striped-bg-factor)
|
|
183
|
+
);
|
|
184
|
+
$active-bg: color.mix(
|
|
185
|
+
$color,
|
|
186
|
+
$background,
|
|
187
|
+
math.percentage($table-active-bg-factor)
|
|
188
|
+
);
|
|
189
|
+
$table-border-color: color.mix(
|
|
190
|
+
$color,
|
|
191
|
+
$background,
|
|
192
|
+
math.percentage($table-border-factor)
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
--#{$rbdg-prefix}grid-color: #{$color};
|
|
196
|
+
--#{$rbdg-prefix}grid-bg: #{$background};
|
|
197
|
+
--#{$rbdg-prefix}grid-border-color: #{$table-border-color};
|
|
198
|
+
--#{$rbdg-prefix}grid-striped-bg: #{$striped-bg};
|
|
199
|
+
--#{$rbdg-prefix}grid-striped-color: #{color-contrast($striped-bg)};
|
|
200
|
+
--#{$rbdg-prefix}grid-active-bg: #{$active-bg};
|
|
201
|
+
--#{$rbdg-prefix}grid-active-color: #{color-contrast($active-bg)};
|
|
202
|
+
--#{$rbdg-prefix}grid-hover-bg: #{$hover-bg};
|
|
203
|
+
--#{$rbdg-prefix}grid-hover-color: #{color-contrast($hover-bg)};
|
|
204
|
+
|
|
205
|
+
color: var(--#{$rbdg-prefix}grid-color);
|
|
206
|
+
border-color: var(--#{$rbdg-prefix}grid-border-color);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
@each $color, $value in $table-variants {
|
|
211
|
+
@include rbdg-grid-variant($color, $value);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Note about Responsive Tables
|
|
215
|
+
//
|
|
216
|
+
// The Bootstrap _tables.scss file contains a series of classes to apply responsive tables at various breakpoints.
|
|
217
|
+
// There is no such equivalent for RBDG flex grid for the following reason.
|
|
218
|
+
//
|
|
219
|
+
// The RBDG flex grid is a div of type "block," so the concept of "responsive" scrollable breakpoints doesn't apply.
|
|
220
|
+
// It appears that for a table, even if the width is to 100%, the browser sometimes disobeys this setting causing
|
|
221
|
+
// the width to be more than the parent, hence the need for responsive tables. Divs do not appear to have this problem.
|
|
222
|
+
//
|
|
223
|
+
// The RBDG flex grid provides other options to achieving a horizontally scrollable grid. They are as follows.
|
|
224
|
+
//
|
|
225
|
+
// When using the default or "auto" setting for the RBDG grid's "width," the intrinsic width of the grid columns is
|
|
226
|
+
// used. In such circumstances, if one wants to make the grid scrollable horizontally, they can enclose the grid in a
|
|
227
|
+
// horizontally-scrollable div.
|
|
228
|
+
//
|
|
229
|
+
// When the grid's width is to set to "parent", the grid takes on the width of the parent (width 100% CSS value) just
|
|
230
|
+
// like the Bootstrap table does. In this case, the grid div itself is horizontally scrollable. In contrast, for
|
|
231
|
+
// responsive Bootstrap tables, it is a div that encloses the table element that is scrollable.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@absreim/react-bootstrap-data-grid",
|
|
3
3
|
"description": "Data grid UI component for use with web apps using React and Bootstrap",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.0.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Brook Li",
|
|
7
7
|
"homepage": "https://react-bootstrap-data-grid.vercel.app/",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FC, ReactNode } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { UseCombinedPipelineHook } from "
|
|
4
|
-
import { UseGridSelectionFnsHook } from "
|
|
2
|
+
import { BaseTableProps } from "./types";
|
|
3
|
+
import { UseCombinedPipelineHook } from "../common/pipeline/useCombinedPipeline";
|
|
4
|
+
import { UseGridSelectionFnsHook } from "../common/pipeline/useGridSelectionFns";
|
|
5
5
|
export interface InternalGridProps {
|
|
6
|
-
gridProps:
|
|
6
|
+
gridProps: BaseTableProps;
|
|
7
7
|
hooks: {
|
|
8
8
|
selectFns: UseGridSelectionFnsHook;
|
|
9
9
|
pipelineOutput: UseCombinedPipelineHook;
|
|
@@ -17,5 +17,5 @@ export interface InternalGridProps {
|
|
|
17
17
|
headerRow?: string[];
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
declare const
|
|
21
|
-
export default
|
|
20
|
+
declare const InternalTable: FC<InternalGridProps>;
|
|
21
|
+
export default InternalTable;
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import SelectAllHeaderCell from "./selection/SelectAllHeaderCell";
|
|
5
|
-
import Pagination from "
|
|
5
|
+
import Pagination from "../common/pagination/Pagination";
|
|
6
6
|
import classNames from "classnames";
|
|
7
|
-
import useInterfaces from "
|
|
8
|
-
import ToolbarContainer from "
|
|
9
|
-
import useExportFn from "
|
|
10
|
-
import getWidthStyle from "
|
|
11
|
-
var
|
|
7
|
+
import useInterfaces from "../common/toolbar/useInterfaces";
|
|
8
|
+
import ToolbarContainer from "../common/toolbar/ToolbarContainer";
|
|
9
|
+
import useExportFn from "../common/export/useExportFn";
|
|
10
|
+
import getWidthStyle from "../common/util/getWidthStyle";
|
|
11
|
+
var InternalTable = function (_a) {
|
|
12
12
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
13
13
|
var _o = _a.gridProps, rows = _o.rows, cols = _o.cols, pagination = _o.pagination, filterModel = _o.filterModel, selectModel = _o.selectModel, editModel = _o.editModel, caption = _o.caption, styleModel = _o.styleModel, displayMode = _o.displayMode, allowExport = _o.allowExport, _p = _a.hooks, pipelineOutput = _p.pipelineOutput, selectFns = _p.selectFns, _q = _a.slots, colHeaderCells = _q.colHeaderCells, bodyRows = _q.bodyRows, prefixHeader = _q.prefixHeader, classes = _a.classes;
|
|
14
14
|
var normalizedTableFilterModel = pipelineOutput.normalizedTableFilterModel, filteredRows = pipelineOutput.filteredRows, filterState = pipelineOutput.filterState, sortedRows = pipelineOutput.sortedRowsOutput.sortedRows, _r = pipelineOutput.currentPageRowsOutput, paginatedRows = _r.paginatedRows, normalizedModel = _r.normalizedModel, showSelectCol = pipelineOutput.showSelectCol;
|
|
@@ -56,4 +56,4 @@ var InternalGrid = function (_a) {
|
|
|
56
56
|
return (_jsxs("div", { "data-testid": "rbdg-top-level-div", className: classNames((_j = styleModel === null || styleModel === void 0 ? void 0 : styleModel.additionalComponentsStyleModel) === null || _j === void 0 ? void 0 : _j.topLevelDiv), children: [showToolbar && (_jsx(ToolbarContainer, { interfaceGen: toolbarInterfaces, styleModel: styleModel === null || styleModel === void 0 ? void 0 : styleModel.toolbarStyleModel })), _jsxs("div", { "data-testid": "rbdg-table-and-pagination-div", className: classNames((_k = styleModel === null || styleModel === void 0 ? void 0 : styleModel.additionalComponentsStyleModel) === null || _k === void 0 ? void 0 : _k.tableAndPaginationDiv), children: [_jsx("div", { "data-testid": "rbdg-table-div", className: classNames(((_l = styleModel === null || styleModel === void 0 ? void 0 : styleModel.additionalComponentsStyleModel) === null || _l === void 0 ? void 0 : _l.tableDiv) ||
|
|
57
57
|
"table-responsive"), children: mainTable }), normalizedModel && (_jsx(Pagination, { normalizedModel: normalizedModel, prePagingNumRows: sortedRows.length, containerDivClasses: (_m = styleModel === null || styleModel === void 0 ? void 0 : styleModel.additionalComponentsStyleModel) === null || _m === void 0 ? void 0 : _m.paginationUiDiv }))] })] }));
|
|
58
58
|
};
|
|
59
|
-
export default
|
|
59
|
+
export default InternalTable;
|
package/table/Table.d.ts
ADDED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
4
|
-
import InternalGrid from "./InternalGrid";
|
|
3
|
+
import InternalTable from "./InternalTable";
|
|
5
4
|
import ColHeaderCell from "./main/ColHeaderCell";
|
|
6
|
-
import useCombinedPipeline from "
|
|
7
|
-
import useGridSelectionFns from "
|
|
8
|
-
import useGetInputStrSubmitCallback from "
|
|
9
|
-
import useAugFormattedRows from "
|
|
5
|
+
import useCombinedPipeline from "../common/pipeline/useCombinedPipeline";
|
|
6
|
+
import useGridSelectionFns from "../common/pipeline/useGridSelectionFns";
|
|
7
|
+
import useGetInputStrSubmitCallback from "../common/pipeline/useGetInputStrSubmitCallback";
|
|
8
|
+
import useAugFormattedRows from "../common/pipeline/useAugFormattedRows";
|
|
10
9
|
import BodyRows from "./main/BodyRows";
|
|
11
|
-
|
|
10
|
+
import useColNameToWidth from "../common/pipeline/useColNameToWidth";
|
|
11
|
+
var Table = function (props) {
|
|
12
12
|
var rows = props.rows, cols = props.cols, filterModel = props.filterModel, sortModel = props.sortModel, pagination = props.pagination, selectModel = props.selectModel, styleModel = props.styleModel, editModel = props.editModel;
|
|
13
13
|
var combinedPipelineOutput = useCombinedPipeline({
|
|
14
14
|
rows: rows,
|
|
@@ -21,14 +21,7 @@ var Grid = function (props) {
|
|
|
21
21
|
var _a = combinedPipelineOutput.sortedRowsOutput, sortColDef = _a.sortColDef, setSortColDef = _a.setSortColDef, sortingEnabled = _a.sortingEnabled, showSelectCol = combinedPipelineOutput.showSelectCol, displayRows = combinedPipelineOutput.displayRows;
|
|
22
22
|
var gridSelectionFns = useGridSelectionFns(selectModel, rows);
|
|
23
23
|
var getInputStrSubmitCallback = useGetInputStrSubmitCallback(editModel, cols);
|
|
24
|
-
var colNameToWidth =
|
|
25
|
-
var map = {};
|
|
26
|
-
cols.forEach(function (_a) {
|
|
27
|
-
var name = _a.name, width = _a.width;
|
|
28
|
-
return (map[name] = width);
|
|
29
|
-
});
|
|
30
|
-
return map;
|
|
31
|
-
}, [cols]);
|
|
24
|
+
var colNameToWidth = useColNameToWidth(cols);
|
|
32
25
|
var augFormattedRows = useAugFormattedRows(colNameToWidth, displayRows);
|
|
33
26
|
var colHeaderCells = cols.map(function (_a, index) {
|
|
34
27
|
var _b;
|
|
@@ -45,9 +38,9 @@ var Grid = function (props) {
|
|
|
45
38
|
styleModel.mainTableStyleModel.theadTh(index), width: width }, name));
|
|
46
39
|
});
|
|
47
40
|
var bodyRows = (_jsx(BodyRows, { augFormattedRows: augFormattedRows, gridSelectionFns: gridSelectionFns, selectModel: selectModel, combinedPipelineOutput: combinedPipelineOutput, editModel: editModel, getInputStrSubmitCallback: getInputStrSubmitCallback, tableStyleModel: styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel }));
|
|
48
|
-
return (_jsx(
|
|
41
|
+
return (_jsx(InternalTable, { gridProps: props, hooks: {
|
|
49
42
|
pipelineOutput: combinedPipelineOutput,
|
|
50
43
|
selectFns: gridSelectionFns,
|
|
51
44
|
}, slots: { colHeaderCells: colHeaderCells, bodyRows: bodyRows } }));
|
|
52
45
|
};
|
|
53
|
-
export default
|
|
46
|
+
export default Table;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { CSSProperties, FC, ReactNode } from "react";
|
|
2
|
-
import { RowId } from "../types";
|
|
3
2
|
import React from "react";
|
|
4
|
-
import { CellData } from "
|
|
3
|
+
import { CellData, RowId } from "../../common/types";
|
|
5
4
|
export type EditableRowProps = Pick<React.ComponentProps<"tr">, "onClick" | "className" | "aria-rowindex" | "aria-selected"> & {
|
|
6
5
|
ariaColIndexOffset: number;
|
|
7
6
|
dataRowId: RowId;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useRef, useState } from "react";
|
|
4
|
-
import { dateToDatetimeInputStr, dateToInputStr } from "
|
|
4
|
+
import { dateToDatetimeInputStr, dateToInputStr, } from "../../common/util/datetime";
|
|
5
5
|
import EditControlsCell from "./EditControlsCell";
|
|
6
6
|
import classNames from "classnames";
|
|
7
|
-
import getWidthStyle from "
|
|
7
|
+
import getWidthStyle from "../../common/util/getWidthStyle";
|
|
8
8
|
var initValueToFormValue = function (value, type) {
|
|
9
9
|
switch (type) {
|
|
10
10
|
case "date":
|
package/table/index.d.ts
ADDED
package/table/index.js
ADDED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { AugFormattedRow, RowId } from "../types";
|
|
2
1
|
import { FC, ReactNode } from "react";
|
|
3
|
-
import { UseGridSelectionFnsHook } from "
|
|
4
|
-
import { UseCombinedPipelineHook } from "
|
|
5
|
-
import { SelectModel } from "
|
|
6
|
-
import {
|
|
7
|
-
import { UseGetInputStrSubmitCallbackHook } from "../pipeline/useGetInputStrSubmitCallback";
|
|
2
|
+
import { UseGridSelectionFnsHook } from "../../common/pipeline/useGridSelectionFns";
|
|
3
|
+
import { UseCombinedPipelineHook } from "../../common/pipeline/useCombinedPipeline";
|
|
4
|
+
import { SelectModel } from "../../common/selection/types";
|
|
5
|
+
import { UseGetInputStrSubmitCallbackHook } from "../../common/pipeline/useGetInputStrSubmitCallback";
|
|
8
6
|
import { TableStyleModel } from "../styling/types";
|
|
7
|
+
import { AugFormattedRow, FormattedRow, RowId } from "../../common/types";
|
|
8
|
+
import { EditModel } from "../../common/editing/types";
|
|
9
9
|
interface BodyRowsProps {
|
|
10
10
|
augFormattedRows: AugFormattedRow[];
|
|
11
11
|
gridSelectionFns: UseGridSelectionFnsHook;
|
|
@@ -15,7 +15,7 @@ interface BodyRowsProps {
|
|
|
15
15
|
editModel: EditModel | undefined;
|
|
16
16
|
getInputStrSubmitCallback: UseGetInputStrSubmitCallbackHook;
|
|
17
17
|
additionalColIndexOffset?: number;
|
|
18
|
-
renderPrefixCells?: (augFormattedRows:
|
|
18
|
+
renderPrefixCells?: (augFormattedRows: FormattedRow) => ReactNode;
|
|
19
19
|
additionalRowStyles?: (rowId: RowId, displayIndex: number) => string[];
|
|
20
20
|
}
|
|
21
21
|
declare const BodyRows: FC<BodyRowsProps>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import EditableRow from "../editing/EditableRow";
|
|
3
3
|
import classNames from "classnames";
|
|
4
|
-
import getWidthStyle from "
|
|
4
|
+
import getWidthStyle from "../../common/util/getWidthStyle";
|
|
5
5
|
import SelectionInput from "../selection/SelectionInput";
|
|
6
6
|
var BodyRows = function (_a) {
|
|
7
7
|
var augFormattedRows = _a.augFormattedRows, _b = _a.gridSelectionFns, selectedSet = _b.selectedSet, getSelectInputModel = _b.getSelectInputModel, getSelectHandler = _b.getSelectHandler, getRowClickHandler = _b.getRowClickHandler, getAriaSelectedValue = _b.getAriaSelectedValue, tableStyleModel = _a.tableStyleModel, _c = _a.combinedPipelineOutput, showSelectCol = _c.showSelectCol, ariaColIndexOffset = _c.ariaColIndexOffset, selectModel = _a.selectModel, editModel = _a.editModel, getInputStrSubmitCallback = _a.getInputStrSubmitCallback, additionalColIndexOffset = _a.additionalColIndexOffset, renderPrefixCells = _a.renderPrefixCells, additionalRowStyles = _a.additionalRowStyles;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import classNames from "classnames";
|
|
4
|
-
import getWidthStyle from "
|
|
5
|
-
import useSortHeaderStates from "
|
|
6
|
-
import sortOrderToAriaSort from "
|
|
4
|
+
import getWidthStyle from "../../../common/util/getWidthStyle";
|
|
5
|
+
import useSortHeaderStates from "../../../common/sorting/useSortHeaderStates";
|
|
6
|
+
import sortOrderToAriaSort from "../../../common/sorting/sortOrderToAriaSort";
|
|
7
7
|
var ColHeaderCell = function (_a) {
|
|
8
8
|
var label = _a.label, sortModel = _a.sortModel, ariaColIndex = _a.ariaColIndex, additionalClasses = _a.additionalClasses, width = _a.width;
|
|
9
9
|
var _b = useSortHeaderStates(sortModel), handleClick = _b.handleClick, handleMouseOver = _b.handleMouseOver, handleMouseOut = _b.handleMouseOut, sortSymbol = _b.sortSymbol;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RowId } from "
|
|
1
|
+
import { RowId } from "../../common/types";
|
|
2
2
|
export interface SharedTableStyleModel {
|
|
3
3
|
table?: string[];
|
|
4
4
|
tbody?: string[];
|
|
@@ -39,23 +39,3 @@ export interface AdditionalComponentsStyleModel {
|
|
|
39
39
|
tableDiv?: string[];
|
|
40
40
|
paginationUiDiv?: string[];
|
|
41
41
|
}
|
|
42
|
-
export interface ToolbarStyleModel {
|
|
43
|
-
activeButton?: string[];
|
|
44
|
-
inactiveButton?: string[];
|
|
45
|
-
toolbar?: string[];
|
|
46
|
-
interfaceContainer?: string[];
|
|
47
|
-
}
|
|
48
|
-
export interface ExportFormStyleModel {
|
|
49
|
-
legend?: string[];
|
|
50
|
-
radioContainer?: string[];
|
|
51
|
-
radioInput?: string[];
|
|
52
|
-
radioLabel?: string[];
|
|
53
|
-
submitButton?: string[];
|
|
54
|
-
}
|
|
55
|
-
export interface StyleModel {
|
|
56
|
-
mainTableStyleModel?: TableStyleModel;
|
|
57
|
-
filterInputTableStyleModel?: FilterInputTableStyleModel;
|
|
58
|
-
additionalComponentsStyleModel?: AdditionalComponentsStyleModel;
|
|
59
|
-
toolbarStyleModel?: ToolbarStyleModel;
|
|
60
|
-
exportFormStyleModel?: ExportFormStyleModel;
|
|
61
|
-
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/table/types.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ColSortModel } from "../common/sorting/types";
|
|
2
|
+
import { ColDefBase, MainComponentSharedProps } from "../common/types";
|
|
3
|
+
import { StyleModel } from "../common/styling/types";
|
|
4
|
+
export type DisplayMode = "table" | "block";
|
|
5
|
+
export type TableProps = MainComponentSharedProps & {
|
|
6
|
+
caption?: string;
|
|
7
|
+
styleModel?: StyleModel;
|
|
8
|
+
displayMode?: DisplayMode;
|
|
9
|
+
};
|
|
10
|
+
export type BaseTableProps = Omit<TableProps, "cols"> & {
|
|
11
|
+
cols: ColDefBase[];
|
|
12
|
+
};
|
|
13
|
+
export interface ColHeaderCellProps {
|
|
14
|
+
label: string;
|
|
15
|
+
sortModel?: ColSortModel;
|
|
16
|
+
ariaColIndex: number;
|
|
17
|
+
additionalClasses?: string[] | null;
|
|
18
|
+
width?: number;
|
|
19
|
+
}
|
package/table/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/editing/types.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ColDataType, ColDataTypeStrings, RowData, RowId } from "../types";
|
|
2
|
-
export interface CellData {
|
|
3
|
-
fieldName: string;
|
|
4
|
-
value: ColDataType;
|
|
5
|
-
type: ColDataTypeStrings;
|
|
6
|
-
ariaColIndex: number;
|
|
7
|
-
formattedValue: string;
|
|
8
|
-
label: string;
|
|
9
|
-
width?: number;
|
|
10
|
-
}
|
|
11
|
-
export type UpdateCallbackGenerator = (id: RowId) => (rowData: RowData) => void;
|
|
12
|
-
export interface EditModel {
|
|
13
|
-
getUpdateCallback: UpdateCallbackGenerator;
|
|
14
|
-
getDeleteCallback?: (id: RowId) => () => void;
|
|
15
|
-
editColWidth?: number;
|
|
16
|
-
}
|
package/main/ToggleButton.d.ts
DELETED
package/main/ToggleButton.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import classNames from "classnames";
|
|
4
|
-
var ToggleButton = function (_a) {
|
|
5
|
-
var isActive = _a.isActive, label = _a.label, onClick = _a.onClick, classes = _a.classes;
|
|
6
|
-
var baseClasses = ["btn"];
|
|
7
|
-
var variableClasses = {
|
|
8
|
-
active: isActive,
|
|
9
|
-
};
|
|
10
|
-
return (_jsx("button", { type: "button", className: classNames(baseClasses, variableClasses, classes, {
|
|
11
|
-
"btn-primary": !(classes && classes.length > 0),
|
|
12
|
-
}), "aria-pressed": isActive, onClick: onClick, children: label }));
|
|
13
|
-
};
|
|
14
|
-
export default ToggleButton;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
2
|
-
var useEditableFromFilterState = function (filterState) {
|
|
3
|
-
return useMemo(function () {
|
|
4
|
-
if (filterState === null) {
|
|
5
|
-
return null;
|
|
6
|
-
}
|
|
7
|
-
var editableState = {};
|
|
8
|
-
Object.keys(filterState).forEach(function (columnName) {
|
|
9
|
-
editableState[columnName] = filterState[columnName].editableState;
|
|
10
|
-
});
|
|
11
|
-
return editableState;
|
|
12
|
-
}, [filterState]);
|
|
13
|
-
};
|
|
14
|
-
export default useEditableFromFilterState;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ColDef } from "../../types";
|
|
2
|
-
import { EditableTableFilterState, TableFilterState } from "../../filtering/types";
|
|
3
|
-
declare const useFilterStateFromEditable: (colDefs: ColDef[], editableFilterState: EditableTableFilterState | null) => TableFilterState | null;
|
|
4
|
-
export default useFilterStateFromEditable;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|