@economic/taco 2.1.2 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Provider/Localization.d.ts +7 -0
- package/dist/components/Table3/components/toolbar/PrintButton/WarningDialog.d.ts +8 -0
- package/dist/components/Table3/hooks/features/usePrinting.d.ts +4 -1
- package/dist/components/Table3/types.d.ts +8 -0
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +8 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +3 -1
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js +48 -6
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/WarningDialog.js +56 -0
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/WarningDialog.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/hooks/useParentStylesheets.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/hooks/useParentStylesheets.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePrinting.js +7 -2
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePrinting.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js +2 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +9 -9
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/keyboard.js +11 -11
- package/dist/esm/packages/taco/src/utils/keyboard.js.map +1 -1
- package/dist/taco.cjs.development.js +133 -33
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +2 -2
- package/types.json +6076 -5318
@@ -361,6 +361,13 @@ export declare const defaultLocalisationTexts: {
|
|
361
361
|
error: string;
|
362
362
|
loading: string;
|
363
363
|
tooltip: string;
|
364
|
+
warningDialog: {
|
365
|
+
title: string;
|
366
|
+
description: string;
|
367
|
+
checkboxVisibilityLabel: string;
|
368
|
+
cancelButtonText: string;
|
369
|
+
printButtonText: string;
|
370
|
+
};
|
364
371
|
};
|
365
372
|
rowHeight: {
|
366
373
|
tooltip: string;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { DialogProps } from '../../../../Dialog/Dialog';
|
3
|
+
export declare type WarningDialogProps = Omit<DialogProps, 'children' | 'onClose'> & {
|
4
|
+
onAccept: () => void;
|
5
|
+
onClose: () => void;
|
6
|
+
onVisibilityChange: React.Dispatch<React.SetStateAction<boolean>>;
|
7
|
+
};
|
8
|
+
export declare const WarningDialog: ({ onAccept, onClose, onVisibilityChange, ...props }: WarningDialogProps) => JSX.Element;
|
@@ -1,5 +1,8 @@
|
|
1
|
+
import React from 'react';
|
1
2
|
import { Table3LoadAllHandler } from '../../types';
|
2
|
-
export declare function usePrinting(isEnabled: boolean, loadAll?: Table3LoadAllHandler): {
|
3
|
+
export declare function usePrinting(isEnabled: boolean, loadAll?: Table3LoadAllHandler, showWarningWhenPrintingLargeDataset?: boolean): {
|
3
4
|
isEnabled: boolean;
|
4
5
|
loadAll: Table3LoadAllHandler | undefined;
|
6
|
+
printWarningDialogVisibility: boolean;
|
7
|
+
setPrintWarningDialogVisibility: React.Dispatch<React.SetStateAction<boolean>>;
|
5
8
|
};
|
@@ -67,6 +67,7 @@ export declare type Table3Settings = {
|
|
67
67
|
columnSizing?: ColumnSizingState;
|
68
68
|
columnVisibility?: VisibilityState;
|
69
69
|
excludeUnmatchedRecordsInSearch?: boolean;
|
70
|
+
showWarningWhenPrintingLargeDataset?: boolean;
|
70
71
|
fontSize?: Table3FontSize;
|
71
72
|
rowHeight?: Table3RowHeight;
|
72
73
|
sorting?: SortingState;
|
@@ -296,6 +297,13 @@ export declare type Table3Texts = {
|
|
296
297
|
error: string;
|
297
298
|
loading: string;
|
298
299
|
tooltip: string;
|
300
|
+
warningDialog: {
|
301
|
+
title: string;
|
302
|
+
description: string;
|
303
|
+
checkboxVisibilityLabel: string;
|
304
|
+
cancelButtonText: string;
|
305
|
+
printButtonText: string;
|
306
|
+
};
|
299
307
|
};
|
300
308
|
rowHeight: {
|
301
309
|
tooltip: string;
|
@@ -290,7 +290,14 @@ const defaultLocalisationTexts = {
|
|
290
290
|
print: {
|
291
291
|
error: 'An error occurred while creating a print preview',
|
292
292
|
loading: 'Creating a print preview',
|
293
|
-
tooltip: 'Print'
|
293
|
+
tooltip: 'Print',
|
294
|
+
warningDialog: {
|
295
|
+
title: 'Extra loading time',
|
296
|
+
description: 'Please note that printing a large amount of data may result in a slightly longer waiting time due to data loading.',
|
297
|
+
checkboxVisibilityLabel: "Don't show again",
|
298
|
+
cancelButtonText: 'Cancel',
|
299
|
+
printButtonText: 'Print'
|
300
|
+
}
|
294
301
|
},
|
295
302
|
rowHeight: {
|
296
303
|
tooltip: 'Row height',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Localization.js","sources":["../../../../../../../src/components/Provider/Localization.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Locale } from '../../types';\nimport { CalendarTexts } from '../Calendar/Calendar';\nimport { ComboboxTexts } from '../Combobox/Combobox';\nimport { DialogTexts } from '../Dialog/Dialog';\nimport { PaginationTexts } from '../Pagination/Pagination';\nimport { ListboxTexts } from '../Listbox/Listbox';\nimport { ToastsTexts } from '../Toast/Toast';\nimport { DatepickerTexts } from '../Datepicker/Datepicker';\nimport { HeaderTexts } from '../Header/Header';\nimport { HangerTexts } from '../Hanger/Hanger';\nimport { SelectTexts } from '../Select/Select';\nimport { TourTexts } from '../Tour/Tour';\nimport { TableTexts } from '../Table/Table';\nimport { Table2Texts } from '../Table2/Table2';\nimport { Table3Texts } from '../Table3/types';\nimport { SearchInputTexts } from '../SearchInput/SearchInput';\nimport { Select2Texts } from '../Select2/Select2';\nimport { BannerTexts } from '../Banner/Banner';\nimport { DrawerTexts } from '../Drawer/Drawer';\n\nexport type LocalizationTexts = {\n /** Localized texts and aria-labels for [Banner](component:banner) component */\n banner: BannerTexts;\n /** Localized texts and aria-labels for [Calendar](component:calendar) component */\n calendar: CalendarTexts;\n /** Localized texts and aria-labels for [Combobox](component:combobox) component */\n combobox: ComboboxTexts;\n /** Localized texts and aria-labels for [DatePicker](component:datepicker) component */\n datepicker: DatepickerTexts;\n /** Localized texts and aria-labels for [Dialog](component:dialog) component */\n dialog: DialogTexts;\n /** Localized texts and aria-labels for [Hanger](component:hanger) component */\n hanger: HangerTexts;\n /** Localized texts and aria-labels for [Header](component:header) component */\n header: HeaderTexts;\n /** Localized texts and aria-labels for [Listbox](component:listbox) component */\n listbox: ListboxTexts;\n /** Localized texts and aria-labels for [Pagination](component:pagination) component */\n pagination: PaginationTexts;\n /** Localized texts and aria-labels for [Table](component:table) component */\n table: TableTexts;\n /** Localized texts and aria-labels for [Table2](component:table2) component */\n table2: Table2Texts;\n /** Localized texts and aria-labels for [Table3](component:table3) component */\n table3: Table3Texts;\n /** Localized texts and aria-labels for [SearchInput](component:searchinput) component */\n searchInput: SearchInputTexts;\n /** Localized texts and aria-labels for [Select](component:select) component */\n select: SelectTexts;\n /** Localized texts and aria-labels for [Select2](component:select2) component */\n select2: Select2Texts;\n /** Localized texts and aria-labels for [Toast](component:toast) component */\n toasts: ToastsTexts;\n /** Localized texts and aria-labels for [Tour](component:tour) component */\n tour: TourTexts;\n /** Localized texts and aria-labels for [Drawer](component:drawer) component */\n drawer: DrawerTexts;\n};\n\nexport type Localization = {\n /**\n * Provide the language code used in application.\n * Default value is `en-GB`\n */\n locale: Locale;\n /** Provide the texts and aria-labels for components used within the provider */\n texts: LocalizationTexts;\n /** Provide the formatting */\n formatting: {\n /** Default value is `dd.mm.yy` */\n date: string;\n };\n};\n\nexport const defaultLocalisationTexts = {\n banner: {\n close: 'Close',\n },\n calendar: {\n months: [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n ],\n weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n actions: {\n previousMonth: 'Previous month',\n nextMonth: 'Next month',\n previousYear: 'Previous year',\n nextYear: 'Next year',\n today: 'Today',\n },\n },\n combobox: {\n tooltip: 'Search in list',\n },\n datepicker: {\n calendar: 'Calendar',\n clear: 'Clear',\n expand: 'Show calendar',\n shortcuts: 'Shortcuts',\n },\n dialog: {\n close: 'Close',\n drag: 'Drag',\n },\n hanger: {\n close: 'Close',\n },\n header: {\n addAgreement: 'Add agreement',\n logout: 'Log off',\n more: 'More',\n new: 'New',\n search: 'Search for agreement...',\n },\n listbox: {\n loading: 'Loading results...',\n empty: 'No results found',\n allOption: 'All',\n },\n pagination: {\n label: 'Pagination',\n pageSize: 'Items per page',\n showingXofYofTotal: 'Showing [X] - [Y] of [total]',\n actions: {\n firstPage: 'Goto first page',\n firstPageWithShortcut: 'Goto first page (Home)',\n previousPage: 'Goto previous page',\n previousPageWithShortcut: 'Goto previous page (Page Up)',\n nextPage: 'Goto next page',\n nextPageWithShortcut: 'Goto next page (Page Down)',\n lastPage: 'Goto last page',\n lastPageWithShortcut: 'Goto last page (End)',\n pageX: 'Goto page [X]',\n },\n },\n table: {\n actions: 'Other actions',\n edit: 'Edit (e)',\n copy: 'Copy (c)',\n del: 'Delete (del)',\n newSubRow: 'New row (shift + n)',\n loading: 'Loading...',\n },\n table2: {\n columns: {\n resize: {\n tooltip: 'Resize column',\n },\n actions: {\n tooltip: 'Other actions',\n },\n drag: {\n tooltip: 'Drag row',\n },\n expansion: {\n collapse: 'Collapse row',\n collapseAll: 'Collapse all rows',\n expand: 'Expand row',\n expandAll: 'Expand all rows',\n },\n select: {\n deselect: 'Deselect row',\n deselectAll: 'Deselect all rows',\n select: 'Select row',\n selectAll: 'Select all rows',\n },\n menu: {\n hideColumn: 'Hide column',\n freezeColumns: (count = 1) => (count === 1 ? 'Freeze the first column' : `Freeze first ${count} columns`),\n unfreezeColumns: 'Unfreeze all columns',\n },\n },\n columnSettings: {\n search: 'Search column...',\n tooltip: 'Column settings',\n button: 'Columns',\n noResults: 'No results',\n },\n editing: {\n button: 'Edit',\n tooltip: 'Edit',\n tooltipDisabled: 'There are no visible columns that support editing',\n rowIndicator: {\n rowWillMove: 'Row will move due to sorting',\n rowWillBeHidden: 'Row will hide due to filtering',\n rowWillMoveReasonSearch:\n 'Due to a search filter applied to this table, this row will be hidden as soon as you select another row',\n rowWillMoveReasonFilter:\n \"Due to a filter applied to the column '[COLUMN]', this row will be hidden as soon as you select another row\",\n rowWillMoveReasonSorting:\n \"Due to sorting applied to the column '[COLUMN]', this row will move position as soon as you select another row\",\n },\n },\n filters: {\n button: 'Filters',\n buttons: {\n addNewFilter: 'Add new filter',\n clearFilters: 'Clear all filters',\n },\n comparators: {\n contains: 'Contains',\n doesNotContain: 'Does not contain',\n isEqualTo: 'Is',\n isNotEqualTo: 'Is not',\n isGreaterThan: 'Is greater than',\n isLessThan: 'Is less than',\n isBetween: 'Is between',\n isOneOf: 'Is one of',\n isNoneOf: 'Is none of',\n isAllOf: 'Is all of',\n isEmpty: 'Is empty',\n isNotEmpty: 'Is not empty',\n },\n conditions: {\n and: 'And',\n where: 'Where',\n },\n emptyFilter: {\n condition: 'Condition',\n value: 'Value',\n },\n tooltip: 'Apply filters',\n total: 'Viewing [CURRENT] of [TOTAL]',\n },\n footer: {\n summary: {\n records: 'Records:',\n selected: 'Records selected:',\n },\n },\n rowDensity: {\n tooltip: 'Row density',\n compact: 'compact',\n normal: 'normal',\n comfortable: 'comfortable',\n spacious: 'spacious',\n },\n search: {\n placeholder: 'Search...',\n },\n shortcuts: {\n tooltip: 'View keyboard shortcuts',\n search: 'Search',\n filter: 'Filter',\n previousRow: 'Previous row',\n nextRow: 'Next row',\n editCell: 'Edit cell',\n previousColumn: 'Previous column',\n nextColumn: 'Next column',\n rowClick: 'Activate current row',\n selectRow: 'Select current row',\n selectAllRows: 'Select all rows',\n expandRow: 'Expand current row',\n collapseRow: 'Collapse current row',\n },\n },\n table3: {\n columns: {\n actions: {\n tooltip: 'Row actions',\n },\n drag: {\n tooltip: 'Drag row',\n },\n expansion: {\n collapse: 'Collapse row',\n collapseAll: 'Collapse all rows',\n expand: 'Expand row',\n expandAll: 'Expand all rows',\n },\n menu: {\n freezeFirstColumn: 'Freeze the first column',\n freezeUptoColumn: `Freeze first [TOTAL] columns`,\n freezeColumns: (count = 1) => (count === 1 ? 'Freeze the first column' : `Freeze first ${count} columns`),\n gotoRow: 'Go to',\n hideColumn: 'Hide column',\n unfreezeColumns: 'Unfreeze all columns',\n },\n resize: {\n tooltip: 'Resize column',\n },\n select: {\n deselect: 'Deselect row',\n deselectAll: 'Deselect all rows',\n select: 'Select row',\n selectAll: 'Select all rows',\n },\n },\n columnSettings: {\n search: 'Search column...',\n tooltip: 'Columns',\n button: 'Columns',\n noResults: 'No results',\n },\n editing: {\n actions: {\n tooltip: 'Row actions',\n save: 'Save',\n clear: 'Clear changes',\n exit: 'Exit edit mode',\n },\n buttons: {\n edit: {\n text: 'Edit',\n tooltip: 'Edit',\n },\n },\n rowIndicator: {\n rowWillMove: 'Row will move due to sorting',\n rowWillBeHidden: 'Row will hide due to filtering',\n rowWillMoveReasonSearch:\n 'Due to a search filter applied to this table, this row will be hidden as soon as you select another row',\n rowWillMoveReasonFilter:\n \"Due to a filter applied to the column '[COLUMN]', this row will be hidden as soon as you select another row\",\n rowWillMoveReasonSorting:\n \"Due to sorting applied to the column '[COLUMN]', this row will move position as soon as you select another row\",\n },\n saving: {\n progress: 'Saving...',\n complete: 'Saved',\n },\n },\n filters: {\n button: 'Filters',\n buttons: {\n addFilter: 'Add new filter',\n clearFilters: 'Clear all filters',\n },\n comparators: {\n contains: 'Contains',\n doesNotContain: 'Does not contain',\n isEqualTo: 'Is',\n isNotEqualTo: 'Is not',\n isGreaterThan: 'Is greater than',\n isLessThan: 'Is less than',\n isBetween: 'Is between',\n isOneOf: 'Is one of',\n isNoneOf: 'Is none of',\n isAllOf: 'Is all of',\n isEmpty: 'Is empty',\n isNotEmpty: 'Is not empty',\n },\n conditions: {\n and: 'And',\n where: 'Where',\n },\n emptyFilter: {\n condition: 'Condition',\n value: 'Value',\n },\n tooltip: 'Apply filters',\n total: 'Viewing [CURRENT] of [TOTAL]',\n },\n fontSize: {\n tooltip: 'Font size',\n sizes: {\n small: 'Small',\n medium: 'Medium',\n large: 'Large',\n },\n },\n footer: {\n summary: {\n count: 'of',\n records: 'Records:',\n selected: 'Records selected:',\n },\n },\n print: {\n error: 'An error occurred while creating a print preview',\n loading: 'Creating a print preview',\n tooltip: 'Print',\n },\n rowHeight: {\n tooltip: 'Row height',\n sizes: {\n short: 'Short',\n medium: 'Medium',\n tall: 'Tall',\n extraTall: 'Extra tall',\n },\n },\n search: {\n excludeUnmatchedResults: 'Hide unmatched records',\n placeholder: 'Search...',\n },\n shortcuts: {\n tooltip: 'View keyboard shortcuts',\n search: 'Search',\n filter: 'Filter',\n previousRow: 'Previous row',\n nextRow: 'Next row',\n editCell: 'Edit cell',\n previousColumn: 'Previous column',\n nextColumn: 'Next column',\n rowClick: 'Activate current row',\n selectRow: 'Select current row',\n selectAllRows: 'Select all rows',\n expandRow: 'Expand current row',\n collapseRow: 'Collapse current row',\n },\n },\n searchInput: {\n button: 'Search',\n findNext: 'Next',\n findPrevious: 'Previous',\n placeholder: 'Search...',\n clear: 'Clear',\n },\n select: {\n allOptionsSelected: 'All',\n },\n select2: {\n allSelect: 'Select all',\n allDeselect: 'Deselect all',\n cancel: 'Cancel',\n chooseColor: 'Pick a color',\n create: 'Create',\n delete: 'Delete',\n save: 'Save',\n search: 'Search...',\n searchOrCreate: 'Search or create...',\n },\n toasts: {\n dismiss: 'Dismiss',\n },\n tour: {\n back: 'Back',\n close: 'Close',\n skip: 'Close and complete',\n last: 'Done',\n next: 'Next',\n open: 'Open',\n },\n drawer: {\n close: 'Close',\n },\n};\n\nexport const defaultLocalizationContext: Localization = {\n locale: 'en-GB',\n texts: defaultLocalisationTexts,\n formatting: {\n date: 'dd.mm.yy',\n },\n};\n\nexport const LocalizationContext = React.createContext<Localization>(defaultLocalizationContext);\nexport interface LocalizationProviderProps {\n children: React.ReactNode;\n localization?: Localization;\n}\nexport const LocalizationProvider: React.FC<LocalizationProviderProps> = ({ localization, children }) => {\n return (\n <LocalizationContext.Provider value={localization ?? defaultLocalizationContext}>{children}</LocalizationContext.Provider>\n );\n};\n\nexport const useLocalization = () => React.useContext(LocalizationContext);\n"],"names":["defaultLocalisationTexts","banner","close","calendar","months","weekdaysShort","weekdays","actions","previousMonth","nextMonth","previousYear","nextYear","today","combobox","tooltip","datepicker","clear","expand","shortcuts","dialog","drag","hanger","header","addAgreement","logout","more","new","search","listbox","loading","empty","allOption","pagination","label","pageSize","showingXofYofTotal","firstPage","firstPageWithShortcut","previousPage","previousPageWithShortcut","nextPage","nextPageWithShortcut","lastPage","lastPageWithShortcut","pageX","table","edit","copy","del","newSubRow","table2","columns","resize","expansion","collapse","collapseAll","expandAll","select","deselect","deselectAll","selectAll","menu","hideColumn","freezeColumns","count","unfreezeColumns","columnSettings","button","noResults","editing","tooltipDisabled","rowIndicator","rowWillMove","rowWillBeHidden","rowWillMoveReasonSearch","rowWillMoveReasonFilter","rowWillMoveReasonSorting","filters","buttons","addNewFilter","clearFilters","comparators","contains","doesNotContain","isEqualTo","isNotEqualTo","isGreaterThan","isLessThan","isBetween","isOneOf","isNoneOf","isAllOf","isEmpty","isNotEmpty","conditions","and","where","emptyFilter","condition","value","total","footer","summary","records","selected","rowDensity","compact","normal","comfortable","spacious","placeholder","filter","previousRow","nextRow","editCell","previousColumn","nextColumn","rowClick","selectRow","selectAllRows","expandRow","collapseRow","table3","freezeFirstColumn","freezeUptoColumn","gotoRow","save","exit","text","saving","progress","complete","addFilter","fontSize","sizes","small","medium","large","print","error","rowHeight","short","tall","extraTall","excludeUnmatchedResults","searchInput","findNext","findPrevious","allOptionsSelected","select2","allSelect","allDeselect","cancel","chooseColor","create","delete","searchOrCreate","toasts","dismiss","tour","back","skip","last","next","open","drawer","defaultLocalizationContext","locale","texts","formatting","date","LocalizationContext","React","LocalizationProvider","localization","children","Provider","useLocalization"],"mappings":";;MA2EaA,wBAAwB,GAAG;EACpCC,MAAM,EAAE;IACJC,KAAK,EAAE;GACV;EACDC,QAAQ,EAAE;IACNC,MAAM,EAAE,CACJ,SAAS,EACT,UAAU,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU,CACb;IACDC,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;IAChEC,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC;IACxFC,OAAO,EAAE;MACLC,aAAa,EAAE,gBAAgB;MAC/BC,SAAS,EAAE,YAAY;MACvBC,YAAY,EAAE,eAAe;MAC7BC,QAAQ,EAAE,WAAW;MACrBC,KAAK,EAAE;;GAEd;EACDC,QAAQ,EAAE;IACNC,OAAO,EAAE;GACZ;EACDC,UAAU,EAAE;IACRZ,QAAQ,EAAE,UAAU;IACpBa,KAAK,EAAE,OAAO;IACdC,MAAM,EAAE,eAAe;IACvBC,SAAS,EAAE;GACd;EACDC,MAAM,EAAE;IACJjB,KA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2F,kBAAkB,EAAE;GACvB;EACDC,OAAO,EAAE;IACLC,SAAS,EAAE,YAAY;IACvBC,WAAW,EAAE,cAAc;IAC3BC,MAAM,EAAE,QAAQ;IAChBC,WAAW,EAAE,cAAc;IAC3BC,MAAM,EAAE,QAAQ;IAChBC,MAAM,EAAE,QAAQ;IAChB7B,IAAI,EAAE,MAAM;IACZnG,MAAM,EAAE,WAAW;IACnBiI,cAAc,EAAE;GACnB;EACDC,MAAM,EAAE;IACJC,OAAO,EAAE;GACZ;EACDC,IAAI,EAAE;IACFC,IAAI,EAAE,MAAM;IACZ9J,KAAK,EAAE,OAAO;IACd+J,IAAI,EAAE,oBAAoB;IAC1BC,IAAI,EAAE,MAAM;IACZC,IAAI,EAAE,MAAM;IACZC,IAAI,EAAE;GACT;EACDC,MAAM,EAAE;IACJnK,KAAK,EAAE;;;MAIFoK,0BAA0B,GAAiB;EACpDC,MAAM,EAAE,OAAO;EACfC,KAAK,EAAExK,wBAAwB;EAC/ByK,UAAU,EAAE;IACRC,IAAI,EAAE;;;MAIDC,mBAAmB,gBAAGC,aAAmB,CAAeN,0BAA0B;MAKlFO,oBAAoB,GAAwC,CAAC;EAAEC,YAAY;EAAEC;CAAU;EAChG,oBACIH,cAACD,mBAAmB,CAACK,QAAQ;IAAC7E,KAAK,EAAE2E,YAAY,aAAZA,YAAY,cAAZA,YAAY,GAAIR;KAA6BS,QAAQ,CAAgC;AAElI;MAEaE,eAAe,GAAG,MAAML,UAAgB,CAACD,mBAAmB;;;;"}
|
1
|
+
{"version":3,"file":"Localization.js","sources":["../../../../../../../src/components/Provider/Localization.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Locale } from '../../types';\nimport { CalendarTexts } from '../Calendar/Calendar';\nimport { ComboboxTexts } from '../Combobox/Combobox';\nimport { DialogTexts } from '../Dialog/Dialog';\nimport { PaginationTexts } from '../Pagination/Pagination';\nimport { ListboxTexts } from '../Listbox/Listbox';\nimport { ToastsTexts } from '../Toast/Toast';\nimport { DatepickerTexts } from '../Datepicker/Datepicker';\nimport { HeaderTexts } from '../Header/Header';\nimport { HangerTexts } from '../Hanger/Hanger';\nimport { SelectTexts } from '../Select/Select';\nimport { TourTexts } from '../Tour/Tour';\nimport { TableTexts } from '../Table/Table';\nimport { Table2Texts } from '../Table2/Table2';\nimport { Table3Texts } from '../Table3/types';\nimport { SearchInputTexts } from '../SearchInput/SearchInput';\nimport { Select2Texts } from '../Select2/Select2';\nimport { BannerTexts } from '../Banner/Banner';\nimport { DrawerTexts } from '../Drawer/Drawer';\n\nexport type LocalizationTexts = {\n /** Localized texts and aria-labels for [Banner](component:banner) component */\n banner: BannerTexts;\n /** Localized texts and aria-labels for [Calendar](component:calendar) component */\n calendar: CalendarTexts;\n /** Localized texts and aria-labels for [Combobox](component:combobox) component */\n combobox: ComboboxTexts;\n /** Localized texts and aria-labels for [DatePicker](component:datepicker) component */\n datepicker: DatepickerTexts;\n /** Localized texts and aria-labels for [Dialog](component:dialog) component */\n dialog: DialogTexts;\n /** Localized texts and aria-labels for [Hanger](component:hanger) component */\n hanger: HangerTexts;\n /** Localized texts and aria-labels for [Header](component:header) component */\n header: HeaderTexts;\n /** Localized texts and aria-labels for [Listbox](component:listbox) component */\n listbox: ListboxTexts;\n /** Localized texts and aria-labels for [Pagination](component:pagination) component */\n pagination: PaginationTexts;\n /** Localized texts and aria-labels for [Table](component:table) component */\n table: TableTexts;\n /** Localized texts and aria-labels for [Table2](component:table2) component */\n table2: Table2Texts;\n /** Localized texts and aria-labels for [Table3](component:table3) component */\n table3: Table3Texts;\n /** Localized texts and aria-labels for [SearchInput](component:searchinput) component */\n searchInput: SearchInputTexts;\n /** Localized texts and aria-labels for [Select](component:select) component */\n select: SelectTexts;\n /** Localized texts and aria-labels for [Select2](component:select2) component */\n select2: Select2Texts;\n /** Localized texts and aria-labels for [Toast](component:toast) component */\n toasts: ToastsTexts;\n /** Localized texts and aria-labels for [Tour](component:tour) component */\n tour: TourTexts;\n /** Localized texts and aria-labels for [Drawer](component:drawer) component */\n drawer: DrawerTexts;\n};\n\nexport type Localization = {\n /**\n * Provide the language code used in application.\n * Default value is `en-GB`\n */\n locale: Locale;\n /** Provide the texts and aria-labels for components used within the provider */\n texts: LocalizationTexts;\n /** Provide the formatting */\n formatting: {\n /** Default value is `dd.mm.yy` */\n date: string;\n };\n};\n\nexport const defaultLocalisationTexts = {\n banner: {\n close: 'Close',\n },\n calendar: {\n months: [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n ],\n weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n actions: {\n previousMonth: 'Previous month',\n nextMonth: 'Next month',\n previousYear: 'Previous year',\n nextYear: 'Next year',\n today: 'Today',\n },\n },\n combobox: {\n tooltip: 'Search in list',\n },\n datepicker: {\n calendar: 'Calendar',\n clear: 'Clear',\n expand: 'Show calendar',\n shortcuts: 'Shortcuts',\n },\n dialog: {\n close: 'Close',\n drag: 'Drag',\n },\n hanger: {\n close: 'Close',\n },\n header: {\n addAgreement: 'Add agreement',\n logout: 'Log off',\n more: 'More',\n new: 'New',\n search: 'Search for agreement...',\n },\n listbox: {\n loading: 'Loading results...',\n empty: 'No results found',\n allOption: 'All',\n },\n pagination: {\n label: 'Pagination',\n pageSize: 'Items per page',\n showingXofYofTotal: 'Showing [X] - [Y] of [total]',\n actions: {\n firstPage: 'Goto first page',\n firstPageWithShortcut: 'Goto first page (Home)',\n previousPage: 'Goto previous page',\n previousPageWithShortcut: 'Goto previous page (Page Up)',\n nextPage: 'Goto next page',\n nextPageWithShortcut: 'Goto next page (Page Down)',\n lastPage: 'Goto last page',\n lastPageWithShortcut: 'Goto last page (End)',\n pageX: 'Goto page [X]',\n },\n },\n table: {\n actions: 'Other actions',\n edit: 'Edit (e)',\n copy: 'Copy (c)',\n del: 'Delete (del)',\n newSubRow: 'New row (shift + n)',\n loading: 'Loading...',\n },\n table2: {\n columns: {\n resize: {\n tooltip: 'Resize column',\n },\n actions: {\n tooltip: 'Other actions',\n },\n drag: {\n tooltip: 'Drag row',\n },\n expansion: {\n collapse: 'Collapse row',\n collapseAll: 'Collapse all rows',\n expand: 'Expand row',\n expandAll: 'Expand all rows',\n },\n select: {\n deselect: 'Deselect row',\n deselectAll: 'Deselect all rows',\n select: 'Select row',\n selectAll: 'Select all rows',\n },\n menu: {\n hideColumn: 'Hide column',\n freezeColumns: (count = 1) => (count === 1 ? 'Freeze the first column' : `Freeze first ${count} columns`),\n unfreezeColumns: 'Unfreeze all columns',\n },\n },\n columnSettings: {\n search: 'Search column...',\n tooltip: 'Column settings',\n button: 'Columns',\n noResults: 'No results',\n },\n editing: {\n button: 'Edit',\n tooltip: 'Edit',\n tooltipDisabled: 'There are no visible columns that support editing',\n rowIndicator: {\n rowWillMove: 'Row will move due to sorting',\n rowWillBeHidden: 'Row will hide due to filtering',\n rowWillMoveReasonSearch:\n 'Due to a search filter applied to this table, this row will be hidden as soon as you select another row',\n rowWillMoveReasonFilter:\n \"Due to a filter applied to the column '[COLUMN]', this row will be hidden as soon as you select another row\",\n rowWillMoveReasonSorting:\n \"Due to sorting applied to the column '[COLUMN]', this row will move position as soon as you select another row\",\n },\n },\n filters: {\n button: 'Filters',\n buttons: {\n addNewFilter: 'Add new filter',\n clearFilters: 'Clear all filters',\n },\n comparators: {\n contains: 'Contains',\n doesNotContain: 'Does not contain',\n isEqualTo: 'Is',\n isNotEqualTo: 'Is not',\n isGreaterThan: 'Is greater than',\n isLessThan: 'Is less than',\n isBetween: 'Is between',\n isOneOf: 'Is one of',\n isNoneOf: 'Is none of',\n isAllOf: 'Is all of',\n isEmpty: 'Is empty',\n isNotEmpty: 'Is not empty',\n },\n conditions: {\n and: 'And',\n where: 'Where',\n },\n emptyFilter: {\n condition: 'Condition',\n value: 'Value',\n },\n tooltip: 'Apply filters',\n total: 'Viewing [CURRENT] of [TOTAL]',\n },\n footer: {\n summary: {\n records: 'Records:',\n selected: 'Records selected:',\n },\n },\n rowDensity: {\n tooltip: 'Row density',\n compact: 'compact',\n normal: 'normal',\n comfortable: 'comfortable',\n spacious: 'spacious',\n },\n search: {\n placeholder: 'Search...',\n },\n shortcuts: {\n tooltip: 'View keyboard shortcuts',\n search: 'Search',\n filter: 'Filter',\n previousRow: 'Previous row',\n nextRow: 'Next row',\n editCell: 'Edit cell',\n previousColumn: 'Previous column',\n nextColumn: 'Next column',\n rowClick: 'Activate current row',\n selectRow: 'Select current row',\n selectAllRows: 'Select all rows',\n expandRow: 'Expand current row',\n collapseRow: 'Collapse current row',\n },\n },\n table3: {\n columns: {\n actions: {\n tooltip: 'Row actions',\n },\n drag: {\n tooltip: 'Drag row',\n },\n expansion: {\n collapse: 'Collapse row',\n collapseAll: 'Collapse all rows',\n expand: 'Expand row',\n expandAll: 'Expand all rows',\n },\n menu: {\n freezeFirstColumn: 'Freeze the first column',\n freezeUptoColumn: `Freeze first [TOTAL] columns`,\n freezeColumns: (count = 1) => (count === 1 ? 'Freeze the first column' : `Freeze first ${count} columns`),\n gotoRow: 'Go to',\n hideColumn: 'Hide column',\n unfreezeColumns: 'Unfreeze all columns',\n },\n resize: {\n tooltip: 'Resize column',\n },\n select: {\n deselect: 'Deselect row',\n deselectAll: 'Deselect all rows',\n select: 'Select row',\n selectAll: 'Select all rows',\n },\n },\n columnSettings: {\n search: 'Search column...',\n tooltip: 'Columns',\n button: 'Columns',\n noResults: 'No results',\n },\n editing: {\n actions: {\n tooltip: 'Row actions',\n save: 'Save',\n clear: 'Clear changes',\n exit: 'Exit edit mode',\n },\n buttons: {\n edit: {\n text: 'Edit',\n tooltip: 'Edit',\n },\n },\n rowIndicator: {\n rowWillMove: 'Row will move due to sorting',\n rowWillBeHidden: 'Row will hide due to filtering',\n rowWillMoveReasonSearch:\n 'Due to a search filter applied to this table, this row will be hidden as soon as you select another row',\n rowWillMoveReasonFilter:\n \"Due to a filter applied to the column '[COLUMN]', this row will be hidden as soon as you select another row\",\n rowWillMoveReasonSorting:\n \"Due to sorting applied to the column '[COLUMN]', this row will move position as soon as you select another row\",\n },\n saving: {\n progress: 'Saving...',\n complete: 'Saved',\n },\n },\n filters: {\n button: 'Filters',\n buttons: {\n addFilter: 'Add new filter',\n clearFilters: 'Clear all filters',\n },\n comparators: {\n contains: 'Contains',\n doesNotContain: 'Does not contain',\n isEqualTo: 'Is',\n isNotEqualTo: 'Is not',\n isGreaterThan: 'Is greater than',\n isLessThan: 'Is less than',\n isBetween: 'Is between',\n isOneOf: 'Is one of',\n isNoneOf: 'Is none of',\n isAllOf: 'Is all of',\n isEmpty: 'Is empty',\n isNotEmpty: 'Is not empty',\n },\n conditions: {\n and: 'And',\n where: 'Where',\n },\n emptyFilter: {\n condition: 'Condition',\n value: 'Value',\n },\n tooltip: 'Apply filters',\n total: 'Viewing [CURRENT] of [TOTAL]',\n },\n fontSize: {\n tooltip: 'Font size',\n sizes: {\n small: 'Small',\n medium: 'Medium',\n large: 'Large',\n },\n },\n footer: {\n summary: {\n count: 'of',\n records: 'Records:',\n selected: 'Records selected:',\n },\n },\n print: {\n error: 'An error occurred while creating a print preview',\n loading: 'Creating a print preview',\n tooltip: 'Print',\n warningDialog: {\n title: 'Extra loading time',\n description:\n 'Please note that printing a large amount of data may result in a slightly longer waiting time due to data loading.',\n checkboxVisibilityLabel: \"Don't show again\",\n cancelButtonText: 'Cancel',\n printButtonText: 'Print',\n },\n },\n rowHeight: {\n tooltip: 'Row height',\n sizes: {\n short: 'Short',\n medium: 'Medium',\n tall: 'Tall',\n extraTall: 'Extra tall',\n },\n },\n search: {\n excludeUnmatchedResults: 'Hide unmatched records',\n placeholder: 'Search...',\n },\n shortcuts: {\n tooltip: 'View keyboard shortcuts',\n search: 'Search',\n filter: 'Filter',\n previousRow: 'Previous row',\n nextRow: 'Next row',\n editCell: 'Edit cell',\n previousColumn: 'Previous column',\n nextColumn: 'Next column',\n rowClick: 'Activate current row',\n selectRow: 'Select current row',\n selectAllRows: 'Select all rows',\n expandRow: 'Expand current row',\n collapseRow: 'Collapse current row',\n },\n },\n searchInput: {\n button: 'Search',\n findNext: 'Next',\n findPrevious: 'Previous',\n placeholder: 'Search...',\n clear: 'Clear',\n },\n select: {\n allOptionsSelected: 'All',\n },\n select2: {\n allSelect: 'Select all',\n allDeselect: 'Deselect all',\n cancel: 'Cancel',\n chooseColor: 'Pick a color',\n create: 'Create',\n delete: 'Delete',\n save: 'Save',\n search: 'Search...',\n searchOrCreate: 'Search or create...',\n },\n toasts: {\n dismiss: 'Dismiss',\n },\n tour: {\n back: 'Back',\n close: 'Close',\n skip: 'Close and complete',\n last: 'Done',\n next: 'Next',\n open: 'Open',\n },\n drawer: {\n close: 'Close',\n },\n};\n\nexport const defaultLocalizationContext: Localization = {\n locale: 'en-GB',\n texts: defaultLocalisationTexts,\n formatting: {\n date: 'dd.mm.yy',\n },\n};\n\nexport const LocalizationContext = React.createContext<Localization>(defaultLocalizationContext);\nexport interface LocalizationProviderProps {\n children: React.ReactNode;\n localization?: Localization;\n}\nexport const LocalizationProvider: React.FC<LocalizationProviderProps> = ({ localization, children }) => {\n return (\n <LocalizationContext.Provider value={localization ?? defaultLocalizationContext}>{children}</LocalizationContext.Provider>\n );\n};\n\nexport const useLocalization = () => React.useContext(LocalizationContext);\n"],"names":["defaultLocalisationTexts","banner","close","calendar","months","weekdaysShort","weekdays","actions","previousMonth","nextMonth","previousYear","nextYear","today","combobox","tooltip","datepicker","clear","expand","shortcuts","dialog","drag","hanger","header","addAgreement","logout","more","new","search","listbox","loading","empty","allOption","pagination","label","pageSize","showingXofYofTotal","firstPage","firstPageWithShortcut","previousPage","previousPageWithShortcut","nextPage","nextPageWithShortcut","lastPage","lastPageWithShortcut","pageX","table","edit","copy","del","newSubRow","table2","columns","resize","expansion","collapse","collapseAll","expandAll","select","deselect","deselectAll","selectAll","menu","hideColumn","freezeColumns","count","unfreezeColumns","columnSettings","button","noResults","editing","tooltipDisabled","rowIndicator","rowWillMove","rowWillBeHidden","rowWillMoveReasonSearch","rowWillMoveReasonFilter","rowWillMoveReasonSorting","filters","buttons","addNewFilter","clearFilters","comparators","contains","doesNotContain","isEqualTo","isNotEqualTo","isGreaterThan","isLessThan","isBetween","isOneOf","isNoneOf","isAllOf","isEmpty","isNotEmpty","conditions","and","where","emptyFilter","condition","value","total","footer","summary","records","selected","rowDensity","compact","normal","comfortable","spacious","placeholder","filter","previousRow","nextRow","editCell","previousColumn","nextColumn","rowClick","selectRow","selectAllRows","expandRow","collapseRow","table3","freezeFirstColumn","freezeUptoColumn","gotoRow","save","exit","text","saving","progress","complete","addFilter","fontSize","sizes","small","medium","large","print","error","warningDialog","title","description","checkboxVisibilityLabel","cancelButtonText","printButtonText","rowHeight","short","tall","extraTall","excludeUnmatchedResults","searchInput","findNext","findPrevious","allOptionsSelected","select2","allSelect","allDeselect","cancel","chooseColor","create","delete","searchOrCreate","toasts","dismiss","tour","back","skip","last","next","open","drawer","defaultLocalizationContext","locale","texts","formatting","date","LocalizationContext","React","LocalizationProvider","localization","children","Provider","useLocalization"],"mappings":";;MA2EaA,wBAAwB,GAAG;EACpCC,MAAM,EAAE;IACJC,KAAK,EAAE;GACV;EACDC,QAAQ,EAAE;IACNC,MAAM,EAAE,CACJ,SAAS,EACT,UAAU,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU,CACb;IACDC,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;IAChEC,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC;IACxFC,OAAO,EAAE;MACLC,aAAa,EAAE,gBAAg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AmB,CAACK,QAAQ;IAACnF,KAAK,EAAEiF,YAAY,aAAZA,YAAY,cAAZA,YAAY,GAAIR;KAA6BS,QAAQ,CAAgC;AAElI;MAEaE,eAAe,GAAG,MAAML,UAAgB,CAACD,mBAAmB;;;;"}
|
@@ -180,7 +180,9 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
180
180
|
setFocused(false);
|
181
181
|
};
|
182
182
|
return /*#__PURE__*/React__default.createElement("div", {
|
183
|
-
className:
|
183
|
+
className: cn('relative', {
|
184
|
+
"[&_[data-taco='input-container']]:z-20": focused
|
185
|
+
}),
|
184
186
|
onBlur: handleSettingsBlur,
|
185
187
|
ref: settingsRef
|
186
188
|
}, input, focused ? /*#__PURE__*/React__default.createElement("div", {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SearchInput2.js","sources":["../../../../../../../src/components/SearchInput2/SearchInput2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { useGlobalKeyDown } from '../../hooks/useGlobalKeyDown';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Input } from '../Input/Input';\nimport { Shortcut } from '../Shortcut/Shortcut';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { KeyDownHandlerOptions } from '../../utils/keyboard';\n\ninterface CommonSearchInput2Props\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue' | 'onChange' | 'value'> {\n onSearch: (value: string) => void;\n settingsContent?: JSX.Element;\n shortcut?: string | KeyDownHandlerOptions;\n value?: string;\n}\n\ninterface BasicSearchInput2Props extends CommonSearchInput2Props {\n findCurrent?: never;\n findTotal?: never;\n onClickFindNext?: never;\n onClickFindPrevious?: never;\n}\n\ninterface ComplexSearchInput2Props extends CommonSearchInput2Props {\n findCurrent: number | null;\n findTotal: number | null;\n onClickFindNext: () => void;\n onClickFindPrevious: () => void;\n}\n\nexport type SearchInput2Props = BasicSearchInput2Props | ComplexSearchInput2Props;\n\nexport const SearchInput2 = React.forwardRef(function SearchInput2(props: SearchInput2Props, ref: React.Ref<HTMLInputElement>) {\n const {\n findCurrent,\n findTotal,\n onClickFindNext: handleClickFindNext,\n onClickFindPrevious: handleClickFindPrevious,\n onSearch: handleSearch,\n settingsContent,\n shortcut,\n value,\n ...attributes\n } = props;\n const internalRef = useMergedRef<HTMLInputElement>(ref);\n const settingsRef = React.useRef<HTMLDivElement>(null);\n const [internalValue, setInternalValue] = React.useState(value ?? '');\n const [focused, setFocused] = React.useState(false);\n const { texts } = useLocalization();\n const isActive = value?.length;\n const isSynced = internalValue === value;\n const hasFind = handleClickFindNext && handleClickFindPrevious && findCurrent !== undefined && findTotal !== undefined;\n\n useGlobalKeyDown(shortcut, (event: KeyboardEvent) => {\n if (document.activeElement !== internalRef.current) {\n event.preventDefault();\n internalRef.current?.focus();\n }\n });\n\n const handleSubmit = () => {\n handleSearch(internalValue);\n };\n\n const handleBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n // trigger searches when leaving the field\n handleSubmit();\n\n if (\n settingsRef.current &&\n (settingsRef.current === event.relatedTarget || settingsRef.current?.contains(event.relatedTarget))\n ) {\n return;\n }\n\n setFocused(false);\n attributes.onBlur?.(event);\n };\n\n const handleChange = event => {\n setInternalValue(event.target.value);\n\n if (!event.target.value) {\n handleClear();\n }\n };\n\n const handleClear = () => {\n requestAnimationFrame(() => internalRef.current?.focus());\n setInternalValue('');\n handleSearch('');\n };\n\n const handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n attributes.onFocus?.(event);\n setFocused(true);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n props.onKeyDown?.(event);\n\n if (event.isDefaultPrevented()) {\n return;\n }\n\n if (event.key === 'Enter') {\n event.preventDefault();\n\n if (hasFind && isActive && isSynced) {\n if (event.shiftKey) {\n handleClickFindPrevious?.();\n } else {\n handleClickFindNext?.();\n }\n } else {\n handleSearch(internalValue);\n }\n return;\n }\n\n if (event.key === 'Escape') {\n handleClear();\n return;\n }\n };\n\n let postfix;\n\n if (!attributes.disabled && !attributes.readOnly && (internalValue || focused)) {\n if (internalValue) {\n postfix = (\n <IconButton\n aria-label={texts.searchInput.clear}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"close\"\n onMouseDown={handleClear}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.clear} <Shortcut keys=\"Escape\" />\n </>\n ) : (\n texts.searchInput.clear\n )\n }\n />\n );\n }\n\n if (hasFind && isActive) {\n postfix = (\n <>\n <span className=\"text-grey-700 flex h-4 items-center border-r border-black/[0.25] pr-2\">\n {findCurrent ?? 0}/{findTotal ?? 0}\n </span>\n {findCurrent ? (\n <>\n <IconButton\n aria-label={texts.searchInput.findPrevious}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-up\"\n onMouseDown={handleClickFindPrevious}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findPrevious} <Shortcut keys={{ shift: true, key: 'Enter' }} />\n </>\n ) : (\n texts.searchInput.findPrevious\n )\n }\n />\n <IconButton\n aria-label={texts.searchInput.findNext}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-down\"\n onMouseDown={handleClickFindNext}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findNext} <Shortcut keys=\"Enter\" />\n </>\n ) : (\n texts.searchInput.findNext\n )\n }\n />\n </>\n ) : null}\n {postfix}\n </>\n );\n }\n } else if (shortcut && !focused && !internalValue) {\n postfix = <Shortcut keys={shortcut} onClickCapture={() => internalRef.current?.focus()} />;\n }\n\n const className = cn(\n 'peer !pl-7',\n hasFind\n ? {\n '!w-48': !internalValue && !focused,\n '!w-72': internalValue || focused,\n }\n : '!w-48',\n {\n '!wcag-blue-100': isActive,\n },\n props.className\n );\n\n const input = (\n <Input\n {...attributes}\n aria-label={attributes['aria-label'] ?? texts.searchInput.placeholder}\n className={className}\n data-taco=\"search-input2\"\n onBlur={handleBlur}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n placeholder={attributes.placeholder ?? texts.searchInput.placeholder}\n prefix={\n <IconButton\n aria-label={texts.searchInput.button}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n disabled={attributes.disabled || attributes.readOnly}\n icon=\"search\"\n onMouseDown={handleSubmit}\n tabIndex={-1}\n tooltip={\n focused && !isSynced ? (\n <>\n {texts.searchInput.button} <Shortcut keys=\"Enter\" />\n </>\n ) : (\n texts.searchInput.button\n )\n }\n />\n }\n postfix={postfix}\n ref={internalRef}\n value={internalValue}\n />\n );\n\n if (settingsContent) {\n const handleSettingsBlur = event => {\n if (event.currentTarget.contains(event.relatedTarget)) {\n return;\n }\n setFocused(false);\n };\n\n return (\n <div className=\"relative [&_[data-taco='input-container']]:z-20\" onBlur={handleSettingsBlur} ref={settingsRef}>\n {input}\n {focused ? (\n <div\n className=\"border-grey-300 absolute left-0 right-0 top-full z-10 flex flex-col gap-y-4 rounded-b border border-t-0 bg-white p-3 shadow\"\n onClickCapture={() => internalRef.current?.focus()}\n tabIndex={-1}>\n {settingsContent}\n </div>\n ) : null}\n </div>\n );\n }\n\n return input;\n});\n"],"names":["SearchInput2","React","forwardRef","props","ref","findCurrent","findTotal","onClickFindNext","handleClickFindNext","onClickFindPrevious","handleClickFindPrevious","onSearch","handleSearch","settingsContent","shortcut","value","attributes","internalRef","useMergedRef","settingsRef","useRef","internalValue","setInternalValue","useState","focused","setFocused","texts","useLocalization","isActive","length","isSynced","hasFind","undefined","useGlobalKeyDown","event","document","activeElement","current","preventDefault","focus","handleSubmit","handleBlur","relatedTarget","contains","onBlur","handleChange","target","handleClear","requestAnimationFrame","handleFocus","onFocus","handleKeyDown","onKeyDown","isDefaultPrevented","key","shiftKey","postfix","disabled","readOnly","IconButton","searchInput","clear","className","icon","onMouseDown","tabIndex","tooltip","Shortcut","keys","findPrevious","shift","findNext","onClickCapture","cn","input","Input","placeholder","onChange","prefix","button","handleSettingsBlur","currentTarget"],"mappings":";;;;;;;;;MAkCaA,YAAY,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,YAAY,CAACG,KAAwB,EAAEC,GAAgC;;EACzH,MAAM;IACFC,WAAW;IACXC,SAAS;IACTC,eAAe,EAAEC,mBAAmB;IACpCC,mBAAmB,EAAEC,uBAAuB;IAC5CC,QAAQ,EAAEC,YAAY;IACtBC,eAAe;IACfC,QAAQ;IACRC,KAAK;IACL,GAAGC;GACN,GAAGb,KAAK;EACT,MAAMc,WAAW,GAAGC,YAAY,CAAmBd,GAAG,CAAC;EACvD,MAAMe,WAAW,GAAGlB,cAAK,CAACmB,MAAM,CAAiB,IAAI,CAAC;EACtD,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAGrB,cAAK,CAACsB,QAAQ,CAACR,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE,CAAC;EACrE,MAAM,CAACS,OAAO,EAAEC,UAAU,CAAC,GAAGxB,cAAK,CAACsB,QAAQ,CAAC,KAAK,CAAC;EACnD,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,QAAQ,GAAGb,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEc,MAAM;EAC9B,MAAMC,QAAQ,GAAGT,aAAa,KAAKN,KAAK;EACxC,MAAMgB,OAAO,GAAGvB,mBAAmB,IAAIE,uBAAuB,IAAIL,WAAW,KAAK2B,SAAS,IAAI1B,SAAS,KAAK0B,SAAS;EAEtHC,gBAAgB,CAACnB,QAAQ,EAAGoB,KAAoB;IAC5C,IAAIC,QAAQ,CAACC,aAAa,KAAKnB,WAAW,CAACoB,OAAO,EAAE;MAAA;MAChDH,KAAK,CAACI,cAAc,EAAE;MACtB,wBAAArB,WAAW,CAACoB,OAAO,yDAAnB,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,KAAK,EAAE;;MAClD0B,QAAQ,EAAE,CAAC;OACVpD,eAAe,CACd,GACN,IAAI,CACN;;EAId,OAAO6D,KAAK;AAChB,CAAC;;;;"}
|
1
|
+
{"version":3,"file":"SearchInput2.js","sources":["../../../../../../../src/components/SearchInput2/SearchInput2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { useGlobalKeyDown } from '../../hooks/useGlobalKeyDown';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Input } from '../Input/Input';\nimport { Shortcut } from '../Shortcut/Shortcut';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { KeyDownHandlerOptions } from '../../utils/keyboard';\n\ninterface CommonSearchInput2Props\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue' | 'onChange' | 'value'> {\n onSearch: (value: string) => void;\n settingsContent?: JSX.Element;\n shortcut?: string | KeyDownHandlerOptions;\n value?: string;\n}\n\ninterface BasicSearchInput2Props extends CommonSearchInput2Props {\n findCurrent?: never;\n findTotal?: never;\n onClickFindNext?: never;\n onClickFindPrevious?: never;\n}\n\ninterface ComplexSearchInput2Props extends CommonSearchInput2Props {\n findCurrent: number | null;\n findTotal: number | null;\n onClickFindNext: () => void;\n onClickFindPrevious: () => void;\n}\n\nexport type SearchInput2Props = BasicSearchInput2Props | ComplexSearchInput2Props;\n\nexport const SearchInput2 = React.forwardRef(function SearchInput2(props: SearchInput2Props, ref: React.Ref<HTMLInputElement>) {\n const {\n findCurrent,\n findTotal,\n onClickFindNext: handleClickFindNext,\n onClickFindPrevious: handleClickFindPrevious,\n onSearch: handleSearch,\n settingsContent,\n shortcut,\n value,\n ...attributes\n } = props;\n const internalRef = useMergedRef<HTMLInputElement>(ref);\n const settingsRef = React.useRef<HTMLDivElement>(null);\n const [internalValue, setInternalValue] = React.useState(value ?? '');\n const [focused, setFocused] = React.useState(false);\n const { texts } = useLocalization();\n const isActive = value?.length;\n const isSynced = internalValue === value;\n const hasFind = handleClickFindNext && handleClickFindPrevious && findCurrent !== undefined && findTotal !== undefined;\n\n useGlobalKeyDown(shortcut, (event: KeyboardEvent) => {\n if (document.activeElement !== internalRef.current) {\n event.preventDefault();\n internalRef.current?.focus();\n }\n });\n\n const handleSubmit = () => {\n handleSearch(internalValue);\n };\n\n const handleBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n // trigger searches when leaving the field\n handleSubmit();\n\n if (\n settingsRef.current &&\n (settingsRef.current === event.relatedTarget || settingsRef.current?.contains(event.relatedTarget))\n ) {\n return;\n }\n\n setFocused(false);\n attributes.onBlur?.(event);\n };\n\n const handleChange = event => {\n setInternalValue(event.target.value);\n\n if (!event.target.value) {\n handleClear();\n }\n };\n\n const handleClear = () => {\n requestAnimationFrame(() => internalRef.current?.focus());\n setInternalValue('');\n handleSearch('');\n };\n\n const handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n attributes.onFocus?.(event);\n setFocused(true);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n props.onKeyDown?.(event);\n\n if (event.isDefaultPrevented()) {\n return;\n }\n\n if (event.key === 'Enter') {\n event.preventDefault();\n\n if (hasFind && isActive && isSynced) {\n if (event.shiftKey) {\n handleClickFindPrevious?.();\n } else {\n handleClickFindNext?.();\n }\n } else {\n handleSearch(internalValue);\n }\n return;\n }\n\n if (event.key === 'Escape') {\n handleClear();\n return;\n }\n };\n\n let postfix;\n\n if (!attributes.disabled && !attributes.readOnly && (internalValue || focused)) {\n if (internalValue) {\n postfix = (\n <IconButton\n aria-label={texts.searchInput.clear}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"close\"\n onMouseDown={handleClear}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.clear} <Shortcut keys=\"Escape\" />\n </>\n ) : (\n texts.searchInput.clear\n )\n }\n />\n );\n }\n\n if (hasFind && isActive) {\n postfix = (\n <>\n <span className=\"text-grey-700 flex h-4 items-center border-r border-black/[0.25] pr-2\">\n {findCurrent ?? 0}/{findTotal ?? 0}\n </span>\n {findCurrent ? (\n <>\n <IconButton\n aria-label={texts.searchInput.findPrevious}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-up\"\n onMouseDown={handleClickFindPrevious}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findPrevious} <Shortcut keys={{ shift: true, key: 'Enter' }} />\n </>\n ) : (\n texts.searchInput.findPrevious\n )\n }\n />\n <IconButton\n aria-label={texts.searchInput.findNext}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-down\"\n onMouseDown={handleClickFindNext}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findNext} <Shortcut keys=\"Enter\" />\n </>\n ) : (\n texts.searchInput.findNext\n )\n }\n />\n </>\n ) : null}\n {postfix}\n </>\n );\n }\n } else if (shortcut && !focused && !internalValue) {\n postfix = <Shortcut keys={shortcut} onClickCapture={() => internalRef.current?.focus()} />;\n }\n\n const className = cn(\n 'peer !pl-7',\n hasFind\n ? {\n '!w-48': !internalValue && !focused,\n '!w-72': internalValue || focused,\n }\n : '!w-48',\n {\n '!wcag-blue-100': isActive,\n },\n props.className\n );\n\n const input = (\n <Input\n {...attributes}\n aria-label={attributes['aria-label'] ?? texts.searchInput.placeholder}\n className={className}\n data-taco=\"search-input2\"\n onBlur={handleBlur}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n placeholder={attributes.placeholder ?? texts.searchInput.placeholder}\n prefix={\n <IconButton\n aria-label={texts.searchInput.button}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n disabled={attributes.disabled || attributes.readOnly}\n icon=\"search\"\n onMouseDown={handleSubmit}\n tabIndex={-1}\n tooltip={\n focused && !isSynced ? (\n <>\n {texts.searchInput.button} <Shortcut keys=\"Enter\" />\n </>\n ) : (\n texts.searchInput.button\n )\n }\n />\n }\n postfix={postfix}\n ref={internalRef}\n value={internalValue}\n />\n );\n\n if (settingsContent) {\n const handleSettingsBlur = event => {\n if (event.currentTarget.contains(event.relatedTarget)) {\n return;\n }\n setFocused(false);\n };\n\n return (\n <div\n className={cn('relative', { \"[&_[data-taco='input-container']]:z-20\": focused })}\n onBlur={handleSettingsBlur}\n ref={settingsRef}>\n {input}\n {focused ? (\n <div\n className=\"border-grey-300 absolute left-0 right-0 top-full z-10 flex flex-col gap-y-4 rounded-b border border-t-0 bg-white p-3 shadow\"\n onClickCapture={() => internalRef.current?.focus()}\n tabIndex={-1}>\n {settingsContent}\n </div>\n ) : null}\n </div>\n );\n }\n\n return input;\n});\n"],"names":["SearchInput2","React","forwardRef","props","ref","findCurrent","findTotal","onClickFindNext","handleClickFindNext","onClickFindPrevious","handleClickFindPrevious","onSearch","handleSearch","settingsContent","shortcut","value","attributes","internalRef","useMergedRef","settingsRef","useRef","internalValue","setInternalValue","useState","focused","setFocused","texts","useLocalization","isActive","length","isSynced","hasFind","undefined","useGlobalKeyDown","event","document","activeElement","current","preventDefault","focus","handleSubmit","handleBlur","relatedTarget","contains","onBlur","handleChange","target","handleClear","requestAnimationFrame","handleFocus","onFocus","handleKeyDown","onKeyDown","isDefaultPrevented","key","shiftKey","postfix","disabled","readOnly","IconButton","searchInput","clear","className","icon","onMouseDown","tabIndex","tooltip","Shortcut","keys","findPrevious","shift","findNext","onClickCapture","cn","input","Input","placeholder","onChange","prefix","button","handleSettingsBlur","currentTarget"],"mappings":";;;;;;;;;MAkCaA,YAAY,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,YAAY,CAACG,KAAwB,EAAEC,GAAgC;;EACzH,MAAM;IACFC,WAAW;IACXC,SAAS;IACTC,eAAe,EAAEC,mBAAmB;IACpCC,mBAAmB,EAAEC,uBAAuB;IAC5CC,QAAQ,EAAEC,YAAY;IACtBC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AAmE;MAC7EL,QAAQ,EAAEzC,UAAU,CAACyC,QAAQ,IAAIzC,UAAU,CAAC0C,QAAQ;MACpDK,IAAI,EAAC,QAAQ;MACbC,WAAW,EAAExB,YAAY;MACzByB,QAAQ,EAAE,CAAC,CAAC;MACZC,OAAO,EACH1C,OAAO,IAAI,CAACM,QAAQ,gBAChB7B,4DACKyB,KAAK,CAACkC,WAAW,CAACmB,MAAM,oBAAE9E,6BAACkE,QAAQ;QAACC,IAAI,EAAC;QAAU,CACrD,GAEH1C,KAAK,CAACkC,WAAW,CAACmB;MAG5B;IAENvB,OAAO,EAAEA,OAAO;IAChBpD,GAAG,EAAEa,WAAW;IAChBF,KAAK,EAAEM;KAEd;EAED,IAAIR,eAAe,EAAE;IACjB,MAAMmE,kBAAkB,GAAG9C,KAAK;MAC5B,IAAIA,KAAK,CAAC+C,aAAa,CAACtC,QAAQ,CAACT,KAAK,CAACQ,aAAa,CAAC,EAAE;QACnD;;MAEJjB,UAAU,CAAC,KAAK,CAAC;KACpB;IAED,oBACIxB;MACI6D,SAAS,EAAEW,EAAE,CAAC,UAAU,EAAE;QAAE,wCAAwC,EAAEjD;OAAS,CAAC;MAChFoB,MAAM,EAAEoC,kBAAkB;MAC1B5E,GAAG,EAAEe;OACJuD,KAAK,EACLlD,OAAO,gBACJvB;MACI6D,SAAS,EAAC,6HAA6H;MACvIU,cAAc,EAAE;QAAA;QAAA,gCAAMvD,WAAW,CAACoB,OAAO,0DAAnB,sBAAqBE,KAAK,EAAE;;MAClD0B,QAAQ,EAAE,CAAC;OACVpD,eAAe,CACd,GACN,IAAI,CACN;;EAId,OAAO6D,KAAK;AAChB,CAAC;;;;"}
|
package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js
CHANGED
@@ -5,7 +5,9 @@ import { useLocalization } from '../../../../Provider/Localization.js';
|
|
5
5
|
import { useToast } from '../../../../Toast/Toaster.js';
|
6
6
|
import { _catch } from '../../../../../../../../node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js';
|
7
7
|
import { PrintIFrame } from './PrintIFrame.js';
|
8
|
+
import { WarningDialog } from './WarningDialog.js';
|
8
9
|
|
10
|
+
const SAFE_PRINT_CELL_COUNT = 10000;
|
9
11
|
function PrintButton(props) {
|
10
12
|
const {
|
11
13
|
table,
|
@@ -16,10 +18,14 @@ function PrintButton(props) {
|
|
16
18
|
} = useLocalization();
|
17
19
|
const toast = useToast();
|
18
20
|
const [isPrinting, setIsPrinting] = React__default.useState(false);
|
21
|
+
const [showWarningDialog, setShowWarningDialog] = React__default.useState(false);
|
19
22
|
const loadingToastRef = React__default.useRef(null);
|
20
23
|
const buttonRef = React__default.useRef(null);
|
21
24
|
const tableMeta = table.options.meta;
|
22
25
|
const state = table.getState();
|
26
|
+
const {
|
27
|
+
printWarningDialogVisibility
|
28
|
+
} = tableMeta.printing;
|
23
29
|
const settings = React__default.useMemo(() => ({
|
24
30
|
columnFilters: state.columnFilters,
|
25
31
|
columnOrder: state.columnOrder,
|
@@ -32,7 +38,6 @@ function PrintButton(props) {
|
|
32
38
|
}), [state.columnFilters, state.columnOrder, state.columnPinning, state.columnSizing, state.columnVisibility, state.sorting, tableMeta.rowHeight.height, tableMeta.columnFreezing.frozenColumnIndex]);
|
33
39
|
const iframeTableProps = {
|
34
40
|
...tableProps,
|
35
|
-
data: tableProps.data,
|
36
41
|
defaultSettings: settings
|
37
42
|
};
|
38
43
|
useGlobalKeyDown({
|
@@ -56,31 +61,63 @@ function PrintButton(props) {
|
|
56
61
|
};
|
57
62
|
const handlePrint = function () {
|
58
63
|
try {
|
64
|
+
let _exit = false;
|
65
|
+
function _temp3(_result2) {
|
66
|
+
if (_exit) return _result2;
|
67
|
+
if (hasNonSafeCellCount && printWarningDialogVisibility) {
|
68
|
+
setShowWarningDialog(true);
|
69
|
+
} else {
|
70
|
+
// only set printing (mount the iframe) when the data has loaded, it prevents repaint performance slow downs
|
71
|
+
setIsPrinting(true);
|
72
|
+
}
|
73
|
+
}
|
59
74
|
loadingToastRef.current = toast.loading(texts.table3.print.loading);
|
75
|
+
const getCellCount = data => data.length ? data.length * Object.keys(data[0]).length : 0;
|
76
|
+
let hasNonSafeCellCount = false;
|
60
77
|
// if loadAll is not defined, just print with what we've got
|
61
78
|
// don't compare length to data.length because the api might be choosing not to return all for performance
|
62
|
-
|
79
|
+
const _temp2 = function () {
|
63
80
|
if (!tableMeta.printing.loadAll) {
|
64
|
-
|
81
|
+
const {
|
82
|
+
data
|
83
|
+
} = tableProps;
|
84
|
+
const cellCount = getCellCount(data);
|
85
|
+
hasNonSafeCellCount = cellCount > SAFE_PRINT_CELL_COUNT;
|
65
86
|
} else {
|
66
87
|
const _temp = _catch(function () {
|
67
88
|
return Promise.resolve(tableMeta.printing.loadAll(table.getState().sorting, table.getState().columnFilters, tableMeta.search.query)).then(function () {
|
68
|
-
//
|
69
|
-
|
89
|
+
// After the loadAll call above, the data changes. Hence, it becomes essential to acquire the data after
|
90
|
+
// this call rather than before it.
|
91
|
+
const {
|
92
|
+
data
|
93
|
+
} = tableProps;
|
94
|
+
const cellCount = getCellCount(data);
|
95
|
+
hasNonSafeCellCount = cellCount > SAFE_PRINT_CELL_COUNT;
|
70
96
|
});
|
71
97
|
}, function (error) {
|
72
98
|
var _loadingToastRef$curr3;
|
73
99
|
const errorMessage = `${texts.table3.print.error}: ${error}`;
|
74
100
|
console.error(errorMessage);
|
75
101
|
(_loadingToastRef$curr3 = loadingToastRef.current) === null || _loadingToastRef$curr3 === void 0 ? void 0 : _loadingToastRef$curr3.error(errorMessage);
|
102
|
+
// in case of error, we return early
|
103
|
+
_exit = true;
|
76
104
|
});
|
77
105
|
if (_temp && _temp.then) return _temp.then(function () {});
|
78
106
|
}
|
79
|
-
}()
|
107
|
+
}();
|
108
|
+
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2));
|
80
109
|
} catch (e) {
|
81
110
|
return Promise.reject(e);
|
82
111
|
}
|
83
112
|
};
|
113
|
+
const handleWarningDialogAccept = () => {
|
114
|
+
setIsPrinting(true);
|
115
|
+
};
|
116
|
+
const handleWarningDialogClose = () => {
|
117
|
+
var _loadingToastRef$curr4;
|
118
|
+
(_loadingToastRef$curr4 = loadingToastRef.current) === null || _loadingToastRef$curr4 === void 0 ? void 0 : _loadingToastRef$curr4.close();
|
119
|
+
setShowWarningDialog(false);
|
120
|
+
};
|
84
121
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(IconButton, {
|
85
122
|
disabled: isPrinting,
|
86
123
|
icon: "print",
|
@@ -92,6 +129,11 @@ function PrintButton(props) {
|
|
92
129
|
onAfterPrint: handleAfterPrint,
|
93
130
|
onBeforePrint: handleBeforePrint,
|
94
131
|
tableProps: iframeTableProps
|
132
|
+
}), /*#__PURE__*/React__default.createElement(WarningDialog, {
|
133
|
+
open: showWarningDialog,
|
134
|
+
onAccept: handleWarningDialogAccept,
|
135
|
+
onClose: handleWarningDialogClose,
|
136
|
+
onVisibilityChange: tableMeta.printing.setPrintWarningDialogVisibility
|
95
137
|
}));
|
96
138
|
}
|
97
139
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"PrintButton.js","sources":["../../../../../../../../../../src/components/Table3/components/toolbar/PrintButton/PrintButton.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { ToastReference, useToast } from '../../../../Toast/Toaster';\nimport { PrintIFrame } from './PrintIFrame';\nimport { Table3Props } from '../../../types';\nimport { useGlobalKeyDown } from '../../../../../hooks/useGlobalKeyDown';\n\nexport type PrintButtonProps<TType = unknown> = React.HTMLAttributes<HTMLButtonElement> & {\n table: RTable<TType>;\n tableProps: Table3Props<TType>;\n};\n\nexport function PrintButton<TType = unknown>(props: PrintButtonProps<TType>) {\n const { table, tableProps } = props;\n const { texts } = useLocalization();\n const toast = useToast();\n\n const [isPrinting, setIsPrinting] = React.useState(false);\n const loadingToastRef = React.useRef<ToastReference | null>(null);\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n const state = table.getState();\n\n const settings = React.useMemo(\n () => ({\n columnFilters: state.columnFilters,\n columnOrder: state.columnOrder,\n columnPinning: state.columnPinning,\n columnSizing: state.columnSizing,\n columnVisibility: state.columnVisibility,\n sorting: state.sorting,\n rowHeight: tableMeta.rowHeight.height,\n columnFreezingIndex: tableMeta.columnFreezing.frozenColumnIndex,\n }),\n [\n state.columnFilters,\n state.columnOrder,\n state.columnPinning,\n state.columnSizing,\n state.columnVisibility,\n state.sorting,\n tableMeta.rowHeight.height,\n tableMeta.columnFreezing.frozenColumnIndex,\n ]\n );\n const iframeTableProps = { ...tableProps, data: tableProps.data, defaultSettings: settings };\n\n useGlobalKeyDown({ key: 'p', meta: true, shift: false }, (event: KeyboardEvent) => {\n event.preventDefault();\n // Starts custom printing\n buttonRef.current?.click();\n });\n\n const handleAfterPrint = () => {\n setIsPrinting(false);\n loadingToastRef.current?.close();\n };\n\n const handleBeforePrint = () => {\n loadingToastRef.current?.close();\n };\n\n const handlePrint = async () => {\n loadingToastRef.current = toast.loading(texts.table3.print.loading as any);\n\n // if loadAll is not defined, just print with what we've got\n // don't compare length to data.length because the api might be choosing not to return all for performance\n if (!tableMeta.printing.loadAll) {\n setIsPrinting(true);\n return;\n } else {\n try {\n await tableMeta.printing.loadAll(\n table.getState().sorting,\n table.getState().columnFilters,\n tableMeta.search.query\n );\n\n // only set printing (mount the iframe) when the data has loaded, it prevents repaint performance slow downs\n setIsPrinting(true);\n } catch (error) {\n const errorMessage = `${texts.table3.print.error}: ${error}`;\n\n console.error(errorMessage);\n loadingToastRef.current?.error(errorMessage);\n }\n }\n };\n\n return (\n <>\n <IconButton\n disabled={isPrinting}\n icon=\"print\"\n onClick={handlePrint}\n aria-label={texts.table3.print.tooltip}\n tooltip={texts.table3.print.tooltip}\n ref={buttonRef}\n />\n {isPrinting && iframeTableProps.data !== null && (\n <PrintIFrame\n onAfterPrint={handleAfterPrint}\n onBeforePrint={handleBeforePrint}\n tableProps={iframeTableProps as Table3Props<TType>}\n />\n )}\n </>\n );\n}\n"],"names":["PrintButton","props","table","tableProps","texts","useLocalization","toast","useToast","isPrinting","setIsPrinting","React","useState","loadingToastRef","useRef","buttonRef","tableMeta","options","meta","state","getState","settings","useMemo","columnFilters","columnOrder","columnPinning","columnSizing","columnVisibility","sorting","rowHeight","height","columnFreezingIndex","columnFreezing","frozenColumnIndex","iframeTableProps","data","defaultSettings","useGlobalKeyDown","key","shift","event","preventDefault","current","click","handleAfterPrint","close","handleBeforePrint","handlePrint","loading","table3","print","printing","loadAll","search","query","error","errorMessage","console","IconButton","disabled","icon","onClick","tooltip","ref","PrintIFrame","onAfterPrint","onBeforePrint"],"mappings":";;;;;;;;SAcgBA,WAAW,CAAkBC,KAA8B;EACvE,MAAM;IAAEC,KAAK;IAAEC;GAAY,GAAGF,KAAK;EACnC,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,KAAK,GAAGC,QAAQ,EAAE;EAExB,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;EACzD,MAAMC,eAAe,GAAGF,cAAK,CAACG,MAAM,CAAwB,IAAI,CAAC;EACjE,MAAMC,SAAS,GAAGJ,cAAK,CAACG,MAAM,CAAoB,IAAI,CAAC;EAEvD,MAAME,SAAS,GAAGb,KAAK,CAACc,OAAO,CAACC,IAAwB;EACxD,MAAMC,KAAK,GAAGhB,KAAK,CAACiB,QAAQ,EAAE;EAE9B,MAAMC,QAAQ,GAAGV,cAAK,CAACW,OAAO,CAC1B,OAAO;IACHC,aAAa,EAAEJ,KAAK,CAACI,aAAa;IAClCC,WAAW,EAAEL,KAAK,CAACK,WAAW;IAC9BC,aAAa,EAAEN,KAAK,CAACM,aAAa;I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CAACmC,QAAQ,CAACC,OAAO;UAC3B1C,aAAa,CAAC,IAAI,CAAC;;UAAC,iCAGhB;YAAA,uBACMM,SAAS,CAACmC,QAAQ,CAACC,OAAO,CAC5BjD,KAAK,CAACiB,QAAQ,EAAE,CAACQ,OAAO,EACxBzB,KAAK,CAACiB,QAAQ,EAAE,CAACG,aAAa,EAC9BP,SAAS,CAACqC,MAAM,CAACC,KAAK,CACzB;;cAGD5C,aAAa,CAAC,IAAI,CAAC;;WACtB,YAAQ6C,KAAK,EAAE;YAAA;YACZ,MAAMC,YAAY,MAAMnD,KAAK,CAAC4C,MAAM,CAACC,KAAK,CAACK,UAAUA,OAAO;YAE5DE,OAAO,CAACF,KAAK,CAACC,YAAY,CAAC;YAC3B,0BAAA3C,eAAe,CAAC6B,OAAO,2DAAvB,uBAAyBa,KAAK,CAACC,YAAY,CAAC;WAC/C;UAAA;;;KAER;MAAA;;;EAED,oBACI7C,yEACIA,6BAAC+C,UAAU;IACPC,QAAQ,EAAElD,UAAU;IACpBmD,IAAI,EAAC,OAAO;IACZC,OAAO,EAAEd,WAAW;kBACR1C,KAAK,CAAC4C,MAAM,CAACC,KAAK,CAACY,OAAO;IACtCA,OAAO,EAAEzD,KAAK,CAAC4C,MAAM,CAACC,KAAK,CAACY,OAAO;IACnCC,GAAG,EAAEhD;IACP,EACDN,UAAU,IAAIyB,gBAAgB,CAACC,IAAI,KAAK,IAAI,iBACzCxB,6BAACqD,WAAW;IACRC,YAAY,EAAErB,gBAAgB;IAC9BsB,aAAa,EAAEpB,iBAAiB;IAChC1C,UAAU,EAAE8B;IAEnB,CACF;AAEX;;;;"}
|
1
|
+
{"version":3,"file":"PrintButton.js","sources":["../../../../../../../../../../src/components/Table3/components/toolbar/PrintButton/PrintButton.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\n\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { ToastReference, useToast } from '../../../../Toast/Toaster';\nimport { PrintIFrame } from './PrintIFrame';\nimport { Table3Props } from '../../../types';\nimport { useGlobalKeyDown } from '../../../../../hooks/useGlobalKeyDown';\nimport { WarningDialog } from './WarningDialog';\n\nconst SAFE_PRINT_CELL_COUNT = 10000;\n\nexport type PrintButtonProps<TType = unknown> = React.HTMLAttributes<HTMLButtonElement> & {\n table: RTable<TType>;\n tableProps: Table3Props<TType>;\n};\n\nexport function PrintButton<TType = unknown>(props: PrintButtonProps<TType>) {\n const { table, tableProps } = props;\n const { texts } = useLocalization();\n const toast = useToast();\n\n const [isPrinting, setIsPrinting] = React.useState(false);\n const [showWarningDialog, setShowWarningDialog] = React.useState(false);\n const loadingToastRef = React.useRef<ToastReference | null>(null);\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n const state = table.getState();\n const { printWarningDialogVisibility } = tableMeta.printing;\n\n const settings = React.useMemo(\n () => ({\n columnFilters: state.columnFilters,\n columnOrder: state.columnOrder,\n columnPinning: state.columnPinning,\n columnSizing: state.columnSizing,\n columnVisibility: state.columnVisibility,\n sorting: state.sorting,\n rowHeight: tableMeta.rowHeight.height,\n columnFreezingIndex: tableMeta.columnFreezing.frozenColumnIndex,\n }),\n [\n state.columnFilters,\n state.columnOrder,\n state.columnPinning,\n state.columnSizing,\n state.columnVisibility,\n state.sorting,\n tableMeta.rowHeight.height,\n tableMeta.columnFreezing.frozenColumnIndex,\n ]\n );\n const iframeTableProps = { ...tableProps, defaultSettings: settings };\n\n useGlobalKeyDown({ key: 'p', meta: true, shift: false }, (event: KeyboardEvent) => {\n event.preventDefault();\n // Starts custom printing\n buttonRef.current?.click();\n });\n\n const handleAfterPrint = () => {\n setIsPrinting(false);\n loadingToastRef.current?.close();\n };\n\n const handleBeforePrint = () => {\n loadingToastRef.current?.close();\n };\n\n const handlePrint = async () => {\n loadingToastRef.current = toast.loading(texts.table3.print.loading as any);\n\n const getCellCount = (data: TType[]) => (data.length ? data.length * Object.keys(data[0]).length : 0);\n let hasNonSafeCellCount = false;\n\n // if loadAll is not defined, just print with what we've got\n // don't compare length to data.length because the api might be choosing not to return all for performance\n if (!tableMeta.printing.loadAll) {\n const { data } = tableProps;\n const cellCount = getCellCount(data);\n\n hasNonSafeCellCount = cellCount > SAFE_PRINT_CELL_COUNT;\n } else {\n try {\n await tableMeta.printing.loadAll(\n table.getState().sorting,\n table.getState().columnFilters,\n tableMeta.search.query\n );\n\n // After the loadAll call above, the data changes. Hence, it becomes essential to acquire the data after\n // this call rather than before it.\n const { data } = tableProps;\n const cellCount = getCellCount(data);\n\n hasNonSafeCellCount = cellCount > SAFE_PRINT_CELL_COUNT;\n } catch (error) {\n const errorMessage = `${texts.table3.print.error}: ${error}`;\n\n console.error(errorMessage);\n loadingToastRef.current?.error(errorMessage);\n\n // in case of error, we return early\n return;\n }\n }\n\n if (hasNonSafeCellCount && printWarningDialogVisibility) {\n setShowWarningDialog(true);\n } else {\n // only set printing (mount the iframe) when the data has loaded, it prevents repaint performance slow downs\n setIsPrinting(true);\n }\n };\n\n const handleWarningDialogAccept = () => {\n setIsPrinting(true);\n };\n\n const handleWarningDialogClose = () => {\n loadingToastRef.current?.close();\n setShowWarningDialog(false);\n };\n\n return (\n <>\n <IconButton\n disabled={isPrinting}\n icon=\"print\"\n onClick={handlePrint}\n aria-label={texts.table3.print.tooltip}\n tooltip={texts.table3.print.tooltip}\n ref={buttonRef}\n />\n {isPrinting && iframeTableProps.data !== null && (\n <PrintIFrame\n onAfterPrint={handleAfterPrint}\n onBeforePrint={handleBeforePrint}\n tableProps={iframeTableProps as Table3Props<TType>}\n />\n )}\n <WarningDialog\n open={showWarningDialog}\n onAccept={handleWarningDialogAccept}\n onClose={handleWarningDialogClose}\n onVisibilityChange={tableMeta.printing.setPrintWarningDialogVisibility}\n />\n </>\n );\n}\n"],"names":["SAFE_PRINT_CELL_COUNT","PrintButton","props","table","tableProps","texts","useLocalization","toast","useToast","isPrinting","setIsPrinting","React","useState","showWarningDialog","setShowWarningDialog","loadingToastRef","useRef","buttonRef","tableMeta","options","meta","state","getState","printWarningDialogVisibility","printing","settings","useMemo","columnFilters","columnOrder","columnPinning","columnSizing","columnVisibility","sorting","rowHeight","height","columnFreezingIndex","columnFreezing","frozenColumnIndex","iframeTableProps","defaultSettings","useGlobalKeyDown","key","shift","event","preventDefault","current","click","handleAfterPrint","close","handleBeforePrint","handlePrint","hasNonSafeCellCount","loading","table3","print","getCellCount","data","length","Object","keys","loadAll","cellCount","search","query","error","errorMessage","console","handleWarningDialogAccept","handleWarningDialogClose","IconButton","disabled","icon","onClick","tooltip","ref","PrintIFrame","onAfterPrint","onBeforePrint","WarningDialog","open","onAccept","onClose","onVisibilityChange","setPrintWarningDialogVisibility"],"mappings":";;;;;;;;;AAWA,MAAMA,qBAAqB,GAAG,KAAK;SAOnBC,WAAW,CAAkBC,KAA8B;EACvE,MAAM;IAAEC,KAAK;IAAEC;GAAY,GAAGF,KAAK;EACnC,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,KAAK,GAAGC,QAAQ,EAAE;EAExB,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;EACzD,MAAM,CAACC,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGH,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;EACvE,MAAMG,eAAe,GAAGJ,cAAK,CAACK,MAAM,CAAwB,IAAI,CAAC;EACjE,MAAMC,SAAS,GAAGN,cAAK,CAACK,MAAM,CAAoB,IAAI,CAAC;EAEvD,MAAME,SAAS,GAAGf,KAAK,CAACgB,OAAO,CAACC,IAAwB;EACxD,MAAMC,KAAK,GAAGlB,KAAK,CAACmB,QAAQ,EAAE;EAC9B,MAAM;IAAEC;GAA8B,GAAGL,SAAS,CAACM,QAAQ;EAE3D,MAAMC,QAAQ,GAAGd,cAAK,CAACe,OAAO,CAC1B,OAAO;I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AI,CAAC;GACtB;EAED,MAAM0D,wBAAwB,GAAG;;IAC7B,0BAAArD,eAAe,CAAC8B,OAAO,2DAAvB,uBAAyBG,KAAK,EAAE;IAChClC,oBAAoB,CAAC,KAAK,CAAC;GAC9B;EAED,oBACIH,yEACIA,6BAAC0D,UAAU;IACPC,QAAQ,EAAE7D,UAAU;IACpB8D,IAAI,EAAC,OAAO;IACZC,OAAO,EAAEtB,WAAW;kBACR7C,KAAK,CAACgD,MAAM,CAACC,KAAK,CAACmB,OAAO;IACtCA,OAAO,EAAEpE,KAAK,CAACgD,MAAM,CAACC,KAAK,CAACmB,OAAO;IACnCC,GAAG,EAAEzD;IACP,EACDR,UAAU,IAAI6B,gBAAgB,CAACkB,IAAI,KAAK,IAAI,iBACzC7C,6BAACgE,WAAW;IACRC,YAAY,EAAE7B,gBAAgB;IAC9B8B,aAAa,EAAE5B,iBAAiB;IAChC7C,UAAU,EAAEkC;IAEnB,eACD3B,6BAACmE,aAAa;IACVC,IAAI,EAAElE,iBAAiB;IACvBmE,QAAQ,EAAEb,yBAAyB;IACnCc,OAAO,EAAEb,wBAAwB;IACjCc,kBAAkB,EAAEhE,SAAS,CAACM,QAAQ,CAAC2D;IACzC,CACH;AAEX;;;;"}
|
package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/WarningDialog.js
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
import { BadgeIcon } from '../../../../BadgeIcon/BadgeIcon.js';
|
3
|
+
import { useLocalization } from '../../../../Provider/Localization.js';
|
4
|
+
import { Button } from '../../../../Button/Button.js';
|
5
|
+
import { Checkbox } from '../../../../Checkbox/Checkbox.js';
|
6
|
+
import { Dialog } from '../../../../Dialog/Dialog.js';
|
7
|
+
import { Group } from '../../../../Group/Group.js';
|
8
|
+
|
9
|
+
const WarningDialog = ({
|
10
|
+
onAccept,
|
11
|
+
onClose,
|
12
|
+
onVisibilityChange,
|
13
|
+
...props
|
14
|
+
}) => {
|
15
|
+
const [hideWarningDialog, setHideWarningDialog] = React__default.useState(false);
|
16
|
+
const {
|
17
|
+
texts
|
18
|
+
} = useLocalization();
|
19
|
+
const handleClose = () => {
|
20
|
+
onClose();
|
21
|
+
// Change visibility state when the dialog is closing
|
22
|
+
onVisibilityChange === null || onVisibilityChange === void 0 ? void 0 : onVisibilityChange(!hideWarningDialog);
|
23
|
+
};
|
24
|
+
return /*#__PURE__*/React__default.createElement(Dialog, Object.assign({}, props, {
|
25
|
+
closeOnEscape: true,
|
26
|
+
onClose: handleClose,
|
27
|
+
showCloseButton: false,
|
28
|
+
size: "xs"
|
29
|
+
}), /*#__PURE__*/React__default.createElement(Dialog.Content, {
|
30
|
+
"aria-label": texts.table3.print.warningDialog.title
|
31
|
+
}, /*#__PURE__*/React__default.createElement(Dialog.Title, {
|
32
|
+
className: "text-center"
|
33
|
+
}, /*#__PURE__*/React__default.createElement(BadgeIcon, {
|
34
|
+
icon: "warning",
|
35
|
+
color: "yellow",
|
36
|
+
className: "mr-2"
|
37
|
+
}), texts.table3.print.warningDialog.title), /*#__PURE__*/React__default.createElement("p", null, texts.table3.print.warningDialog.description), /*#__PURE__*/React__default.createElement(Dialog.Footer, {
|
38
|
+
className: "flex items-center justify-between"
|
39
|
+
}, /*#__PURE__*/React__default.createElement(Checkbox, {
|
40
|
+
label: texts.table3.print.warningDialog.checkboxVisibilityLabel,
|
41
|
+
checked: hideWarningDialog,
|
42
|
+
onChange: setHideWarningDialog
|
43
|
+
}), /*#__PURE__*/React__default.createElement(Group, null, /*#__PURE__*/React__default.createElement(Button, {
|
44
|
+
onClick: handleClose
|
45
|
+
}, texts.table3.print.warningDialog.cancelButtonText), /*#__PURE__*/React__default.createElement(Button, {
|
46
|
+
appearance: "primary",
|
47
|
+
autoFocus: true,
|
48
|
+
onClick: () => {
|
49
|
+
handleClose();
|
50
|
+
onAccept();
|
51
|
+
}
|
52
|
+
}, texts.table3.print.warningDialog.printButtonText)))));
|
53
|
+
};
|
54
|
+
|
55
|
+
export { WarningDialog };
|
56
|
+
//# sourceMappingURL=WarningDialog.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"WarningDialog.js","sources":["../../../../../../../../../../src/components/Table3/components/toolbar/PrintButton/WarningDialog.tsx"],"sourcesContent":["import React from 'react';\n\nimport { BadgeIcon } from '../../../../BadgeIcon/BadgeIcon';\nimport { Button } from '../../../../Button/Button';\nimport { Checkbox } from '../../../../Checkbox/Checkbox';\nimport { Dialog, DialogProps } from '../../../../Dialog/Dialog';\nimport { Group } from '../../../../Group/Group';\nimport { useLocalization } from '../../../../Provider/Localization';\n\nexport type WarningDialogProps = Omit<DialogProps, 'children' | 'onClose'> & {\n onAccept: () => void;\n onClose: () => void;\n onVisibilityChange: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\nexport const WarningDialog = ({ onAccept, onClose, onVisibilityChange, ...props }: WarningDialogProps) => {\n const [hideWarningDialog, setHideWarningDialog] = React.useState(false);\n const { texts } = useLocalization();\n const handleClose = () => {\n onClose();\n // Change visibility state when the dialog is closing\n onVisibilityChange?.(!hideWarningDialog);\n };\n\n return (\n <Dialog {...props} closeOnEscape={true} onClose={handleClose} showCloseButton={false} size=\"xs\">\n <Dialog.Content aria-label={texts.table3.print.warningDialog.title}>\n <Dialog.Title className=\"text-center\">\n <BadgeIcon icon=\"warning\" color=\"yellow\" className=\"mr-2\" />\n {texts.table3.print.warningDialog.title}\n </Dialog.Title>\n <p>{texts.table3.print.warningDialog.description}</p>\n <Dialog.Footer className=\"flex items-center justify-between\">\n <Checkbox\n label={texts.table3.print.warningDialog.checkboxVisibilityLabel}\n checked={hideWarningDialog}\n onChange={setHideWarningDialog}\n />\n <Group>\n <Button onClick={handleClose}>{texts.table3.print.warningDialog.cancelButtonText}</Button>\n <Button\n appearance=\"primary\"\n autoFocus\n onClick={() => {\n handleClose();\n onAccept();\n }}>\n {texts.table3.print.warningDialog.printButtonText}\n </Button>\n </Group>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog>\n );\n};\n"],"names":["WarningDialog","onAccept","onClose","onVisibilityChange","props","hideWarningDialog","setHideWarningDialog","React","useState","texts","useLocalization","handleClose","Dialog","closeOnEscape","showCloseButton","size","Content","table3","print","warningDialog","title","Title","className","BadgeIcon","icon","color","description","Footer","Checkbox","label","checkboxVisibilityLabel","checked","onChange","Group","Button","onClick","cancelButtonText","appearance","autoFocus","printButtonText"],"mappings":";;;;;;;;MAeaA,aAAa,GAAG,CAAC;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,kBAAkB;EAAE,GAAGC;CAA2B;EACjG,MAAM,CAACC,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;EACvE,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,WAAW,GAAG;IAChBT,OAAO,EAAE;;IAETC,kBAAkB,aAAlBA,kBAAkB,uBAAlBA,kBAAkB,CAAG,CAACE,iBAAiB,CAAC;GAC3C;EAED,oBACIE,6BAACK,MAAM,oBAAKR,KAAK;IAAES,aAAa,EAAE,IAAI;IAAEX,OAAO,EAAES,WAAW;IAAEG,eAAe,EAAE,KAAK;IAAEC,IAAI,EAAC;mBACvFR,6BAACK,MAAM,CAACI,OAAO;kBAAaP,KAAK,CAACQ,MAAM,CAACC,KAAK,CAACC,aAAa,CAACC;kBACzDb,6BAACK,MAAM,CAACS,KAAK;IAACC,SAAS,EAAC;kBACpBf,6BAACgB,SAAS;IAACC,IAAI,EAAC,SAAS;IAACC,KAAK,EAAC,QAAQ;IAACH,SAAS,EAAC;IAAS,EAC3Db,KAAK,CAACQ,MAAM,CAACC,KAAK,CAACC,aAAa,CAACC,KAAK,CAC5B,eACfb,wCAAIE,KAAK,CAACQ,MAAM,CAACC,KAAK,CAACC,aAAa,CAACO,WAAW,CAAK,eACrDnB,6BAACK,MAAM,CAACe,MAAM;IAACL,SAAS,EAAC;kBACrBf,6BAACqB,QAAQ;IACLC,KAAK,EAAEpB,KAAK,CAACQ,MAAM,CAACC,KAAK,CAACC,aAAa,CAACW,uBAAuB;IAC/DC,OAAO,EAAE1B,iBAAiB;IAC1B2B,QAAQ,EAAE1B;IACZ,eACFC,6BAAC0B,KAAK,qBACF1B,6BAAC2B,MAAM;IAACC,OAAO,EAAExB;KAAcF,KAAK,CAACQ,MAAM,CAACC,KAAK,CAACC,aAAa,CAACiB,gBAAgB,CAAU,eAC1F7B,6BAAC2B,MAAM;IACHG,UAAU,EAAC,SAAS;IACpBC,SAAS;IACTH,OAAO,EAAE;MACLxB,WAAW,EAAE;MACbV,QAAQ,EAAE;;KAEbQ,KAAK,CAACQ,MAAM,CAACC,KAAK,CAACC,aAAa,CAACoB,eAAe,CAC5C,CACL,CACI,CACH,CACZ;AAEjB;;;;"}
|
@@ -6,7 +6,7 @@ const PRINT_STYLES = `
|
|
6
6
|
}
|
7
7
|
|
8
8
|
@media print {
|
9
|
-
|
9
|
+
html, body, #root {
|
10
10
|
overflow: auto !important;
|
11
11
|
height: auto !important;
|
12
12
|
width: auto !important;
|
@@ -25,7 +25,7 @@ const PRINT_STYLES = `
|
|
25
25
|
* Summary row cells
|
26
26
|
*/
|
27
27
|
[role="table"] [role="rowgroup"]:last-child [role="cell"] {
|
28
|
-
border-
|
28
|
+
border-width: 0 !important;
|
29
29
|
}
|
30
30
|
|
31
31
|
[role="table"] a {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useParentStylesheets.js","sources":["../../../../../../../../../../../src/components/Table3/components/toolbar/PrintButton/hooks/useParentStylesheets.ts"],"sourcesContent":["import React from 'react';\n\nconst PRINT_STYLES = `\n@page {\n margin: 16px;\n}\n\n@media print {\n
|
1
|
+
{"version":3,"file":"useParentStylesheets.js","sources":["../../../../../../../../../../../src/components/Table3/components/toolbar/PrintButton/hooks/useParentStylesheets.ts"],"sourcesContent":["import React from 'react';\n\nconst PRINT_STYLES = `\n@page {\n margin: 16px;\n}\n\n@media print {\n html, body, #root {\n overflow: auto !important;\n height: auto !important;\n width: auto !important;\n }\n\n [role=\"table\"] {\n border-width: 0 !important;\n overflow-y: hidden !important;\n }\n\n [role=\"table\"] [role=\"columnheader\"] {\n border-bottom-width: 1px !important;\n }\n\n /*\n * Summary row cells\n */\n [role=\"table\"] [role=\"rowgroup\"]:last-child [role=\"cell\"] {\n border-width: 0 !important;\n }\n\n [role=\"table\"] a {\n color: rgb(28 28 28);\n }\n\n [data-taco=\"alert\"],\n [data-taco=\"banner\"],\n [data-taco=\"hanger\"],\n [data-taco=\"toast\"],\n [data-taco=\"table3-toolbar\"],\n [data-taco=\"tooltip\"],\n /*\n * Tour components\n */\n [id^=\"react-joyride\"]\n {\n display: none !important;\n }\n}\n`;\n\nexport function useParentStylesheets(iframeWindow: Window | null | undefined) {\n const [ready, setReady] = React.useState(false);\n\n React.useEffect(() => {\n if (!iframeWindow) {\n return;\n }\n\n const parentDocument = iframeWindow.parent.document;\n const iframeDocument = iframeWindow.document;\n\n // add our custom print styles\n const customPrintStyles = iframeDocument.createElement('style');\n\n if (customPrintStyles) {\n customPrintStyles.innerHTML = PRINT_STYLES;\n iframeDocument.head.appendChild(customPrintStyles);\n }\n\n // Get style tags from the parent\n const parentStylesheets = Array.from(\n parentDocument.querySelectorAll('style:not([data-taco=\"table3-column-freezing-styles\"])')\n );\n // Get linked stylesheets from the parent\n const linkStylesheets = Array.from(parentDocument.querySelectorAll('[rel=\"stylesheet\"]'));\n\n // We want to add tailwind styles specifically but there is no guarenteed way to know which style tag has\n // tailwind styles, so we add all the styles present in the parent frame\n parentStylesheets.forEach(parentStyle => {\n const styleTag = iframeDocument.createElement('style');\n\n styleTag.innerHTML = parentStyle.innerHTML;\n iframeDocument.head.appendChild(styleTag);\n });\n\n // Add all link tags that are stylesheets, to the iframe head, so that we include the taco and client styles\n linkStylesheets.forEach(linkStylesheet => {\n const linkTag = iframeDocument.createElement('link');\n\n linkTag.setAttribute('rel', 'stylesheet');\n\n linkTag.innerHTML = linkStylesheet.innerHTML;\n iframeDocument.head.appendChild(linkTag);\n });\n\n setReady(true);\n }, [iframeWindow]);\n\n return ready;\n}\n"],"names":["PRINT_STYLES","useParentStylesheets","iframeWindow","ready","setReady","React","useState","useEffect","parentDocument","parent","document","iframeDocument","customPrintStyles","createElement","innerHTML","head","appendChild","parentStylesheets","Array","from","querySelectorAll","linkStylesheets","forEach","parentStyle","styleTag","linkStylesheet","linkTag","setAttribute"],"mappings":";;AAEA,MAAMA,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CjB;SAEeC,oBAAoB,CAACC,YAAuC;EACxE,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;EAE/CD,cAAK,CAACE,SAAS,CAAC;IACZ,IAAI,CAACL,YAAY,EAAE;MACf;;IAGJ,MAAMM,cAAc,GAAGN,YAAY,CAACO,MAAM,CAACC,QAAQ;IACnD,MAAMC,cAAc,GAAGT,YAAY,CAACQ,QAAQ;;IAG5C,MAAME,iBAAiB,GAAGD,cAAc,CAACE,aAAa,CAAC,OAAO,CAAC;IAE/D,IAAID,iBAAiB,EAAE;MACnBA,iBAAiB,CAACE,SAAS,GAAGd,YAAY;MAC1CW,cAAc,CAACI,IAAI,CAACC,WAAW,CAACJ,iBAAiB,CAAC;;;IAItD,MAAMK,iBAAiB,GAAGC,KAAK,CAACC,IAAI,CAChCX,cAAc,CAACY,gBAAgB,CAAC,wDAAwD,CAAC,CAC5F;;IAED,MAAMC,eAAe,GAAGH,KAAK,CAACC,IAAI,CAACX,cAAc,CAACY,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;;;IAIzFH,iBAAiB,CAACK,OAAO,CAACC,WAAW;MACjC,MAAMC,QAAQ,GAAGb,cAAc,CAACE,aAAa,CAAC,OAAO,CAAC;MAEtDW,QAAQ,CAACV,SAAS,GAAGS,WAAW,CAACT,SAAS;MAC1CH,cAAc,CAACI,IAA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