@economic/taco 2.45.0-alpha.25 → 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/Combobox/Combobox.d.ts +1 -1
- package/dist/components/Menu/components/Content.d.ts +1 -1
- package/dist/components/Menu/components/SubMenu.d.ts +1 -1
- 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/Combobox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +17 -18
- 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 +117 -57
- 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 +9 -8
- package/tailwind.config.js +1 -0
@@ -50,13 +50,14 @@ export declare type TableColumnRendererControlProps = {
|
|
50
50
|
fontSize?: FontSize;
|
51
51
|
invalid?: boolean;
|
52
52
|
onBlur?: (value: any) => void;
|
53
|
+
onKeyDown?: React.KeyboardEventHandler;
|
53
54
|
onFocus?: React.FocusEventHandler;
|
54
55
|
readOnly?: boolean;
|
55
56
|
ref: React.RefObject<HTMLElement> | ((instance: HTMLElement | null | undefined) => void);
|
56
57
|
setValue: (value: any) => void;
|
57
58
|
value: any;
|
58
59
|
};
|
59
|
-
export declare type TableColumnRendererHeader = string;
|
60
|
+
export declare type TableColumnRendererHeader = string | JSX.Element;
|
60
61
|
export declare type TableColumnRendererFooter<TType> = (rows: TType[]) => JSX.Element | string | number | null;
|
61
62
|
export declare type TableColumnSort = ReactTableColumnSort;
|
62
63
|
export declare type TableColumnSortDirection = 'asc' | 'desc';
|
@@ -99,6 +100,8 @@ export declare type TableEmptyStateReason = 'empty' | 'filtering' | 'searching';
|
|
99
100
|
export declare type TableEmptyStateRenderer = (props: {
|
100
101
|
reason: TableEmptyStateReason;
|
101
102
|
}) => JSX.Element | null;
|
103
|
+
export declare type TableEvent = 'editing-mode';
|
104
|
+
export declare type TableEventHandler = (event: TableEvent, data?: object) => void;
|
102
105
|
export declare type TableSettings = {
|
103
106
|
columnFilters?: ReactTableColumnFilterState;
|
104
107
|
columnOrder?: ReactTableColumnOrderState;
|
@@ -167,6 +170,7 @@ export declare type TableCommonProps<TType = unknown> = TableFeatureProps<TType>
|
|
167
170
|
toolbarLeft?: JSX.Element;
|
168
171
|
toolbarRight?: JSX.Element;
|
169
172
|
toolbarPanel?: JSX.Element;
|
173
|
+
onEvent?: TableEventHandler;
|
170
174
|
onRowClick?: TableRowClickHandler<TType>;
|
171
175
|
onRowDrag?: TableRowDragHandler<TType>;
|
172
176
|
onRowDrop?: TableRowDropHandler<TType>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { TableMeta as ReactTableMeta, RowData } from '@tanstack/react-table';
|
2
|
-
import { TableColumnAlignment, TableColumnClassNameHandler, TableColumnDataType, TableColumnMenu, TableColumnRenderer, TableColumnRendererControl, TableFilterComparator, TableProps } from '../types';
|
2
|
+
import { TableColumnAlignment, TableColumnClassNameHandler, TableColumnDataType, TableColumnMenu, TableColumnRenderer, TableColumnRendererControl, TableEventHandler, TableFilterComparator, TableProps } from '../types';
|
3
3
|
import { useTableColumnFreezing } from './features/useTableColumnFreezing';
|
4
4
|
import { useTableColumnOrdering } from './features/useTableColumnOrdering';
|
5
5
|
import { useTableFooter } from './features/useTableFooter';
|
@@ -25,6 +25,7 @@ declare module '@tanstack/table-core' {
|
|
25
25
|
fontSize: ReturnType<typeof useTableFontSize>;
|
26
26
|
footer: ReturnType<typeof useTableFooter>;
|
27
27
|
length: number;
|
28
|
+
onEvent: TableEventHandler;
|
28
29
|
printing: ReturnType<typeof useTablePrinting>;
|
29
30
|
rowActions: ReturnType<typeof useTableRowActions>;
|
30
31
|
rowActive: ReturnType<typeof useTableRowActive>;
|
@@ -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');
|
@@ -6006,7 +6006,7 @@ const useCombobox = ({
|
|
6006
6006
|
if (index !== undefined) {
|
6007
6007
|
const option = data[index];
|
6008
6008
|
if (option && !option.disabled) {
|
6009
|
-
|
6009
|
+
setInputValueByRef$1(inputRef.current, option.value, 'focusout');
|
6010
6010
|
}
|
6011
6011
|
}
|
6012
6012
|
};
|
@@ -6028,7 +6028,7 @@ const useCombobox = ({
|
|
6028
6028
|
if (defaultValue && !value) {
|
6029
6029
|
setInputValueByIndex(getIndexFromValue(data, defaultValue));
|
6030
6030
|
}
|
6031
|
-
}, [
|
6031
|
+
}, [data]);
|
6032
6032
|
// update input value if it changed 'externally', e.g. clicking/entering an item in the listbox, from a modal etc
|
6033
6033
|
React.useEffect(() => {
|
6034
6034
|
if (value !== undefined && value !== inputValue) {
|
@@ -6063,27 +6063,22 @@ const useCombobox = ({
|
|
6063
6063
|
setCurrentIndex(undefined);
|
6064
6064
|
}
|
6065
6065
|
}, [open]);
|
6066
|
-
const handleChange = nextValue => {
|
6067
|
-
//const event = createCustomEvent('change');
|
6068
|
-
if (onChange && nextValue !== String(value)) {
|
6069
|
-
const item = findByValue(flattenedData, nextValue);
|
6070
|
-
const sanitizedItem = sanitizeItem(item);
|
6071
|
-
onChange(sanitizedItem === null || sanitizedItem === void 0 ? void 0 : sanitizedItem.value);
|
6072
|
-
}
|
6073
|
-
};
|
6074
6066
|
// event handlers
|
6075
6067
|
const handleInputBlur = event => {
|
6068
|
+
event.persist();
|
6076
6069
|
if (listRef.current && event.relatedTarget === listRef.current) {
|
6077
6070
|
event.preventDefault();
|
6078
6071
|
return;
|
6079
6072
|
}
|
6080
|
-
//
|
6081
|
-
if (
|
6082
|
-
|
6083
|
-
|
6084
|
-
|
6085
|
-
|
6086
|
-
|
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
|
+
const item = findByValue(flattenedData, event.target.value);
|
6076
|
+
event.detail = sanitizeItem(item);
|
6077
|
+
const parents = getOptionParents(flattenedData, item === null || item === void 0 ? void 0 : item.path);
|
6078
|
+
if (parents !== null && parents.length > 0) {
|
6079
|
+
event.detail.parents = parents;
|
6080
|
+
}
|
6081
|
+
onChange(event);
|
6087
6082
|
}
|
6088
6083
|
if (props.onBlur) {
|
6089
6084
|
props.onBlur(event);
|
@@ -6097,10 +6092,12 @@ const useCombobox = ({
|
|
6097
6092
|
setOpen(true);
|
6098
6093
|
}
|
6099
6094
|
if (onClick) {
|
6095
|
+
event.persist();
|
6100
6096
|
onClick(event);
|
6101
6097
|
}
|
6102
6098
|
};
|
6103
6099
|
const handleInputKeyDown = event => {
|
6100
|
+
event.persist();
|
6104
6101
|
if (!event.ctrlKey && !event.metaKey) {
|
6105
6102
|
switch (event.key) {
|
6106
6103
|
case 'Backspace':
|
@@ -6116,6 +6113,7 @@ const useCombobox = ({
|
|
6116
6113
|
}
|
6117
6114
|
case 'Tab':
|
6118
6115
|
{
|
6116
|
+
setCurrentValue(currentIndex);
|
6119
6117
|
setOpen(false);
|
6120
6118
|
return;
|
6121
6119
|
}
|
@@ -6168,6 +6166,7 @@ const useCombobox = ({
|
|
6168
6166
|
}
|
6169
6167
|
}
|
6170
6168
|
if (!event.isDefaultPrevented() && onKeyDown) {
|
6169
|
+
event.persist();
|
6171
6170
|
onKeyDown(event);
|
6172
6171
|
}
|
6173
6172
|
};
|
@@ -9504,8 +9503,16 @@ const BaseSelect = /*#__PURE__*/React.forwardRef(function BaseSelect(props, ref)
|
|
9504
9503
|
});
|
9505
9504
|
const Select = /*#__PURE__*/React.forwardRef(function Select(props, ref) {
|
9506
9505
|
const {
|
9506
|
+
editable,
|
9507
9507
|
...otherProps
|
9508
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
|
+
}
|
9509
9516
|
return /*#__PURE__*/React.createElement(BaseSelect, Object.assign({}, otherProps, {
|
9510
9517
|
ref: ref
|
9511
9518
|
}));
|
@@ -9800,6 +9807,20 @@ const insertToastWithoutDuplicates = (currentToasts, id, content, options, close
|
|
9800
9807
|
}
|
9801
9808
|
return nextToasts;
|
9802
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
|
+
};
|
9803
9824
|
const ToastProvider = ({
|
9804
9825
|
children,
|
9805
9826
|
...props
|
@@ -9891,7 +9912,7 @@ const ToastProvider = ({
|
|
9891
9912
|
}, []);
|
9892
9913
|
return /*#__PURE__*/React.createElement(ToastContext.Provider, Object.assign({}, props, {
|
9893
9914
|
value: toaster
|
9894
|
-
}), children, /*#__PURE__*/React.createElement(
|
9915
|
+
}), children, /*#__PURE__*/React.createElement(Portal$1, null, /*#__PURE__*/React.createElement("div", {
|
9895
9916
|
id: "yt-toast__container",
|
9896
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",
|
9897
9918
|
role: "log"
|
@@ -10446,7 +10467,10 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
|
|
10446
10467
|
// To avoid errors caused by undefined row data values, we pass accessorFn as a preventive measure
|
10447
10468
|
// accessorKey can be dot notated strings, so we use lodash.get to access deeply nested children
|
10448
10469
|
accessorFn: row => get(row, accessorKey),
|
10449
|
-
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,
|
10450
10474
|
// features
|
10451
10475
|
enableColumnFilter,
|
10452
10476
|
enableGlobalFilter,
|
@@ -11980,6 +12004,7 @@ function useTableManager(props, meta, internalColumns) {
|
|
11980
12004
|
fontSize,
|
11981
12005
|
footer,
|
11982
12006
|
length,
|
12007
|
+
onEvent: props.onEvent,
|
11983
12008
|
printing,
|
11984
12009
|
rowActions: rowActions,
|
11985
12010
|
rowActive,
|
@@ -13706,6 +13731,21 @@ function getIsPinned(header) {
|
|
13706
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();
|
13707
13732
|
}
|
13708
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
|
+
};
|
13709
13749
|
function Header$5(props) {
|
13710
13750
|
var _header$column$column;
|
13711
13751
|
const {
|
@@ -13875,12 +13915,11 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
|
|
13875
13915
|
"data-cell-pinned": isPinned ? isPinned : undefined,
|
13876
13916
|
style: style,
|
13877
13917
|
ref: setRef
|
13878
|
-
}), isPlaceholder ?
|
13879
|
-
|
13880
|
-
|
13881
|
-
|
13882
|
-
|
13883
|
-
}, 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, {
|
13884
13923
|
direction: sortDirection
|
13885
13924
|
}) : null, hasMenu ? (/*#__PURE__*/React__default.createElement(HeaderMenu, {
|
13886
13925
|
canFilter: canFilter,
|
@@ -14068,29 +14107,39 @@ function Summary(props) {
|
|
14068
14107
|
}
|
14069
14108
|
|
14070
14109
|
function Foot(props) {
|
14110
|
+
var _nonGroupedHeaders$fi;
|
14071
14111
|
const {
|
14072
14112
|
children,
|
14073
14113
|
table,
|
14074
14114
|
...attributes
|
14075
14115
|
} = props;
|
14116
|
+
const tableMeta = table.options.meta;
|
14076
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;
|
14077
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, {
|
14078
14127
|
key: header.id,
|
14079
14128
|
header: header,
|
14080
|
-
|
14129
|
+
showSummary: index === summaryColumnIndex
|
14081
14130
|
})))));
|
14082
14131
|
}
|
14083
14132
|
function Footer$3(props) {
|
14084
14133
|
return /*#__PURE__*/React__default.createElement(MemoedFooter, {
|
14085
14134
|
footer: props.header,
|
14086
|
-
|
14135
|
+
showSummary: props.showSummary
|
14087
14136
|
});
|
14088
14137
|
}
|
14089
14138
|
const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(props) {
|
14090
14139
|
var _footer$subHeaders, _footer$subHeaders$fi;
|
14091
14140
|
const {
|
14092
14141
|
footer,
|
14093
|
-
|
14142
|
+
showSummary
|
14094
14143
|
} = props;
|
14095
14144
|
const columnMeta = footer.column.columnDef.meta;
|
14096
14145
|
// getIsPinned returns true for split header groups, even if the split group has no pinned sub headers
|
@@ -14103,7 +14152,8 @@ const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(prop
|
|
14103
14152
|
}
|
14104
14153
|
let content;
|
14105
14154
|
let align;
|
14106
|
-
|
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) {
|
14107
14157
|
align = 'left';
|
14108
14158
|
content = /*#__PURE__*/React__default.createElement(Summary, {
|
14109
14159
|
table: footer.getContext().table
|
@@ -19520,7 +19570,6 @@ function useTableEditing(isEnabled = false, handleSave, handleChange, handleCrea
|
|
19520
19570
|
var _tableMeta$rowActive$, _table$getRowModel$ro;
|
19521
19571
|
const index = (_tableMeta$rowActive$ = tableMeta.rowActive.rowActiveIndex) !== null && _tableMeta$rowActive$ !== void 0 ? _tableMeta$rowActive$ : 0;
|
19522
19572
|
if (tableMeta.rowActive.rowActiveIndex === undefined) {
|
19523
|
-
console.log('edit toggle active', index);
|
19524
19573
|
tableMeta.rowActive.setRowActiveIndex(index);
|
19525
19574
|
}
|
19526
19575
|
if (!isTemporaryRow((_table$getRowModel$ro = table.getRowModel().rows[index]) === null || _table$getRowModel$ro === void 0 ? void 0 : _table$getRowModel$ro.id)) {
|
@@ -19885,32 +19934,6 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
19885
19934
|
ref: controlRef,
|
19886
19935
|
tabIndex
|
19887
19936
|
};
|
19888
|
-
if (typeof type === 'function') {
|
19889
|
-
const controlFnProps = {
|
19890
|
-
...commonProps,
|
19891
|
-
invalid,
|
19892
|
-
setValue: onChange,
|
19893
|
-
value
|
19894
|
-
};
|
19895
|
-
return type(controlFnProps, {
|
19896
|
-
...row,
|
19897
|
-
...rowPendingChanges
|
19898
|
-
});
|
19899
|
-
}
|
19900
|
-
if (type === 'switch') {
|
19901
|
-
return /*#__PURE__*/React__default.createElement(Switch, Object.assign({}, commonProps, {
|
19902
|
-
checked: Boolean(value),
|
19903
|
-
onChange: onChange,
|
19904
|
-
ref: controlRef
|
19905
|
-
}));
|
19906
|
-
}
|
19907
|
-
if (type === 'checkbox') {
|
19908
|
-
return /*#__PURE__*/React__default.createElement(Checkbox, Object.assign({}, commonProps, {
|
19909
|
-
checked: Boolean(value),
|
19910
|
-
onChange: onChange,
|
19911
|
-
ref: controlRef
|
19912
|
-
}));
|
19913
|
-
}
|
19914
19937
|
const handleInputKeyDown = event => {
|
19915
19938
|
const target = event.target;
|
19916
19939
|
if (target.readOnly) {
|
@@ -19958,6 +19981,39 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
19958
19981
|
toggleDetailedMode(true);
|
19959
19982
|
}
|
19960
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
|
+
}
|
19961
20017
|
const handleFocus = event => {
|
19962
20018
|
if (!isDetailedMode) {
|
19963
20019
|
event.target.select();
|
@@ -20439,7 +20495,11 @@ function Editing(props) {
|
|
20439
20495
|
const ref = React__default.useRef(null);
|
20440
20496
|
const tableMeta = table.options.meta;
|
20441
20497
|
const handleChange = enabled => {
|
20498
|
+
var _tableMeta$onEvent;
|
20442
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
|
+
});
|
20443
20503
|
};
|
20444
20504
|
const tooltip = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table3.editing.buttons.edit.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
|
20445
20505
|
className: "ml-2",
|