@economic/taco 2.58.1 → 2.58.2-EC-64962.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 +20 -27
- package/dist/taco.cjs.map +1 -1
- package/dist/taco.d.ts +48 -38
- package/dist/taco.js +20 -27
- package/dist/taco.js.map +1 -1
- package/package.json +2 -2
package/dist/taco.d.ts
CHANGED
@@ -3150,49 +3150,62 @@ export declare type TableColumnDataType = 'text' | 'number' | 'datetime' | 'bool
|
|
3150
3150
|
|
3151
3151
|
export declare type TableColumnFilter = ColumnFilter;
|
3152
3152
|
|
3153
|
-
export declare type
|
3154
|
-
|
3155
|
-
export declare type TableColumnProps<TType = unknown> = ValueOf<{
|
3153
|
+
export declare type TableColumnIdentifierProps<TType = unknown> = {
|
3156
3154
|
[Key in keyof TType]: {
|
3157
|
-
accessor
|
3158
|
-
id
|
3155
|
+
accessor: Key;
|
3156
|
+
id?: string;
|
3159
3157
|
renderer?: TableColumnRenderer<TType, TType[Key]>;
|
3160
|
-
/** Renderer to use if the cell is an aggregate cell and part of a grouped row */
|
3161
3158
|
aggregate?: TableColumnRendererAggregate<TType, TType[Key]>;
|
3162
|
-
control?: TableColumnRendererControl<TType>;
|
3163
|
-
footer?: TableColumnRendererFooter<TType>;
|
3164
|
-
header: TableColumnRendererHeader;
|
3165
|
-
/** Aggregation function to be used when the column is part of a grouped row */
|
3166
|
-
aggregationFn?: 'auto' | BuiltInAggregationFn;
|
3167
|
-
align?: TableColumnAlignment;
|
3168
|
-
className?: TableColumnClassNameHandler<TType>;
|
3169
|
-
dataType?: TableColumnDataType;
|
3170
|
-
defaultHidden?: boolean;
|
3171
|
-
defaultWidth?: TableColumnWidth;
|
3172
|
-
enableEditing?: boolean;
|
3173
|
-
enableFiltering?: boolean;
|
3174
|
-
enableGrouping?: boolean;
|
3175
|
-
enableHiding?: boolean;
|
3176
|
-
enableOrdering?: boolean;
|
3177
|
-
enablePrinting?: boolean;
|
3178
|
-
enableResizing?: boolean;
|
3179
|
-
enableSearch?: boolean;
|
3180
|
-
enableSorting?: boolean;
|
3181
|
-
enableTruncate?: boolean;
|
3182
|
-
filters?: TableFilterComparator[];
|
3183
|
-
headerClassName?: string;
|
3184
|
-
menu?: TableColumnMenu;
|
3185
|
-
minWidth?: number;
|
3186
|
-
sort?: TableColumnSortDirection;
|
3187
|
-
sortFn?: TableColumnSortFn<TType>;
|
3188
|
-
tooltip?: string;
|
3189
3159
|
};
|
3190
|
-
}
|
3160
|
+
}[keyof TType] | {
|
3161
|
+
accessor?: never;
|
3162
|
+
id: string;
|
3163
|
+
renderer?: TableColumnRenderer<TType, unknown>;
|
3164
|
+
aggregate?: TableColumnRendererAggregate<TType, unknown>;
|
3165
|
+
};
|
3166
|
+
|
3167
|
+
export declare type TableColumnMenu = ((columnId: string) => React.ReactNode | null)[];
|
3168
|
+
|
3169
|
+
export declare type TableColumnProps<TType = unknown> = TableColumnIdentifierProps<TType> & {
|
3170
|
+
control?: TableColumnRendererControl<TType>;
|
3171
|
+
footer?: TableColumnRendererFooter<TType>;
|
3172
|
+
header: TableColumnRendererHeader;
|
3173
|
+
/** Aggregation function to be used when the column is part of a grouped row */
|
3174
|
+
aggregationFn?: 'auto' | BuiltInAggregationFn;
|
3175
|
+
align?: TableColumnAlignment;
|
3176
|
+
className?: TableColumnClassNameHandler<TType>;
|
3177
|
+
dataType?: TableColumnDataType;
|
3178
|
+
defaultHidden?: boolean;
|
3179
|
+
defaultWidth?: TableColumnWidth;
|
3180
|
+
enableEditing?: boolean;
|
3181
|
+
enableFiltering?: boolean;
|
3182
|
+
enableGrouping?: boolean;
|
3183
|
+
enableHiding?: boolean;
|
3184
|
+
enableOrdering?: boolean;
|
3185
|
+
enablePrinting?: boolean;
|
3186
|
+
enableResizing?: boolean;
|
3187
|
+
enableSearch?: boolean;
|
3188
|
+
enableSorting?: boolean;
|
3189
|
+
enableTruncate?: boolean;
|
3190
|
+
filters?: TableFilterComparator[];
|
3191
|
+
headerClassName?: string;
|
3192
|
+
menu?: TableColumnMenu;
|
3193
|
+
minWidth?: number;
|
3194
|
+
sort?: TableColumnSortDirection;
|
3195
|
+
sortFn?: TableColumnSortFn<TType>;
|
3196
|
+
tooltip?: string;
|
3197
|
+
};
|
3191
3198
|
|
3192
|
-
export declare type TableColumnRenderer<TType, TValue> = (
|
3199
|
+
export declare type TableColumnRenderer<TType, TValue = unknown> = (args: TableColumnRendererArgs<TType, TValue>) => JSX.Element | string | number | unknown | null;
|
3193
3200
|
|
3194
3201
|
export declare type TableColumnRendererAggregate<TType, TValue> = (value: TValue, row: TType) => JSX.Element | string | number | null;
|
3195
3202
|
|
3203
|
+
export declare type TableColumnRendererArgs<TType, TValue> = {
|
3204
|
+
formattedValue: string;
|
3205
|
+
row: TType;
|
3206
|
+
value: TValue;
|
3207
|
+
};
|
3208
|
+
|
3196
3209
|
export declare type TableColumnRendererControl<TType = unknown> = ((props: TableColumnRendererControlProps, row?: TType, filterState?: TableFilter[]) => JSX.Element) | 'datepicker' | 'input' | 'switch' | 'checkbox' | 'textarea';
|
3197
3210
|
|
3198
3211
|
export declare type TableColumnRendererControlProps = {
|
@@ -3991,8 +4004,6 @@ export declare const useTableRowCreation: <TRow extends {}>(data: Row<TRow>[], t
|
|
3991
4004
|
|
3992
4005
|
export declare const useToast: () => Toaster<ToastReference>;
|
3993
4006
|
|
3994
|
-
export declare type ValueOf<T> = T[keyof T];
|
3995
|
-
|
3996
4007
|
export declare const VisuallyHidden: React_2.ForwardRefExoticComponent<Props & React_2.RefAttributes<HTMLSpanElement>>;
|
3997
4008
|
|
3998
4009
|
export declare const WindowedTable: ForwardedGenericTableWithStatics;
|
@@ -4045,7 +4056,6 @@ declare module '@tanstack/table-core' {
|
|
4045
4056
|
header: string;
|
4046
4057
|
headerClassName?: string;
|
4047
4058
|
menu?: TableColumnMenu;
|
4048
|
-
renderer?: TableColumnRenderer<TValue, TData>;
|
4049
4059
|
tooltip?: string;
|
4050
4060
|
}
|
4051
4061
|
}
|
package/dist/taco.js
CHANGED
@@ -33516,23 +33516,27 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
|
|
33516
33516
|
enablePrinting,
|
33517
33517
|
enableTruncate,
|
33518
33518
|
enableEditing,
|
33519
|
-
header
|
33520
|
-
renderer: renderer2
|
33519
|
+
header
|
33521
33520
|
}
|
33522
33521
|
};
|
33522
|
+
const formattedValueRenderer = (value) => {
|
33523
|
+
var _a;
|
33524
|
+
const displayValue = (_a = dataTypeProperties.getDisplayValue) == null ? void 0 : _a.call(dataTypeProperties, value, { localization });
|
33525
|
+
const safeValue = value !== void 0 && value !== null ? String(value) : value;
|
33526
|
+
if (Array.isArray(displayValue)) {
|
33527
|
+
return displayValue[0] ?? safeValue;
|
33528
|
+
}
|
33529
|
+
return displayValue ?? safeValue;
|
33530
|
+
};
|
33531
|
+
const rendererArgs = (info) => ({
|
33532
|
+
formattedValue: formattedValueRenderer(info.getValue()),
|
33533
|
+
row: info.row.original,
|
33534
|
+
value: info.getValue()
|
33535
|
+
});
|
33523
33536
|
if (typeof renderer2 === "function") {
|
33524
|
-
column.cell = (info) => renderer2(
|
33525
|
-
} else
|
33526
|
-
|
33527
|
-
var _a;
|
33528
|
-
const displayValue = (_a = dataTypeProperties.getDisplayValue) == null ? void 0 : _a.call(dataTypeProperties, value, { localization });
|
33529
|
-
if (Array.isArray(displayValue)) {
|
33530
|
-
return displayValue[0] ?? value;
|
33531
|
-
}
|
33532
|
-
return displayValue ?? value;
|
33533
|
-
};
|
33534
|
-
column.cell = (info) => dataTypeRenderer(info.getValue());
|
33535
|
-
column.meta.renderer = dataTypeRenderer;
|
33537
|
+
column.cell = (info) => renderer2(rendererArgs(info));
|
33538
|
+
} else {
|
33539
|
+
column.cell = (info) => formattedValueRenderer(info.getValue());
|
33536
33540
|
}
|
33537
33541
|
if (typeof footer === "function") {
|
33538
33542
|
column.footer = (info) => footer(info.table.getRowModel().rows.flatMap((row) => row.original !== void 0 ? row.original : []));
|
@@ -36440,17 +36444,14 @@ function useSearchHighlighting(cell, cellIndex, ref) {
|
|
36440
36444
|
return isHighlighted;
|
36441
36445
|
}
|
36442
36446
|
function GroupedCell(props) {
|
36443
|
-
var _a;
|
36444
36447
|
const { cell, cellRef, index: index2, isHighlighted } = props;
|
36445
36448
|
const { table } = cell.getContext();
|
36446
36449
|
const tableMeta = table.options.meta;
|
36447
|
-
const columnMeta = cell.column.columnDef.meta;
|
36448
36450
|
const attributes = getCellAttributes(cell, index2, isHighlighted);
|
36449
36451
|
const { isHovered, rowIndex } = React__default.useContext(RowContext);
|
36450
36452
|
const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;
|
36451
36453
|
const canShowActions = isActiveRow || isHovered && !tableMeta.rowActive.isHoverStatePaused;
|
36452
36454
|
const colSpan = cell.row.getVisibleCells().filter((c3) => c3.column.id === "__actions" || !isInternalColumn(c3.column.id)).length - 1;
|
36453
|
-
const content = ((_a = columnMeta.renderer) == null ? void 0 : _a.call(columnMeta, cell.getValue(), cell.row.original)) ?? cell.getValue() ?? null;
|
36454
36455
|
const subRows = cell.getContext().row.subRows.map((row) => row.original);
|
36455
36456
|
return /* @__PURE__ */ React__default.createElement(
|
36456
36457
|
MemoedGroupedCell,
|
@@ -36464,7 +36465,7 @@ function GroupedCell(props) {
|
|
36464
36465
|
subRows,
|
36465
36466
|
table
|
36466
36467
|
},
|
36467
|
-
|
36468
|
+
flexRender(cell.column.columnDef.cell, cell.getContext())
|
36468
36469
|
);
|
36469
36470
|
}
|
36470
36471
|
const MemoedGroupedCell = React__default.memo(function MemoedGroupedCell2(props) {
|
@@ -36610,19 +36611,11 @@ const DisplayRow = React__default.memo(function DisplayRow2(props) {
|
|
36610
36611
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("tr", { ...attributes, className, ref }, children, row.getVisibleCells().filter((cell) => !(isGrouped && cell.column.id === "__actions")).map((cell, cellIndex) => /* @__PURE__ */ React__default.createElement(Cell$2, { key: cell.id, cell, index: cellIndex, renderer: CellRenderer }))), expandedRow ? /* @__PURE__ */ React__default.createElement("tr", { "data-row-parent-id": row.id, ref: expansionRef }, /* @__PURE__ */ React__default.createElement("td", { className: "col-span-full" }, expandedRow)) : null);
|
36611
36612
|
});
|
36612
36613
|
function DisplayCell(props) {
|
36613
|
-
var _a;
|
36614
36614
|
const { cell, cellRef, index: index2, isHighlighted, ...cellAttributes } = props;
|
36615
36615
|
const columnMeta = cell.column.columnDef.meta;
|
36616
36616
|
const attributes = getCellAttributes(cell, index2, isHighlighted);
|
36617
36617
|
const isTruncated = !!columnMeta.enableTruncate;
|
36618
|
-
|
36619
|
-
let content;
|
36620
|
-
if (isInternalColumn(cell.column.id)) {
|
36621
|
-
content = flexRender(cell.column.columnDef.cell, cell.getContext());
|
36622
|
-
} else {
|
36623
|
-
content = ((_a = columnMeta.renderer) == null ? void 0 : _a.call(columnMeta, value, cell.row.original)) ?? value ?? null;
|
36624
|
-
}
|
36625
|
-
return /* @__PURE__ */ React__default.createElement(MemoedDisplayCell, { ...cellAttributes, ...attributes, cellRef, isTruncated }, content);
|
36618
|
+
return /* @__PURE__ */ React__default.createElement(MemoedDisplayCell, { ...cellAttributes, ...attributes, cellRef, isTruncated }, flexRender(cell.column.columnDef.cell, cell.getContext()));
|
36626
36619
|
}
|
36627
36620
|
const MemoedDisplayCell = React__default.memo(function MemoedDisplayCell2(props) {
|
36628
36621
|
const { cellRef, children, isTruncated, ...cellAttributes } = props;
|