@economic/taco 2.65.0 → 2.66.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 +75 -14
- package/dist/taco.cjs.map +1 -1
- package/dist/taco.css +1 -1
- package/dist/taco.d.ts +10 -0
- package/dist/taco.js +75 -14
- package/dist/taco.js.map +1 -1
- package/package.json +2 -2
package/dist/taco.css
CHANGED
@@ -653,7 +653,7 @@ table[data-taco^='table'] tbody {
|
|
653
653
|
/* grid */
|
654
654
|
@apply col-span-full grid auto-rows-min grid-cols-[subgrid];
|
655
655
|
/* printing - override virtualiser bottom spacing */
|
656
|
-
@apply print:!h-auto;
|
656
|
+
@apply print:!contents print:!h-auto;
|
657
657
|
}
|
658
658
|
|
659
659
|
table[data-taco^='table']:has([data-taco='empty-state']) {
|
package/dist/taco.d.ts
CHANGED
@@ -3305,6 +3305,7 @@ export declare type TableCommonProps<TType = unknown> = TableFeatureProps<TType>
|
|
3305
3305
|
onChangeSearch?: TableSearchHandler;
|
3306
3306
|
onChangeSettings?: TableSettingsHandler;
|
3307
3307
|
onChangeSort?: TableSortHandler;
|
3308
|
+
onPrint?: TablePrintHandler;
|
3308
3309
|
};
|
3309
3310
|
|
3310
3311
|
export declare type TableConditionalRowProp<TType = unknown> = boolean | ((row: TType) => boolean);
|
@@ -3398,6 +3399,15 @@ export declare type TableGroupProps = {
|
|
3398
3399
|
|
3399
3400
|
export declare type TablePreset = 'complex' | 'list' | 'simple';
|
3400
3401
|
|
3402
|
+
export declare type TablePrintHandler = (settings: TableSettings, printSettings: TablePrintSettings) => Promise<void>;
|
3403
|
+
|
3404
|
+
export declare type TablePrintSettings = {
|
3405
|
+
allRows: boolean;
|
3406
|
+
orientation: 'portrait' | 'landscape';
|
3407
|
+
size: 'A3' | 'A4' | 'A5' | 'letter' | 'legal';
|
3408
|
+
splitGroups: boolean;
|
3409
|
+
};
|
3410
|
+
|
3401
3411
|
export declare type TableProps<TType = unknown> = TableClientProps<TType> | TableServerProps<TType>;
|
3402
3412
|
|
3403
3413
|
export declare type TableRef = HTMLTableElement & {
|
package/dist/taco.js
CHANGED
@@ -16952,10 +16952,10 @@ const Navbar = React.memo(({ onMonthChange, value = /* @__PURE__ */ new Date() }
|
|
16952
16952
|
onMonthChange(new Date(year.value, month.value));
|
16953
16953
|
};
|
16954
16954
|
const onNextClick = () => {
|
16955
|
-
onMonthChange(new Date(value.getFullYear(), value.getMonth() + 1, value.
|
16955
|
+
onMonthChange(new Date(value.getFullYear(), value.getMonth() + 1, value.getDate()));
|
16956
16956
|
};
|
16957
16957
|
const onPreviousClick = () => {
|
16958
|
-
onMonthChange(new Date(value.getFullYear(), value.getMonth() - 1, value.
|
16958
|
+
onMonthChange(new Date(value.getFullYear(), value.getMonth() - 1, value.getDate()));
|
16959
16959
|
};
|
16960
16960
|
return /* @__PURE__ */ React.createElement("div", { className: "mb-3 flex items-center justify-between" }, /* @__PURE__ */ React.createElement("form", { className: "inline-flex space-x-1" }, /* @__PURE__ */ React.createElement("select", { className: "h-8 px-2", name: "month", onChange: handleChange, value: value.getMonth() }, months.map((month, i2) => /* @__PURE__ */ React.createElement("option", { key: month, value: i2 }, month))), /* @__PURE__ */ React.createElement("select", { className: "h-8 px-2", name: "year", onChange: handleChange, value: value.getFullYear() }, years.map((year) => /* @__PURE__ */ React.createElement("option", { key: year, value: year }, String(year))))), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Tooltip$3, { title: actions.previousMonth }, /* @__PURE__ */ React.createElement(
|
16961
16961
|
IconButton,
|
@@ -25748,6 +25748,13 @@ const Dialog = React.forwardRef(function Dialog2(props, ref) {
|
|
25748
25748
|
}),
|
25749
25749
|
[closeOnEscape, drawerOpen, draggable, drawer, extra, open, otherProps, showCloseButton]
|
25750
25750
|
);
|
25751
|
+
React.useEffect(() => {
|
25752
|
+
const onFocusOut = (event) => {
|
25753
|
+
event.stopImmediatePropagation();
|
25754
|
+
};
|
25755
|
+
document.addEventListener("focusout", onFocusOut);
|
25756
|
+
return () => document.removeEventListener("focusout", onFocusOut);
|
25757
|
+
}, []);
|
25751
25758
|
return /* @__PURE__ */ React.createElement(DialogContext.Provider, { value: context }, /* @__PURE__ */ React.createElement($5d3850c4d0b4e6c7$export$be92b6f5f03c0fe9, { defaultOpen, open, onOpenChange: onChange }, trigger && /* @__PURE__ */ React.createElement(Trigger$4, null, trigger), children));
|
25752
25759
|
});
|
25753
25760
|
Dialog.Trigger = Trigger$4;
|
@@ -26765,7 +26772,17 @@ const DrawerContent = React__default.forwardRef(function Content2(props, externa
|
|
26765
26772
|
style: styleProp
|
26766
26773
|
},
|
26767
26774
|
content
|
26768
|
-
) : /* @__PURE__ */ React__default.createElement(
|
26775
|
+
) : /* @__PURE__ */ React__default.createElement(
|
26776
|
+
UntrappedFocusDrawerContent,
|
26777
|
+
{
|
26778
|
+
...otherProps,
|
26779
|
+
onEscape: handleEscapeKeyDown,
|
26780
|
+
className: contentClassName,
|
26781
|
+
style: styleProp,
|
26782
|
+
ref
|
26783
|
+
},
|
26784
|
+
content
|
26785
|
+
);
|
26769
26786
|
});
|
26770
26787
|
const Content$5 = React__default.forwardRef(function Content3(props, externalRef) {
|
26771
26788
|
const { children } = props;
|
@@ -34840,6 +34857,7 @@ class DateTimeDataType extends DataType {
|
|
34840
34857
|
}
|
34841
34858
|
const dataTypes = {
|
34842
34859
|
auto: {
|
34860
|
+
align: "left",
|
34843
34861
|
sortingFn: "auto",
|
34844
34862
|
filterComparators: [
|
34845
34863
|
TableFilterComparator.Contains,
|
@@ -34852,6 +34870,7 @@ const dataTypes = {
|
|
34852
34870
|
},
|
34853
34871
|
// base
|
34854
34872
|
text: {
|
34873
|
+
align: "left",
|
34855
34874
|
sortingFn: "alphanumeric",
|
34856
34875
|
filterComparators: [
|
34857
34876
|
TableFilterComparator.Contains,
|
@@ -34863,6 +34882,7 @@ const dataTypes = {
|
|
34863
34882
|
]
|
34864
34883
|
},
|
34865
34884
|
boolean: {
|
34885
|
+
align: "left",
|
34866
34886
|
sortingFn: "basic",
|
34867
34887
|
filterComparators: [TableFilterComparator.IsEqualTo, TableFilterComparator.IsNotEqualTo]
|
34868
34888
|
},
|
@@ -34890,6 +34910,7 @@ const dataTypes = {
|
|
34890
34910
|
};
|
34891
34911
|
function createDatetimeDataType(defaultOptions2) {
|
34892
34912
|
return {
|
34913
|
+
align: "left",
|
34893
34914
|
sortingFn: "datetime",
|
34894
34915
|
filterComparators: [
|
34895
34916
|
TableFilterComparator.IsEqualTo,
|
@@ -35853,7 +35874,7 @@ const useLocalStorage = (key, initialValue) => {
|
|
35853
35874
|
};
|
35854
35875
|
return [state, setState, clear];
|
35855
35876
|
};
|
35856
|
-
function useTablePrinting(isEnabled = false, tableId) {
|
35877
|
+
function useTablePrinting(isEnabled = false, tableId, onPrint) {
|
35857
35878
|
const [isPrinting, setIsPrinting] = React__default.useState(false);
|
35858
35879
|
const [settings, setSetting] = useTablePrintingSettings(tableId);
|
35859
35880
|
return {
|
@@ -35861,7 +35882,8 @@ function useTablePrinting(isEnabled = false, tableId) {
|
|
35861
35882
|
isPrinting,
|
35862
35883
|
setIsPrinting,
|
35863
35884
|
settings,
|
35864
|
-
setSetting
|
35885
|
+
setSetting,
|
35886
|
+
onPrint
|
35865
35887
|
};
|
35866
35888
|
}
|
35867
35889
|
const DEFAULT_PRINT_SETTINGS = {
|
@@ -36651,7 +36673,7 @@ function useTableManager(props, ref, meta, internalColumns) {
|
|
36651
36673
|
const columnOrdering = useTableColumnOrdering(options.enableColumnOrdering);
|
36652
36674
|
const fontSize = useTableFontSize(options.enableFontSize, settings.fontSize);
|
36653
36675
|
const footer = useTableFooter(options.enableFooter);
|
36654
|
-
const printing = useTablePrinting(options.enablePrinting, safeId);
|
36676
|
+
const printing = useTablePrinting(options.enablePrinting, safeId, props.onPrint);
|
36655
36677
|
const rowActive = useTableRowActive$1(options.enableRowActive, props.defaultRowActiveIndex);
|
36656
36678
|
const rowActions = useTableRowActions(options.enableRowActions, props.rowActions, props.rowActionsLength);
|
36657
36679
|
const rowClick = useTableRowClick(options.enableRowClick, props.onRowClick);
|
@@ -43539,7 +43561,7 @@ function Item(props) {
|
|
43539
43561
|
}
|
43540
43562
|
Item.displayName = "SortableListItem";
|
43541
43563
|
const Column$3 = React__default.forwardRef(function Column2(props, ref) {
|
43542
|
-
var _a, _b, _c;
|
43564
|
+
var _a, _b, _c, _d;
|
43543
43565
|
const { column, draggable = false, ...dragAttributes } = props;
|
43544
43566
|
const canHide = column.getCanHide();
|
43545
43567
|
const className = clsx("group/column flex items-center gap-x-2 rounded py-1 px-2", {
|
@@ -43550,10 +43572,17 @@ const Column$3 = React__default.forwardRef(function Column2(props, ref) {
|
|
43550
43572
|
const attributes = draggable ? dragAttributes : void 0;
|
43551
43573
|
const isVisible2 = column.getIsVisible();
|
43552
43574
|
const parentHeader = (_b = (_a = column.parent) == null ? void 0 : _a.columnDef) == null ? void 0 : _b.header;
|
43553
|
-
return /* @__PURE__ */ React__default.createElement("div", { ...attributes, className, onClick: () => column.toggleVisibility(!isVisible2), ref }, draggable ? /* @__PURE__ */ React__default.createElement(Icon$1, { name: "drag", className: "text-grey-500 group-hover/column:text-grey-700 -mx-2 !h-5" }) : null, /* @__PURE__ */ React__default.createElement("span", { className: "flex-grow truncate" }, (_c = column.columnDef.meta) == null ? void 0 : _c.header, parentHeader ? /* @__PURE__ */ React__default.createElement("span", { className: "italic" }, "(", parentHeader, ")") : null), canHide ? /* @__PURE__ */ React__default.createElement(
|
43575
|
+
return /* @__PURE__ */ React__default.createElement("div", { ...attributes, className, onClick: () => column.toggleVisibility(!isVisible2), ref }, draggable ? /* @__PURE__ */ React__default.createElement(Icon$1, { name: "drag", className: "text-grey-500 group-hover/column:text-grey-700 -mx-2 !h-5" }) : null, /* @__PURE__ */ React__default.createElement("span", { className: "flex-grow truncate" }, (_c = column.columnDef.meta) == null ? void 0 : _c.header, parentHeader ? /* @__PURE__ */ React__default.createElement("span", { className: "italic" }, "(", parentHeader, ")") : null), canHide ? /* @__PURE__ */ React__default.createElement(
|
43576
|
+
Checkbox$2,
|
43577
|
+
{
|
43578
|
+
"aria-label": (_d = column.columnDef.meta) == null ? void 0 : _d.header,
|
43579
|
+
checked: isVisible2,
|
43580
|
+
onChange: () => column.toggleVisibility(!isVisible2)
|
43581
|
+
}
|
43582
|
+
) : null);
|
43554
43583
|
});
|
43555
43584
|
function HideOrOrderPopover(props) {
|
43556
|
-
const { table, trigger, ...popoverProps } = props;
|
43585
|
+
const { id: id2, table, trigger, ...popoverProps } = props;
|
43557
43586
|
const { texts } = useLocalization();
|
43558
43587
|
const [query, setQuery] = React__default.useState("");
|
43559
43588
|
const allColumns = table.getAllLeafColumns();
|
@@ -43596,7 +43625,7 @@ function HideOrOrderPopover(props) {
|
|
43596
43625
|
}
|
43597
43626
|
}
|
43598
43627
|
};
|
43599
|
-
return /* @__PURE__ */ React__default.createElement(Popover, { ...popoverProps, anchor: trigger }, /* @__PURE__ */ React__default.createElement(Popover.Content,
|
43628
|
+
return /* @__PURE__ */ React__default.createElement(Popover, { ...popoverProps, anchor: trigger }, /* @__PURE__ */ React__default.createElement(Popover.Content, { id: id2 }, /* @__PURE__ */ React__default.createElement("div", { className: "flex min-w-[100px] max-w-sm flex-col gap-2" }, table.options.enableHiding ? /* @__PURE__ */ React__default.createElement(
|
43600
43629
|
Input,
|
43601
43630
|
{
|
43602
43631
|
onChange: (event) => setQuery(event.target.value),
|
@@ -43618,7 +43647,7 @@ function HideOrOrderPopover(props) {
|
|
43618
43647
|
}))) : /* @__PURE__ */ React__default.createElement("div", { className: listClassName }, columns.length ? columns.map((column) => /* @__PURE__ */ React__default.createElement(Column$3, { column, key: column.id })) : texts.table.columnSettings.noResults))));
|
43619
43648
|
}
|
43620
43649
|
function Settings(props) {
|
43621
|
-
const { customSettings, table } = props;
|
43650
|
+
const { customSettings, id: id2, table } = props;
|
43622
43651
|
const { texts } = useLocalization();
|
43623
43652
|
const tableMeta = table.options.meta;
|
43624
43653
|
const canHideOrOrder = table.options.enableHiding || tableMeta.columnOrdering.isEnabled;
|
@@ -43631,7 +43660,16 @@ function Settings(props) {
|
|
43631
43660
|
switch (popover) {
|
43632
43661
|
case "columnSettings": {
|
43633
43662
|
if (canHideOrOrder) {
|
43634
|
-
popoverElement = (popoverProps) => /* @__PURE__ */ React__default.createElement(
|
43663
|
+
popoverElement = (popoverProps) => /* @__PURE__ */ React__default.createElement(
|
43664
|
+
HideOrOrderPopover,
|
43665
|
+
{
|
43666
|
+
...popoverProps,
|
43667
|
+
id: `${id2}-columnSettings`,
|
43668
|
+
open: true,
|
43669
|
+
onChange: handleClosePopover,
|
43670
|
+
table
|
43671
|
+
}
|
43672
|
+
);
|
43635
43673
|
}
|
43636
43674
|
}
|
43637
43675
|
}
|
@@ -43640,8 +43678,17 @@ function Settings(props) {
|
|
43640
43678
|
IconButton,
|
43641
43679
|
{
|
43642
43680
|
"aria-label": texts.table.otherOptions.tooltip,
|
43681
|
+
id: id2,
|
43643
43682
|
icon: "sliders",
|
43644
|
-
menu: popoverElement ? void 0 : (menuProps) => /* @__PURE__ */ React__default.createElement(Menu$1, { ...menuProps }, /* @__PURE__ */ React__default.createElement(Menu$1.Content, { align: "end" }, canHideOrOrder ? /* @__PURE__ */ React__default.createElement(
|
43683
|
+
menu: popoverElement ? void 0 : (menuProps) => /* @__PURE__ */ React__default.createElement(Menu$1, { ...menuProps }, /* @__PURE__ */ React__default.createElement(Menu$1.Content, { align: "end" }, canHideOrOrder ? /* @__PURE__ */ React__default.createElement(
|
43684
|
+
Menu$1.Item,
|
43685
|
+
{
|
43686
|
+
"aria-controls": `${id2}-columnSettings`,
|
43687
|
+
icon: "columns",
|
43688
|
+
onClick: () => setPopover("columnSettings")
|
43689
|
+
},
|
43690
|
+
texts.table.columnSettings.button
|
43691
|
+
) : null, canHideOrOrder && (canChangeRowHeight || canChangeFontSize || customSettings) ? /* @__PURE__ */ React__default.createElement(Menu$1.Separator, null) : null, canChangeRowHeight ? /* @__PURE__ */ React__default.createElement(
|
43645
43692
|
Menu$1.Item,
|
43646
43693
|
{
|
43647
43694
|
icon: `height-${tableMeta.rowHeight.height}`,
|
@@ -45050,6 +45097,17 @@ function Print(props) {
|
|
45050
45097
|
}, []);
|
45051
45098
|
const print = async () => {
|
45052
45099
|
const toastRef = toast.loading(texts.table.print.loading);
|
45100
|
+
if (tableMeta.printing.onPrint) {
|
45101
|
+
try {
|
45102
|
+
await tableMeta.printing.onPrint(getSettings(table), tableMeta.printing.settings);
|
45103
|
+
toastRef.close();
|
45104
|
+
} catch (error) {
|
45105
|
+
const errorMessage = `${texts.table.print.error}: ${error}`;
|
45106
|
+
console.error(errorMessage);
|
45107
|
+
toastRef.error(errorMessage);
|
45108
|
+
}
|
45109
|
+
return;
|
45110
|
+
}
|
45053
45111
|
if (tableMeta.server.isEnabled && tableMeta.server.loadAllIfNeeded) {
|
45054
45112
|
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
45055
45113
|
try {
|
@@ -45554,15 +45612,17 @@ function TableToolbar(props) {
|
|
45554
45612
|
const canPrint = table.meta.printing.isEnabled;
|
45555
45613
|
const canSettings = canChangeSettings(table.instance, table.props.customSettings);
|
45556
45614
|
const canSearch = table.meta.search.isEnabled;
|
45615
|
+
const id2 = `${table.id}-toolbar`;
|
45557
45616
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
45558
45617
|
"div",
|
45559
45618
|
{
|
45560
45619
|
...attributes,
|
45620
|
+
id: id2,
|
45561
45621
|
className: "mb-4 flex flex-shrink flex-grow-0 flex-wrap gap-2 print:hidden",
|
45562
45622
|
"data-taco": "table-toolbar"
|
45563
45623
|
},
|
45564
45624
|
table.props.toolbarLeft,
|
45565
|
-
/* @__PURE__ */ React__default.createElement(Group$6, { className: "ml-auto flex-shrink-0 items-center print:hidden" }, customTools, canFilter ? /* @__PURE__ */ React__default.createElement(Filters, { length: table.meta.length, table: table.instance }) : null, table.props.toolbarRight, canPrint ? /* @__PURE__ */ React__default.createElement(Print, { table: table.instance, tableId: table.id, tableRef: table.ref }) : null, canSettings ? /* @__PURE__ */ React__default.createElement(Settings, { customSettings: table.props.customSettings, table: table.instance }) : null, canSearch ? /* @__PURE__ */ React__default.createElement(Search$1, { scrollToIndex: table.renderer.scrollToIndex, table: table.instance, tableRef: table.ref }) : null)
|
45625
|
+
/* @__PURE__ */ React__default.createElement(Group$6, { className: "ml-auto flex-shrink-0 items-center print:hidden" }, customTools, canFilter ? /* @__PURE__ */ React__default.createElement(Filters, { length: table.meta.length, table: table.instance }) : null, table.props.toolbarRight, canPrint ? /* @__PURE__ */ React__default.createElement(Print, { table: table.instance, tableId: table.id, tableRef: table.ref }) : null, canSettings ? /* @__PURE__ */ React__default.createElement(Settings, { customSettings: table.props.customSettings, id: `${id2}-settings`, table: table.instance }) : null, canSearch ? /* @__PURE__ */ React__default.createElement(Search$1, { scrollToIndex: table.renderer.scrollToIndex, table: table.instance, tableRef: table.ref }) : null)
|
45566
45626
|
), table.props.toolbarPanel ? /* @__PURE__ */ React__default.createElement("div", { className: "mb-4" }, table.props.toolbarPanel) : void 0);
|
45567
45627
|
}
|
45568
45628
|
function canChangeSettings(table, customSettings) {
|
@@ -45603,6 +45663,7 @@ function TableGrid(props) {
|
|
45603
45663
|
{
|
45604
45664
|
...attributes,
|
45605
45665
|
id: table.id,
|
45666
|
+
"aria-owns": `${table.id}-toolbar`,
|
45606
45667
|
"data-table-font-size": table.meta.fontSize.size,
|
45607
45668
|
"data-table-grouped": !!((_a = table.state.grouping) == null ? void 0 : _a.length),
|
45608
45669
|
"data-table-horizontally-scrolled": table.meta.columnFreezing.isHorizontallyScrolled ? true : void 0,
|