@economic/taco 2.58.2-EC-64961.1 → 2.58.2-EC-64961.3

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.d.ts CHANGED
@@ -3146,7 +3146,7 @@ export declare type TableColumnAlignment = 'left' | 'center' | 'right';
3146
3146
 
3147
3147
  export declare type TableColumnClassNameHandler<TType = unknown> = string | ((row: TType) => string | undefined);
3148
3148
 
3149
- export declare type TableColumnDataType = 'text' | 'number' | 'datetime' | 'boolean' | 'amount';
3149
+ export declare type TableColumnDataType = 'text' | 'boolean' | 'date' | 'time' | 'datetime' | 'number' | 'amount' | 'percentage';
3150
3150
 
3151
3151
  export declare type TableColumnDataTypeOptions = {
3152
3152
  currency?: string;
@@ -3163,7 +3163,10 @@ export declare type TableColumnDataTypeProps<TType = unknown> = {
3163
3163
  dataType?: 'amount';
3164
3164
  dataTypeOptions?: TableColumnDataTypeOptionsHandler<TType, Pick<TableColumnDataTypeOptions, 'currency'>>;
3165
3165
  } | {
3166
- dataType?: Omit<TableColumnDataType, 'number' | 'amount'>;
3166
+ dataType?: 'percentage';
3167
+ dataTypeOptions?: TableColumnDataTypeOptionsHandler<TType, Pick<TableColumnDataTypeOptions, 'decimals' | 'useGrouping'>>;
3168
+ } | {
3169
+ dataType?: Omit<TableColumnDataType, 'number' | 'amount' | 'percentage'>;
3167
3170
  dataTypeOptions?: never;
3168
3171
  };
3169
3172
 
package/dist/taco.js CHANGED
@@ -33036,7 +33036,34 @@ const dataTypes = {
33036
33036
  TableFilterComparator.IsNotEmpty
33037
33037
  ]
33038
33038
  },
33039
- datetime: {
33039
+ boolean: {
33040
+ sortingFn: "basic",
33041
+ filterComparators: [TableFilterComparator.IsEqualTo, TableFilterComparator.IsNotEqualTo]
33042
+ },
33043
+ // dates
33044
+ date: createDatetimeDataType({
33045
+ day: "2-digit",
33046
+ month: "2-digit",
33047
+ year: "2-digit"
33048
+ }),
33049
+ time: createDatetimeDataType({
33050
+ hour: "2-digit",
33051
+ minute: "2-digit"
33052
+ }),
33053
+ datetime: createDatetimeDataType({
33054
+ day: "2-digit",
33055
+ month: "2-digit",
33056
+ year: "2-digit",
33057
+ hour: "2-digit",
33058
+ minute: "2-digit"
33059
+ }),
33060
+ // numbers
33061
+ number: createNumberDataType("left"),
33062
+ amount: createNumberDataType("right", { decimals: 2, useGrouping: true }),
33063
+ percentage: createNumberDataType("right", { useGrouping: true, percent: true })
33064
+ };
33065
+ function createDatetimeDataType(defaultOptions2) {
33066
+ return {
33040
33067
  sortingFn: "datetime",
33041
33068
  filterComparators: [
33042
33069
  TableFilterComparator.IsEqualTo,
@@ -33049,19 +33076,17 @@ const dataTypes = {
33049
33076
  TableFilterComparator.IsEmpty,
33050
33077
  TableFilterComparator.IsNotEmpty
33051
33078
  ],
33052
- getDisplayValue: (value, _1, options) => {
33079
+ getDisplayValue: (value, row, options) => {
33053
33080
  var _a;
33054
- return format$1(value, (_a = options == null ? void 0 : options.localization) == null ? void 0 : _a.formatting.date) ?? "";
33081
+ if (value === void 0) {
33082
+ return "";
33083
+ }
33084
+ return new Intl.DateTimeFormat((_a = options == null ? void 0 : options.localization) == null ? void 0 : _a.locale, defaultOptions2).format(
33085
+ typeof value === "string" ? Date.parse(value) : value
33086
+ );
33055
33087
  }
33056
- },
33057
- boolean: {
33058
- sortingFn: "basic",
33059
- filterComparators: [TableFilterComparator.IsEqualTo, TableFilterComparator.IsNotEqualTo]
33060
- },
33061
- // numbers
33062
- number: createNumberDataType("left"),
33063
- amount: createNumberDataType("right", { decimals: 2, useGrouping: true })
33064
- };
33088
+ };
33089
+ }
33065
33090
  function createNumberDataType(align, defaultOptions2) {
33066
33091
  return {
33067
33092
  align,
@@ -33090,7 +33115,9 @@ function createNumberDataType(align, defaultOptions2) {
33090
33115
  minimumFractionDigits: (dataTypeOptions == null ? void 0 : dataTypeOptions.decimals) ?? (defaultOptions2 == null ? void 0 : defaultOptions2.decimals),
33091
33116
  maximumFractionDigits: (dataTypeOptions == null ? void 0 : dataTypeOptions.decimals) ?? (defaultOptions2 == null ? void 0 : defaultOptions2.decimals)
33092
33117
  };
33093
- if (dataTypeOptions == null ? void 0 : dataTypeOptions.currency) {
33118
+ if (defaultOptions2 == null ? void 0 : defaultOptions2.percent) {
33119
+ numberFormatOptions.style = "percent";
33120
+ } else if (dataTypeOptions == null ? void 0 : dataTypeOptions.currency) {
33094
33121
  numberFormatOptions.style = "currency";
33095
33122
  numberFormatOptions.currency = dataTypeOptions.currency;
33096
33123
  numberFormatOptions.currencyDisplay = "code";