@economic/taco 2.51.3-alpha.1 → 2.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Report/Report.d.ts +1 -1
- package/dist/esm/index.css +40 -4
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js +33 -26
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Toolbar/Editing/Editing.js +4 -0
- package/dist/esm/packages/taco/src/components/Table3/components/Toolbar/Editing/Editing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +0 -1
- package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Toast/Toaster.js +16 -2
- package/dist/esm/packages/taco/src/components/Toast/Toaster.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js +16 -4
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +4 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
- package/dist/index.css +40 -4
- package/dist/primitives/Table/Core/components/Footer/Footer.d.ts +2 -2
- package/dist/primitives/Table/types.d.ts +4 -0
- package/dist/primitives/Table/useTableManager/useTableManager.d.ts +2 -1
- package/dist/taco.cjs.development.js +73 -35
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +3 -2
- package/tailwind.config.js +1 -0
@@ -27,7 +27,7 @@ var CollapsiblePrimitive = require('@radix-ui/react-collapsible');
|
|
27
27
|
var PrimitiveSwitch = require('@radix-ui/react-switch');
|
28
28
|
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
29
29
|
var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
|
30
|
-
var
|
30
|
+
var ReactDOM = _interopDefault(require('react-dom'));
|
31
31
|
var reactTable = require('@tanstack/react-table');
|
32
32
|
var get = _interopDefault(require('lodash/get'));
|
33
33
|
var reactVirtual = require('@tanstack/react-virtual');
|
@@ -9805,6 +9805,20 @@ const insertToastWithoutDuplicates = (currentToasts, id, content, options, close
|
|
9805
9805
|
}
|
9806
9806
|
return nextToasts;
|
9807
9807
|
};
|
9808
|
+
const Portal$1 = props => {
|
9809
|
+
var _globalThis$document;
|
9810
|
+
const {
|
9811
|
+
children,
|
9812
|
+
container: containerProp,
|
9813
|
+
...portalProps
|
9814
|
+
} = props;
|
9815
|
+
const [mounted, setMounted] = React.useState(false);
|
9816
|
+
React.useLayoutEffect(() => setMounted(true), []);
|
9817
|
+
const container = containerProp || mounted && (globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$document = globalThis.document) === null || _globalThis$document === void 0 ? void 0 : _globalThis$document.body);
|
9818
|
+
return container ? /*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/React.createElement("div", Object.assign({}, portalProps, {
|
9819
|
+
"data-taco": "portal"
|
9820
|
+
}), children), container) : null;
|
9821
|
+
};
|
9808
9822
|
const ToastProvider = ({
|
9809
9823
|
children,
|
9810
9824
|
...props
|
@@ -9896,7 +9910,7 @@ const ToastProvider = ({
|
|
9896
9910
|
}, []);
|
9897
9911
|
return /*#__PURE__*/React.createElement(ToastContext.Provider, Object.assign({}, props, {
|
9898
9912
|
value: toaster
|
9899
|
-
}), children, /*#__PURE__*/React.createElement(
|
9913
|
+
}), children, /*#__PURE__*/React.createElement(Portal$1, null, /*#__PURE__*/React.createElement("div", {
|
9900
9914
|
id: "yt-toast__container",
|
9901
9915
|
className: "pointer-events-all absolute !left-auto bottom-0 right-0 z-[1000] mb-4 mr-4 flex max-w-md flex-col items-end justify-end",
|
9902
9916
|
role: "log"
|
@@ -10451,8 +10465,10 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
|
|
10451
10465
|
// To avoid errors caused by undefined row data values, we pass accessorFn as a preventive measure
|
10452
10466
|
// accessorKey can be dot notated strings, so we use lodash.get to access deeply nested children
|
10453
10467
|
accessorFn: row => get(row, accessorKey),
|
10454
|
-
// The header can be either a string or a JSX.Element, but react-table expects it to be a string or a
|
10455
|
-
|
10468
|
+
// The header can be either a string or a JSX.Element, but react-table expects it to be a string or a
|
10469
|
+
// renderer function, so `() => header` ensures compatibility when header is a JSX.Element.
|
10470
|
+
// If we just pass `() => header`, then we will loose truncation for string headers.
|
10471
|
+
header: typeof header === 'string' ? header : () => header,
|
10456
10472
|
// features
|
10457
10473
|
enableColumnFilter,
|
10458
10474
|
enableGlobalFilter,
|
@@ -11986,6 +12002,7 @@ function useTableManager(props, meta, internalColumns) {
|
|
11986
12002
|
fontSize,
|
11987
12003
|
footer,
|
11988
12004
|
length,
|
12005
|
+
onEvent: props.onEvent,
|
11989
12006
|
printing,
|
11990
12007
|
rowActions: rowActions,
|
11991
12008
|
rowActive,
|
@@ -14086,29 +14103,39 @@ function Summary(props) {
|
|
14086
14103
|
}
|
14087
14104
|
|
14088
14105
|
function Foot(props) {
|
14106
|
+
var _nonGroupedHeaders$fi;
|
14089
14107
|
const {
|
14090
14108
|
children,
|
14091
14109
|
table,
|
14092
14110
|
...attributes
|
14093
14111
|
} = props;
|
14112
|
+
const tableMeta = table.options.meta;
|
14094
14113
|
const nonGroupedHeaders = table.getFooterGroups()[0].headers.filter(header => !header.column.getIsGrouped());
|
14114
|
+
const firstVisibleExternalColumnIndex = (_nonGroupedHeaders$fi = nonGroupedHeaders.find(header => {
|
14115
|
+
var _header$column$column;
|
14116
|
+
return !isInternalColumn(header.id) && ((_header$column$column = header.column.columnDef.meta) === null || _header$column$column === void 0 ? void 0 : _header$column$column.enablePrinting) !== false;
|
14117
|
+
})) === null || _nonGroupedHeaders$fi === void 0 ? void 0 : _nonGroupedHeaders$fi.index;
|
14118
|
+
// During printing, the summary should be displayed in the first visible external column,
|
14119
|
+
// as internal and hidden columns are excluded from the printed document.
|
14120
|
+
// However, in the normal table view, the summary should appear in the first column.
|
14121
|
+
const summaryColumnIndex = tableMeta.printing.isPrinting ? firstVisibleExternalColumnIndex : 0;
|
14095
14122
|
return /*#__PURE__*/React__default.createElement("tfoot", Object.assign({}, attributes), children, /*#__PURE__*/React__default.createElement("tr", null, nonGroupedHeaders.map((header, index) => (/*#__PURE__*/React__default.createElement(Footer$3, {
|
14096
14123
|
key: header.id,
|
14097
14124
|
header: header,
|
14098
|
-
|
14125
|
+
showSummary: index === summaryColumnIndex
|
14099
14126
|
})))));
|
14100
14127
|
}
|
14101
14128
|
function Footer$3(props) {
|
14102
14129
|
return /*#__PURE__*/React__default.createElement(MemoedFooter, {
|
14103
14130
|
footer: props.header,
|
14104
|
-
|
14131
|
+
showSummary: props.showSummary
|
14105
14132
|
});
|
14106
14133
|
}
|
14107
14134
|
const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(props) {
|
14108
14135
|
var _footer$subHeaders, _footer$subHeaders$fi;
|
14109
14136
|
const {
|
14110
14137
|
footer,
|
14111
|
-
|
14138
|
+
showSummary
|
14112
14139
|
} = props;
|
14113
14140
|
const columnMeta = footer.column.columnDef.meta;
|
14114
14141
|
// getIsPinned returns true for split header groups, even if the split group has no pinned sub headers
|
@@ -14121,7 +14148,8 @@ const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(prop
|
|
14121
14148
|
}
|
14122
14149
|
let content;
|
14123
14150
|
let align;
|
14124
|
-
|
14151
|
+
// Summary should only be appended to the first visible external column, as internal columns like the select column will be hidden in the print view.
|
14152
|
+
if (showSummary) {
|
14125
14153
|
align = 'left';
|
14126
14154
|
content = /*#__PURE__*/React__default.createElement(Summary, {
|
14127
14155
|
table: footer.getContext().table
|
@@ -19538,7 +19566,6 @@ function useTableEditing(isEnabled = false, handleSave, handleChange, handleCrea
|
|
19538
19566
|
var _tableMeta$rowActive$, _table$getRowModel$ro;
|
19539
19567
|
const index = (_tableMeta$rowActive$ = tableMeta.rowActive.rowActiveIndex) !== null && _tableMeta$rowActive$ !== void 0 ? _tableMeta$rowActive$ : 0;
|
19540
19568
|
if (tableMeta.rowActive.rowActiveIndex === undefined) {
|
19541
|
-
console.log('edit toggle active', index);
|
19542
19569
|
tableMeta.rowActive.setRowActiveIndex(index);
|
19543
19570
|
}
|
19544
19571
|
if (!isTemporaryRow((_table$getRowModel$ro = table.getRowModel().rows[index]) === null || _table$getRowModel$ro === void 0 ? void 0 : _table$getRowModel$ro.id)) {
|
@@ -19903,32 +19930,6 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
19903
19930
|
ref: controlRef,
|
19904
19931
|
tabIndex
|
19905
19932
|
};
|
19906
|
-
if (typeof type === 'function') {
|
19907
|
-
const controlFnProps = {
|
19908
|
-
...commonProps,
|
19909
|
-
invalid,
|
19910
|
-
setValue: onChange,
|
19911
|
-
value
|
19912
|
-
};
|
19913
|
-
return type(controlFnProps, {
|
19914
|
-
...row,
|
19915
|
-
...rowPendingChanges
|
19916
|
-
});
|
19917
|
-
}
|
19918
|
-
if (type === 'switch') {
|
19919
|
-
return /*#__PURE__*/React__default.createElement(Switch, Object.assign({}, commonProps, {
|
19920
|
-
checked: Boolean(value),
|
19921
|
-
onChange: onChange,
|
19922
|
-
ref: controlRef
|
19923
|
-
}));
|
19924
|
-
}
|
19925
|
-
if (type === 'checkbox') {
|
19926
|
-
return /*#__PURE__*/React__default.createElement(Checkbox, Object.assign({}, commonProps, {
|
19927
|
-
checked: Boolean(value),
|
19928
|
-
onChange: onChange,
|
19929
|
-
ref: controlRef
|
19930
|
-
}));
|
19931
|
-
}
|
19932
19933
|
const handleInputKeyDown = event => {
|
19933
19934
|
const target = event.target;
|
19934
19935
|
if (target.readOnly) {
|
@@ -19976,6 +19977,39 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
19976
19977
|
toggleDetailedMode(true);
|
19977
19978
|
}
|
19978
19979
|
};
|
19980
|
+
if (typeof type === 'function') {
|
19981
|
+
const controlFnProps = {
|
19982
|
+
...commonProps,
|
19983
|
+
invalid,
|
19984
|
+
setValue: onChange,
|
19985
|
+
onKeyDown: event => {
|
19986
|
+
const target = event.target || null;
|
19987
|
+
// it make sense to handle keydown for the custom edititng controls only if target is either input or textarea
|
19988
|
+
if (target && (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA')) {
|
19989
|
+
handleInputKeyDown(event);
|
19990
|
+
}
|
19991
|
+
},
|
19992
|
+
value
|
19993
|
+
};
|
19994
|
+
return type(controlFnProps, {
|
19995
|
+
...row,
|
19996
|
+
...rowPendingChanges
|
19997
|
+
});
|
19998
|
+
}
|
19999
|
+
if (type === 'switch') {
|
20000
|
+
return /*#__PURE__*/React__default.createElement(Switch, Object.assign({}, commonProps, {
|
20001
|
+
checked: Boolean(value),
|
20002
|
+
onChange: onChange,
|
20003
|
+
ref: controlRef
|
20004
|
+
}));
|
20005
|
+
}
|
20006
|
+
if (type === 'checkbox') {
|
20007
|
+
return /*#__PURE__*/React__default.createElement(Checkbox, Object.assign({}, commonProps, {
|
20008
|
+
checked: Boolean(value),
|
20009
|
+
onChange: onChange,
|
20010
|
+
ref: controlRef
|
20011
|
+
}));
|
20012
|
+
}
|
19979
20013
|
const handleFocus = event => {
|
19980
20014
|
if (!isDetailedMode) {
|
19981
20015
|
event.target.select();
|
@@ -20453,7 +20487,11 @@ function Editing(props) {
|
|
20453
20487
|
const ref = React__default.useRef(null);
|
20454
20488
|
const tableMeta = table.options.meta;
|
20455
20489
|
const handleChange = enabled => {
|
20490
|
+
var _tableMeta$onEvent;
|
20456
20491
|
tableMeta.editing.toggleEditing(enabled, table, scrollToIndex);
|
20492
|
+
(_tableMeta$onEvent = tableMeta.onEvent) === null || _tableMeta$onEvent === void 0 ? void 0 : _tableMeta$onEvent.call(tableMeta, 'editing-mode', {
|
20493
|
+
enabled
|
20494
|
+
});
|
20457
20495
|
};
|
20458
20496
|
const tooltip = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table3.editing.buttons.edit.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
|
20459
20497
|
className: "ml-2",
|