@economic/taco 2.5.0 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Icon/components/AttachWarning.d.ts +3 -0
- package/dist/components/Icon/components/ChartArea.d.ts +3 -0
- package/dist/components/Icon/components/ChartBar.d.ts +3 -0
- package/dist/components/Icon/components/ChartLine.d.ts +3 -0
- package/dist/components/Icon/components/ChartPie.d.ts +3 -0
- package/dist/components/Icon/components/ChartTable.d.ts +3 -0
- package/dist/components/Icon/components/index.d.ts +1 -1
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Menu/components/Item.d.ts +1 -1
- package/dist/components/Menu/components/Link.d.ts +1 -1
- package/dist/components/Navigation2/components/Link.d.ts +1 -1
- package/dist/components/Select2/components/Option.d.ts +1 -1
- package/dist/components/Select2/components/Search.d.ts +1 -1
- package/dist/components/Select2/components/Trigger.d.ts +1 -1
- package/dist/components/Table3/components/columns/cell/EditingCell.d.ts +5 -2
- package/dist/components/Table3/components/columns/cell/EditingControl.d.ts +21 -0
- package/dist/components/Table3/components/columns/cell/controls/TextAreaControl.d.ts +2 -0
- package/dist/components/Tag/Tag.d.ts +1 -1
- package/dist/esm/index.css +85 -22
- package/dist/esm/packages/taco/src/components/Icon/components/AttachWarning.js +19 -0
- package/dist/esm/packages/taco/src/components/Icon/components/AttachWarning.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/ChartArea.js +19 -0
- package/dist/esm/packages/taco/src/components/Icon/components/ChartArea.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/ChartBar.js +19 -0
- package/dist/esm/packages/taco/src/components/Icon/components/ChartBar.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/ChartLine.js +19 -0
- package/dist/esm/packages/taco/src/components/Icon/components/ChartLine.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/ChartPie.js +17 -0
- package/dist/esm/packages/taco/src/components/Icon/components/ChartPie.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/ChartTable.js +19 -0
- package/dist/esm/packages/taco/src/components/Icon/components/ChartTable.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/index.js +12 -0
- package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table2/components/column/Cell.js +6 -1
- package/dist/esm/packages/taco/src/components/Table2/components/column/Cell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +10 -3
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +27 -145
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +158 -0
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextAreaControl.js +102 -0
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextAreaControl.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Drag.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Drag.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +3 -3
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js +0 -5
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +4 -2
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useColumnFreezing.js +14 -5
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useColumnFreezing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSettings.js +4 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSettings.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js +82 -78
- package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useCssGrid.js +2 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/useCssGrid.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useLocalStorage.js +11 -1
- package/dist/esm/packages/taco/src/hooks/useLocalStorage.js.map +1 -1
- package/dist/esm/packages/taco/src/index.js +1 -1
- package/dist/hooks/useLocalStorage.d.ts +1 -1
- package/dist/index.css +85 -22
- package/dist/primitives/Listbox2/components/Root.d.ts +1 -1
- package/dist/primitives/Listbox2/types.d.ts +1 -1
- package/dist/taco.cjs.development.js +513 -257
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +2 -2
- package/types.json +25442 -12989
@@ -318,6 +318,21 @@ function IconAttachCancel(props, svgRef) {
|
|
318
318
|
}
|
319
319
|
var AttachCancel = /*#__PURE__*/React.forwardRef(IconAttachCancel);
|
320
320
|
|
321
|
+
function IconAttachWarning(props, svgRef) {
|
322
|
+
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
323
|
+
fill: "none",
|
324
|
+
xmlns: "http://www.w3.org/2000/svg",
|
325
|
+
viewBox: "0 0 24 24",
|
326
|
+
ref: svgRef
|
327
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
328
|
+
fillRule: "evenodd",
|
329
|
+
clipRule: "evenodd",
|
330
|
+
d: "M12.38 3.688a3.75 3.75 0 015.44 5.16l-.137.144-9.132 9.131a2.25 2.25 0 01-3.287-3.069l.105-.113 6.657-6.656a.75.75 0 011.128.983l-.068.077-6.656 6.657a.75.75 0 00.984 1.128l.076-.067 9.132-9.132a2.25 2.25 0 00-3.07-3.287l-.112.105-9.132 9.132a3.75 3.75 0 005.16 5.44l.144-.137 1.934-1.935a6.062 6.062 0 00.09 2.031l-.964.965a5.25 5.25 0 01-7.574-7.269l.15-.156 9.131-9.132zM22 18a4.5 4.5 0 10-9 0 4.5 4.5 0 009 0zm-5.243-2.852a.75.75 0 011.493.102v3.5l-.007.102a.75.75 0 01-1.493-.102v-3.5l.007-.102zM17.5 20a.75.75 0 100 1.5.75.75 0 000-1.5z",
|
331
|
+
fill: "currentColor"
|
332
|
+
}));
|
333
|
+
}
|
334
|
+
var AttachWarning = /*#__PURE__*/React.forwardRef(IconAttachWarning);
|
335
|
+
|
321
336
|
function IconAttach(props, svgRef) {
|
322
337
|
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
323
338
|
xmlns: "http://www.w3.org/2000/svg",
|
@@ -473,6 +488,79 @@ function IconCashReports(props, svgRef) {
|
|
473
488
|
}
|
474
489
|
var CashReports = /*#__PURE__*/React.forwardRef(IconCashReports);
|
475
490
|
|
491
|
+
function IconChartArea(props, svgRef) {
|
492
|
+
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
493
|
+
fill: "none",
|
494
|
+
xmlns: "http://www.w3.org/2000/svg",
|
495
|
+
viewBox: "0 0 24 24",
|
496
|
+
ref: svgRef
|
497
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
498
|
+
fillRule: "evenodd",
|
499
|
+
clipRule: "evenodd",
|
500
|
+
d: "M3.5 4.75a.75.75 0 00-1.5 0v14.5c0 .414.336.75.75.75h18.5a.75.75 0 000-1.5h-1.5V6a.75.75 0 00-1.14-.64l-6.88 4.188-3.045-2.682a.75.75 0 00-.921-.055L3.5 9.745V4.75zm0 6.816V18.5h14.75V7.335l-6.211 3.782a.75.75 0 01-.886-.078l-3.02-2.66L3.5 11.565z",
|
501
|
+
fill: "currentColor"
|
502
|
+
}));
|
503
|
+
}
|
504
|
+
var ChartArea = /*#__PURE__*/React.forwardRef(IconChartArea);
|
505
|
+
|
506
|
+
function IconChartBar(props, svgRef) {
|
507
|
+
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
508
|
+
fill: "none",
|
509
|
+
xmlns: "http://www.w3.org/2000/svg",
|
510
|
+
viewBox: "0 0 24 24",
|
511
|
+
ref: svgRef
|
512
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
513
|
+
fillRule: "evenodd",
|
514
|
+
clipRule: "evenodd",
|
515
|
+
d: "M11 17.75A1.75 1.75 0 009.25 16h-4.5A1.75 1.75 0 003 17.75v1.5c0 .966.784 1.75 1.75 1.75h4.5A1.75 1.75 0 0011 19.25v-1.5zm6-6.5a1.75 1.75 0 00-1.75-1.75H4.75A1.75 1.75 0 003 11.25v1.5c0 .966.784 1.75 1.75 1.75h10.5A1.75 1.75 0 0017 12.75v-1.5zm4-6.5A1.75 1.75 0 0019.25 3H4.75A1.75 1.75 0 003 4.75v1.5C3 7.216 3.784 8 4.75 8h14.5A1.75 1.75 0 0021 6.25v-1.5zm-11.5 13v1.5a.25.25 0 01-.193.243l-.057.007h-4.5a.25.25 0 01-.243-.193L4.5 19.25v-1.5a.25.25 0 01.193-.243l.057-.007h4.5a.25.25 0 01.243.193l.007.057zm6-6.5v1.5a.25.25 0 01-.193.243L15.25 13H4.75a.25.25 0 01-.243-.193L4.5 12.75v-1.5a.25.25 0 01.193-.243L4.75 11h10.5a.25.25 0 01.243.193l.007.057zm4-6.5v1.5a.25.25 0 01-.193.243l-.057.007H4.75a.25.25 0 01-.243-.193L4.5 6.25v-1.5a.25.25 0 01.193-.243L4.75 4.5h14.5a.25.25 0 01.243.193l.007.057z",
|
516
|
+
fill: "currentColor"
|
517
|
+
}));
|
518
|
+
}
|
519
|
+
var ChartBar = /*#__PURE__*/React.forwardRef(IconChartBar);
|
520
|
+
|
521
|
+
function IconChartLine(props, svgRef) {
|
522
|
+
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
523
|
+
fill: "none",
|
524
|
+
xmlns: "http://www.w3.org/2000/svg",
|
525
|
+
viewBox: "0 0 24 24",
|
526
|
+
ref: svgRef
|
527
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
528
|
+
fillRule: "evenodd",
|
529
|
+
clipRule: "evenodd",
|
530
|
+
d: "M3.5 4.75a.75.75 0 00-1.5 0v14.5c0 .414.336.75.75.75h18.5a.75.75 0 000-1.5H3.5V4.75zm18.06 2.53a.75.75 0 10-1.06-1.06l-5.97 5.97-3.47-3.47a.75.75 0 00-1.06 0l-4.47 4.47a.75.75 0 001.061 1.06l3.94-3.94L14 13.78a.75.75 0 001.06 0l6.5-6.5z",
|
531
|
+
fill: "currentColor"
|
532
|
+
}));
|
533
|
+
}
|
534
|
+
var ChartLine = /*#__PURE__*/React.forwardRef(IconChartLine);
|
535
|
+
|
536
|
+
function IconChartPie(props, svgRef) {
|
537
|
+
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
538
|
+
fill: "none",
|
539
|
+
xmlns: "http://www.w3.org/2000/svg",
|
540
|
+
viewBox: "0 0 24 24",
|
541
|
+
ref: svgRef
|
542
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
543
|
+
d: "M10.25 4.25A.75.75 0 0111 5v8h8a.75.75 0 01.743.648l.007.102c0 4.97-4.03 8.5-9 8.5a9 9 0 01-9-9c0-4.97 3.53-9 8.5-9zM9.5 5.787l-.209.024c-3.69.47-6.041 3.622-6.041 7.439a7.5 7.5 0 007.5 7.5c3.817 0 6.968-2.352 7.44-6.041l.022-.209H10.25a.75.75 0 01-.743-.648L9.5 13.75V5.787zm3.75-4.037a9 9 0 019 9 .75.75 0 01-.75.75h-8.25a.75.75 0 01-.75-.75V2.5a.75.75 0 01.75-.75zM14 3.287V10h6.712l-.023-.209a7.504 7.504 0 00-6.48-6.48L14 3.287z",
|
544
|
+
fill: "currentColor"
|
545
|
+
}));
|
546
|
+
}
|
547
|
+
var ChartPie = /*#__PURE__*/React.forwardRef(IconChartPie);
|
548
|
+
|
549
|
+
function IconChartTable(props, svgRef) {
|
550
|
+
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
551
|
+
fill: "none",
|
552
|
+
xmlns: "http://www.w3.org/2000/svg",
|
553
|
+
viewBox: "0 0 24 24",
|
554
|
+
ref: svgRef
|
555
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
556
|
+
fillRule: "evenodd",
|
557
|
+
clipRule: "evenodd",
|
558
|
+
d: "M4.5 4.5h15v3.75h-15V4.5zM3 9.75V4.5A1.5 1.5 0 014.5 3h15A1.5 1.5 0 0121 4.5v15a1.5 1.5 0 01-1.5 1.5h-15A1.5 1.5 0 013 19.5V9.75zM4.5 14V9.75h4V14h-4zm0 1.5v4h4v-4h-4zm5.5 4h4v-4h-4v4zm5.5 0h4v-4h-4v4zm4-5.5V9.75h-4V14h4zM10 9.75h4V14h-4V9.75z",
|
559
|
+
fill: "currentColor"
|
560
|
+
}));
|
561
|
+
}
|
562
|
+
var ChartTable = /*#__PURE__*/React.forwardRef(IconChartTable);
|
563
|
+
|
476
564
|
function IconChatSolid(props, svgRef) {
|
477
565
|
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
478
566
|
xmlns: "http://www.w3.org/2000/svg",
|
@@ -3128,6 +3216,7 @@ const icons = {
|
|
3128
3216
|
'arrow-up': ArrowUp,
|
3129
3217
|
'attach-auto': AttachAuto,
|
3130
3218
|
'attach-cancel': AttachCancel,
|
3219
|
+
'attach-warning': AttachWarning,
|
3131
3220
|
attach: Attach,
|
3132
3221
|
'autotext-insert': AutotextInsert,
|
3133
3222
|
autotext: Autotext,
|
@@ -3140,6 +3229,11 @@ const icons = {
|
|
3140
3229
|
calendar: Calendar,
|
3141
3230
|
'cash-account': CashAccount,
|
3142
3231
|
'cash-reports': CashReports,
|
3232
|
+
'chart-area': ChartArea,
|
3233
|
+
'chart-bar': ChartBar,
|
3234
|
+
'chart-line': ChartLine,
|
3235
|
+
'chart-pie': ChartPie,
|
3236
|
+
'chart-table': ChartTable,
|
3143
3237
|
'chat-solid': ChatSolid,
|
3144
3238
|
chat: Chat,
|
3145
3239
|
'chevron-down-double': ChevronDownDouble,
|
@@ -9875,7 +9969,7 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
|
|
9875
9969
|
}, /*#__PURE__*/React__default.createElement("div", {
|
9876
9970
|
className: "flex flex-wrap gap-1"
|
9877
9971
|
}, valuesAsChildren.map(child => /*#__PURE__*/React__default.createElement(Tag$1, {
|
9878
|
-
key: child.props.value,
|
9972
|
+
key: String(child.props.value),
|
9879
9973
|
className: "truncate",
|
9880
9974
|
color: tags ? child.props.color : undefined,
|
9881
9975
|
disabled: disabled,
|
@@ -12992,9 +13086,14 @@ const Cell = function Cell(props) {
|
|
12992
13086
|
};
|
12993
13087
|
if (meta.editMode.onSave && hasCellControl && (canEditThisCell || isHoveringThisRowWhileEditing && isDataColumn)) {
|
12994
13088
|
attributes.onMouseDown = event => {
|
12995
|
-
handleMouseDown(event);
|
12996
13089
|
const target = event.target;
|
12997
13090
|
const isTargetInput = target !== null && target.nodeName === 'INPUT';
|
13091
|
+
// In Edit mode, If mouse click is happening outside of cell (in case of any dropdowns like date picker or select),
|
13092
|
+
// then it should not be processed as a click on a cell.
|
13093
|
+
if (!event.currentTarget.contains(target)) {
|
13094
|
+
return;
|
13095
|
+
}
|
13096
|
+
handleMouseDown(event);
|
12998
13097
|
// event.target?.select is only truthy for input elements
|
12999
13098
|
// if event.target is active element, then that means we should select the text
|
13000
13099
|
if (isTargetInput && target !== document.activeElement) {
|
@@ -16211,7 +16310,7 @@ const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(prop
|
|
16211
16310
|
className: className,
|
16212
16311
|
"data-align": align,
|
16213
16312
|
"data-column-index": index,
|
16214
|
-
role: "
|
16313
|
+
role: "columnheader"
|
16215
16314
|
}, typeof meta.footer === 'function' ? /*#__PURE__*/React__default.createElement("span", {
|
16216
16315
|
className: "flex-grow truncate"
|
16217
16316
|
}, meta.footer(table.getRowModel().rows.map(row => row.original[id]))) : null);
|
@@ -16257,7 +16356,7 @@ const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
|
|
16257
16356
|
const actionsOnRow = visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);
|
16258
16357
|
const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);
|
16259
16358
|
content = /*#__PURE__*/React__default.createElement("span", {
|
16260
|
-
className: "-mb-2 -mt-
|
16359
|
+
className: "-mb-2 -mt-1.5 flex justify-end pl-2 text-right",
|
16261
16360
|
ref: ref
|
16262
16361
|
}, actionsOnRow.map((button, index) => {
|
16263
16362
|
var _ref, _button$props$tooltip;
|
@@ -16307,7 +16406,7 @@ function createRowActionsColumn$1() {
|
|
16307
16406
|
footer: Footer$4,
|
16308
16407
|
meta: {
|
16309
16408
|
align: 'right',
|
16310
|
-
className: cn('!pt-[var(--table3-row-padding)] print:opacity-0 [[role="table"][data-editing="false"]_&]:group-[[data-current="true"]]/row:sticky [[role="table"][data-pause-hover="false"][data-editing="false"]_&]:group-hover/row:sticky right-0 !pl-1 !pr-1', '
|
16409
|
+
className: cn('!pt-[var(--table3-row-padding)] print:opacity-0 [[role="table"][data-editing="false"]_&]:group-[[data-current="true"]]/row:sticky [[role="table"][data-pause-hover="false"][data-editing="false"]_&]:group-hover/row:sticky right-0 !pl-1 !pr-1', 'shadow-[-6px_0px_6px_var(--table3-row-actions-shadow)]', 'group-[[data-current="true"][data-selected="false"]]/row:text-grey-200', 'group-[[data-selected="true"]]/row:text-blue-100', 'group-[[data-selected="false"]:hover]/row:text-grey-100'),
|
16311
16410
|
enableOrdering: false,
|
16312
16411
|
enableSearch: false,
|
16313
16412
|
enableTruncate: false,
|
@@ -16401,6 +16500,8 @@ const useCssGrid = table => {
|
|
16401
16500
|
if (column.id === COLUMN_ID) {
|
16402
16501
|
size = 'minmax(max-content, auto)';
|
16403
16502
|
} else {
|
16503
|
+
// getSize method is used instead of columnSizing state because columnSizing state doesn't have
|
16504
|
+
// sizes of internal columns.
|
16404
16505
|
size = `${column.getSize()}px`;
|
16405
16506
|
}
|
16406
16507
|
} else if (width !== undefined) {
|
@@ -16909,17 +17010,26 @@ function useColumnFreezingStyle(tableId, table) {
|
|
16909
17010
|
columnVisibility
|
16910
17011
|
} = table.getState();
|
16911
17012
|
const tableMeta = table.options.meta;
|
16912
|
-
const frozenColumnIndex =
|
17013
|
+
const frozenColumnIndex =
|
17014
|
+
// If column freezing is not enabled then only internal frozen column should be frozen.
|
17015
|
+
(tableMeta.columnFreezing.isEnabled ? (_tableMeta$columnFree = tableMeta.columnFreezing.frozenColumnIndex) !== null && _tableMeta$columnFree !== void 0 ? _tableMeta$columnFree : -1 : -1) + tableMeta.columnFreezing.frozenInternalColumnCount;
|
16913
17016
|
const style = React__default.useMemo(() => {
|
16914
17017
|
if (tableMeta.columnFreezing.frozenInternalColumnCount > 0 || tableMeta.columnFreezing.isEnabled && frozenColumnIndex !== undefined) {
|
16915
|
-
|
17018
|
+
var _visibleFrozenColumns;
|
17019
|
+
const visibleFrozenColumns = table.getVisibleLeafColumns().slice(0, frozenColumnIndex + 1);
|
16916
17020
|
// if all frozen columns haven't had their size set yet, then abort
|
16917
|
-
if (visibleFrozenColumns.every(
|
17021
|
+
if (visibleFrozenColumns.every(column => columnSizing[column.id] === undefined)) {
|
16918
17022
|
return undefined;
|
16919
17023
|
}
|
16920
17024
|
const offsets = {};
|
16921
|
-
visibleFrozenColumns.reduce((offset,
|
17025
|
+
visibleFrozenColumns.reduce((offset, column) => {
|
17026
|
+
const columnId = column.id;
|
16922
17027
|
offsets[columnId] = offset;
|
17028
|
+
if (isInternalColumn$1(columnId)) {
|
17029
|
+
// getSize method is used instead of columnSizing state because columnSizing state doesn't have
|
17030
|
+
// sizes of internal columns.
|
17031
|
+
return offset + column.getSize();
|
17032
|
+
}
|
16923
17033
|
return offset + columnSizing[columnId];
|
16924
17034
|
}, 0);
|
16925
17035
|
const styles = [Object.values(offsets).map((offset, index) => `#${tableId} [role="row"] > :nth-child(${index + 1}) { left: ${offset}px }`).join('\n'), `#${tableId} [role="row"] > :not(:nth-child(n+${frozenColumnIndex + 2})) {
|
@@ -16928,7 +17038,7 @@ function useColumnFreezingStyle(tableId, table) {
|
|
16928
17038
|
}`, `#${tableId}[data-horizontally-scrolled="true"] [role="row"] > :nth-child(${frozenColumnIndex + 1}) {
|
16929
17039
|
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), 6px 0px 6px rgb(0 0 0/8%), 1px 0px 0px #DDDDDD;
|
16930
17040
|
}`];
|
16931
|
-
const columnId = visibleFrozenColumns[frozenColumnIndex];
|
17041
|
+
const columnId = (_visibleFrozenColumns = visibleFrozenColumns[frozenColumnIndex]) === null || _visibleFrozenColumns === void 0 ? void 0 : _visibleFrozenColumns.id;
|
16932
17042
|
// frozenColumnIndex could not be in the visible frozen column so it is important to check if columnId
|
16933
17043
|
// exists before checking if it is internal.
|
16934
17044
|
//
|
@@ -17435,121 +17545,133 @@ const willRowMoveAfterSorting$1 = (value, cell, rowIndex, rows, desc) => {
|
|
17435
17545
|
return ((_resortedRows$index = resortedRows[index]) === null || _resortedRows$index === void 0 ? void 0 : _resortedRows$index.id) !== cell.row.id;
|
17436
17546
|
};
|
17437
17547
|
|
17438
|
-
function
|
17439
|
-
return /*#__PURE__*/React__default.createElement(MemoedEditingCell, Object.assign({}, props));
|
17440
|
-
}
|
17441
|
-
const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditingCell(props) {
|
17442
|
-
var _tableMeta$editing$ge, _tableMeta$editing$ro, _rows$tableMeta$curre;
|
17548
|
+
const Textarea = /*#__PURE__*/React.forwardRef(function Textarea(props, ref) {
|
17443
17549
|
const {
|
17444
|
-
|
17550
|
+
defaultValue: _,
|
17551
|
+
highlighted,
|
17552
|
+
invalid,
|
17553
|
+
onKeyDown,
|
17554
|
+
...otherProps
|
17555
|
+
} = props;
|
17556
|
+
const classNames = cn(getInputClasses(props), 'py-1 min-h-[75px] disabled:resize-none', props.className);
|
17557
|
+
// home and end keys only navigate to the start/end of textarea value if the textarea container does not scroll
|
17558
|
+
// if it has scroll height then the browser reverts to native scrolling behaviour only
|
17559
|
+
// so we manually override it to ensure _our_ desired behaviour remains intact
|
17560
|
+
const handleKeyDown = event => {
|
17561
|
+
if (event.key === 'Home' || event.key === 'End') {
|
17562
|
+
event.preventDefault();
|
17563
|
+
const position = event.key === 'End' ? event.currentTarget.value.length : 0;
|
17564
|
+
event.currentTarget.setSelectionRange(position, position);
|
17565
|
+
event.currentTarget.scrollTop = event.key === 'End' ? event.currentTarget.scrollHeight : 0;
|
17566
|
+
}
|
17567
|
+
if (onKeyDown) {
|
17568
|
+
onKeyDown(event);
|
17569
|
+
}
|
17570
|
+
};
|
17571
|
+
return /*#__PURE__*/React.createElement("textarea", Object.assign({}, otherProps, {
|
17572
|
+
className: classNames,
|
17573
|
+
"data-taco": "textarea",
|
17574
|
+
onKeyDown: handleKeyDown,
|
17575
|
+
ref: ref
|
17576
|
+
}));
|
17577
|
+
});
|
17578
|
+
|
17579
|
+
const TextAreaControl = /*#__PURE__*/React__default.forwardRef(function TextAreaControl(props, externalRef) {
|
17580
|
+
const {
|
17581
|
+
onKeyDown: handleKeyDown,
|
17582
|
+
onChange: handleChange,
|
17445
17583
|
column,
|
17446
|
-
|
17447
|
-
|
17448
|
-
|
17449
|
-
|
17450
|
-
|
17584
|
+
isCellInDetailMode,
|
17585
|
+
align,
|
17586
|
+
isCurrentRow,
|
17587
|
+
value,
|
17588
|
+
...attributes
|
17451
17589
|
} = props;
|
17452
|
-
const
|
17590
|
+
const textareaMaxHeight = 120;
|
17591
|
+
const textareaMinHeight = 32;
|
17453
17592
|
const columnMeta = column.columnDef.meta;
|
17454
|
-
const
|
17455
|
-
|
17456
|
-
|
17457
|
-
|
17458
|
-
|
17459
|
-
|
17460
|
-
|
17461
|
-
|
17462
|
-
|
17463
|
-
|
17464
|
-
|
17465
|
-
|
17466
|
-
const
|
17467
|
-
|
17468
|
-
|
17469
|
-
|
17470
|
-
|
17471
|
-
const pinnedColumnsWidth = lastFrozenRect.left + lastFrozenRect.width;
|
17472
|
-
tableElement.scrollTo(cellRect.left - pinnedColumnsWidth, tableElement.scrollTop);
|
17473
|
-
// Check for editing actions overlap
|
17474
|
-
} else if (cellRect && tableRect && cellRect.right > tableRect.right - EDITING_ACTIONS_WIDTH) {
|
17475
|
-
const spaceBetweenCellAndEditingActions = 10;
|
17476
|
-
tableElement.scrollTo(
|
17477
|
-
// Need to take into account if table has been already scrolled.
|
17478
|
-
tableElement.scrollLeft + EDITING_ACTIONS_WIDTH + spaceBetweenCellAndEditingActions, tableElement.scrollTop);
|
17593
|
+
const ref = useMergedRef(externalRef);
|
17594
|
+
React__default.useEffect(() => {
|
17595
|
+
// If truncation is not enabled, then textarea should re-calculate it's height to fit with it's own content, when initialized.
|
17596
|
+
if (ref !== null && ref !== void 0 && ref.current && !(columnMeta !== null && columnMeta !== void 0 && columnMeta.enableTruncate)) {
|
17597
|
+
const textareaElement = ref === null || ref === void 0 ? void 0 : ref.current;
|
17598
|
+
resizeTextArea(textareaElement);
|
17599
|
+
}
|
17600
|
+
}, []);
|
17601
|
+
React__default.useEffect(() => {
|
17602
|
+
// If truncation is enabled, then textarea should only adjust to it's own content, when in detail mode.
|
17603
|
+
// Otherwise it should collapse to minimal height.
|
17604
|
+
if (ref !== null && ref !== void 0 && ref.current && columnMeta !== null && columnMeta !== void 0 && columnMeta.enableTruncate) {
|
17605
|
+
const textareaElement = ref === null || ref === void 0 ? void 0 : ref.current;
|
17606
|
+
if (isCellInDetailMode) {
|
17607
|
+
resizeTextArea(textareaElement);
|
17608
|
+
} else {
|
17609
|
+
textareaElement.style.height = `${textareaMinHeight}px`;
|
17479
17610
|
}
|
17480
17611
|
}
|
17481
|
-
|
17482
|
-
|
17483
|
-
|
17484
|
-
|
17612
|
+
}, [isCellInDetailMode]);
|
17613
|
+
const resizeTextArea = textareaElement => {
|
17614
|
+
// Need to set inherit before calculating height, so that browser sets the scrollHeight properly,
|
17615
|
+
// depending on text inside.
|
17616
|
+
const textareaRect = textareaElement.getBoundingClientRect();
|
17617
|
+
const prevHeight = textareaRect.height;
|
17618
|
+
if (columnMeta !== null && columnMeta !== void 0 && columnMeta.enableTruncate) {
|
17619
|
+
if (prevHeight < textareaMaxHeight) {
|
17620
|
+
textareaElement.style.height = 'inherit';
|
17621
|
+
textareaElement.style.height = `${Math.min(textareaElement.scrollHeight, textareaMaxHeight)}px`;
|
17622
|
+
}
|
17623
|
+
} else {
|
17624
|
+
textareaElement.style.height = 'inherit';
|
17625
|
+
textareaElement.style.height = `${textareaElement.scrollHeight}px`;
|
17485
17626
|
}
|
17486
17627
|
};
|
17487
|
-
const
|
17488
|
-
|
17489
|
-
};
|
17490
|
-
// row move indicator
|
17491
|
-
const moveReason = (_tableMeta$editing$ro = tableMeta.editing.rowMoveReason[cell.column.id]) !== null && _tableMeta$editing$ro !== void 0 ? _tableMeta$editing$ro : null;
|
17492
|
-
const rows = table.getRowModel().rows;
|
17493
|
-
const isCurrentRow = ((_rows$tableMeta$curre = rows[tableMeta.currentRow.currentRowIndex]) === null || _rows$tableMeta$curre === void 0 ? void 0 : _rows$tableMeta$curre.id) === row.id;
|
17494
|
-
const mountNode = React__default.useMemo(() => {
|
17495
|
-
if (moveReason) {
|
17496
|
-
var _cellRef$current2, _cellRef$current2$par;
|
17497
|
-
return (_cellRef$current2 = cellRef.current) === null || _cellRef$current2 === void 0 ? void 0 : (_cellRef$current2$par = _cellRef$current2.parentElement) === null || _cellRef$current2$par === void 0 ? void 0 : _cellRef$current2$par.firstChild;
|
17498
|
-
}
|
17499
|
-
return null;
|
17500
|
-
}, [moveReason, cellRef]);
|
17501
|
-
const removeMoveReason = () => {
|
17502
|
-
tableMeta.editing.removeRowMoveReason(cell.column.id);
|
17628
|
+
const handleTextareaChange = e => {
|
17629
|
+
resizeTextArea(e.target);
|
17503
17630
|
};
|
17504
|
-
|
17505
|
-
|
17506
|
-
|
17507
|
-
|
17631
|
+
const textareaContainerClassName = cn('w-full', {
|
17632
|
+
'focus-within:absolute focus-within:left-0 focus-within:top-0 focus-within:z-20 focus-within:px-2 focus-within:pt-[var(--table3-row-padding)]': columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.enableTruncate
|
17633
|
+
});
|
17634
|
+
const handleTextareaKeyDown = event => {
|
17635
|
+
// By default Shift + Enter in textarea makes a new line, we want to keep this behaviour
|
17636
|
+
if (event.shiftKey && event.key === 'Enter') {
|
17508
17637
|
return;
|
17509
|
-
}
|
17510
|
-
if (hasChanged$1(getValue(), value)) {
|
17511
|
-
const moveReason = getRowMoveReason(table, row.index, row.original, cell, value);
|
17512
|
-
tableMeta.editing.setRowMoveReason({
|
17513
|
-
[cell.column.id]: moveReason
|
17514
|
-
});
|
17515
17638
|
} else {
|
17516
|
-
|
17639
|
+
handleKeyDown(event);
|
17517
17640
|
}
|
17518
|
-
|
17519
|
-
|
17520
|
-
|
17521
|
-
|
17522
|
-
|
17523
|
-
|
17524
|
-
|
17525
|
-
|
17526
|
-
|
17527
|
-
|
17528
|
-
|
17529
|
-
|
17530
|
-
|
17531
|
-
|
17532
|
-
|
17533
|
-
|
17534
|
-
|
17535
|
-
|
17536
|
-
|
17537
|
-
|
17538
|
-
|
17539
|
-
|
17540
|
-
|
17541
|
-
|
17542
|
-
|
17543
|
-
|
17544
|
-
|
17545
|
-
|
17546
|
-
|
17547
|
-
value: value,
|
17548
|
-
cell: cell
|
17641
|
+
};
|
17642
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
17643
|
+
className: textareaContainerClassName,
|
17644
|
+
"data-taco": "input-container"
|
17645
|
+
}, /*#__PURE__*/React__default.createElement(Textarea, Object.assign({}, attributes, {
|
17646
|
+
onChange: event => {
|
17647
|
+
handleChange(event.target.value);
|
17648
|
+
handleTextareaChange(event);
|
17649
|
+
},
|
17650
|
+
rows: 1,
|
17651
|
+
onKeyDown: e => {
|
17652
|
+
handleTextareaKeyDown(e);
|
17653
|
+
},
|
17654
|
+
onBlur: event => {
|
17655
|
+
// If truncation is enabled, then textarea should shring back to min height, when loosing focus.
|
17656
|
+
if (columnMeta !== null && columnMeta !== void 0 && columnMeta.enableTruncate) {
|
17657
|
+
const textareaElement = event.currentTarget;
|
17658
|
+
textareaElement.style.height = `${textareaMinHeight}px`;
|
17659
|
+
}
|
17660
|
+
},
|
17661
|
+
className: cn(getCellAlignmentClasses$1(align), `z-20 h-fit resize-none`, {
|
17662
|
+
[`!min-h-[${textareaMinHeight}px]`]: columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.enableTruncate,
|
17663
|
+
'!yt-focus-dark': isCellInDetailMode,
|
17664
|
+
[`h-[${textareaMinHeight}px]`]: !isCellInDetailMode && (columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.enableTruncate),
|
17665
|
+
// Only allow resizing when focused and truncation enabled
|
17666
|
+
'focus:resize-y': isCurrentRow && (columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.enableTruncate)
|
17667
|
+
}),
|
17668
|
+
ref: ref,
|
17669
|
+
value: String(value !== null && value !== void 0 ? value : '')
|
17549
17670
|
})));
|
17550
17671
|
});
|
17551
|
-
|
17552
|
-
|
17672
|
+
|
17673
|
+
const EditingControl = /*#__PURE__*/React__default.forwardRef(function Control(props, externalRef) {
|
17674
|
+
var _ref$current;
|
17553
17675
|
const {
|
17554
17676
|
align,
|
17555
17677
|
column,
|
@@ -17560,11 +17682,16 @@ const Control = /*#__PURE__*/React__default.forwardRef(function Control(props, r
|
|
17560
17682
|
tableRef,
|
17561
17683
|
value,
|
17562
17684
|
cell,
|
17685
|
+
isCurrentRow,
|
17563
17686
|
...attributes
|
17564
17687
|
} = props;
|
17565
17688
|
const tableMeta = table.options.meta;
|
17566
|
-
const
|
17689
|
+
const ref = React__default.useRef();
|
17690
|
+
const refCallback = mergeRefs([ref, externalRef]);
|
17691
|
+
const columnMeta = column.columnDef.meta;
|
17692
|
+
const controlRenderer = columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.control;
|
17567
17693
|
const isCellInDetailMode = tableMeta.editing.detailModeEditing && (ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.contains(document.activeElement));
|
17694
|
+
// Revert to initial value if escape was pressed
|
17568
17695
|
const handleKeyDown = event => {
|
17569
17696
|
const target = event.target;
|
17570
17697
|
if (target.readOnly) {
|
@@ -17572,12 +17699,10 @@ const Control = /*#__PURE__*/React__default.forwardRef(function Control(props, r
|
|
17572
17699
|
}
|
17573
17700
|
// prevent row arrow shortcuts triggering when in detail mode
|
17574
17701
|
if (tableMeta.editing.detailModeEditing && (event.key === 'ArrowUp' || event.key === 'ArrowDown')) {
|
17575
|
-
event.preventDefault();
|
17576
17702
|
event.stopPropagation();
|
17577
17703
|
}
|
17578
17704
|
if (event.key === 'Escape') {
|
17579
17705
|
event.preventDefault();
|
17580
|
-
// Revert to initial value if escape was pressed in detail mode.
|
17581
17706
|
if (tableMeta.editing.detailModeEditing) {
|
17582
17707
|
tableMeta.editing.setDetailModeEditing(false);
|
17583
17708
|
if (value !== initialValue) {
|
@@ -17595,7 +17720,9 @@ const Control = /*#__PURE__*/React__default.forwardRef(function Control(props, r
|
|
17595
17720
|
}
|
17596
17721
|
}
|
17597
17722
|
} else {
|
17723
|
+
var _tableRef$current;
|
17598
17724
|
tableMeta.editing.toggleEditing(false);
|
17725
|
+
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.focus();
|
17599
17726
|
}
|
17600
17727
|
return;
|
17601
17728
|
}
|
@@ -17613,6 +17740,15 @@ const Control = /*#__PURE__*/React__default.forwardRef(function Control(props, r
|
|
17613
17740
|
return;
|
17614
17741
|
}
|
17615
17742
|
};
|
17743
|
+
const isNumber = typeof value === 'number';
|
17744
|
+
const handleInputKeyDown = event => {
|
17745
|
+
handleKeyDown(event);
|
17746
|
+
// Switching to editing mode, when key pressed any alphabetical character or number
|
17747
|
+
if (/^[a-z0-9]$/i.test(event.key)) {
|
17748
|
+
tableMeta.editing.setDetailModeEditing(true);
|
17749
|
+
return;
|
17750
|
+
}
|
17751
|
+
};
|
17616
17752
|
const handleDatepickerChange = event => {
|
17617
17753
|
// When datepicker looses focus, it triggers change event, even if date wasn't changed,
|
17618
17754
|
// so adding additional check here to prevent adding change to the edititng state.
|
@@ -17625,7 +17761,7 @@ const Control = /*#__PURE__*/React__default.forwardRef(function Control(props, r
|
|
17625
17761
|
if (typeof controlRenderer === 'function') {
|
17626
17762
|
return controlRenderer({
|
17627
17763
|
...attributes,
|
17628
|
-
ref,
|
17764
|
+
ref: ref,
|
17629
17765
|
setValue: nextValue => {
|
17630
17766
|
if (nextValue !== value) {
|
17631
17767
|
handleChange(nextValue);
|
@@ -17647,7 +17783,7 @@ const Control = /*#__PURE__*/React__default.forwardRef(function Control(props, r
|
|
17647
17783
|
}),
|
17648
17784
|
onChange: handleDatepickerChange,
|
17649
17785
|
onKeyDown: handleDatepickerKeyDown,
|
17650
|
-
ref:
|
17786
|
+
ref: refCallback,
|
17651
17787
|
value: value
|
17652
17788
|
}));
|
17653
17789
|
} else if (controlRenderer === 'switch') {
|
@@ -17655,18 +17791,15 @@ const Control = /*#__PURE__*/React__default.forwardRef(function Control(props, r
|
|
17655
17791
|
className: "mx-2 mt-1.5",
|
17656
17792
|
checked: Boolean(value),
|
17657
17793
|
onChange: handleChange,
|
17658
|
-
ref:
|
17794
|
+
ref: refCallback
|
17795
|
+
}));
|
17796
|
+
} else if (controlRenderer === 'textarea') {
|
17797
|
+
return /*#__PURE__*/React__default.createElement(TextAreaControl, Object.assign({}, props, {
|
17798
|
+
isCellInDetailMode: isCellInDetailMode,
|
17799
|
+
onKeyDown: handleInputKeyDown,
|
17800
|
+
ref: refCallback
|
17659
17801
|
}));
|
17660
17802
|
}
|
17661
|
-
const isNumber = typeof value === 'number';
|
17662
|
-
const handleInputKeyDown = event => {
|
17663
|
-
handleKeyDown(event);
|
17664
|
-
// Switching to editing mode, when key pressed any alphabetical character or number
|
17665
|
-
if (/^[a-z0-9]$/i.test(event.key)) {
|
17666
|
-
tableMeta.editing.setDetailModeEditing(true);
|
17667
|
-
return;
|
17668
|
-
}
|
17669
|
-
};
|
17670
17803
|
return /*#__PURE__*/React__default.createElement(Input, Object.assign({}, attributes, {
|
17671
17804
|
className: cn(getInputAppearanceClassnames(), getCellAlignmentClasses$1(align), {
|
17672
17805
|
'!yt-focus-dark': isCellInDetailMode
|
@@ -17675,11 +17808,143 @@ const Control = /*#__PURE__*/React__default.forwardRef(function Control(props, r
|
|
17675
17808
|
handleChange(event.target.value);
|
17676
17809
|
},
|
17677
17810
|
onKeyDown: handleInputKeyDown,
|
17678
|
-
ref:
|
17811
|
+
ref: refCallback,
|
17679
17812
|
type: isNumber ? 'number' : undefined,
|
17680
17813
|
value: isNumber ? value : String(value !== null && value !== void 0 ? value : '')
|
17681
17814
|
}));
|
17682
17815
|
});
|
17816
|
+
|
17817
|
+
function EditingCell$1(props) {
|
17818
|
+
const {
|
17819
|
+
isHovered
|
17820
|
+
} = useRowContext$1();
|
17821
|
+
// Need to explicitly pass tableMeta, because just passing the table object will not trigger editing change since table object is not mutatable.
|
17822
|
+
const tableMeta = props.table.options.meta;
|
17823
|
+
return /*#__PURE__*/React__default.createElement(MemoedEditingCell, Object.assign({}, props, {
|
17824
|
+
isHovered: isHovered,
|
17825
|
+
tableMeta: tableMeta
|
17826
|
+
}));
|
17827
|
+
}
|
17828
|
+
const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditingCell(props) {
|
17829
|
+
var _tableMeta$editing$ge, _tableMeta$editing$ro, _rows$tableMeta$curre, _column$columnDef$met;
|
17830
|
+
const {
|
17831
|
+
cell,
|
17832
|
+
column,
|
17833
|
+
index,
|
17834
|
+
getValue,
|
17835
|
+
table,
|
17836
|
+
tableRef,
|
17837
|
+
row,
|
17838
|
+
isHovered,
|
17839
|
+
tableMeta
|
17840
|
+
} = props;
|
17841
|
+
const columnMeta = column.columnDef.meta;
|
17842
|
+
const cellRef = React__default.useRef(null);
|
17843
|
+
const controlRef = React__default.useRef(null);
|
17844
|
+
const handleChange = value => tableMeta.editing.setCellValue(cell, value);
|
17845
|
+
const value = (_tableMeta$editing$ge = tableMeta.editing.getCellValue(cell)) !== null && _tableMeta$editing$ge !== void 0 ? _tableMeta$editing$ge : getValue();
|
17846
|
+
const handleFocus = event => {
|
17847
|
+
var _event$target;
|
17848
|
+
// Check if cell is hidden behind pinned columns or edititng actions, and scroll to it.
|
17849
|
+
const frozenColumnIndex = tableMeta.columnFreezing.frozenColumnIndex;
|
17850
|
+
const tableElement = tableRef.current;
|
17851
|
+
if (tableElement && frozenColumnIndex !== undefined && index > frozenColumnIndex) {
|
17852
|
+
var _cellRef$current;
|
17853
|
+
const lastFrozenColumnElement = getCurrentRowCellElement(frozenColumnIndex, tableElement);
|
17854
|
+
const cellRect = (_cellRef$current = cellRef.current) === null || _cellRef$current === void 0 ? void 0 : _cellRef$current.getBoundingClientRect();
|
17855
|
+
const lastFrozenRect = lastFrozenColumnElement === null || lastFrozenColumnElement === void 0 ? void 0 : lastFrozenColumnElement.getBoundingClientRect();
|
17856
|
+
const tableRect = tableElement.getBoundingClientRect();
|
17857
|
+
// Check for pinned columns overlap
|
17858
|
+
if (cellRect && lastFrozenRect && cellRect.left < lastFrozenRect.left + lastFrozenRect.width) {
|
17859
|
+
const pinnedColumnsWidth = lastFrozenRect.left + lastFrozenRect.width;
|
17860
|
+
tableElement.scrollTo(cellRect.left - pinnedColumnsWidth, tableElement.scrollTop);
|
17861
|
+
// Check for editing actions overlap
|
17862
|
+
} else if (cellRect && tableRect && cellRect.right > tableRect.right - EDITING_ACTIONS_WIDTH) {
|
17863
|
+
const spaceBetweenCellAndEditingActions = 10;
|
17864
|
+
tableElement.scrollTo(
|
17865
|
+
// Need to take into account if table has been already scrolled.
|
17866
|
+
tableElement.scrollLeft + EDITING_ACTIONS_WIDTH + spaceBetweenCellAndEditingActions, tableElement.scrollTop);
|
17867
|
+
}
|
17868
|
+
}
|
17869
|
+
if ((_event$target = event.target) !== null && _event$target !== void 0 && _event$target.select) {
|
17870
|
+
requestAnimationFrame(() => {
|
17871
|
+
event.target.select();
|
17872
|
+
});
|
17873
|
+
}
|
17874
|
+
};
|
17875
|
+
const handleBlur = () => {
|
17876
|
+
tableMeta.editing.setDetailModeEditing(false);
|
17877
|
+
};
|
17878
|
+
// row move indicator
|
17879
|
+
const moveReason = (_tableMeta$editing$ro = tableMeta.editing.rowMoveReason[cell.column.id]) !== null && _tableMeta$editing$ro !== void 0 ? _tableMeta$editing$ro : null;
|
17880
|
+
const rows = table.getRowModel().rows;
|
17881
|
+
const isCurrentRow = ((_rows$tableMeta$curre = rows[tableMeta.currentRow.currentRowIndex]) === null || _rows$tableMeta$curre === void 0 ? void 0 : _rows$tableMeta$curre.id) === row.id;
|
17882
|
+
const mountNode = React__default.useMemo(() => {
|
17883
|
+
if (moveReason) {
|
17884
|
+
var _cellRef$current2, _cellRef$current2$par;
|
17885
|
+
return (_cellRef$current2 = cellRef.current) === null || _cellRef$current2 === void 0 ? void 0 : (_cellRef$current2$par = _cellRef$current2.parentElement) === null || _cellRef$current2$par === void 0 ? void 0 : _cellRef$current2$par.firstChild;
|
17886
|
+
}
|
17887
|
+
return null;
|
17888
|
+
}, [moveReason, cellRef]);
|
17889
|
+
const removeMoveReason = () => {
|
17890
|
+
tableMeta.editing.removeRowMoveReason(cell.column.id);
|
17891
|
+
};
|
17892
|
+
React__default.useEffect(() => {
|
17893
|
+
// To avoid reseting move reason on another row hover,
|
17894
|
+
// we need to check for changes only if value got changed in the current row.
|
17895
|
+
if (!isCurrentRow) {
|
17896
|
+
return;
|
17897
|
+
}
|
17898
|
+
if (hasChanged$1(getValue(), value)) {
|
17899
|
+
const moveReason = getRowMoveReason(table, row.index, row.original, cell, value);
|
17900
|
+
tableMeta.editing.setRowMoveReason({
|
17901
|
+
[cell.column.id]: moveReason
|
17902
|
+
});
|
17903
|
+
} else {
|
17904
|
+
removeMoveReason();
|
17905
|
+
}
|
17906
|
+
return removeMoveReason;
|
17907
|
+
}, [value]);
|
17908
|
+
const controlRenderer = (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.control;
|
17909
|
+
const className = cn('!px-2 py-[var(--table3-row-padding)]', {
|
17910
|
+
relative: (isCurrentRow || isHovered) && controlRenderer === 'textarea',
|
17911
|
+
// Need to set higher z-index, so that the current row textarea (in expanded state) overlaps rows below
|
17912
|
+
'z-10': isCurrentRow,
|
17913
|
+
// When row is hovered and located below, then the hovered textarea overlaps the current row textarea(if the current row textarea is expanded to support multiple lines),
|
17914
|
+
// as result we need to set lower z-index for the hovered row -> cell.
|
17915
|
+
'z-0': isHovered
|
17916
|
+
},
|
17917
|
+
// component overrides - grayscale for editing hover
|
17918
|
+
'[[role="row"][data-current="false"]:hover_&>*]:!grayscale [[role="row"][data-current="false"]:hover_&_.bg-white]:!bg-grey-100',
|
17919
|
+
// we alias to any because className conflicts with the Table2 definition,
|
17920
|
+
// when Table2 is gone, remove this as any
|
17921
|
+
typeof columnMeta.className === 'function' ? columnMeta.className(row.original) : columnMeta.className);
|
17922
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, moveReason !== null && mountNode && /*#__PURE__*/React__default.createElement(Indicator$1, {
|
17923
|
+
reason: moveReason,
|
17924
|
+
columnName: String(cell.column.columnDef.header),
|
17925
|
+
mountNode: mountNode,
|
17926
|
+
validationErrors: []
|
17927
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
17928
|
+
className: className,
|
17929
|
+
"data-column-index": index,
|
17930
|
+
role: "cell",
|
17931
|
+
ref: cellRef
|
17932
|
+
}, /*#__PURE__*/React__default.createElement(EditingControl, {
|
17933
|
+
align: columnMeta.align,
|
17934
|
+
column: cell.column,
|
17935
|
+
data: cell.row.original,
|
17936
|
+
initialValue: getValue(),
|
17937
|
+
onBlur: handleBlur,
|
17938
|
+
onFocus: handleFocus,
|
17939
|
+
onChange: handleChange,
|
17940
|
+
ref: controlRef,
|
17941
|
+
table: table,
|
17942
|
+
tableRef: tableRef,
|
17943
|
+
value: value,
|
17944
|
+
cell: cell,
|
17945
|
+
isCurrentRow: isCurrentRow
|
17946
|
+
})));
|
17947
|
+
});
|
17683
17948
|
function getRowMoveReason(table, rowIndex, rowValues, cell, newValue) {
|
17684
17949
|
var _table$getState$sorti;
|
17685
17950
|
let rowMoveReason = null;
|
@@ -17816,7 +18081,7 @@ const Cell$4 = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
|
|
17816
18081
|
return newTableMeta.currentRow.currentRowIndex === oldTableMeta.currentRow.currentRowIndex && newProps.row.getIsSelected() !== oldProps.row.getIsSelected();
|
17817
18082
|
});
|
17818
18083
|
function createRowSelectionColumn$1(hasDrag, hasExpansion) {
|
17819
|
-
const size = hasDrag ? 22 :
|
18084
|
+
const size = hasDrag && hasExpansion ? 22 : 4;
|
17820
18085
|
return {
|
17821
18086
|
id: COLUMN_ID$2,
|
17822
18087
|
header: Header$3,
|
@@ -17826,7 +18091,7 @@ function createRowSelectionColumn$1(hasDrag, hasExpansion) {
|
|
17826
18091
|
align: 'center',
|
17827
18092
|
className: cn('!pt-[var(--table3-row-padding)] !justify-end !p-0', {
|
17828
18093
|
'!pr-0.5': hasExpansion,
|
17829
|
-
'!pr-
|
18094
|
+
'!pr-3': !hasExpansion
|
17830
18095
|
}),
|
17831
18096
|
enableOrdering: false,
|
17832
18097
|
enableSearch: false,
|
@@ -17834,7 +18099,7 @@ function createRowSelectionColumn$1(hasDrag, hasExpansion) {
|
|
17834
18099
|
header: '',
|
17835
18100
|
headerClassName: cn('items-center !justify-end !p-0', {
|
17836
18101
|
'!pr-0.5': hasExpansion,
|
17837
|
-
'!pr-
|
18102
|
+
'!pr-3': !hasExpansion
|
17838
18103
|
})
|
17839
18104
|
},
|
17840
18105
|
// options
|
@@ -18009,8 +18274,8 @@ function createRowDragColumn(onRowDrag) {
|
|
18009
18274
|
},
|
18010
18275
|
// options
|
18011
18276
|
enableResizing: false,
|
18012
|
-
size:
|
18013
|
-
minSize:
|
18277
|
+
size: 20,
|
18278
|
+
minSize: 20
|
18014
18279
|
};
|
18015
18280
|
}
|
18016
18281
|
|
@@ -18030,88 +18295,92 @@ function getSortingFn$1(dataType, customFnOrBuiltIn) {
|
|
18030
18295
|
return 'auto';
|
18031
18296
|
}
|
18032
18297
|
function useConvertChildrenToColumns(props, options, editing) {
|
18033
|
-
|
18034
|
-
|
18035
|
-
|
18036
|
-
|
18037
|
-
|
18038
|
-
|
18039
|
-
|
18040
|
-
|
18041
|
-
|
18042
|
-
|
18043
|
-
|
18044
|
-
|
18045
|
-
|
18046
|
-
|
18047
|
-
|
18048
|
-
|
18049
|
-
|
18050
|
-
|
18298
|
+
// It's important to memoise column definitions, because it prevents columns like "Drag column" to re-render on every state change,
|
18299
|
+
// and break dragging at the moment it happens.
|
18300
|
+
return React__default.useMemo(() => {
|
18301
|
+
var _props$actionsForRow;
|
18302
|
+
const columnHelper = reactTable$1.createColumnHelper();
|
18303
|
+
const columns = [];
|
18304
|
+
const defaultColumnSizing = {};
|
18305
|
+
const defaultColumnVisibility = {};
|
18306
|
+
const defaultSorting = [];
|
18307
|
+
React__default.Children.toArray(props.children).filter(child => !!child) // remove falsey children
|
18308
|
+
.forEach(child => {
|
18309
|
+
if ( /*#__PURE__*/React__default.isValidElement(child) && child.props.accessor) {
|
18310
|
+
var _child$props$enableRe, _child$props$enableFi, _child$props$enableSo, _child$props$enableHi, _child$props$enableOr, _child$props$enableSe, _child$props$enableTr;
|
18311
|
+
if (child.props.defaultWidth) {
|
18312
|
+
defaultColumnSizing[child.props.accessor] = child.props.defaultWidth === 'grow' ? '1fr' : child.props.defaultWidth;
|
18313
|
+
}
|
18314
|
+
if (child.props.defaultHidden && options.enableColumnHiding) {
|
18315
|
+
defaultColumnVisibility[child.props.accessor] = false;
|
18316
|
+
}
|
18317
|
+
if (child.props.sort !== undefined) {
|
18318
|
+
defaultSorting.push({
|
18319
|
+
id: child.props.accessor,
|
18320
|
+
desc: child.props.sort === 'desc'
|
18321
|
+
});
|
18322
|
+
}
|
18323
|
+
columns.push({
|
18324
|
+
accessorKey: child.props.accessor,
|
18051
18325
|
id: child.props.accessor,
|
18052
|
-
|
18326
|
+
header: Header$2,
|
18327
|
+
cell: Cell$3,
|
18328
|
+
footer: Footer$4,
|
18329
|
+
// sizing
|
18330
|
+
minSize: MIN_COLUMN_SIZE$1,
|
18331
|
+
enableResizing: (_child$props$enableRe = child.props.enableResizing) !== null && _child$props$enableRe !== void 0 ? _child$props$enableRe : true,
|
18332
|
+
// filtering
|
18333
|
+
enableColumnFilter: (_child$props$enableFi = child.props.enableFiltering) !== null && _child$props$enableFi !== void 0 ? _child$props$enableFi : true,
|
18334
|
+
filterFn: 'tacoFilter',
|
18335
|
+
// sorting
|
18336
|
+
enableSorting: (_child$props$enableSo = child.props.enableSorting) !== null && _child$props$enableSo !== void 0 ? _child$props$enableSo : true,
|
18337
|
+
sortingFn: getSortingFn$1(child.props.dataType, child.props.sortFn),
|
18338
|
+
sortDescFirst: false,
|
18339
|
+
sortUndefined: 1,
|
18340
|
+
// visibility
|
18341
|
+
enableHiding: (_child$props$enableHi = child.props.enableHiding) !== null && _child$props$enableHi !== void 0 ? _child$props$enableHi : true,
|
18342
|
+
// custom options
|
18343
|
+
meta: {
|
18344
|
+
align: child.props.align,
|
18345
|
+
className: child.props.className,
|
18346
|
+
control: child.props.control,
|
18347
|
+
dataType: child.props.dataType,
|
18348
|
+
enableOrdering: (_child$props$enableOr = child.props.enableOrdering) !== null && _child$props$enableOr !== void 0 ? _child$props$enableOr : true,
|
18349
|
+
enableSearch: (_child$props$enableSe = child.props.enableSearch) !== null && _child$props$enableSe !== void 0 ? _child$props$enableSe : true,
|
18350
|
+
enableTruncate: (_child$props$enableTr = child.props.enableTruncate) !== null && _child$props$enableTr !== void 0 ? _child$props$enableTr : false,
|
18351
|
+
filters: child.props.filters,
|
18352
|
+
footer: child.props.footer,
|
18353
|
+
header: child.props.header,
|
18354
|
+
headerClassName: child.props.headerClassName,
|
18355
|
+
menu: child.props.menu,
|
18356
|
+
renderer: child.props.renderer,
|
18357
|
+
tooltip: child.props.tooltip
|
18358
|
+
}
|
18053
18359
|
});
|
18054
18360
|
}
|
18055
|
-
|
18056
|
-
|
18057
|
-
|
18058
|
-
header: Header$2,
|
18059
|
-
cell: Cell$3,
|
18060
|
-
footer: Footer$4,
|
18061
|
-
// sizing
|
18062
|
-
minSize: MIN_COLUMN_SIZE$1,
|
18063
|
-
enableResizing: (_child$props$enableRe = child.props.enableResizing) !== null && _child$props$enableRe !== void 0 ? _child$props$enableRe : true,
|
18064
|
-
// filtering
|
18065
|
-
enableColumnFilter: (_child$props$enableFi = child.props.enableFiltering) !== null && _child$props$enableFi !== void 0 ? _child$props$enableFi : true,
|
18066
|
-
filterFn: 'tacoFilter',
|
18067
|
-
// sorting
|
18068
|
-
enableSorting: (_child$props$enableSo = child.props.enableSorting) !== null && _child$props$enableSo !== void 0 ? _child$props$enableSo : true,
|
18069
|
-
sortingFn: getSortingFn$1(child.props.dataType, child.props.sortFn),
|
18070
|
-
sortDescFirst: false,
|
18071
|
-
sortUndefined: 1,
|
18072
|
-
// visibility
|
18073
|
-
enableHiding: (_child$props$enableHi = child.props.enableHiding) !== null && _child$props$enableHi !== void 0 ? _child$props$enableHi : true,
|
18074
|
-
// custom options
|
18075
|
-
meta: {
|
18076
|
-
align: child.props.align,
|
18077
|
-
className: child.props.className,
|
18078
|
-
control: child.props.control,
|
18079
|
-
dataType: child.props.dataType,
|
18080
|
-
enableOrdering: (_child$props$enableOr = child.props.enableOrdering) !== null && _child$props$enableOr !== void 0 ? _child$props$enableOr : true,
|
18081
|
-
enableSearch: (_child$props$enableSe = child.props.enableSearch) !== null && _child$props$enableSe !== void 0 ? _child$props$enableSe : true,
|
18082
|
-
enableTruncate: (_child$props$enableTr = child.props.enableTruncate) !== null && _child$props$enableTr !== void 0 ? _child$props$enableTr : false,
|
18083
|
-
filters: child.props.filters,
|
18084
|
-
footer: child.props.footer,
|
18085
|
-
header: child.props.header,
|
18086
|
-
headerClassName: child.props.headerClassName,
|
18087
|
-
menu: child.props.menu,
|
18088
|
-
renderer: child.props.renderer,
|
18089
|
-
tooltip: child.props.tooltip
|
18090
|
-
}
|
18091
|
-
});
|
18361
|
+
});
|
18362
|
+
if (options.enableRowExpansion && props.expandedRowRenderer) {
|
18363
|
+
columns.unshift(columnHelper.display(createRowExpansionColumn$1(props.expandedRowRenderer)));
|
18092
18364
|
}
|
18093
|
-
|
18094
|
-
|
18095
|
-
|
18096
|
-
|
18097
|
-
|
18098
|
-
|
18099
|
-
|
18100
|
-
|
18101
|
-
|
18102
|
-
|
18103
|
-
|
18104
|
-
|
18105
|
-
|
18106
|
-
|
18107
|
-
|
18108
|
-
|
18109
|
-
|
18110
|
-
|
18111
|
-
|
18112
|
-
defaultColumnVisibility,
|
18113
|
-
defaultSorting
|
18114
|
-
};
|
18365
|
+
if (options.enableRowSelection) {
|
18366
|
+
columns.unshift(columnHelper.display(createRowSelectionColumn$1(!!(options.enableRowDrag && props.onRowDrag), !!props.expandedRowRenderer)));
|
18367
|
+
}
|
18368
|
+
if (options.enableRowDrag && props.onRowDrag) {
|
18369
|
+
columns.unshift(columnHelper.display(createRowDragColumn(props.onRowDrag)));
|
18370
|
+
}
|
18371
|
+
if ((_props$actionsForRow = props.actionsForRow) !== null && _props$actionsForRow !== void 0 && _props$actionsForRow.length) {
|
18372
|
+
columns.push(columnHelper.display(createRowActionsColumn$1()));
|
18373
|
+
}
|
18374
|
+
if (editing.isEnabled && editing.isEditing) {
|
18375
|
+
columns.push(columnHelper.display(createRowEditingActionsColumn()));
|
18376
|
+
}
|
18377
|
+
return {
|
18378
|
+
columns,
|
18379
|
+
defaultColumnSizing,
|
18380
|
+
defaultColumnVisibility,
|
18381
|
+
defaultSorting
|
18382
|
+
};
|
18383
|
+
}, []);
|
18115
18384
|
}
|
18116
18385
|
|
18117
18386
|
function usePrinting(isEnabled, loadAll, showWarningWhenPrintingLargeDataset = true) {
|
@@ -18240,6 +18509,9 @@ function useRowActions$1(actionsForRow, actionsForRowLength = ACTIONS_ON_ROW_LEN
|
|
18240
18509
|
|
18241
18510
|
const useLocalStorage = (key, initialValue) => {
|
18242
18511
|
const [state, setState] = React__default.useState(() => {
|
18512
|
+
if (!key) {
|
18513
|
+
return initialValue;
|
18514
|
+
}
|
18243
18515
|
try {
|
18244
18516
|
const localStorageValue = localStorage.getItem(key);
|
18245
18517
|
if (typeof localStorageValue !== 'string') {
|
@@ -18256,6 +18528,9 @@ const useLocalStorage = (key, initialValue) => {
|
|
18256
18528
|
}
|
18257
18529
|
});
|
18258
18530
|
React__default.useEffect(() => {
|
18531
|
+
if (!key) {
|
18532
|
+
return;
|
18533
|
+
}
|
18259
18534
|
try {
|
18260
18535
|
const serializedState = JSON.stringify(state);
|
18261
18536
|
localStorage.setItem(key, serializedState);
|
@@ -18264,7 +18539,11 @@ const useLocalStorage = (key, initialValue) => {
|
|
18264
18539
|
// localStorage can throw. Also JSON.stringify can throw.
|
18265
18540
|
}
|
18266
18541
|
}, [key, state]);
|
18267
|
-
const clear = () =>
|
18542
|
+
const clear = () => {
|
18543
|
+
if (key) {
|
18544
|
+
localStorage.removeItem(key);
|
18545
|
+
}
|
18546
|
+
};
|
18268
18547
|
return [state, setState, clear];
|
18269
18548
|
};
|
18270
18549
|
|
@@ -18278,7 +18557,10 @@ function useUniqueTableId(tableId) {
|
|
18278
18557
|
}
|
18279
18558
|
function useSettings(id, defaultSettings = {}, onChangeSettings) {
|
18280
18559
|
const uniqueId = useUniqueTableId(id);
|
18281
|
-
|
18560
|
+
// If the onChangeSettings prop is provided, we intend to handle settings changes externally rather than saving them
|
18561
|
+
// to local storage.
|
18562
|
+
const key = !onChangeSettings ? uniqueId : undefined;
|
18563
|
+
const [persistedSettings, setPersistedSettings] = useLocalStorage(key, defaultSettings);
|
18282
18564
|
return React__default.useMemo(() => {
|
18283
18565
|
if (onChangeSettings) {
|
18284
18566
|
return [defaultSettings, onChangeSettings];
|
@@ -19245,11 +19527,11 @@ function FilterValue(props) {
|
|
19245
19527
|
if (((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.dataType) === 'datetime') {
|
19246
19528
|
return /*#__PURE__*/React__default.createElement("div", {
|
19247
19529
|
className: "flex flex-grow items-center gap-2"
|
19248
|
-
}, /*#__PURE__*/React__default.createElement(Control
|
19530
|
+
}, /*#__PURE__*/React__default.createElement(Control, {
|
19249
19531
|
column: column,
|
19250
19532
|
onChange: value => handleChange([value, toValue]),
|
19251
19533
|
value: fromValue
|
19252
|
-
}), /*#__PURE__*/React__default.createElement(Control
|
19534
|
+
}), /*#__PURE__*/React__default.createElement(Control, {
|
19253
19535
|
column: column,
|
19254
19536
|
onChange: value => handleChange([fromValue, value]),
|
19255
19537
|
value: toValue
|
@@ -19257,26 +19539,26 @@ function FilterValue(props) {
|
|
19257
19539
|
}
|
19258
19540
|
return /*#__PURE__*/React__default.createElement("div", {
|
19259
19541
|
className: "flex flex-grow items-center gap-2"
|
19260
|
-
}, /*#__PURE__*/React__default.createElement(Control
|
19542
|
+
}, /*#__PURE__*/React__default.createElement(Control, {
|
19261
19543
|
column: column,
|
19262
19544
|
onChange: value => handleChange([isNaN(value) ? undefined : value, toValue]),
|
19263
19545
|
placeholder: "from",
|
19264
19546
|
value: fromValue !== null && fromValue !== void 0 ? fromValue : ''
|
19265
|
-
}), /*#__PURE__*/React__default.createElement(Control
|
19547
|
+
}), /*#__PURE__*/React__default.createElement(Control, {
|
19266
19548
|
column: column,
|
19267
19549
|
onChange: value => handleChange([fromValue, isNaN(value) ? undefined : value]),
|
19268
19550
|
placeholder: "to",
|
19269
19551
|
value: toValue !== null && toValue !== void 0 ? toValue : ''
|
19270
19552
|
}));
|
19271
19553
|
}
|
19272
|
-
return /*#__PURE__*/React__default.createElement(Control
|
19554
|
+
return /*#__PURE__*/React__default.createElement(Control, {
|
19273
19555
|
comparator: comparator,
|
19274
19556
|
column: column,
|
19275
19557
|
onChange: handleChange,
|
19276
19558
|
value: value
|
19277
19559
|
});
|
19278
19560
|
}
|
19279
|
-
function Control
|
19561
|
+
function Control(props) {
|
19280
19562
|
var _column$columnDef$met2, _column$columnDef$met3;
|
19281
19563
|
const {
|
19282
19564
|
column,
|
@@ -19867,7 +20149,9 @@ function PrintIFrame({
|
|
19867
20149
|
enableRowDrag: false,
|
19868
20150
|
enableRowDrop: false,
|
19869
20151
|
enableRowSelectionSingle: false,
|
19870
|
-
preset: undefined
|
20152
|
+
preset: undefined,
|
20153
|
+
// The presence of the onChangeSettings prop ensures that settings won't be stored in local storage.
|
20154
|
+
onChangeSettings: () => undefined
|
19871
20155
|
};
|
19872
20156
|
// -top-60 -left-60 styles make sure that iframe is added outside of the viewport
|
19873
20157
|
return /*#__PURE__*/React__default.createElement("iframe", {
|
@@ -19944,7 +20228,6 @@ function PrintButton(props) {
|
|
19944
20228
|
printWarningDialogVisibility
|
19945
20229
|
} = tableMeta.printing;
|
19946
20230
|
const printTableId = `${tableProps.id}_print`;
|
19947
|
-
const printTableLocalStorageKey = useUniqueTableId(printTableId);
|
19948
20231
|
const defaultSettings = React__default.useMemo(() => ({
|
19949
20232
|
columnFreezingIndex: tableMeta.columnFreezing.frozenColumnIndex,
|
19950
20233
|
columnOrder: state.columnOrder,
|
@@ -19977,9 +20260,6 @@ function PrintButton(props) {
|
|
19977
20260
|
var _loadingToastRef$curr;
|
19978
20261
|
setIsPrinting(false);
|
19979
20262
|
(_loadingToastRef$curr = loadingToastRef.current) === null || _loadingToastRef$curr === void 0 ? void 0 : _loadingToastRef$curr.close();
|
19980
|
-
// Remove print table settings after printing. Doing this will not only remove unwanted localstorage space, but
|
19981
|
-
// will also make sure that the table that is getting printed will always have the fresh table settings
|
19982
|
-
localStorage.removeItem(printTableLocalStorageKey);
|
19983
20263
|
};
|
19984
20264
|
const handleBeforePrint = () => {
|
19985
20265
|
var _loadingToastRef$curr2;
|
@@ -20408,10 +20688,12 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
|
20408
20688
|
} = useTableRenderStrategy$1(props, table, internalRef);
|
20409
20689
|
const tableMeta = table.options.meta;
|
20410
20690
|
const state = table.getState();
|
20691
|
+
const bodyRef = React__default.useRef(null);
|
20411
20692
|
React__default.useEffect(() => {
|
20412
20693
|
const handleKeyDown = event => {
|
20694
|
+
var _bodyRef$current;
|
20413
20695
|
// prevent global shortcuts activating while active in other elements, like inputs or buttons
|
20414
|
-
if (isEventTriggeredOnInteractiveElement(event.target)) {
|
20696
|
+
if (isEventTriggeredOnInteractiveElement(event.target) && !(bodyRef !== null && bodyRef !== void 0 && (_bodyRef$current = bodyRef.current) !== null && _bodyRef$current !== void 0 && _bodyRef$current.contains(event.target))) {
|
20415
20697
|
return;
|
20416
20698
|
}
|
20417
20699
|
tableMeta.hoverState.handleKeyDown(event);
|
@@ -20424,7 +20706,11 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
|
20424
20706
|
return () => {
|
20425
20707
|
document.removeEventListener('keydown', handleKeyDown);
|
20426
20708
|
};
|
20427
|
-
},
|
20709
|
+
},
|
20710
|
+
// See https://github.com/e-conomic/taco/blob/dev/packages/taco/src/components/Table3/strategies/virtualised.tsx#L143
|
20711
|
+
// scrollToIndex function changes when row count changes, so it is important to update handlers with new
|
20712
|
+
// scrollToIndex function.
|
20713
|
+
[scrollToIndex]);
|
20428
20714
|
const handleBlur = event => {
|
20429
20715
|
tableMeta.editing.handleBlur(event);
|
20430
20716
|
};
|
@@ -20495,7 +20781,8 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
|
20495
20781
|
})))))), table.getRowModel().rows.length ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(focus.FocusScope, null, /*#__PURE__*/React__default.createElement("div", {
|
20496
20782
|
className: "group/body contents",
|
20497
20783
|
"data-taco": "table2-body",
|
20498
|
-
role: "rowgroup"
|
20784
|
+
role: "rowgroup",
|
20785
|
+
ref: bodyRef
|
20499
20786
|
}, renderBody())), /*#__PURE__*/React__default.createElement("div", {
|
20500
20787
|
className: "border-grey-300 col-span-full -mt-px border-t"
|
20501
20788
|
}), tableMeta.enableFooter ? /*#__PURE__*/React__default.createElement("div", {
|
@@ -20609,37 +20896,6 @@ Tabs.List = TabList;
|
|
20609
20896
|
Tabs.Trigger = TabTrigger;
|
20610
20897
|
Tabs.Content = TabContent;
|
20611
20898
|
|
20612
|
-
const Textarea = /*#__PURE__*/React.forwardRef(function Textarea(props, ref) {
|
20613
|
-
const {
|
20614
|
-
defaultValue: _,
|
20615
|
-
highlighted,
|
20616
|
-
invalid,
|
20617
|
-
onKeyDown,
|
20618
|
-
...otherProps
|
20619
|
-
} = props;
|
20620
|
-
const classNames = cn(getInputClasses(props), 'py-1 min-h-[75px] disabled:resize-none', props.className);
|
20621
|
-
// home and end keys only navigate to the start/end of textarea value if the textarea container does not scroll
|
20622
|
-
// if it has scroll height then the browser reverts to native scrolling behaviour only
|
20623
|
-
// so we manually override it to ensure _our_ desired behaviour remains intact
|
20624
|
-
const handleKeyDown = event => {
|
20625
|
-
if (event.key === 'Home' || event.key === 'End') {
|
20626
|
-
event.preventDefault();
|
20627
|
-
const position = event.key === 'End' ? event.currentTarget.value.length : 0;
|
20628
|
-
event.currentTarget.setSelectionRange(position, position);
|
20629
|
-
event.currentTarget.scrollTop = event.key === 'End' ? event.currentTarget.scrollHeight : 0;
|
20630
|
-
}
|
20631
|
-
if (onKeyDown) {
|
20632
|
-
onKeyDown(event);
|
20633
|
-
}
|
20634
|
-
};
|
20635
|
-
return /*#__PURE__*/React.createElement("textarea", Object.assign({}, otherProps, {
|
20636
|
-
className: classNames,
|
20637
|
-
"data-taco": "textarea",
|
20638
|
-
onKeyDown: handleKeyDown,
|
20639
|
-
ref: ref
|
20640
|
-
}));
|
20641
|
-
});
|
20642
|
-
|
20643
20899
|
const Tooltip$1 = ({
|
20644
20900
|
continuous,
|
20645
20901
|
index,
|