@economic/taco 2.58.2-EC-64962.1 → 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 +60 -37
- package/dist/taco.cjs.map +1 -1
- package/dist/taco.d.ts +22 -2
- package/dist/taco.js +60 -37
- package/dist/taco.js.map +1 -1
- package/package.json +2 -2
package/dist/taco.cjs
CHANGED
@@ -33054,20 +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
|
-
},
|
33071
33057
|
datetime: {
|
33072
33058
|
sortingFn: "datetime",
|
33073
33059
|
filterComparators: [
|
@@ -33081,7 +33067,7 @@ const dataTypes = {
|
|
33081
33067
|
TableFilterComparator.IsEmpty,
|
33082
33068
|
TableFilterComparator.IsNotEmpty
|
33083
33069
|
],
|
33084
|
-
getDisplayValue: (value, options) => {
|
33070
|
+
getDisplayValue: (value, _1, options) => {
|
33085
33071
|
var _a;
|
33086
33072
|
return format$1(value, (_a = options == null ? void 0 : options.localization) == null ? void 0 : _a.formatting.date) ?? "";
|
33087
33073
|
}
|
@@ -33090,9 +33076,13 @@ const dataTypes = {
|
|
33090
33076
|
sortingFn: "basic",
|
33091
33077
|
filterComparators: [TableFilterComparator.IsEqualTo, TableFilterComparator.IsNotEqualTo]
|
33092
33078
|
},
|
33093
|
-
//
|
33094
|
-
|
33095
|
-
|
33079
|
+
// numbers
|
33080
|
+
number: createNumberDataType("left"),
|
33081
|
+
amount: createNumberDataType("right", { decimals: 2, useGrouping: true })
|
33082
|
+
};
|
33083
|
+
function createNumberDataType(align, defaultOptions2) {
|
33084
|
+
return {
|
33085
|
+
align,
|
33096
33086
|
sortingFn: "basic",
|
33097
33087
|
filterComparators: [
|
33098
33088
|
TableFilterComparator.IsEqualTo,
|
@@ -33105,19 +33095,38 @@ const dataTypes = {
|
|
33105
33095
|
TableFilterComparator.IsEmpty,
|
33106
33096
|
TableFilterComparator.IsNotEmpty
|
33107
33097
|
],
|
33108
|
-
getDisplayValue: (value, options) => {
|
33109
|
-
var _a;
|
33098
|
+
getDisplayValue: (value, row, options) => {
|
33099
|
+
var _a, _b;
|
33110
33100
|
if (value === void 0) {
|
33111
33101
|
return "";
|
33112
33102
|
}
|
33113
|
-
const
|
33114
|
-
const
|
33115
|
-
|
33116
|
-
|
33103
|
+
const dataTypeOptions = typeof (options == null ? void 0 : options.dataTypeOptions) === "function" ? options == null ? void 0 : options.dataTypeOptions(row) : options == null ? void 0 : options.dataTypeOptions;
|
33104
|
+
const numberFormatOptions = {
|
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)
|
33110
|
+
};
|
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));
|
33117
33126
|
return [localisedValue, localisedValueWithoutThousandsSeperator];
|
33118
33127
|
}
|
33119
|
-
}
|
33120
|
-
}
|
33128
|
+
};
|
33129
|
+
}
|
33121
33130
|
function getDataTypeProperties(dataType) {
|
33122
33131
|
return dataTypes[dataType ?? "text"] ?? dataTypes.text;
|
33123
33132
|
}
|
@@ -33239,7 +33248,7 @@ function columnFilterFn(value, filter2) {
|
|
33239
33248
|
const flattenCellValue = (cellValue) => {
|
33240
33249
|
return typeof cellValue === "object" ? Object.values(cellValue).map(flattenCellValue) : cellValue;
|
33241
33250
|
};
|
33242
|
-
function isMatched(searchQuery, cellValue, dataType, localization) {
|
33251
|
+
function isMatched(searchQuery, cellValue, rowValue, dataType, dataTypeOptions, localization) {
|
33243
33252
|
if (typeof cellValue === "object") {
|
33244
33253
|
return flattenCellValue(cellValue).flat(Infinity).find((y4) => isWeakContains(y4, searchQuery));
|
33245
33254
|
} else {
|
@@ -33249,7 +33258,10 @@ function isMatched(searchQuery, cellValue, dataType, localization) {
|
|
33249
33258
|
} else {
|
33250
33259
|
const dataTypeProperties = getDataTypeProperties(dataType);
|
33251
33260
|
if (dataTypeProperties.getDisplayValue) {
|
33252
|
-
const cellDisplayValue = dataTypeProperties.getDisplayValue(cellValue, {
|
33261
|
+
const cellDisplayValue = dataTypeProperties.getDisplayValue(cellValue, rowValue, {
|
33262
|
+
dataTypeOptions,
|
33263
|
+
localization
|
33264
|
+
});
|
33253
33265
|
if (Array.isArray(cellDisplayValue)) {
|
33254
33266
|
for (const displayValue of cellDisplayValue) {
|
33255
33267
|
if (isWeakContains(displayValue, searchQuery)) {
|
@@ -33265,12 +33277,19 @@ function isMatched(searchQuery, cellValue, dataType, localization) {
|
|
33265
33277
|
return false;
|
33266
33278
|
}
|
33267
33279
|
function globalFilterFn(row, columnId, searchQuery, localization) {
|
33268
|
-
var _a
|
33280
|
+
var _a;
|
33269
33281
|
try {
|
33270
33282
|
if (row.original) {
|
33271
33283
|
const cellValue = row.original[columnId];
|
33272
|
-
const
|
33273
|
-
return isMatched(
|
33284
|
+
const columnMeta = (_a = row._getAllCellsByColumnId()[columnId]) == null ? void 0 : _a.column.columnDef.meta;
|
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
|
+
);
|
33274
33293
|
}
|
33275
33294
|
} catch {
|
33276
33295
|
}
|
@@ -33285,7 +33304,7 @@ function resetHighlightedColumnIndexes(searchQuery, table, localization) {
|
|
33285
33304
|
const rowGrouping = table.getState().grouping;
|
33286
33305
|
table.getRowModel().rows.forEach((row, rowIndex) => {
|
33287
33306
|
columns.forEach((column, columnIndex) => {
|
33288
|
-
var _a;
|
33307
|
+
var _a, _b;
|
33289
33308
|
try {
|
33290
33309
|
let allowSearch = true;
|
33291
33310
|
if (rowGrouping == null ? void 0 : rowGrouping.length) {
|
@@ -33298,7 +33317,8 @@ function resetHighlightedColumnIndexes(searchQuery, table, localization) {
|
|
33298
33317
|
if (column.getIsVisible() && column.columnDef.enableGlobalFilter && allowSearch) {
|
33299
33318
|
const cellValue = get(row.original, column.id);
|
33300
33319
|
const dataType = (_a = column.columnDef.meta) == null ? void 0 : _a.dataType;
|
33301
|
-
|
33320
|
+
const dataTypeOptions = (_b = column.columnDef.meta) == null ? void 0 : _b.dataTypeOptions;
|
33321
|
+
if (isMatched(searchQuery, cellValue, row.original, dataType, dataTypeOptions, localization)) {
|
33302
33322
|
indexes.push([rowIndex, columnIndex]);
|
33303
33323
|
}
|
33304
33324
|
}
|
@@ -33537,9 +33557,12 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
|
|
33537
33557
|
header
|
33538
33558
|
}
|
33539
33559
|
};
|
33540
|
-
const formattedValueRenderer = (value) => {
|
33560
|
+
const formattedValueRenderer = (value, row) => {
|
33541
33561
|
var _a;
|
33542
|
-
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, {
|
33563
|
+
dataTypeOptions: meta.dataTypeOptions,
|
33564
|
+
localization
|
33565
|
+
});
|
33543
33566
|
const safeValue = value !== void 0 && value !== null ? String(value) : value;
|
33544
33567
|
if (Array.isArray(displayValue)) {
|
33545
33568
|
return displayValue[0] ?? safeValue;
|
@@ -33547,14 +33570,14 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
|
|
33547
33570
|
return displayValue ?? safeValue;
|
33548
33571
|
};
|
33549
33572
|
const rendererArgs = (info) => ({
|
33550
|
-
formattedValue: formattedValueRenderer(info.getValue()),
|
33573
|
+
formattedValue: formattedValueRenderer(info.getValue(), info.row.original),
|
33551
33574
|
row: info.row.original,
|
33552
33575
|
value: info.getValue()
|
33553
33576
|
});
|
33554
33577
|
if (typeof renderer2 === "function") {
|
33555
33578
|
column.cell = (info) => renderer2(rendererArgs(info));
|
33556
33579
|
} else {
|
33557
|
-
column.cell = (info) => formattedValueRenderer(info.getValue());
|
33580
|
+
column.cell = (info) => formattedValueRenderer(info.getValue(), info.row.original);
|
33558
33581
|
}
|
33559
33582
|
if (typeof footer === "function") {
|
33560
33583
|
column.footer = (info) => footer(info.table.getRowModel().rows.flatMap((row) => row.original !== void 0 ? row.original : []));
|