@economic/taco 2.41.4 → 2.42.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/AlertDialog/AlertDialog.d.ts +2 -0
- package/dist/components/AlertDialog/components/Content.d.ts +1 -1
- package/dist/components/Table3/util/editing.d.ts +2 -1
- package/dist/esm/packages/taco/src/components/AlertDialog/AlertDialog.js.map +1 -1
- package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js +31 -3
- package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Card/Card.js +7 -5
- package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Popover/Primitives.js +2 -1
- package/dist/esm/packages/taco/src/components/Popover/Primitives.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +7 -4
- package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/util/editing.js +6 -5
- package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/util.js +3 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/util.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/util.js +5 -7
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/util.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/listeners/useTableSearchListener.js +3 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +4 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js +4 -17
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/dataTypes.js +62 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/dataTypes.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/filtering.js +1 -15
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/filtering.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js +37 -7
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +22 -8
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/sorting.js +4 -6
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/sorting.js.map +1 -1
- package/dist/primitives/Table/types.d.ts +1 -1
- package/dist/primitives/Table/useTableManager/util/columns.d.ts +2 -2
- package/dist/primitives/Table/useTableManager/util/dataTypes.d.ts +12 -0
- package/dist/primitives/Table/useTableManager/util/filtering.d.ts +0 -2
- package/dist/primitives/Table/useTableManager/util/search.d.ts +6 -2
- package/dist/primitives/Table/useTableManager/util/setup.d.ts +3 -2
- package/dist/primitives/Table/useTableManager/util/sorting.d.ts +2 -1
- package/dist/taco.cjs.development.js +319 -219
- 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
@@ -3911,12 +3911,38 @@ const getDialogSizeClassnames = size => {
|
|
3911
3911
|
const getDialogPositionClassnames = () => 'mt-16 mx-auto';
|
3912
3912
|
const getDialogStylingClassnames = () => 'bg-white rounded animate-[fade-in_150ms] shadow-[0_6px_9px_0_rgba(89,85,98,0.3),0_0_1px_0_rgba(89,85,98,0.2)]';
|
3913
3913
|
|
3914
|
+
const iconPropsByVariant = variant => {
|
3915
|
+
switch (variant) {
|
3916
|
+
case 'information':
|
3917
|
+
return {
|
3918
|
+
color: 'blue',
|
3919
|
+
icon: 'info'
|
3920
|
+
};
|
3921
|
+
case 'error':
|
3922
|
+
return {
|
3923
|
+
color: 'red',
|
3924
|
+
icon: 'close'
|
3925
|
+
};
|
3926
|
+
case 'warning':
|
3927
|
+
return {
|
3928
|
+
color: 'yellow',
|
3929
|
+
icon: 'warning'
|
3930
|
+
};
|
3931
|
+
default:
|
3932
|
+
return undefined;
|
3933
|
+
}
|
3934
|
+
};
|
3914
3935
|
const Title = /*#__PURE__*/React.forwardRef(function AlertDialogTitle(props, ref) {
|
3915
|
-
const
|
3936
|
+
const {
|
3937
|
+
props: parentProps
|
3938
|
+
} = useCurrentAlertDialog();
|
3939
|
+
const iconProps = iconPropsByVariant(parentProps.variant);
|
3916
3940
|
return /*#__PURE__*/React.createElement(AlertDialogPrimitive.Title, Object.assign({}, props, {
|
3917
|
-
className: className,
|
3941
|
+
className: cn('flex items-center', props.className),
|
3918
3942
|
ref: ref
|
3919
|
-
})
|
3943
|
+
}), iconProps ? /*#__PURE__*/React.createElement(BadgeIcon, Object.assign({}, iconProps, {
|
3944
|
+
className: "mr-2"
|
3945
|
+
})) : undefined, props.children);
|
3920
3946
|
});
|
3921
3947
|
const Content = /*#__PURE__*/React.forwardRef(function AlertDialogContent(props, ref) {
|
3922
3948
|
const className = cn('p-6', getDialogPositionClassnames(), getDialogStylingClassnames(), getDialogSizeClassnames('dialog'));
|
@@ -5060,14 +5086,16 @@ const Card = /*#__PURE__*/React.forwardRef(function Card(props, ref) {
|
|
5060
5086
|
const {
|
5061
5087
|
title,
|
5062
5088
|
menu,
|
5063
|
-
children
|
5089
|
+
children,
|
5090
|
+
className,
|
5091
|
+
...otherProps
|
5064
5092
|
} = props;
|
5065
|
-
const
|
5066
|
-
return /*#__PURE__*/React.createElement("div", {
|
5067
|
-
className:
|
5093
|
+
const cardClassName = cn('bg-white flex flex-col rounded-xl border border-solid border-radius-[12px] border-grey-300 hover:border-grey-500', className);
|
5094
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({}, otherProps, {
|
5095
|
+
className: cardClassName,
|
5068
5096
|
"data-taco": "card",
|
5069
5097
|
ref: ref
|
5070
|
-
}, /*#__PURE__*/React.createElement("div", {
|
5098
|
+
}), /*#__PURE__*/React.createElement("div", {
|
5071
5099
|
className: "mx-4 mb-2 mt-4 flex justify-between"
|
5072
5100
|
}, title && (/*#__PURE__*/React.createElement(Truncate, {
|
5073
5101
|
tooltip: title
|
@@ -6294,7 +6322,8 @@ const UnstyledArrow = /*#__PURE__*/React.forwardRef(function PopoverArrow(props,
|
|
6294
6322
|
transform: 'rotateZ(180deg)'
|
6295
6323
|
}
|
6296
6324
|
}), /*#__PURE__*/React.createElement("path", {
|
6297
|
-
|
6325
|
+
// rgba(89, 85, 98, 0.35) is the primary color of the yt-shadow, giving the arrow a shadow-like appearance
|
6326
|
+
className: "text-[rgba(89, 85, 98, 0.35)] fill-current",
|
6298
6327
|
d: "M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z"
|
6299
6328
|
}), /*#__PURE__*/React.createElement("path", {
|
6300
6329
|
className: "fill-current",
|
@@ -9746,136 +9775,6 @@ const Provider = props => {
|
|
9746
9775
|
})(exports.FontSizes || (exports.FontSizes = {}));
|
9747
9776
|
const fixedForwardRef = React__default.forwardRef;
|
9748
9777
|
|
9749
|
-
function getSortingFn(dataType, customFnOrBuiltIn) {
|
9750
|
-
if (typeof customFnOrBuiltIn === 'function') {
|
9751
|
-
return (rowA, rowB, columnId) => customFnOrBuiltIn(rowA.original, rowB.original, columnId);
|
9752
|
-
}
|
9753
|
-
// if a built in is being used, just return that
|
9754
|
-
if (customFnOrBuiltIn) {
|
9755
|
-
return customFnOrBuiltIn;
|
9756
|
-
}
|
9757
|
-
// some times we alias based on the type
|
9758
|
-
if (dataType && dataType !== 'boolean' && dataType !== 'number') {
|
9759
|
-
return dataType;
|
9760
|
-
}
|
9761
|
-
// otherwise fall back to auto
|
9762
|
-
return 'auto';
|
9763
|
-
}
|
9764
|
-
|
9765
|
-
function isInternalColumn(id) {
|
9766
|
-
return id === null || id === void 0 ? void 0 : id.startsWith('__');
|
9767
|
-
}
|
9768
|
-
// column widths
|
9769
|
-
const getCellMinWidth = (fontSize = 'medium') => {
|
9770
|
-
switch (fontSize) {
|
9771
|
-
case exports.FontSizes.small:
|
9772
|
-
return 57;
|
9773
|
-
case exports.FontSizes.large:
|
9774
|
-
return 83;
|
9775
|
-
default:
|
9776
|
-
case exports.FontSizes.medium:
|
9777
|
-
return 72;
|
9778
|
-
}
|
9779
|
-
};
|
9780
|
-
// highlighting
|
9781
|
-
function isCellHighlighted(query, value, dataType) {
|
9782
|
-
if (value === undefined || value === null) {
|
9783
|
-
return false;
|
9784
|
-
}
|
9785
|
-
return String(getCellValueAsString(value, dataType)).toLocaleLowerCase().includes(query.toLocaleLowerCase());
|
9786
|
-
}
|
9787
|
-
function getCellValueAsString(value, dataType) {
|
9788
|
-
if (value === undefined || value === null) {
|
9789
|
-
return '';
|
9790
|
-
} else if (dateFns.isDate(value)) {
|
9791
|
-
var _format;
|
9792
|
-
return (_format = format(value)) !== null && _format !== void 0 ? _format : '';
|
9793
|
-
} else if (dataType === 'datetime' && typeof value === 'string') {
|
9794
|
-
var _format2;
|
9795
|
-
return (_format2 = format(parseFromISOString(value))) !== null && _format2 !== void 0 ? _format2 : '';
|
9796
|
-
}
|
9797
|
-
return String(value);
|
9798
|
-
}
|
9799
|
-
function orderColumn(column, {
|
9800
|
-
orderingDisabled,
|
9801
|
-
orderingEnabled
|
9802
|
-
}) {
|
9803
|
-
const groupedColumn = column;
|
9804
|
-
if (Array.isArray(groupedColumn.columns) && groupedColumn.columns.length > 0) {
|
9805
|
-
groupedColumn.columns.forEach(subcolumn => orderColumn(subcolumn, {
|
9806
|
-
orderingDisabled,
|
9807
|
-
orderingEnabled
|
9808
|
-
}));
|
9809
|
-
} else {
|
9810
|
-
var _column$meta;
|
9811
|
-
if ((_column$meta = column.meta) !== null && _column$meta !== void 0 && _column$meta.enableOrdering) {
|
9812
|
-
orderingEnabled.push(column.id);
|
9813
|
-
} else {
|
9814
|
-
orderingDisabled.push(column.id);
|
9815
|
-
}
|
9816
|
-
}
|
9817
|
-
}
|
9818
|
-
// ordering
|
9819
|
-
function ensureOrdering(columns, settingsOrder, pinnedOrder = [], internalColumnsPinnedToTheRight = ['__actions']) {
|
9820
|
-
// internal columns come with a defined order
|
9821
|
-
const internalColumns = columns.filter(column => isInternalColumn(column.id) && !internalColumnsPinnedToTheRight.includes(String(column.id))).map(column => column.id);
|
9822
|
-
// columns with ordering disabled should be moved to the front
|
9823
|
-
const orderingDisabled = [];
|
9824
|
-
let orderingEnabled = [];
|
9825
|
-
let orderedColumns = columns;
|
9826
|
-
// if settings is defined, make sure the columns that are actual children are sorted by it
|
9827
|
-
if (Array.isArray(settingsOrder)) {
|
9828
|
-
orderedColumns = columns.slice().sort(
|
9829
|
-
// the magic >>> 0 here ensures that columns that aren't found in settings, but are children, are pushed to the end
|
9830
|
-
(a, b) => (settingsOrder.indexOf(a.id) >>> 0) - (settingsOrder.indexOf(b.id) >>> 0));
|
9831
|
-
}
|
9832
|
-
orderedColumns.forEach(column => {
|
9833
|
-
if (isInternalColumn(column.id)) {
|
9834
|
-
return;
|
9835
|
-
}
|
9836
|
-
orderColumn(column, {
|
9837
|
-
orderingDisabled,
|
9838
|
-
orderingEnabled
|
9839
|
-
});
|
9840
|
-
});
|
9841
|
-
if (settingsOrder && settingsOrder.length > 0) {
|
9842
|
-
const columnsAbsentInSettingsOrder = [];
|
9843
|
-
orderingEnabled = orderingEnabled.reduce((acc, column) => {
|
9844
|
-
const index = settingsOrder.indexOf(column);
|
9845
|
-
if (index > -1) {
|
9846
|
-
acc[index] = column;
|
9847
|
-
} else {
|
9848
|
-
columnsAbsentInSettingsOrder.push(column);
|
9849
|
-
}
|
9850
|
-
return acc;
|
9851
|
-
}, []).filter(column => !!column)
|
9852
|
-
// Append absent columns at the end
|
9853
|
-
.concat(columnsAbsentInSettingsOrder);
|
9854
|
-
}
|
9855
|
-
// if pinned columns are defined, make sure they are sorted first, this ensures state matches the freezing "upto" behaviour
|
9856
|
-
if (Array.isArray(pinnedOrder)) {
|
9857
|
-
orderingEnabled.sort(
|
9858
|
-
// the magic >>> 0 here ensures that columns that aren't found in settings, but are children, are pushed to the end
|
9859
|
-
(a, b) => (pinnedOrder.indexOf(a) >>> 0) - (pinnedOrder.indexOf(b) >>> 0));
|
9860
|
-
}
|
9861
|
-
const order = [...internalColumns, ...orderingDisabled, ...orderingEnabled];
|
9862
|
-
// actions should always be last, enforce that
|
9863
|
-
internalColumnsPinnedToTheRight.forEach(id => {
|
9864
|
-
if (columns.findIndex(column => column.id === id) > -1) {
|
9865
|
-
order.push(id);
|
9866
|
-
}
|
9867
|
-
});
|
9868
|
-
return order;
|
9869
|
-
}
|
9870
|
-
// freezing - we use the react-table pinning state, but that requires some mapping between them
|
9871
|
-
function unfreezeAllExternalColumns(leftPinnedState) {
|
9872
|
-
var _leftPinnedState$filt;
|
9873
|
-
return (_leftPinnedState$filt = leftPinnedState === null || leftPinnedState === void 0 ? void 0 : leftPinnedState.filter(id => isInternalColumn(id) && id !== '__actions')) !== null && _leftPinnedState$filt !== void 0 ? _leftPinnedState$filt : [];
|
9874
|
-
}
|
9875
|
-
function freezeUptoExternalColumn(index, columns) {
|
9876
|
-
return columns.slice(0, index + 1);
|
9877
|
-
}
|
9878
|
-
|
9879
9778
|
// filtering
|
9880
9779
|
(function (TableFilterComparator) {
|
9881
9780
|
TableFilterComparator[TableFilterComparator["Contains"] = 0] = "Contains";
|
@@ -9899,6 +9798,74 @@ function freezeUptoExternalColumn(index, columns) {
|
|
9899
9798
|
TableServerLoadAllState[TableServerLoadAllState["Completed"] = 2] = "Completed";
|
9900
9799
|
})(exports.TableServerLoadAllState || (exports.TableServerLoadAllState = {}));
|
9901
9800
|
|
9801
|
+
const dataTypes = {
|
9802
|
+
auto: {
|
9803
|
+
sortingFn: 'auto',
|
9804
|
+
filterComparators: [exports.TableFilterComparator.Contains, exports.TableFilterComparator.DoesNotContain, exports.TableFilterComparator.IsEqualTo, exports.TableFilterComparator.IsNotEqualTo, exports.TableFilterComparator.IsEmpty, exports.TableFilterComparator.IsNotEmpty]
|
9805
|
+
},
|
9806
|
+
// base
|
9807
|
+
text: {
|
9808
|
+
sortingFn: 'alphanumeric',
|
9809
|
+
filterComparators: [exports.TableFilterComparator.Contains, exports.TableFilterComparator.DoesNotContain, exports.TableFilterComparator.IsEqualTo, exports.TableFilterComparator.IsNotEqualTo, exports.TableFilterComparator.IsEmpty, exports.TableFilterComparator.IsNotEmpty]
|
9810
|
+
},
|
9811
|
+
number: {
|
9812
|
+
sortingFn: 'basic',
|
9813
|
+
filterComparators: [exports.TableFilterComparator.IsEqualTo, exports.TableFilterComparator.IsNotEqualTo, exports.TableFilterComparator.IsGreaterThan, exports.TableFilterComparator.IsLessThan, exports.TableFilterComparator.IsGreaterThanOrEqualTo, exports.TableFilterComparator.IsLessThanOrEqualTo, exports.TableFilterComparator.IsBetween, exports.TableFilterComparator.IsEmpty, exports.TableFilterComparator.IsNotEmpty]
|
9814
|
+
},
|
9815
|
+
datetime: {
|
9816
|
+
sortingFn: 'datetime',
|
9817
|
+
filterComparators: [exports.TableFilterComparator.IsEqualTo, exports.TableFilterComparator.IsNotEqualTo, exports.TableFilterComparator.IsGreaterThan, exports.TableFilterComparator.IsLessThan, exports.TableFilterComparator.IsGreaterThanOrEqualTo, exports.TableFilterComparator.IsLessThanOrEqualTo, exports.TableFilterComparator.IsBetween, exports.TableFilterComparator.IsEmpty, exports.TableFilterComparator.IsNotEmpty],
|
9818
|
+
getDisplayValue: (value, options) => {
|
9819
|
+
if (value === undefined) {
|
9820
|
+
return '';
|
9821
|
+
}
|
9822
|
+
if (dateFns.isDate(value)) {
|
9823
|
+
var _format, _options$localization;
|
9824
|
+
return (_format = format(value, options === null || options === void 0 ? void 0 : (_options$localization = options.localization) === null || _options$localization === void 0 ? void 0 : _options$localization.formatting.date)) !== null && _format !== void 0 ? _format : '';
|
9825
|
+
} else if (typeof value === 'string') {
|
9826
|
+
var _format2, _options$localization2;
|
9827
|
+
return (_format2 = format(parseFromISOString(value), options === null || options === void 0 ? void 0 : (_options$localization2 = options.localization) === null || _options$localization2 === void 0 ? void 0 : _options$localization2.formatting.date)) !== null && _format2 !== void 0 ? _format2 : '';
|
9828
|
+
}
|
9829
|
+
return String(value);
|
9830
|
+
}
|
9831
|
+
},
|
9832
|
+
boolean: {
|
9833
|
+
sortingFn: 'basic',
|
9834
|
+
filterComparators: [exports.TableFilterComparator.IsEqualTo, exports.TableFilterComparator.IsNotEqualTo]
|
9835
|
+
},
|
9836
|
+
// advanced
|
9837
|
+
amount: {
|
9838
|
+
align: 'right',
|
9839
|
+
sortingFn: 'basic',
|
9840
|
+
filterComparators: [exports.TableFilterComparator.IsEqualTo, exports.TableFilterComparator.IsNotEqualTo, exports.TableFilterComparator.IsGreaterThan, exports.TableFilterComparator.IsLessThan, exports.TableFilterComparator.IsGreaterThanOrEqualTo, exports.TableFilterComparator.IsLessThanOrEqualTo, exports.TableFilterComparator.IsBetween, exports.TableFilterComparator.IsEmpty, exports.TableFilterComparator.IsNotEmpty],
|
9841
|
+
getDisplayValue: (value, options) => {
|
9842
|
+
var _options$localization3;
|
9843
|
+
if (value === undefined) {
|
9844
|
+
return '';
|
9845
|
+
}
|
9846
|
+
return new Intl.NumberFormat(options === null || options === void 0 ? void 0 : (_options$localization3 = options.localization) === null || _options$localization3 === void 0 ? void 0 : _options$localization3.locale, {
|
9847
|
+
minimumFractionDigits: 2
|
9848
|
+
}).format(Number(value));
|
9849
|
+
}
|
9850
|
+
}
|
9851
|
+
};
|
9852
|
+
function getDataTypeProperties(dataType) {
|
9853
|
+
var _dataTypes;
|
9854
|
+
return (_dataTypes = dataTypes[dataType !== null && dataType !== void 0 ? dataType : 'text']) !== null && _dataTypes !== void 0 ? _dataTypes : dataTypes.text;
|
9855
|
+
}
|
9856
|
+
|
9857
|
+
function getSortingFn(dataType, customFnOrBuiltIn) {
|
9858
|
+
// custom functions should override any that come from dataType
|
9859
|
+
if (typeof customFnOrBuiltIn === 'function') {
|
9860
|
+
return (rowA, rowB, columnId) => customFnOrBuiltIn(rowA.original, rowB.original, columnId);
|
9861
|
+
}
|
9862
|
+
// if a built in is being used, just return that
|
9863
|
+
if (customFnOrBuiltIn) {
|
9864
|
+
return customFnOrBuiltIn;
|
9865
|
+
}
|
9866
|
+
return getDataTypeProperties(dataType).sortingFn;
|
9867
|
+
}
|
9868
|
+
|
9902
9869
|
const toLowerCase = value => String(value !== null && value !== void 0 ? value : '').toLocaleLowerCase();
|
9903
9870
|
const isWeakContains = (left, right) => toLowerCase(left).includes(toLowerCase(right));
|
9904
9871
|
const isWeakEqual$1 = (left, right) => toLowerCase(left) === toLowerCase(right);
|
@@ -10009,19 +9976,189 @@ function columnFilterFn(value, filter) {
|
|
10009
9976
|
return true;
|
10010
9977
|
}
|
10011
9978
|
}
|
10012
|
-
|
9979
|
+
|
9980
|
+
function isMatched(searchQuery, cellValue, dataType, localization) {
|
9981
|
+
const cellValueAsString = String(cellValue !== null && cellValue !== void 0 ? cellValue : '');
|
9982
|
+
if (cellValueAsString !== undefined && isWeakContains(cellValueAsString, searchQuery)) {
|
9983
|
+
return true;
|
9984
|
+
} else {
|
9985
|
+
const dataTypeProperties = getDataTypeProperties(dataType);
|
9986
|
+
if (dataTypeProperties.getDisplayValue) {
|
9987
|
+
const cellDisplayValue = dataTypeProperties.getDisplayValue(cellValue, {
|
9988
|
+
localization
|
9989
|
+
});
|
9990
|
+
if (cellDisplayValue !== undefined && isWeakContains(cellDisplayValue, searchQuery)) {
|
9991
|
+
return true;
|
9992
|
+
}
|
9993
|
+
}
|
9994
|
+
}
|
9995
|
+
return false;
|
9996
|
+
}
|
9997
|
+
function globalFilterFn(row, columnId, searchQuery, localization) {
|
10013
9998
|
try {
|
10014
9999
|
if (row.original) {
|
10015
10000
|
var _row$_getAllCellsByCo, _row$_getAllCellsByCo2;
|
10001
|
+
const cellValue = row.original[columnId];
|
10016
10002
|
const dataType = (_row$_getAllCellsByCo = row._getAllCellsByColumnId()[columnId]) === null || _row$_getAllCellsByCo === void 0 ? void 0 : (_row$_getAllCellsByCo2 = _row$_getAllCellsByCo.column.columnDef.meta) === null || _row$_getAllCellsByCo2 === void 0 ? void 0 : _row$_getAllCellsByCo2.dataType;
|
10017
|
-
|
10018
|
-
return isWeakContains(cellValue, searchQuery);
|
10003
|
+
return isMatched(searchQuery, cellValue, dataType, localization);
|
10019
10004
|
}
|
10020
10005
|
} catch {
|
10021
10006
|
// we don't care, just fail silently and return no results
|
10022
10007
|
}
|
10023
10008
|
return false;
|
10024
10009
|
}
|
10010
|
+
function resetHighlightedColumnIndexes(searchQuery, table, localization) {
|
10011
|
+
const tableMeta = table.options.meta;
|
10012
|
+
let firstRowIndex;
|
10013
|
+
if (searchQuery) {
|
10014
|
+
const indexes = [];
|
10015
|
+
const columns = table.getVisibleLeafColumns();
|
10016
|
+
const rowGrouping = table.getState().grouping;
|
10017
|
+
table.getRowModel().rows.forEach((row, rowIndex) => {
|
10018
|
+
columns.forEach((column, columnIndex) => {
|
10019
|
+
try {
|
10020
|
+
let allowSearch = true;
|
10021
|
+
if (rowGrouping !== null && rowGrouping !== void 0 && rowGrouping.length) {
|
10022
|
+
// if it's the grouped row, only allow search of the grouped column - because that's all that's visible
|
10023
|
+
if (row.getIsGrouped()) {
|
10024
|
+
allowSearch = column.getIsGrouped();
|
10025
|
+
}
|
10026
|
+
// otherwise for other rows, don't search the grouped column - because it isn't visible
|
10027
|
+
else if (rowGrouping.includes(column.id)) {
|
10028
|
+
allowSearch = false;
|
10029
|
+
}
|
10030
|
+
}
|
10031
|
+
if (column.getIsVisible() && column.columnDef.enableGlobalFilter && allowSearch) {
|
10032
|
+
var _column$columnDef$met;
|
10033
|
+
const cellValue = get(row.original, column.id);
|
10034
|
+
const dataType = (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.dataType;
|
10035
|
+
if (isMatched(searchQuery, cellValue, dataType, localization)) {
|
10036
|
+
indexes.push([rowIndex, columnIndex]);
|
10037
|
+
}
|
10038
|
+
}
|
10039
|
+
} catch (e) {
|
10040
|
+
//
|
10041
|
+
}
|
10042
|
+
});
|
10043
|
+
});
|
10044
|
+
tableMeta.search.setHighlightedColumnIndexes(indexes);
|
10045
|
+
if (indexes.length) {
|
10046
|
+
firstRowIndex = indexes[0][0];
|
10047
|
+
tableMeta.search.setCurrentHighlightColumnIndex(0);
|
10048
|
+
} else {
|
10049
|
+
tableMeta.search.setCurrentHighlightColumnIndex(undefined);
|
10050
|
+
}
|
10051
|
+
} else {
|
10052
|
+
tableMeta.search.setHighlightedColumnIndexes([]);
|
10053
|
+
tableMeta.search.setCurrentHighlightColumnIndex(undefined);
|
10054
|
+
}
|
10055
|
+
if (firstRowIndex !== undefined) {
|
10056
|
+
tableMeta.rowActive.setRowActiveIndex(firstRowIndex);
|
10057
|
+
}
|
10058
|
+
return firstRowIndex;
|
10059
|
+
}
|
10060
|
+
|
10061
|
+
function isInternalColumn(id) {
|
10062
|
+
return id === null || id === void 0 ? void 0 : id.startsWith('__');
|
10063
|
+
}
|
10064
|
+
// column widths
|
10065
|
+
const getCellMinWidth = (fontSize = 'medium') => {
|
10066
|
+
switch (fontSize) {
|
10067
|
+
case exports.FontSizes.small:
|
10068
|
+
return 57;
|
10069
|
+
case exports.FontSizes.large:
|
10070
|
+
return 83;
|
10071
|
+
default:
|
10072
|
+
case exports.FontSizes.medium:
|
10073
|
+
return 72;
|
10074
|
+
}
|
10075
|
+
};
|
10076
|
+
// highlighting
|
10077
|
+
function isCellHighlighted(query, value, dataType, localization) {
|
10078
|
+
if (value === undefined || value === null) {
|
10079
|
+
return false;
|
10080
|
+
}
|
10081
|
+
return isMatched(query, value, dataType, localization);
|
10082
|
+
}
|
10083
|
+
function orderColumn(column, {
|
10084
|
+
orderingDisabled,
|
10085
|
+
orderingEnabled
|
10086
|
+
}) {
|
10087
|
+
const groupedColumn = column;
|
10088
|
+
if (Array.isArray(groupedColumn.columns) && groupedColumn.columns.length > 0) {
|
10089
|
+
groupedColumn.columns.forEach(subcolumn => orderColumn(subcolumn, {
|
10090
|
+
orderingDisabled,
|
10091
|
+
orderingEnabled
|
10092
|
+
}));
|
10093
|
+
} else {
|
10094
|
+
var _column$meta;
|
10095
|
+
if ((_column$meta = column.meta) !== null && _column$meta !== void 0 && _column$meta.enableOrdering) {
|
10096
|
+
orderingEnabled.push(column.id);
|
10097
|
+
} else {
|
10098
|
+
orderingDisabled.push(column.id);
|
10099
|
+
}
|
10100
|
+
}
|
10101
|
+
}
|
10102
|
+
// ordering
|
10103
|
+
function ensureOrdering(columns, settingsOrder, pinnedOrder = [], internalColumnsPinnedToTheRight = ['__actions']) {
|
10104
|
+
// internal columns come with a defined order
|
10105
|
+
const internalColumns = columns.filter(column => isInternalColumn(column.id) && !internalColumnsPinnedToTheRight.includes(String(column.id))).map(column => column.id);
|
10106
|
+
// columns with ordering disabled should be moved to the front
|
10107
|
+
const orderingDisabled = [];
|
10108
|
+
let orderingEnabled = [];
|
10109
|
+
let orderedColumns = columns;
|
10110
|
+
// if settings is defined, make sure the columns that are actual children are sorted by it
|
10111
|
+
if (Array.isArray(settingsOrder)) {
|
10112
|
+
orderedColumns = columns.slice().sort(
|
10113
|
+
// the magic >>> 0 here ensures that columns that aren't found in settings, but are children, are pushed to the end
|
10114
|
+
(a, b) => (settingsOrder.indexOf(a.id) >>> 0) - (settingsOrder.indexOf(b.id) >>> 0));
|
10115
|
+
}
|
10116
|
+
orderedColumns.forEach(column => {
|
10117
|
+
if (isInternalColumn(column.id)) {
|
10118
|
+
return;
|
10119
|
+
}
|
10120
|
+
orderColumn(column, {
|
10121
|
+
orderingDisabled,
|
10122
|
+
orderingEnabled
|
10123
|
+
});
|
10124
|
+
});
|
10125
|
+
if (settingsOrder && settingsOrder.length > 0) {
|
10126
|
+
const columnsAbsentInSettingsOrder = [];
|
10127
|
+
orderingEnabled = orderingEnabled.reduce((acc, column) => {
|
10128
|
+
const index = settingsOrder.indexOf(column);
|
10129
|
+
if (index > -1) {
|
10130
|
+
acc[index] = column;
|
10131
|
+
} else {
|
10132
|
+
columnsAbsentInSettingsOrder.push(column);
|
10133
|
+
}
|
10134
|
+
return acc;
|
10135
|
+
}, []).filter(column => !!column)
|
10136
|
+
// Append absent columns at the end
|
10137
|
+
.concat(columnsAbsentInSettingsOrder);
|
10138
|
+
}
|
10139
|
+
// if pinned columns are defined, make sure they are sorted first, this ensures state matches the freezing "upto" behaviour
|
10140
|
+
if (Array.isArray(pinnedOrder)) {
|
10141
|
+
orderingEnabled.sort(
|
10142
|
+
// the magic >>> 0 here ensures that columns that aren't found in settings, but are children, are pushed to the end
|
10143
|
+
(a, b) => (pinnedOrder.indexOf(a) >>> 0) - (pinnedOrder.indexOf(b) >>> 0));
|
10144
|
+
}
|
10145
|
+
const order = [...internalColumns, ...orderingDisabled, ...orderingEnabled];
|
10146
|
+
// actions should always be last, enforce that
|
10147
|
+
internalColumnsPinnedToTheRight.forEach(id => {
|
10148
|
+
if (columns.findIndex(column => column.id === id) > -1) {
|
10149
|
+
order.push(id);
|
10150
|
+
}
|
10151
|
+
});
|
10152
|
+
return order;
|
10153
|
+
}
|
10154
|
+
// freezing - we use the react-table pinning state, but that requires some mapping between them
|
10155
|
+
function unfreezeAllExternalColumns(leftPinnedState) {
|
10156
|
+
var _leftPinnedState$filt;
|
10157
|
+
return (_leftPinnedState$filt = leftPinnedState === null || leftPinnedState === void 0 ? void 0 : leftPinnedState.filter(id => isInternalColumn(id) && id !== '__actions')) !== null && _leftPinnedState$filt !== void 0 ? _leftPinnedState$filt : [];
|
10158
|
+
}
|
10159
|
+
function freezeUptoExternalColumn(index, columns) {
|
10160
|
+
return columns.slice(0, index + 1);
|
10161
|
+
}
|
10025
10162
|
|
10026
10163
|
function getSettings(table) {
|
10027
10164
|
const meta = table.options.meta;
|
@@ -10054,7 +10191,7 @@ function ignoreInternalColumns(data) {
|
|
10054
10191
|
}
|
10055
10192
|
|
10056
10193
|
// mapping children to react-table columns
|
10057
|
-
function processChildren(child, columns, defaultSizing, defaultSorting, defaultVisibility, settings, defaultRowGroupColumnId) {
|
10194
|
+
function processChildren(child, columns, defaultSizing, defaultSorting, defaultVisibility, settings, defaultRowGroupColumnId, localization) {
|
10058
10195
|
const columnHelper = reactTable.createColumnHelper();
|
10059
10196
|
if (/*#__PURE__*/React__default.isValidElement(child) && child.props.children) {
|
10060
10197
|
const {
|
@@ -10065,11 +10202,12 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
|
|
10065
10202
|
columns.push(columnHelper.group({
|
10066
10203
|
id,
|
10067
10204
|
header,
|
10068
|
-
columns: React__default.Children.toArray(children).reduce((columns, child) => processChildren(child, columns, defaultSizing, defaultSorting, defaultVisibility, settings, defaultRowGroupColumnId), []),
|
10205
|
+
columns: React__default.Children.toArray(children).reduce((columns, child) => processChildren(child, columns, defaultSizing, defaultSorting, defaultVisibility, settings, defaultRowGroupColumnId, localization), []),
|
10069
10206
|
// we don't want to let column groups be grouped/aggregrated
|
10070
10207
|
enableGrouping: false
|
10071
10208
|
}));
|
10072
10209
|
} else if (/*#__PURE__*/React__default.isValidElement(child) && (child.props.accessor || child.props.id)) {
|
10210
|
+
var _meta$align;
|
10073
10211
|
const {
|
10074
10212
|
id: untypedId,
|
10075
10213
|
accessor: accessorKey = untypedId,
|
@@ -10098,6 +10236,7 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
|
|
10098
10236
|
...meta
|
10099
10237
|
} = child.props;
|
10100
10238
|
const id = untypedId;
|
10239
|
+
const dataTypeProperties = getDataTypeProperties(child.props.dataType);
|
10101
10240
|
if (defaultHidden && enableHiding) {
|
10102
10241
|
defaultVisibility[id] = false;
|
10103
10242
|
}
|
@@ -10130,6 +10269,7 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
|
|
10130
10269
|
// meta
|
10131
10270
|
meta: {
|
10132
10271
|
...meta,
|
10272
|
+
align: (_meta$align = meta.align) !== null && _meta$align !== void 0 ? _meta$align : dataTypeProperties.align,
|
10133
10273
|
defaultWidth,
|
10134
10274
|
enableOrdering: isGrouped ? false : enableOrdering,
|
10135
10275
|
enablePrinting,
|
@@ -10139,9 +10279,18 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
|
|
10139
10279
|
renderer
|
10140
10280
|
}
|
10141
10281
|
};
|
10142
|
-
// renderers
|
10282
|
+
// renderers - use defined renderers first, then fall back to data type renderers (if there is one)
|
10143
10283
|
if (typeof renderer === 'function') {
|
10144
10284
|
column.cell = info => renderer(info.getValue(), info.row.original);
|
10285
|
+
} else if (dataTypeProperties.getDisplayValue) {
|
10286
|
+
const dataTypeRenderer = value => {
|
10287
|
+
var _dataTypeProperties$g, _dataTypeProperties$g2;
|
10288
|
+
return (_dataTypeProperties$g = (_dataTypeProperties$g2 = dataTypeProperties.getDisplayValue) === null || _dataTypeProperties$g2 === void 0 ? void 0 : _dataTypeProperties$g2.call(dataTypeProperties, value, {
|
10289
|
+
localization
|
10290
|
+
})) !== null && _dataTypeProperties$g !== void 0 ? _dataTypeProperties$g : value;
|
10291
|
+
};
|
10292
|
+
column.cell = info => dataTypeRenderer(info.getValue());
|
10293
|
+
column.meta.renderer = dataTypeRenderer;
|
10145
10294
|
}
|
10146
10295
|
if (typeof footer === 'function') {
|
10147
10296
|
column.footer = info => footer(info.table.getRowModel().rows.flatMap(row => row.original !== undefined ? row.original : []));
|
@@ -10195,7 +10344,7 @@ function createInternalColumn(id, column, defaultSizing) {
|
|
10195
10344
|
}
|
10196
10345
|
};
|
10197
10346
|
}
|
10198
|
-
function mapTableChildrenToColumns(props, settings, options, internalColumns) {
|
10347
|
+
function mapTableChildrenToColumns(props, settings, options, internalColumns, localization) {
|
10199
10348
|
const {
|
10200
10349
|
children,
|
10201
10350
|
defaultRowGroupColumnId
|
@@ -10203,7 +10352,7 @@ function mapTableChildrenToColumns(props, settings, options, internalColumns) {
|
|
10203
10352
|
const defaultSizing = {};
|
10204
10353
|
const defaultSorting = [];
|
10205
10354
|
const defaultVisibility = {};
|
10206
|
-
const columns = React__default.Children.toArray(children).reduce((columns, child) => processChildren(child, columns, defaultSizing, defaultSorting, defaultVisibility, settings, defaultRowGroupColumnId), []);
|
10355
|
+
const columns = React__default.Children.toArray(children).reduce((columns, child) => processChildren(child, columns, defaultSizing, defaultSorting, defaultVisibility, settings, defaultRowGroupColumnId, localization), []);
|
10207
10356
|
if (internalColumns) {
|
10208
10357
|
var _props$rowActions;
|
10209
10358
|
if (options.enableRowExpansion && props.rowExpansionRenderer && internalColumns.rowExpansion) {
|
@@ -10230,7 +10379,7 @@ function mapTableChildrenToColumns(props, settings, options, internalColumns) {
|
|
10230
10379
|
defaultVisibility
|
10231
10380
|
};
|
10232
10381
|
}
|
10233
|
-
function configureReactTableOptions(options, props) {
|
10382
|
+
function configureReactTableOptions(options, props, localization) {
|
10234
10383
|
var _options$enableFilter, _options$enableColumn, _options$enableRowExp, _options$enableColumn2, _options$enableColumn3, _options$enableSortin;
|
10235
10384
|
const enableRowSelection = options.enableRowSelection || options.enableRowSelectionSingle;
|
10236
10385
|
// We don't want to expose internal Tanstack Table row, so we need to wrap enableRowSelection callback into additional function,
|
@@ -10277,7 +10426,7 @@ function configureReactTableOptions(options, props) {
|
|
10277
10426
|
if (options.enableSearch) {
|
10278
10427
|
// always set these because enableGlobalFilter can be toggled on and off by the user
|
10279
10428
|
tableOptions.getFilteredRowModel = reactTable.getFilteredRowModel();
|
10280
|
-
tableOptions.globalFilterFn = globalFilterFn;
|
10429
|
+
tableOptions.globalFilterFn = (row, columnId, searchQuery) => globalFilterFn(row, columnId, searchQuery, localization);
|
10281
10430
|
tableOptions.getColumnCanGlobalFilter = column => {
|
10282
10431
|
var _column$columnDef$met, _column$columnDef$met2;
|
10283
10432
|
return (_column$columnDef$met = (_column$columnDef$met2 = column.columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.enableSearch) !== null && _column$columnDef$met !== void 0 ? _column$columnDef$met : true;
|
@@ -11394,64 +11543,14 @@ function useTableRowSelectionListener(table, onRowSelect) {
|
|
11394
11543
|
}, [!!table.options.enableRowSelection, !!table.options.enableMultiRowSelection, JSON.stringify(rowSelection)]);
|
11395
11544
|
}
|
11396
11545
|
|
11397
|
-
function resetHighlightedColumnIndexes(value, table) {
|
11398
|
-
const tableMeta = table.options.meta;
|
11399
|
-
let firstRowIndex;
|
11400
|
-
if (value) {
|
11401
|
-
const indexes = [];
|
11402
|
-
const columns = table.getVisibleLeafColumns();
|
11403
|
-
const rowGrouping = table.getState().grouping;
|
11404
|
-
table.getRowModel().rows.forEach((row, rowIndex) => {
|
11405
|
-
columns.forEach((column, columnIndex) => {
|
11406
|
-
try {
|
11407
|
-
let allowSearch = true;
|
11408
|
-
if (rowGrouping !== null && rowGrouping !== void 0 && rowGrouping.length) {
|
11409
|
-
// if it's the grouped row, only allow search of the grouped column - because that's all that's visible
|
11410
|
-
if (row.getIsGrouped()) {
|
11411
|
-
allowSearch = column.getIsGrouped();
|
11412
|
-
}
|
11413
|
-
// otherwise for other rows, don't search the grouped column - because it isn't visible
|
11414
|
-
else if (rowGrouping.includes(column.id)) {
|
11415
|
-
allowSearch = false;
|
11416
|
-
}
|
11417
|
-
}
|
11418
|
-
if (column.getIsVisible() && column.columnDef.enableGlobalFilter && allowSearch) {
|
11419
|
-
var _column$columnDef$met;
|
11420
|
-
const cellValue = getCellValueAsString(get(row.original, column.id), (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.dataType);
|
11421
|
-
// indexes don't map to sorted data
|
11422
|
-
if (cellValue !== undefined && isWeakContains(cellValue, value)) {
|
11423
|
-
indexes.push([rowIndex, columnIndex]);
|
11424
|
-
}
|
11425
|
-
}
|
11426
|
-
} catch (e) {
|
11427
|
-
//
|
11428
|
-
}
|
11429
|
-
});
|
11430
|
-
});
|
11431
|
-
tableMeta.search.setHighlightedColumnIndexes(indexes);
|
11432
|
-
if (indexes.length) {
|
11433
|
-
firstRowIndex = indexes[0][0];
|
11434
|
-
tableMeta.search.setCurrentHighlightColumnIndex(0);
|
11435
|
-
} else {
|
11436
|
-
tableMeta.search.setCurrentHighlightColumnIndex(undefined);
|
11437
|
-
}
|
11438
|
-
} else {
|
11439
|
-
tableMeta.search.setHighlightedColumnIndexes([]);
|
11440
|
-
tableMeta.search.setCurrentHighlightColumnIndex(undefined);
|
11441
|
-
}
|
11442
|
-
if (firstRowIndex !== undefined) {
|
11443
|
-
tableMeta.rowActive.setRowActiveIndex(firstRowIndex);
|
11444
|
-
}
|
11445
|
-
return firstRowIndex;
|
11446
|
-
}
|
11447
|
-
|
11448
11546
|
function useTableSearchListener(table, onChangeSearch) {
|
11449
11547
|
const meta = table.options.meta;
|
11548
|
+
const localization = useLocalization();
|
11450
11549
|
// recalculates highlighted indexes whenever something important changes
|
11451
11550
|
React__default.useEffect(() => {
|
11452
11551
|
if (meta.search.isEnabled) {
|
11453
11552
|
const query = table.getState().globalFilter;
|
11454
|
-
resetHighlightedColumnIndexes(query, table);
|
11553
|
+
resetHighlightedColumnIndexes(query, table, localization);
|
11455
11554
|
if (typeof onChangeSearch === 'function') {
|
11456
11555
|
onChangeSearch(query);
|
11457
11556
|
}
|
@@ -11571,6 +11670,7 @@ function useTableRowDrop(isEnabled = false, onRowDrop) {
|
|
11571
11670
|
const DEFAULT_EMPTY_ARRAY = [];
|
11572
11671
|
function useTableManager(props, meta, internalColumns) {
|
11573
11672
|
var _props$data, _props$length, _meta$editing, _instance$options$met;
|
11673
|
+
const localization = useLocalization();
|
11574
11674
|
// CSS.escape would be best here, but it doesn't seem to work very well
|
11575
11675
|
const safeId = props.id.replace('.', '_');
|
11576
11676
|
// configure table options, merging props with presets
|
@@ -11603,7 +11703,7 @@ function useTableManager(props, meta, internalColumns) {
|
|
11603
11703
|
const {
|
11604
11704
|
columns,
|
11605
11705
|
...defaultState
|
11606
|
-
} = mapTableChildrenToColumns(props, settings, options, internalColumns);
|
11706
|
+
} = mapTableChildrenToColumns(props, settings, options, internalColumns, localization);
|
11607
11707
|
// configure initial table state
|
11608
11708
|
const initialState = useReactTableInitialState(props, columns, settings, defaultState);
|
11609
11709
|
// create a react-table instance
|
@@ -11614,7 +11714,7 @@ function useTableManager(props, meta, internalColumns) {
|
|
11614
11714
|
initialState,
|
11615
11715
|
getCoreRowModel: reactTable.getCoreRowModel(),
|
11616
11716
|
// configure react-table built-in features
|
11617
|
-
...configureReactTableOptions(options, props),
|
11717
|
+
...configureReactTableOptions(options, props, localization),
|
11618
11718
|
// settings that can be toggled by the user, and therefore require our own state
|
11619
11719
|
enableGlobalFilter: search.enableGlobalFilter,
|
11620
11720
|
// custom context
|
@@ -12568,6 +12668,7 @@ function getCellAttributes(cell, index, isHighlighted) {
|
|
12568
12668
|
};
|
12569
12669
|
}
|
12570
12670
|
function useSearchHighlighting(cell, cellIndex, ref) {
|
12671
|
+
const localization = useLocalization();
|
12571
12672
|
const {
|
12572
12673
|
rowIndex
|
12573
12674
|
} = React__default.useContext(RowContext);
|
@@ -12580,7 +12681,7 @@ function useSearchHighlighting(cell, cellIndex, ref) {
|
|
12580
12681
|
}
|
12581
12682
|
let isHighlighted = false;
|
12582
12683
|
if (context.table.getState().globalFilter) {
|
12583
|
-
isHighlighted = isCellHighlighted(context.table.getState().globalFilter, cell.getValue(), columnMeta.dataType);
|
12684
|
+
isHighlighted = isCellHighlighted(context.table.getState().globalFilter, cell.getValue(), columnMeta.dataType, localization);
|
12584
12685
|
}
|
12585
12686
|
if (!isHighlighted || tableMeta.search.currentHighlightColumnIndex === undefined) {
|
12586
12687
|
return undefined;
|
@@ -16076,16 +16177,13 @@ function guessComparatorsBasedOnControl(column) {
|
|
16076
16177
|
}
|
16077
16178
|
}
|
16078
16179
|
}
|
16079
|
-
if (columnMeta.
|
16080
|
-
return
|
16081
|
-
}
|
16082
|
-
if (columnMeta.control === 'datepicker' || columnMeta.dataType === 'datetime') {
|
16083
|
-
return [exports.TableFilterComparator.IsEqualTo, exports.TableFilterComparator.IsNotEqualTo, exports.TableFilterComparator.IsBetween, exports.TableFilterComparator.IsLessThan, exports.TableFilterComparator.IsGreaterThan, exports.TableFilterComparator.IsEmpty, exports.TableFilterComparator.IsNotEmpty, exports.TableFilterComparator.IsLessThanOrEqualTo, exports.TableFilterComparator.IsGreaterThanOrEqualTo];
|
16180
|
+
if (columnMeta.control === 'datepicker') {
|
16181
|
+
return getDataTypeProperties('datetime').filterComparators;
|
16084
16182
|
}
|
16085
16183
|
if (columnMeta.control === 'switch') {
|
16086
|
-
return
|
16184
|
+
return getDataTypeProperties('boolean').filterComparators;
|
16087
16185
|
}
|
16088
|
-
return
|
16186
|
+
return getDataTypeProperties(columnMeta.dataType).filterComparators;
|
16089
16187
|
}
|
16090
16188
|
|
16091
16189
|
const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
@@ -18242,11 +18340,11 @@ function useTableEditingListener(table, tableRef) {
|
|
18242
18340
|
}, [saveChanges, tableMeta.editing.isEditing]);
|
18243
18341
|
}
|
18244
18342
|
|
18245
|
-
function willRowMove(cell, change, rowIndex) {
|
18343
|
+
function willRowMove(cell, change, rowIndex, localization) {
|
18246
18344
|
const {
|
18247
18345
|
table
|
18248
18346
|
} = cell.getContext();
|
18249
|
-
if (willRowMoveAfterSearch(cell, change, table)) {
|
18347
|
+
if (willRowMoveAfterSearch(cell, change, table, localization)) {
|
18250
18348
|
return 'search';
|
18251
18349
|
} else if (willRowMoveAfterFilter(cell, change)) {
|
18252
18350
|
return 'filter';
|
@@ -18255,7 +18353,7 @@ function willRowMove(cell, change, rowIndex) {
|
|
18255
18353
|
}
|
18256
18354
|
return undefined;
|
18257
18355
|
}
|
18258
|
-
function willRowMoveAfterSearch(cell, change, table) {
|
18356
|
+
function willRowMoveAfterSearch(cell, change, table, localization) {
|
18259
18357
|
const searchQuery = table.getState().globalFilter;
|
18260
18358
|
if (!table.options.enableGlobalFilter || !searchQuery) {
|
18261
18359
|
return false;
|
@@ -18267,7 +18365,7 @@ function willRowMoveAfterSearch(cell, change, table) {
|
|
18267
18365
|
[cell.column.id]: change
|
18268
18366
|
}
|
18269
18367
|
};
|
18270
|
-
return !globalFilterFn(rowWithChange, cell.column.id, searchQuery);
|
18368
|
+
return !globalFilterFn(rowWithChange, cell.column.id, searchQuery, localization);
|
18271
18369
|
}
|
18272
18370
|
function willRowMoveAfterFilter(cell, change) {
|
18273
18371
|
if (!cell.column.getIsFiltered()) {
|
@@ -18499,7 +18597,7 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
|
|
18499
18597
|
[cell.column.id]: change
|
18500
18598
|
};
|
18501
18599
|
setPendingChanges(currentChanges => {
|
18502
|
-
const nextChanges = createPendingChangesSetter(currentChanges, cell.row, rowIndex, changes);
|
18600
|
+
const nextChanges = createPendingChangesSetter(currentChanges, cell.row, rowIndex, changes, localization);
|
18503
18601
|
pendingChangesUpdater.syncCellChanges(nextChanges);
|
18504
18602
|
return nextChanges;
|
18505
18603
|
});
|
@@ -18543,6 +18641,7 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
|
|
18543
18641
|
return Promise.reject(e);
|
18544
18642
|
}
|
18545
18643
|
};
|
18644
|
+
const localization = useLocalization();
|
18546
18645
|
const [pendingChanges, setPendingChanges] = React__default.useState({});
|
18547
18646
|
// we maintain save status as separate state because 'complete' needs to briefly show after pendingChanges are deleted
|
18548
18647
|
const [saveStates, setSaveState] = React__default.useState({});
|
@@ -18676,6 +18775,7 @@ function useLastFocusedCellIndex() {
|
|
18676
18775
|
return [lastFocusedCellIndexRef.current, setLastFocusedCellIndex];
|
18677
18776
|
}
|
18678
18777
|
function usePendingChangesUpdater(handleChange, setPendingChanges) {
|
18778
|
+
const localization = useLocalization();
|
18679
18779
|
const updatersRef = React__default.useRef({});
|
18680
18780
|
const runCellUpdates = React__default.useCallback(lodash.debounce(function (changes, cell, rowIndex) {
|
18681
18781
|
try {
|
@@ -18691,7 +18791,7 @@ function usePendingChangesUpdater(handleChange, setPendingChanges) {
|
|
18691
18791
|
};
|
18692
18792
|
return Promise.resolve(handleChange(cell.column.id, changes[cell.column.id], nextValues, previousValues)).then(function (updates) {
|
18693
18793
|
if (updates && Object.keys(updates).length) {
|
18694
|
-
setPendingChanges(currentChanges => createPendingChangesSetter(currentChanges, cell.row, rowIndex, updates));
|
18794
|
+
setPendingChanges(currentChanges => createPendingChangesSetter(currentChanges, cell.row, rowIndex, updates, localization));
|
18695
18795
|
}
|
18696
18796
|
});
|
18697
18797
|
}
|
@@ -18709,7 +18809,7 @@ function usePendingChangesUpdater(handleChange, setPendingChanges) {
|
|
18709
18809
|
runCellUpdates
|
18710
18810
|
};
|
18711
18811
|
}
|
18712
|
-
function createPendingChangesSetter(currentChanges, row, rowIndex, changes) {
|
18812
|
+
function createPendingChangesSetter(currentChanges, row, rowIndex, changes, localization) {
|
18713
18813
|
var _currentChanges$row$i, _currentChanges$row$i2, _currentChanges$row$i3;
|
18714
18814
|
// prepare
|
18715
18815
|
const nextChanges = {
|
@@ -18736,7 +18836,7 @@ function createPendingChangesSetter(currentChanges, row, rowIndex, changes) {
|
|
18736
18836
|
if (change !== row.original[accessor]) {
|
18737
18837
|
rowChanges[accessor] = change;
|
18738
18838
|
// determine if the row will move position based on this change, and save why it will move
|
18739
|
-
const reason = willRowMove(cells[accessor], change, rowIndex);
|
18839
|
+
const reason = willRowMove(cells[accessor], change, rowIndex, localization);
|
18740
18840
|
if (reason) {
|
18741
18841
|
rowChanges._meta.moveReason[accessor] = reason;
|
18742
18842
|
} else {
|