@teselagen/ui 0.8.6-beta.2 → 0.8.8
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 +10 -0
- package/DataTable/defaultProps.d.ts +43 -0
- package/DataTable/utils/computePresets.d.ts +1 -0
- package/DataTable/utils/getRowCopyText.d.ts +3 -1
- package/DataTable/utils/handleCopyRows.d.ts +5 -1
- package/DataTable/utils/index.d.ts +1 -0
- package/DataTable/utils/queryParams.d.ts +14 -7
- package/DataTable/utils/rowClick.d.ts +1 -1
- package/FormComponents/Uploader.d.ts +3 -1
- package/FormComponents/tryToMatchSchemas.d.ts +1 -1
- package/MenuBar/index.d.ts +3 -1
- package/ResizableDraggableDialog/index.d.ts +3 -1
- package/TagSelect/index.d.ts +1 -1
- package/index.cjs.js +34520 -37504
- package/index.d.ts +0 -1
- package/index.es.js +33521 -36505
- package/package.json +1 -1
- package/src/DataTable/Columns.js +1 -1
- package/src/DataTable/DisplayOptions.js +1 -1
- package/src/DataTable/EditabelCell.js +55 -0
- package/src/DataTable/FilterAndSortMenu.js +30 -27
- package/src/DataTable/defaultProps.js +45 -0
- package/src/DataTable/index.js +14 -3
- package/src/DataTable/style.css +1 -1
- package/src/DataTable/utils/computePresets.js +42 -0
- package/src/DataTable/utils/queryParams.js +772 -64
- package/src/DataTable/utils/withTableParams.js +16 -3
- package/src/ExcelCell.js +38 -0
- package/src/FormComponents/index.js +2 -2
- package/src/index.js +0 -1
- package/{ui.css → style.css} +1 -1
- package/utils/hotkeyUtils.d.ts +3 -1
- package/DataTable/utils/filterLocalEntitiesToHasura.d.ts +0 -5
- package/DataTable/utils/initializeHasuraWhereAndFilter.d.ts +0 -2
- package/DataTable/utils/tableQueryParamsToHasuraClauses.d.ts +0 -26
- package/src/DataTable/utils/filterLocalEntitiesToHasura.js +0 -236
- package/src/DataTable/utils/filterLocalEntitiesToHasura.test.js +0 -587
- package/src/DataTable/utils/initializeHasuraWhereAndFilter.js +0 -26
- package/src/DataTable/utils/tableQueryParamsToHasuraClauses.js +0 -260
- package/src/DataTable/utils/tableQueryParamsToHasuraClauses.test.js +0 -206
package/package.json
CHANGED
package/src/DataTable/Columns.js
CHANGED
|
@@ -33,10 +33,10 @@ import getTextFromEl from "../utils/getTextFromEl";
|
|
|
33
33
|
import rowClick, { finalizeSelection } from "./utils/rowClick";
|
|
34
34
|
import { editCellHelper } from "./editCellHelper";
|
|
35
35
|
import { getCellVal } from "./getCellVal";
|
|
36
|
+
import { getCCDisplayName } from "./utils/queryParams";
|
|
36
37
|
import { useDispatch } from "react-redux";
|
|
37
38
|
import { change as _change } from "redux-form";
|
|
38
39
|
import { RenderCell } from "./RenderCell";
|
|
39
|
-
import { getCCDisplayName } from "./utils/tableQueryParamsToHasuraClauses";
|
|
40
40
|
|
|
41
41
|
dayjs.extend(localizedFormat);
|
|
42
42
|
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
+
|
|
3
|
+
export const EditableCell = ({
|
|
4
|
+
cancelEdit,
|
|
5
|
+
dataTest,
|
|
6
|
+
finishEdit,
|
|
7
|
+
initialValue,
|
|
8
|
+
isEditableCellInitialValue,
|
|
9
|
+
isNumeric,
|
|
10
|
+
shouldSelectAll,
|
|
11
|
+
stopSelectAll
|
|
12
|
+
}) => {
|
|
13
|
+
const [value, setValue] = useState(initialValue);
|
|
14
|
+
const inputRef = useRef(null);
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (inputRef.current) {
|
|
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
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}, [isEditableCellInitialValue, isNumeric, shouldSelectAll, stopSelectAll]);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<input
|
|
31
|
+
style={{
|
|
32
|
+
border: 0,
|
|
33
|
+
width: "95%",
|
|
34
|
+
fontSize: 12,
|
|
35
|
+
background: "none"
|
|
36
|
+
}}
|
|
37
|
+
ref={inputRef}
|
|
38
|
+
{...dataTest}
|
|
39
|
+
autoFocus
|
|
40
|
+
onKeyDown={e => {
|
|
41
|
+
if (e.key === "Enter") {
|
|
42
|
+
finishEdit(value);
|
|
43
|
+
e.stopPropagation();
|
|
44
|
+
} else if (e.key === "Escape") {
|
|
45
|
+
e.stopPropagation();
|
|
46
|
+
cancelEdit();
|
|
47
|
+
}
|
|
48
|
+
}}
|
|
49
|
+
onBlur={() => finishEdit(value)}
|
|
50
|
+
onChange={e => setValue(e.target.value)}
|
|
51
|
+
type={isNumeric ? "number" : undefined}
|
|
52
|
+
value={value}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { DateInput, DateRangeInput } from "@blueprintjs/datetime";
|
|
3
|
-
import { camelCase
|
|
3
|
+
import { camelCase } from "lodash-es";
|
|
4
4
|
import classNames from "classnames";
|
|
5
5
|
import {
|
|
6
6
|
Menu,
|
|
@@ -349,40 +349,43 @@ function getFilterMenuItems(dataType) {
|
|
|
349
349
|
let filterMenuItems = [];
|
|
350
350
|
if (dataType === "string") {
|
|
351
351
|
filterMenuItems = [
|
|
352
|
-
"
|
|
353
|
-
"
|
|
354
|
-
"
|
|
355
|
-
"
|
|
356
|
-
"
|
|
357
|
-
"
|
|
358
|
-
"
|
|
359
|
-
"
|
|
360
|
-
"
|
|
361
|
-
"
|
|
352
|
+
"Contains",
|
|
353
|
+
"Not Contains",
|
|
354
|
+
"Starts With",
|
|
355
|
+
"Ends With",
|
|
356
|
+
"Is Exactly",
|
|
357
|
+
"Regex",
|
|
358
|
+
"In List",
|
|
359
|
+
"Not In List",
|
|
360
|
+
"Is Empty",
|
|
361
|
+
"Not Empty"
|
|
362
362
|
];
|
|
363
363
|
} else if (dataType === "lookup") {
|
|
364
364
|
filterMenuItems = [
|
|
365
|
-
"
|
|
366
|
-
"
|
|
367
|
-
"
|
|
368
|
-
"
|
|
369
|
-
"
|
|
370
|
-
"
|
|
365
|
+
"Contains",
|
|
366
|
+
"Not Contains",
|
|
367
|
+
"Starts With",
|
|
368
|
+
"Ends With",
|
|
369
|
+
"Is Exactly",
|
|
370
|
+
"Regex"
|
|
371
371
|
];
|
|
372
372
|
} else if (dataType === "boolean") {
|
|
373
|
-
filterMenuItems = ["
|
|
373
|
+
filterMenuItems = ["True", "False"];
|
|
374
374
|
} else if (dataType === "number" || dataType === "integer") {
|
|
375
|
+
// else if (dataType === "lookup") {
|
|
376
|
+
// filterMenuItems = ["None"];
|
|
377
|
+
// }
|
|
375
378
|
filterMenuItems = [
|
|
376
|
-
"
|
|
377
|
-
"
|
|
378
|
-
"
|
|
379
|
-
"
|
|
380
|
-
"
|
|
381
|
-
"
|
|
382
|
-
"
|
|
379
|
+
"Greater Than",
|
|
380
|
+
"Less Than",
|
|
381
|
+
"In Range",
|
|
382
|
+
"Outside Range",
|
|
383
|
+
"Equal To",
|
|
384
|
+
"In List",
|
|
385
|
+
"Not In List"
|
|
383
386
|
];
|
|
384
387
|
} else if (dataType === "timestamp") {
|
|
385
|
-
filterMenuItems = ["
|
|
388
|
+
filterMenuItems = ["Is Between", "Not Between", "Is Before", "Is After"];
|
|
386
389
|
}
|
|
387
|
-
return filterMenuItems
|
|
390
|
+
return filterMenuItems;
|
|
388
391
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { noop } from "lodash-es";
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line import/no-anonymous-default-export
|
|
4
|
+
export default {
|
|
5
|
+
//NOTE: DO NOT SET DEFAULTS HERE FOR PROPS THAT GET COMPUTED AS PART OF PRESET GROUPS IN computePresets
|
|
6
|
+
addFilters: noop,
|
|
7
|
+
className: "",
|
|
8
|
+
clearFilters: noop,
|
|
9
|
+
contextMenu: noop,
|
|
10
|
+
disabled: false,
|
|
11
|
+
entities: [],
|
|
12
|
+
extraClasses: "",
|
|
13
|
+
filters: [],
|
|
14
|
+
isCopyable: true,
|
|
15
|
+
isEntityDisabled: noop,
|
|
16
|
+
isLoading: false,
|
|
17
|
+
isSimple: false,
|
|
18
|
+
isSingleSelect: false,
|
|
19
|
+
maxHeight: 600,
|
|
20
|
+
noHeader: false,
|
|
21
|
+
noSelect: false,
|
|
22
|
+
noUserSelect: false,
|
|
23
|
+
onDeselect: noop,
|
|
24
|
+
onMultiRowSelect: noop,
|
|
25
|
+
onRowClick: noop,
|
|
26
|
+
onRowSelect: noop,
|
|
27
|
+
onSingleRowSelect: noop,
|
|
28
|
+
page: 1,
|
|
29
|
+
pageSize: 10,
|
|
30
|
+
reduxFormExpandedEntityIdMap: {},
|
|
31
|
+
reduxFormSearchInput: "",
|
|
32
|
+
reduxFormSelectedEntityIdMap: {},
|
|
33
|
+
removeSingleFilter: noop,
|
|
34
|
+
resized: [],
|
|
35
|
+
resizePersist: noop,
|
|
36
|
+
setFilter: noop,
|
|
37
|
+
setOrder: noop,
|
|
38
|
+
setPage: noop,
|
|
39
|
+
setPageSize: noop,
|
|
40
|
+
setSearchTerm: noop,
|
|
41
|
+
showCount: false,
|
|
42
|
+
style: {},
|
|
43
|
+
withCheckboxes: false,
|
|
44
|
+
withSort: true
|
|
45
|
+
};
|
package/src/DataTable/index.js
CHANGED
|
@@ -92,6 +92,7 @@ import { viewColumn, openColumn, multiViewColumn } from "./viewColumn";
|
|
|
92
92
|
import convertSchema from "./utils/convertSchema";
|
|
93
93
|
import TableFormTrackerContext from "./TableFormTrackerContext";
|
|
94
94
|
import {
|
|
95
|
+
getCCDisplayName,
|
|
95
96
|
getCurrentParamsFromUrl,
|
|
96
97
|
getQueryParams,
|
|
97
98
|
makeDataTableHandlers,
|
|
@@ -102,7 +103,6 @@ import { formValueSelector, change as _change } from "redux-form";
|
|
|
102
103
|
import { throwFormError } from "../throwFormError";
|
|
103
104
|
import { isObservableArray, toJS } from "mobx";
|
|
104
105
|
import { isBeingCalledExcessively } from "../utils/isBeingCalledExcessively";
|
|
105
|
-
import { getCCDisplayName } from "./utils/tableQueryParamsToHasuraClauses";
|
|
106
106
|
|
|
107
107
|
enablePatches();
|
|
108
108
|
const IS_LINUX = window.navigator.platform.toLowerCase().search("linux") > -1;
|
|
@@ -337,6 +337,16 @@ const DataTable = ({
|
|
|
337
337
|
|
|
338
338
|
const queryParams = useMemo(() => {
|
|
339
339
|
if (!isTableParamsConnected) {
|
|
340
|
+
const additionalFilterToUse =
|
|
341
|
+
typeof props.additionalFilter === "function"
|
|
342
|
+
? props.additionalFilter
|
|
343
|
+
: () => props.additionalFilter;
|
|
344
|
+
|
|
345
|
+
const additionalOrFilterToUse =
|
|
346
|
+
typeof props.additionalOrFilter === "function"
|
|
347
|
+
? props.additionalOrFilter
|
|
348
|
+
: () => props.additionalOrFilter;
|
|
349
|
+
|
|
340
350
|
return getQueryParams({
|
|
341
351
|
doNotCoercePageSize,
|
|
342
352
|
currentParams,
|
|
@@ -346,7 +356,8 @@ const DataTable = ({
|
|
|
346
356
|
schema: convertedSchema,
|
|
347
357
|
isInfinite,
|
|
348
358
|
isLocalCall,
|
|
349
|
-
additionalFilter:
|
|
359
|
+
additionalFilter: additionalFilterToUse,
|
|
360
|
+
additionalOrFilter: additionalOrFilterToUse,
|
|
350
361
|
noOrderError: props.noOrderError,
|
|
351
362
|
isCodeModel: props.isCodeModel,
|
|
352
363
|
ownProps: props
|
|
@@ -603,7 +614,7 @@ const DataTable = ({
|
|
|
603
614
|
: !val;
|
|
604
615
|
});
|
|
605
616
|
}
|
|
606
|
-
if (noValsForField
|
|
617
|
+
if (noValsForField) {
|
|
607
618
|
return {
|
|
608
619
|
...field,
|
|
609
620
|
isHidden: true,
|
package/src/DataTable/style.css
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { omitBy, isNil } from "lodash-es";
|
|
2
|
+
//we use this to make adding preset prop groups simpler
|
|
3
|
+
export default function computePresets(props = {}) {
|
|
4
|
+
const { isSimple } = props;
|
|
5
|
+
let toReturn = omitBy(props, isNil);
|
|
6
|
+
toReturn.pageSize = toReturn.controlled_pageSize || toReturn.pageSize;
|
|
7
|
+
if (isSimple) {
|
|
8
|
+
//isSimplePreset
|
|
9
|
+
toReturn = {
|
|
10
|
+
noHeader: true,
|
|
11
|
+
noFooter: !props.withPaging,
|
|
12
|
+
noPadding: true,
|
|
13
|
+
noFullscreenButton: true,
|
|
14
|
+
hidePageSizeWhenPossible: !props.withPaging,
|
|
15
|
+
isInfinite: !props.withPaging,
|
|
16
|
+
hideSelectedCount: true,
|
|
17
|
+
withTitle: false,
|
|
18
|
+
withSearch: false,
|
|
19
|
+
compact: true,
|
|
20
|
+
withPaging: false,
|
|
21
|
+
withFilter: false,
|
|
22
|
+
...toReturn
|
|
23
|
+
};
|
|
24
|
+
} else {
|
|
25
|
+
toReturn = {
|
|
26
|
+
// the usual defaults:
|
|
27
|
+
noFooter: false,
|
|
28
|
+
noPadding: false,
|
|
29
|
+
compact: true,
|
|
30
|
+
noFullscreenButton: false,
|
|
31
|
+
hidePageSizeWhenPossible: false,
|
|
32
|
+
isInfinite: false,
|
|
33
|
+
hideSelectedCount: false,
|
|
34
|
+
withTitle: true,
|
|
35
|
+
withSearch: true,
|
|
36
|
+
withPaging: true,
|
|
37
|
+
withFilter: true,
|
|
38
|
+
...toReturn
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return toReturn || {};
|
|
42
|
+
}
|