@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.
Files changed (115) hide show
  1. package/package.json +1 -1
  2. package/src/style.css +10 -26
  3. package/AdvancedOptions.js +0 -33
  4. package/AssignDefaultsModeContext.js +0 -22
  5. package/CellDragHandle.js +0 -132
  6. package/ColumnFilterMenu.js +0 -62
  7. package/Columns.js +0 -979
  8. package/DisabledLoadingComponent.js +0 -15
  9. package/DisplayOptions.js +0 -199
  10. package/DropdownButton.js +0 -36
  11. package/DropdownCell.js +0 -61
  12. package/EditableCell.js +0 -44
  13. package/FillWindow.css +0 -6
  14. package/FillWindow.js +0 -69
  15. package/FilterAndSortMenu.js +0 -388
  16. package/FormSeparator.js +0 -9
  17. package/LoadingDots.js +0 -14
  18. package/MatchHeaders.js +0 -234
  19. package/PagingTool.js +0 -225
  20. package/RenderCell.js +0 -191
  21. package/SearchBar.js +0 -69
  22. package/SimpleStepViz.js +0 -22
  23. package/SortableColumns.js +0 -100
  24. package/TableFormTrackerContext.js +0 -10
  25. package/Tag.js +0 -112
  26. package/ThComponent.js +0 -44
  27. package/TimelineEvent.js +0 -31
  28. package/UploadCsvWizard.css +0 -4
  29. package/UploadCsvWizard.js +0 -719
  30. package/Uploader.js +0 -1278
  31. package/adHoc.js +0 -10
  32. package/autoTooltip.js +0 -201
  33. package/basicHandleActionsWithFullState.js +0 -14
  34. package/browserUtils.js +0 -3
  35. package/combineReducersWithFullState.js +0 -14
  36. package/commandControls.js +0 -82
  37. package/commandUtils.js +0 -112
  38. package/constants.js +0 -1
  39. package/convertSchema.js +0 -69
  40. package/customIcons.js +0 -361
  41. package/dataTableEnhancer.js +0 -41
  42. package/defaultFormatters.js +0 -32
  43. package/defaultValidators.js +0 -40
  44. package/determineBlackOrWhiteTextColor.js +0 -4
  45. package/editCellHelper.js +0 -44
  46. package/filterLocalEntitiesToHasura.js +0 -216
  47. package/formatPasteData.js +0 -16
  48. package/getAllRows.js +0 -11
  49. package/getCellCopyText.js +0 -7
  50. package/getCellInfo.js +0 -36
  51. package/getCellVal.js +0 -20
  52. package/getDayjsFormatter.js +0 -35
  53. package/getFieldPathToField.js +0 -7
  54. package/getIdOrCodeOrIndex.js +0 -9
  55. package/getLastSelectedEntity.js +0 -11
  56. package/getNewEntToSelect.js +0 -25
  57. package/getNewName.js +0 -31
  58. package/getRowCopyText.js +0 -28
  59. package/getTableConfigFromStorage.js +0 -5
  60. package/getTextFromEl.js +0 -28
  61. package/getVals.js +0 -8
  62. package/handleCopyColumn.js +0 -21
  63. package/handleCopyHelper.js +0 -15
  64. package/handleCopyRows.js +0 -23
  65. package/handleCopyTable.js +0 -16
  66. package/handlerHelpers.js +0 -24
  67. package/hotkeyUtils.js +0 -131
  68. package/index.js +0 -1
  69. package/initializeHasuraWhereAndFilter.js +0 -27
  70. package/isBeingCalledExcessively.js +0 -24
  71. package/isBottomRightCornerOfRectangle.js +0 -20
  72. package/isEntityClean.js +0 -15
  73. package/isTruthy.js +0 -12
  74. package/isValueEmpty.js +0 -3
  75. package/itemUpload.js +0 -84
  76. package/menuUtils.js +0 -433
  77. package/popoverOverflowModifiers.js +0 -11
  78. package/primarySelectedValue.js +0 -1
  79. package/pureNoFunc.js +0 -31
  80. package/queryParams.js +0 -336
  81. package/removeCleanRows.js +0 -22
  82. package/renderOnDoc.js +0 -32
  83. package/rerenderOnWindowResize.js +0 -26
  84. package/rowClick.js +0 -181
  85. package/selection.js +0 -8
  86. package/showAppSpinner.js +0 -12
  87. package/showDialogOnDocBody.js +0 -33
  88. package/showProgressToast.js +0 -22
  89. package/simplifyHasuraWhere.js +0 -80
  90. package/sortify.js +0 -73
  91. package/style.css +0 -29
  92. package/tableQueryParamsToHasuraClauses.js +0 -113
  93. package/tagUtils.js +0 -45
  94. package/tgFormValues.js +0 -35
  95. package/tg_modalState.js +0 -47
  96. package/throwFormError.js +0 -16
  97. package/toastr.js +0 -148
  98. package/tryToMatchSchemas.js +0 -264
  99. package/typeToCommonType.js +0 -6
  100. package/useDeepEqualMemo.js +0 -15
  101. package/useDialog.js +0 -63
  102. package/useStableReference.js +0 -9
  103. package/useTableEntities.js +0 -38
  104. package/useTraceUpdate.js +0 -19
  105. package/utils.js +0 -37
  106. package/validateTableWideErrors.js +0 -160
  107. package/viewColumn.js +0 -97
  108. package/withField.js +0 -20
  109. package/withFields.js +0 -11
  110. package/withLocalStorage.js +0 -11
  111. package/withSelectTableRecords.js +0 -43
  112. package/withSelectedEntities.js +0 -65
  113. package/withStore.js +0 -10
  114. package/withTableParams.js +0 -288
  115. package/wrapDialog.js +0 -116
@@ -1,216 +0,0 @@
1
- import {
2
- isEmpty,
3
- every,
4
- some,
5
- isEqual,
6
- isString,
7
- isNull,
8
- isArray,
9
- includes,
10
- isObject,
11
- has,
12
- orderBy
13
- } from "lodash-es";
14
-
15
- export function filterLocalEntitiesToHasura(
16
- records,
17
- { where, order_by, limit, offset, isInfinite } = {}
18
- ) {
19
- let filteredRecords = [...records];
20
-
21
- // Apply where clause if it exists
22
- if (where) {
23
- filteredRecords = applyWhereClause(filteredRecords, where);
24
- }
25
-
26
- // Apply order_by if it exists
27
- if (order_by) {
28
- filteredRecords = applyOrderBy(filteredRecords, order_by);
29
- }
30
-
31
- // Store the complete filtered and ordered records for pagination info
32
- const allFilteredRecords = [...filteredRecords];
33
-
34
- // Apply limit and offset
35
- if (!isInfinite && offset !== undefined) {
36
- filteredRecords = filteredRecords.slice(offset);
37
- }
38
-
39
- if (!isInfinite && limit !== undefined) {
40
- filteredRecords = filteredRecords.slice(0, limit);
41
- }
42
-
43
- // For consistency, always return an object with entities, entitiesAcrossPages, and entityCount
44
- return {
45
- entities: filteredRecords,
46
- entitiesAcrossPages: allFilteredRecords,
47
- entityCount: allFilteredRecords.length
48
- };
49
- }
50
-
51
- function applyWhereClause(records, where) {
52
- function applyFilter(record, filter) {
53
- if (isEmpty(filter)) {
54
- return true; // No filter, all records pass
55
- }
56
-
57
- for (const key in filter) {
58
- if (key === "_and") {
59
- if (!every(filter[key], subFilter => applyFilter(record, subFilter))) {
60
- return false;
61
- }
62
- } else if (key === "_or") {
63
- if (!some(filter[key], subFilter => applyFilter(record, subFilter))) {
64
- return false;
65
- }
66
- } else if (key === "_not") {
67
- if (applyFilter(record, filter[key])) {
68
- return false;
69
- }
70
- } else {
71
- const value = record[key];
72
- const conditions = filter[key];
73
-
74
- for (const operator in conditions) {
75
- const conditionValue = conditions[operator];
76
-
77
- // Handle range conditions (_gt/_lt or _gte/_lte combinations)
78
- if (operator === "_gt" && conditions._lt) {
79
- if (!(value > conditionValue && value < conditions._lt))
80
- return false;
81
- continue;
82
- }
83
- if (operator === "_gte" && conditions._lte) {
84
- if (!(value >= conditionValue && value <= conditions._lte))
85
- return false;
86
- continue;
87
- }
88
-
89
- switch (operator) {
90
- case "_eq":
91
- if (!isEqual(value, conditionValue)) return false;
92
- break;
93
- case "_neq":
94
- if (isEqual(value, conditionValue)) return false;
95
- break;
96
- case "_gt":
97
- if (!(value > conditionValue)) return false;
98
- break;
99
- case "_gte":
100
- if (!(value >= conditionValue)) return false;
101
- break;
102
- case "_lt":
103
- if (!(value < conditionValue)) return false;
104
- break;
105
- case "_lte":
106
- if (!(value <= conditionValue)) return false;
107
- break;
108
- case "_like":
109
- if (
110
- !isString(value) ||
111
- !new RegExp(conditionValue.replace(/%/g, ".*")).test(value)
112
- )
113
- return false;
114
- break;
115
- case "_ilike":
116
- if (
117
- !isString(value) ||
118
- !new RegExp(conditionValue.replace(/%/g, ".*"), "i").test(value)
119
- )
120
- return false;
121
- break;
122
- case "_nlike":
123
- if (
124
- !isString(value) ||
125
- new RegExp(conditionValue.replace(/%/g, ".*")).test(value)
126
- )
127
- return false;
128
- break;
129
- case "_nilike":
130
- if (
131
- !isString(value) ||
132
- new RegExp(conditionValue.replace(/%/g, ".*"), "i").test(value)
133
- )
134
- return false;
135
- break;
136
- case "_starts_with":
137
- if (!isString(value) || !value.startsWith(conditionValue))
138
- return false;
139
- break;
140
- case "_ends_with":
141
- if (!isString(value) || !value.endsWith(conditionValue))
142
- return false;
143
- break;
144
- case "_is_null":
145
- if (
146
- (conditionValue && !isNull(value)) ||
147
- (!conditionValue && isNull(value))
148
- )
149
- return false;
150
- break;
151
- case "_contains":
152
- if (
153
- !isArray(value) ||
154
- !every(conditionValue, item => includes(value, item))
155
- )
156
- return false;
157
- break;
158
- case "_contained_in":
159
- if (
160
- !isArray(value) ||
161
- !every(value, item => includes(conditionValue, item))
162
- )
163
- return false;
164
- break;
165
- case "_has_key":
166
- if (!isObject(value) || !has(value, conditionValue)) return false;
167
- break;
168
- case "_has_keys_any":
169
- if (
170
- !isObject(value) ||
171
- !some(conditionValue, item => has(value, item))
172
- )
173
- return false;
174
- break;
175
- case "_has_keys_all":
176
- if (
177
- !isObject(value) ||
178
- !every(conditionValue, item => has(value, item))
179
- )
180
- return false;
181
- break;
182
- case "_similar":
183
- if (
184
- !isString(value) ||
185
- !new RegExp(conditionValue.replace(/%/g, ".*")).test(value)
186
- )
187
- return false;
188
- break;
189
- default:
190
- if (operator.startsWith("_")) {
191
- console.warn(`Unsupported operator: ${operator}`);
192
- return false;
193
- } else {
194
- console.warn(`Unsupported operator: ${operator}`);
195
- return false;
196
- }
197
- }
198
- }
199
- }
200
- }
201
-
202
- return true;
203
- }
204
-
205
- return records.filter(record => applyFilter(record, where));
206
- }
207
-
208
- function applyOrderBy(records, order_by) {
209
- const keys = Object.keys(order_by);
210
- if (keys.length > 0) {
211
- const field = keys[0];
212
- const direction = order_by[field] === "asc" ? "asc" : "desc";
213
- return orderBy(records, [field], [direction]);
214
- }
215
- return records;
216
- }
@@ -1,16 +0,0 @@
1
- import { getFieldPathToField } from "./getFieldPathToField";
2
-
3
- export const formatPasteData = ({ schema, newVal, path }) => {
4
- const pathToField = getFieldPathToField(schema);
5
- const column = pathToField[path];
6
- if (column.type === "genericSelect") {
7
- if (newVal?.__genSelCol === path) {
8
- newVal = newVal.__strVal;
9
- } else {
10
- newVal = undefined;
11
- }
12
- } else {
13
- newVal = Object.hasOwn(newVal, "__strVal") ? newVal.__strVal : newVal;
14
- }
15
- return newVal;
16
- };
package/getAllRows.js DELETED
@@ -1,11 +0,0 @@
1
- export const getAllRows = e => {
2
- const el = e.target.querySelector(".data-table-container")
3
- ? e.target.querySelector(".data-table-container")
4
- : e.target.closest(".data-table-container");
5
-
6
- const allRowEls = el.querySelectorAll(".rt-tr");
7
- if (!allRowEls || !allRowEls.length) {
8
- return;
9
- }
10
- return allRowEls;
11
- };
@@ -1,7 +0,0 @@
1
- export const getCellCopyText = cellWrapper => {
2
- const text = cellWrapper && cellWrapper.getAttribute("data-copy-text");
3
- const jsonText = cellWrapper && cellWrapper.getAttribute("data-copy-json");
4
-
5
- const textContent = text || cellWrapper.textContent || "";
6
- return [textContent, jsonText];
7
- };
package/getCellInfo.js DELETED
@@ -1,36 +0,0 @@
1
- import { getIdOrCodeOrIndex } from "./getIdOrCodeOrIndex";
2
-
3
- export const getCellInfo = ({
4
- columnIndex,
5
- columnPath,
6
- rowId,
7
- schema,
8
- entities,
9
- rowIndex,
10
- isEntityDisabled,
11
- entity
12
- }) => {
13
- const leftpath = schema.fields[columnIndex - 1]?.path;
14
- const rightpath = schema.fields[columnIndex + 1]?.path;
15
- const cellIdToLeft = leftpath && `${rowId}:${leftpath}`;
16
- const cellIdToRight = rightpath && `${rowId}:${rightpath}`;
17
- const rowAboveId =
18
- entities[rowIndex - 1] &&
19
- getIdOrCodeOrIndex(entities[rowIndex - 1], rowIndex - 1);
20
- const rowBelowId =
21
- entities[rowIndex + 1] &&
22
- getIdOrCodeOrIndex(entities[rowIndex + 1], rowIndex + 1);
23
- const cellIdAbove = rowAboveId && `${rowAboveId}:${columnPath}`;
24
- const cellIdBelow = rowBelowId && `${rowBelowId}:${columnPath}`;
25
-
26
- const cellId = `${rowId}:${columnPath}`;
27
- const rowDisabled = isEntityDisabled(entity);
28
- return {
29
- cellId,
30
- cellIdAbove,
31
- cellIdToRight,
32
- cellIdBelow,
33
- cellIdToLeft,
34
- rowDisabled
35
- };
36
- };
package/getCellVal.js DELETED
@@ -1,20 +0,0 @@
1
- import { get } from "lodash-es";
2
- import { isString } from "lodash-es";
3
- import { isTruthy } from "./isTruthy";
4
-
5
- export const getCellVal = (ent, path, col) => {
6
- const isBool = col?.type === "boolean";
7
- let selectedCellVal = get(ent, path, "");
8
- if (isBool) {
9
- if (isString(selectedCellVal)) {
10
- selectedCellVal = selectedCellVal.toLowerCase();
11
- }
12
- selectedCellVal =
13
- selectedCellVal === "true" ||
14
- selectedCellVal === true ||
15
- selectedCellVal === 1 ||
16
- selectedCellVal === "yes";
17
- selectedCellVal = isTruthy(selectedCellVal);
18
- }
19
- return selectedCellVal;
20
- };
@@ -1,35 +0,0 @@
1
- import dayjs from "dayjs";
2
- import LocalizedFormat from "dayjs/plugin/localizedFormat";
3
- import localeData from "dayjs/plugin/localeData";
4
-
5
- dayjs.extend(localeData);
6
- dayjs.extend(LocalizedFormat);
7
- const userLocale = Intl.DateTimeFormat().resolvedOptions().locale;
8
-
9
- if (userLocale) {
10
- const requireLocale = (newLocale, skipCall) => {
11
- if (dayjs.locale() !== newLocale) {
12
- try {
13
- require(`dayjs/locale/${newLocale}.js`);
14
- dayjs.locale(newLocale);
15
- } catch (error) {
16
- // error
17
- if (!skipCall && newLocale.includes("-")) {
18
- requireLocale(newLocale.split("-")[0], true);
19
- }
20
- }
21
- }
22
- };
23
- const localeToUse = userLocale.toLowerCase();
24
- requireLocale(localeToUse);
25
- }
26
-
27
- export default function getDayjsFormatter(format) {
28
- return {
29
- formatDate: date => dayjs(date).format(format),
30
- parseDate: str => dayjs(str, format).toDate(),
31
- placeholder: format?.toLowerCase().includes("l")
32
- ? dayjs.Ls[dayjs.locale()]?.formats[format.toUpperCase()]
33
- : format
34
- };
35
- }
@@ -1,7 +0,0 @@
1
- export const getFieldPathToField = schema => {
2
- const fieldPathToField = {};
3
- schema.fields.forEach(f => {
4
- fieldPathToField[f.path] = f;
5
- });
6
- return fieldPathToField;
7
- };
@@ -1,9 +0,0 @@
1
- export const getIdOrCodeOrIndex = (record, rowIndex) => {
2
- if (record.id || record.id === 0) {
3
- return record.id;
4
- } else if (record.code) {
5
- return record.code;
6
- } else {
7
- return rowIndex;
8
- }
9
- };
@@ -1,11 +0,0 @@
1
- export const getLastSelectedEntity = idMap => {
2
- let lastSelectedEnt;
3
- let latestTime;
4
- Object.values(idMap).forEach(({ time, entity }) => {
5
- if (!latestTime || time > latestTime) {
6
- lastSelectedEnt = entity;
7
- latestTime = time;
8
- }
9
- });
10
- return lastSelectedEnt;
11
- };
@@ -1,25 +0,0 @@
1
- export const getNewEntToSelect = ({
2
- type,
3
- lastSelectedIndex,
4
- entities,
5
- isEntityDisabled
6
- }) => {
7
- let newIndexToSelect;
8
- if (type === "up") {
9
- newIndexToSelect = lastSelectedIndex - 1;
10
- } else {
11
- newIndexToSelect = lastSelectedIndex + 1;
12
- }
13
- const newEntToSelect = entities[newIndexToSelect];
14
- if (!newEntToSelect) return;
15
- if (isEntityDisabled && isEntityDisabled(newEntToSelect)) {
16
- return getNewEntToSelect({
17
- type,
18
- lastSelectedIndex: newIndexToSelect,
19
- entities,
20
- isEntityDisabled
21
- });
22
- } else {
23
- return newEntToSelect;
24
- }
25
- };
package/getNewName.js DELETED
@@ -1,31 +0,0 @@
1
- export function getNewName(list, targetName) {
2
- const usedNumbers = [];
3
-
4
- for (let i = 0; i < list.length; i++) {
5
- const currentName = list[i].name;
6
- const baseName = currentName.replace(/\(\d+\)\.csv$/, ".csv");
7
-
8
- if (baseName === targetName) {
9
- const match = currentName.match(/\((\d+)\)\.csv$/);
10
- if (match) {
11
- usedNumbers[parseInt(match[1])] = true;
12
- } else {
13
- usedNumbers[0] = true;
14
- }
15
- }
16
- }
17
-
18
- let newName = targetName;
19
- for (let i = 0; i <= usedNumbers.length; i++) {
20
- if (!usedNumbers[i]) {
21
- if (i === 0) {
22
- newName = targetName;
23
- } else {
24
- newName = targetName.replace(".csv", `(${i}).csv`);
25
- }
26
- break;
27
- }
28
- }
29
-
30
- return newName;
31
- }
package/getRowCopyText.js DELETED
@@ -1,28 +0,0 @@
1
- import { getCellCopyText } from "./getCellCopyText";
2
- import { flatMap } from "lodash-es";
3
-
4
- export const getRowCopyText = (rowEl, { specificColumn } = {}) => {
5
- //takes in a row element
6
- if (!rowEl) return [];
7
- const textContent = [];
8
- const jsonText = [];
9
-
10
- for (const cellEl of rowEl.children) {
11
- const cellChild = cellEl.querySelector(`[data-copy-text]`);
12
- if (!cellChild) {
13
- if (specificColumn) continue; //strip it
14
- continue; //just leave it blank
15
- }
16
- if (
17
- specificColumn &&
18
- cellChild.getAttribute("data-test") !== specificColumn
19
- ) {
20
- continue;
21
- }
22
- const [t, j] = getCellCopyText(cellChild);
23
- textContent.push(t);
24
- jsonText.push(j);
25
- }
26
-
27
- return [flatMap(textContent).join("\t"), jsonText];
28
- };
@@ -1,5 +0,0 @@
1
- export default function getTableConfigFromStorage(formName) {
2
- let tableConfig = window.localStorage.getItem(formName);
3
- tableConfig = tableConfig && JSON.parse(tableConfig);
4
- return tableConfig;
5
- }
package/getTextFromEl.js DELETED
@@ -1,28 +0,0 @@
1
- import React from "react";
2
-
3
- export default function getTextFromEl(el, options = {}) {
4
- const { lowerCase } = options;
5
- if (React.isValidElement(el)) {
6
- return el && el.props && el.props.children
7
- ? (el.props.children.reduce
8
- ? el.props.children
9
- : [el.props.children]
10
- ).reduce((acc, child) => {
11
- if (child && child.props && child.props.children) {
12
- acc += getTextFromEl(child);
13
- } else if (typeof child === "string") {
14
- if (lowerCase) {
15
- acc += child.toLowerCase();
16
- } else {
17
- acc += child;
18
- }
19
- } else if (typeof child === "number") {
20
- acc += child + "";
21
- }
22
- return acc;
23
- }, "")
24
- : "";
25
- } else {
26
- return el;
27
- }
28
- }
package/getVals.js DELETED
@@ -1,8 +0,0 @@
1
- import { isFunction } from "lodash-es";
2
-
3
- export function getVals(values) {
4
- if (isFunction(values)) {
5
- return values();
6
- }
7
- return values;
8
- }
@@ -1,21 +0,0 @@
1
- import { getAllRows } from "./getAllRows";
2
- import { getIdOrCodeOrIndex } from "./getIdOrCodeOrIndex";
3
- import { handleCopyRows } from "./handleCopyRows";
4
-
5
- export const handleCopyColumn = (e, cellWrapper, selectedRecords) => {
6
- const specificColumn = cellWrapper.getAttribute("data-test");
7
- let rowElsToCopy = getAllRows(e);
8
- if (!rowElsToCopy) return;
9
- if (selectedRecords) {
10
- const ids = selectedRecords.map(e => getIdOrCodeOrIndex(e)?.toString());
11
- rowElsToCopy = Array.from(rowElsToCopy).filter(rowEl => {
12
- const id = rowEl.closest(".rt-tr-group")?.getAttribute("data-test-id");
13
- return id !== undefined && ids.includes(id);
14
- });
15
- }
16
- if (!rowElsToCopy) return;
17
- handleCopyRows(rowElsToCopy, {
18
- specificColumn,
19
- onFinishMsg: "Column Copied"
20
- });
21
- };
@@ -1,15 +0,0 @@
1
- import copy from "copy-to-clipboard";
2
-
3
- export const handleCopyHelper = (stringToCopy, jsonToCopy, message) => {
4
- !window.Cypress &&
5
- copy(stringToCopy, {
6
- onCopy: clipboardData => {
7
- clipboardData.setData("application/json", JSON.stringify(jsonToCopy));
8
- },
9
- // keep this so that pasting into spreadsheets works.
10
- format: "text/plain"
11
- });
12
- if (message) {
13
- window.toastr.success(message);
14
- }
15
- };
package/handleCopyRows.js DELETED
@@ -1,23 +0,0 @@
1
- import download from "downloadjs";
2
- import { getRowCopyText } from "./getRowCopyText";
3
- import { handleCopyHelper } from "./handleCopyHelper";
4
-
5
- export const handleCopyRows = (
6
- rowElsToCopy,
7
- { specificColumn, onFinishMsg, isDownload } = {}
8
- ) => {
9
- let textToCopy = [];
10
- const jsonToCopy = [];
11
- rowElsToCopy.forEach(rowEl => {
12
- const [t, j] = getRowCopyText(rowEl, { specificColumn });
13
- textToCopy.push(t);
14
- jsonToCopy.push(j);
15
- });
16
- textToCopy = textToCopy.filter(text => text).join("\n");
17
- if (!textToCopy) return window.toastr.warning("No text to copy");
18
- if (isDownload) {
19
- download(textToCopy.replaceAll("\t", ","), "tableData.csv", "text/csv");
20
- } else {
21
- handleCopyHelper(textToCopy, jsonToCopy, onFinishMsg || "Row Copied");
22
- }
23
- };
@@ -1,16 +0,0 @@
1
- import { getAllRows } from "./getAllRows";
2
- import { handleCopyRows } from "./handleCopyRows";
3
-
4
- export const handleCopyTable = (e, opts) => {
5
- try {
6
- const allRowEls = getAllRows(e);
7
- if (!allRowEls) return;
8
- handleCopyRows(allRowEls, {
9
- ...opts,
10
- onFinishMsg: "Table Copied"
11
- });
12
- } catch (error) {
13
- console.error(`error:`, error);
14
- window.toastr.error("Error copying rows.");
15
- }
16
- };
package/handlerHelpers.js DELETED
@@ -1,24 +0,0 @@
1
- export const onEnterHelper = callback => ({
2
- onKeyDown: event => {
3
- if (event.key === "Enter") {
4
- callback(event);
5
- }
6
- }
7
- });
8
-
9
- export const onBlurHelper = callback => ({
10
- onBlur: event => {
11
- callback(event);
12
- }
13
- });
14
-
15
- export const onEnterOrBlurHelper = callback => ({
16
- onKeyDown: function (event) {
17
- if (event.key === "Enter") {
18
- callback(event);
19
- }
20
- },
21
- onBlur: function (event) {
22
- callback(event);
23
- }
24
- });