@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.
Files changed (149) 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/{filtering → common/filtering}/FilterOptionsTable.d.ts +4 -4
  5. package/{filtering → common/filtering}/types.d.ts +6 -6
  6. package/common/filtering/useFilterFormState.d.ts +3 -0
  7. package/{index.d.ts → common/index.d.ts} +8 -7
  8. package/{index.js → common/index.js} +8 -7
  9. package/{pagination → common/pagination}/PageSelector.d.ts +1 -1
  10. package/{pagination → common/pagination}/PageSizeSelector.d.ts +1 -1
  11. package/{pagination → common/pagination}/types.d.ts +2 -1
  12. package/{pipeline → common/pipeline}/useAugFormattedRows.d.ts +1 -1
  13. package/common/pipeline/useColNameToWidth.d.ts +3 -0
  14. package/common/pipeline/useColNameToWidth.js +12 -0
  15. package/{pipeline → common/pipeline}/useCombinedPipeline/index.d.ts +4 -4
  16. package/{pipeline → common/pipeline}/useCombinedPipeline/useCurrentPageRows.d.ts +1 -1
  17. package/{pipeline → common/pipeline}/useCombinedPipeline/useDisplayRows.d.ts +1 -1
  18. package/{pipeline → 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/{pipeline → common/pipeline}/useCombinedPipeline/useSortedRows.d.ts +2 -2
  22. package/{pipeline → common/pipeline}/useGridSelectionFns.d.ts +2 -2
  23. package/{sorting → common/sorting}/types.d.ts +3 -3
  24. package/{main/ColHeaderCell → common/sorting}/useSortHeaderStates.d.ts +2 -2
  25. package/{main/ColHeaderCell → common/sorting}/useSortHeaderStates.js +4 -4
  26. package/common/styling/types.d.ts +21 -0
  27. package/{types.d.ts → 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/community/index.d.ts +4 -0
  31. package/community/index.js +4 -0
  32. package/grid/constants.d.ts +2 -0
  33. package/grid/constants.js +2 -0
  34. package/grid/index.d.ts +3 -0
  35. package/grid/index.js +3 -0
  36. package/{Grid.d.ts → grid/main/Grid.d.ts} +0 -1
  37. package/grid/main/Grid.js +60 -0
  38. package/grid/main/GridBody.d.ts +4 -0
  39. package/grid/main/GridBody.js +17 -0
  40. package/grid/main/GridHeader.d.ts +4 -0
  41. package/grid/main/GridHeader.js +12 -0
  42. package/grid/main/getWidthStyles.d.ts +3 -0
  43. package/grid/main/getWidthStyles.js +6 -0
  44. package/grid/main/types.d.ts +32 -0
  45. package/grid/main/types.js +1 -0
  46. package/grid.css +1 -0
  47. package/grid.scss +231 -0
  48. package/package.json +1 -1
  49. package/{InternalGrid.d.ts → table/InternalTable.d.ts} +6 -6
  50. package/{InternalGrid.js → table/InternalTable.js} +7 -7
  51. package/table/Table.d.ts +5 -0
  52. package/{Grid.js → table/Table.js} +10 -17
  53. package/{editing → table/editing}/EditableRow.d.ts +1 -2
  54. package/{editing → table/editing}/EditableRow.js +2 -2
  55. package/table/index.d.ts +5 -0
  56. package/table/index.js +5 -0
  57. package/{main → table/main}/BodyRows.d.ts +7 -7
  58. package/{main → table/main}/BodyRows.js +1 -1
  59. package/{main → table/main}/ColHeaderCell/index.js +3 -3
  60. package/{selection → table/selection}/SelectAllHeaderCell.d.ts +1 -1
  61. package/{styling → 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/editing/types.d.ts +0 -16
  66. package/filtering/useFilterFormState.d.ts +0 -3
  67. package/main/ToggleButton.d.ts +0 -9
  68. package/main/ToggleButton.js +0 -14
  69. package/pipeline/useCombinedPipeline/useEditableFromFilterState.d.ts +0 -3
  70. package/pipeline/useCombinedPipeline/useEditableFromFilterState.js +0 -14
  71. package/pipeline/useCombinedPipeline/useFilter.d.ts +0 -4
  72. package/pipeline/useCombinedPipeline/useFilterStateFromEditable.d.ts +0 -4
  73. /package/{editing → common/editing}/inputStrsToRowData.d.ts +0 -0
  74. /package/{editing → common/editing}/inputStrsToRowData.js +0 -0
  75. /package/{editing → common/editing}/types.js +0 -0
  76. /package/{export → common/export}/ExportForm.d.ts +0 -0
  77. /package/{export → common/export}/ExportForm.js +0 -0
  78. /package/{export → common/export}/types.d.ts +0 -0
  79. /package/{export → common/export}/types.js +0 -0
  80. /package/{export → common/export}/useExportFn.d.ts +0 -0
  81. /package/{export → common/export}/useExportFn.js +0 -0
  82. /package/{filtering → common/filtering}/DateFilterRow.d.ts +0 -0
  83. /package/{filtering → common/filtering}/DateFilterRow.js +0 -0
  84. /package/{filtering → common/filtering}/FilterOptionsTable.js +0 -0
  85. /package/{filtering → common/filtering}/FilterRow.d.ts +0 -0
  86. /package/{filtering → common/filtering}/FilterRow.js +0 -0
  87. /package/{filtering → common/filtering}/NumberFilterRow.d.ts +0 -0
  88. /package/{filtering → common/filtering}/NumberFilterRow.js +0 -0
  89. /package/{filtering → common/filtering}/StringFilterRow.d.ts +0 -0
  90. /package/{filtering → common/filtering}/StringFilterRow.js +0 -0
  91. /package/{filtering → common/filtering}/types.js +0 -0
  92. /package/{filtering → common/filtering}/useFilterFormState.js +0 -0
  93. /package/{pagination → common/pagination}/PageSelector.js +0 -0
  94. /package/{pagination → common/pagination}/PageSizeSelector.js +0 -0
  95. /package/{pagination → common/pagination}/Pagination.d.ts +0 -0
  96. /package/{pagination → common/pagination}/Pagination.js +0 -0
  97. /package/{pagination → common/pagination}/types.js +0 -0
  98. /package/{pipeline → common/pipeline}/types.d.ts +0 -0
  99. /package/{pipeline → common/pipeline}/types.js +0 -0
  100. /package/{pipeline → common/pipeline}/useAugFormattedRows.js +0 -0
  101. /package/{pipeline → common/pipeline}/useCombinedPipeline/index.js +0 -0
  102. /package/{pipeline → common/pipeline}/useCombinedPipeline/useCurrentPageRows.js +0 -0
  103. /package/{pipeline → common/pipeline}/useCombinedPipeline/useFilter.js +0 -0
  104. /package/{pipeline → common/pipeline}/useCombinedPipeline/useFilterStateFromEditable.js +0 -0
  105. /package/{pipeline → common/pipeline}/useCombinedPipeline/useFilterStateStore.d.ts +0 -0
  106. /package/{pipeline → common/pipeline}/useCombinedPipeline/useFilterStateStore.js +0 -0
  107. /package/{pipeline → common/pipeline}/useCombinedPipeline/useSortedRows.js +0 -0
  108. /package/{pipeline → common/pipeline}/useGetInputStrSubmitCallback.d.ts +0 -0
  109. /package/{pipeline → common/pipeline}/useGetInputStrSubmitCallback.js +0 -0
  110. /package/{pipeline → common/pipeline}/useGridSelectionFns.js +0 -0
  111. /package/{selection → common/selection}/types.d.ts +0 -0
  112. /package/{selection → common/selection}/types.js +0 -0
  113. /package/{sorting → common/sorting}/arrowPlaceholder.d.ts +0 -0
  114. /package/{sorting → common/sorting}/arrowPlaceholder.js +0 -0
  115. /package/{sorting → common/sorting}/downArrow.d.ts +0 -0
  116. /package/{sorting → common/sorting}/downArrow.js +0 -0
  117. /package/{sorting → common/sorting}/sortOrderToAriaSort.d.ts +0 -0
  118. /package/{sorting → common/sorting}/sortOrderToAriaSort.js +0 -0
  119. /package/{sorting → common/sorting}/types.js +0 -0
  120. /package/{sorting → common/sorting}/upArrow.d.ts +0 -0
  121. /package/{sorting → common/sorting}/upArrow.js +0 -0
  122. /package/{styling → common/styling}/types.js +0 -0
  123. /package/{toolbar → common/toolbar}/Toolbar.d.ts +0 -0
  124. /package/{toolbar → common/toolbar}/Toolbar.js +0 -0
  125. /package/{toolbar → common/toolbar}/ToolbarContainer.d.ts +0 -0
  126. /package/{toolbar → common/toolbar}/ToolbarContainer.js +0 -0
  127. /package/{toolbar → common/toolbar}/types.d.ts +0 -0
  128. /package/{toolbar → common/toolbar}/types.js +0 -0
  129. /package/{toolbar → common/toolbar}/useInterfaces.d.ts +0 -0
  130. /package/{toolbar → common/toolbar}/useInterfaces.js +0 -0
  131. /package/{types.js → common/types.js} +0 -0
  132. /package/{util → common/util}/datetime.d.ts +0 -0
  133. /package/{util → common/util}/datetime.js +0 -0
  134. /package/{util → common/util}/getWidthStyle.d.ts +0 -0
  135. /package/{util → common/util}/getWidthStyle.js +0 -0
  136. /package/{util → common/util}/isSubset.d.ts +0 -0
  137. /package/{util → common/util}/isSubset.js +0 -0
  138. /package/{util → common/util}/trueModulo.d.ts +0 -0
  139. /package/{util → common/util}/trueModulo.js +0 -0
  140. /package/{util → common/util}/useControlledHover.d.ts +0 -0
  141. /package/{util → common/util}/useControlledHover.js +0 -0
  142. /package/{editing → table/editing}/EditControlsCell.d.ts +0 -0
  143. /package/{editing → table/editing}/EditControlsCell.js +0 -0
  144. /package/{main → table/main}/ColHeaderCell/index.d.ts +0 -0
  145. /package/{selection → table/selection}/SelectAllHeaderCell.js +0 -0
  146. /package/{selection → table/selection}/SelectionInput.d.ts +0 -0
  147. /package/{selection → table/selection}/SelectionInput.js +0 -0
  148. /package/{style.css → table.css} +0 -0
  149. /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": "3.0.0",
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 { 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
- var InternalGrid = function (_a) {
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 InternalGrid;
59
+ 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
- var Grid = function (props) {
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 = useMemo(function () {
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(InternalGrid, { gridProps: props, hooks: {
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 Grid;
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 "./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
  var initValueToFormValue = function (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
  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 "../../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
  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,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;
@@ -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 {};
@@ -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
- }
@@ -1,3 +0,0 @@
1
- import { FilterFormState, TableFilterState } from "./types";
2
- declare const useFilterFormState: (tableFilterState: TableFilterState) => FilterFormState;
3
- export default useFilterFormState;
@@ -1,9 +0,0 @@
1
- import { FC } from "react";
2
- export interface ToggleButtonProps {
3
- isActive: boolean;
4
- label: string;
5
- onClick: () => void;
6
- classes?: string[];
7
- }
8
- declare const ToggleButton: FC<ToggleButtonProps>;
9
- export default ToggleButton;
@@ -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,3 +0,0 @@
1
- import { EditableTableFilterState, TableFilterState } from "../../filtering/types";
2
- declare const useEditableFromFilterState: (filterState: TableFilterState | null) => EditableTableFilterState | null;
3
- export default useEditableFromFilterState;
@@ -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 { AugRowDef, RowDef } from "../../types";
2
- import { EditableTableFilterState } from "../../filtering/types";
3
- declare const useFilter: (rows: RowDef[], filterState: EditableTableFilterState | null) => AugRowDef[];
4
- export default useFilter;
@@ -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