@economic/taco 2.35.1 → 2.36.1
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/Select2/components/Option.d.ts +2 -2
- package/dist/components/Select2/components/Search.d.ts +1 -7
- package/dist/components/Table3/Table3.d.ts +4 -0
- 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 +5 -0
- 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 +7 -16
- 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/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/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/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.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/types.d.ts +7 -5
- package/dist/primitives/Table/useTableManager/features/useTableRowClick.d.ts +4 -4
- 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 +419 -109
- 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();
|
@@ -10438,7 +10446,9 @@ function getTableFeaturePreset(props) {
|
|
10438
10446
|
enablePrinting: (_props$enablePrinting = props.enablePrinting) !== null && _props$enablePrinting !== void 0 ? _props$enablePrinting : presetOptions.enablePrinting,
|
10439
10447
|
enableRowActive: (_props$enableRowActiv = props.enableRowActive) !== null && _props$enableRowActiv !== void 0 ? _props$enableRowActiv : presetOptions.enableRowActive,
|
10440
10448
|
enableRowActions: enableRowActions && !!((_props$rowActions = props.rowActions) !== null && _props$rowActions !== void 0 && _props$rowActions.length),
|
10441
|
-
|
10449
|
+
// enableRowClick can be either function or boolean, that is why we need to pass exactly enableRowClick,
|
10450
|
+
// and not just result of the condition
|
10451
|
+
enableRowClick: enableRowClick && !!props.onRowClick ? enableRowClick : false,
|
10442
10452
|
enableRowDrag: enableRowDrag && !!props.onRowDrag,
|
10443
10453
|
enableRowDrop: enableRowDrop && !!props.onRowDrop,
|
10444
10454
|
enableRowGoto: enableRowGoto && !!props.onRowGoto,
|
@@ -10658,26 +10668,29 @@ function getNextIndex(direction, currentIndex, length) {
|
|
10658
10668
|
}
|
10659
10669
|
|
10660
10670
|
function useTableRowClick(isEnabled = false, onRowClick) {
|
10661
|
-
const
|
10662
|
-
|
10671
|
+
const isRowClickEnabled = React__default.useCallback(row => {
|
10672
|
+
return typeof isEnabled === 'boolean' ? isEnabled : isEnabled(row);
|
10673
|
+
}, [isEnabled]);
|
10674
|
+
const handleKeyDown = React__default.useCallback(function (event, rowData) {
|
10675
|
+
if (!isRowClickEnabled(rowData) || typeof onRowClick !== 'function' || event.defaultPrevented) {
|
10663
10676
|
return;
|
10664
10677
|
}
|
10665
|
-
if (
|
10678
|
+
if (rowData && event.key === 'Enter') {
|
10666
10679
|
event.preventDefault();
|
10667
|
-
onRowClick(
|
10680
|
+
onRowClick(rowData);
|
10668
10681
|
return;
|
10669
10682
|
}
|
10670
10683
|
}, [isEnabled, onRowClick]);
|
10671
|
-
const handleClick = React__default.useCallback(function (event,
|
10672
|
-
if (!
|
10684
|
+
const handleClick = React__default.useCallback(function (event, rowData) {
|
10685
|
+
if (!isRowClickEnabled(rowData) || typeof onRowClick !== 'function' || event.defaultPrevented) {
|
10673
10686
|
return;
|
10674
10687
|
}
|
10675
10688
|
event.preventDefault();
|
10676
|
-
onRowClick(
|
10689
|
+
onRowClick(rowData);
|
10677
10690
|
return;
|
10678
10691
|
}, [isEnabled, onRowClick]);
|
10679
10692
|
return {
|
10680
|
-
isEnabled,
|
10693
|
+
isEnabled: isRowClickEnabled,
|
10681
10694
|
handleClick,
|
10682
10695
|
handleKeyDown
|
10683
10696
|
};
|
@@ -10777,7 +10790,167 @@ function useTableSearch(isEnabled = false, defaultEnableGlobalFilter = false) {
|
|
10777
10790
|
}
|
10778
10791
|
|
10779
10792
|
// A type of promise-like that resolves synchronously and supports only one observer
|
10793
|
+
const _Pact = /*#__PURE__*/function () {
|
10794
|
+
function _Pact() {}
|
10795
|
+
_Pact.prototype.then = function (onFulfilled, onRejected) {
|
10796
|
+
const result = new _Pact();
|
10797
|
+
const state = this.s;
|
10798
|
+
if (state) {
|
10799
|
+
const callback = state & 1 ? onFulfilled : onRejected;
|
10800
|
+
if (callback) {
|
10801
|
+
try {
|
10802
|
+
_settle(result, 1, callback(this.v));
|
10803
|
+
} catch (e) {
|
10804
|
+
_settle(result, 2, e);
|
10805
|
+
}
|
10806
|
+
return result;
|
10807
|
+
} else {
|
10808
|
+
return this;
|
10809
|
+
}
|
10810
|
+
}
|
10811
|
+
this.o = function (_this) {
|
10812
|
+
try {
|
10813
|
+
const value = _this.v;
|
10814
|
+
if (_this.s & 1) {
|
10815
|
+
_settle(result, 1, onFulfilled ? onFulfilled(value) : value);
|
10816
|
+
} else if (onRejected) {
|
10817
|
+
_settle(result, 1, onRejected(value));
|
10818
|
+
} else {
|
10819
|
+
_settle(result, 2, value);
|
10820
|
+
}
|
10821
|
+
} catch (e) {
|
10822
|
+
_settle(result, 2, e);
|
10823
|
+
}
|
10824
|
+
};
|
10825
|
+
return result;
|
10826
|
+
};
|
10827
|
+
return _Pact;
|
10828
|
+
}();
|
10829
|
+
|
10830
|
+
// Settles a pact synchronously
|
10831
|
+
function _settle(pact, state, value) {
|
10832
|
+
if (!pact.s) {
|
10833
|
+
if (value instanceof _Pact) {
|
10834
|
+
if (value.s) {
|
10835
|
+
if (state & 1) {
|
10836
|
+
state = value.s;
|
10837
|
+
}
|
10838
|
+
value = value.v;
|
10839
|
+
} else {
|
10840
|
+
value.o = _settle.bind(null, pact, state);
|
10841
|
+
return;
|
10842
|
+
}
|
10843
|
+
}
|
10844
|
+
if (value && value.then) {
|
10845
|
+
value.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));
|
10846
|
+
return;
|
10847
|
+
}
|
10848
|
+
pact.s = state;
|
10849
|
+
pact.v = value;
|
10850
|
+
const observer = pact.o;
|
10851
|
+
if (observer) {
|
10852
|
+
observer(pact);
|
10853
|
+
}
|
10854
|
+
}
|
10855
|
+
}
|
10856
|
+
function _isSettledPact(thenable) {
|
10857
|
+
return thenable instanceof _Pact && thenable.s & 1;
|
10858
|
+
}
|
10859
|
+
|
10860
|
+
// 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)
|
10861
|
+
function _forTo(array, body, check) {
|
10862
|
+
var i = -1,
|
10863
|
+
pact,
|
10864
|
+
reject;
|
10865
|
+
function _cycle(result) {
|
10866
|
+
try {
|
10867
|
+
while (++i < array.length && (!check || !check())) {
|
10868
|
+
result = body(i);
|
10869
|
+
if (result && result.then) {
|
10870
|
+
if (_isSettledPact(result)) {
|
10871
|
+
result = result.v;
|
10872
|
+
} else {
|
10873
|
+
result.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));
|
10874
|
+
return;
|
10875
|
+
}
|
10876
|
+
}
|
10877
|
+
}
|
10878
|
+
if (pact) {
|
10879
|
+
_settle(pact, 1, result);
|
10880
|
+
} else {
|
10881
|
+
pact = result;
|
10882
|
+
}
|
10883
|
+
} catch (e) {
|
10884
|
+
_settle(pact || (pact = new _Pact()), 2, e);
|
10885
|
+
}
|
10886
|
+
}
|
10887
|
+
_cycle();
|
10888
|
+
return pact;
|
10889
|
+
}
|
10780
10890
|
const _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = /*#__PURE__*/Symbol("Symbol.iterator")) : "@@iterator";
|
10891
|
+
|
10892
|
+
// Asynchronously iterate through an object's values
|
10893
|
+
// Uses for...of if the runtime supports it, otherwise iterates until length on a copy
|
10894
|
+
function _forOf(target, body, check) {
|
10895
|
+
if (typeof target[_iteratorSymbol] === "function") {
|
10896
|
+
var iterator = target[_iteratorSymbol](),
|
10897
|
+
step,
|
10898
|
+
pact,
|
10899
|
+
reject;
|
10900
|
+
function _cycle(result) {
|
10901
|
+
try {
|
10902
|
+
while (!(step = iterator.next()).done && (!check || !check())) {
|
10903
|
+
result = body(step.value);
|
10904
|
+
if (result && result.then) {
|
10905
|
+
if (_isSettledPact(result)) {
|
10906
|
+
result = result.v;
|
10907
|
+
} else {
|
10908
|
+
result.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));
|
10909
|
+
return;
|
10910
|
+
}
|
10911
|
+
}
|
10912
|
+
}
|
10913
|
+
if (pact) {
|
10914
|
+
_settle(pact, 1, result);
|
10915
|
+
} else {
|
10916
|
+
pact = result;
|
10917
|
+
}
|
10918
|
+
} catch (e) {
|
10919
|
+
_settle(pact || (pact = new _Pact()), 2, e);
|
10920
|
+
}
|
10921
|
+
}
|
10922
|
+
_cycle();
|
10923
|
+
if (iterator.return) {
|
10924
|
+
var _fixup = function (value) {
|
10925
|
+
try {
|
10926
|
+
if (!step.done) {
|
10927
|
+
iterator.return();
|
10928
|
+
}
|
10929
|
+
} catch (e) {}
|
10930
|
+
return value;
|
10931
|
+
};
|
10932
|
+
if (pact && pact.then) {
|
10933
|
+
return pact.then(_fixup, function (e) {
|
10934
|
+
throw _fixup(e);
|
10935
|
+
});
|
10936
|
+
}
|
10937
|
+
_fixup();
|
10938
|
+
}
|
10939
|
+
return pact;
|
10940
|
+
}
|
10941
|
+
// No support for Symbol.iterator
|
10942
|
+
if (!("length" in target)) {
|
10943
|
+
throw new TypeError("Object is not iterable");
|
10944
|
+
}
|
10945
|
+
// Handle live collections properly
|
10946
|
+
var values = [];
|
10947
|
+
for (var i = 0; i < target.length; i++) {
|
10948
|
+
values.push(target[i]);
|
10949
|
+
}
|
10950
|
+
return _forTo(values, function (i) {
|
10951
|
+
return body(values[i]);
|
10952
|
+
}, check);
|
10953
|
+
}
|
10781
10954
|
const _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = /*#__PURE__*/Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
|
10782
10955
|
|
10783
10956
|
// Asynchronously call a function and send errors to recovery continuation
|
@@ -10903,7 +11076,12 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
10903
11076
|
const invalidate = function () {
|
10904
11077
|
try {
|
10905
11078
|
_forceReset.current = true;
|
10906
|
-
|
11079
|
+
if (_lastUsedSearch.current) {
|
11080
|
+
// we're searching, which means we need to refetch all with the correct sorting applied
|
11081
|
+
return loadAll(_lastUsedSorting.current, _lastUsedFilters.current);
|
11082
|
+
} else {
|
11083
|
+
return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current);
|
11084
|
+
}
|
10907
11085
|
} catch (e) {
|
10908
11086
|
return Promise.reject(e);
|
10909
11087
|
}
|
@@ -11865,7 +12043,7 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
|
|
11865
12043
|
let content = null;
|
11866
12044
|
if (rows.length) {
|
11867
12045
|
style = {
|
11868
|
-
height:
|
12046
|
+
height: totalSize,
|
11869
12047
|
paddingBottom,
|
11870
12048
|
paddingTop
|
11871
12049
|
};
|
@@ -12565,8 +12743,7 @@ const DisplayRow = /*#__PURE__*/React__default.memo(function DisplayRow(props) {
|
|
12565
12743
|
tableMeta.rowClick.handleClick(event, row.original);
|
12566
12744
|
}, [row.original]);
|
12567
12745
|
const handleClickCapture = React__default.useCallback(() => {
|
12568
|
-
|
12569
|
-
requestAnimationFrame(() => tableMeta.rowActive.setRowActiveIndex(index));
|
12746
|
+
tableMeta.rowActive.setRowActiveIndex(index);
|
12570
12747
|
}, [index]);
|
12571
12748
|
// row active
|
12572
12749
|
if (tableMeta.rowActive.isEnabled) {
|
@@ -12575,7 +12752,7 @@ const DisplayRow = /*#__PURE__*/React__default.memo(function DisplayRow(props) {
|
|
12575
12752
|
attributes.onClickCapture = handleClickCapture;
|
12576
12753
|
}
|
12577
12754
|
// row click
|
12578
|
-
if (tableMeta.rowClick.isEnabled) {
|
12755
|
+
if (tableMeta.rowClick.isEnabled(row.original)) {
|
12579
12756
|
attributes.onClick = handleClick;
|
12580
12757
|
}
|
12581
12758
|
// row drag
|
@@ -12872,6 +13049,7 @@ function HeaderMenu(props) {
|
|
12872
13049
|
canHide,
|
12873
13050
|
canPin,
|
12874
13051
|
canSort,
|
13052
|
+
columnId,
|
12875
13053
|
customMenu,
|
12876
13054
|
index,
|
12877
13055
|
isFiltered,
|
@@ -12975,10 +13153,7 @@ function HeaderMenu(props) {
|
|
12975
13153
|
}, isFiltered ? texts.table.columns.menu.editFilter : texts.table.columns.menu.filter));
|
12976
13154
|
}
|
12977
13155
|
if (customMenu) {
|
12978
|
-
const
|
12979
|
-
trigger: undefined
|
12980
|
-
});
|
12981
|
-
const customItems = React__default.Children.toArray(menu.props.children.props.children);
|
13156
|
+
const customItems = customMenu.map(menuItem => menuItem(columnId)).filter(action => !!action);
|
12982
13157
|
if (customItems.length) {
|
12983
13158
|
if (menuItems.length) {
|
12984
13159
|
menuItems.push( /*#__PURE__*/React__default.createElement(Menu$1.Separator, null));
|
@@ -13240,7 +13415,8 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
|
|
13240
13415
|
onSortToggle: handleSortToggle,
|
13241
13416
|
scrollToIndex: scrollToIndex,
|
13242
13417
|
setRowActiveIndex: setRowActiveIndex,
|
13243
|
-
sortDirection: sortDirection
|
13418
|
+
sortDirection: sortDirection,
|
13419
|
+
columnId: id
|
13244
13420
|
})) : null, canResize ? ( /*#__PURE__*/React__default.createElement(Resizer, {
|
13245
13421
|
headerRef: ref,
|
13246
13422
|
id: id,
|
@@ -15093,17 +15269,12 @@ const BubbleSelect = props => {
|
|
15093
15269
|
};
|
15094
15270
|
|
15095
15271
|
const Search$2 = /*#__PURE__*/React__default.forwardRef(function ListboxSearch(props, ref) {
|
15096
|
-
const {
|
15097
|
-
onTabKeyPress,
|
15098
|
-
...otherProps
|
15099
|
-
} = props;
|
15100
15272
|
const {
|
15101
15273
|
listboxRef,
|
15102
15274
|
searchQuery,
|
15103
15275
|
setSearchQuery,
|
15104
15276
|
setValidationError,
|
15105
|
-
validationError
|
15106
|
-
setOpen
|
15277
|
+
validationError
|
15107
15278
|
} = useSelect2Context();
|
15108
15279
|
const handleChange = event => {
|
15109
15280
|
if (validationError) {
|
@@ -15116,11 +15287,6 @@ const Search$2 = /*#__PURE__*/React__default.forwardRef(function ListboxSearch(p
|
|
15116
15287
|
if (event.key === ' ') {
|
15117
15288
|
return;
|
15118
15289
|
}
|
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
15290
|
if (isAriaSelectionKey(event) || event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
15125
15291
|
var _listboxRef$current;
|
15126
15292
|
event.preventDefault();
|
@@ -15135,7 +15301,7 @@ const Search$2 = /*#__PURE__*/React__default.forwardRef(function ListboxSearch(p
|
|
15135
15301
|
}),
|
15136
15302
|
invalid: !!validationError,
|
15137
15303
|
message: validationError === null || validationError === void 0 ? void 0 : validationError.message
|
15138
|
-
}, /*#__PURE__*/React__default.createElement(Input, Object.assign({},
|
15304
|
+
}, /*#__PURE__*/React__default.createElement(Input, Object.assign({}, props, {
|
15139
15305
|
"aria-hidden": true,
|
15140
15306
|
autoFocus: true,
|
15141
15307
|
invalid: !!validationError,
|
@@ -15346,7 +15512,6 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15346
15512
|
// align the listbox min width with the width of the input - it should never be smaller
|
15347
15513
|
const dimensions = useBoundingClientRectListener(internalRef);
|
15348
15514
|
// state
|
15349
|
-
const [tabTriggeredClose, setTabTriggeredClose] = React__default.useState(false);
|
15350
15515
|
const [open, setOpen] = React__default.useState(false);
|
15351
15516
|
const [value, _setValue] = reactUseControllableState.useControllableState({
|
15352
15517
|
// uncontrolled
|
@@ -15432,20 +15597,13 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15432
15597
|
setShouldPauseHoverState(true);
|
15433
15598
|
}
|
15434
15599
|
};
|
15435
|
-
const
|
15436
|
-
event.
|
15437
|
-
|
15438
|
-
if (tabTriggeredClose) {
|
15439
|
-
const nextFocussableElement = getNextFocussableElement(internalRef.current);
|
15600
|
+
const handleTab = event => {
|
15601
|
+
if (event.key === 'Tab') {
|
15602
|
+
const nextFocussableElement = getNextFocussableElement(internalRef.current, event.shiftKey ? -1 : +1);
|
15440
15603
|
if (nextFocussableElement) {
|
15441
15604
|
// UX requirement: move focus to the next focussable element when tab key is pressed to select the value
|
15442
15605
|
nextFocussableElement.focus();
|
15443
|
-
// Reset the tabTriggeredClose state
|
15444
|
-
setTabTriggeredClose(false);
|
15445
15606
|
}
|
15446
|
-
} else {
|
15447
|
-
var _internalRef$current;
|
15448
|
-
(_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.focus();
|
15449
15607
|
}
|
15450
15608
|
};
|
15451
15609
|
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) || [];
|
@@ -15500,10 +15658,10 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15500
15658
|
asChild: true,
|
15501
15659
|
align: "start",
|
15502
15660
|
onOpenAutoFocus: () => {
|
15503
|
-
var _internalRef$
|
15504
|
-
(_internalRef$
|
15661
|
+
var _internalRef$current;
|
15662
|
+
(_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.focus();
|
15505
15663
|
},
|
15506
|
-
|
15664
|
+
onKeyDown: handleTab,
|
15507
15665
|
sideOffset: 4,
|
15508
15666
|
tabIndex: -1
|
15509
15667
|
}, /*#__PURE__*/React__default.createElement("div", {
|
@@ -15513,8 +15671,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15513
15671
|
}
|
15514
15672
|
}, flattenedChildren.length > 0 || onCreate ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Search$2, {
|
15515
15673
|
placeholder: onCreate ? texts.select2.searchOrCreate : texts.select2.search,
|
15516
|
-
ref: searchRef
|
15517
|
-
onTabKeyPress: () => setTabTriggeredClose(true)
|
15674
|
+
ref: searchRef
|
15518
15675
|
}), multiple && selectOptions.length > 1 && ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Button$1, {
|
15519
15676
|
className: "!justify-start",
|
15520
15677
|
appearance: "discrete",
|
@@ -16037,10 +16194,11 @@ function Control(props) {
|
|
16037
16194
|
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;
|
16038
16195
|
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;
|
16039
16196
|
React.useEffect(() => {
|
16040
|
-
|
16197
|
+
// 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
|
16198
|
+
if (controlRenderer === 'switch' && value === undefined) {
|
16041
16199
|
onChange(false);
|
16042
16200
|
}
|
16043
|
-
}, []);
|
16201
|
+
}, [controlRenderer]);
|
16044
16202
|
if (typeof controlRenderer === 'function') {
|
16045
16203
|
return /*#__PURE__*/React__default.cloneElement(controlRenderer({
|
16046
16204
|
...attributes,
|
@@ -16242,7 +16400,8 @@ function ManageFiltersPopover(props) {
|
|
16242
16400
|
if (f.value.comparator === exports.TableFilterComparator.IsEmpty || f.value.comparator === exports.TableFilterComparator.IsNotEmpty || controlRenderer === 'switch') {
|
16243
16401
|
return true;
|
16244
16402
|
}
|
16245
|
-
|
16403
|
+
const value = f.value.value;
|
16404
|
+
return value !== undefined && value !== null && value !== '';
|
16246
16405
|
});
|
16247
16406
|
return newFilters;
|
16248
16407
|
});
|
@@ -16287,12 +16446,12 @@ function ManageFiltersPopover(props) {
|
|
16287
16446
|
onClick: handleCreate
|
16288
16447
|
}, "+ ", texts.table.filters.buttons.addFilter))), /*#__PURE__*/React__default.createElement(Group, {
|
16289
16448
|
className: "ml-auto"
|
16290
|
-
}, /*#__PURE__*/React__default.createElement(Popover.Close, null, /*#__PURE__*/React__default.createElement(Button$1, null,
|
16449
|
+
}, /*#__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, {
|
16291
16450
|
onClick: handleClear
|
16292
|
-
},
|
16451
|
+
}, texts.table.filters.buttons.clear), /*#__PURE__*/React__default.createElement(Button$1, {
|
16293
16452
|
appearance: "primary",
|
16294
16453
|
onClick: handleApply
|
16295
|
-
},
|
16454
|
+
}, texts.table.filters.buttons.apply)))));
|
16296
16455
|
}
|
16297
16456
|
|
16298
16457
|
function Filters(props) {
|
@@ -16430,8 +16589,11 @@ function TableGrid(props) {
|
|
16430
16589
|
table: table.instance,
|
16431
16590
|
tableElement: table.ref.current,
|
16432
16591
|
scrollToIndex: table.renderer.scrollToIndex,
|
16433
|
-
style:
|
16434
|
-
|
16592
|
+
style: props.children ? {
|
16593
|
+
...table.renderer.style,
|
16594
|
+
height: table.renderer.style.height + 41
|
16595
|
+
} : table.renderer.style
|
16596
|
+
}, table.renderer.rows, props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
|
16435
16597
|
table: table.instance
|
16436
16598
|
}) : null)) : ( /*#__PURE__*/React__default.createElement(EmptyStateBody, {
|
16437
16599
|
emptyState: table.props.emptyState
|
@@ -18058,6 +18220,25 @@ function willRowMoveAfterSorting(cell, change, rowIndex) {
|
|
18058
18220
|
}
|
18059
18221
|
return ((_resortedRows$index = resortedRows[index]) === null || _resortedRows$index === void 0 ? void 0 : _resortedRows$index.id) !== cell.row.id;
|
18060
18222
|
}
|
18223
|
+
function animateCreateRow(id) {
|
18224
|
+
const templateRow = document.querySelector(`[data-row-id="${id}"]`);
|
18225
|
+
if (templateRow) {
|
18226
|
+
var _templateRow$querySel;
|
18227
|
+
(_templateRow$querySel = templateRow.querySelector(':first-child')) === null || _templateRow$querySel === void 0 ? void 0 : _templateRow$querySel.focus();
|
18228
|
+
templateRow.scrollIntoView();
|
18229
|
+
const keyframes = [{
|
18230
|
+
background: '#b2c7ef'
|
18231
|
+
}, {
|
18232
|
+
background: '#ebebeb'
|
18233
|
+
}];
|
18234
|
+
for (const child of templateRow.children) {
|
18235
|
+
child.animate(keyframes, {
|
18236
|
+
duration: 1000,
|
18237
|
+
easing: 'ease-out'
|
18238
|
+
});
|
18239
|
+
}
|
18240
|
+
}
|
18241
|
+
}
|
18061
18242
|
|
18062
18243
|
function useTableEditing(isEnabled = false, handleSave, validator) {
|
18063
18244
|
// used to switch the table into editing mode
|
@@ -18092,6 +18273,7 @@ function useTableEditing(isEnabled = false, handleSave, validator) {
|
|
18092
18273
|
function usePendingChanges(isEnabled, handleSave, validator) {
|
18093
18274
|
const saveChanges = function (rowId = undefined) {
|
18094
18275
|
try {
|
18276
|
+
let _exit = false;
|
18095
18277
|
if (!handleSave) {
|
18096
18278
|
console.warn('Tried to save, but Table has no onSave handler');
|
18097
18279
|
return Promise.resolve();
|
@@ -18103,13 +18285,12 @@ function usePendingChanges(isEnabled, handleSave, validator) {
|
|
18103
18285
|
...pendingChanges
|
18104
18286
|
};
|
18105
18287
|
const changes = Object.keys(changesToSave);
|
18106
|
-
|
18107
|
-
changes.
|
18108
|
-
|
18109
|
-
let _exit = false;
|
18288
|
+
return Promise.resolve(function () {
|
18289
|
+
if (changes.length) {
|
18290
|
+
return _forOf(changes, function (rowId) {
|
18110
18291
|
const pendingChange = changesToSave[rowId];
|
18111
18292
|
const changeSet = getChangesetFromChanges(pendingChange);
|
18112
|
-
return
|
18293
|
+
return _catch(function () {
|
18113
18294
|
function _temp3(_result) {
|
18114
18295
|
return _exit ? _result : Promise.resolve(handleSave(changeSet)).then(function () {
|
18115
18296
|
// cleanup changes, we don't need them after saving
|
@@ -18117,6 +18298,10 @@ function usePendingChanges(isEnabled, handleSave, validator) {
|
|
18117
18298
|
setRowSaveStatus(rowId, 'complete');
|
18118
18299
|
});
|
18119
18300
|
}
|
18301
|
+
if (getRowSaveStatus(rowId) === 'pending') {
|
18302
|
+
_exit = true;
|
18303
|
+
return;
|
18304
|
+
}
|
18120
18305
|
// set saving = true
|
18121
18306
|
setRowSaveStatus(rowId, 'pending');
|
18122
18307
|
// re-run validation, maybe a cell is already invalid but has never been blurred
|
@@ -18163,13 +18348,12 @@ function usePendingChanges(isEnabled, handleSave, validator) {
|
|
18163
18348
|
});
|
18164
18349
|
}
|
18165
18350
|
setRowSaveStatus(rowId, undefined);
|
18166
|
-
})
|
18167
|
-
}
|
18168
|
-
return
|
18169
|
-
}
|
18170
|
-
}
|
18171
|
-
}
|
18172
|
-
return Promise.resolve();
|
18351
|
+
});
|
18352
|
+
}, function () {
|
18353
|
+
return _exit;
|
18354
|
+
});
|
18355
|
+
}
|
18356
|
+
}());
|
18173
18357
|
} catch (e) {
|
18174
18358
|
return Promise.reject(e);
|
18175
18359
|
}
|
@@ -18206,6 +18390,40 @@ function usePendingChanges(isEnabled, handleSave, validator) {
|
|
18206
18390
|
return Promise.reject(e);
|
18207
18391
|
}
|
18208
18392
|
};
|
18393
|
+
const addCreatedRowChangeset = function (row) {
|
18394
|
+
try {
|
18395
|
+
const cells = row.getAllCells();
|
18396
|
+
setPendingChanges(currentChanges => {
|
18397
|
+
return cells.reduce((changes, cell) => {
|
18398
|
+
if (cell.getValue()) {
|
18399
|
+
var _currentChanges$cell$4, _currentChanges$cell$5, _currentChanges$cell$6;
|
18400
|
+
return {
|
18401
|
+
...changes,
|
18402
|
+
[cell.row.id]: {
|
18403
|
+
...changes[cell.row.id],
|
18404
|
+
[cell.column.id]: cell.getValue(),
|
18405
|
+
_meta: {
|
18406
|
+
...((_currentChanges$cell$4 = currentChanges[cell.row.id]) === null || _currentChanges$cell$4 === void 0 ? void 0 : _currentChanges$cell$4._meta),
|
18407
|
+
original: cell.row.original,
|
18408
|
+
moveReason: {
|
18409
|
+
...((_currentChanges$cell$5 = currentChanges[cell.row.id]) === null || _currentChanges$cell$5 === void 0 ? void 0 : _currentChanges$cell$5._meta.moveReason)
|
18410
|
+
},
|
18411
|
+
errors: {
|
18412
|
+
...((_currentChanges$cell$6 = currentChanges[cell.row.id]) === null || _currentChanges$cell$6 === void 0 ? void 0 : _currentChanges$cell$6._meta.errors)
|
18413
|
+
}
|
18414
|
+
}
|
18415
|
+
}
|
18416
|
+
};
|
18417
|
+
} else {
|
18418
|
+
return changes;
|
18419
|
+
}
|
18420
|
+
}, currentChanges);
|
18421
|
+
});
|
18422
|
+
return Promise.resolve();
|
18423
|
+
} catch (e) {
|
18424
|
+
return Promise.reject(e);
|
18425
|
+
}
|
18426
|
+
};
|
18209
18427
|
const [pendingChanges, setPendingChanges] = React__default.useState({});
|
18210
18428
|
// we maintain save status as separate state because 'complete' needs to briefly show after pendingChanges are deleted
|
18211
18429
|
const [saveStates, setSaveState] = React__default.useState({});
|
@@ -18332,8 +18550,8 @@ function usePendingChanges(isEnabled, handleSave, validator) {
|
|
18332
18550
|
return Object.keys(getErrors().filter(error => {
|
18333
18551
|
var _activeRow;
|
18334
18552
|
if ((_activeRow = activeRow) !== null && _activeRow !== void 0 && _activeRow.id && focusIsInsideTable) {
|
18335
|
-
var _activeRow2
|
18336
|
-
return error.rowId === ((_activeRow2 = activeRow) === null || _activeRow2 === void 0 ? void 0 : _activeRow2.id) ? error.pendingChange._meta.errors
|
18553
|
+
var _activeRow2, _error$pendingChange$;
|
18554
|
+
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;
|
18337
18555
|
}
|
18338
18556
|
return true;
|
18339
18557
|
})).length;
|
@@ -18358,6 +18576,7 @@ function usePendingChanges(isEnabled, handleSave, validator) {
|
|
18358
18576
|
getCellError,
|
18359
18577
|
setCellValue,
|
18360
18578
|
validateCell,
|
18579
|
+
addCreatedRowChangeset,
|
18361
18580
|
hasChanges,
|
18362
18581
|
hasErrors,
|
18363
18582
|
getErrors,
|
@@ -18583,10 +18802,11 @@ function useEditingCellAutofocus(props) {
|
|
18583
18802
|
// focus the cell so that we trigger it's handle focus
|
18584
18803
|
React__default.useEffect(() => {
|
18585
18804
|
if (props.cellRef.current) {
|
18586
|
-
var _props$cellRef$curren, _document$activeEleme;
|
18805
|
+
var _props$cellRef$curren, _document$activeEleme, _document$activeEleme2;
|
18587
18806
|
const isFocusedElementInCurrentRow = (_props$cellRef$curren = props.cellRef.current.closest('tr')) === null || _props$cellRef$curren === void 0 ? void 0 : _props$cellRef$curren.contains(document.activeElement);
|
18588
18807
|
const isFocusedElementSearch = ((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.getAttribute('name')) === 'table-search';
|
18589
|
-
|
18808
|
+
const isFocusedElementMenu = ((_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === void 0 ? void 0 : _document$activeEleme2.getAttribute('role')) === 'menu';
|
18809
|
+
if (autoFocus && !isFocusedElementInCurrentRow && !isFocusedElementSearch && !isFocusedElementMenu) {
|
18590
18810
|
var _props$cellRef$curren2;
|
18591
18811
|
(_props$cellRef$curren2 = props.cellRef.current) === null || _props$cellRef$curren2 === void 0 ? void 0 : _props$cellRef$curren2.focus();
|
18592
18812
|
}
|
@@ -19002,6 +19222,7 @@ const RENDERERS$1 = {
|
|
19002
19222
|
};
|
19003
19223
|
function useTable3(props, ref) {
|
19004
19224
|
const editing = useTableEditing(props.enableEditing, props.onSave, props.validator);
|
19225
|
+
const creationEnabled = editing.isEnabled && !!props.enableCreation;
|
19005
19226
|
const extendedProps = {
|
19006
19227
|
...props,
|
19007
19228
|
enableRowActions: editing.isEditing ? true : props.enableRowActions,
|
@@ -19011,7 +19232,7 @@ function useTable3(props, ref) {
|
|
19011
19232
|
onClear: () => editing.resetChanges(rowId),
|
19012
19233
|
onSave: () => editing.saveChanges(rowId),
|
19013
19234
|
onExit: () => editing.toggleEditing(false),
|
19014
|
-
isLastRow: table.meta.rowActive.rowActiveIndex === table.meta.length - 1
|
19235
|
+
isLastRow: !creationEnabled && table.meta.rowActive.rowActiveIndex === table.meta.length - 1
|
19015
19236
|
}))] : props.rowActions
|
19016
19237
|
};
|
19017
19238
|
const meta = {
|
@@ -19157,6 +19378,89 @@ function FilterResetDialog(props) {
|
|
19157
19378
|
}, texts.table3.editing.validation.resetFiltersDialog.confirm)))));
|
19158
19379
|
}
|
19159
19380
|
|
19381
|
+
function CreateNewRowButton(props) {
|
19382
|
+
const {
|
19383
|
+
onCreate,
|
19384
|
+
scrollToIndex,
|
19385
|
+
table,
|
19386
|
+
tableMeta
|
19387
|
+
} = props;
|
19388
|
+
const {
|
19389
|
+
texts
|
19390
|
+
} = useLocalization();
|
19391
|
+
const rows = table.getCoreRowModel().rows;
|
19392
|
+
const [rowCreated, setRowCreated] = React__default.useState({
|
19393
|
+
rowFinder: undefined
|
19394
|
+
});
|
19395
|
+
const handleKeyDown = event => {
|
19396
|
+
if (!tableMeta.editing.hasChanges() && event.key === 'Tab') {
|
19397
|
+
!tableMeta.editing.saveChanges();
|
19398
|
+
}
|
19399
|
+
};
|
19400
|
+
const handleCreate = function () {
|
19401
|
+
try {
|
19402
|
+
if (!onCreate) {
|
19403
|
+
return Promise.resolve();
|
19404
|
+
}
|
19405
|
+
const createdRow = rows.find(row => {
|
19406
|
+
var _rowCreated$rowFinder;
|
19407
|
+
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);
|
19408
|
+
});
|
19409
|
+
const _temp = function () {
|
19410
|
+
if (createdRow) {
|
19411
|
+
return Promise.resolve(tableMeta.editing.saveChanges()).then(function () {
|
19412
|
+
if (!tableMeta.editing.hasRowErrors(createdRow.id)) {
|
19413
|
+
const rowFinder = onCreate();
|
19414
|
+
setRowCreated({
|
19415
|
+
rowFinder
|
19416
|
+
});
|
19417
|
+
}
|
19418
|
+
});
|
19419
|
+
} else {
|
19420
|
+
const rowFinder = onCreate();
|
19421
|
+
setRowCreated({
|
19422
|
+
rowFinder
|
19423
|
+
});
|
19424
|
+
}
|
19425
|
+
}();
|
19426
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
19427
|
+
} catch (e) {
|
19428
|
+
return Promise.reject(e);
|
19429
|
+
}
|
19430
|
+
};
|
19431
|
+
React__default.useEffect(() => {
|
19432
|
+
if (typeof (rowCreated === null || rowCreated === void 0 ? void 0 : rowCreated.rowFinder) === 'function') {
|
19433
|
+
const createdRow = rows.find(row => {
|
19434
|
+
var _rowCreated$rowFinder2;
|
19435
|
+
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);
|
19436
|
+
});
|
19437
|
+
if (createdRow) {
|
19438
|
+
const rowInTable = table.getRowModel().rows.find(row => {
|
19439
|
+
var _rowCreated$rowFinder3;
|
19440
|
+
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);
|
19441
|
+
});
|
19442
|
+
if (rowInTable) {
|
19443
|
+
tableMeta.editing.toggleEditing(true);
|
19444
|
+
tableMeta.rowActive.setRowActiveIndex(createdRow.index);
|
19445
|
+
scrollToIndex(createdRow.index);
|
19446
|
+
requestAnimationFrame(() => animateCreateRow(createdRow.id));
|
19447
|
+
}
|
19448
|
+
requestAnimationFrame(() => tableMeta.editing.addCreatedRowChangeset(createdRow));
|
19449
|
+
}
|
19450
|
+
}
|
19451
|
+
}, [rowCreated]);
|
19452
|
+
return /*#__PURE__*/React__default.createElement("tr", {
|
19453
|
+
onClick: handleCreate,
|
19454
|
+
className: "border-grey-300 hover:bg-grey-100 group !sticky bottom-10 left-0 z-[21] !block cursor-pointer border-t"
|
19455
|
+
}, /*#__PURE__*/React__default.createElement("td", {
|
19456
|
+
className: "!border-t-0 !bg-transparent"
|
19457
|
+
}, /*#__PURE__*/React__default.createElement(Button$1, {
|
19458
|
+
onKeyDown: handleKeyDown,
|
19459
|
+
className: "group-hover:bg-grey-200 sticky left-0",
|
19460
|
+
appearance: "transparent"
|
19461
|
+
}, "+ ", texts.table3.editing.buttons.create.label)));
|
19462
|
+
}
|
19463
|
+
|
19160
19464
|
function Editing(props) {
|
19161
19465
|
const {
|
19162
19466
|
scrollToIndex,
|
@@ -19213,6 +19517,7 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
|
|
19213
19517
|
enableHorizontalArrowKeyNavigation: table3.meta.editing.isEditing
|
19214
19518
|
};
|
19215
19519
|
const hasValidationErrors = table3.meta.editing.hasErrors(table3.instance, table3.ref);
|
19520
|
+
const showCreateRowButton = table3.meta.editing.isEnabled && props.enableCreation && props.onCreate;
|
19216
19521
|
return /*#__PURE__*/React__default.createElement(Table, null, /*#__PURE__*/React__default.createElement(Table.Toolbar, {
|
19217
19522
|
table: table3
|
19218
19523
|
}, table3.meta.editing.isEnabled ? ( /*#__PURE__*/React__default.createElement(Editing, {
|
@@ -19226,7 +19531,12 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
|
|
19226
19531
|
})) : null, /*#__PURE__*/React__default.createElement(Table.Grid, Object.assign({}, gridAttributes, {
|
19227
19532
|
"data-taco": "table3",
|
19228
19533
|
table: table3
|
19229
|
-
})
|
19534
|
+
}), showCreateRowButton && ( /*#__PURE__*/React__default.createElement(CreateNewRowButton, {
|
19535
|
+
table: table3.instance,
|
19536
|
+
tableMeta: table3.meta,
|
19537
|
+
onCreate: props.onCreate,
|
19538
|
+
scrollToIndex: table3.renderer.scrollToIndex
|
19539
|
+
}))));
|
19230
19540
|
});
|
19231
19541
|
const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
19232
19542
|
const stringifiedChildren = String(props.children);
|