@economic/taco 2.58.2-EC-64962.0 → 2.58.2-EC-64961.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/taco.cjs +39 -15
- package/dist/taco.cjs.map +1 -1
- package/dist/taco.d.ts +24 -8
- package/dist/taco.js +39 -15
- package/dist/taco.js.map +1 -1
- package/package.json +2 -2
package/dist/taco.cjs
CHANGED
@@ -33066,7 +33066,17 @@ const dataTypes = {
|
|
33066
33066
|
TableFilterComparator.IsBetween,
|
33067
33067
|
TableFilterComparator.IsEmpty,
|
33068
33068
|
TableFilterComparator.IsNotEmpty
|
33069
|
-
]
|
33069
|
+
],
|
33070
|
+
getDisplayValue: (value, options) => {
|
33071
|
+
var _a, _b, _c;
|
33072
|
+
if (value === void 0) {
|
33073
|
+
return "";
|
33074
|
+
}
|
33075
|
+
if ((_a = options == null ? void 0 : options.dataTypeOptions) == null ? void 0 : _a.numberFormatOptions) {
|
33076
|
+
return formatNumber(value, (_b = options == null ? void 0 : options.localization) == null ? void 0 : _b.locale, (_c = options == null ? void 0 : options.dataTypeOptions) == null ? void 0 : _c.numberFormatOptions);
|
33077
|
+
}
|
33078
|
+
return String(value);
|
33079
|
+
}
|
33070
33080
|
},
|
33071
33081
|
datetime: {
|
33072
33082
|
sortingFn: "datetime",
|
@@ -33106,18 +33116,28 @@ const dataTypes = {
|
|
33106
33116
|
TableFilterComparator.IsNotEmpty
|
33107
33117
|
],
|
33108
33118
|
getDisplayValue: (value, options) => {
|
33109
|
-
var _a;
|
33119
|
+
var _a, _b, _c, _d, _e, _f;
|
33110
33120
|
if (value === void 0) {
|
33111
33121
|
return "";
|
33112
33122
|
}
|
33113
|
-
const
|
33114
|
-
const
|
33115
|
-
const
|
33116
|
-
|
33117
|
-
|
33123
|
+
const min2 = ((_b = (_a = options == null ? void 0 : options.dataTypeOptions) == null ? void 0 : _a.numberFormatOptions) == null ? void 0 : _b.minimumFractionDigits) ?? 2;
|
33124
|
+
const max2 = ((_d = (_c = options == null ? void 0 : options.dataTypeOptions) == null ? void 0 : _c.numberFormatOptions) == null ? void 0 : _d.maximumFractionDigits) ?? 2;
|
33125
|
+
const numberFormatOptions = {
|
33126
|
+
minimumFractionDigits: Math.min(min2, max2),
|
33127
|
+
maximumFractionDigits: Math.max(max2, min2),
|
33128
|
+
...(_e = options == null ? void 0 : options.dataTypeOptions) == null ? void 0 : _e.numberFormatOptions
|
33129
|
+
};
|
33130
|
+
return formatNumber(value, (_f = options == null ? void 0 : options.localization) == null ? void 0 : _f.locale, numberFormatOptions);
|
33118
33131
|
}
|
33119
33132
|
}
|
33120
33133
|
};
|
33134
|
+
function formatNumber(value, locale2, numberFormatOptions) {
|
33135
|
+
const formatter = new Intl.NumberFormat(locale2, numberFormatOptions);
|
33136
|
+
const decimalSeperator = new Intl.NumberFormat(String(locale2 ?? ""), { minimumFractionDigits: 2 }).format(1.1).substring(1, 2);
|
33137
|
+
const localisedValue = formatter.format(Number(value));
|
33138
|
+
const localisedValueWithoutThousandsSeperator = decimalSeperator === "." ? localisedValue.replace(",", "") : localisedValue.replace(".", "");
|
33139
|
+
return [localisedValue, localisedValueWithoutThousandsSeperator];
|
33140
|
+
}
|
33121
33141
|
function getDataTypeProperties(dataType) {
|
33122
33142
|
return dataTypes[dataType ?? "text"] ?? dataTypes.text;
|
33123
33143
|
}
|
@@ -33239,7 +33259,7 @@ function columnFilterFn(value, filter2) {
|
|
33239
33259
|
const flattenCellValue = (cellValue) => {
|
33240
33260
|
return typeof cellValue === "object" ? Object.values(cellValue).map(flattenCellValue) : cellValue;
|
33241
33261
|
};
|
33242
|
-
function isMatched(searchQuery, cellValue, dataType, localization) {
|
33262
|
+
function isMatched(searchQuery, cellValue, dataType, dataTypeOptions, localization) {
|
33243
33263
|
if (typeof cellValue === "object") {
|
33244
33264
|
return flattenCellValue(cellValue).flat(Infinity).find((y4) => isWeakContains(y4, searchQuery));
|
33245
33265
|
} else {
|
@@ -33249,7 +33269,7 @@ function isMatched(searchQuery, cellValue, dataType, localization) {
|
|
33249
33269
|
} else {
|
33250
33270
|
const dataTypeProperties = getDataTypeProperties(dataType);
|
33251
33271
|
if (dataTypeProperties.getDisplayValue) {
|
33252
|
-
const cellDisplayValue = dataTypeProperties.getDisplayValue(cellValue, { localization });
|
33272
|
+
const cellDisplayValue = dataTypeProperties.getDisplayValue(cellValue, { dataTypeOptions, localization });
|
33253
33273
|
if (Array.isArray(cellDisplayValue)) {
|
33254
33274
|
for (const displayValue of cellDisplayValue) {
|
33255
33275
|
if (isWeakContains(displayValue, searchQuery)) {
|
@@ -33265,12 +33285,12 @@ function isMatched(searchQuery, cellValue, dataType, localization) {
|
|
33265
33285
|
return false;
|
33266
33286
|
}
|
33267
33287
|
function globalFilterFn(row, columnId, searchQuery, localization) {
|
33268
|
-
var _a
|
33288
|
+
var _a;
|
33269
33289
|
try {
|
33270
33290
|
if (row.original) {
|
33271
33291
|
const cellValue = row.original[columnId];
|
33272
|
-
const
|
33273
|
-
return isMatched(searchQuery, cellValue, dataType, localization);
|
33292
|
+
const columnMeta = (_a = row._getAllCellsByColumnId()[columnId]) == null ? void 0 : _a.column.columnDef.meta;
|
33293
|
+
return isMatched(searchQuery, cellValue, columnMeta == null ? void 0 : columnMeta.dataType, columnMeta == null ? void 0 : columnMeta.dataTypeOptions, localization);
|
33274
33294
|
}
|
33275
33295
|
} catch {
|
33276
33296
|
}
|
@@ -33285,7 +33305,7 @@ function resetHighlightedColumnIndexes(searchQuery, table, localization) {
|
|
33285
33305
|
const rowGrouping = table.getState().grouping;
|
33286
33306
|
table.getRowModel().rows.forEach((row, rowIndex) => {
|
33287
33307
|
columns.forEach((column, columnIndex) => {
|
33288
|
-
var _a;
|
33308
|
+
var _a, _b;
|
33289
33309
|
try {
|
33290
33310
|
let allowSearch = true;
|
33291
33311
|
if (rowGrouping == null ? void 0 : rowGrouping.length) {
|
@@ -33298,7 +33318,8 @@ function resetHighlightedColumnIndexes(searchQuery, table, localization) {
|
|
33298
33318
|
if (column.getIsVisible() && column.columnDef.enableGlobalFilter && allowSearch) {
|
33299
33319
|
const cellValue = get(row.original, column.id);
|
33300
33320
|
const dataType = (_a = column.columnDef.meta) == null ? void 0 : _a.dataType;
|
33301
|
-
|
33321
|
+
const dataTypeOptions = (_b = column.columnDef.meta) == null ? void 0 : _b.dataTypeOptions;
|
33322
|
+
if (isMatched(searchQuery, cellValue, dataType, dataTypeOptions, localization)) {
|
33302
33323
|
indexes.push([rowIndex, columnIndex]);
|
33303
33324
|
}
|
33304
33325
|
}
|
@@ -33539,7 +33560,10 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
|
|
33539
33560
|
};
|
33540
33561
|
const formattedValueRenderer = (value) => {
|
33541
33562
|
var _a;
|
33542
|
-
const displayValue = (_a = dataTypeProperties.getDisplayValue) == null ? void 0 : _a.call(dataTypeProperties, value, {
|
33563
|
+
const displayValue = (_a = dataTypeProperties.getDisplayValue) == null ? void 0 : _a.call(dataTypeProperties, value, {
|
33564
|
+
dataTypeOptions: meta.dataTypeOptions,
|
33565
|
+
localization
|
33566
|
+
});
|
33543
33567
|
const safeValue = value !== void 0 && value !== null ? String(value) : value;
|
33544
33568
|
if (Array.isArray(displayValue)) {
|
33545
33569
|
return displayValue[0] ?? safeValue;
|