@teselagen/ui 0.7.33-beta.2 → 0.7.33-beta.3
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/package.json +1 -1
- package/src/style.css +10 -26
- package/AdvancedOptions.js +0 -33
- package/AssignDefaultsModeContext.js +0 -22
- package/CellDragHandle.js +0 -132
- package/ColumnFilterMenu.js +0 -62
- package/Columns.js +0 -979
- package/DisabledLoadingComponent.js +0 -15
- package/DisplayOptions.js +0 -199
- package/DropdownButton.js +0 -36
- package/DropdownCell.js +0 -61
- package/EditableCell.js +0 -44
- package/FillWindow.css +0 -6
- package/FillWindow.js +0 -69
- package/FilterAndSortMenu.js +0 -388
- package/FormSeparator.js +0 -9
- package/LoadingDots.js +0 -14
- package/MatchHeaders.js +0 -234
- package/PagingTool.js +0 -225
- package/RenderCell.js +0 -191
- package/SearchBar.js +0 -69
- package/SimpleStepViz.js +0 -22
- package/SortableColumns.js +0 -100
- package/TableFormTrackerContext.js +0 -10
- package/Tag.js +0 -112
- package/ThComponent.js +0 -44
- package/TimelineEvent.js +0 -31
- package/UploadCsvWizard.css +0 -4
- package/UploadCsvWizard.js +0 -719
- package/Uploader.js +0 -1278
- package/adHoc.js +0 -10
- package/autoTooltip.js +0 -201
- package/basicHandleActionsWithFullState.js +0 -14
- package/browserUtils.js +0 -3
- package/combineReducersWithFullState.js +0 -14
- package/commandControls.js +0 -82
- package/commandUtils.js +0 -112
- package/constants.js +0 -1
- package/convertSchema.js +0 -69
- package/customIcons.js +0 -361
- package/dataTableEnhancer.js +0 -41
- package/defaultFormatters.js +0 -32
- package/defaultValidators.js +0 -40
- package/determineBlackOrWhiteTextColor.js +0 -4
- package/editCellHelper.js +0 -44
- package/filterLocalEntitiesToHasura.js +0 -216
- package/formatPasteData.js +0 -16
- package/getAllRows.js +0 -11
- package/getCellCopyText.js +0 -7
- package/getCellInfo.js +0 -36
- package/getCellVal.js +0 -20
- package/getDayjsFormatter.js +0 -35
- package/getFieldPathToField.js +0 -7
- package/getIdOrCodeOrIndex.js +0 -9
- package/getLastSelectedEntity.js +0 -11
- package/getNewEntToSelect.js +0 -25
- package/getNewName.js +0 -31
- package/getRowCopyText.js +0 -28
- package/getTableConfigFromStorage.js +0 -5
- package/getTextFromEl.js +0 -28
- package/getVals.js +0 -8
- package/handleCopyColumn.js +0 -21
- package/handleCopyHelper.js +0 -15
- package/handleCopyRows.js +0 -23
- package/handleCopyTable.js +0 -16
- package/handlerHelpers.js +0 -24
- package/hotkeyUtils.js +0 -131
- package/index.js +0 -1
- package/initializeHasuraWhereAndFilter.js +0 -27
- package/isBeingCalledExcessively.js +0 -24
- package/isBottomRightCornerOfRectangle.js +0 -20
- package/isEntityClean.js +0 -15
- package/isTruthy.js +0 -12
- package/isValueEmpty.js +0 -3
- package/itemUpload.js +0 -84
- package/menuUtils.js +0 -433
- package/popoverOverflowModifiers.js +0 -11
- package/primarySelectedValue.js +0 -1
- package/pureNoFunc.js +0 -31
- package/queryParams.js +0 -336
- package/removeCleanRows.js +0 -22
- package/renderOnDoc.js +0 -32
- package/rerenderOnWindowResize.js +0 -26
- package/rowClick.js +0 -181
- package/selection.js +0 -8
- package/showAppSpinner.js +0 -12
- package/showDialogOnDocBody.js +0 -33
- package/showProgressToast.js +0 -22
- package/simplifyHasuraWhere.js +0 -80
- package/sortify.js +0 -73
- package/style.css +0 -29
- package/tableQueryParamsToHasuraClauses.js +0 -113
- package/tagUtils.js +0 -45
- package/tgFormValues.js +0 -35
- package/tg_modalState.js +0 -47
- package/throwFormError.js +0 -16
- package/toastr.js +0 -148
- package/tryToMatchSchemas.js +0 -264
- package/typeToCommonType.js +0 -6
- package/useDeepEqualMemo.js +0 -15
- package/useDialog.js +0 -63
- package/useStableReference.js +0 -9
- package/useTableEntities.js +0 -38
- package/useTraceUpdate.js +0 -19
- package/utils.js +0 -37
- package/validateTableWideErrors.js +0 -160
- package/viewColumn.js +0 -97
- package/withField.js +0 -20
- package/withFields.js +0 -11
- package/withLocalStorage.js +0 -11
- package/withSelectTableRecords.js +0 -43
- package/withSelectedEntities.js +0 -65
- package/withStore.js +0 -10
- package/withTableParams.js +0 -288
- package/wrapDialog.js +0 -116
package/hotkeyUtils.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from "react";
|
|
2
|
-
import { useHotkeys } from "@blueprintjs/core";
|
|
3
|
-
import { startCase } from "lodash-es";
|
|
4
|
-
|
|
5
|
-
// This has been mostly superseded by blueprint's KeyCombo component, but may
|
|
6
|
-
// still be useful for cases where we need plain text
|
|
7
|
-
export function comboToLabel(def, useSymbols = true) {
|
|
8
|
-
const combo = typeof def === "string" ? def : def.combo;
|
|
9
|
-
|
|
10
|
-
if (useSymbols) {
|
|
11
|
-
let parts = combo.replace("++", "+plus").split("+");
|
|
12
|
-
parts = parts.map(p => symbols[p] || startCase(p) || p);
|
|
13
|
-
return parts.join("");
|
|
14
|
-
} else {
|
|
15
|
-
return combo
|
|
16
|
-
.split("+")
|
|
17
|
-
.map(p => startCase(p) || p)
|
|
18
|
-
.join(" + ")
|
|
19
|
-
.replace("Meta", isMac ? "Cmd" : "Ctrl")
|
|
20
|
-
.replace("Mod", isMac ? "Cmd" : "Ctrl")
|
|
21
|
-
.replace("Alt", isMac ? "Option" : "Alt");
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// HOF to get hotkey combos by id
|
|
26
|
-
export const hotkeysById =
|
|
27
|
-
(hotkeys, mode = "raw") =>
|
|
28
|
-
id => {
|
|
29
|
-
const def = getHotkeyProps(hotkeys[id]);
|
|
30
|
-
return (
|
|
31
|
-
def &&
|
|
32
|
-
(mode === "raw" ? def.combo : comboToLabel(def.combo, mode === "symbols"))
|
|
33
|
-
);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
// Translate shorthand array if needed
|
|
37
|
-
export const getHotkeyProps = (def, id) => {
|
|
38
|
-
let out;
|
|
39
|
-
if (typeof def === "string") {
|
|
40
|
-
out = { combo: def };
|
|
41
|
-
} else if (def instanceof Array) {
|
|
42
|
-
out = { combo: def[0], label: def[1], ...(def[2] || {}) };
|
|
43
|
-
} else {
|
|
44
|
-
out = def;
|
|
45
|
-
}
|
|
46
|
-
out.label = out.label || startCase(id);
|
|
47
|
-
return out;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/*
|
|
51
|
-
* HOC to add hotkey support to components. Use this instead of blueprint's one.
|
|
52
|
-
*
|
|
53
|
-
* Arguments:
|
|
54
|
-
* - hotkeySpec: either a named hotkey section previously registered, or an
|
|
55
|
-
* object mapping command ids to hotkey definitions, where each hotkey can
|
|
56
|
-
* be either:
|
|
57
|
-
* - a string consisting in the key combo (e.g. 'ctrl+shift+x')
|
|
58
|
-
* - an array holding the combo, label, and an object with any other props
|
|
59
|
-
* - an object holding all props
|
|
60
|
-
* - handlers: an object mapping command ids to handler functions
|
|
61
|
-
* - options: an object that may specify the follownig options:
|
|
62
|
-
* - functional: boolean indicating if the wrapped component will be a
|
|
63
|
-
* functional stateless component instead of a class-based one
|
|
64
|
-
*
|
|
65
|
-
* Returns a function that can be invoked with a component class, or a
|
|
66
|
-
* stateless component function (if specified in the options) and returns
|
|
67
|
-
* the decorated class. It may also be invoked without arguments to generate a
|
|
68
|
-
* dummy ad-hoc component with no output.
|
|
69
|
-
*
|
|
70
|
-
*/
|
|
71
|
-
export const withHotkeys = (hotkeys, handlers) => {
|
|
72
|
-
return ({ children } = {}) => {
|
|
73
|
-
const memoedHotkeys = useMemo(
|
|
74
|
-
() =>
|
|
75
|
-
Object.keys(hotkeys).map(id => {
|
|
76
|
-
const { ...props } = getHotkeyProps(hotkeys[id], id);
|
|
77
|
-
return {
|
|
78
|
-
key: id,
|
|
79
|
-
global: props.global !== false,
|
|
80
|
-
onKeyDown: function (e) {
|
|
81
|
-
return handlers[id](e);
|
|
82
|
-
},
|
|
83
|
-
...props
|
|
84
|
-
};
|
|
85
|
-
}),
|
|
86
|
-
[]
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
const { handleKeyDown, handleKeyUp } = useHotkeys(memoedHotkeys);
|
|
90
|
-
const newProps = {
|
|
91
|
-
tabIndex: 0,
|
|
92
|
-
onKeyDown: handleKeyDown,
|
|
93
|
-
onKeyUp: handleKeyUp
|
|
94
|
-
};
|
|
95
|
-
return children ? ( //tnr: if children are passed, we'll clone them with the new props
|
|
96
|
-
React.cloneElement(children, newProps)
|
|
97
|
-
) : (
|
|
98
|
-
//if not, then we'll return a div that can be used
|
|
99
|
-
<div className="hotkeyHandler" {...newProps}></div>
|
|
100
|
-
);
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
const isMac = navigator.userAgent.includes("Mac OS X");
|
|
105
|
-
|
|
106
|
-
// TODO maybe avoid using symbols by default when not on Mac?
|
|
107
|
-
// Anyway, alternative 'Key + Key' description is provided as well
|
|
108
|
-
const symbols = {
|
|
109
|
-
cmd: "⌘",
|
|
110
|
-
meta: "⌘",
|
|
111
|
-
ctrl: "⌃",
|
|
112
|
-
alt: "⌥",
|
|
113
|
-
shift: "⇧",
|
|
114
|
-
esc: "␛", //'⎋',
|
|
115
|
-
enter: "⏎",
|
|
116
|
-
backspace: "⌫",
|
|
117
|
-
plus: "+",
|
|
118
|
-
tab: "⇥",
|
|
119
|
-
space: "␣",
|
|
120
|
-
capslock: "⇪",
|
|
121
|
-
pageup: "⇞",
|
|
122
|
-
pagedown: "⇟",
|
|
123
|
-
home: "↖",
|
|
124
|
-
end: "↘",
|
|
125
|
-
left: "←",
|
|
126
|
-
right: "→",
|
|
127
|
-
up: "↑",
|
|
128
|
-
down: "↓"
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
symbols.mod = symbols[isMac ? "meta" : "ctrl"];
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useDeepEqualMemo } from "./useDeepEqualMemo";
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export function initializeHasuraWhereAndFilter(
|
|
2
|
-
additionalFilter,
|
|
3
|
-
where = {},
|
|
4
|
-
currentParams
|
|
5
|
-
) {
|
|
6
|
-
where._and = where._and || [];
|
|
7
|
-
where._or = where._or || [];
|
|
8
|
-
if (typeof additionalFilter === "function") {
|
|
9
|
-
const newWhere = additionalFilter(where, currentParams);
|
|
10
|
-
if (newWhere) {
|
|
11
|
-
where = {
|
|
12
|
-
...where,
|
|
13
|
-
...newWhere
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
} else if (typeof additionalFilter === "object")
|
|
17
|
-
where._and.push(additionalFilter);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const addCustomColumnFilters = (where, fields, currentParams) => {
|
|
21
|
-
fields.forEach(field => {
|
|
22
|
-
const { customColumnFilter, filterDisabled } = field;
|
|
23
|
-
if (filterDisabled || !customColumnFilter) return;
|
|
24
|
-
customColumnFilter(where, currentParams);
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const keyCount = {};
|
|
2
|
-
export const isBeingCalledExcessively = ({ uniqName }) => {
|
|
3
|
-
if (process.env.NODE_ENV !== "development") {
|
|
4
|
-
return;
|
|
5
|
-
}
|
|
6
|
-
if (!uniqName) {
|
|
7
|
-
throw new Error("uniqName is required");
|
|
8
|
-
}
|
|
9
|
-
// if this function is hit more than 10 times in a row in 2 seconds with the same uniqName then throw an error
|
|
10
|
-
if (keyCount[uniqName + "_timeout"]) {
|
|
11
|
-
clearTimeout(keyCount[uniqName + "_timeout"]);
|
|
12
|
-
}
|
|
13
|
-
keyCount[uniqName] = keyCount[uniqName] || 0;
|
|
14
|
-
keyCount[uniqName]++;
|
|
15
|
-
|
|
16
|
-
keyCount[uniqName + "_timeout"] = setTimeout(() => {
|
|
17
|
-
keyCount[uniqName] = 0;
|
|
18
|
-
}, 2000);
|
|
19
|
-
|
|
20
|
-
if (keyCount[uniqName] > 20) {
|
|
21
|
-
keyCount[uniqName] = 0;
|
|
22
|
-
throw new Error(`isBeingCalledExcessively: ${uniqName}`);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export const isBottomRightCornerOfRectangle = ({
|
|
2
|
-
cellId,
|
|
3
|
-
selectionGrid,
|
|
4
|
-
lastRowIndex,
|
|
5
|
-
lastCellIndex,
|
|
6
|
-
entityMap,
|
|
7
|
-
pathToIndex
|
|
8
|
-
}) => {
|
|
9
|
-
selectionGrid.forEach(row => {
|
|
10
|
-
// remove undefineds from start of row
|
|
11
|
-
while (row[0] === undefined && row.length) row.shift();
|
|
12
|
-
});
|
|
13
|
-
const [rowId, cellPath] = cellId.split(":");
|
|
14
|
-
const ent = entityMap[rowId];
|
|
15
|
-
if (!ent) return;
|
|
16
|
-
const { i } = ent;
|
|
17
|
-
const cellIndex = pathToIndex[cellPath];
|
|
18
|
-
const isBottomRight = i === lastRowIndex && cellIndex === lastCellIndex;
|
|
19
|
-
return isBottomRight;
|
|
20
|
-
};
|
package/isEntityClean.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export function isEntityClean(e) {
|
|
2
|
-
if (typeof e !== "object" || e === null) {
|
|
3
|
-
return true; // or return false depending on what you want for non-object inputs
|
|
4
|
-
}
|
|
5
|
-
let isClean = true;
|
|
6
|
-
for (const [key, val] of Object.entries(e)) {
|
|
7
|
-
if (key === "id") continue;
|
|
8
|
-
if (key === "_isClean") continue;
|
|
9
|
-
if (val) {
|
|
10
|
-
isClean = false;
|
|
11
|
-
break;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return isClean;
|
|
15
|
-
}
|
package/isTruthy.js
DELETED
package/isValueEmpty.js
DELETED
package/itemUpload.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
ProgressBar,
|
|
4
|
-
Intent,
|
|
5
|
-
Button,
|
|
6
|
-
Tooltip,
|
|
7
|
-
Position,
|
|
8
|
-
Icon
|
|
9
|
-
} from "@blueprintjs/core";
|
|
10
|
-
|
|
11
|
-
const itemUpload = props => {
|
|
12
|
-
const item = props.item;
|
|
13
|
-
const name = nameShortener(item.name);
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<div className="item-upload-container" key={item.id}>
|
|
17
|
-
<div className="item-upload">
|
|
18
|
-
<div>
|
|
19
|
-
{!props.saved ? (
|
|
20
|
-
<Tooltip
|
|
21
|
-
content={
|
|
22
|
-
<span>
|
|
23
|
-
{`Click to
|
|
24
|
-
${props.active ? "abort this uploading" : "remove this file"}`}
|
|
25
|
-
</span>
|
|
26
|
-
}
|
|
27
|
-
position={Position.LEFT}
|
|
28
|
-
usePortal={true}
|
|
29
|
-
>
|
|
30
|
-
<Button
|
|
31
|
-
intent={Intent.DANGER}
|
|
32
|
-
minimal
|
|
33
|
-
icon="delete"
|
|
34
|
-
onClick={props.onCancel}
|
|
35
|
-
/>
|
|
36
|
-
</Tooltip>
|
|
37
|
-
) : null}
|
|
38
|
-
</div>
|
|
39
|
-
<div>
|
|
40
|
-
<span>{name}</span>
|
|
41
|
-
</div>
|
|
42
|
-
<div>
|
|
43
|
-
{props.active ? `${props.value}%` : null}
|
|
44
|
-
{props.error ? (
|
|
45
|
-
<Tooltip content={props.error} usePortal={true}>
|
|
46
|
-
<Icon icon="error" intent={Intent.DANGER} />
|
|
47
|
-
</Tooltip>
|
|
48
|
-
) : null}
|
|
49
|
-
{props.saved ? (
|
|
50
|
-
<Tooltip content={"File Saved"} usePortal={true}>
|
|
51
|
-
<Icon icon="saved" intent={Intent.SUCCESS} />
|
|
52
|
-
</Tooltip>
|
|
53
|
-
) : null}
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
{props.active ? (
|
|
57
|
-
<ProgressBar intent={Intent.PRIMARY} value={props.value / 100} />
|
|
58
|
-
) : null}
|
|
59
|
-
</div>
|
|
60
|
-
);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Short file names length to display
|
|
65
|
-
* @param {*} itemName
|
|
66
|
-
*/
|
|
67
|
-
const nameShortener = itemName => {
|
|
68
|
-
if (itemName.length > 40) {
|
|
69
|
-
let name = "";
|
|
70
|
-
const arr = itemName.split(".");
|
|
71
|
-
name += `${arr[0].substring(0, 20)}...`;
|
|
72
|
-
if (arr.length >= 2) {
|
|
73
|
-
name += `${arr[arr.length - 2].substring(
|
|
74
|
-
arr[arr.length - 2].length - 5,
|
|
75
|
-
arr[arr.length - 2].length
|
|
76
|
-
)}`;
|
|
77
|
-
name += `.${arr[arr.length - 1]}`;
|
|
78
|
-
}
|
|
79
|
-
return name;
|
|
80
|
-
}
|
|
81
|
-
return itemName;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export default itemUpload;
|