@economic/taco 2.45.0-alpha.26 → 2.45.0-alpha.27
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Report/Report.d.ts +1 -1
- package/dist/components/Select/Select.d.ts +19 -5
- package/dist/esm/index.css +74 -4
- package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +2 -2
- package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select/Select.js +9 -0
- package/dist/esm/packages/taco/src/components/Select/Select.js.map +1 -1
- 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/Core/components/Header/Header.js +20 -6
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.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 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
- package/dist/index.css +74 -4
- package/dist/primitives/Table/Core/components/Footer/Footer.d.ts +2 -2
- package/dist/primitives/Table/types.d.ts +5 -1
- package/dist/primitives/Table/useTableManager/useTableManager.d.ts +2 -1
- package/dist/taco.cjs.development.js +103 -42
- 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');
|
@@ -6070,8 +6070,8 @@ const useCombobox = ({
|
|
6070
6070
|
event.preventDefault();
|
6071
6071
|
return;
|
6072
6072
|
}
|
6073
|
-
|
6074
|
-
if (onChange &&
|
6073
|
+
// event.target.value is always a string so it is important to cast value to a string before checking the equality
|
6074
|
+
if (onChange && event.target.value !== String(value)) {
|
6075
6075
|
const item = findByValue(flattenedData, event.target.value);
|
6076
6076
|
event.detail = sanitizeItem(item);
|
6077
6077
|
const parents = getOptionParents(flattenedData, item === null || item === void 0 ? void 0 : item.path);
|
@@ -9503,8 +9503,16 @@ const BaseSelect = /*#__PURE__*/React.forwardRef(function BaseSelect(props, ref)
|
|
9503
9503
|
});
|
9504
9504
|
const Select = /*#__PURE__*/React.forwardRef(function Select(props, ref) {
|
9505
9505
|
const {
|
9506
|
+
editable,
|
9506
9507
|
...otherProps
|
9507
9508
|
} = props;
|
9509
|
+
if (editable) {
|
9510
|
+
return /*#__PURE__*/React.createElement(Combobox, Object.assign({}, otherProps, {
|
9511
|
+
dialog: undefined,
|
9512
|
+
inline: true,
|
9513
|
+
ref: ref
|
9514
|
+
}));
|
9515
|
+
}
|
9508
9516
|
return /*#__PURE__*/React.createElement(BaseSelect, Object.assign({}, otherProps, {
|
9509
9517
|
ref: ref
|
9510
9518
|
}));
|
@@ -9799,6 +9807,20 @@ const insertToastWithoutDuplicates = (currentToasts, id, content, options, close
|
|
9799
9807
|
}
|
9800
9808
|
return nextToasts;
|
9801
9809
|
};
|
9810
|
+
const Portal$1 = props => {
|
9811
|
+
var _globalThis$document;
|
9812
|
+
const {
|
9813
|
+
children,
|
9814
|
+
container: containerProp,
|
9815
|
+
...portalProps
|
9816
|
+
} = props;
|
9817
|
+
const [mounted, setMounted] = React.useState(false);
|
9818
|
+
React.useLayoutEffect(() => setMounted(true), []);
|
9819
|
+
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);
|
9820
|
+
return container ? /*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/React.createElement("div", Object.assign({}, portalProps, {
|
9821
|
+
"data-taco": "portal"
|
9822
|
+
}), children), container) : null;
|
9823
|
+
};
|
9802
9824
|
const ToastProvider = ({
|
9803
9825
|
children,
|
9804
9826
|
...props
|
@@ -9890,7 +9912,7 @@ const ToastProvider = ({
|
|
9890
9912
|
}, []);
|
9891
9913
|
return /*#__PURE__*/React.createElement(ToastContext.Provider, Object.assign({}, props, {
|
9892
9914
|
value: toaster
|
9893
|
-
}), children, /*#__PURE__*/React.createElement(
|
9915
|
+
}), children, /*#__PURE__*/React.createElement(Portal$1, null, /*#__PURE__*/React.createElement("div", {
|
9894
9916
|
id: "yt-toast__container",
|
9895
9917
|
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",
|
9896
9918
|
role: "log"
|
@@ -10445,7 +10467,10 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
|
|
10445
10467
|
// To avoid errors caused by undefined row data values, we pass accessorFn as a preventive measure
|
10446
10468
|
// accessorKey can be dot notated strings, so we use lodash.get to access deeply nested children
|
10447
10469
|
accessorFn: row => get(row, accessorKey),
|
10448
|
-
header
|
10470
|
+
// The header can be either a string or a JSX.Element, but react-table expects it to be a string or a
|
10471
|
+
// renderer function, so `() => header` ensures compatibility when header is a JSX.Element.
|
10472
|
+
// If we just pass `() => header`, then we will loose truncation for string headers.
|
10473
|
+
header: typeof header === 'string' ? header : () => header,
|
10449
10474
|
// features
|
10450
10475
|
enableColumnFilter,
|
10451
10476
|
enableGlobalFilter,
|
@@ -11979,6 +12004,7 @@ function useTableManager(props, meta, internalColumns) {
|
|
11979
12004
|
fontSize,
|
11980
12005
|
footer,
|
11981
12006
|
length,
|
12007
|
+
onEvent: props.onEvent,
|
11982
12008
|
printing,
|
11983
12009
|
rowActions: rowActions,
|
11984
12010
|
rowActive,
|
@@ -13705,6 +13731,21 @@ function getIsPinned(header) {
|
|
13705
13731
|
return (_header$subHeaders = header.subHeaders) !== null && _header$subHeaders !== void 0 && _header$subHeaders.length ? (_header$subHeaders$fi = header.subHeaders.find(x => x.column.getIsPinned())) === null || _header$subHeaders$fi === void 0 ? void 0 : _header$subHeaders$fi.column.getIsPinned() : header.column.getIsPinned();
|
13706
13732
|
}
|
13707
13733
|
|
13734
|
+
const HeaderContent = ({
|
13735
|
+
children,
|
13736
|
+
tooltip,
|
13737
|
+
isInternalColumnHeader
|
13738
|
+
}) => {
|
13739
|
+
if (isInternalColumnHeader || typeof children !== 'string') {
|
13740
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, children);
|
13741
|
+
}
|
13742
|
+
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
13743
|
+
title: String(tooltip !== null && tooltip !== void 0 ? tooltip : children),
|
13744
|
+
placement: "top"
|
13745
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
13746
|
+
className: "truncate"
|
13747
|
+
}, children));
|
13748
|
+
};
|
13708
13749
|
function Header$5(props) {
|
13709
13750
|
var _header$column$column;
|
13710
13751
|
const {
|
@@ -13874,12 +13915,11 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
|
|
13874
13915
|
"data-cell-pinned": isPinned ? isPinned : undefined,
|
13875
13916
|
style: style,
|
13876
13917
|
ref: setRef
|
13877
|
-
}), isPlaceholder ?
|
13878
|
-
|
13879
|
-
|
13880
|
-
|
13881
|
-
|
13882
|
-
}, children))), sortDirection ? /*#__PURE__*/React__default.createElement(SortIndicator, {
|
13918
|
+
}), !isPlaceholder ? (/*#__PURE__*/React__default.createElement(HeaderContent, {
|
13919
|
+
children: children,
|
13920
|
+
tooltip: tooltip,
|
13921
|
+
isInternalColumnHeader: !!isInternalColumn(id)
|
13922
|
+
})) : null, sortDirection ? /*#__PURE__*/React__default.createElement(SortIndicator, {
|
13883
13923
|
direction: sortDirection
|
13884
13924
|
}) : null, hasMenu ? (/*#__PURE__*/React__default.createElement(HeaderMenu, {
|
13885
13925
|
canFilter: canFilter,
|
@@ -14067,29 +14107,39 @@ function Summary(props) {
|
|
14067
14107
|
}
|
14068
14108
|
|
14069
14109
|
function Foot(props) {
|
14110
|
+
var _nonGroupedHeaders$fi;
|
14070
14111
|
const {
|
14071
14112
|
children,
|
14072
14113
|
table,
|
14073
14114
|
...attributes
|
14074
14115
|
} = props;
|
14116
|
+
const tableMeta = table.options.meta;
|
14075
14117
|
const nonGroupedHeaders = table.getFooterGroups()[0].headers.filter(header => !header.column.getIsGrouped());
|
14118
|
+
const firstVisibleExternalColumnIndex = (_nonGroupedHeaders$fi = nonGroupedHeaders.find(header => {
|
14119
|
+
var _header$column$column;
|
14120
|
+
return !isInternalColumn(header.id) && ((_header$column$column = header.column.columnDef.meta) === null || _header$column$column === void 0 ? void 0 : _header$column$column.enablePrinting) !== false;
|
14121
|
+
})) === null || _nonGroupedHeaders$fi === void 0 ? void 0 : _nonGroupedHeaders$fi.index;
|
14122
|
+
// During printing, the summary should be displayed in the first visible external column,
|
14123
|
+
// as internal and hidden columns are excluded from the printed document.
|
14124
|
+
// However, in the normal table view, the summary should appear in the first column.
|
14125
|
+
const summaryColumnIndex = tableMeta.printing.isPrinting ? firstVisibleExternalColumnIndex : 0;
|
14076
14126
|
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, {
|
14077
14127
|
key: header.id,
|
14078
14128
|
header: header,
|
14079
|
-
|
14129
|
+
showSummary: index === summaryColumnIndex
|
14080
14130
|
})))));
|
14081
14131
|
}
|
14082
14132
|
function Footer$3(props) {
|
14083
14133
|
return /*#__PURE__*/React__default.createElement(MemoedFooter, {
|
14084
14134
|
footer: props.header,
|
14085
|
-
|
14135
|
+
showSummary: props.showSummary
|
14086
14136
|
});
|
14087
14137
|
}
|
14088
14138
|
const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(props) {
|
14089
14139
|
var _footer$subHeaders, _footer$subHeaders$fi;
|
14090
14140
|
const {
|
14091
14141
|
footer,
|
14092
|
-
|
14142
|
+
showSummary
|
14093
14143
|
} = props;
|
14094
14144
|
const columnMeta = footer.column.columnDef.meta;
|
14095
14145
|
// getIsPinned returns true for split header groups, even if the split group has no pinned sub headers
|
@@ -14102,7 +14152,8 @@ const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(prop
|
|
14102
14152
|
}
|
14103
14153
|
let content;
|
14104
14154
|
let align;
|
14105
|
-
|
14155
|
+
// 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.
|
14156
|
+
if (showSummary) {
|
14106
14157
|
align = 'left';
|
14107
14158
|
content = /*#__PURE__*/React__default.createElement(Summary, {
|
14108
14159
|
table: footer.getContext().table
|
@@ -19519,7 +19570,6 @@ function useTableEditing(isEnabled = false, handleSave, handleChange, handleCrea
|
|
19519
19570
|
var _tableMeta$rowActive$, _table$getRowModel$ro;
|
19520
19571
|
const index = (_tableMeta$rowActive$ = tableMeta.rowActive.rowActiveIndex) !== null && _tableMeta$rowActive$ !== void 0 ? _tableMeta$rowActive$ : 0;
|
19521
19572
|
if (tableMeta.rowActive.rowActiveIndex === undefined) {
|
19522
|
-
console.log('edit toggle active', index);
|
19523
19573
|
tableMeta.rowActive.setRowActiveIndex(index);
|
19524
19574
|
}
|
19525
19575
|
if (!isTemporaryRow((_table$getRowModel$ro = table.getRowModel().rows[index]) === null || _table$getRowModel$ro === void 0 ? void 0 : _table$getRowModel$ro.id)) {
|
@@ -19884,32 +19934,6 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
19884
19934
|
ref: controlRef,
|
19885
19935
|
tabIndex
|
19886
19936
|
};
|
19887
|
-
if (typeof type === 'function') {
|
19888
|
-
const controlFnProps = {
|
19889
|
-
...commonProps,
|
19890
|
-
invalid,
|
19891
|
-
setValue: onChange,
|
19892
|
-
value
|
19893
|
-
};
|
19894
|
-
return type(controlFnProps, {
|
19895
|
-
...row,
|
19896
|
-
...rowPendingChanges
|
19897
|
-
});
|
19898
|
-
}
|
19899
|
-
if (type === 'switch') {
|
19900
|
-
return /*#__PURE__*/React__default.createElement(Switch, Object.assign({}, commonProps, {
|
19901
|
-
checked: Boolean(value),
|
19902
|
-
onChange: onChange,
|
19903
|
-
ref: controlRef
|
19904
|
-
}));
|
19905
|
-
}
|
19906
|
-
if (type === 'checkbox') {
|
19907
|
-
return /*#__PURE__*/React__default.createElement(Checkbox, Object.assign({}, commonProps, {
|
19908
|
-
checked: Boolean(value),
|
19909
|
-
onChange: onChange,
|
19910
|
-
ref: controlRef
|
19911
|
-
}));
|
19912
|
-
}
|
19913
19937
|
const handleInputKeyDown = event => {
|
19914
19938
|
const target = event.target;
|
19915
19939
|
if (target.readOnly) {
|
@@ -19957,6 +19981,39 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
19957
19981
|
toggleDetailedMode(true);
|
19958
19982
|
}
|
19959
19983
|
};
|
19984
|
+
if (typeof type === 'function') {
|
19985
|
+
const controlFnProps = {
|
19986
|
+
...commonProps,
|
19987
|
+
invalid,
|
19988
|
+
setValue: onChange,
|
19989
|
+
onKeyDown: event => {
|
19990
|
+
const target = event.target || null;
|
19991
|
+
// it make sense to handle keydown for the custom edititng controls only if target is either input or textarea
|
19992
|
+
if (target && (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA')) {
|
19993
|
+
handleInputKeyDown(event);
|
19994
|
+
}
|
19995
|
+
},
|
19996
|
+
value
|
19997
|
+
};
|
19998
|
+
return type(controlFnProps, {
|
19999
|
+
...row,
|
20000
|
+
...rowPendingChanges
|
20001
|
+
});
|
20002
|
+
}
|
20003
|
+
if (type === 'switch') {
|
20004
|
+
return /*#__PURE__*/React__default.createElement(Switch, Object.assign({}, commonProps, {
|
20005
|
+
checked: Boolean(value),
|
20006
|
+
onChange: onChange,
|
20007
|
+
ref: controlRef
|
20008
|
+
}));
|
20009
|
+
}
|
20010
|
+
if (type === 'checkbox') {
|
20011
|
+
return /*#__PURE__*/React__default.createElement(Checkbox, Object.assign({}, commonProps, {
|
20012
|
+
checked: Boolean(value),
|
20013
|
+
onChange: onChange,
|
20014
|
+
ref: controlRef
|
20015
|
+
}));
|
20016
|
+
}
|
19960
20017
|
const handleFocus = event => {
|
19961
20018
|
if (!isDetailedMode) {
|
19962
20019
|
event.target.select();
|
@@ -20438,7 +20495,11 @@ function Editing(props) {
|
|
20438
20495
|
const ref = React__default.useRef(null);
|
20439
20496
|
const tableMeta = table.options.meta;
|
20440
20497
|
const handleChange = enabled => {
|
20498
|
+
var _tableMeta$onEvent;
|
20441
20499
|
tableMeta.editing.toggleEditing(enabled, table, scrollToIndex);
|
20500
|
+
(_tableMeta$onEvent = tableMeta.onEvent) === null || _tableMeta$onEvent === void 0 ? void 0 : _tableMeta$onEvent.call(tableMeta, 'editing-mode', {
|
20501
|
+
enabled
|
20502
|
+
});
|
20442
20503
|
};
|
20443
20504
|
const tooltip = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table3.editing.buttons.edit.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
|
20444
20505
|
className: "ml-2",
|