@teselagen/ui 0.8.6-beta.23 → 0.8.6-beta.25
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 +7 -0
- package/DataTable/defaultProps.d.ts +43 -0
- package/DataTable/utils/computePresets.d.ts +1 -0
- package/DataTable/utils/convertSchema.d.ts +22 -2
- package/DataTable/utils/formatPasteData.d.ts +11 -5
- package/DataTable/utils/getAllRows.d.ts +4 -1
- package/DataTable/utils/getCellCopyText.d.ts +1 -1
- package/DataTable/utils/getCellInfo.d.ts +20 -15
- package/DataTable/utils/getFieldPathToField.d.ts +5 -1
- package/DataTable/utils/getIdOrCodeOrIndex.d.ts +2 -1
- package/DataTable/utils/getLastSelectedEntity.d.ts +7 -1
- package/DataTable/utils/getNewEntToSelect.d.ts +7 -6
- package/DataTable/utils/getRowCopyText.d.ts +1 -1
- package/DataTable/utils/handleCopyColumn.d.ts +1 -1
- package/DataTable/utils/handleCopyTable.d.ts +1 -1
- package/DataTable/utils/initializeHasuraWhereAndFilter.d.ts +22 -1
- package/DataTable/utils/isBottomRightCornerOfRectangle.d.ts +10 -8
- package/DataTable/utils/isEntityClean.d.ts +3 -1
- package/DataTable/utils/primarySelectedValue.d.ts +1 -1
- package/DataTable/utils/removeCleanRows.d.ts +11 -3
- package/DataTable/utils/selection.d.ts +3 -1
- package/DataTable/utils/types/Entity.d.ts +5 -0
- package/DataTable/utils/types/Field.d.ts +4 -0
- package/DataTable/utils/types/OrderBy.d.ts +11 -0
- package/DataTable/utils/types/Schema.d.ts +4 -0
- package/DataTable/utils/useDeepEqualMemo.d.ts +1 -0
- package/DataTable/utils/useTableEntities.d.ts +17 -4
- package/DataTable/utils/useTableParams.d.ts +49 -0
- package/DataTable/utils/utils.d.ts +16 -5
- package/index.cjs.js +147 -121
- package/index.es.js +147 -121
- package/package.json +2 -2
- package/src/DataTable/Columns.jsx +945 -0
- package/src/DataTable/EditabelCell.js +44 -0
- package/src/DataTable/EditabelCell.jsx +44 -0
- package/src/DataTable/RenderCell.jsx +191 -0
- package/src/DataTable/defaultProps.js +45 -0
- package/src/DataTable/index.js +96 -68
- package/src/DataTable/utils/computePresets.js +42 -0
- package/src/DataTable/utils/convertSchema.ts +79 -0
- package/src/DataTable/utils/formatPasteData.ts +34 -0
- package/src/DataTable/utils/getAllRows.js +2 -6
- package/src/DataTable/utils/getAllRows.ts +11 -0
- package/src/DataTable/utils/getCellCopyText.ts +7 -0
- package/src/DataTable/utils/getCellInfo.ts +46 -0
- package/src/DataTable/utils/getFieldPathToField.ts +10 -0
- package/src/DataTable/utils/getIdOrCodeOrIndex.ts +14 -0
- package/src/DataTable/utils/getLastSelectedEntity.ts +15 -0
- package/src/DataTable/utils/getNewEntToSelect.ts +32 -0
- package/src/DataTable/utils/handleCopyColumn.js +2 -2
- package/src/DataTable/utils/handleCopyTable.js +2 -2
- package/src/DataTable/utils/initializeHasuraWhereAndFilter.ts +35 -0
- package/src/DataTable/utils/isBottomRightCornerOfRectangle.ts +27 -0
- package/src/DataTable/utils/isEntityClean.ts +15 -0
- package/src/DataTable/utils/primarySelectedValue.ts +1 -0
- package/src/DataTable/utils/removeCleanRows.ts +25 -0
- package/src/DataTable/utils/selection.ts +11 -0
- package/src/DataTable/utils/types/Entity.ts +7 -0
- package/src/DataTable/utils/types/Field.ts +4 -0
- package/src/DataTable/utils/types/OrderBy.ts +15 -0
- package/src/DataTable/utils/types/Schema.ts +5 -0
- package/src/DataTable/utils/useDeepEqualMemo.js +10 -0
- package/src/DataTable/utils/useTableEntities.ts +60 -0
- package/src/DataTable/utils/useTableParams.js +361 -0
- package/src/DataTable/utils/utils.ts +39 -0
- package/style.css +10537 -0
package/index.cjs.js
CHANGED
|
@@ -15867,6 +15867,7 @@ var itemSizeEstimator = /* @__PURE__ */ __name(function itemSizeEstimator2() {
|
|
|
15867
15867
|
return 41.36;
|
|
15868
15868
|
}, "itemSizeEstimator");
|
|
15869
15869
|
var ReactTableDefaults = defaultProps;
|
|
15870
|
+
var VIRTUALIZE_CUTOFF_LENGTH = 200;
|
|
15870
15871
|
var ReactTable = function(_Methods) {
|
|
15871
15872
|
_inherits$8(ReactTable2, _Methods);
|
|
15872
15873
|
function ReactTable2(props) {
|
|
@@ -16452,7 +16453,7 @@ var ReactTable = function(_Methods) {
|
|
|
16452
16453
|
minWidth: rowMinWidth + "px"
|
|
16453
16454
|
})
|
|
16454
16455
|
}, tBodyProps.rest),
|
|
16455
|
-
pageRows.length <
|
|
16456
|
+
_this2.props.noVirtual || pageRows.length < VIRTUALIZE_CUTOFF_LENGTH ? pageRows.map(function(d2, i2) {
|
|
16456
16457
|
return makePageRow(d2, i2);
|
|
16457
16458
|
}) : React.createElement(ReactList, {
|
|
16458
16459
|
type: "variable",
|
|
@@ -16545,18 +16546,21 @@ function isEntityClean(e) {
|
|
|
16545
16546
|
}
|
|
16546
16547
|
__name(isEntityClean, "isEntityClean");
|
|
16547
16548
|
const getIdOrCodeOrIndex = /* @__PURE__ */ __name((record, rowIndex) => {
|
|
16548
|
-
if (record.id || record.id === 0) {
|
|
16549
|
+
if ("id" in record && (record.id || record.id === 0)) {
|
|
16549
16550
|
return record.id;
|
|
16550
|
-
} else if (record.code) {
|
|
16551
|
+
} else if ("code" in record && record.code) {
|
|
16551
16552
|
return record.code;
|
|
16552
16553
|
} else {
|
|
16554
|
+
if (rowIndex === void 0 || rowIndex === null) {
|
|
16555
|
+
throw new Error("id, code, or rowIndex must be provided");
|
|
16556
|
+
}
|
|
16553
16557
|
return rowIndex;
|
|
16554
16558
|
}
|
|
16555
16559
|
}, "getIdOrCodeOrIndex");
|
|
16556
16560
|
const getSelectedRowsFromEntities = /* @__PURE__ */ __name((entities, idMap) => {
|
|
16557
16561
|
if (!idMap) return [];
|
|
16558
16562
|
return entities.reduce((acc, entity, i2) => {
|
|
16559
|
-
return idMap[getIdOrCodeOrIndex(entity, i2)] ? acc.concat(i2) : acc;
|
|
16563
|
+
return idMap[getIdOrCodeOrIndex(entity, i2)] ? acc.concat([i2]) : acc;
|
|
16560
16564
|
}, []);
|
|
16561
16565
|
}, "getSelectedRowsFromEntities");
|
|
16562
16566
|
const removeCleanRows = /* @__PURE__ */ __name((entities, cellValidation) => {
|
|
@@ -16636,17 +16640,22 @@ const getFieldPathToField = /* @__PURE__ */ __name((schema) => {
|
|
|
16636
16640
|
});
|
|
16637
16641
|
return fieldPathToField;
|
|
16638
16642
|
}, "getFieldPathToField");
|
|
16639
|
-
const formatPasteData = /* @__PURE__ */ __name(({
|
|
16643
|
+
const formatPasteData = /* @__PURE__ */ __name(({
|
|
16644
|
+
schema,
|
|
16645
|
+
newVal,
|
|
16646
|
+
path: path2
|
|
16647
|
+
}) => {
|
|
16640
16648
|
const pathToField = getFieldPathToField(schema);
|
|
16641
16649
|
const column = pathToField[path2];
|
|
16642
16650
|
if (column.type === "genericSelect") {
|
|
16643
|
-
|
|
16644
|
-
|
|
16651
|
+
const value = newVal;
|
|
16652
|
+
if (value.__genSelCol === path2) {
|
|
16653
|
+
newVal = value.__strVal;
|
|
16645
16654
|
} else {
|
|
16646
16655
|
newVal = void 0;
|
|
16647
16656
|
}
|
|
16648
16657
|
} else {
|
|
16649
|
-
newVal =
|
|
16658
|
+
newVal = typeof newVal === "object" && newVal !== null && "__strVal" in newVal ? newVal.__strVal : newVal;
|
|
16650
16659
|
}
|
|
16651
16660
|
return newVal;
|
|
16652
16661
|
}, "formatPasteData");
|
|
@@ -16671,18 +16680,19 @@ const endsWithNumber = /* @__PURE__ */ __name((str) => {
|
|
|
16671
16680
|
return /[0-9]+$/.test(str);
|
|
16672
16681
|
}, "endsWithNumber");
|
|
16673
16682
|
const getNumberStrAtEnd = /* @__PURE__ */ __name((str) => {
|
|
16683
|
+
var _a;
|
|
16674
16684
|
if (endsWithNumber(str)) {
|
|
16675
|
-
return str.match(/[0-9]+$/)[0];
|
|
16685
|
+
return (_a = str.match(/[0-9]+$/)) == null ? void 0 : _a[0];
|
|
16676
16686
|
}
|
|
16677
16687
|
return null;
|
|
16678
16688
|
}, "getNumberStrAtEnd");
|
|
16679
16689
|
const stripNumberAtEnd = /* @__PURE__ */ __name((str) => {
|
|
16680
16690
|
var _a;
|
|
16681
|
-
return (_a = str == null ? void 0 : str.replace) == null ? void 0 : _a.call(str, getNumberStrAtEnd(str), "");
|
|
16691
|
+
return (_a = str == null ? void 0 : str.replace) == null ? void 0 : _a.call(str, getNumberStrAtEnd(str) || "", "");
|
|
16682
16692
|
}, "stripNumberAtEnd");
|
|
16683
|
-
const getAllRows = /* @__PURE__ */ __name((
|
|
16684
|
-
|
|
16685
|
-
const allRowEls =
|
|
16693
|
+
const getAllRows = /* @__PURE__ */ __name((tableRef) => {
|
|
16694
|
+
var _a, _b;
|
|
16695
|
+
const allRowEls = (_b = (_a = tableRef.current) == null ? void 0 : _a.tableRef) == null ? void 0 : _b.querySelectorAll(".rt-tr");
|
|
16686
16696
|
if (!allRowEls || !allRowEls.length) {
|
|
16687
16697
|
return;
|
|
16688
16698
|
}
|
|
@@ -16715,7 +16725,7 @@ const getNewEntToSelect = /* @__PURE__ */ __name(({
|
|
|
16715
16725
|
}, "getNewEntToSelect");
|
|
16716
16726
|
const getLastSelectedEntity = /* @__PURE__ */ __name((idMap) => {
|
|
16717
16727
|
let lastSelectedEnt;
|
|
16718
|
-
let latestTime;
|
|
16728
|
+
let latestTime = null;
|
|
16719
16729
|
Object.values(idMap).forEach(({ time, entity }) => {
|
|
16720
16730
|
if (!latestTime || time > latestTime) {
|
|
16721
16731
|
lastSelectedEnt = entity;
|
|
@@ -16755,9 +16765,9 @@ const getCellInfo = /* @__PURE__ */ __name(({
|
|
|
16755
16765
|
};
|
|
16756
16766
|
}, "getCellInfo");
|
|
16757
16767
|
const getCellCopyText = /* @__PURE__ */ __name((cellWrapper) => {
|
|
16758
|
-
const text2 = cellWrapper
|
|
16759
|
-
const jsonText = cellWrapper
|
|
16760
|
-
const textContent = text2 || cellWrapper.textContent || "";
|
|
16768
|
+
const text2 = cellWrapper == null ? void 0 : cellWrapper.getAttribute("data-copy-text");
|
|
16769
|
+
const jsonText = cellWrapper == null ? void 0 : cellWrapper.getAttribute("data-copy-json");
|
|
16770
|
+
const textContent = text2 || (cellWrapper == null ? void 0 : cellWrapper.textContent) || "";
|
|
16761
16771
|
return [textContent, jsonText];
|
|
16762
16772
|
}, "getCellCopyText");
|
|
16763
16773
|
const getRowCopyText = /* @__PURE__ */ __name((rowEl, { specificColumn } = {}) => {
|
|
@@ -16949,14 +16959,14 @@ const handleCopyRows = /* @__PURE__ */ __name((rowElsToCopy, { specificColumn, o
|
|
|
16949
16959
|
handleCopyHelper(textToCopy, jsonToCopy, onFinishMsg || "Row Copied");
|
|
16950
16960
|
}
|
|
16951
16961
|
}, "handleCopyRows");
|
|
16952
|
-
const handleCopyColumn = /* @__PURE__ */ __name((
|
|
16962
|
+
const handleCopyColumn = /* @__PURE__ */ __name((tableRef, cellWrapper, selectedRecords) => {
|
|
16953
16963
|
const specificColumn = cellWrapper.getAttribute("data-test");
|
|
16954
|
-
let rowElsToCopy = getAllRows(
|
|
16964
|
+
let rowElsToCopy = getAllRows(tableRef);
|
|
16955
16965
|
if (!rowElsToCopy) return;
|
|
16956
16966
|
if (selectedRecords) {
|
|
16957
|
-
const ids2 = selectedRecords.map((
|
|
16967
|
+
const ids2 = selectedRecords.map((e) => {
|
|
16958
16968
|
var _a;
|
|
16959
|
-
return (_a = getIdOrCodeOrIndex(
|
|
16969
|
+
return (_a = getIdOrCodeOrIndex(e)) == null ? void 0 : _a.toString();
|
|
16960
16970
|
});
|
|
16961
16971
|
rowElsToCopy = Array.from(rowElsToCopy).filter((rowEl) => {
|
|
16962
16972
|
var _a;
|
|
@@ -16989,9 +16999,9 @@ const isBottomRightCornerOfRectangle = /* @__PURE__ */ __name(({
|
|
|
16989
16999
|
const isBottomRight = i2 === lastRowIndex && cellIndex === lastCellIndex;
|
|
16990
17000
|
return isBottomRight;
|
|
16991
17001
|
}, "isBottomRightCornerOfRectangle");
|
|
16992
|
-
const handleCopyTable = /* @__PURE__ */ __name((
|
|
17002
|
+
const handleCopyTable = /* @__PURE__ */ __name((tableRef, opts) => {
|
|
16993
17003
|
try {
|
|
16994
|
-
const allRowEls = getAllRows(
|
|
17004
|
+
const allRowEls = getAllRows(tableRef);
|
|
16995
17005
|
if (!allRowEls) return;
|
|
16996
17006
|
handleCopyRows(allRowEls, __spreadProps(__spreadValues({}, opts), {
|
|
16997
17007
|
onFinishMsg: "Table Copied"
|
|
@@ -17028,13 +17038,15 @@ const useTableEntities = /* @__PURE__ */ __name((tableFormName) => {
|
|
|
17028
17038
|
},
|
|
17029
17039
|
[dispatch, tableFormName]
|
|
17030
17040
|
);
|
|
17031
|
-
const { allOrderedEntities, selectedEntities } = reactRedux.useSelector(
|
|
17032
|
-
|
|
17033
|
-
|
|
17034
|
-
|
|
17035
|
-
|
|
17036
|
-
|
|
17037
|
-
|
|
17041
|
+
const { allOrderedEntities, selectedEntities } = reactRedux.useSelector(
|
|
17042
|
+
(state) => {
|
|
17043
|
+
var _a, _b, _c, _d, _e, _f;
|
|
17044
|
+
return {
|
|
17045
|
+
allOrderedEntities: (_c = (_b = (_a = state.form) == null ? void 0 : _a[tableFormName]) == null ? void 0 : _b.values) == null ? void 0 : _c.allOrderedEntities,
|
|
17046
|
+
selectedEntities: (_f = (_e = (_d = state.form) == null ? void 0 : _d[tableFormName]) == null ? void 0 : _e.values) == null ? void 0 : _f.reduxFormSelectedEntityIdMap
|
|
17047
|
+
};
|
|
17048
|
+
}
|
|
17049
|
+
);
|
|
17038
17050
|
return { selectTableEntities, allOrderedEntities, selectedEntities };
|
|
17039
17051
|
}, "useTableEntities");
|
|
17040
17052
|
const useDeepEqualMemo = /* @__PURE__ */ __name((value) => {
|
|
@@ -19904,8 +19916,9 @@ function initializeHasuraWhereAndFilter(additionalFilter, where = {}, currentPar
|
|
|
19904
19916
|
if (newWhere) {
|
|
19905
19917
|
Object.assign(where, newWhere);
|
|
19906
19918
|
}
|
|
19907
|
-
} else if (typeof additionalFilter === "object")
|
|
19919
|
+
} else if (typeof additionalFilter === "object" && additionalFilter !== null) {
|
|
19908
19920
|
where._and.push(additionalFilter);
|
|
19921
|
+
}
|
|
19909
19922
|
}
|
|
19910
19923
|
__name(initializeHasuraWhereAndFilter, "initializeHasuraWhereAndFilter");
|
|
19911
19924
|
const defaultPageSizes = [5, 10, 15, 25, 50, 100, 200, 400];
|
|
@@ -37232,7 +37245,7 @@ const multiViewColumn = __spreadProps(__spreadValues({}, viewColumn), {
|
|
|
37232
37245
|
));
|
|
37233
37246
|
}, "render")
|
|
37234
37247
|
});
|
|
37235
|
-
|
|
37248
|
+
const convertSchema = /* @__PURE__ */ __name((schema) => {
|
|
37236
37249
|
let schemaToUse = schema;
|
|
37237
37250
|
if (!schemaToUse.fields && Array.isArray(schema)) {
|
|
37238
37251
|
schemaToUse = {
|
|
@@ -37241,35 +37254,26 @@ function convertSchema(schema) {
|
|
|
37241
37254
|
}
|
|
37242
37255
|
schemaToUse = __spreadValues({}, schemaToUse);
|
|
37243
37256
|
schemaToUse.fields = schemaToUse.fields.map((field, i2) => {
|
|
37244
|
-
let fieldToUse = field;
|
|
37245
37257
|
if (typeof field === "string") {
|
|
37246
|
-
|
|
37258
|
+
return {
|
|
37247
37259
|
displayName: startCase(camelCase(field)),
|
|
37248
37260
|
path: field,
|
|
37249
37261
|
type: "string"
|
|
37250
37262
|
};
|
|
37251
|
-
} else
|
|
37252
|
-
fieldToUse =
|
|
37253
|
-
|
|
37254
|
-
|
|
37255
|
-
|
|
37256
|
-
|
|
37257
|
-
|
|
37258
|
-
|
|
37259
|
-
}
|
|
37260
|
-
|
|
37261
|
-
if (!fieldToUse.path) {
|
|
37262
|
-
fieldToUse = __spreadProps(__spreadValues({}, fieldToUse), {
|
|
37263
|
-
filterDisabled: true,
|
|
37264
|
-
sortDisabled: true,
|
|
37265
|
-
path: "fake-path" + i2
|
|
37266
|
-
});
|
|
37263
|
+
} else {
|
|
37264
|
+
const fieldToUse = __spreadValues({}, field);
|
|
37265
|
+
fieldToUse.type = fieldToUse.type || "string";
|
|
37266
|
+
fieldToUse.displayName = fieldToUse.displayName || startCase(camelCase(fieldToUse.path || ""));
|
|
37267
|
+
if (!fieldToUse.path) {
|
|
37268
|
+
fieldToUse.filterDisabled = true;
|
|
37269
|
+
fieldToUse.sortDisabled = true;
|
|
37270
|
+
fieldToUse.path = "fake-path" + i2;
|
|
37271
|
+
}
|
|
37272
|
+
return fieldToUse;
|
|
37267
37273
|
}
|
|
37268
|
-
return fieldToUse;
|
|
37269
37274
|
});
|
|
37270
37275
|
return schemaToUse;
|
|
37271
|
-
}
|
|
37272
|
-
__name(convertSchema, "convertSchema");
|
|
37276
|
+
}, "convertSchema");
|
|
37273
37277
|
function mergeSchemas(_originalSchema, _overrideSchema) {
|
|
37274
37278
|
const originalSchema = convertSchema(_originalSchema);
|
|
37275
37279
|
const overrideSchema = convertSchema(_overrideSchema);
|
|
@@ -56320,6 +56324,7 @@ const DataTable = /* @__PURE__ */ __name((_I) => {
|
|
|
56320
56324
|
);
|
|
56321
56325
|
const tableRef = React.useRef();
|
|
56322
56326
|
const alreadySelected = React.useRef(false);
|
|
56327
|
+
const [noVirtual, setNoVirtual] = React.useState(false);
|
|
56323
56328
|
const [onlyShowRowsWErrors, setOnlyShowRowsWErrors] = React.useState(false);
|
|
56324
56329
|
const [entitiesUndoRedoStack, setEntitiesUndoRedoStack] = React.useState({
|
|
56325
56330
|
currentVersion: 0
|
|
@@ -57161,76 +57166,94 @@ const DataTable = /* @__PURE__ */ __name((_I) => {
|
|
|
57161
57166
|
updateEntitiesHelper,
|
|
57162
57167
|
updateValidation
|
|
57163
57168
|
]);
|
|
57164
|
-
const
|
|
57165
|
-
(
|
|
57166
|
-
|
|
57167
|
-
|
|
57168
|
-
|
|
57169
|
-
|
|
57170
|
-
|
|
57171
|
-
|
|
57172
|
-
|
|
57173
|
-
|
|
57174
|
-
|
|
57175
|
-
|
|
57176
|
-
|
|
57177
|
-
|
|
57178
|
-
|
|
57179
|
-
|
|
57180
|
-
|
|
57181
|
-
|
|
57182
|
-
|
|
57183
|
-
|
|
57184
|
-
|
|
57185
|
-
|
|
57186
|
-
|
|
57187
|
-
|
|
57188
|
-
|
|
57189
|
-
|
|
57190
|
-
|
|
57191
|
-
|
|
57192
|
-
|
|
57193
|
-
|
|
57194
|
-
|
|
57195
|
-
|
|
57196
|
-
|
|
57197
|
-
|
|
57198
|
-
if (
|
|
57199
|
-
|
|
57200
|
-
} else {
|
|
57201
|
-
const jsonRow = [];
|
|
57202
|
-
let [rowCopyText, json] = getRowCopyText(allRows[i2 + 1]);
|
|
57203
|
-
rowCopyText = rowCopyText.split(" ");
|
|
57204
|
-
times(row.length, (i22) => {
|
|
57205
|
-
const cell = row[i22];
|
|
57206
|
-
if (cell) {
|
|
57207
|
-
fullCellText += rowCopyText[i22];
|
|
57208
|
-
jsonRow.push(json[i22]);
|
|
57209
|
-
}
|
|
57210
|
-
if (i22 !== row.length - 1 && i22 >= firstCellIndex)
|
|
57211
|
-
fullCellText += " ";
|
|
57212
|
-
});
|
|
57213
|
-
fullJson.push(jsonRow);
|
|
57169
|
+
const waitUntilAllRowsAreRendered = React.useCallback(() => {
|
|
57170
|
+
return new Promise((resolve) => {
|
|
57171
|
+
const interval = setInterval(() => {
|
|
57172
|
+
var _a2, _b;
|
|
57173
|
+
const allRowEls = (_b = (_a2 = tableRef.current) == null ? void 0 : _a2.tableRef) == null ? void 0 : _b.querySelectorAll(".rt-tr-group");
|
|
57174
|
+
if ((allRowEls == null ? void 0 : allRowEls.length) === entities.length) {
|
|
57175
|
+
clearInterval(interval);
|
|
57176
|
+
resolve();
|
|
57177
|
+
}
|
|
57178
|
+
}, 50);
|
|
57179
|
+
});
|
|
57180
|
+
}, []);
|
|
57181
|
+
const handleCopySelectedCells = React.useCallback(() => __async(exports, null, function* () {
|
|
57182
|
+
if (isEmpty$1(selectedCells)) return;
|
|
57183
|
+
if (entities.length > VIRTUALIZE_CUTOFF_LENGTH) {
|
|
57184
|
+
setNoVirtual(true);
|
|
57185
|
+
yield waitUntilAllRowsAreRendered();
|
|
57186
|
+
}
|
|
57187
|
+
const pathToIndex = getFieldPathToIndex(schema);
|
|
57188
|
+
const entityIdToEntity = getEntityIdToEntity(entities);
|
|
57189
|
+
const selectionGrid = [];
|
|
57190
|
+
let firstRowIndex;
|
|
57191
|
+
let firstCellIndex;
|
|
57192
|
+
Object.keys(selectedCells).forEach((key) => {
|
|
57193
|
+
const [rowId, path2] = key.split(":");
|
|
57194
|
+
const eInfo = entityIdToEntity[rowId];
|
|
57195
|
+
if (eInfo) {
|
|
57196
|
+
if (firstRowIndex === void 0 || eInfo.i < firstRowIndex) {
|
|
57197
|
+
firstRowIndex = eInfo.i;
|
|
57198
|
+
}
|
|
57199
|
+
if (!selectionGrid[eInfo.i]) {
|
|
57200
|
+
selectionGrid[eInfo.i] = [];
|
|
57201
|
+
}
|
|
57202
|
+
const cellIndex = pathToIndex[path2];
|
|
57203
|
+
if (firstCellIndex === void 0 || cellIndex < firstCellIndex) {
|
|
57204
|
+
firstCellIndex = cellIndex;
|
|
57214
57205
|
}
|
|
57215
|
-
|
|
57216
|
-
|
|
57217
|
-
|
|
57218
|
-
|
|
57219
|
-
|
|
57220
|
-
|
|
57206
|
+
selectionGrid[eInfo.i][cellIndex] = true;
|
|
57207
|
+
}
|
|
57208
|
+
});
|
|
57209
|
+
if (firstRowIndex === void 0) return;
|
|
57210
|
+
const allRows = getAllRows(tableRef);
|
|
57211
|
+
let fullCellText = "";
|
|
57212
|
+
const fullJson = [];
|
|
57213
|
+
times(selectionGrid.length, (i2) => {
|
|
57214
|
+
const row = selectionGrid[i2];
|
|
57215
|
+
if (fullCellText) {
|
|
57216
|
+
fullCellText += "\n";
|
|
57217
|
+
}
|
|
57218
|
+
if (!row) {
|
|
57219
|
+
return;
|
|
57220
|
+
} else {
|
|
57221
|
+
const jsonRow = [];
|
|
57222
|
+
let [rowCopyText, json] = getRowCopyText(allRows[i2 + 1]);
|
|
57223
|
+
rowCopyText = rowCopyText.split(" ");
|
|
57224
|
+
times(row.length, (i22) => {
|
|
57225
|
+
const cell = row[i22];
|
|
57226
|
+
if (cell) {
|
|
57227
|
+
fullCellText += rowCopyText[i22];
|
|
57228
|
+
jsonRow.push(json[i22]);
|
|
57229
|
+
}
|
|
57230
|
+
if (i22 !== row.length - 1 && i22 >= firstCellIndex) fullCellText += " ";
|
|
57231
|
+
});
|
|
57232
|
+
fullJson.push(jsonRow);
|
|
57233
|
+
}
|
|
57234
|
+
});
|
|
57235
|
+
if (!fullCellText) return window.toastr.warning("No text to copy");
|
|
57236
|
+
handleCopyHelper(fullCellText, fullJson, "Selected cells copied");
|
|
57237
|
+
setNoVirtual(false);
|
|
57238
|
+
}), [entities, selectedCells, schema, waitUntilAllRowsAreRendered]);
|
|
57221
57239
|
const handleCopySelectedRows = React.useCallback(
|
|
57222
|
-
(selectedRecords,
|
|
57223
|
-
|
|
57224
|
-
|
|
57240
|
+
(selectedRecords) => __async(exports, null, function* () {
|
|
57241
|
+
if (entities.length > VIRTUALIZE_CUTOFF_LENGTH) {
|
|
57242
|
+
setNoVirtual(true);
|
|
57243
|
+
yield waitUntilAllRowsAreRendered();
|
|
57244
|
+
}
|
|
57245
|
+
const idToIndex = entities.reduce((acc, e, i2) => {
|
|
57246
|
+
acc[e.id || e.code] = i2;
|
|
57225
57247
|
return acc;
|
|
57226
57248
|
}, {});
|
|
57227
57249
|
const rowNumbersToCopy = selectedRecords.map((rec) => idToIndex[rec.id || rec.code] + 1).sort();
|
|
57228
57250
|
if (!rowNumbersToCopy.length) return;
|
|
57229
57251
|
rowNumbersToCopy.unshift(0);
|
|
57230
57252
|
try {
|
|
57231
|
-
const allRowEls = getAllRows(
|
|
57253
|
+
const allRowEls = getAllRows(tableRef);
|
|
57232
57254
|
if (!allRowEls) return;
|
|
57233
57255
|
const rowEls = rowNumbersToCopy.map((i2) => allRowEls[i2]);
|
|
57256
|
+
if (window.Cypress) window.Cypress.__copiedRowsLength = rowEls.length;
|
|
57234
57257
|
handleCopyRows(rowEls, {
|
|
57235
57258
|
onFinishMsg: "Selected rows copied"
|
|
57236
57259
|
});
|
|
@@ -57238,8 +57261,9 @@ const DataTable = /* @__PURE__ */ __name((_I) => {
|
|
|
57238
57261
|
console.error(`error:`, error);
|
|
57239
57262
|
window.toastr.error("Error copying rows.");
|
|
57240
57263
|
}
|
|
57241
|
-
|
|
57242
|
-
|
|
57264
|
+
setNoVirtual(false);
|
|
57265
|
+
}),
|
|
57266
|
+
[entities, waitUntilAllRowsAreRendered]
|
|
57243
57267
|
);
|
|
57244
57268
|
const handleCopyHotkey = React.useCallback(
|
|
57245
57269
|
(e) => {
|
|
@@ -58006,7 +58030,7 @@ const DataTable = /* @__PURE__ */ __name((_I) => {
|
|
|
58006
58030
|
{
|
|
58007
58031
|
key: "copyColumn",
|
|
58008
58032
|
onClick: /* @__PURE__ */ __name(() => {
|
|
58009
|
-
handleCopyColumn(
|
|
58033
|
+
handleCopyColumn(tableRef, cellWrapper);
|
|
58010
58034
|
}, "onClick"),
|
|
58011
58035
|
text: "Column"
|
|
58012
58036
|
}
|
|
@@ -58019,7 +58043,7 @@ const DataTable = /* @__PURE__ */ __name((_I) => {
|
|
|
58019
58043
|
{
|
|
58020
58044
|
key: "copyColumnSelected",
|
|
58021
58045
|
onClick: /* @__PURE__ */ __name(() => {
|
|
58022
|
-
handleCopyColumn(
|
|
58046
|
+
handleCopyColumn(tableRef, cellWrapper, selectedRecords);
|
|
58023
58047
|
}, "onClick"),
|
|
58024
58048
|
text: "Column (Selected)"
|
|
58025
58049
|
}
|
|
@@ -58062,7 +58086,7 @@ const DataTable = /* @__PURE__ */ __name((_I) => {
|
|
|
58062
58086
|
{
|
|
58063
58087
|
key: "copyFullTableRows",
|
|
58064
58088
|
onClick: /* @__PURE__ */ __name(() => {
|
|
58065
|
-
handleCopyTable(
|
|
58089
|
+
handleCopyTable(tableRef);
|
|
58066
58090
|
}, "onClick"),
|
|
58067
58091
|
text: "Table"
|
|
58068
58092
|
}
|
|
@@ -58599,6 +58623,7 @@ const DataTable = /* @__PURE__ */ __name((_I) => {
|
|
|
58599
58623
|
__spreadValues({
|
|
58600
58624
|
data: filteredEnts,
|
|
58601
58625
|
ref: tableRef,
|
|
58626
|
+
noVirtual,
|
|
58602
58627
|
className: classNames({
|
|
58603
58628
|
isCellEditable,
|
|
58604
58629
|
"tg-table-loading": isLoading,
|
|
@@ -58666,7 +58691,8 @@ const DataTable = /* @__PURE__ */ __name((_I) => {
|
|
|
58666
58691
|
resizePersist,
|
|
58667
58692
|
resized,
|
|
58668
58693
|
rowsToShow,
|
|
58669
|
-
style
|
|
58694
|
+
style,
|
|
58695
|
+
noVirtual
|
|
58670
58696
|
]
|
|
58671
58697
|
);
|
|
58672
58698
|
return /* @__PURE__ */ React.createElement("div", { tabIndex: "1", onKeyDown: handleKeyDown, onKeyUp: handleKeyUp }, /* @__PURE__ */ React.createElement(
|
|
@@ -58949,8 +58975,8 @@ const DataTable = /* @__PURE__ */ __name((_I) => {
|
|
|
58949
58975
|
), /* @__PURE__ */ React.createElement(
|
|
58950
58976
|
core.Button,
|
|
58951
58977
|
{
|
|
58952
|
-
onClick: /* @__PURE__ */ __name((
|
|
58953
|
-
handleCopyTable(
|
|
58978
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
58979
|
+
handleCopyTable(tableRef, { isDownload: true });
|
|
58954
58980
|
}, "onClick"),
|
|
58955
58981
|
"data-tip": "Download Table as CSV",
|
|
58956
58982
|
minimal: true,
|