@gpa-gemstone/react-table 1.2.56 → 1.2.58

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 (47) hide show
  1. package/lib/AdjustableTable/Column.d.ts +6 -45
  2. package/lib/AdjustableTable/Column.js +32 -53
  3. package/lib/AdjustableTable/Table.d.ts +2 -116
  4. package/lib/AdjustableTable/Table.js +329 -347
  5. package/lib/AdjustableTable/Types.d.ts +148 -0
  6. package/lib/AdjustableTable/Types.js +24 -0
  7. package/lib/ConfigurableTable/ConfigurableColumn.d.ts +11 -0
  8. package/lib/ConfigurableTable/ConfigurableColumn.js +31 -0
  9. package/lib/ConfigurableTable/ConfigurableTable.d.ts +25 -0
  10. package/lib/ConfigurableTable/ConfigurableTable.js +189 -0
  11. package/lib/FilterableTable/BooleanFilter.d.ts +26 -0
  12. package/lib/FilterableTable/BooleanFilter.js +68 -0
  13. package/lib/FilterableTable/DateTimeFilters.d.ts +10 -0
  14. package/lib/FilterableTable/DateTimeFilters.js +321 -0
  15. package/lib/FilterableTable/EnumFilter.d.ts +37 -0
  16. package/lib/FilterableTable/EnumFilter.js +89 -0
  17. package/lib/FilterableTable/FilterableColumn.d.ts +20 -0
  18. package/lib/FilterableTable/FilterableColumn.js +34 -0
  19. package/lib/FilterableTable/FilterableTable.d.ts +12 -0
  20. package/lib/FilterableTable/FilterableTable.js +95 -0
  21. package/lib/FilterableTable/NumberFilter.d.ts +19 -0
  22. package/lib/FilterableTable/NumberFilter.js +160 -0
  23. package/lib/FilterableTable/TextFilter.d.ts +14 -0
  24. package/lib/FilterableTable/TextFilter.js +78 -0
  25. package/lib/Filters/BooleanFilter.d.ts +26 -0
  26. package/lib/Filters/BooleanFilter.js +68 -0
  27. package/lib/Filters/DateTimeFilters.d.ts +10 -0
  28. package/lib/Filters/DateTimeFilters.js +321 -0
  29. package/lib/Filters/EnumFilter.d.ts +37 -0
  30. package/lib/Filters/EnumFilter.js +89 -0
  31. package/lib/Filters/NumberFilter.d.ts +19 -0
  32. package/lib/Filters/NumberFilter.js +160 -0
  33. package/lib/Filters/TextFilter.d.ts +14 -0
  34. package/lib/Filters/TextFilter.js +78 -0
  35. package/lib/Table/Column.d.ts +19 -0
  36. package/lib/Table/Column.js +73 -0
  37. package/lib/Table/FilterableColumn.d.ts +20 -0
  38. package/lib/Table/FilterableColumn.js +74 -0
  39. package/lib/Table/Table.d.ts +3 -0
  40. package/lib/Table/Table.js +498 -0
  41. package/lib/Table/Types.d.ts +185 -0
  42. package/lib/Table/Types.js +24 -0
  43. package/lib/index.d.ts +7 -14
  44. package/lib/index.js +13 -19
  45. package/package.json +56 -52
  46. package/lib/AdjustableTable/AdjustableColumn.d.ts +0 -18
  47. package/lib/AdjustableTable/AdjustableColumn.js +0 -187
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ // ******************************************************************************************************
3
+ // Types.ts - Gbtc
4
+ //
5
+ // Copyright © 2021, Grid Protection Alliance. All Rights Reserved.
6
+ //
7
+ // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
8
+ // the NOTICE file distributed with this work for additional information regarding copyright ownership.
9
+ // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
10
+ // file except in compliance with the License. You may obtain a copy of the License at:
11
+ //
12
+ // http://opensource.org/licenses/MIT
13
+ //
14
+ // Unless agreed to in writing, the subject software distributed under the License is distributed on an
15
+ // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
16
+ // License for the specific language governing permissions and limitations.
17
+ //
18
+ // Code Modification History:
19
+ // ----------------------------------------------------------------------------------------------------
20
+ // 12/06/2024 - G. Santos
21
+ // Migrated props to namespace.
22
+ //
23
+ // ******************************************************************************************************
24
+ Object.defineProperty(exports, "__esModule", { value: true });
package/lib/index.d.ts CHANGED
@@ -1,15 +1,8 @@
1
- import Table, { TableProps, Rows, Column } from './Table';
2
- import { SelectTable, ISelectTableProps } from './SelectTable';
3
- import { SearchableTable } from './SearchableTable';
4
- import { DynamicTableProps, DynamicTable } from './DynamicTable';
5
1
  import Paging from './Paging';
6
- import AdjustableTable from './AdjustableTable/Table';
7
- import UpdatedColumn from './AdjustableTable/Column';
8
- import AdjustableColumn from './AdjustableTable/AdjustableColumn';
9
- declare const ReactTable: {
10
- Table: typeof AdjustableTable;
11
- Column: typeof UpdatedColumn;
12
- AdjustableColumn: typeof AdjustableColumn;
13
- };
14
- export { ReactTable, TableProps, SelectTable, ISelectTableProps, SearchableTable, DynamicTable, DynamicTableProps, Rows, Column, Paging };
15
- export default Table;
2
+ import * as ReactTableProps from './Table/Types';
3
+ import { Table } from './Table/Table';
4
+ import { Column } from './Table/Column';
5
+ import FilterableColumn from './Table/FilterableColumn';
6
+ import ConfigurableTable from './ConfigurableTable/ConfigurableTable';
7
+ import ConfigurableColumn from './ConfigurableTable/ConfigurableColumn';
8
+ export { ReactTableProps, Table, Column, FilterableColumn, ConfigurableTable, ConfigurableColumn, Paging };
package/lib/index.js CHANGED
@@ -24,24 +24,18 @@
24
24
  //
25
25
  // ******************************************************************************************************
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.Paging = exports.Rows = exports.DynamicTable = exports.SearchableTable = exports.SelectTable = exports.ReactTable = void 0;
28
- const Table_1 = require("./Table");
29
- Object.defineProperty(exports, "Rows", { enumerable: true, get: function () { return Table_1.Rows; } });
30
- const SelectTable_1 = require("./SelectTable");
31
- Object.defineProperty(exports, "SelectTable", { enumerable: true, get: function () { return SelectTable_1.SelectTable; } });
32
- const SearchableTable_1 = require("./SearchableTable");
33
- Object.defineProperty(exports, "SearchableTable", { enumerable: true, get: function () { return SearchableTable_1.SearchableTable; } });
34
- const DynamicTable_1 = require("./DynamicTable");
35
- Object.defineProperty(exports, "DynamicTable", { enumerable: true, get: function () { return DynamicTable_1.DynamicTable; } });
27
+ exports.Paging = exports.ConfigurableColumn = exports.ConfigurableTable = exports.FilterableColumn = exports.Column = exports.Table = exports.ReactTableProps = void 0;
36
28
  const Paging_1 = require("./Paging");
37
29
  exports.Paging = Paging_1.default;
38
- const Table_2 = require("./AdjustableTable/Table");
39
- const Column_1 = require("./AdjustableTable/Column");
40
- const AdjustableColumn_1 = require("./AdjustableTable/AdjustableColumn");
41
- const ReactTable = {
42
- Table: Table_2.default,
43
- Column: Column_1.default,
44
- AdjustableColumn: AdjustableColumn_1.default,
45
- };
46
- exports.ReactTable = ReactTable;
47
- exports.default = Table_1.default;
30
+ const ReactTableProps = require("./Table/Types");
31
+ exports.ReactTableProps = ReactTableProps;
32
+ const Table_1 = require("./Table/Table");
33
+ Object.defineProperty(exports, "Table", { enumerable: true, get: function () { return Table_1.Table; } });
34
+ const Column_1 = require("./Table/Column");
35
+ Object.defineProperty(exports, "Column", { enumerable: true, get: function () { return Column_1.Column; } });
36
+ const FilterableColumn_1 = require("./Table/FilterableColumn");
37
+ exports.FilterableColumn = FilterableColumn_1.default;
38
+ const ConfigurableTable_1 = require("./ConfigurableTable/ConfigurableTable");
39
+ exports.ConfigurableTable = ConfigurableTable_1.default;
40
+ const ConfigurableColumn_1 = require("./ConfigurableTable/ConfigurableColumn");
41
+ exports.ConfigurableColumn = ConfigurableColumn_1.default;
package/package.json CHANGED
@@ -1,53 +1,57 @@
1
- {
2
- "name": "@gpa-gemstone/react-table",
3
- "version": "1.2.56",
4
- "description": "Table for GPA web applications",
5
- "main": "lib/index.js",
6
- "types": "lib/index.d.ts",
7
- "files": ["lib"],
8
- "scripts": {
9
- "test": "jest --config jestconfig.json",
10
- "build": "tsc",
11
- "format": "prettier --write \"src/**/*.tsx\"",
12
- "lint": "eslint . --ext .ts,.tsx",
13
- "prepare": "npm run build",
14
- "prepublishOnly": "npm test && npm run lint",
15
- "preversion": "npm run lint",
16
- "version": "npm run format && git add -A src",
17
- "postversion": "git push && git push --tags"
18
- },
19
- "repository": {
20
- "type": "git",
21
- "url": "https://github.com/GridProtectionAlliance/gpa-gemstone.git"
22
- },
23
- "keywords": [
24
- "React",
25
- "Table",
26
- "GSF",
27
- "Gemstone",
28
- "GridProtectionAlliance"
29
- ],
30
- "author": "GridProtectionAlliance",
31
- "license": "MIT",
32
- "bugs": {"url": "https://github.com/GridProtectionAlliance/gpa-gemstone/issues"},
33
- "homepage": "https://github.com/GridProtectionAlliance/gpa-gemstone#readme",
34
- "devDependencies": {
35
- "@types/jest": "^27.0.0",
36
- "@typescript-eslint/eslint-plugin": "^5.60.0",
37
- "@typescript-eslint/parser": "^5.60.0",
38
- "eslint": "^8.43.0",
39
- "jest": "^29.0.0",
40
- "prettier": "^2.3.2",
41
- "ts-jest": "^29.0.0",
42
- "typescript": "5.5.3"
43
- },
44
- "dependencies": {
45
- "@gpa-gemstone/gpa-symbols": "0.0.43",
46
- "@gpa-gemstone/helper-functions": "0.0.35",
47
- "@types/lodash": "^4.14.171",
48
- "@types/react": "^17.0.14",
49
- "lodash": "^4.17.21",
50
- "react": "^18.2.0"
51
- },
52
- "publishConfig": {"access": "public"}
1
+ {
2
+ "name": "@gpa-gemstone/react-table",
3
+ "version": "1.2.58",
4
+ "description": "Table for GPA web applications",
5
+ "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
7
+ "files": ["lib"],
8
+ "scripts": {
9
+ "test": "jest --config jestconfig.json",
10
+ "build": "tsc",
11
+ "format": "prettier --write \"src/**/*.tsx\"",
12
+ "lint": "eslint . --ext .ts,.tsx",
13
+ "prepare": "npm run build",
14
+ "prepublishOnly": "npm test && npm run lint",
15
+ "preversion": "npm run lint",
16
+ "version": "npm run format && git add -A src",
17
+ "postversion": "git push && git push --tags"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/GridProtectionAlliance/gpa-gemstone.git"
22
+ },
23
+ "keywords": [
24
+ "React",
25
+ "Table",
26
+ "GSF",
27
+ "Gemstone",
28
+ "GridProtectionAlliance"
29
+ ],
30
+ "author": "GridProtectionAlliance",
31
+ "license": "MIT",
32
+ "bugs": {"url": "https://github.com/GridProtectionAlliance/gpa-gemstone/issues"},
33
+ "homepage": "https://github.com/GridProtectionAlliance/gpa-gemstone#readme",
34
+ "devDependencies": {
35
+ "@types/jest": "^27.0.0",
36
+ "@typescript-eslint/eslint-plugin": "^5.60.0",
37
+ "@typescript-eslint/parser": "^5.60.0",
38
+ "@types/react-portal": "4.0.4",
39
+ "eslint": "^8.43.0",
40
+ "jest": "^29.0.0",
41
+ "prettier": "^2.3.2",
42
+ "ts-jest": "^29.0.0",
43
+ "typescript": "5.5.3"
44
+ },
45
+ "dependencies": {
46
+ "@gpa-gemstone/gpa-symbols": "0.0.45",
47
+ "@gpa-gemstone/helper-functions": "0.0.36",
48
+ "@gpa-gemstone/react-interactive": "1.0.137",
49
+ "@types/lodash": "^4.14.171",
50
+ "@types/react": "^17.0.14",
51
+ "lodash": "^4.17.21",
52
+ "react": "^18.2.0",
53
+ "react-dom": "18.2.0",
54
+ "react-portal": "4.2.2"
55
+ },
56
+ "publishConfig": {"access": "public"}
53
57
  }
@@ -1,18 +0,0 @@
1
- import * as React from 'react';
2
- import { IColumnProps, IDataWrapperProps, IHeaderWrapperProps } from './Column';
3
- export default function AdjustableColumn<T>(props: React.PropsWithChildren<IColumnProps<T>>): JSX.Element;
4
- interface IAdjustableHeaderWrapperProps extends IHeaderWrapperProps {
5
- adjustment: number;
6
- startAdjustment: React.MouseEventHandler<HTMLDivElement>;
7
- setMinWidth: (w: number) => void;
8
- minWidth?: number;
9
- setMaxWidth: (w: number) => void;
10
- maxWidth?: number;
11
- extraWidth: number;
12
- }
13
- export declare function AdjustableColumnHeaderWrapper(props: React.PropsWithChildren<IAdjustableHeaderWrapperProps>): JSX.Element | null;
14
- interface IAdjustableDataWrapperProps extends IDataWrapperProps {
15
- adjustment?: number;
16
- }
17
- export declare function AdjustableColumnDataWrapper(props: React.PropsWithChildren<IAdjustableDataWrapperProps>): JSX.Element | null;
18
- export {};
@@ -1,187 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = AdjustableColumn;
4
- exports.AdjustableColumnHeaderWrapper = AdjustableColumnHeaderWrapper;
5
- exports.AdjustableColumnDataWrapper = AdjustableColumnDataWrapper;
6
- // ******************************************************************************************************
7
- // AdjustableColumn.tsx - Gbtc
8
- //
9
- // Copyright © 2023, Grid Protection Alliance. All Rights Reserved.
10
- //
11
- // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
12
- // the NOTICE file distributed with this work for additional information regarding copyright ownership.
13
- // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
14
- // file except in compliance with the License. You may obtain a copy of the License at:
15
- //
16
- // http://opensource.org/licenses/MIT
17
- //
18
- // Unless agreed to in writing, the subject software distributed under the License is distributed on an
19
- // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
20
- // License for the specific language governing permissions and limitations.
21
- //
22
- // Code Modification History:
23
- // ----------------------------------------------------------------------------------------------------
24
- // 11/19/2023 - C. Lackner
25
- // Generated original version of source code.
26
- // 05/31/2024 - C. Lackner
27
- // Refactored to fix sizing issues.
28
- //
29
- // ******************************************************************************************************
30
- const gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols");
31
- const React = require("react");
32
- function AdjustableColumn(props) {
33
- return React.createElement(React.Fragment, null, props.children);
34
- }
35
- function AdjustableColumnHeaderWrapper(props) {
36
- var _a, _b, _c, _d, _e, _f, _g;
37
- const thref = React.useRef(null);
38
- const [mode, setMode] = React.useState('minWidth');
39
- //const [width, setWidth] = React.useState<number>();
40
- const [minWidth, setMinWidth] = React.useState();
41
- const [maxWidth, setMaxWidth] = React.useState();
42
- const [showBorder, setShowBorder] = React.useState(false);
43
- const onHover = React.useCallback(() => { setShowBorder(true); }, []);
44
- const onLeave = React.useCallback(() => { setShowBorder(false); }, []);
45
- const style = (props.style !== undefined) ? Object.assign({}, props.style) : {};
46
- style.overflowX = (_a = style.overflowX) !== null && _a !== void 0 ? _a : 'hidden';
47
- style.display = (_b = style.display) !== null && _b !== void 0 ? _b : 'inline-block';
48
- style.position = (_c = style.position) !== null && _c !== void 0 ? _c : 'relative';
49
- style.borderTop = (_d = style.borderTop) !== null && _d !== void 0 ? _d : 'none';
50
- style.minWidth = (_e = style.minWidth) !== null && _e !== void 0 ? _e : 100;
51
- const isAuto = style.width == 'auto';
52
- const isUndefined = style.width === undefined;
53
- if ((style.width == undefined || style.width == 'auto') && props.width !== undefined && mode === 'width') {
54
- style.width = (props.width) + props.extraWidth;
55
- }
56
- if (mode === 'minWidth') {
57
- style.width = style.minWidth;
58
- }
59
- if (mode === 'maxWidth') {
60
- style.width = style.maxWidth;
61
- }
62
- if (mode === 'width' && props.adjustment !== undefined && props.adjustment !== 0 && style.width !== undefined) {
63
- style.width = `calc(${formatwidth(style.width).toString()} ${props.adjustment < 0 ? '-' : '+'} ${Math.abs(props.adjustment).toString()}px)`;
64
- }
65
- if (style.cursor === undefined && ((_f = props.allowSort) !== null && _f !== void 0 ? _f : true)) {
66
- style.cursor = 'pointer';
67
- }
68
- React.useLayoutEffect(() => {
69
- var _a, _b, _c;
70
- if (thref.current == null)
71
- return;
72
- if (mode == 'minWidth') {
73
- const w = (_a = thref.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width;
74
- if (w === undefined)
75
- return;
76
- if (w !== minWidth) {
77
- setMinWidth(w);
78
- }
79
- if (maxWidth === undefined && style.maxWidth !== undefined) {
80
- setMode('maxWidth');
81
- }
82
- else if (props.width === undefined) {
83
- setMode('width');
84
- }
85
- }
86
- if (mode == 'maxWidth') {
87
- const w = (_b = thref.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect().width;
88
- if (w === undefined)
89
- return;
90
- if (w !== maxWidth) {
91
- setMaxWidth(w);
92
- }
93
- if (props.width === undefined) {
94
- setMode('width');
95
- }
96
- else if (props.minWidth === undefined && style.minWidth !== undefined) {
97
- setMode('minWidth');
98
- }
99
- }
100
- if (mode == 'width') {
101
- const w = (_c = thref.current) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect().width;
102
- if (w === undefined)
103
- return;
104
- if (props.width === undefined || (w !== (props.width + props.extraWidth))) {
105
- props.setWidth(w, isAuto, isUndefined);
106
- }
107
- if (maxWidth === undefined && style.maxWidth !== undefined) {
108
- setMode('maxWidth');
109
- }
110
- else if (minWidth === undefined && style.minWidth !== undefined) {
111
- setMode('minWidth');
112
- }
113
- }
114
- });
115
- React.useEffect(() => {
116
- if (minWidth !== props.minWidth)
117
- props.setMinWidth(minWidth);
118
- }, [minWidth]);
119
- React.useEffect(() => {
120
- if (maxWidth !== props.maxWidth)
121
- props.setMaxWidth(maxWidth);
122
- }, [maxWidth]);
123
- const onClick = React.useCallback((e) => {
124
- var _a;
125
- if ((_a = props.allowSort) !== null && _a !== void 0 ? _a : true)
126
- props.onSort(e);
127
- }, [props.onSort, props.allowSort]);
128
- const onClickBorder = React.useCallback((e) => {
129
- props.startAdjustment(e);
130
- }, [props.startAdjustment]);
131
- if (props.width != undefined && !props.enabled)
132
- return null;
133
- return React.createElement("th", { ref: thref, style: style, onClick: onClick, onDrag: (e) => { e.stopPropagation(); } },
134
- React.createElement("div", { style: {
135
- width: 5,
136
- height: '100%',
137
- position: 'absolute',
138
- top: 0,
139
- left: 0,
140
- opacity: showBorder ? 1 : 0,
141
- background: '#e9ecef',
142
- cursor: 'col-resize'
143
- }, onMouseEnter: onHover, onMouseLeave: onLeave, onMouseDown: onClickBorder }),
144
- props.sorted ? React.createElement("div", { style: { position: 'absolute', width: 25 } }, props.asc ? React.createElement(gpa_symbols_1.ReactIcons.ArrowDropUp, null) : React.createElement(gpa_symbols_1.ReactIcons.ArrowDropDown, null)) : null,
145
- React.createElement("div", { style: {
146
- marginLeft: (props.sorted ? 25 : 0),
147
- } }, (_g = props.children) !== null && _g !== void 0 ? _g : props.colKey));
148
- }
149
- function AdjustableColumnDataWrapper(props) {
150
- var _a, _b;
151
- const tdref = React.useRef(null);
152
- const style = (props.style !== undefined) ? Object.assign({}, props.style) : {};
153
- style.overflowX = (_a = style.overflowX) !== null && _a !== void 0 ? _a : 'hidden';
154
- style.display = (_b = style.display) !== null && _b !== void 0 ? _b : 'inline-block';
155
- const isAuto = style.width == 'auto';
156
- const isUndefined = style.width === undefined;
157
- if ((style.width == undefined || style.width == 'auto') && props.width !== undefined) {
158
- style.width = (props.width) + props.extraWidth;
159
- }
160
- if (props.dragStart !== undefined)
161
- style.cursor = "grab";
162
- React.useLayoutEffect(() => {
163
- var _a;
164
- if (tdref.current == null)
165
- return;
166
- const w = (_a = tdref.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width;
167
- if (style.width === undefined && props.width === undefined) {
168
- props.setWidth(w, isAuto, isUndefined);
169
- return;
170
- }
171
- if (props.adjustment !== undefined && props.adjustment !== 0)
172
- return;
173
- if (w === undefined || (props.width !== undefined && w == (props.width + props.extraWidth)))
174
- return;
175
- props.setWidth(w, isAuto, isUndefined);
176
- });
177
- if (props.adjustment !== undefined && props.adjustment !== 0 && style.width !== undefined)
178
- style.width = `calc(${formatwidth(style.width)} ${props.adjustment < 0 ? '-' : '+'} ${Math.abs(props.adjustment).toString()}px)`;
179
- if (props.width != undefined && !props.enabled)
180
- return null;
181
- return (React.createElement("td", { ref: tdref, style: style, onClick: props.onClick, draggable: props.dragStart !== undefined, onDragStart: props.dragStart }, props.children));
182
- }
183
- function formatwidth(style) {
184
- if (style.toString().endsWith('%') || style.toString().endsWith('px'))
185
- return style;
186
- return style.toString() + "px";
187
- }