@economic/taco 2.7.2 → 2.7.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Select2/Select2.d.ts +4 -5
- package/dist/components/Select2/components/Context.d.ts +4 -6
- package/dist/components/Select2/components/Create.d.ts +2 -1
- package/dist/components/Select2/types.d.ts +4 -0
- package/dist/components/Table3/components/columns/cell/controls/{TextAreaControl.d.ts → TextareaControl.d.ts} +1 -1
- package/dist/components/Table3/types.d.ts +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +9 -0
- package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Input/Input.js +15 -12
- package/dist/esm/packages/taco/src/components/Input/Input.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +3 -0
- package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js.map +1 -1
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +9 -2
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Context.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Create.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +0 -6
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +2 -1
- 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 +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/{TextAreaControl.js → TextareaControl.js} +3 -3
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/{TextAreaControl.js.map → TextareaControl.js.map} +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +8 -1
- 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/toolbar/PrintButton/PrintIFrame.js +5 -5
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/hooks/useParentStylesheets.js +3 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/hooks/useParentStylesheets.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js +7 -4
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js +14 -12
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Textarea/Textarea.js +4 -0
- package/dist/esm/packages/taco/src/components/Textarea/Textarea.js.map +1 -1
- package/dist/taco.cjs.development.js +82 -46
- 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 +7143 -7308
@@ -4829,23 +4829,26 @@ const InputWithoutDeprecatedFeatures = /*#__PURE__*/React.forwardRef(function In
|
|
4829
4829
|
...attributes
|
4830
4830
|
} = props;
|
4831
4831
|
const internalRef = useMergedRef(ref);
|
4832
|
-
|
4833
|
-
|
4834
|
-
|
4835
|
-
|
4836
|
-
|
4837
|
-
|
4838
|
-
|
4832
|
+
const handleKeyDown = event => {
|
4833
|
+
// prevent any external keyboard shortcuts from executing while typing single characters in input
|
4834
|
+
if (event.key.length === 1) {
|
4835
|
+
event.stopPropagation();
|
4836
|
+
}
|
4837
|
+
// home and end keys only navigate to the start/end of input value if the input container does not scroll
|
4838
|
+
// if it has scroll height then the browser reverts to native scrolling behaviour only
|
4839
|
+
// so we manually override it to ensure _our_ desired behaviour remains intact
|
4840
|
+
// only the 'text', 'search', 'url', 'tel', 'password' input types support setSelectionRange
|
4841
|
+
if (validSetSelectionRangeTypes.includes(type)) {
|
4839
4842
|
if (!event.shiftKey && (event.key === 'Home' || event.key === 'End')) {
|
4840
4843
|
event.preventDefault();
|
4841
4844
|
const position = event.key === 'End' ? event.currentTarget.value.length : 0;
|
4842
4845
|
event.currentTarget.setSelectionRange(position, position);
|
4843
4846
|
}
|
4844
|
-
|
4845
|
-
|
4846
|
-
|
4847
|
-
}
|
4848
|
-
}
|
4847
|
+
}
|
4848
|
+
if (typeof onKeyDown === 'function') {
|
4849
|
+
onKeyDown(event);
|
4850
|
+
}
|
4851
|
+
};
|
4849
4852
|
const prefixRef = React.useRef(null);
|
4850
4853
|
const prefixRect = useBoundingClientRectListener(prefixRef);
|
4851
4854
|
const postfixRef = React.useRef(null);
|
@@ -5093,6 +5096,9 @@ const ScrollableList = /*#__PURE__*/React.forwardRef(function ScrollableList(pro
|
|
5093
5096
|
const index = nextIndex !== undefined ? nextIndex : currentIndex;
|
5094
5097
|
onKeyDown(event, index);
|
5095
5098
|
}
|
5099
|
+
// Stops the keyboard event from propagating so that keyboard event on other components outside the scrollable
|
5100
|
+
// list are not executed.
|
5101
|
+
event.stopPropagation();
|
5096
5102
|
};
|
5097
5103
|
const handleClick = index => event => {
|
5098
5104
|
setCurrentIndex(index);
|
@@ -6145,6 +6151,8 @@ const Content$4 = /*#__PURE__*/React.forwardRef(function DialogContent(props, re
|
|
6145
6151
|
} else if (dialog.onClose) {
|
6146
6152
|
dialog.onClose();
|
6147
6153
|
}
|
6154
|
+
// Stops event from propogating outside the dialog.
|
6155
|
+
event.stopPropagation();
|
6148
6156
|
};
|
6149
6157
|
// the chosen behaviour in taco is that outside clicks do not close the dialog
|
6150
6158
|
const handleInteractOutside = event => event.preventDefault();
|
@@ -6158,12 +6166,19 @@ const Content$4 = /*#__PURE__*/React.forwardRef(function DialogContent(props, re
|
|
6158
6166
|
} else {
|
6159
6167
|
output = props.children;
|
6160
6168
|
}
|
6169
|
+
const onKeyDown = event => {
|
6170
|
+
if (event.key !== 'Escape') {
|
6171
|
+
// Stops event from propogating outside the dialog.
|
6172
|
+
event.stopPropagation();
|
6173
|
+
}
|
6174
|
+
};
|
6161
6175
|
return /*#__PURE__*/React.createElement(DialogPrimitive.Portal, null, /*#__PURE__*/React.createElement(DialogPrimitive.Overlay, {
|
6162
6176
|
asChild: true
|
6163
6177
|
}, /*#__PURE__*/React.createElement(Backdrop, null, /*#__PURE__*/React.createElement(DialogPrimitive.Content, Object.assign({}, props, {
|
6164
6178
|
className: className,
|
6165
6179
|
onEscapeKeyDown: handleEscapeKeyDown,
|
6166
6180
|
onInteractOutside: handleInteractOutside,
|
6181
|
+
onKeyDown: onKeyDown,
|
6167
6182
|
ref: internalRef,
|
6168
6183
|
style: {
|
6169
6184
|
...props.style,
|
@@ -9122,8 +9137,15 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
9122
9137
|
if (settingsContent) {
|
9123
9138
|
const settingsClassname = cn('border-grey-300 absolute left-0 right-0 -mt-0.5 hidden top-full group-focus-within:flex focus-within:flex flex-col gap-y-4 rounded-b border border-t-0 bg-white p-3 shadow !pt-[calc(theme(spacing.3)_+_theme(spacing[0.5]))]');
|
9124
9139
|
return /*#__PURE__*/React__default.createElement("div", {
|
9125
|
-
className:
|
9126
|
-
|
9140
|
+
className: cn('group relative', {
|
9141
|
+
'z-10 [&_[data-taco=input-container]]:z-10': focused
|
9142
|
+
}),
|
9143
|
+
ref: containerRef,
|
9144
|
+
// create a new stacking context so our internal z-indexes don't effect external components
|
9145
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
|
9146
|
+
style: {
|
9147
|
+
opacity: 0.999
|
9148
|
+
}
|
9127
9149
|
}, input, /*#__PURE__*/React__default.createElement("div", {
|
9128
9150
|
className: settingsClassname,
|
9129
9151
|
onClickCapture: () => {
|
@@ -16177,7 +16199,7 @@ function DisplayCell(props) {
|
|
16177
16199
|
index,
|
16178
16200
|
tableRef
|
16179
16201
|
};
|
16180
|
-
}, [row.original, props.children, value]);
|
16202
|
+
}, [row.original, props.children, value, tableMeta.columnFreezing.frozenColumnIndex]);
|
16181
16203
|
const memoedHighlight = React__default.useMemo(() => {
|
16182
16204
|
var _tableMeta$search$que;
|
16183
16205
|
if (!tableMeta.search.isHighlightingEnabled || !columnMeta.enableSearch) {
|
@@ -16314,6 +16336,7 @@ const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
|
|
16314
16336
|
const {
|
16315
16337
|
actions,
|
16316
16338
|
actionsLength,
|
16339
|
+
fontSize,
|
16317
16340
|
isCurrentRow,
|
16318
16341
|
isEditing,
|
16319
16342
|
isResizingColumn,
|
@@ -16348,8 +16371,13 @@ const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
|
|
16348
16371
|
const visibleActions = actions.map(action => action(row.original)).filter(action => !!action);
|
16349
16372
|
const actionsOnRow = visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);
|
16350
16373
|
const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);
|
16374
|
+
const className = cn('-mb-2 flex justify-end pl-2 text-right', {
|
16375
|
+
// Adjust negative margin on row actions cell to ensure that the cell aligns vertically.
|
16376
|
+
'-mt-2': fontSize === 'small',
|
16377
|
+
'-mt-1.5': fontSize !== 'small'
|
16378
|
+
});
|
16351
16379
|
content = /*#__PURE__*/React__default.createElement("span", {
|
16352
|
-
className:
|
16380
|
+
className: className,
|
16353
16381
|
ref: ref
|
16354
16382
|
}, actionsOnRow.map((button, index) => {
|
16355
16383
|
var _ref, _button$props$tooltip;
|
@@ -16385,6 +16413,7 @@ function Cell$1(context) {
|
|
16385
16413
|
return /*#__PURE__*/React__default.createElement(MemoedCell, Object.assign({}, context, {
|
16386
16414
|
actions: tableMeta.rowActions.actionsForRow,
|
16387
16415
|
actionsLength: tableMeta.rowActions.actionsForRowLength,
|
16416
|
+
fontSize: tableMeta.fontSize.size,
|
16388
16417
|
isCurrentRow: tableMeta.currentRow.currentRowIndex === rowIndex,
|
16389
16418
|
isEditing: tableMeta.editing.isEditing,
|
16390
16419
|
isResizingColumn: !!context.table.getState().columnSizingInfo.isResizingColumn,
|
@@ -16766,18 +16795,20 @@ function useSettingsStateListener$1(table, onChangeSettings) {
|
|
16766
16795
|
React__default.useEffect(() => {
|
16767
16796
|
let handler;
|
16768
16797
|
if (typeof onChangeSettings === 'function') {
|
16769
|
-
handler = setTimeout(() =>
|
16770
|
-
|
16771
|
-
|
16772
|
-
|
16773
|
-
|
16774
|
-
|
16775
|
-
|
16776
|
-
|
16777
|
-
|
16778
|
-
|
16779
|
-
|
16780
|
-
|
16798
|
+
handler = setTimeout(() => {
|
16799
|
+
onChangeSettings({
|
16800
|
+
// adding a new setting? you need to add it to the print settings in PrintButton.tsx!
|
16801
|
+
columnFreezingIndex: meta.columnFreezing.frozenColumnIndex,
|
16802
|
+
columnOrder: meta.columnOrdering.isEnabled ? state.columnOrder : undefined,
|
16803
|
+
columnSizing: table.options.enableColumnResizing ? state.columnSizing : undefined,
|
16804
|
+
columnVisibility: table.options.enableHiding ? state.columnVisibility : undefined,
|
16805
|
+
excludeUnmatchedRecordsInSearch: meta.search.excludeUnmatchedResults,
|
16806
|
+
fontSize: meta.fontSize.isEnabled ? meta.fontSize.size : undefined,
|
16807
|
+
rowHeight: meta.rowHeight.isEnabled ? meta.rowHeight.height : undefined,
|
16808
|
+
showWarningWhenPrintingLargeDataset: meta.printing.printWarningDialogVisibility,
|
16809
|
+
sorting: state.sorting
|
16810
|
+
});
|
16811
|
+
}, 250);
|
16781
16812
|
}
|
16782
16813
|
return () => clearTimeout(handler);
|
16783
16814
|
}, [meta.columnFreezing.frozenColumnIndex, state.columnOrder, state.columnSizing, state.columnVisibility, meta.search.excludeUnmatchedResults, meta.fontSize.size, meta.rowHeight.height, meta.printing.printWarningDialogVisibility, state.sorting]);
|
@@ -17551,6 +17582,10 @@ const Textarea = /*#__PURE__*/React.forwardRef(function Textarea(props, ref) {
|
|
17551
17582
|
// if it has scroll height then the browser reverts to native scrolling behaviour only
|
17552
17583
|
// so we manually override it to ensure _our_ desired behaviour remains intact
|
17553
17584
|
const handleKeyDown = event => {
|
17585
|
+
// prevent any external keyboard shortcuts from executing while typing single characters in textarea
|
17586
|
+
if (event.key.length === 1) {
|
17587
|
+
event.stopPropagation();
|
17588
|
+
}
|
17554
17589
|
if (event.key === 'Home' || event.key === 'End') {
|
17555
17590
|
event.preventDefault();
|
17556
17591
|
const position = event.key === 'End' ? event.currentTarget.value.length : 0;
|
@@ -17569,7 +17604,7 @@ const Textarea = /*#__PURE__*/React.forwardRef(function Textarea(props, ref) {
|
|
17569
17604
|
}));
|
17570
17605
|
});
|
17571
17606
|
|
17572
|
-
const
|
17607
|
+
const TextareaControl = /*#__PURE__*/React__default.forwardRef(function TextareaControl(props, externalRef) {
|
17573
17608
|
const {
|
17574
17609
|
onKeyDown: handleKeyDown,
|
17575
17610
|
onChange: handleChange,
|
@@ -17787,7 +17822,7 @@ const EditingControl = /*#__PURE__*/React__default.forwardRef(function Control(p
|
|
17787
17822
|
ref: refCallback
|
17788
17823
|
}));
|
17789
17824
|
} else if (controlRenderer === 'textarea') {
|
17790
|
-
return /*#__PURE__*/React__default.createElement(
|
17825
|
+
return /*#__PURE__*/React__default.createElement(TextareaControl, Object.assign({}, props, {
|
17791
17826
|
isCellInDetailMode: isCellInDetailMode,
|
17792
17827
|
onKeyDown: handleInputKeyDown,
|
17793
17828
|
ref: refCallback
|
@@ -17899,7 +17934,7 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
17899
17934
|
return removeMoveReason;
|
17900
17935
|
}, [value]);
|
17901
17936
|
const controlRenderer = (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.control;
|
17902
|
-
const className = cn('!px-
|
17937
|
+
const className = cn('!px-[0.4375rem] py-[calc(var(--table3-row-padding)_-_0.06rem)]', {
|
17903
17938
|
relative: (isCurrentRow || isHovered) && controlRenderer === 'textarea',
|
17904
17939
|
// Need to set higher z-index, so that the current row textarea (in expanded state) overlaps rows below
|
17905
17940
|
'z-10': isCurrentRow,
|
@@ -17919,6 +17954,7 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
17919
17954
|
validationErrors: []
|
17920
17955
|
}), /*#__PURE__*/React__default.createElement("div", {
|
17921
17956
|
className: className,
|
17957
|
+
"data-align": columnMeta.align,
|
17922
17958
|
"data-column-index": index,
|
17923
17959
|
role: "cell",
|
17924
17960
|
ref: cellRef
|
@@ -19312,10 +19348,13 @@ function resetHighlightedColumnIndexes(enabled, value, table) {
|
|
19312
19348
|
table.getRowModel().rows.forEach((row, rowIndex) => {
|
19313
19349
|
columns.forEach((column, columnIndex) => {
|
19314
19350
|
try {
|
19315
|
-
var
|
19316
|
-
|
19317
|
-
|
19318
|
-
|
19351
|
+
var _column$columnDef$met;
|
19352
|
+
if ((_column$columnDef$met = column.columnDef.meta) !== null && _column$columnDef$met !== void 0 && _column$columnDef$met.enableSearch) {
|
19353
|
+
var _row$original, _column$columnDef$met2;
|
19354
|
+
const cellValue = getCellValueAsString((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original[column.id], (_column$columnDef$met2 = column.columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.dataType);
|
19355
|
+
if (cellValue && globalFilterFn$1(cellValue, value)) {
|
19356
|
+
indexes.push([rowIndex, columnIndex]);
|
19357
|
+
}
|
19319
19358
|
}
|
19320
19359
|
} catch (e) {
|
19321
19360
|
//
|
@@ -19944,7 +19983,9 @@ const PRINT_STYLES = `
|
|
19944
19983
|
|
19945
19984
|
@media print {
|
19946
19985
|
html, body, #root {
|
19947
|
-
|
19986
|
+
// hides horizontal scrollbar
|
19987
|
+
overflow-x: none !important;
|
19988
|
+
overflow-y: auto !important;
|
19948
19989
|
height: auto !important;
|
19949
19990
|
width: auto !important;
|
19950
19991
|
}
|
@@ -20087,14 +20128,14 @@ function PrintIFrame({
|
|
20087
20128
|
};
|
20088
20129
|
}, [mountNode, stylesReady]);
|
20089
20130
|
React__default.useEffect(() => {
|
20090
|
-
var
|
20091
|
-
if (!iframeWindow || !stylesReady) {
|
20131
|
+
var _contentRef$closest, _parentElement$innerH;
|
20132
|
+
if (!contentRef || !iframeWindow || !stylesReady) {
|
20092
20133
|
return;
|
20093
20134
|
}
|
20135
|
+
// get the closest parent/container of the table, and the table itself
|
20136
|
+
const parentElement = (_contentRef$closest = contentRef === null || contentRef === void 0 ? void 0 : contentRef.closest('[role=dialog], [data-taco=drawer], main')) !== null && _contentRef$closest !== void 0 ? _contentRef$closest : iframeWindow.parent.document.body;
|
20094
20137
|
const iframeDocument = iframeWindow.document;
|
20095
|
-
|
20096
|
-
const parentDocumentContent = ((_iframeWindow$parent$ = iframeWindow.parent.document.querySelector('main')) === null || _iframeWindow$parent$ === void 0 ? void 0 : _iframeWindow$parent$.innerHTML) || ((_iframeWindow$parent$2 = iframeWindow.parent.document.body) === null || _iframeWindow$parent$2 === void 0 ? void 0 : _iframeWindow$parent$2.innerHTML) || '';
|
20097
|
-
iframeDocument.body.innerHTML = parentDocumentContent;
|
20138
|
+
iframeDocument.body.innerHTML = (_parentElement$innerH = parentElement === null || parentElement === void 0 ? void 0 : parentElement.innerHTML) !== null && _parentElement$innerH !== void 0 ? _parentElement$innerH : '';
|
20098
20139
|
const tableElement = iframeDocument.querySelector('[role="table"]');
|
20099
20140
|
const tableColumnFreezingStyles = iframeDocument.querySelector('[data-taco="table3-column-freezing-styles"]');
|
20100
20141
|
const tableWrapper = iframeDocument.createElement('div');
|
@@ -20690,11 +20731,6 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
|
20690
20731
|
const bodyRef = React__default.useRef(null);
|
20691
20732
|
React__default.useEffect(() => {
|
20692
20733
|
const handleKeyDown = event => {
|
20693
|
-
var _bodyRef$current;
|
20694
|
-
// prevent global shortcuts activating while active in other elements, like inputs or buttons
|
20695
|
-
if (isEventTriggeredOnInteractiveElement(event.target) && !(bodyRef !== null && bodyRef !== void 0 && (_bodyRef$current = bodyRef.current) !== null && _bodyRef$current !== void 0 && _bodyRef$current.contains(event.target))) {
|
20696
|
-
return;
|
20697
|
-
}
|
20698
20734
|
tableMeta.hoverState.handleKeyDown(event);
|
20699
20735
|
tableMeta.currentRow.handleKeyDown(event, table.getRowModel().rows.length, scrollToIndex);
|
20700
20736
|
tableMeta.rowClick.handleKeyDown(event, table);
|