@economic/taco 2.35.0 → 2.36.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Dialog/components/Content.d.ts +5 -0
- package/dist/components/Icon/components/index.d.ts +1 -1
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Menu/Menu.d.ts +2 -1
- package/dist/components/Menu/components/Item.d.ts +1 -1
- package/dist/components/Menu/components/Link.d.ts +1 -1
- package/dist/components/Menu/components/Separator.d.ts +3 -2
- package/dist/components/Navigation2/components/Link.d.ts +1 -1
- package/dist/components/Provider/Localization.d.ts +6 -0
- package/dist/components/Report/Report.d.ts +1 -1
- package/dist/components/Select2/Select2.d.ts +4 -25
- package/dist/components/Select2/components/Option.d.ts +2 -2
- package/dist/components/Select2/components/Search.d.ts +1 -7
- package/dist/components/Table3/Table3.d.ts +29 -1
- package/dist/components/Table3/components/Row/Editing/CreateRowButton.d.ts +11 -0
- package/dist/components/Table3/features/useTableEditing.d.ts +1 -0
- package/dist/components/Table3/types.d.ts +16 -1
- package/dist/components/Table3/util/editing.d.ts +1 -0
- package/dist/components/Tag/Tag.d.ts +1 -1
- package/dist/esm/index.css +41 -21
- package/dist/esm/node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js +161 -1
- package/dist/esm/node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +1 -1
- package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/{ESignature.js → DocumentSignedSolid.js} +4 -4
- package/dist/esm/packages/taco/src/components/Icon/components/DocumentSignedSolid.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/{Home2.js → House.js} +4 -4
- package/dist/esm/packages/taco/src/components/Icon/components/{Home2.js.map → House.js.map} +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/{Home.js → HouseSolid.js} +4 -4
- package/dist/esm/packages/taco/src/components/Icon/components/HouseSolid.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/index.js +6 -6
- package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/Menu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Separator.js +7 -5
- package/dist/esm/packages/taco/src/components/Menu/components/Separator.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +7 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +8 -55
- package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Search.js +2 -12
- package/dist/esm/packages/taco/src/components/Select2/components/Search.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +8 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/util.js +3 -2
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +24 -3
- package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateRowButton.js +90 -0
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateRowButton.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +53 -15
- package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/useTable3.js +2 -1
- package/dist/esm/packages/taco/src/components/Table3/useTable3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/util/editing.js +20 -1
- package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +5 -2
- package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js +2 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js +2 -4
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js +2 -3
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js +5 -4
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.js +4 -3
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.js +4 -3
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js +3 -2
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.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/useTableDataLoader.js +6 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowClick.js +11 -8
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowClick.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +2 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js +3 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +9 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/dom.js +2 -2
- package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
- package/dist/index.css +41 -21
- package/dist/primitives/Table/Core/components/Header/components/Menu.d.ts +1 -0
- package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.d.ts +1 -1
- package/dist/primitives/Table/types.d.ts +8 -6
- package/dist/primitives/Table/useTableManager/features/useTableRowClick.d.ts +4 -4
- package/dist/primitives/Table/useTableManager/useTableManager.d.ts +1 -1
- package/dist/primitives/Table/useTableManager/util/presets.d.ts +1 -1
- package/dist/primitives/Table/useTableManager/util/setup.d.ts +2 -2
- package/dist/taco.cjs.development.js +463 -156
- 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/dist/utils/dom.d.ts +1 -1
- package/package.json +2 -2
- package/dist/components/Table/Table.storyexample.d.ts +0 -9
- package/dist/esm/packages/taco/src/components/Icon/components/ESignature.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Home.js.map +0 -1
- /package/dist/components/Icon/components/{ESignature.d.ts → DocumentSignedSolid.d.ts} +0 -0
- /package/dist/components/Icon/components/{Home.d.ts → House.d.ts} +0 -0
- /package/dist/components/Icon/components/{Home2.d.ts → HouseSolid.d.ts} +0 -0
@@ -1239,6 +1239,19 @@ function IconDocumentRejectedRequest(props, svgRef) {
|
|
1239
1239
|
}
|
1240
1240
|
var DocumentRejectedRequest = /*#__PURE__*/React.forwardRef(IconDocumentRejectedRequest);
|
1241
1241
|
|
1242
|
+
function IconDocumentSignedSolid(props, svgRef) {
|
1243
|
+
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
1244
|
+
xmlns: "http://www.w3.org/2000/svg",
|
1245
|
+
viewBox: "0 0 24 24",
|
1246
|
+
ref: svgRef
|
1247
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
1248
|
+
d: "M13 2v5.25l.006.144a1.75 1.75 0 001.593 1.6L14.75 9H20v11.25A1.75 1.75 0 0118.25 22H5.75A1.75 1.75 0 014 20.25V3.75C4 2.784 4.784 2 5.75 2H13zm-3 7.75c-1.572 0-2.858 1.745-3.337 3.877l-.048.23-.039.217c-.138.832-.124 1.608.046 2.26l.07.238.055.148-.191.101c-.33.166-.672.305-1.025.413a.75.75 0 00.339 1.457l.1-.023.281-.092c.35-.122.691-.268 1.02-.435l.325-.174.098-.059.02.014c.302.18.66.293 1.074.32L9 18.25l.255-.004c1.076-.038 1.983-.315 2.706-.82l.193-.145.124-.104.014.052c.044.14.098.262.164.369l.069.102.086.107c.579.665 1.275.432 2.018-.32l.117-.122.102-.115.021.104c.043.2.09.356.163.512.209.456.598.755 1.132.708.582-.052 1.196-.55 2.042-1.612l.162-.206.32-.425.17-.23a.75.75 0 00-1.144-.965l-.071.085-.293.396-.28.362-.251.308-.22.256-.187.205-.11.112-.082-.493-.042-.199-.024-.09c-.083-.294-.201-.52-.436-.692-.598-.437-1.122-.163-1.695.514l-.258.312-.107.118-.007-.214a12.73 12.73 0 01.094-1.533c.1-.89-1.135-1.152-1.438-.372l-.033.103-.057.203c-.397 1.321-1.216 2.03-2.562 2.195l-.217.022-.176.009.199-.19a8.876 8.876 0 001.813-2.556c1.013-2.18.695-4.247-1.274-4.247zm0 1.5c.406 0 .531.695-.005 1.934l-.081.181-.116.237a7.434 7.434 0 01-1.401 1.893l-.25.236-.105.089-.032-.177c-.06-.406-.037-.911.077-1.5C8.402 12.53 9.306 11.25 10 11.25zm4.5-4V2L20 7.5h-5.25l-.057-.007a.25.25 0 01-.184-.175L14.5 7.25z",
|
1249
|
+
fill: "currentColor",
|
1250
|
+
fillRule: "evenodd"
|
1251
|
+
}));
|
1252
|
+
}
|
1253
|
+
var DocumentSignedSolid = /*#__PURE__*/React.forwardRef(IconDocumentSignedSolid);
|
1254
|
+
|
1242
1255
|
function IconDocumentSigned(props, svgRef) {
|
1243
1256
|
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
1244
1257
|
fill: "none",
|
@@ -1331,19 +1344,6 @@ function IconECopedia(props, svgRef) {
|
|
1331
1344
|
}
|
1332
1345
|
var ECopedia = /*#__PURE__*/React.forwardRef(IconECopedia);
|
1333
1346
|
|
1334
|
-
function IconESignature(props, svgRef) {
|
1335
|
-
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
1336
|
-
xmlns: "http://www.w3.org/2000/svg",
|
1337
|
-
viewBox: "0 0 24 24",
|
1338
|
-
ref: svgRef
|
1339
|
-
}, props), /*#__PURE__*/React.createElement("path", {
|
1340
|
-
d: "M13 2v5.25l.006.144a1.75 1.75 0 001.593 1.6L14.75 9H20v11.25A1.75 1.75 0 0118.25 22H5.75A1.75 1.75 0 014 20.25V3.75C4 2.784 4.784 2 5.75 2H13zm-3 7.75c-1.572 0-2.858 1.745-3.337 3.877l-.048.23-.039.217c-.138.832-.124 1.608.046 2.26l.07.238.055.148-.191.101c-.33.166-.672.305-1.025.413a.75.75 0 00.339 1.457l.1-.023.281-.092c.35-.122.691-.268 1.02-.435l.325-.174.098-.059.02.014c.302.18.66.293 1.074.32L9 18.25l.255-.004c1.076-.038 1.983-.315 2.706-.82l.193-.145.124-.104.014.052c.044.14.098.262.164.369l.069.102.086.107c.579.665 1.275.432 2.018-.32l.117-.122.102-.115.021.104c.043.2.09.356.163.512.209.456.598.755 1.132.708.582-.052 1.196-.55 2.042-1.612l.162-.206.32-.425.17-.23a.75.75 0 00-1.144-.965l-.071.085-.293.396-.28.362-.251.308-.22.256-.187.205-.11.112-.082-.493-.042-.199-.024-.09c-.083-.294-.201-.52-.436-.692-.598-.437-1.122-.163-1.695.514l-.258.312-.107.118-.007-.214a12.73 12.73 0 01.094-1.533c.1-.89-1.135-1.152-1.438-.372l-.033.103-.057.203c-.397 1.321-1.216 2.03-2.562 2.195l-.217.022-.176.009.199-.19a8.876 8.876 0 001.813-2.556c1.013-2.18.695-4.247-1.274-4.247zm0 1.5c.406 0 .531.695-.005 1.934l-.081.181-.116.237a7.434 7.434 0 01-1.401 1.893l-.25.236-.105.089-.032-.177c-.06-.406-.037-.911.077-1.5C8.402 12.53 9.306 11.25 10 11.25zm4.5-4V2L20 7.5h-5.25l-.057-.007a.25.25 0 01-.184-.175L14.5 7.25z",
|
1341
|
-
fill: "currentColor",
|
1342
|
-
fillRule: "evenodd"
|
1343
|
-
}));
|
1344
|
-
}
|
1345
|
-
var ESignature = /*#__PURE__*/React.forwardRef(IconESignature);
|
1346
|
-
|
1347
1347
|
function IconEditSimple(props, svgRef) {
|
1348
1348
|
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
1349
1349
|
fill: "none",
|
@@ -1778,33 +1778,33 @@ function IconHeightTall(props, svgRef) {
|
|
1778
1778
|
}
|
1779
1779
|
var HeightTall = /*#__PURE__*/React.forwardRef(IconHeightTall);
|
1780
1780
|
|
1781
|
-
function
|
1781
|
+
function IconHouseSolid(props, svgRef) {
|
1782
1782
|
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
1783
|
-
fill: "none",
|
1784
1783
|
xmlns: "http://www.w3.org/2000/svg",
|
1785
1784
|
viewBox: "0 0 24 24",
|
1786
1785
|
ref: svgRef
|
1787
1786
|
}, props), /*#__PURE__*/React.createElement("path", {
|
1788
|
-
|
1789
|
-
|
1790
|
-
|
1791
|
-
fill: "currentColor"
|
1787
|
+
d: "M12 6l8 8v7a1 1 0 01-1 1h-5v-5a1 1 0 00-.883-.993L13 16h-2a1 1 0 00-.993.883L10 17v5H5a1 1 0 01-1-1v-7l8-8zm.613-3.79l.094.083L17 6.585V4.75a.5.5 0 01.5-.5h1a.5.5 0 01.5.5v3.835l2.707 2.708a1 1 0 01-1.32 1.497l-.094-.083L12 4.415l-8.293 8.292a1 1 0 01-1.32.083l-.094-.083a1 1 0 01-.083-1.32l.083-.094 9-9a1 1 0 011.32-.083z",
|
1788
|
+
fill: "currentColor",
|
1789
|
+
fillRule: "evenodd"
|
1792
1790
|
}));
|
1793
1791
|
}
|
1794
|
-
var
|
1792
|
+
var HouseSolid = /*#__PURE__*/React.forwardRef(IconHouseSolid);
|
1795
1793
|
|
1796
|
-
function
|
1794
|
+
function IconHouse(props, svgRef) {
|
1797
1795
|
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
1796
|
+
fill: "none",
|
1798
1797
|
xmlns: "http://www.w3.org/2000/svg",
|
1799
1798
|
viewBox: "0 0 24 24",
|
1800
1799
|
ref: svgRef
|
1801
1800
|
}, props), /*#__PURE__*/React.createElement("path", {
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1801
|
+
fillRule: "evenodd",
|
1802
|
+
clipRule: "evenodd",
|
1803
|
+
d: "M11.116 2.823a1.25 1.25 0 011.768 0L17.25 7.19V6a.75.75 0 011.5 0v2.69l2.78 2.78a.75.75 0 01-1.06 1.06l-2.994-2.993-.013-.013L12 4.061l-8.47 8.47a.75.75 0 01-1.06-1.061l8.646-8.647zm1.768 3.25l7 7c.234.235.366.553.366.884v6.293c0 .69-.56 1.25-1.25 1.25h-4c-.69 0-1.25-.56-1.25-1.25V16.5h-3.5v3.75c0 .69-.56 1.25-1.25 1.25H5c-.69 0-1.25-.56-1.25-1.25v-6.293c0-.332.132-.65.366-.884l7-7a1.25 1.25 0 011.768 0zM12 7.311l-6.75 6.75V20h3.5v-3.75c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25V20h3.5v-5.94L12 7.31z",
|
1804
|
+
fill: "currentColor"
|
1805
1805
|
}));
|
1806
1806
|
}
|
1807
|
-
var
|
1807
|
+
var House = /*#__PURE__*/React.forwardRef(IconHouse);
|
1808
1808
|
|
1809
1809
|
function IconId(props, svgRef) {
|
1810
1810
|
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
@@ -3566,6 +3566,7 @@ const icons = {
|
|
3566
3566
|
'document-preview': DocumentPreview,
|
3567
3567
|
'document-received': DocumentReceived,
|
3568
3568
|
'document-rejected-request': DocumentRejectedRequest,
|
3569
|
+
'document-signed-solid': DocumentSignedSolid,
|
3569
3570
|
'document-signed': DocumentSigned,
|
3570
3571
|
'document-split': DocumentSplit,
|
3571
3572
|
'document-time': DocumentTime,
|
@@ -3573,7 +3574,6 @@ const icons = {
|
|
3573
3574
|
download: Download,
|
3574
3575
|
drag: Drag,
|
3575
3576
|
'e-copedia': ECopedia,
|
3576
|
-
'e-signature': ESignature,
|
3577
3577
|
'edit-simple': EditSimple,
|
3578
3578
|
edit: Edit,
|
3579
3579
|
'ellipsis-horizontal': EllipsisHorizontal,
|
@@ -3606,8 +3606,8 @@ const icons = {
|
|
3606
3606
|
'height-medium': HeightMedium,
|
3607
3607
|
'height-short': HeightShort,
|
3608
3608
|
'height-tall': HeightTall,
|
3609
|
-
|
3610
|
-
|
3609
|
+
'house-solid': HouseSolid,
|
3610
|
+
house: House,
|
3611
3611
|
id: Id,
|
3612
3612
|
images: Images,
|
3613
3613
|
import: Import,
|
@@ -4156,7 +4156,7 @@ const getIndexOfFirstChildOverflowingParent = (element, overscan = 0) => {
|
|
4156
4156
|
}
|
4157
4157
|
return boundaryChildIndex;
|
4158
4158
|
};
|
4159
|
-
const getNextFocussableElement = currentElement => {
|
4159
|
+
const getNextFocussableElement = (currentElement, direction = 1) => {
|
4160
4160
|
if (!currentElement) {
|
4161
4161
|
return null;
|
4162
4162
|
}
|
@@ -4166,7 +4166,7 @@ const getNextFocussableElement = currentElement => {
|
|
4166
4166
|
if (currentElementIndex !== -1 && currentElementIndex === focussableElements.length - 1) {
|
4167
4167
|
return null;
|
4168
4168
|
}
|
4169
|
-
return focussableElements[currentElementIndex +
|
4169
|
+
return focussableElements[currentElementIndex + direction];
|
4170
4170
|
};
|
4171
4171
|
const getOverlaySelector = element => {
|
4172
4172
|
switch (element === null || element === void 0 ? void 0 : element.getAttribute('role')) {
|
@@ -4563,7 +4563,10 @@ const defaultLocalisationTexts = {
|
|
4563
4563
|
button: 'Filters',
|
4564
4564
|
buttons: {
|
4565
4565
|
addFilter: 'Add new filter',
|
4566
|
-
clearFilters: 'Clear all filters'
|
4566
|
+
clearFilters: 'Clear all filters',
|
4567
|
+
cancel: 'Cancel',
|
4568
|
+
clear: 'Clear',
|
4569
|
+
apply: 'Apply'
|
4567
4570
|
},
|
4568
4571
|
comparators: {
|
4569
4572
|
contains: 'Contains',
|
@@ -4673,6 +4676,9 @@ const defaultLocalisationTexts = {
|
|
4673
4676
|
buttons: {
|
4674
4677
|
edit: {
|
4675
4678
|
tooltip: 'Edit table'
|
4679
|
+
},
|
4680
|
+
create: {
|
4681
|
+
label: 'New'
|
4676
4682
|
}
|
4677
4683
|
},
|
4678
4684
|
clearChangesConfirmationDialog: {
|
@@ -5939,8 +5945,8 @@ const useCombobox = ({
|
|
5939
5945
|
}
|
5940
5946
|
case 'Enter':
|
5941
5947
|
{
|
5948
|
+
event.preventDefault();
|
5942
5949
|
if (isElementInsideTable3OrReport(event.currentTarget)) {
|
5943
|
-
event.preventDefault();
|
5944
5950
|
if (inline && !open) {
|
5945
5951
|
setOpen(true);
|
5946
5952
|
} else if (buttonRef.current && !open) {
|
@@ -8536,11 +8542,13 @@ const RadioGroup$1 = /*#__PURE__*/React.forwardRef(function MenuRadioItem(props,
|
|
8536
8542
|
});
|
8537
8543
|
RadioGroup$1.Item = RadioItem;
|
8538
8544
|
|
8539
|
-
const Separator = ()
|
8540
|
-
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Separator, {
|
8545
|
+
const Separator = /*#__PURE__*/React.forwardRef(function Separator(props, ref) {
|
8546
|
+
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Separator, Object.assign({
|
8541
8547
|
className: "bg-grey-300 my-1 h-px"
|
8542
|
-
}
|
8543
|
-
|
8548
|
+
}, props, {
|
8549
|
+
ref: ref
|
8550
|
+
}));
|
8551
|
+
});
|
8544
8552
|
|
8545
8553
|
const Header = /*#__PURE__*/React.forwardRef(function MenuHeader(props, ref) {
|
8546
8554
|
const menu = useCurrentMenu();
|
@@ -10210,6 +10218,13 @@ function mapTableChildrenToColumns(props, settings, options, internalColumns) {
|
|
10210
10218
|
function configureReactTableOptions(options, props) {
|
10211
10219
|
var _options$enableFilter, _options$enableColumn, _options$enableRowExp, _options$enableColumn2, _options$enableColumn3, _options$enableSortin;
|
10212
10220
|
const enableRowSelection = options.enableRowSelection || options.enableRowSelectionSingle;
|
10221
|
+
const getRowIdentityColumnAccessor = () => {
|
10222
|
+
if (!props.rowIdentityColumnAccessor) {
|
10223
|
+
return undefined;
|
10224
|
+
}
|
10225
|
+
const rowIdentityColumnAccessors = [props.rowIdentityColumnAccessor].flat();
|
10226
|
+
return originalRow => rowIdentityColumnAccessors.map(identityColumnAccessor => String(originalRow[identityColumnAccessor])).join('_');
|
10227
|
+
};
|
10213
10228
|
const tableOptions = {
|
10214
10229
|
defaultColumn: {
|
10215
10230
|
enableColumnFilter: options.enableFiltering || true,
|
@@ -10234,6 +10249,8 @@ function configureReactTableOptions(options, props) {
|
|
10234
10249
|
// models for default features
|
10235
10250
|
getExpandedRowModel: reactTable.getExpandedRowModel(),
|
10236
10251
|
getGroupedRowModel: reactTable.getGroupedRowModel(),
|
10252
|
+
// Use row indentity column values as id for each row
|
10253
|
+
getRowId: getRowIdentityColumnAccessor(),
|
10237
10254
|
groupedColumnMode: false
|
10238
10255
|
};
|
10239
10256
|
if (tableOptions.enableColumnResizing) {
|
@@ -10438,7 +10455,9 @@ function getTableFeaturePreset(props) {
|
|
10438
10455
|
enablePrinting: (_props$enablePrinting = props.enablePrinting) !== null && _props$enablePrinting !== void 0 ? _props$enablePrinting : presetOptions.enablePrinting,
|
10439
10456
|
enableRowActive: (_props$enableRowActiv = props.enableRowActive) !== null && _props$enableRowActiv !== void 0 ? _props$enableRowActiv : presetOptions.enableRowActive,
|
10440
10457
|
enableRowActions: enableRowActions && !!((_props$rowActions = props.rowActions) !== null && _props$rowActions !== void 0 && _props$rowActions.length),
|
10441
|
-
|
10458
|
+
// enableRowClick can be either function or boolean, that is why we need to pass exactly enableRowClick,
|
10459
|
+
// and not just result of the condition
|
10460
|
+
enableRowClick: enableRowClick && !!props.onRowClick ? enableRowClick : false,
|
10442
10461
|
enableRowDrag: enableRowDrag && !!props.onRowDrag,
|
10443
10462
|
enableRowDrop: enableRowDrop && !!props.onRowDrop,
|
10444
10463
|
enableRowGoto: enableRowGoto && !!props.onRowGoto,
|
@@ -10658,26 +10677,29 @@ function getNextIndex(direction, currentIndex, length) {
|
|
10658
10677
|
}
|
10659
10678
|
|
10660
10679
|
function useTableRowClick(isEnabled = false, onRowClick) {
|
10661
|
-
const
|
10662
|
-
|
10680
|
+
const isRowClickEnabled = React__default.useCallback(row => {
|
10681
|
+
return typeof isEnabled === 'boolean' ? isEnabled : isEnabled(row);
|
10682
|
+
}, [isEnabled]);
|
10683
|
+
const handleKeyDown = React__default.useCallback(function (event, rowData) {
|
10684
|
+
if (!isRowClickEnabled(rowData) || typeof onRowClick !== 'function' || event.defaultPrevented) {
|
10663
10685
|
return;
|
10664
10686
|
}
|
10665
|
-
if (
|
10687
|
+
if (rowData && event.key === 'Enter') {
|
10666
10688
|
event.preventDefault();
|
10667
|
-
onRowClick(
|
10689
|
+
onRowClick(rowData);
|
10668
10690
|
return;
|
10669
10691
|
}
|
10670
10692
|
}, [isEnabled, onRowClick]);
|
10671
|
-
const handleClick = React__default.useCallback(function (event,
|
10672
|
-
if (!
|
10693
|
+
const handleClick = React__default.useCallback(function (event, rowData) {
|
10694
|
+
if (!isRowClickEnabled(rowData) || typeof onRowClick !== 'function' || event.defaultPrevented) {
|
10673
10695
|
return;
|
10674
10696
|
}
|
10675
10697
|
event.preventDefault();
|
10676
|
-
onRowClick(
|
10698
|
+
onRowClick(rowData);
|
10677
10699
|
return;
|
10678
10700
|
}, [isEnabled, onRowClick]);
|
10679
10701
|
return {
|
10680
|
-
isEnabled,
|
10702
|
+
isEnabled: isRowClickEnabled,
|
10681
10703
|
handleClick,
|
10682
10704
|
handleKeyDown
|
10683
10705
|
};
|
@@ -10777,7 +10799,167 @@ function useTableSearch(isEnabled = false, defaultEnableGlobalFilter = false) {
|
|
10777
10799
|
}
|
10778
10800
|
|
10779
10801
|
// A type of promise-like that resolves synchronously and supports only one observer
|
10802
|
+
const _Pact = /*#__PURE__*/function () {
|
10803
|
+
function _Pact() {}
|
10804
|
+
_Pact.prototype.then = function (onFulfilled, onRejected) {
|
10805
|
+
const result = new _Pact();
|
10806
|
+
const state = this.s;
|
10807
|
+
if (state) {
|
10808
|
+
const callback = state & 1 ? onFulfilled : onRejected;
|
10809
|
+
if (callback) {
|
10810
|
+
try {
|
10811
|
+
_settle(result, 1, callback(this.v));
|
10812
|
+
} catch (e) {
|
10813
|
+
_settle(result, 2, e);
|
10814
|
+
}
|
10815
|
+
return result;
|
10816
|
+
} else {
|
10817
|
+
return this;
|
10818
|
+
}
|
10819
|
+
}
|
10820
|
+
this.o = function (_this) {
|
10821
|
+
try {
|
10822
|
+
const value = _this.v;
|
10823
|
+
if (_this.s & 1) {
|
10824
|
+
_settle(result, 1, onFulfilled ? onFulfilled(value) : value);
|
10825
|
+
} else if (onRejected) {
|
10826
|
+
_settle(result, 1, onRejected(value));
|
10827
|
+
} else {
|
10828
|
+
_settle(result, 2, value);
|
10829
|
+
}
|
10830
|
+
} catch (e) {
|
10831
|
+
_settle(result, 2, e);
|
10832
|
+
}
|
10833
|
+
};
|
10834
|
+
return result;
|
10835
|
+
};
|
10836
|
+
return _Pact;
|
10837
|
+
}();
|
10838
|
+
|
10839
|
+
// Settles a pact synchronously
|
10840
|
+
function _settle(pact, state, value) {
|
10841
|
+
if (!pact.s) {
|
10842
|
+
if (value instanceof _Pact) {
|
10843
|
+
if (value.s) {
|
10844
|
+
if (state & 1) {
|
10845
|
+
state = value.s;
|
10846
|
+
}
|
10847
|
+
value = value.v;
|
10848
|
+
} else {
|
10849
|
+
value.o = _settle.bind(null, pact, state);
|
10850
|
+
return;
|
10851
|
+
}
|
10852
|
+
}
|
10853
|
+
if (value && value.then) {
|
10854
|
+
value.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));
|
10855
|
+
return;
|
10856
|
+
}
|
10857
|
+
pact.s = state;
|
10858
|
+
pact.v = value;
|
10859
|
+
const observer = pact.o;
|
10860
|
+
if (observer) {
|
10861
|
+
observer(pact);
|
10862
|
+
}
|
10863
|
+
}
|
10864
|
+
}
|
10865
|
+
function _isSettledPact(thenable) {
|
10866
|
+
return thenable instanceof _Pact && thenable.s & 1;
|
10867
|
+
}
|
10868
|
+
|
10869
|
+
// Asynchronously iterate through an object that has a length property, passing the index as the first argument to the callback (even as the length property changes)
|
10870
|
+
function _forTo(array, body, check) {
|
10871
|
+
var i = -1,
|
10872
|
+
pact,
|
10873
|
+
reject;
|
10874
|
+
function _cycle(result) {
|
10875
|
+
try {
|
10876
|
+
while (++i < array.length && (!check || !check())) {
|
10877
|
+
result = body(i);
|
10878
|
+
if (result && result.then) {
|
10879
|
+
if (_isSettledPact(result)) {
|
10880
|
+
result = result.v;
|
10881
|
+
} else {
|
10882
|
+
result.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));
|
10883
|
+
return;
|
10884
|
+
}
|
10885
|
+
}
|
10886
|
+
}
|
10887
|
+
if (pact) {
|
10888
|
+
_settle(pact, 1, result);
|
10889
|
+
} else {
|
10890
|
+
pact = result;
|
10891
|
+
}
|
10892
|
+
} catch (e) {
|
10893
|
+
_settle(pact || (pact = new _Pact()), 2, e);
|
10894
|
+
}
|
10895
|
+
}
|
10896
|
+
_cycle();
|
10897
|
+
return pact;
|
10898
|
+
}
|
10780
10899
|
const _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = /*#__PURE__*/Symbol("Symbol.iterator")) : "@@iterator";
|
10900
|
+
|
10901
|
+
// Asynchronously iterate through an object's values
|
10902
|
+
// Uses for...of if the runtime supports it, otherwise iterates until length on a copy
|
10903
|
+
function _forOf(target, body, check) {
|
10904
|
+
if (typeof target[_iteratorSymbol] === "function") {
|
10905
|
+
var iterator = target[_iteratorSymbol](),
|
10906
|
+
step,
|
10907
|
+
pact,
|
10908
|
+
reject;
|
10909
|
+
function _cycle(result) {
|
10910
|
+
try {
|
10911
|
+
while (!(step = iterator.next()).done && (!check || !check())) {
|
10912
|
+
result = body(step.value);
|
10913
|
+
if (result && result.then) {
|
10914
|
+
if (_isSettledPact(result)) {
|
10915
|
+
result = result.v;
|
10916
|
+
} else {
|
10917
|
+
result.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));
|
10918
|
+
return;
|
10919
|
+
}
|
10920
|
+
}
|
10921
|
+
}
|
10922
|
+
if (pact) {
|
10923
|
+
_settle(pact, 1, result);
|
10924
|
+
} else {
|
10925
|
+
pact = result;
|
10926
|
+
}
|
10927
|
+
} catch (e) {
|
10928
|
+
_settle(pact || (pact = new _Pact()), 2, e);
|
10929
|
+
}
|
10930
|
+
}
|
10931
|
+
_cycle();
|
10932
|
+
if (iterator.return) {
|
10933
|
+
var _fixup = function (value) {
|
10934
|
+
try {
|
10935
|
+
if (!step.done) {
|
10936
|
+
iterator.return();
|
10937
|
+
}
|
10938
|
+
} catch (e) {}
|
10939
|
+
return value;
|
10940
|
+
};
|
10941
|
+
if (pact && pact.then) {
|
10942
|
+
return pact.then(_fixup, function (e) {
|
10943
|
+
throw _fixup(e);
|
10944
|
+
});
|
10945
|
+
}
|
10946
|
+
_fixup();
|
10947
|
+
}
|
10948
|
+
return pact;
|
10949
|
+
}
|
10950
|
+
// No support for Symbol.iterator
|
10951
|
+
if (!("length" in target)) {
|
10952
|
+
throw new TypeError("Object is not iterable");
|
10953
|
+
}
|
10954
|
+
// Handle live collections properly
|
10955
|
+
var values = [];
|
10956
|
+
for (var i = 0; i < target.length; i++) {
|
10957
|
+
values.push(target[i]);
|
10958
|
+
}
|
10959
|
+
return _forTo(values, function (i) {
|
10960
|
+
return body(values[i]);
|
10961
|
+
}, check);
|
10962
|
+
}
|
10781
10963
|
const _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = /*#__PURE__*/Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
|
10782
10964
|
|
10783
10965
|
// Asynchronously call a function and send errors to recovery continuation
|
@@ -10903,7 +11085,12 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
10903
11085
|
const invalidate = function () {
|
10904
11086
|
try {
|
10905
11087
|
_forceReset.current = true;
|
10906
|
-
|
11088
|
+
if (_lastUsedSearch.current) {
|
11089
|
+
// we're searching, which means we need to refetch all with the correct sorting applied
|
11090
|
+
return loadAll(_lastUsedSorting.current, _lastUsedFilters.current);
|
11091
|
+
} else {
|
11092
|
+
return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current);
|
11093
|
+
}
|
10907
11094
|
} catch (e) {
|
10908
11095
|
return Promise.reject(e);
|
10909
11096
|
}
|
@@ -11405,6 +11592,7 @@ function useTableManager(props, meta, internalColumns) {
|
|
11405
11592
|
// ensure data is always valid
|
11406
11593
|
const data = (_props$data = props.data) !== null && _props$data !== void 0 ? _props$data : [];
|
11407
11594
|
const length = (_props$length = props.length) !== null && _props$length !== void 0 ? _props$length : data.length;
|
11595
|
+
const rowIdentityColumnAccessor = props.rowIdentityColumnAccessor !== undefined ? [props.rowIdentityColumnAccessor].flat() : [];
|
11408
11596
|
// create a react-table instance
|
11409
11597
|
const instance = reactTable.useReactTable({
|
11410
11598
|
data,
|
@@ -11432,7 +11620,7 @@ function useTableManager(props, meta, internalColumns) {
|
|
11432
11620
|
rowDrag,
|
11433
11621
|
rowDrop: rowDrop,
|
11434
11622
|
rowExpansion: rowExpansion,
|
11435
|
-
|
11623
|
+
rowIdentityColumnAccessor,
|
11436
11624
|
rowGoto,
|
11437
11625
|
rowGroups: rowGroups,
|
11438
11626
|
rowHeight,
|
@@ -11865,7 +12053,7 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
|
|
11865
12053
|
let content = null;
|
11866
12054
|
if (rows.length) {
|
11867
12055
|
style = {
|
11868
|
-
height:
|
12056
|
+
height: totalSize,
|
11869
12057
|
paddingBottom,
|
11870
12058
|
paddingTop
|
11871
12059
|
};
|
@@ -12565,8 +12753,7 @@ const DisplayRow = /*#__PURE__*/React__default.memo(function DisplayRow(props) {
|
|
12565
12753
|
tableMeta.rowClick.handleClick(event, row.original);
|
12566
12754
|
}, [row.original]);
|
12567
12755
|
const handleClickCapture = React__default.useCallback(() => {
|
12568
|
-
|
12569
|
-
requestAnimationFrame(() => tableMeta.rowActive.setRowActiveIndex(index));
|
12756
|
+
tableMeta.rowActive.setRowActiveIndex(index);
|
12570
12757
|
}, [index]);
|
12571
12758
|
// row active
|
12572
12759
|
if (tableMeta.rowActive.isEnabled) {
|
@@ -12575,7 +12762,7 @@ const DisplayRow = /*#__PURE__*/React__default.memo(function DisplayRow(props) {
|
|
12575
12762
|
attributes.onClickCapture = handleClickCapture;
|
12576
12763
|
}
|
12577
12764
|
// row click
|
12578
|
-
if (tableMeta.rowClick.isEnabled) {
|
12765
|
+
if (tableMeta.rowClick.isEnabled(row.original)) {
|
12579
12766
|
attributes.onClick = handleClick;
|
12580
12767
|
}
|
12581
12768
|
// row drag
|
@@ -12872,6 +13059,7 @@ function HeaderMenu(props) {
|
|
12872
13059
|
canHide,
|
12873
13060
|
canPin,
|
12874
13061
|
canSort,
|
13062
|
+
columnId,
|
12875
13063
|
customMenu,
|
12876
13064
|
index,
|
12877
13065
|
isFiltered,
|
@@ -12975,10 +13163,7 @@ function HeaderMenu(props) {
|
|
12975
13163
|
}, isFiltered ? texts.table.columns.menu.editFilter : texts.table.columns.menu.filter));
|
12976
13164
|
}
|
12977
13165
|
if (customMenu) {
|
12978
|
-
const
|
12979
|
-
trigger: undefined
|
12980
|
-
});
|
12981
|
-
const customItems = React__default.Children.toArray(menu.props.children.props.children);
|
13166
|
+
const customItems = customMenu.map(menuItem => menuItem(columnId)).filter(action => !!action);
|
12982
13167
|
if (customItems.length) {
|
12983
13168
|
if (menuItems.length) {
|
12984
13169
|
menuItems.push( /*#__PURE__*/React__default.createElement(Menu$1.Separator, null));
|
@@ -13240,7 +13425,8 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
|
|
13240
13425
|
onSortToggle: handleSortToggle,
|
13241
13426
|
scrollToIndex: scrollToIndex,
|
13242
13427
|
setRowActiveIndex: setRowActiveIndex,
|
13243
|
-
sortDirection: sortDirection
|
13428
|
+
sortDirection: sortDirection,
|
13429
|
+
columnId: id
|
13244
13430
|
})) : null, canResize ? ( /*#__PURE__*/React__default.createElement(Resizer, {
|
13245
13431
|
headerRef: ref,
|
13246
13432
|
id: id,
|
@@ -15093,17 +15279,12 @@ const BubbleSelect = props => {
|
|
15093
15279
|
};
|
15094
15280
|
|
15095
15281
|
const Search$2 = /*#__PURE__*/React__default.forwardRef(function ListboxSearch(props, ref) {
|
15096
|
-
const {
|
15097
|
-
onTabKeyPress,
|
15098
|
-
...otherProps
|
15099
|
-
} = props;
|
15100
15282
|
const {
|
15101
15283
|
listboxRef,
|
15102
15284
|
searchQuery,
|
15103
15285
|
setSearchQuery,
|
15104
15286
|
setValidationError,
|
15105
|
-
validationError
|
15106
|
-
setOpen
|
15287
|
+
validationError
|
15107
15288
|
} = useSelect2Context();
|
15108
15289
|
const handleChange = event => {
|
15109
15290
|
if (validationError) {
|
@@ -15116,11 +15297,6 @@ const Search$2 = /*#__PURE__*/React__default.forwardRef(function ListboxSearch(p
|
|
15116
15297
|
if (event.key === ' ') {
|
15117
15298
|
return;
|
15118
15299
|
}
|
15119
|
-
// Select2 should close dropdown and receive focus, when user press Tab while searching (UX requirement to support better keyboard navigation)
|
15120
|
-
if (event.key === 'Tab') {
|
15121
|
-
setOpen(false);
|
15122
|
-
onTabKeyPress();
|
15123
|
-
}
|
15124
15300
|
if (isAriaSelectionKey(event) || event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
15125
15301
|
var _listboxRef$current;
|
15126
15302
|
event.preventDefault();
|
@@ -15135,7 +15311,7 @@ const Search$2 = /*#__PURE__*/React__default.forwardRef(function ListboxSearch(p
|
|
15135
15311
|
}),
|
15136
15312
|
invalid: !!validationError,
|
15137
15313
|
message: validationError === null || validationError === void 0 ? void 0 : validationError.message
|
15138
|
-
}, /*#__PURE__*/React__default.createElement(Input, Object.assign({},
|
15314
|
+
}, /*#__PURE__*/React__default.createElement(Input, Object.assign({}, props, {
|
15139
15315
|
"aria-hidden": true,
|
15140
15316
|
autoFocus: true,
|
15141
15317
|
invalid: !!validationError,
|
@@ -15310,9 +15486,6 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15310
15486
|
name,
|
15311
15487
|
onChange,
|
15312
15488
|
onCreate,
|
15313
|
-
dialogTriggerTitle,
|
15314
|
-
dialogTriggerDisabled,
|
15315
|
-
dialog,
|
15316
15489
|
onDelete,
|
15317
15490
|
onEdit,
|
15318
15491
|
placeholder,
|
@@ -15349,7 +15522,6 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15349
15522
|
// align the listbox min width with the width of the input - it should never be smaller
|
15350
15523
|
const dimensions = useBoundingClientRectListener(internalRef);
|
15351
15524
|
// state
|
15352
|
-
const [tabTriggeredClose, setTabTriggeredClose] = React__default.useState(false);
|
15353
15525
|
const [open, setOpen] = React__default.useState(false);
|
15354
15526
|
const [value, _setValue] = reactUseControllableState.useControllableState({
|
15355
15527
|
// uncontrolled
|
@@ -15382,9 +15554,6 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15382
15554
|
listboxRef,
|
15383
15555
|
multiple,
|
15384
15556
|
onCreate,
|
15385
|
-
dialogTriggerTitle,
|
15386
|
-
dialogTriggerDisabled,
|
15387
|
-
dialog,
|
15388
15557
|
onDelete,
|
15389
15558
|
onEdit,
|
15390
15559
|
open,
|
@@ -15438,20 +15607,13 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15438
15607
|
setShouldPauseHoverState(true);
|
15439
15608
|
}
|
15440
15609
|
};
|
15441
|
-
const
|
15442
|
-
event.
|
15443
|
-
|
15444
|
-
if (tabTriggeredClose) {
|
15445
|
-
const nextFocussableElement = getNextFocussableElement(internalRef.current);
|
15610
|
+
const handleTab = event => {
|
15611
|
+
if (event.key === 'Tab') {
|
15612
|
+
const nextFocussableElement = getNextFocussableElement(internalRef.current, event.shiftKey ? -1 : +1);
|
15446
15613
|
if (nextFocussableElement) {
|
15447
15614
|
// UX requirement: move focus to the next focussable element when tab key is pressed to select the value
|
15448
15615
|
nextFocussableElement.focus();
|
15449
|
-
// Reset the tabTriggeredClose state
|
15450
|
-
setTabTriggeredClose(false);
|
15451
15616
|
}
|
15452
|
-
} else {
|
15453
|
-
var _internalRef$current;
|
15454
|
-
(_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.focus();
|
15455
15617
|
}
|
15456
15618
|
};
|
15457
15619
|
const selectOptions = searchQuery === '' ? flattenedChildren.map(child => child.props.value) : filteredChildren.map(child => isGroup(child) ? Array.isArray(child.props.children) && child.props.children.map(subChild => subChild.props.value) : child.props.value).flatMap(c => c) || [];
|
@@ -15486,27 +15648,6 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15486
15648
|
setValue(nextValue);
|
15487
15649
|
}
|
15488
15650
|
};
|
15489
|
-
const handleCreateInDialog = function (name, color) {
|
15490
|
-
try {
|
15491
|
-
const _temp2 = function () {
|
15492
|
-
if (onCreate && dialog) {
|
15493
|
-
const _temp = _catch(function () {
|
15494
|
-
return Promise.resolve(onCreate(name, color)).then(function (option) {
|
15495
|
-
setValue(option.value);
|
15496
|
-
// To avoid memory leak we should bind onClose of dialog with setOpen(false)
|
15497
|
-
setOpen(false);
|
15498
|
-
});
|
15499
|
-
}, function (err) {
|
15500
|
-
console.log(err);
|
15501
|
-
});
|
15502
|
-
if (_temp && _temp.then) return _temp.then(function () {});
|
15503
|
-
}
|
15504
|
-
}();
|
15505
|
-
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
|
15506
|
-
} catch (e) {
|
15507
|
-
return Promise.reject(e);
|
15508
|
-
}
|
15509
|
-
};
|
15510
15651
|
const className = cn('border-grey-300 rounded border bg-white py-1.5 shadow-md outline-none"', createCollectionClassName());
|
15511
15652
|
return /*#__PURE__*/React__default.createElement(Select2Context.Provider, {
|
15512
15653
|
value: context
|
@@ -15527,10 +15668,10 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15527
15668
|
asChild: true,
|
15528
15669
|
align: "start",
|
15529
15670
|
onOpenAutoFocus: () => {
|
15530
|
-
var _internalRef$
|
15531
|
-
(_internalRef$
|
15671
|
+
var _internalRef$current;
|
15672
|
+
(_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.focus();
|
15532
15673
|
},
|
15533
|
-
|
15674
|
+
onKeyDown: handleTab,
|
15534
15675
|
sideOffset: 4,
|
15535
15676
|
tabIndex: -1
|
15536
15677
|
}, /*#__PURE__*/React__default.createElement("div", {
|
@@ -15540,8 +15681,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15540
15681
|
}
|
15541
15682
|
}, flattenedChildren.length > 0 || onCreate ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Search$2, {
|
15542
15683
|
placeholder: onCreate ? texts.select2.searchOrCreate : texts.select2.search,
|
15543
|
-
ref: searchRef
|
15544
|
-
onTabKeyPress: () => setTabTriggeredClose(true)
|
15684
|
+
ref: searchRef
|
15545
15685
|
}), multiple && selectOptions.length > 1 && ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Button$1, {
|
15546
15686
|
className: "!justify-start",
|
15547
15687
|
appearance: "discrete",
|
@@ -15574,16 +15714,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15574
15714
|
}, searchQuery === '' ? ( /*#__PURE__*/React__default.createElement(Collection$1, null, initialChildren)) : ( /*#__PURE__*/React__default.createElement(Collection$1, null, filteredChildren)), onCreate ? /*#__PURE__*/React__default.createElement(Create, {
|
15575
15715
|
onCreate: onCreate,
|
15576
15716
|
options: flattenedChildren
|
15577
|
-
}) : null)),
|
15578
|
-
className: "border-grey-300 h-9 border-t p-1.5"
|
15579
|
-
}, /*#__PURE__*/React__default.createElement(Button$1, {
|
15580
|
-
appearance: "discrete",
|
15581
|
-
disabled: dialogTriggerDisabled,
|
15582
|
-
dialog: dialog(handleCreateInDialog)
|
15583
|
-
}, /*#__PURE__*/React__default.createElement(Icon, {
|
15584
|
-
className: "text-xs",
|
15585
|
-
name: "circle-plus"
|
15586
|
-
}), " ", dialogTriggerTitle)))))), /*#__PURE__*/React__default.createElement(ControlledHiddenField, {
|
15717
|
+
}) : null))))), /*#__PURE__*/React__default.createElement(ControlledHiddenField, {
|
15587
15718
|
emptyValue: emptyValue,
|
15588
15719
|
multiple: multiple || tags,
|
15589
15720
|
name: name,
|
@@ -15901,7 +16032,8 @@ const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
15901
16032
|
allColumns,
|
15902
16033
|
filters,
|
15903
16034
|
onChange: handleChange,
|
15904
|
-
value = null
|
16035
|
+
value = null,
|
16036
|
+
...attributes
|
15905
16037
|
} = props;
|
15906
16038
|
const {
|
15907
16039
|
texts
|
@@ -15914,13 +16046,13 @@ const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
15914
16046
|
message: warning ? texts.table.filters.hiddenColumn : undefined,
|
15915
16047
|
warning: warning,
|
15916
16048
|
className: "min-h-[theme(spacing.8)]"
|
15917
|
-
}, /*#__PURE__*/React__default.createElement(Select2, {
|
16049
|
+
}, /*#__PURE__*/React__default.createElement(Select2, Object.assign({}, attributes, {
|
15918
16050
|
ref: ref,
|
15919
16051
|
className: "focus:yt-focus !w-32 flex-shrink-0 ",
|
15920
16052
|
emptyValue: null,
|
15921
16053
|
onChange: handleChange,
|
15922
16054
|
value: value
|
15923
|
-
}, allColumns.map(column => {
|
16055
|
+
}), allColumns.map(column => {
|
15924
16056
|
var _column$columnDef$met, _column$parent, _column$parent$column;
|
15925
16057
|
return /*#__PURE__*/React__default.createElement(Select2.Option, {
|
15926
16058
|
key: column.id,
|
@@ -15940,18 +16072,19 @@ function FilterComparator(props) {
|
|
15940
16072
|
const {
|
15941
16073
|
column,
|
15942
16074
|
onChange: handleChange,
|
15943
|
-
value
|
16075
|
+
value,
|
16076
|
+
...attributes
|
15944
16077
|
} = props;
|
15945
16078
|
const {
|
15946
16079
|
texts
|
15947
16080
|
} = useLocalization();
|
15948
16081
|
const validComparators = guessComparatorsBasedOnControl(column);
|
15949
|
-
return /*#__PURE__*/React__default.createElement(Select2, {
|
16082
|
+
return /*#__PURE__*/React__default.createElement(Select2, Object.assign({}, attributes, {
|
15950
16083
|
className: "!w-32 flex-shrink-0",
|
15951
16084
|
disabled: !column,
|
15952
16085
|
onChange: handleChange,
|
15953
16086
|
value: value
|
15954
|
-
}, validComparators.map(comparator => ( /*#__PURE__*/React__default.createElement(Select2.Option, {
|
16087
|
+
}), validComparators.map(comparator => ( /*#__PURE__*/React__default.createElement(Select2.Option, {
|
15955
16088
|
key: comparator,
|
15956
16089
|
value: comparator
|
15957
16090
|
}, getComparatorText(comparator, texts, column)))));
|
@@ -16071,10 +16204,11 @@ function Control(props) {
|
|
16071
16204
|
const controlRenderer = column === null || column === void 0 ? void 0 : (_column$columnDef$met2 = column.columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.control;
|
16072
16205
|
const dataType = column === null || column === void 0 ? void 0 : (_column$columnDef$met3 = column.columnDef.meta) === null || _column$columnDef$met3 === void 0 ? void 0 : _column$columnDef$met3.dataType;
|
16073
16206
|
React.useEffect(() => {
|
16074
|
-
|
16207
|
+
// Set value to false only after first render of the control (when it's undefined) after setting the FilterColumn value, because we don't want to change then the value every time filter is opened
|
16208
|
+
if (controlRenderer === 'switch' && value === undefined) {
|
16075
16209
|
onChange(false);
|
16076
16210
|
}
|
16077
|
-
}, []);
|
16211
|
+
}, [controlRenderer]);
|
16078
16212
|
if (typeof controlRenderer === 'function') {
|
16079
16213
|
return /*#__PURE__*/React__default.cloneElement(controlRenderer({
|
16080
16214
|
...attributes,
|
@@ -16276,7 +16410,8 @@ function ManageFiltersPopover(props) {
|
|
16276
16410
|
if (f.value.comparator === exports.TableFilterComparator.IsEmpty || f.value.comparator === exports.TableFilterComparator.IsNotEmpty || controlRenderer === 'switch') {
|
16277
16411
|
return true;
|
16278
16412
|
}
|
16279
|
-
|
16413
|
+
const value = f.value.value;
|
16414
|
+
return value !== undefined && value !== null && value !== '';
|
16280
16415
|
});
|
16281
16416
|
return newFilters;
|
16282
16417
|
});
|
@@ -16321,12 +16456,12 @@ function ManageFiltersPopover(props) {
|
|
16321
16456
|
onClick: handleCreate
|
16322
16457
|
}, "+ ", texts.table.filters.buttons.addFilter))), /*#__PURE__*/React__default.createElement(Group, {
|
16323
16458
|
className: "ml-auto"
|
16324
|
-
}, /*#__PURE__*/React__default.createElement(Popover.Close, null, /*#__PURE__*/React__default.createElement(Button$1, null,
|
16459
|
+
}, /*#__PURE__*/React__default.createElement(Popover.Close, null, /*#__PURE__*/React__default.createElement(Button$1, null, texts.table.filters.buttons.cancel)), /*#__PURE__*/React__default.createElement(Button$1, {
|
16325
16460
|
onClick: handleClear
|
16326
|
-
},
|
16461
|
+
}, texts.table.filters.buttons.clear), /*#__PURE__*/React__default.createElement(Button$1, {
|
16327
16462
|
appearance: "primary",
|
16328
16463
|
onClick: handleApply
|
16329
|
-
},
|
16464
|
+
}, texts.table.filters.buttons.apply)))));
|
16330
16465
|
}
|
16331
16466
|
|
16332
16467
|
function Filters(props) {
|
@@ -16464,8 +16599,11 @@ function TableGrid(props) {
|
|
16464
16599
|
table: table.instance,
|
16465
16600
|
tableElement: table.ref.current,
|
16466
16601
|
scrollToIndex: table.renderer.scrollToIndex,
|
16467
|
-
style:
|
16468
|
-
|
16602
|
+
style: props.children ? {
|
16603
|
+
...table.renderer.style,
|
16604
|
+
height: table.renderer.style.height + 41
|
16605
|
+
} : table.renderer.style
|
16606
|
+
}, table.renderer.rows, props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
|
16469
16607
|
table: table.instance
|
16470
16608
|
}) : null)) : ( /*#__PURE__*/React__default.createElement(EmptyStateBody, {
|
16471
16609
|
emptyState: table.props.emptyState
|
@@ -18092,6 +18230,25 @@ function willRowMoveAfterSorting(cell, change, rowIndex) {
|
|
18092
18230
|
}
|
18093
18231
|
return ((_resortedRows$index = resortedRows[index]) === null || _resortedRows$index === void 0 ? void 0 : _resortedRows$index.id) !== cell.row.id;
|
18094
18232
|
}
|
18233
|
+
function animateCreateRow(id) {
|
18234
|
+
const templateRow = document.querySelector(`[data-row-id="${id}"]`);
|
18235
|
+
if (templateRow) {
|
18236
|
+
var _templateRow$querySel;
|
18237
|
+
(_templateRow$querySel = templateRow.querySelector(':first-child')) === null || _templateRow$querySel === void 0 ? void 0 : _templateRow$querySel.focus();
|
18238
|
+
templateRow.scrollIntoView();
|
18239
|
+
const keyframes = [{
|
18240
|
+
background: '#b2c7ef'
|
18241
|
+
}, {
|
18242
|
+
background: '#ebebeb'
|
18243
|
+
}];
|
18244
|
+
for (const child of templateRow.children) {
|
18245
|
+
child.animate(keyframes, {
|
18246
|
+
duration: 1000,
|
18247
|
+
easing: 'ease-out'
|
18248
|
+
});
|
18249
|
+
}
|
18250
|
+
}
|
18251
|
+
}
|
18095
18252
|
|
18096
18253
|
function useTableEditing(isEnabled = false, handleSave, validator) {
|
18097
18254
|
// used to switch the table into editing mode
|
@@ -18126,6 +18283,7 @@ function useTableEditing(isEnabled = false, handleSave, validator) {
|
|
18126
18283
|
function usePendingChanges(isEnabled, handleSave, validator) {
|
18127
18284
|
const saveChanges = function (rowId = undefined) {
|
18128
18285
|
try {
|
18286
|
+
let _exit = false;
|
18129
18287
|
if (!handleSave) {
|
18130
18288
|
console.warn('Tried to save, but Table has no onSave handler');
|
18131
18289
|
return Promise.resolve();
|
@@ -18137,13 +18295,12 @@ function usePendingChanges(isEnabled, handleSave, validator) {
|
|
18137
18295
|
...pendingChanges
|
18138
18296
|
};
|
18139
18297
|
const changes = Object.keys(changesToSave);
|
18140
|
-
|
18141
|
-
changes.
|
18142
|
-
|
18143
|
-
let _exit = false;
|
18298
|
+
return Promise.resolve(function () {
|
18299
|
+
if (changes.length) {
|
18300
|
+
return _forOf(changes, function (rowId) {
|
18144
18301
|
const pendingChange = changesToSave[rowId];
|
18145
18302
|
const changeSet = getChangesetFromChanges(pendingChange);
|
18146
|
-
return
|
18303
|
+
return _catch(function () {
|
18147
18304
|
function _temp3(_result) {
|
18148
18305
|
return _exit ? _result : Promise.resolve(handleSave(changeSet)).then(function () {
|
18149
18306
|
// cleanup changes, we don't need them after saving
|
@@ -18151,6 +18308,10 @@ function usePendingChanges(isEnabled, handleSave, validator) {
|
|
18151
18308
|
setRowSaveStatus(rowId, 'complete');
|
18152
18309
|
});
|
18153
18310
|
}
|
18311
|
+
if (getRowSaveStatus(rowId) === 'pending') {
|
18312
|
+
_exit = true;
|
18313
|
+
return;
|
18314
|
+
}
|
18154
18315
|
// set saving = true
|
18155
18316
|
setRowSaveStatus(rowId, 'pending');
|
18156
18317
|
// re-run validation, maybe a cell is already invalid but has never been blurred
|
@@ -18197,13 +18358,12 @@ function usePendingChanges(isEnabled, handleSave, validator) {
|
|
18197
18358
|
});
|
18198
18359
|
}
|
18199
18360
|
setRowSaveStatus(rowId, undefined);
|
18200
|
-
})
|
18201
|
-
}
|
18202
|
-
return
|
18203
|
-
}
|
18204
|
-
}
|
18205
|
-
}
|
18206
|
-
return Promise.resolve();
|
18361
|
+
});
|
18362
|
+
}, function () {
|
18363
|
+
return _exit;
|
18364
|
+
});
|
18365
|
+
}
|
18366
|
+
}());
|
18207
18367
|
} catch (e) {
|
18208
18368
|
return Promise.reject(e);
|
18209
18369
|
}
|
@@ -18240,6 +18400,40 @@ function usePendingChanges(isEnabled, handleSave, validator) {
|
|
18240
18400
|
return Promise.reject(e);
|
18241
18401
|
}
|
18242
18402
|
};
|
18403
|
+
const addCreatedRowChangeset = function (row) {
|
18404
|
+
try {
|
18405
|
+
const cells = row.getAllCells();
|
18406
|
+
setPendingChanges(currentChanges => {
|
18407
|
+
return cells.reduce((changes, cell) => {
|
18408
|
+
if (cell.getValue()) {
|
18409
|
+
var _currentChanges$cell$4, _currentChanges$cell$5, _currentChanges$cell$6;
|
18410
|
+
return {
|
18411
|
+
...changes,
|
18412
|
+
[cell.row.id]: {
|
18413
|
+
...changes[cell.row.id],
|
18414
|
+
[cell.column.id]: cell.getValue(),
|
18415
|
+
_meta: {
|
18416
|
+
...((_currentChanges$cell$4 = currentChanges[cell.row.id]) === null || _currentChanges$cell$4 === void 0 ? void 0 : _currentChanges$cell$4._meta),
|
18417
|
+
original: cell.row.original,
|
18418
|
+
moveReason: {
|
18419
|
+
...((_currentChanges$cell$5 = currentChanges[cell.row.id]) === null || _currentChanges$cell$5 === void 0 ? void 0 : _currentChanges$cell$5._meta.moveReason)
|
18420
|
+
},
|
18421
|
+
errors: {
|
18422
|
+
...((_currentChanges$cell$6 = currentChanges[cell.row.id]) === null || _currentChanges$cell$6 === void 0 ? void 0 : _currentChanges$cell$6._meta.errors)
|
18423
|
+
}
|
18424
|
+
}
|
18425
|
+
}
|
18426
|
+
};
|
18427
|
+
} else {
|
18428
|
+
return changes;
|
18429
|
+
}
|
18430
|
+
}, currentChanges);
|
18431
|
+
});
|
18432
|
+
return Promise.resolve();
|
18433
|
+
} catch (e) {
|
18434
|
+
return Promise.reject(e);
|
18435
|
+
}
|
18436
|
+
};
|
18243
18437
|
const [pendingChanges, setPendingChanges] = React__default.useState({});
|
18244
18438
|
// we maintain save status as separate state because 'complete' needs to briefly show after pendingChanges are deleted
|
18245
18439
|
const [saveStates, setSaveState] = React__default.useState({});
|
@@ -18366,8 +18560,8 @@ function usePendingChanges(isEnabled, handleSave, validator) {
|
|
18366
18560
|
return Object.keys(getErrors().filter(error => {
|
18367
18561
|
var _activeRow;
|
18368
18562
|
if ((_activeRow = activeRow) !== null && _activeRow !== void 0 && _activeRow.id && focusIsInsideTable) {
|
18369
|
-
var _activeRow2
|
18370
|
-
return error.rowId === ((_activeRow2 = activeRow) === null || _activeRow2 === void 0 ? void 0 : _activeRow2.id) ? error.pendingChange._meta.errors
|
18563
|
+
var _activeRow2, _error$pendingChange$;
|
18564
|
+
return error.rowId === ((_activeRow2 = activeRow) === null || _activeRow2 === void 0 ? void 0 : _activeRow2.id) ? (_error$pendingChange$ = error.pendingChange._meta.errors) === null || _error$pendingChange$ === void 0 ? void 0 : _error$pendingChange$.hasShownErrorAlert : true;
|
18371
18565
|
}
|
18372
18566
|
return true;
|
18373
18567
|
})).length;
|
@@ -18392,6 +18586,7 @@ function usePendingChanges(isEnabled, handleSave, validator) {
|
|
18392
18586
|
getCellError,
|
18393
18587
|
setCellValue,
|
18394
18588
|
validateCell,
|
18589
|
+
addCreatedRowChangeset,
|
18395
18590
|
hasChanges,
|
18396
18591
|
hasErrors,
|
18397
18592
|
getErrors,
|
@@ -18617,10 +18812,11 @@ function useEditingCellAutofocus(props) {
|
|
18617
18812
|
// focus the cell so that we trigger it's handle focus
|
18618
18813
|
React__default.useEffect(() => {
|
18619
18814
|
if (props.cellRef.current) {
|
18620
|
-
var _props$cellRef$curren, _document$activeEleme;
|
18815
|
+
var _props$cellRef$curren, _document$activeEleme, _document$activeEleme2;
|
18621
18816
|
const isFocusedElementInCurrentRow = (_props$cellRef$curren = props.cellRef.current.closest('tr')) === null || _props$cellRef$curren === void 0 ? void 0 : _props$cellRef$curren.contains(document.activeElement);
|
18622
18817
|
const isFocusedElementSearch = ((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.getAttribute('name')) === 'table-search';
|
18623
|
-
|
18818
|
+
const isFocusedElementMenu = ((_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === void 0 ? void 0 : _document$activeEleme2.getAttribute('role')) === 'menu';
|
18819
|
+
if (autoFocus && !isFocusedElementInCurrentRow && !isFocusedElementSearch && !isFocusedElementMenu) {
|
18624
18820
|
var _props$cellRef$curren2;
|
18625
18821
|
(_props$cellRef$curren2 = props.cellRef.current) === null || _props$cellRef$curren2 === void 0 ? void 0 : _props$cellRef$curren2.focus();
|
18626
18822
|
}
|
@@ -19036,6 +19232,7 @@ const RENDERERS$1 = {
|
|
19036
19232
|
};
|
19037
19233
|
function useTable3(props, ref) {
|
19038
19234
|
const editing = useTableEditing(props.enableEditing, props.onSave, props.validator);
|
19235
|
+
const creationEnabled = editing.isEnabled && !!props.enableCreation;
|
19039
19236
|
const extendedProps = {
|
19040
19237
|
...props,
|
19041
19238
|
enableRowActions: editing.isEditing ? true : props.enableRowActions,
|
@@ -19045,7 +19242,7 @@ function useTable3(props, ref) {
|
|
19045
19242
|
onClear: () => editing.resetChanges(rowId),
|
19046
19243
|
onSave: () => editing.saveChanges(rowId),
|
19047
19244
|
onExit: () => editing.toggleEditing(false),
|
19048
|
-
isLastRow: table.meta.rowActive.rowActiveIndex === table.meta.length - 1
|
19245
|
+
isLastRow: !creationEnabled && table.meta.rowActive.rowActiveIndex === table.meta.length - 1
|
19049
19246
|
}))] : props.rowActions
|
19050
19247
|
};
|
19051
19248
|
const meta = {
|
@@ -19076,6 +19273,22 @@ function Alert$1(props) {
|
|
19076
19273
|
const tableMeta = table.options.meta;
|
19077
19274
|
const [showFilterResetDialog, setShowFilterResetDialog] = React__default.useState(false);
|
19078
19275
|
const pendingChangesWithErrors = tableMeta.editing.getErrors();
|
19276
|
+
const resetPendingChanges = tableMeta.editing.resetChanges;
|
19277
|
+
const allRows = table.getPreFilteredRowModel().rows;
|
19278
|
+
// This effect deletes error in the alert if the row that has the error is deleted.
|
19279
|
+
React__default.useEffect(() => {
|
19280
|
+
pendingChangesWithErrors.forEach(errorRow => {
|
19281
|
+
const errorRowId = errorRow.rowId;
|
19282
|
+
try {
|
19283
|
+
// getRow throws error if it fails to find the row
|
19284
|
+
if (!table.getRow(errorRowId)) {
|
19285
|
+
resetPendingChanges(errorRowId);
|
19286
|
+
}
|
19287
|
+
} catch {
|
19288
|
+
resetPendingChanges(errorRowId);
|
19289
|
+
}
|
19290
|
+
});
|
19291
|
+
}, [allRows.length]);
|
19079
19292
|
const activeRow = React__default.useMemo(() => tableMeta.rowActive.rowActiveIndex ? table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex] : undefined, [tableMeta.rowActive.rowActiveIndex]);
|
19080
19293
|
// mark errors being rendered as seen
|
19081
19294
|
React__default.useEffect(() => {
|
@@ -19104,18 +19317,23 @@ function Alert$1(props) {
|
|
19104
19317
|
const title = (pendingChangesWithErrors.length === 1 ? validationTexts.alert.titleOne : validationTexts.alert.titlePlural).replace('[COUNT]', String(pendingChangesWithErrors.length));
|
19105
19318
|
// generate links to each invalid row, to go into the error message
|
19106
19319
|
const links = [];
|
19107
|
-
const rowIdentityColumn = tableMeta.
|
19320
|
+
const rowIdentityColumn = tableMeta.rowIdentityColumnAccessor ?
|
19321
|
+
// Since rowIdentityColumnAccessor can have multiple ids, we use the first id to refer to the row in Alert
|
19322
|
+
table.getColumn(String(tableMeta.rowIdentityColumnAccessor[0])) : undefined;
|
19108
19323
|
pendingChangesWithErrors.forEach((error, index) => {
|
19109
19324
|
// if appropriate, concatenate the item with the text "and"
|
19110
19325
|
if (pendingChangesWithErrors.length > 1 && index === pendingChangesWithErrors.length - 1) {
|
19111
19326
|
// Add space before and after `messageAnd` text
|
19112
19327
|
links.push(` ${validationTexts.alert.messageAnd} `);
|
19113
19328
|
}
|
19114
|
-
const rowIndex = table.
|
19329
|
+
const rowIndex = table.getFilteredRowModel().rows.findIndex(row => row.id === error.rowId);
|
19115
19330
|
const handleClick = () => {
|
19331
|
+
// if row is visible
|
19116
19332
|
if (rowIndex > -1) {
|
19117
19333
|
scrollToRow(rowIndex);
|
19118
|
-
}
|
19334
|
+
}
|
19335
|
+
// if row is filtered out
|
19336
|
+
else {
|
19119
19337
|
setShowFilterResetDialog(error.rowId);
|
19120
19338
|
}
|
19121
19339
|
};
|
@@ -19191,6 +19409,89 @@ function FilterResetDialog(props) {
|
|
19191
19409
|
}, texts.table3.editing.validation.resetFiltersDialog.confirm)))));
|
19192
19410
|
}
|
19193
19411
|
|
19412
|
+
function CreateNewRowButton(props) {
|
19413
|
+
const {
|
19414
|
+
onCreate,
|
19415
|
+
scrollToIndex,
|
19416
|
+
table,
|
19417
|
+
tableMeta
|
19418
|
+
} = props;
|
19419
|
+
const {
|
19420
|
+
texts
|
19421
|
+
} = useLocalization();
|
19422
|
+
const rows = table.getCoreRowModel().rows;
|
19423
|
+
const [rowCreated, setRowCreated] = React__default.useState({
|
19424
|
+
rowFinder: undefined
|
19425
|
+
});
|
19426
|
+
const handleKeyDown = event => {
|
19427
|
+
if (!tableMeta.editing.hasChanges() && event.key === 'Tab') {
|
19428
|
+
!tableMeta.editing.saveChanges();
|
19429
|
+
}
|
19430
|
+
};
|
19431
|
+
const handleCreate = function () {
|
19432
|
+
try {
|
19433
|
+
if (!onCreate) {
|
19434
|
+
return Promise.resolve();
|
19435
|
+
}
|
19436
|
+
const createdRow = rows.find(row => {
|
19437
|
+
var _rowCreated$rowFinder;
|
19438
|
+
return rowCreated === null || rowCreated === void 0 ? void 0 : (_rowCreated$rowFinder = rowCreated.rowFinder) === null || _rowCreated$rowFinder === void 0 ? void 0 : _rowCreated$rowFinder.call(rowCreated, row.original);
|
19439
|
+
});
|
19440
|
+
const _temp = function () {
|
19441
|
+
if (createdRow) {
|
19442
|
+
return Promise.resolve(tableMeta.editing.saveChanges()).then(function () {
|
19443
|
+
if (!tableMeta.editing.hasRowErrors(createdRow.id)) {
|
19444
|
+
const rowFinder = onCreate();
|
19445
|
+
setRowCreated({
|
19446
|
+
rowFinder
|
19447
|
+
});
|
19448
|
+
}
|
19449
|
+
});
|
19450
|
+
} else {
|
19451
|
+
const rowFinder = onCreate();
|
19452
|
+
setRowCreated({
|
19453
|
+
rowFinder
|
19454
|
+
});
|
19455
|
+
}
|
19456
|
+
}();
|
19457
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
19458
|
+
} catch (e) {
|
19459
|
+
return Promise.reject(e);
|
19460
|
+
}
|
19461
|
+
};
|
19462
|
+
React__default.useEffect(() => {
|
19463
|
+
if (typeof (rowCreated === null || rowCreated === void 0 ? void 0 : rowCreated.rowFinder) === 'function') {
|
19464
|
+
const createdRow = rows.find(row => {
|
19465
|
+
var _rowCreated$rowFinder2;
|
19466
|
+
return rowCreated === null || rowCreated === void 0 ? void 0 : (_rowCreated$rowFinder2 = rowCreated.rowFinder) === null || _rowCreated$rowFinder2 === void 0 ? void 0 : _rowCreated$rowFinder2.call(rowCreated, row.original);
|
19467
|
+
});
|
19468
|
+
if (createdRow) {
|
19469
|
+
const rowInTable = table.getRowModel().rows.find(row => {
|
19470
|
+
var _rowCreated$rowFinder3;
|
19471
|
+
return rowCreated === null || rowCreated === void 0 ? void 0 : (_rowCreated$rowFinder3 = rowCreated.rowFinder) === null || _rowCreated$rowFinder3 === void 0 ? void 0 : _rowCreated$rowFinder3.call(rowCreated, row.original);
|
19472
|
+
});
|
19473
|
+
if (rowInTable) {
|
19474
|
+
tableMeta.editing.toggleEditing(true);
|
19475
|
+
tableMeta.rowActive.setRowActiveIndex(createdRow.index);
|
19476
|
+
scrollToIndex(createdRow.index);
|
19477
|
+
requestAnimationFrame(() => animateCreateRow(createdRow.id));
|
19478
|
+
}
|
19479
|
+
requestAnimationFrame(() => tableMeta.editing.addCreatedRowChangeset(createdRow));
|
19480
|
+
}
|
19481
|
+
}
|
19482
|
+
}, [rowCreated]);
|
19483
|
+
return /*#__PURE__*/React__default.createElement("tr", {
|
19484
|
+
onClick: handleCreate,
|
19485
|
+
className: "border-grey-300 hover:bg-grey-100 group !sticky bottom-10 left-0 z-[21] !block cursor-pointer border-t"
|
19486
|
+
}, /*#__PURE__*/React__default.createElement("td", {
|
19487
|
+
className: "!border-t-0 !bg-transparent"
|
19488
|
+
}, /*#__PURE__*/React__default.createElement(Button$1, {
|
19489
|
+
onKeyDown: handleKeyDown,
|
19490
|
+
className: "group-hover:bg-grey-200 sticky left-0",
|
19491
|
+
appearance: "transparent"
|
19492
|
+
}, "+ ", texts.table3.editing.buttons.create.label)));
|
19493
|
+
}
|
19494
|
+
|
19194
19495
|
function Editing(props) {
|
19195
19496
|
const {
|
19196
19497
|
scrollToIndex,
|
@@ -19247,6 +19548,7 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
|
|
19247
19548
|
enableHorizontalArrowKeyNavigation: table3.meta.editing.isEditing
|
19248
19549
|
};
|
19249
19550
|
const hasValidationErrors = table3.meta.editing.hasErrors(table3.instance, table3.ref);
|
19551
|
+
const showCreateRowButton = table3.meta.editing.isEnabled && props.enableCreation && props.onCreate;
|
19250
19552
|
return /*#__PURE__*/React__default.createElement(Table, null, /*#__PURE__*/React__default.createElement(Table.Toolbar, {
|
19251
19553
|
table: table3
|
19252
19554
|
}, table3.meta.editing.isEnabled ? ( /*#__PURE__*/React__default.createElement(Editing, {
|
@@ -19260,7 +19562,12 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
|
|
19260
19562
|
})) : null, /*#__PURE__*/React__default.createElement(Table.Grid, Object.assign({}, gridAttributes, {
|
19261
19563
|
"data-taco": "table3",
|
19262
19564
|
table: table3
|
19263
|
-
})
|
19565
|
+
}), showCreateRowButton && ( /*#__PURE__*/React__default.createElement(CreateNewRowButton, {
|
19566
|
+
table: table3.instance,
|
19567
|
+
tableMeta: table3.meta,
|
19568
|
+
onCreate: props.onCreate,
|
19569
|
+
scrollToIndex: table3.renderer.scrollToIndex
|
19570
|
+
}))));
|
19264
19571
|
});
|
19265
19572
|
const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
19266
19573
|
const stringifiedChildren = String(props.children);
|