@economic/taco 2.32.0 → 2.33.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Table3/Table3.d.ts +2 -18
- package/dist/components/Table3/types.d.ts +2 -11
- package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +3 -24
- package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +1 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +0 -9
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
- package/dist/primitives/Table/types.d.ts +1 -1
- package/dist/primitives/Table/useTableManager/useTableManager.d.ts +1 -1
- package/dist/taco.cjs.development.js +4 -35
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +2 -2
@@ -10060,13 +10060,6 @@ function mapTableChildrenToColumns(props, settings, options, internalColumns) {
|
|
10060
10060
|
function configureReactTableOptions(options, props) {
|
10061
10061
|
var _options$enableFilter, _options$enableColumn, _options$enableRowExp, _options$enableColumn2, _options$enableColumn3, _options$enableSortin;
|
10062
10062
|
const enableRowSelection = options.enableRowSelection || options.enableRowSelectionSingle;
|
10063
|
-
const getRowIdentityColumnId = () => {
|
10064
|
-
if (!props.rowIdentityColumnId) {
|
10065
|
-
return undefined;
|
10066
|
-
}
|
10067
|
-
const rowIdentityColumnIds = [props.rowIdentityColumnId].flat();
|
10068
|
-
return originalRow => rowIdentityColumnIds.map(identityColumnId => String(originalRow[identityColumnId])).join('_');
|
10069
|
-
};
|
10070
10063
|
const tableOptions = {
|
10071
10064
|
defaultColumn: {
|
10072
10065
|
enableColumnFilter: options.enableFiltering || true,
|
@@ -10091,8 +10084,6 @@ function configureReactTableOptions(options, props) {
|
|
10091
10084
|
// models for default features
|
10092
10085
|
getExpandedRowModel: reactTable.getExpandedRowModel(),
|
10093
10086
|
getGroupedRowModel: reactTable.getGroupedRowModel(),
|
10094
|
-
// Use row indentity column values as id for each row
|
10095
|
-
getRowId: getRowIdentityColumnId(),
|
10096
10087
|
groupedColumnMode: false
|
10097
10088
|
};
|
10098
10089
|
if (tableOptions.enableColumnResizing) {
|
@@ -11268,7 +11259,6 @@ function useTableManager(props, meta, internalColumns) {
|
|
11268
11259
|
// ensure data is always valid
|
11269
11260
|
const data = (_props$data = props.data) !== null && _props$data !== void 0 ? _props$data : [];
|
11270
11261
|
const length = (_props$length = props.length) !== null && _props$length !== void 0 ? _props$length : data.length;
|
11271
|
-
const rowIdentityColumnId = props.rowIdentityColumnId !== undefined ? [props.rowIdentityColumnId].flat() : [];
|
11272
11262
|
// create a react-table instance
|
11273
11263
|
const instance = reactTable.useReactTable({
|
11274
11264
|
data,
|
@@ -11296,7 +11286,7 @@ function useTableManager(props, meta, internalColumns) {
|
|
11296
11286
|
rowDrag,
|
11297
11287
|
rowDrop: rowDrop,
|
11298
11288
|
rowExpansion: rowExpansion,
|
11299
|
-
rowIdentityColumnId,
|
11289
|
+
rowIdentityColumnId: props.rowIdentityColumnId,
|
11300
11290
|
rowGoto,
|
11301
11291
|
rowGroups: rowGroups,
|
11302
11292
|
rowHeight,
|
@@ -18854,22 +18844,6 @@ function Alert$1(props) {
|
|
18854
18844
|
const tableMeta = table.options.meta;
|
18855
18845
|
const [showFilterResetDialog, setShowFilterResetDialog] = React__default.useState(false);
|
18856
18846
|
const pendingChangesWithErrors = tableMeta.editing.getErrors();
|
18857
|
-
const deletePendingChange = tableMeta.editing.resetChanges;
|
18858
|
-
const allRows = table.getPreFilteredRowModel().rows;
|
18859
|
-
// This effect deletes error in the alert if the row that has the error is deleted.
|
18860
|
-
React__default.useEffect(() => {
|
18861
|
-
pendingChangesWithErrors.forEach(errorRow => {
|
18862
|
-
const errorRowId = errorRow.rowId;
|
18863
|
-
try {
|
18864
|
-
// getRow throws error if it fails to find the row
|
18865
|
-
if (!table.getRow(errorRowId)) {
|
18866
|
-
deletePendingChange(errorRowId);
|
18867
|
-
}
|
18868
|
-
} catch {
|
18869
|
-
deletePendingChange(errorRowId);
|
18870
|
-
}
|
18871
|
-
});
|
18872
|
-
}, [allRows.length]);
|
18873
18847
|
const activeRow = React__default.useMemo(() => tableMeta.rowActive.rowActiveIndex ? table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex] : undefined, [tableMeta.rowActive.rowActiveIndex]);
|
18874
18848
|
// mark errors being rendered as seen
|
18875
18849
|
React__default.useEffect(() => {
|
@@ -18898,23 +18872,18 @@ function Alert$1(props) {
|
|
18898
18872
|
const title = (pendingChangesWithErrors.length === 1 ? validationTexts.alert.titleOne : validationTexts.alert.titlePlural).replace('[COUNT]', String(pendingChangesWithErrors.length));
|
18899
18873
|
// generate links to each invalid row, to go into the error message
|
18900
18874
|
const links = [];
|
18901
|
-
const rowIdentityColumn = tableMeta.rowIdentityColumnId ?
|
18902
|
-
// Since rowIdentityColumnId can have multiple ids, we use the first id to refer to the row in Alert
|
18903
|
-
table.getColumn(tableMeta.rowIdentityColumnId[0]) : undefined;
|
18875
|
+
const rowIdentityColumn = tableMeta.rowIdentityColumnId ? table.getColumn(tableMeta.rowIdentityColumnId) : undefined;
|
18904
18876
|
pendingChangesWithErrors.forEach((error, index) => {
|
18905
18877
|
// if appropriate, concatenate the item with the text "and"
|
18906
18878
|
if (pendingChangesWithErrors.length > 1 && index === pendingChangesWithErrors.length - 1) {
|
18907
18879
|
// Add space before and after `messageAnd` text
|
18908
18880
|
links.push(` ${validationTexts.alert.messageAnd} `);
|
18909
18881
|
}
|
18910
|
-
const rowIndex = table.
|
18882
|
+
const rowIndex = table.getRowModel().rows.findIndex(row => row.id === error.rowId);
|
18911
18883
|
const handleClick = () => {
|
18912
|
-
// if row is visible
|
18913
18884
|
if (rowIndex > -1) {
|
18914
18885
|
scrollToRow(rowIndex);
|
18915
|
-
}
|
18916
|
-
// if row is filtered out
|
18917
|
-
else {
|
18886
|
+
} else {
|
18918
18887
|
setShowFilterResetDialog(error.rowId);
|
18919
18888
|
}
|
18920
18889
|
};
|