@absreim/react-bootstrap-data-grid-pro 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.
Files changed (184) hide show
  1. package/common/constants.d.ts +2 -0
  2. package/common/constants.js +2 -0
  3. package/common/editing/types.d.ts +7 -0
  4. package/{grid → common}/filtering/FilterOptionsTable.d.ts +4 -4
  5. package/{grid → common}/filtering/types.d.ts +6 -6
  6. package/common/filtering/useFilterFormState.d.ts +3 -0
  7. package/common/index.d.ts +11 -0
  8. package/common/index.js +11 -0
  9. package/{grid → common}/pagination/PageSelector.d.ts +1 -1
  10. package/{grid → common}/pagination/PageSizeSelector.d.ts +1 -1
  11. package/{grid → common}/pagination/types.d.ts +2 -1
  12. package/{grid → common}/pipeline/useAugFormattedRows.d.ts +1 -1
  13. package/common/pipeline/useColNameToWidth.d.ts +3 -0
  14. package/common/pipeline/useColNameToWidth.js +7 -0
  15. package/{grid → common}/pipeline/useCombinedPipeline/index.d.ts +4 -4
  16. package/{grid → common}/pipeline/useCombinedPipeline/useCurrentPageRows.d.ts +1 -1
  17. package/{grid → common}/pipeline/useCombinedPipeline/useDisplayRows.d.ts +1 -1
  18. package/{grid → common}/pipeline/useCombinedPipeline/useDisplayRows.js +1 -2
  19. package/common/pipeline/useCombinedPipeline/useFilter.d.ts +4 -0
  20. package/common/pipeline/useCombinedPipeline/useFilterStateFromEditable.d.ts +4 -0
  21. package/{grid → common}/pipeline/useCombinedPipeline/useSortedRows.d.ts +2 -2
  22. package/{grid → common}/pipeline/useGridSelectionFns.d.ts +2 -2
  23. package/{grid → common}/sorting/types.d.ts +3 -3
  24. package/{grid/main/ColHeaderCell → common/sorting}/useSortHeaderStates.d.ts +2 -2
  25. package/{grid/main/ColHeaderCell → common/sorting}/useSortHeaderStates.js +4 -4
  26. package/common/styling/types.d.ts +21 -0
  27. package/{grid → common}/types.d.ts +21 -30
  28. package/common/util/index.d.ts +5 -0
  29. package/common/util/index.js +5 -0
  30. package/grid/constants.d.ts +2 -0
  31. package/grid/constants.js +2 -0
  32. package/grid/index.d.ts +3 -10
  33. package/grid/index.js +3 -10
  34. package/grid/{Grid.d.ts → main/Grid.d.ts} +0 -1
  35. package/grid/main/Grid.js +59 -0
  36. package/grid/main/GridBody.d.ts +4 -0
  37. package/grid/main/GridBody.js +13 -0
  38. package/grid/main/GridHeader.d.ts +4 -0
  39. package/grid/main/GridHeader.js +11 -0
  40. package/grid/main/getWidthStyles.d.ts +3 -0
  41. package/grid/main/getWidthStyles.js +6 -0
  42. package/grid/main/types.d.ts +32 -0
  43. package/grid.css +1 -0
  44. package/grid.scss +231 -0
  45. package/package.json +1 -1
  46. package/pro/index.d.ts +5 -0
  47. package/pro/index.js +5 -0
  48. package/{grid/InternalGrid.d.ts → table/InternalTable.d.ts} +6 -6
  49. package/{grid/InternalGrid.js → table/InternalTable.js} +7 -7
  50. package/table/Table.d.ts +5 -0
  51. package/{grid/Grid.js → table/Table.js} +10 -14
  52. package/{grid → table}/editing/EditableRow.d.ts +1 -2
  53. package/{grid → table}/editing/EditableRow.js +2 -2
  54. package/table/index.d.ts +5 -0
  55. package/table/index.js +5 -0
  56. package/{grid → table}/main/BodyRows.d.ts +7 -7
  57. package/{grid → table}/main/BodyRows.js +1 -1
  58. package/{grid → table}/main/ColHeaderCell/index.js +3 -3
  59. package/{grid → table}/selection/SelectAllHeaderCell.d.ts +1 -1
  60. package/table/style.scss +3 -0
  61. package/{grid → table}/styling/types.d.ts +1 -21
  62. package/table/styling/types.js +1 -0
  63. package/table/types.d.ts +19 -0
  64. package/table/types.js +1 -0
  65. package/{grid-pro → table-pro}/ColHeaderCellPro.js +4 -4
  66. package/table-pro/TablePro.d.ts +4 -0
  67. package/{grid-pro/GridPro.js → table-pro/TablePro.js} +9 -9
  68. package/{grid-pro → table-pro}/index.d.ts +2 -2
  69. package/{grid-pro → table-pro}/index.js +2 -2
  70. package/{grid-pro → table-pro}/reorder/ReorderHandleCell.js +1 -1
  71. package/{grid-pro → table-pro}/reorder/useKeyboardReorder.js +1 -1
  72. package/{grid-pro → table-pro}/resize/useResizeModel.d.ts +1 -1
  73. package/table-pro/style.scss +69 -0
  74. package/{grid-pro → table-pro}/types.d.ts +3 -3
  75. package/table-pro/types.js +1 -0
  76. package/table-pro.scss +1 -0
  77. package/grid/editing/types.d.ts +0 -16
  78. package/grid/filtering/useFilterFormState.d.ts +0 -3
  79. package/grid/pipeline/useCombinedPipeline/useFilter.d.ts +0 -4
  80. package/grid/pipeline/useCombinedPipeline/useFilterStateFromEditable.d.ts +0 -4
  81. package/grid-pro/GridPro.d.ts +0 -4
  82. /package/{grid → common}/editing/inputStrsToRowData.d.ts +0 -0
  83. /package/{grid → common}/editing/inputStrsToRowData.js +0 -0
  84. /package/{grid-pro/reorder → common/editing}/types.js +0 -0
  85. /package/{grid → common}/export/ExportForm.d.ts +0 -0
  86. /package/{grid → common}/export/ExportForm.js +0 -0
  87. /package/{grid → common}/export/types.d.ts +0 -0
  88. /package/{grid-pro/resize → common/export}/types.js +0 -0
  89. /package/{grid → common}/export/useExportFn.d.ts +0 -0
  90. /package/{grid → common}/export/useExportFn.js +0 -0
  91. /package/{grid → common}/filtering/DateFilterRow.d.ts +0 -0
  92. /package/{grid → common}/filtering/DateFilterRow.js +0 -0
  93. /package/{grid → common}/filtering/FilterOptionsTable.js +0 -0
  94. /package/{grid → common}/filtering/FilterRow.d.ts +0 -0
  95. /package/{grid → common}/filtering/FilterRow.js +0 -0
  96. /package/{grid → common}/filtering/NumberFilterRow.d.ts +0 -0
  97. /package/{grid → common}/filtering/NumberFilterRow.js +0 -0
  98. /package/{grid → common}/filtering/StringFilterRow.d.ts +0 -0
  99. /package/{grid → common}/filtering/StringFilterRow.js +0 -0
  100. /package/{grid → common}/filtering/types.js +0 -0
  101. /package/{grid → common}/filtering/useFilterFormState.js +0 -0
  102. /package/{grid → common}/pagination/PageSelector.js +0 -0
  103. /package/{grid → common}/pagination/PageSizeSelector.js +0 -0
  104. /package/{grid → common}/pagination/Pagination.d.ts +0 -0
  105. /package/{grid → common}/pagination/Pagination.js +0 -0
  106. /package/{grid-pro → common/pagination}/types.js +0 -0
  107. /package/{grid → common}/pipeline/types.d.ts +0 -0
  108. /package/{grid-pro/util → common/pipeline}/types.js +0 -0
  109. /package/{grid → common}/pipeline/useAugFormattedRows.js +0 -0
  110. /package/{grid → common}/pipeline/useCombinedPipeline/index.js +0 -0
  111. /package/{grid → common}/pipeline/useCombinedPipeline/useCurrentPageRows.js +0 -0
  112. /package/{grid → common}/pipeline/useCombinedPipeline/useFilter.js +0 -0
  113. /package/{grid → common}/pipeline/useCombinedPipeline/useFilterStateFromEditable.js +0 -0
  114. /package/{grid → common}/pipeline/useCombinedPipeline/useFilterStateStore.d.ts +0 -0
  115. /package/{grid → common}/pipeline/useCombinedPipeline/useFilterStateStore.js +0 -0
  116. /package/{grid → common}/pipeline/useCombinedPipeline/useSortedRows.js +0 -0
  117. /package/{grid → common}/pipeline/useGetInputStrSubmitCallback.d.ts +0 -0
  118. /package/{grid → common}/pipeline/useGetInputStrSubmitCallback.js +0 -0
  119. /package/{grid → common}/pipeline/useGridSelectionFns.js +0 -0
  120. /package/{grid → common}/selection/types.d.ts +0 -0
  121. /package/{grid → common}/selection/types.js +0 -0
  122. /package/{grid → common}/sorting/arrowPlaceholder.d.ts +0 -0
  123. /package/{grid → common}/sorting/arrowPlaceholder.js +0 -0
  124. /package/{grid → common}/sorting/downArrow.d.ts +0 -0
  125. /package/{grid → common}/sorting/downArrow.js +0 -0
  126. /package/{grid → common}/sorting/sortOrderToAriaSort.d.ts +0 -0
  127. /package/{grid → common}/sorting/sortOrderToAriaSort.js +0 -0
  128. /package/{grid/editing → common/sorting}/types.js +0 -0
  129. /package/{grid → common}/sorting/upArrow.d.ts +0 -0
  130. /package/{grid → common}/sorting/upArrow.js +0 -0
  131. /package/{grid/export → common/styling}/types.js +0 -0
  132. /package/{grid → common}/toolbar/Toolbar.d.ts +0 -0
  133. /package/{grid → common}/toolbar/Toolbar.js +0 -0
  134. /package/{grid → common}/toolbar/ToolbarContainer.d.ts +0 -0
  135. /package/{grid → common}/toolbar/ToolbarContainer.js +0 -0
  136. /package/{grid → common}/toolbar/types.d.ts +0 -0
  137. /package/{grid/pagination → common/toolbar}/types.js +0 -0
  138. /package/{grid → common}/toolbar/useInterfaces.d.ts +0 -0
  139. /package/{grid → common}/toolbar/useInterfaces.js +0 -0
  140. /package/{grid/pipeline → common}/types.js +0 -0
  141. /package/{grid → common}/util/datetime.d.ts +0 -0
  142. /package/{grid → common}/util/datetime.js +0 -0
  143. /package/{grid → common}/util/getWidthStyle.d.ts +0 -0
  144. /package/{grid → common}/util/getWidthStyle.js +0 -0
  145. /package/{grid → common}/util/isSubset.d.ts +0 -0
  146. /package/{grid → common}/util/isSubset.js +0 -0
  147. /package/{grid → common}/util/trueModulo.d.ts +0 -0
  148. /package/{grid → common}/util/trueModulo.js +0 -0
  149. /package/{grid → common}/util/useControlledHover.d.ts +0 -0
  150. /package/{grid → common}/util/useControlledHover.js +0 -0
  151. /package/grid/{sorting → main}/types.js +0 -0
  152. /package/{grid → table}/editing/EditControlsCell.d.ts +0 -0
  153. /package/{grid → table}/editing/EditControlsCell.js +0 -0
  154. /package/{grid → table}/main/ColHeaderCell/index.d.ts +0 -0
  155. /package/{grid → table}/selection/SelectAllHeaderCell.js +0 -0
  156. /package/{grid → table}/selection/SelectionInput.d.ts +0 -0
  157. /package/{grid → table}/selection/SelectionInput.js +0 -0
  158. /package/{grid-pro → table-pro}/ColHeaderCellPro.d.ts +0 -0
  159. /package/{grid-pro → table-pro}/assets/HorizontalGrip.d.ts +0 -0
  160. /package/{grid-pro → table-pro}/assets/HorizontalGrip.js +0 -0
  161. /package/{grid-pro → table-pro}/assets/VerticalGrip.d.ts +0 -0
  162. /package/{grid-pro → table-pro}/assets/VerticalGrip.js +0 -0
  163. /package/{grid-pro/util → table-pro/lib}/regDragCleanup.d.ts +0 -0
  164. /package/{grid-pro/util → table-pro/lib}/regDragCleanup.js +0 -0
  165. /package/{grid-pro/util → table-pro/lib}/types.d.ts +0 -0
  166. /package/{grid/styling → table-pro/lib}/types.js +0 -0
  167. /package/{grid-pro → table-pro}/reorder/ReorderHandleCell.d.ts +0 -0
  168. /package/{grid-pro → table-pro}/reorder/ReorderHeaderCell.d.ts +0 -0
  169. /package/{grid-pro → table-pro}/reorder/ReorderHeaderCell.js +0 -0
  170. /package/{grid-pro → table-pro}/reorder/types.d.ts +0 -0
  171. /package/{grid/toolbar → table-pro/reorder}/types.js +0 -0
  172. /package/{grid-pro → table-pro}/reorder/useKeyboardReorder.d.ts +0 -0
  173. /package/{grid-pro → table-pro}/reorder/useKeyboardReorderListener.d.ts +0 -0
  174. /package/{grid-pro → table-pro}/reorder/useKeyboardReorderListener.js +0 -0
  175. /package/{grid-pro → table-pro}/reorder/useReorderStyles.d.ts +0 -0
  176. /package/{grid-pro → table-pro}/reorder/useReorderStyles.js +0 -0
  177. /package/{grid-pro → table-pro}/resize/types.d.ts +0 -0
  178. /package/{grid → table-pro/resize}/types.js +0 -0
  179. /package/{grid-pro → table-pro}/resize/useResizeModel.js +0 -0
  180. /package/{grid-pro → table-pro}/util/index.d.ts +0 -0
  181. /package/{grid-pro → table-pro}/util/index.js +0 -0
  182. /package/{grid-pro → table-pro}/util/reorderRows.d.ts +0 -0
  183. /package/{grid-pro → table-pro}/util/reorderRows.js +0 -0
  184. /package/{style.css → table-pro.css} +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-pro",
3
3
  "description": "Pro Version of data grid UI component for use with web apps using React and Bootstrap",
4
- "version": "3.0.0",
4
+ "version": "4.0.0",
5
5
  "license": "Commercial. See LICENSE file.",
6
6
  "author": "Brook Li",
7
7
  "homepage": "https://react-bootstrap-data-grid.vercel.app/",
package/pro/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export * from "../grid";
2
+ export * from "../table-pro";
3
+ export { default as Grid } from "../grid";
4
+ export { default as Table } from "../table";
5
+ export { default as TablePro } from "../table-pro";
package/pro/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export * from "../grid";
2
+ export * from "../table-pro";
3
+ export { default as Grid } from "../grid";
4
+ export { default as Table } from "../table";
5
+ export { default as TablePro } from "../table-pro";
@@ -1,9 +1,9 @@
1
1
  import { FC, ReactNode } from "react";
2
- import { BaseGridProps } from "./types";
3
- import { UseCombinedPipelineHook } from "./pipeline/useCombinedPipeline";
4
- import { UseGridSelectionFnsHook } from "./pipeline/useGridSelectionFns";
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: BaseGridProps;
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 InternalGrid: FC<InternalGridProps>;
21
- export default InternalGrid;
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 "./pagination/Pagination";
5
+ import Pagination from "../common/pagination/Pagination";
6
6
  import classNames from "classnames";
7
- import useInterfaces from "./toolbar/useInterfaces";
8
- import ToolbarContainer from "./toolbar/ToolbarContainer";
9
- import useExportFn from "./export/useExportFn";
10
- import getWidthStyle from "./util/getWidthStyle";
11
- const InternalGrid = ({ gridProps: { rows, cols, pagination, filterModel, selectModel, editModel, caption, styleModel, displayMode, allowExport, }, hooks: { pipelineOutput, selectFns }, slots: { colHeaderCells, bodyRows, prefixHeader }, classes, }) => {
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
+ const InternalTable = ({ gridProps: { rows, cols, pagination, filterModel, selectModel, editModel, caption, styleModel, displayMode, allowExport, }, hooks: { pipelineOutput, selectFns }, slots: { colHeaderCells, bodyRows, prefixHeader }, classes, }) => {
12
12
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
13
13
  const { normalizedTableFilterModel, filteredRows, filterState, sortedRowsOutput: { sortedRows }, currentPageRowsOutput: { paginatedRows, normalizedModel }, showSelectCol, } = pipelineOutput;
14
14
  const exportFnInfo = useExportFn({
@@ -55,4 +55,4 @@ const InternalGrid = ({ gridProps: { rows, cols, pagination, filterModel, select
55
55
  return (_jsxs("div", { "data-testid": "rbdg-top-level-div", className: classNames((_h = styleModel === null || styleModel === void 0 ? void 0 : styleModel.additionalComponentsStyleModel) === null || _h === void 0 ? void 0 : _h.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((_j = styleModel === null || styleModel === void 0 ? void 0 : styleModel.additionalComponentsStyleModel) === null || _j === void 0 ? void 0 : _j.tableAndPaginationDiv), children: [_jsx("div", { "data-testid": "rbdg-table-div", className: classNames(((_k = styleModel === null || styleModel === void 0 ? void 0 : styleModel.additionalComponentsStyleModel) === null || _k === void 0 ? void 0 : _k.tableDiv) ||
56
56
  "table-responsive"), children: mainTable }), normalizedModel && (_jsx(Pagination, { normalizedModel: normalizedModel, prePagingNumRows: sortedRows.length, containerDivClasses: (_l = styleModel === null || styleModel === void 0 ? void 0 : styleModel.additionalComponentsStyleModel) === null || _l === void 0 ? void 0 : _l.paginationUiDiv }))] })] }));
57
57
  };
58
- export default InternalGrid;
58
+ export default InternalTable;
@@ -0,0 +1,5 @@
1
+ import { FC } from "react";
2
+ import { TableProps } from "./types";
3
+ declare const Table: FC<TableProps>;
4
+ export default Table;
5
+ export type { TableProps } from "./types";
@@ -1,14 +1,14 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useMemo } from "react";
4
- import InternalGrid from "./InternalGrid";
3
+ import InternalTable from "./InternalTable";
5
4
  import ColHeaderCell from "./main/ColHeaderCell";
6
- import useCombinedPipeline from "./pipeline/useCombinedPipeline";
7
- import useGridSelectionFns from "./pipeline/useGridSelectionFns";
8
- import useGetInputStrSubmitCallback from "./pipeline/useGetInputStrSubmitCallback";
9
- import useAugFormattedRows from "./pipeline/useAugFormattedRows";
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
- const Grid = (props) => {
10
+ import useColNameToWidth from "../common/pipeline/useColNameToWidth";
11
+ const Table = (props) => {
12
12
  const { rows, cols, filterModel, sortModel, pagination, selectModel, styleModel, editModel, } = props;
13
13
  const combinedPipelineOutput = useCombinedPipeline({
14
14
  rows,
@@ -21,11 +21,7 @@ const Grid = (props) => {
21
21
  const { sortedRowsOutput: { sortColDef, setSortColDef, sortingEnabled }, showSelectCol, displayRows, } = combinedPipelineOutput;
22
22
  const gridSelectionFns = useGridSelectionFns(selectModel, rows);
23
23
  const getInputStrSubmitCallback = useGetInputStrSubmitCallback(editModel, cols);
24
- const colNameToWidth = useMemo(() => {
25
- const map = {};
26
- cols.forEach(({ name, width }) => (map[name] = width));
27
- return map;
28
- }, [cols]);
24
+ const colNameToWidth = useColNameToWidth(cols);
29
25
  const augFormattedRows = useAugFormattedRows(colNameToWidth, displayRows);
30
26
  const colHeaderCells = cols.map(({ name, label, sortable, width }, index) => {
31
27
  var _a;
@@ -41,9 +37,9 @@ const Grid = (props) => {
41
37
  styleModel.mainTableStyleModel.theadTh(index), width: width }, name));
42
38
  });
43
39
  const 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 }));
44
- return (_jsx(InternalGrid, { gridProps: props, hooks: {
40
+ return (_jsx(InternalTable, { gridProps: props, hooks: {
45
41
  pipelineOutput: combinedPipelineOutput,
46
42
  selectFns: gridSelectionFns,
47
43
  }, slots: { colHeaderCells, bodyRows } }));
48
44
  };
49
- export default Grid;
45
+ 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 "./types";
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 "../util/datetime";
4
+ import { dateToDatetimeInputStr, dateToInputStr, } from "../../common/util/datetime";
5
5
  import EditControlsCell from "./EditControlsCell";
6
6
  import classNames from "classnames";
7
- import getWidthStyle from "../util/getWidthStyle";
7
+ import getWidthStyle from "../../common/util/getWidthStyle";
8
8
  const initValueToFormValue = (value, type) => {
9
9
  switch (type) {
10
10
  case "date":
@@ -0,0 +1,5 @@
1
+ export * from "./types";
2
+ export * from "./styling/types";
3
+ export * from "../common/selection/types";
4
+ export * from "../common";
5
+ export { default } from "./Table";
package/table/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export * from "./types";
2
+ export * from "./styling/types";
3
+ export * from "../common/selection/types";
4
+ export * from "../common";
5
+ export { default } from "./Table";
@@ -1,11 +1,11 @@
1
- import { AugFormattedRow, RowId } from "../types";
2
1
  import { FC, ReactNode } from "react";
3
- import { UseGridSelectionFnsHook } from "../pipeline/useGridSelectionFns";
4
- import { UseCombinedPipelineHook } from "../pipeline/useCombinedPipeline";
5
- import { SelectModel } from "../selection/types";
6
- import { EditModel } from "../editing/types";
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: AugFormattedRow) => ReactNode;
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 "../util/getWidthStyle";
4
+ import getWidthStyle from "../../common/util/getWidthStyle";
5
5
  import SelectionInput from "../selection/SelectionInput";
6
6
  const BodyRows = ({ augFormattedRows, gridSelectionFns: { selectedSet, getSelectInputModel, getSelectHandler, getRowClickHandler, getAriaSelectedValue, }, tableStyleModel, combinedPipelineOutput: { showSelectCol, ariaColIndexOffset }, selectModel, editModel, getInputStrSubmitCallback, additionalColIndexOffset, renderPrefixCells, additionalRowStyles, }) => augFormattedRows.map((row, index) => {
7
7
  return (_jsxs(EditableRow, { onClick: getRowClickHandler(row.id), className: classNames({
@@ -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 "../../util/getWidthStyle";
5
- import useSortHeaderStates from "./useSortHeaderStates";
6
- import sortOrderToAriaSort from "../../sorting/sortOrderToAriaSort";
4
+ import getWidthStyle from "../../../common/util/getWidthStyle";
5
+ import useSortHeaderStates from "../../../common/sorting/useSortHeaderStates";
6
+ import sortOrderToAriaSort from "../../../common/sorting/sortOrderToAriaSort";
7
7
  const ColHeaderCell = ({ label, sortModel, ariaColIndex, additionalClasses, width, }) => {
8
8
  const { handleClick, handleMouseOver, handleMouseOut, sortSymbol } = useSortHeaderStates(sortModel);
9
9
  return (_jsxs("th", { className: classNames({
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties, FC } from "react";
2
- import { SelectionInfo } from "./types";
2
+ import { SelectionInfo } from "../../common/selection/types";
3
3
  interface SelectAllHeaderCellProps {
4
4
  onClick: () => void;
5
5
  selectionInfo: SelectionInfo;
@@ -0,0 +1,3 @@
1
+ .rbdg-sort-toggler {
2
+ cursor: pointer;
3
+ }
@@ -1,4 +1,4 @@
1
- import { RowId } from "../types";
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 {};
@@ -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 {};
@@ -2,11 +2,11 @@
2
2
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useCallback, useMemo, useRef, } from "react";
4
4
  import classNames from "classnames";
5
- import getWidthStyle from "../grid/util/getWidthStyle";
6
- import useSortHeaderStates from "../grid/main/ColHeaderCell/useSortHeaderStates";
5
+ import getWidthStyle from "../common/util/getWidthStyle";
6
+ import useSortHeaderStates from "../common/sorting/useSortHeaderStates";
7
7
  import VerticalGrip from "./assets/VerticalGrip";
8
- import regDragCleanup from "./util/regDragCleanup";
9
- import sortOrderToAriaSort from "../grid/sorting/sortOrderToAriaSort";
8
+ import regDragCleanup from "./lib/regDragCleanup";
9
+ import sortOrderToAriaSort from "../common/sorting/sortOrderToAriaSort";
10
10
  const setWidthStyle = (cells, width) => {
11
11
  cells.forEach((cell) => {
12
12
  cell.style.minWidth = `${width}px`;
@@ -0,0 +1,4 @@
1
+ import { FC } from "react";
2
+ import { TableProProps } from "./types";
3
+ declare const TablePro: FC<TableProProps>;
4
+ export default TablePro;
@@ -1,20 +1,20 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { useCallback, useEffect, useMemo } from "react";
4
- import useCombinedPipeline from "../grid/pipeline/useCombinedPipeline";
5
- import InternalGrid from "../grid/InternalGrid";
4
+ import useCombinedPipeline from "../common/pipeline/useCombinedPipeline";
5
+ import InternalTable from "../table/InternalTable";
6
6
  import ColHeaderCellPro from "./ColHeaderCellPro";
7
- import useGridSelectionFns from "../grid/pipeline/useGridSelectionFns";
8
- import useGetInputStrSubmitCallback from "../grid/pipeline/useGetInputStrSubmitCallback";
9
- import useAugFormattedRows from "../grid/pipeline/useAugFormattedRows";
7
+ import useGridSelectionFns from "../common/pipeline/useGridSelectionFns";
8
+ import useGetInputStrSubmitCallback from "../common/pipeline/useGetInputStrSubmitCallback";
9
+ import useAugFormattedRows from "../common/pipeline/useAugFormattedRows";
10
10
  import useResizeModel from "./resize/useResizeModel";
11
- import BodyRows from "../grid/main/BodyRows";
11
+ import BodyRows from "../table/main/BodyRows";
12
12
  import ReorderHeaderCell from "./reorder/ReorderHeaderCell";
13
13
  import ReorderHandleCell from "./reorder/ReorderHandleCell";
14
14
  import useKeyboardReorder from "./reorder/useKeyboardReorder";
15
15
  import useReorderStyles from "./reorder/useReorderStyles";
16
16
  import useKeyboardReorderListener from "./reorder/useKeyboardReorderListener";
17
- const GridPro = (props) => {
17
+ const TablePro = (props) => {
18
18
  const { rows, cols, editModel, filterModel, sortModel, pagination, selectModel, styleModel, displayMode, reorder, } = props;
19
19
  const combinedPipelineOutput = useCombinedPipeline({
20
20
  rows,
@@ -117,11 +117,11 @@ const GridPro = (props) => {
117
117
  ]);
118
118
  const bodyRows = (_jsx(BodyRows, { augFormattedRows: augFormattedRows, gridSelectionFns: gridSelectionFns, selectModel: selectModel, combinedPipelineOutput: combinedPipelineOutput, editModel: editModel, getInputStrSubmitCallback: getInputStrSubmitCallback, renderPrefixCells: renderPrefixCells, additionalColIndexOffset: reorder ? 1 : 0, additionalRowStyles: additionalBodyRowStyles, tableStyleModel: styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel }));
119
119
  const prefixHeader = reorder ? _jsx(ReorderHeaderCell, {}) : null;
120
- return (_jsx(InternalGrid, { gridProps: props, hooks: {
120
+ return (_jsx(InternalTable, { gridProps: props, hooks: {
121
121
  pipelineOutput: combinedPipelineOutput,
122
122
  selectFns: gridSelectionFns,
123
123
  }, slots: { colHeaderCells, bodyRows, prefixHeader }, classes: {
124
124
  headerRow: additionalHeaderRowStyles,
125
125
  } }));
126
126
  };
127
- export default GridPro;
127
+ export default TablePro;
@@ -1,5 +1,5 @@
1
- export * from "../grid";
2
- export { default } from "./GridPro";
1
+ export * from "../table";
2
+ export { default } from "./TablePro";
3
3
  export * from "./types";
4
4
  export * from "./util";
5
5
  export * from "./reorder/types";
@@ -1,5 +1,5 @@
1
- export * from "../grid";
2
- export { default } from "./GridPro";
1
+ export * from "../table";
2
+ export { default } from "./TablePro";
3
3
  export * from "./types";
4
4
  export * from "./util";
5
5
  export * from "./reorder/types";
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useCallback, } from "react";
3
3
  import HorizontalGrip from "../assets/HorizontalGrip";
4
- import regDragCleanup from "../util/regDragCleanup";
4
+ import regDragCleanup from "../lib/regDragCleanup";
5
5
  import classNames from "classnames";
6
6
  function dropTargetRefValuesEqual(first, second) {
7
7
  if (first === null && second === null) {
@@ -1,5 +1,5 @@
1
1
  import { useCallback, useMemo, useState } from "react";
2
- import trueModulo from "../../grid/util/trueModulo";
2
+ import trueModulo from "../../common/util/trueModulo";
3
3
  const useKeyboardReorder = (displayRowIds) => {
4
4
  const [state, setState] = useState(null);
5
5
  // A change the displayed rows can suddenly make the existing state invalid.
@@ -1,5 +1,5 @@
1
1
  import { ProColDef } from "../types";
2
- import { DisplayMode } from "../../grid";
2
+ import { DisplayMode } from "../../table";
3
3
  import { ResizeModel } from "./types";
4
4
  declare const useResizeModel: (cols: Pick<ProColDef, "resizeable" | "width" | "name">[], display: DisplayMode | undefined) => ResizeModel;
5
5
  export default useResizeModel;