@economic/taco 2.58.2-EC-64961.0 → 2.58.2-EC-64961.1
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 +51 -52
- package/dist/taco.cjs.map +1 -1
- package/dist/taco.d.ts +13 -9
- package/dist/taco.js +51 -52
- package/dist/taco.js.map +1 -1
- package/package.json +2 -2
package/dist/taco.cjs
CHANGED
@@ -33054,30 +33054,6 @@ const dataTypes = {
|
|
33054
33054
|
TableFilterComparator.IsNotEmpty
|
33055
33055
|
]
|
33056
33056
|
},
|
33057
|
-
number: {
|
33058
|
-
sortingFn: "basic",
|
33059
|
-
filterComparators: [
|
33060
|
-
TableFilterComparator.IsEqualTo,
|
33061
|
-
TableFilterComparator.IsNotEqualTo,
|
33062
|
-
TableFilterComparator.IsGreaterThan,
|
33063
|
-
TableFilterComparator.IsLessThan,
|
33064
|
-
TableFilterComparator.IsGreaterThanOrEqualTo,
|
33065
|
-
TableFilterComparator.IsLessThanOrEqualTo,
|
33066
|
-
TableFilterComparator.IsBetween,
|
33067
|
-
TableFilterComparator.IsEmpty,
|
33068
|
-
TableFilterComparator.IsNotEmpty
|
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
|
-
}
|
33080
|
-
},
|
33081
33057
|
datetime: {
|
33082
33058
|
sortingFn: "datetime",
|
33083
33059
|
filterComparators: [
|
@@ -33091,7 +33067,7 @@ const dataTypes = {
|
|
33091
33067
|
TableFilterComparator.IsEmpty,
|
33092
33068
|
TableFilterComparator.IsNotEmpty
|
33093
33069
|
],
|
33094
|
-
getDisplayValue: (value, options) => {
|
33070
|
+
getDisplayValue: (value, _1, options) => {
|
33095
33071
|
var _a;
|
33096
33072
|
return format$1(value, (_a = options == null ? void 0 : options.localization) == null ? void 0 : _a.formatting.date) ?? "";
|
33097
33073
|
}
|
@@ -33100,9 +33076,13 @@ const dataTypes = {
|
|
33100
33076
|
sortingFn: "basic",
|
33101
33077
|
filterComparators: [TableFilterComparator.IsEqualTo, TableFilterComparator.IsNotEqualTo]
|
33102
33078
|
},
|
33103
|
-
//
|
33104
|
-
|
33105
|
-
|
33079
|
+
// numbers
|
33080
|
+
number: createNumberDataType("left"),
|
33081
|
+
amount: createNumberDataType("right", { decimals: 2, useGrouping: true })
|
33082
|
+
};
|
33083
|
+
function createNumberDataType(align, defaultOptions2) {
|
33084
|
+
return {
|
33085
|
+
align,
|
33106
33086
|
sortingFn: "basic",
|
33107
33087
|
filterComparators: [
|
33108
33088
|
TableFilterComparator.IsEqualTo,
|
@@ -33115,28 +33095,37 @@ const dataTypes = {
|
|
33115
33095
|
TableFilterComparator.IsEmpty,
|
33116
33096
|
TableFilterComparator.IsNotEmpty
|
33117
33097
|
],
|
33118
|
-
getDisplayValue: (value, options) => {
|
33119
|
-
var _a, _b
|
33098
|
+
getDisplayValue: (value, row, options) => {
|
33099
|
+
var _a, _b;
|
33120
33100
|
if (value === void 0) {
|
33121
33101
|
return "";
|
33122
33102
|
}
|
33123
|
-
const
|
33124
|
-
const max2 = ((_d = (_c = options == null ? void 0 : options.dataTypeOptions) == null ? void 0 : _c.numberFormatOptions) == null ? void 0 : _d.maximumFractionDigits) ?? 2;
|
33103
|
+
const dataTypeOptions = typeof (options == null ? void 0 : options.dataTypeOptions) === "function" ? options == null ? void 0 : options.dataTypeOptions(row) : options == null ? void 0 : options.dataTypeOptions;
|
33125
33104
|
const numberFormatOptions = {
|
33126
|
-
|
33127
|
-
|
33128
|
-
|
33105
|
+
// format
|
33106
|
+
useGrouping: (dataTypeOptions == null ? void 0 : dataTypeOptions.useGrouping) ?? (defaultOptions2 == null ? void 0 : defaultOptions2.useGrouping) ?? false,
|
33107
|
+
// decimals
|
33108
|
+
minimumFractionDigits: (dataTypeOptions == null ? void 0 : dataTypeOptions.decimals) ?? (defaultOptions2 == null ? void 0 : defaultOptions2.decimals),
|
33109
|
+
maximumFractionDigits: (dataTypeOptions == null ? void 0 : dataTypeOptions.decimals) ?? (defaultOptions2 == null ? void 0 : defaultOptions2.decimals)
|
33129
33110
|
};
|
33130
|
-
|
33111
|
+
if (dataTypeOptions == null ? void 0 : dataTypeOptions.currency) {
|
33112
|
+
numberFormatOptions.style = "currency";
|
33113
|
+
numberFormatOptions.currency = dataTypeOptions.currency;
|
33114
|
+
numberFormatOptions.currencyDisplay = "code";
|
33115
|
+
}
|
33116
|
+
const localisedValue = new Intl.NumberFormat((_a = options == null ? void 0 : options.localization) == null ? void 0 : _a.locale, numberFormatOptions).format(
|
33117
|
+
Number(value)
|
33118
|
+
);
|
33119
|
+
if (!numberFormatOptions.useGrouping) {
|
33120
|
+
return localisedValue;
|
33121
|
+
}
|
33122
|
+
const localisedValueWithoutThousandsSeperator = new Intl.NumberFormat((_b = options == null ? void 0 : options.localization) == null ? void 0 : _b.locale, {
|
33123
|
+
...numberFormatOptions,
|
33124
|
+
useGrouping: false
|
33125
|
+
}).format(Number(value));
|
33126
|
+
return [localisedValue, localisedValueWithoutThousandsSeperator];
|
33131
33127
|
}
|
33132
|
-
}
|
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];
|
33128
|
+
};
|
33140
33129
|
}
|
33141
33130
|
function getDataTypeProperties(dataType) {
|
33142
33131
|
return dataTypes[dataType ?? "text"] ?? dataTypes.text;
|
@@ -33259,7 +33248,7 @@ function columnFilterFn(value, filter2) {
|
|
33259
33248
|
const flattenCellValue = (cellValue) => {
|
33260
33249
|
return typeof cellValue === "object" ? Object.values(cellValue).map(flattenCellValue) : cellValue;
|
33261
33250
|
};
|
33262
|
-
function isMatched(searchQuery, cellValue, dataType, dataTypeOptions, localization) {
|
33251
|
+
function isMatched(searchQuery, cellValue, rowValue, dataType, dataTypeOptions, localization) {
|
33263
33252
|
if (typeof cellValue === "object") {
|
33264
33253
|
return flattenCellValue(cellValue).flat(Infinity).find((y4) => isWeakContains(y4, searchQuery));
|
33265
33254
|
} else {
|
@@ -33269,7 +33258,10 @@ function isMatched(searchQuery, cellValue, dataType, dataTypeOptions, localizati
|
|
33269
33258
|
} else {
|
33270
33259
|
const dataTypeProperties = getDataTypeProperties(dataType);
|
33271
33260
|
if (dataTypeProperties.getDisplayValue) {
|
33272
|
-
const cellDisplayValue = dataTypeProperties.getDisplayValue(cellValue,
|
33261
|
+
const cellDisplayValue = dataTypeProperties.getDisplayValue(cellValue, rowValue, {
|
33262
|
+
dataTypeOptions,
|
33263
|
+
localization
|
33264
|
+
});
|
33273
33265
|
if (Array.isArray(cellDisplayValue)) {
|
33274
33266
|
for (const displayValue of cellDisplayValue) {
|
33275
33267
|
if (isWeakContains(displayValue, searchQuery)) {
|
@@ -33290,7 +33282,14 @@ function globalFilterFn(row, columnId, searchQuery, localization) {
|
|
33290
33282
|
if (row.original) {
|
33291
33283
|
const cellValue = row.original[columnId];
|
33292
33284
|
const columnMeta = (_a = row._getAllCellsByColumnId()[columnId]) == null ? void 0 : _a.column.columnDef.meta;
|
33293
|
-
return isMatched(
|
33285
|
+
return isMatched(
|
33286
|
+
searchQuery,
|
33287
|
+
cellValue,
|
33288
|
+
row.original,
|
33289
|
+
columnMeta == null ? void 0 : columnMeta.dataType,
|
33290
|
+
columnMeta == null ? void 0 : columnMeta.dataTypeOptions,
|
33291
|
+
localization
|
33292
|
+
);
|
33294
33293
|
}
|
33295
33294
|
} catch {
|
33296
33295
|
}
|
@@ -33319,7 +33318,7 @@ function resetHighlightedColumnIndexes(searchQuery, table, localization) {
|
|
33319
33318
|
const cellValue = get(row.original, column.id);
|
33320
33319
|
const dataType = (_a = column.columnDef.meta) == null ? void 0 : _a.dataType;
|
33321
33320
|
const dataTypeOptions = (_b = column.columnDef.meta) == null ? void 0 : _b.dataTypeOptions;
|
33322
|
-
if (isMatched(searchQuery, cellValue, dataType, dataTypeOptions, localization)) {
|
33321
|
+
if (isMatched(searchQuery, cellValue, row.original, dataType, dataTypeOptions, localization)) {
|
33323
33322
|
indexes.push([rowIndex, columnIndex]);
|
33324
33323
|
}
|
33325
33324
|
}
|
@@ -33558,9 +33557,9 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
|
|
33558
33557
|
header
|
33559
33558
|
}
|
33560
33559
|
};
|
33561
|
-
const formattedValueRenderer = (value) => {
|
33560
|
+
const formattedValueRenderer = (value, row) => {
|
33562
33561
|
var _a;
|
33563
|
-
const displayValue = (_a = dataTypeProperties.getDisplayValue) == null ? void 0 : _a.call(dataTypeProperties, value, {
|
33562
|
+
const displayValue = (_a = dataTypeProperties.getDisplayValue) == null ? void 0 : _a.call(dataTypeProperties, value, row, {
|
33564
33563
|
dataTypeOptions: meta.dataTypeOptions,
|
33565
33564
|
localization
|
33566
33565
|
});
|
@@ -33571,14 +33570,14 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
|
|
33571
33570
|
return displayValue ?? safeValue;
|
33572
33571
|
};
|
33573
33572
|
const rendererArgs = (info) => ({
|
33574
|
-
formattedValue: formattedValueRenderer(info.getValue()),
|
33573
|
+
formattedValue: formattedValueRenderer(info.getValue(), info.row.original),
|
33575
33574
|
row: info.row.original,
|
33576
33575
|
value: info.getValue()
|
33577
33576
|
});
|
33578
33577
|
if (typeof renderer2 === "function") {
|
33579
33578
|
column.cell = (info) => renderer2(rendererArgs(info));
|
33580
33579
|
} else {
|
33581
|
-
column.cell = (info) => formattedValueRenderer(info.getValue());
|
33580
|
+
column.cell = (info) => formattedValueRenderer(info.getValue(), info.row.original);
|
33582
33581
|
}
|
33583
33582
|
if (typeof footer === "function") {
|
33584
33583
|
column.footer = (info) => footer(info.table.getRowModel().rows.flatMap((row) => row.original !== void 0 ? row.original : []));
|