@teselagen/ui 0.7.23 → 0.7.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DataTable/EditabelCell.d.ts +5 -2
- package/FormComponents/tryToMatchSchemas.d.ts +1 -1
- package/package.json +3 -2
- package/src/DataTable/EditabelCell.js +15 -4
- package/DataTable/utils/useDeepEqualMemo.d.ts +0 -1
- package/DataTable/utils/useTableParams.d.ts +0 -49
- package/src/DataTable/Columns.jsx +0 -945
- package/src/DataTable/EditabelCell.jsx +0 -44
- package/src/DataTable/RenderCell.jsx +0 -191
- package/src/DataTable/utils/useDeepEqualMemo.js +0 -10
- package/src/DataTable/utils/useTableParams.js +0 -361
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
export function EditableCell({ cancelEdit, dataTest, finishEdit, isNumeric,
|
|
1
|
+
export function EditableCell({ cancelEdit, dataTest, finishEdit, initialValue, isEditableCellInitialValue, isNumeric, shouldSelectAll, stopSelectAll }: {
|
|
2
2
|
cancelEdit: any;
|
|
3
3
|
dataTest: any;
|
|
4
4
|
finishEdit: any;
|
|
5
|
-
isNumeric: any;
|
|
6
5
|
initialValue: any;
|
|
6
|
+
isEditableCellInitialValue: any;
|
|
7
|
+
isNumeric: any;
|
|
8
|
+
shouldSelectAll: any;
|
|
9
|
+
stopSelectAll: any;
|
|
7
10
|
}): import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teselagen/ui",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.24",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@teselagen/file-utils": "0.3.18",
|
|
15
|
+
"@teselagen/bounce-loader": "0.3.11",
|
|
15
16
|
"@blueprintjs/core": "3.54.0",
|
|
16
17
|
"@blueprintjs/datetime": "^3.24.1",
|
|
17
18
|
"@blueprintjs/icons": "3.33.0",
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
"react-markdown": "9.0.1",
|
|
49
50
|
"react-redux": "^8.0.5",
|
|
50
51
|
"react-rnd": "^10.2.4",
|
|
51
|
-
"react-router-dom": "
|
|
52
|
+
"react-router-dom": "4",
|
|
52
53
|
"react-transition-group": "^2.4.0",
|
|
53
54
|
"recompose": "npm:react-recompose@0.31.1",
|
|
54
55
|
"redux": "^4.1.2",
|
|
@@ -4,8 +4,11 @@ export const EditableCell = ({
|
|
|
4
4
|
cancelEdit,
|
|
5
5
|
dataTest,
|
|
6
6
|
finishEdit,
|
|
7
|
+
initialValue,
|
|
8
|
+
isEditableCellInitialValue,
|
|
7
9
|
isNumeric,
|
|
8
|
-
|
|
10
|
+
shouldSelectAll,
|
|
11
|
+
stopSelectAll
|
|
9
12
|
}) => {
|
|
10
13
|
const [value, setValue] = useState(initialValue);
|
|
11
14
|
const inputRef = useRef(null);
|
|
@@ -13,8 +16,15 @@ export const EditableCell = ({
|
|
|
13
16
|
useEffect(() => {
|
|
14
17
|
if (inputRef.current) {
|
|
15
18
|
inputRef.current.focus();
|
|
19
|
+
if (isEditableCellInitialValue && !isNumeric) {
|
|
20
|
+
inputRef.current.selectionStart = inputRef.current.value.length;
|
|
21
|
+
inputRef.current.selectionEnd = inputRef.current.value.length;
|
|
22
|
+
} else if (shouldSelectAll) {
|
|
23
|
+
inputRef.current.select();
|
|
24
|
+
stopSelectAll();
|
|
25
|
+
}
|
|
16
26
|
}
|
|
17
|
-
}, [isNumeric]);
|
|
27
|
+
}, [isEditableCellInitialValue, isNumeric, shouldSelectAll, stopSelectAll]);
|
|
18
28
|
|
|
19
29
|
return (
|
|
20
30
|
<input
|
|
@@ -28,10 +38,11 @@ export const EditableCell = ({
|
|
|
28
38
|
{...dataTest}
|
|
29
39
|
autoFocus
|
|
30
40
|
onKeyDown={e => {
|
|
31
|
-
e.stopPropagation();
|
|
32
41
|
if (e.key === "Enter") {
|
|
33
|
-
|
|
42
|
+
finishEdit(value);
|
|
43
|
+
e.stopPropagation();
|
|
34
44
|
} else if (e.key === "Escape") {
|
|
45
|
+
e.stopPropagation();
|
|
35
46
|
cancelEdit();
|
|
36
47
|
}
|
|
37
48
|
}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function useDeepEqualMemo(value: any): undefined;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Note all these options can be passed at Design Time or at Runtime (like reduxForm())
|
|
3
|
-
*
|
|
4
|
-
* @export
|
|
5
|
-
*
|
|
6
|
-
* @param {compOrOpts} compOrOpts
|
|
7
|
-
* @typedef {object} compOrOpts
|
|
8
|
-
* @property {*string} formName - required unique identifier for the table
|
|
9
|
-
* @property {Object | Function} schema - The data table schema or a function returning it. The function wll be called with props as the argument.
|
|
10
|
-
* @property {boolean} urlConnected - whether the table should connect to/update the URL
|
|
11
|
-
* @property {boolean} withSelectedEntities - whether or not to pass the selected entities
|
|
12
|
-
* @property {boolean} isCodeModel - whether the model is keyed by code instead of id in the db
|
|
13
|
-
* @property {object} defaults - tableParam defaults such as pageSize, filter, etc
|
|
14
|
-
* @property {boolean} noOrderError - won't console an error if an order is not found on schema
|
|
15
|
-
*/
|
|
16
|
-
export default function useTableParams(props: any): any;
|
|
17
|
-
/**
|
|
18
|
-
* Note all these options can be passed at Design Time or at Runtime (like reduxForm())
|
|
19
|
-
*/
|
|
20
|
-
export type compOrOpts = {
|
|
21
|
-
/**
|
|
22
|
-
* } formName - required unique identifier for the table
|
|
23
|
-
*/
|
|
24
|
-
string: any;
|
|
25
|
-
/**
|
|
26
|
-
* - The data table schema or a function returning it. The function wll be called with props as the argument.
|
|
27
|
-
*/
|
|
28
|
-
schema: Object | Function;
|
|
29
|
-
/**
|
|
30
|
-
* - whether the table should connect to/update the URL
|
|
31
|
-
*/
|
|
32
|
-
urlConnected: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* - whether or not to pass the selected entities
|
|
35
|
-
*/
|
|
36
|
-
withSelectedEntities: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* - whether the model is keyed by code instead of id in the db
|
|
39
|
-
*/
|
|
40
|
-
isCodeModel: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* - tableParam defaults such as pageSize, filter, etc
|
|
43
|
-
*/
|
|
44
|
-
defaults: object;
|
|
45
|
-
/**
|
|
46
|
-
* - won't console an error if an order is not found on schema
|
|
47
|
-
*/
|
|
48
|
-
noOrderError: boolean;
|
|
49
|
-
};
|