@economic/taco 2.12.1 → 2.14.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Field/Field.d.ts +4 -2
- package/dist/components/Icon/components/Location.d.ts +3 -0
- package/dist/components/Icon/components/index.d.ts +1 -1
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Menu/components/Item.d.ts +1 -1
- package/dist/components/Menu/components/Link.d.ts +1 -1
- package/dist/components/Navigation2/components/Link.d.ts +1 -1
- package/dist/components/Provider/Localization.d.ts +1 -113
- package/dist/components/Select2/components/Option.d.ts +7 -5
- package/dist/components/Select2/components/Search.d.ts +1 -1
- package/dist/components/Table3/Table3.d.ts +9 -1
- package/dist/components/Table3/components/columns/header/Group.d.ts +15 -0
- package/dist/components/Table3/components/columns/header/Header.d.ts +5 -0
- package/dist/components/Table3/components/columns/internal/EditingActions.d.ts +1 -1
- package/dist/components/Table3/components/columns/styles.d.ts +2 -2
- package/dist/components/Table3/components/toolbar/Filter/filters/components/Filter.d.ts +4 -4
- package/dist/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.d.ts +3 -2
- package/dist/components/Table3/components/toolbar/Filter/filters/components/Placeholder.d.ts +3 -2
- package/dist/components/Table3/components/toolbar/FontSize.d.ts +4 -0
- package/dist/components/Table3/hooks/features/useHeaderOffsetStyle.d.ts +3 -0
- package/dist/components/Table3/hooks/useCssGrid.d.ts +2 -1
- package/dist/components/Table3/hooks/useTable.d.ts +1 -1
- package/dist/components/Table3/types.d.ts +8 -1
- package/dist/components/Tag/Tag.d.ts +1 -1
- package/dist/esm/index.css +24 -6
- package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +1 -1
- package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Field/Field.js +6 -4
- package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Location.js +17 -0
- package/dist/esm/packages/taco/src/components/Icon/components/Location.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/index.js +2 -0
- package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +1 -110
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Option.js +13 -6
- package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Search.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Search.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +7 -6
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +29 -11
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +2 -5
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +1 -4
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js +70 -0
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js +26 -8
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js +6 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +3 -2
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js +13 -9
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js +14 -2
- package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js +10 -7
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +15 -8
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Filter.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Filter.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js +25 -4
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js +0 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterValue.js +5 -3
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterValue.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Placeholder.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Placeholder.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/FontSize.js +9 -4
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/FontSize.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +2 -3
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/RowHeight.js +3 -2
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/RowHeight.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useHeaderOffsetStyle.js +24 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useHeaderOffsetStyle.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSettings.js +6 -7
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSettings.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js +48 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js +34 -9
- package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useCssGrid.js +6 -5
- package/dist/esm/packages/taco/src/components/Table3/hooks/useCssGrid.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js +11 -9
- package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js.map +1 -1
- 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/index.js +1 -2
- package/dist/esm/packages/taco/src/index.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/dom.js +1 -2
- package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
- package/dist/index.css +24 -6
- package/dist/index.d.ts +0 -1
- package/dist/taco.cjs.development.js +697 -4100
- 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/tailwind.config.js +3 -0
- package/types.json +14334 -32345
- package/dist/components/Table2/Table2.d.ts +0 -130
- package/dist/components/Table2/components/BatchActionsMenu.d.ts +0 -10
- package/dist/components/Table2/components/ColumnSettingsButton.d.ts +0 -6
- package/dist/components/Table2/components/EditModeButton.d.ts +0 -8
- package/dist/components/Table2/components/RowDensityButton.d.ts +0 -7
- package/dist/components/Table2/components/Search.d.ts +0 -3
- package/dist/components/Table2/components/ShortcutsGuideButton.d.ts +0 -7
- package/dist/components/Table2/components/column/Base.d.ts +0 -14
- package/dist/components/Table2/components/column/Cell.d.ts +0 -15
- package/dist/components/Table2/components/column/Footer.d.ts +0 -9
- package/dist/components/Table2/components/column/Header.d.ts +0 -11
- package/dist/components/Table2/components/column/Indicator.d.ts +0 -17
- package/dist/components/Table2/components/column/ValidationError.d.ts +0 -5
- package/dist/components/Table2/components/column/utils.d.ts +0 -3
- package/dist/components/Table2/components/filters/FiltersButton.d.ts +0 -7
- package/dist/components/Table2/components/filters/components/Column.d.ts +0 -11
- package/dist/components/Table2/components/filters/components/ColumnFilter.d.ts +0 -10
- package/dist/components/Table2/components/filters/components/Comparator.d.ts +0 -11
- package/dist/components/Table2/components/filters/components/EmptyFilter.d.ts +0 -13
- package/dist/components/Table2/components/filters/components/InferredControl.d.ts +0 -10
- package/dist/components/Table2/components/row/Context.d.ts +0 -24
- package/dist/components/Table2/components/row/ExpandedRow.d.ts +0 -6
- package/dist/components/Table2/components/row/Row.d.ts +0 -2
- package/dist/components/Table2/hooks/listeners/useActiveCellStateListener.d.ts +0 -3
- package/dist/components/Table2/hooks/listeners/useActiveRowStateListener.d.ts +0 -3
- package/dist/components/Table2/hooks/listeners/useColumnOffsetStateListener.d.ts +0 -3
- package/dist/components/Table2/hooks/listeners/useFilterStateListener.d.ts +0 -3
- package/dist/components/Table2/hooks/listeners/useRowSelectionListener.d.ts +0 -3
- package/dist/components/Table2/hooks/listeners/useSettingsStateListener.d.ts +0 -3
- package/dist/components/Table2/hooks/useActiveCell.d.ts +0 -26
- package/dist/components/Table2/hooks/useActiveRow.d.ts +0 -10
- package/dist/components/Table2/hooks/useColumnDefinitions.d.ts +0 -37
- package/dist/components/Table2/hooks/useEditMode.d.ts +0 -28
- package/dist/components/Table2/hooks/useGridTemplate.d.ts +0 -2
- package/dist/components/Table2/hooks/useTable.d.ts +0 -46
- package/dist/components/Table2/hooks/useTableShortcuts.d.ts +0 -2
- package/dist/components/Table2/hooks/useVirtualiser.d.ts +0 -23
- package/dist/components/Table2/types.d.ts +0 -148
- package/dist/components/Table2/utilities/cell.d.ts +0 -14
- package/dist/components/Table2/utilities/columns.d.ts +0 -16
- package/dist/components/Table2/utilities/filterFn.d.ts +0 -3
- package/dist/esm/packages/taco/src/components/Table2/Table2.js +0 -422
- package/dist/esm/packages/taco/src/components/Table2/Table2.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/components/BatchActionsMenu.js +0 -83
- package/dist/esm/packages/taco/src/components/Table2/components/BatchActionsMenu.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/components/ColumnSettingsButton.js +0 -116
- package/dist/esm/packages/taco/src/components/Table2/components/ColumnSettingsButton.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/components/EditModeButton.js +0 -81
- package/dist/esm/packages/taco/src/components/Table2/components/EditModeButton.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/components/RowDensityButton.js +0 -47
- package/dist/esm/packages/taco/src/components/Table2/components/RowDensityButton.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/components/Search.js +0 -62
- package/dist/esm/packages/taco/src/components/Table2/components/Search.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/components/column/Base.js +0 -32
- package/dist/esm/packages/taco/src/components/Table2/components/column/Base.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/components/column/Cell.js +0 -605
- package/dist/esm/packages/taco/src/components/Table2/components/column/Cell.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/components/column/Footer.js +0 -32
- package/dist/esm/packages/taco/src/components/Table2/components/column/Footer.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/components/column/Header.js +0 -243
- package/dist/esm/packages/taco/src/components/Table2/components/column/Header.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/components/column/Indicator.js +0 -73
- package/dist/esm/packages/taco/src/components/Table2/components/column/Indicator.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/components/column/ValidationError.js +0 -30
- package/dist/esm/packages/taco/src/components/Table2/components/column/ValidationError.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/components/column/utils.js +0 -39
- package/dist/esm/packages/taco/src/components/Table2/components/column/utils.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/components/filters/FiltersButton.js +0 -155
- package/dist/esm/packages/taco/src/components/Table2/components/filters/FiltersButton.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/components/filters/components/Column.js +0 -31
- package/dist/esm/packages/taco/src/components/Table2/components/filters/components/Column.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/components/filters/components/ColumnFilter.js +0 -129
- package/dist/esm/packages/taco/src/components/Table2/components/filters/components/ColumnFilter.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/components/filters/components/Comparator.js +0 -68
- package/dist/esm/packages/taco/src/components/Table2/components/filters/components/Comparator.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/components/filters/components/EmptyFilter.js +0 -63
- package/dist/esm/packages/taco/src/components/Table2/components/filters/components/EmptyFilter.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/components/filters/components/InferredControl.js +0 -99
- package/dist/esm/packages/taco/src/components/Table2/components/filters/components/InferredControl.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/components/row/Context.js +0 -58
- package/dist/esm/packages/taco/src/components/Table2/components/row/Context.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/components/row/ExpandedRow.js +0 -36
- package/dist/esm/packages/taco/src/components/Table2/components/row/ExpandedRow.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/components/row/Row.js +0 -44
- package/dist/esm/packages/taco/src/components/Table2/components/row/Row.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useActiveRowStateListener.js +0 -19
- package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useActiveRowStateListener.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useColumnOffsetStateListener.js +0 -28
- package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useColumnOffsetStateListener.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useFilterStateListener.js +0 -12
- package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useFilterStateListener.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useRowSelectionListener.js +0 -18
- package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useRowSelectionListener.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useSettingsStateListener.js +0 -25
- package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useSettingsStateListener.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/hooks/useActiveRow.js +0 -33
- package/dist/esm/packages/taco/src/components/Table2/hooks/useActiveRow.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/hooks/useColumnDefinitions.js +0 -122
- package/dist/esm/packages/taco/src/components/Table2/hooks/useColumnDefinitions.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/hooks/useEditMode.js +0 -112
- package/dist/esm/packages/taco/src/components/Table2/hooks/useEditMode.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/hooks/useGridTemplate.js +0 -34
- package/dist/esm/packages/taco/src/components/Table2/hooks/useGridTemplate.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/hooks/useTable.js +0 -222
- package/dist/esm/packages/taco/src/components/Table2/hooks/useTable.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/hooks/useTableShortcuts.js +0 -46
- package/dist/esm/packages/taco/src/components/Table2/hooks/useTableShortcuts.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/hooks/useVirtualiser.js +0 -48
- package/dist/esm/packages/taco/src/components/Table2/hooks/useVirtualiser.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/types.js +0 -18
- package/dist/esm/packages/taco/src/components/Table2/types.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/utilities/cell.js +0 -41
- package/dist/esm/packages/taco/src/components/Table2/utilities/cell.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/utilities/columns.js +0 -387
- package/dist/esm/packages/taco/src/components/Table2/utilities/columns.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table2/utilities/filterFn.js +0 -100
- package/dist/esm/packages/taco/src/components/Table2/utilities/filterFn.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Truncate/Truncate.js +0 -32
- package/dist/esm/packages/taco/src/components/Truncate/Truncate.js.map +0 -1
- package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js +0 -20
- package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js.map +0 -1
@@ -1,39 +0,0 @@
|
|
1
|
-
import { isDate } from 'date-fns';
|
2
|
-
import { isWeakEqual } from '../../../../utils/date.js';
|
3
|
-
|
4
|
-
const hasChanged = (value, newValue) => {
|
5
|
-
if (isDate(value) && isDate(newValue)) {
|
6
|
-
return !isWeakEqual(value, newValue);
|
7
|
-
} else if (Array.isArray(value)) {
|
8
|
-
return JSON.stringify(value) !== JSON.stringify(newValue);
|
9
|
-
}
|
10
|
-
return value !== newValue;
|
11
|
-
};
|
12
|
-
const willRowMoveAfterSorting = (value, cell, rowIndex, rows, desc) => {
|
13
|
-
const miniSortRows = [{
|
14
|
-
...cell.row,
|
15
|
-
original: {
|
16
|
-
...cell.row.original,
|
17
|
-
[cell.column.id]: value
|
18
|
-
}
|
19
|
-
}];
|
20
|
-
// getValue is used by the built-in sort functons, so we need to make sure it returns the changed value
|
21
|
-
miniSortRows[0].getValue = () => value;
|
22
|
-
let index = 0;
|
23
|
-
if (rowIndex > 0) {
|
24
|
-
miniSortRows.unshift(rows[rowIndex - 1]);
|
25
|
-
index = 1;
|
26
|
-
}
|
27
|
-
if (rowIndex < rows.length - 1) {
|
28
|
-
miniSortRows.push(rows[rowIndex + 1]);
|
29
|
-
}
|
30
|
-
let resortedRows = [...miniSortRows].sort((a, b) => cell.column.getSortingFn()(a, b, cell.column.id));
|
31
|
-
if (desc) {
|
32
|
-
resortedRows = resortedRows.reverse();
|
33
|
-
}
|
34
|
-
return resortedRows[index].id !== cell.row.id;
|
35
|
-
};
|
36
|
-
const clickableNodeNames = ['INPUT', 'BUTTON', 'A', 'SELECT', 'OPTION', 'LABEL', 'TEXTAREA', 'DETAILS'];
|
37
|
-
|
38
|
-
export { clickableNodeNames, hasChanged, willRowMoveAfterSorting };
|
39
|
-
//# sourceMappingURL=utils.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../../../../../../src/components/Table2/components/column/utils.ts"],"sourcesContent":["import { isDate } from 'date-fns';\n\nimport { isWeakEqual as isWeakEqualDate } from '../../../../utils/date';\n\nexport const hasChanged = (value, newValue) => {\n if (isDate(value) && isDate(newValue)) {\n return !isWeakEqualDate(value, newValue);\n } else if (Array.isArray(value)) {\n return JSON.stringify(value) !== JSON.stringify(newValue);\n }\n\n return value !== newValue;\n};\n\nexport const willRowMoveAfterSorting = (value, cell, rowIndex, rows, desc): boolean => {\n const miniSortRows = [{ ...cell.row, original: { ...cell.row.original, [cell.column.id]: value } }];\n // getValue is used by the built-in sort functons, so we need to make sure it returns the changed value\n miniSortRows[0].getValue = () => value;\n\n let index = 0;\n\n if (rowIndex > 0) {\n miniSortRows.unshift(rows[rowIndex - 1]);\n index = 1;\n }\n\n if (rowIndex < rows.length - 1) {\n miniSortRows.push(rows[rowIndex + 1]);\n }\n\n let resortedRows = [...miniSortRows].sort((a, b) => cell.column.getSortingFn()(a, b, cell.column.id));\n\n if (desc) {\n resortedRows = resortedRows.reverse();\n }\n\n return resortedRows[index].id !== cell.row.id;\n};\n\nexport const clickableNodeNames = ['INPUT', 'BUTTON', 'A', 'SELECT', 'OPTION', 'LABEL', 'TEXTAREA', 'DETAILS'];\n"],"names":["hasChanged","value","newValue","isDate","isWeakEqualDate","Array","isArray","JSON","stringify","willRowMoveAfterSorting","cell","rowIndex","rows","desc","miniSortRows","row","original","column","id","getValue","index","unshift","length","push","resortedRows","sort","a","b","getSortingFn","reverse","clickableNodeNames"],"mappings":";;;MAIaA,UAAU,GAAGA,CAACC,KAAK,EAAEC,QAAQ;EACtC,IAAIC,MAAM,CAACF,KAAK,CAAC,IAAIE,MAAM,CAACD,QAAQ,CAAC,EAAE;IACnC,OAAO,CAACE,WAAe,CAACH,KAAK,EAAEC,QAAQ,CAAC;GAC3C,MAAM,IAAIG,KAAK,CAACC,OAAO,CAACL,KAAK,CAAC,EAAE;IAC7B,OAAOM,IAAI,CAACC,SAAS,CAACP,KAAK,CAAC,KAAKM,IAAI,CAACC,SAAS,CAACN,QAAQ,CAAC;;EAG7D,OAAOD,KAAK,KAAKC,QAAQ;AAC7B;MAEaO,uBAAuB,GAAGA,CAACR,KAAK,EAAES,IAAI,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,IAAI;EACrE,MAAMC,YAAY,GAAG,CAAC;IAAE,GAAGJ,IAAI,CAACK,GAAG;IAAEC,QAAQ,EAAE;MAAE,GAAGN,IAAI,CAACK,GAAG,CAACC,QAAQ;MAAE,CAACN,IAAI,CAACO,MAAM,CAACC,EAAE,GAAGjB;;GAAS,CAAC;;EAEnGa,YAAY,CAAC,CAAC,CAAC,CAACK,QAAQ,GAAG,MAAMlB,KAAK;EAEtC,IAAImB,KAAK,GAAG,CAAC;EAEb,IAAIT,QAAQ,GAAG,CAAC,EAAE;IACdG,YAAY,CAACO,OAAO,CAACT,IAAI,CAACD,QAAQ,GAAG,CAAC,CAAC,CAAC;IACxCS,KAAK,GAAG,CAAC;;EAGb,IAAIT,QAAQ,GAAGC,IAAI,CAACU,MAAM,GAAG,CAAC,EAAE;IAC5BR,YAAY,CAACS,IAAI,CAACX,IAAI,CAACD,QAAQ,GAAG,CAAC,CAAC,CAAC;;EAGzC,IAAIa,YAAY,GAAG,CAAC,GAAGV,YAAY,CAAC,CAACW,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKjB,IAAI,CAACO,MAAM,CAACW,YAAY,EAAE,CAACF,CAAC,EAAEC,CAAC,EAAEjB,IAAI,CAACO,MAAM,CAACC,EAAE,CAAC,CAAC;EAErG,IAAIL,IAAI,EAAE;IACNW,YAAY,GAAGA,YAAY,CAACK,OAAO,EAAE;;EAGzC,OAAOL,YAAY,CAACJ,KAAK,CAAC,CAACF,EAAE,KAAKR,IAAI,CAACK,GAAG,CAACG,EAAE;AACjD;MAEaY,kBAAkB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS;;;;"}
|
@@ -1,155 +0,0 @@
|
|
1
|
-
import React__default from 'react';
|
2
|
-
import cn from 'classnames';
|
3
|
-
import { Icon } from '../../../Icon/Icon.js';
|
4
|
-
import { useGlobalKeyDown } from '../../../../hooks/useGlobalKeyDown.js';
|
5
|
-
import { useLocalization } from '../../../Provider/Localization.js';
|
6
|
-
import { Button } from '../../../Button/Button.js';
|
7
|
-
import { Popover } from '../../../Popover/Popover.js';
|
8
|
-
import { Shortcut } from '../../../Shortcut/Shortcut.js';
|
9
|
-
import { isInternalColumn } from '../../utilities/columns.js';
|
10
|
-
import { Table2FilterComparator } from '../../types.js';
|
11
|
-
import { ColumnFilter } from './components/ColumnFilter.js';
|
12
|
-
import { EmptyFilter } from './components/EmptyFilter.js';
|
13
|
-
|
14
|
-
const FiltersButton = ({
|
15
|
-
length,
|
16
|
-
table
|
17
|
-
}) => {
|
18
|
-
const {
|
19
|
-
texts
|
20
|
-
} = useLocalization();
|
21
|
-
const ref = React__default.useRef(null);
|
22
|
-
const allColumns = table.getAllLeafColumns().filter(column => !isInternalColumn(column.id)).sort((a, b) => {
|
23
|
-
var _a$columnDef, _b$columnDef;
|
24
|
-
return (_a$columnDef = a.columnDef) === null || _a$columnDef === void 0 ? void 0 : _a$columnDef.header.localeCompare((_b$columnDef = b.columnDef) === null || _b$columnDef === void 0 ? void 0 : _b$columnDef.header);
|
25
|
-
});
|
26
|
-
const {
|
27
|
-
shouldDisableTableActions
|
28
|
-
} = table.options.meta;
|
29
|
-
const columnFilters = table.getState().columnFilters;
|
30
|
-
const filteredColumns = columnFilters.reduce((columns, columnFilter) => {
|
31
|
-
const column = allColumns.find(c => c.id === columnFilter.id);
|
32
|
-
if (column) {
|
33
|
-
return [...columns, column];
|
34
|
-
}
|
35
|
-
return columns;
|
36
|
-
}, []);
|
37
|
-
const [emptyFilterCount, setEmptyFilterCount] = React__default.useState(1);
|
38
|
-
const handleAdd = () => setEmptyFilterCount(emptyFilterCount + 1);
|
39
|
-
const handleReset = () => {
|
40
|
-
table.resetColumnFilters();
|
41
|
-
setEmptyFilterCount(1);
|
42
|
-
};
|
43
|
-
useGlobalKeyDown({
|
44
|
-
key: 'f',
|
45
|
-
meta: true,
|
46
|
-
shift: true
|
47
|
-
}, event => {
|
48
|
-
var _ref$current;
|
49
|
-
event.preventDefault();
|
50
|
-
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.click();
|
51
|
-
});
|
52
|
-
const handleEmptyFilterChange = columnId => {
|
53
|
-
// create an actual filter on that column that the user selected
|
54
|
-
const column = allColumns.find(c => c.getCanFilter() && c.id === columnId);
|
55
|
-
if (column) {
|
56
|
-
column.setFilterValue({
|
57
|
-
comparator: undefined,
|
58
|
-
value: undefined
|
59
|
-
});
|
60
|
-
}
|
61
|
-
// hide the empty filter row because we now have a real filter
|
62
|
-
setEmptyFilterCount(emptyFilterCount - 1);
|
63
|
-
};
|
64
|
-
const handleRemove = () => {
|
65
|
-
if (filteredColumns.length === 1 && emptyFilterCount === 0) {
|
66
|
-
setEmptyFilterCount(1);
|
67
|
-
}
|
68
|
-
};
|
69
|
-
const handleRemoveEmptyFilter = () => {
|
70
|
-
setEmptyFilterCount(emptyFilterCount - 1);
|
71
|
-
};
|
72
|
-
const handleOpenChange = () => {
|
73
|
-
const emptyFilterCount = filteredColumns.length === 0 ? 1 : 0;
|
74
|
-
setEmptyFilterCount(emptyFilterCount);
|
75
|
-
};
|
76
|
-
const filters = filteredColumns.length > 0 && filteredColumns.filter(column => {
|
77
|
-
var _column$columnDef$met;
|
78
|
-
const controlType = (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.control;
|
79
|
-
const value = column.getFilterValue().value;
|
80
|
-
const comparator = column.getFilterValue().comparator;
|
81
|
-
if (Array.isArray(value)) {
|
82
|
-
if (value.length > 0 && value.find(item => item !== undefined)) {
|
83
|
-
return true;
|
84
|
-
}
|
85
|
-
} else if (value) {
|
86
|
-
return true;
|
87
|
-
} else if ([Table2FilterComparator.IsEmpty, Table2FilterComparator.IsNotEmpty].includes(comparator)) {
|
88
|
-
if (!controlType) {
|
89
|
-
return true;
|
90
|
-
}
|
91
|
-
}
|
92
|
-
return false;
|
93
|
-
});
|
94
|
-
const filtersApplied = filters && filters.length;
|
95
|
-
return /*#__PURE__*/React__default.createElement(Button, {
|
96
|
-
"aria-label": texts.table2.filters.tooltip,
|
97
|
-
appearance: filtersApplied ? 'primary' : 'default',
|
98
|
-
className: cn({
|
99
|
-
'!wcag-blue-100': filtersApplied
|
100
|
-
}),
|
101
|
-
disabled: shouldDisableTableActions,
|
102
|
-
popover: popoverProps => /*#__PURE__*/React__default.createElement(Popover, Object.assign({}, popoverProps, {
|
103
|
-
onChange: handleOpenChange
|
104
|
-
}), /*#__PURE__*/React__default.createElement(Popover.Content, null, /*#__PURE__*/React__default.createElement("div", {
|
105
|
-
className: "flex w-[40rem] flex-col gap-4"
|
106
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
107
|
-
className: "flex h-8"
|
108
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
109
|
-
className: "flex w-full items-center gap-2"
|
110
|
-
}, /*#__PURE__*/React__default.createElement("h4", {
|
111
|
-
className: "mb-0 inline-flex"
|
112
|
-
}, texts.table2.filters.button), /*#__PURE__*/React__default.createElement("p", {
|
113
|
-
className: "text-grey-700 mb-0 mr-auto mt-px inline-flex"
|
114
|
-
}, texts.table2.filters.total.replace('[CURRENT]', String(table.getFilteredRowModel().rows.length)).replace('[TOTAL]', String(length)))), columnFilters.length || emptyFilterCount > 1 ? /*#__PURE__*/React__default.createElement(Button, {
|
115
|
-
onClick: handleReset
|
116
|
-
}, texts.table2.filters.buttons.clearFilters) : null), /*#__PURE__*/React__default.createElement("div", {
|
117
|
-
className: "flex flex-col gap-2"
|
118
|
-
}, filteredColumns.map((column, index) => /*#__PURE__*/React__default.createElement(ColumnFilter, {
|
119
|
-
key: `${column.id}_${index}`,
|
120
|
-
allColumns: allColumns,
|
121
|
-
index: index,
|
122
|
-
column: column,
|
123
|
-
table: table,
|
124
|
-
onRemove: handleRemove
|
125
|
-
})), [...Array(emptyFilterCount)].map((_, index) => /*#__PURE__*/React__default.createElement(EmptyFilter, {
|
126
|
-
key: `emptyFilter_${index}`,
|
127
|
-
index: index,
|
128
|
-
allColumns: allColumns,
|
129
|
-
table: table,
|
130
|
-
onChange: value => handleEmptyFilterChange(value),
|
131
|
-
emptyFilterCount: emptyFilterCount,
|
132
|
-
filteredColumns: filteredColumns,
|
133
|
-
onRemove: handleRemoveEmptyFilter
|
134
|
-
})), /*#__PURE__*/React__default.createElement("div", {
|
135
|
-
className: "justify-start"
|
136
|
-
}, /*#__PURE__*/React__default.createElement(Button, {
|
137
|
-
appearance: "discrete",
|
138
|
-
onClick: handleAdd
|
139
|
-
}, "+ ", texts.table2.filters.buttons.addNewFilter)))))),
|
140
|
-
ref: ref,
|
141
|
-
tooltip: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table2.filters.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
|
142
|
-
className: "ml-2",
|
143
|
-
keys: {
|
144
|
-
key: 'f',
|
145
|
-
meta: true,
|
146
|
-
shift: true
|
147
|
-
}
|
148
|
-
}))
|
149
|
-
}, /*#__PURE__*/React__default.createElement(Icon, {
|
150
|
-
name: filtersApplied ? 'filter-solid' : 'filter'
|
151
|
-
}), texts.table2.filters.button, " ", filtersApplied ? `(${filtersApplied})` : '');
|
152
|
-
};
|
153
|
-
|
154
|
-
export { FiltersButton };
|
155
|
-
//# sourceMappingURL=FiltersButton.js.map
|
package/dist/esm/packages/taco/src/components/Table2/components/filters/FiltersButton.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"FiltersButton.js","sources":["../../../../../../../../../src/components/Table2/components/filters/FiltersButton.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Table as RTTable, Column as RTColumn, TableMeta } from '@tanstack/react-table';\nimport { Button } from '../../../Button/Button';\nimport { Icon } from '../../../Icon/Icon';\nimport { Popover } from '../../../Popover/Popover';\nimport { Table2Filter, Table2FilterComparator } from '../../types';\nimport { isInternalColumn } from '../../utilities/columns';\nimport { ColumnFilter } from './components/ColumnFilter';\nimport { EmptyFilter } from './components/EmptyFilter';\nimport { Shortcut } from '../../../Shortcut/Shortcut';\nimport { useGlobalKeyDown } from '../../../../hooks/useGlobalKeyDown';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Select2Value } from '../../../Select2/types';\n\nexport type FiltersButtonProps = {\n length: number;\n table: RTTable<any>;\n};\n\nexport const FiltersButton = ({ length, table }: FiltersButtonProps) => {\n const { texts } = useLocalization();\n const ref = React.useRef<HTMLButtonElement>(null);\n const allColumns = table\n .getAllLeafColumns()\n .filter(column => !isInternalColumn(column.id))\n .sort((a, b) => (a.columnDef?.header as string).localeCompare(b.columnDef?.header as string));\n const { shouldDisableTableActions } = table.options.meta as TableMeta<any>;\n\n const columnFilters = table.getState().columnFilters;\n\n const filteredColumns = columnFilters.reduce((columns: RTColumn<any, any>[], columnFilter) => {\n const column = allColumns.find(c => c.id === columnFilter.id);\n\n if (column) {\n return [...columns, column];\n }\n\n return columns;\n }, []);\n\n const [emptyFilterCount, setEmptyFilterCount] = React.useState(1);\n\n const handleAdd = () => setEmptyFilterCount(emptyFilterCount + 1);\n\n const handleReset = () => {\n table.resetColumnFilters();\n setEmptyFilterCount(1);\n };\n\n useGlobalKeyDown({ key: 'f', meta: true, shift: true }, (event: KeyboardEvent) => {\n event.preventDefault();\n ref.current?.click();\n });\n\n const handleEmptyFilterChange = (columnId: Select2Value) => {\n // create an actual filter on that column that the user selected\n const column = allColumns.find(c => c.getCanFilter() && c.id === columnId);\n\n if (column) {\n column.setFilterValue({\n comparator: undefined,\n value: undefined,\n } as Table2Filter);\n }\n\n // hide the empty filter row because we now have a real filter\n setEmptyFilterCount(emptyFilterCount - 1);\n };\n\n const handleRemove = () => {\n if (filteredColumns.length === 1 && emptyFilterCount === 0) {\n setEmptyFilterCount(1);\n }\n };\n\n const handleRemoveEmptyFilter = () => {\n setEmptyFilterCount(emptyFilterCount - 1);\n };\n\n const handleOpenChange = () => {\n const emptyFilterCount = filteredColumns.length === 0 ? 1 : 0;\n setEmptyFilterCount(emptyFilterCount);\n };\n\n const filters =\n filteredColumns.length > 0 &&\n filteredColumns.filter(column => {\n const controlType = column.columnDef.meta?.control;\n const value = (column.getFilterValue() as Table2Filter).value;\n const comparator = (column.getFilterValue() as Table2Filter).comparator;\n\n if (Array.isArray(value)) {\n if (value.length > 0 && value.find(item => item !== undefined)) {\n return true;\n }\n } else if (value) {\n return true;\n } else if ([Table2FilterComparator.IsEmpty, Table2FilterComparator.IsNotEmpty].includes(comparator as number)) {\n if (!controlType) {\n return true;\n }\n }\n return false;\n });\n const filtersApplied = filters && filters.length;\n\n return (\n <Button\n aria-label={texts.table2.filters.tooltip}\n appearance={filtersApplied ? 'primary' : 'default'}\n className={cn({\n '!wcag-blue-100': filtersApplied,\n })}\n disabled={shouldDisableTableActions}\n popover={popoverProps => (\n <Popover {...popoverProps} onChange={handleOpenChange}>\n <Popover.Content>\n <div className=\"flex w-[40rem] flex-col gap-4\">\n <div className=\"flex h-8\">\n <div className=\"flex w-full items-center gap-2\">\n <h4 className=\"mb-0 inline-flex\">{texts.table2.filters.button}</h4>\n <p className=\"text-grey-700 mb-0 mr-auto mt-px inline-flex\">\n {texts.table2.filters.total\n .replace('[CURRENT]', String(table.getFilteredRowModel().rows.length))\n .replace('[TOTAL]', String(length))}\n </p>\n </div>\n {columnFilters.length || emptyFilterCount > 1 ? (\n <Button onClick={handleReset}>{texts.table2.filters.buttons.clearFilters}</Button>\n ) : null}\n </div>\n\n <div className=\"flex flex-col gap-2\">\n {filteredColumns.map((column, index) => (\n <ColumnFilter\n key={`${column.id}_${index}`}\n allColumns={allColumns}\n index={index}\n column={column}\n table={table}\n onRemove={handleRemove}\n />\n ))}\n {[...Array(emptyFilterCount)].map((_, index) => (\n <EmptyFilter\n key={`emptyFilter_${index}`}\n index={index}\n allColumns={allColumns}\n table={table}\n onChange={value => handleEmptyFilterChange(value)}\n emptyFilterCount={emptyFilterCount}\n filteredColumns={filteredColumns}\n onRemove={handleRemoveEmptyFilter}\n />\n ))}\n <div className=\"justify-start\">\n <Button appearance=\"discrete\" onClick={handleAdd}>\n + {texts.table2.filters.buttons.addNewFilter}\n </Button>\n </div>\n </div>\n </div>\n </Popover.Content>\n </Popover>\n )}\n ref={ref}\n tooltip={\n <>\n {texts.table2.filters.tooltip}\n <Shortcut className=\"ml-2\" keys={{ key: 'f', meta: true, shift: true }} />\n </>\n }>\n <Icon name={filtersApplied ? 'filter-solid' : 'filter'} />\n {texts.table2.filters.button} {filtersApplied ? `(${filtersApplied})` : ''}\n </Button>\n );\n};\n"],"names":["FiltersButton","length","table","texts","useLocalization","ref","React","useRef","allColumns","getAllLeafColumns","filter","column","isInternalColumn","id","sort","a","b","_a$columnDef","_b$columnDef","columnDef","header","localeCompare","shouldDisableTableActions","options","meta","columnFilters","getState","filteredColumns","reduce","columns","columnFilter","find","c","emptyFilterCount","setEmptyFilterCount","useState","handleAdd","handleReset","resetColumnFilters","useGlobalKeyDown","key","shift","event","preventDefault","_ref$current","current","click","handleEmptyFilterChange","columnId","getCanFilter","setFilterValue","comparator","undefined","value","handleRemove","handleRemoveEmptyFilter","handleOpenChange","filters","controlType","_column$columnDef$met","control","getFilterValue","Array","isArray","item","Table2FilterComparator","IsEmpty","IsNotEmpty","includes","filtersApplied","Button","table2","tooltip","appearance","className","cn","disabled","popover","popoverProps","Popover","onChange","Content","button","total","replace","String","getFilteredRowModel","rows","onClick","buttons","clearFilters","map","index","ColumnFilter","onRemove","_","EmptyFilter","addNewFilter","Shortcut","keys","Icon","name"],"mappings":";;;;;;;;;;;;;MAoBaA,aAAa,GAAGA,CAAC;EAAEC,MAAM;EAAEC;CAA2B;EAC/D,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,GAAG,GAAGC,cAAK,CAACC,MAAM,CAAoB,IAAI,CAAC;EACjD,MAAMC,UAAU,GAAGN,KAAK,CACnBO,iBAAiB,EAAE,CACnBC,MAAM,CAACC,MAAM,IAAI,CAACC,gBAAgB,CAACD,MAAM,CAACE,EAAE,CAAC,CAAC,CAC9CC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC;IAAA,IAAAC,YAAA,EAAAC,YAAA;IAAA,QAAAD,YAAA,GAAMF,CAAC,CAACI,SAAS,cAAAF,YAAA,uBAAXA,YAAA,CAAaG,MAAiB,CAACC,aAAa,EAAAH,YAAA,GAACF,CAAC,CAACG,SAAS,cAAAD,YAAA,uBAAXA,YAAA,CAAaE,MAAgB,CAA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
package/dist/esm/packages/taco/src/components/Table2/components/filters/components/Column.js
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
import React__default from 'react';
|
2
|
-
import { Select2 } from '../../../../Select2/Select2.js';
|
3
|
-
|
4
|
-
const Column = ({
|
5
|
-
allColumns,
|
6
|
-
column,
|
7
|
-
index,
|
8
|
-
table,
|
9
|
-
...props
|
10
|
-
}) => {
|
11
|
-
const handleChange = id => {
|
12
|
-
table.setColumnFilters(currentColumnFilters => {
|
13
|
-
const nextColumnFilters = [...currentColumnFilters];
|
14
|
-
nextColumnFilters[index].id = id;
|
15
|
-
nextColumnFilters[index].value = {};
|
16
|
-
return nextColumnFilters;
|
17
|
-
});
|
18
|
-
};
|
19
|
-
return /*#__PURE__*/React__default.createElement(Select2, Object.assign({}, props, {
|
20
|
-
autoFocus: true,
|
21
|
-
onChange: handleChange,
|
22
|
-
value: column.id
|
23
|
-
}), allColumns.map(c => /*#__PURE__*/React__default.createElement(Select2.Option, {
|
24
|
-
key: c.id,
|
25
|
-
disabled: !c.getCanFilter() || c.id !== column.id && !!table.getState().columnFilters.find(f => f.id === c.id),
|
26
|
-
value: c.id
|
27
|
-
}, String(c.columnDef.header))));
|
28
|
-
};
|
29
|
-
|
30
|
-
export { Column };
|
31
|
-
//# sourceMappingURL=Column.js.map
|
package/dist/esm/packages/taco/src/components/Table2/components/filters/components/Column.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"Column.js","sources":["../../../../../../../../../../src/components/Table2/components/filters/components/Column.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as RTColumn, Table as RTTable } from '@tanstack/react-table';\nimport { Select2, Select2Props } from '../../../../Select2/Select2';\nimport { Table2Filter } from '../../../types';\n\ntype ColumnProps = Omit<Select2Props, 'children'> & {\n allColumns: RTColumn<any, any>[];\n column: RTColumn<any, any>;\n index: number;\n table: RTTable<any>;\n};\n\nexport const Column = ({ allColumns, column, index, table, ...props }: ColumnProps) => {\n const handleChange = id => {\n table.setColumnFilters(currentColumnFilters => {\n const nextColumnFilters = [...currentColumnFilters];\n nextColumnFilters[index].id = id;\n (nextColumnFilters[index] as Table2Filter).value = {};\n return nextColumnFilters;\n });\n };\n\n return (\n <Select2 {...props} autoFocus onChange={handleChange} value={column.id}>\n {allColumns.map(c => (\n <Select2.Option\n key={c.id}\n disabled={\n !c.getCanFilter() || (c.id !== column.id && !!table.getState().columnFilters.find(f => f.id === c.id))\n }\n value={c.id}>\n {String(c.columnDef.header)}\n </Select2.Option>\n ))}\n </Select2>\n );\n};\n"],"names":["Column","allColumns","column","index","table","props","handleChange","id","setColumnFilters","currentColumnFilters","nextColumnFilters","value","React","Select2","autoFocus","onChange","map","c","Option","key","disabled","getCanFilter","getState","columnFilters","find","f","String","columnDef","header"],"mappings":";;;MAYaA,MAAM,GAAGA,CAAC;EAAEC,UAAU;EAAEC,MAAM;EAAEC,KAAK;EAAEC,KAAK;EAAE,GAAGC;CAAoB;EAC9E,MAAMC,YAAY,GAAGC,EAAE;IACnBH,KAAK,CAACI,gBAAgB,CAACC,oBAAoB;MACvC,MAAMC,iBAAiB,GAAG,CAAC,GAAGD,oBAAoB,CAAC;MACnDC,iBAAiB,CAACP,KAAK,CAAC,CAACI,EAAE,GAAGA,EAAE;MAC/BG,iBAAiB,CAACP,KAAK,CAAkB,CAACQ,KAAK,GAAG,EAAE;MACrD,OAAOD,iBAAiB;KAC3B,CAAC;GACL;EAED,oBACIE,6BAACC,OAAO,oBAAKR,KAAK;IAAES,SAAS;IAACC,QAAQ,EAAET,YAAY;IAAEK,KAAK,EAAET,MAAM,CAACK;MAC/DN,UAAU,CAACe,GAAG,CAACC,CAAC,iBACbL,6BAACC,OAAO,CAACK,MAAM;IACXC,GAAG,EAAEF,CAAC,CAACV,EAAE;IACTa,QAAQ,EACJ,CAACH,CAAC,CAACI,YAAY,EAAE,IAAKJ,CAAC,CAACV,EAAE,KAAKL,MAAM,CAACK,EAAE,IAAI,CAAC,CAACH,KAAK,CAACkB,QAAQ,EAAE,CAACC,aAAa,CAACC,IAAI,CAACC,CAAC,IAAIA,CAAC,CAAClB,EAAE,KAAKU,CAAC,CAACV,EAAE,CAAE;IAE1GI,KAAK,EAAEM,CAAC,CAACV;KACRmB,MAAM,CAACT,CAAC,CAACU,SAAS,CAACC,MAAM,CAAC,CAElC,CAAC,CACI;AAElB;;;;"}
|
package/dist/esm/packages/taco/src/components/Table2/components/filters/components/ColumnFilter.js
DELETED
@@ -1,129 +0,0 @@
|
|
1
|
-
import React__default from 'react';
|
2
|
-
import { IconButton } from '../../../../IconButton/IconButton.js';
|
3
|
-
import { useLocalization } from '../../../../Provider/Localization.js';
|
4
|
-
import { Input } from '../../../../Input/Input.js';
|
5
|
-
import { Datepicker } from '../../../../Datepicker/Datepicker.js';
|
6
|
-
import { Switch } from '../../../../Switch/Switch.js';
|
7
|
-
import { Table2FilterComparator } from '../../../types.js';
|
8
|
-
import { Column } from './Column.js';
|
9
|
-
import { Comparator } from './Comparator.js';
|
10
|
-
import { InferredControl } from './InferredControl.js';
|
11
|
-
|
12
|
-
const ColumnFilter = props => {
|
13
|
-
var _column$columnDef$hea, _column$columnDef$met;
|
14
|
-
const {
|
15
|
-
allColumns,
|
16
|
-
column,
|
17
|
-
index,
|
18
|
-
table,
|
19
|
-
onRemove
|
20
|
-
} = props;
|
21
|
-
const {
|
22
|
-
comparator,
|
23
|
-
value
|
24
|
-
} = column.getFilterValue();
|
25
|
-
const ariaLabel = String((_column$columnDef$hea = column.columnDef.header) !== null && _column$columnDef$hea !== void 0 ? _column$columnDef$hea : '');
|
26
|
-
const {
|
27
|
-
texts
|
28
|
-
} = useLocalization();
|
29
|
-
const ref = React__default.useRef(null);
|
30
|
-
let control;
|
31
|
-
const controlType = (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.control;
|
32
|
-
if (typeof controlType === 'function') {
|
33
|
-
control = controlType({
|
34
|
-
onBlur: () => Promise.resolve(),
|
35
|
-
onFocus: () => Promise.resolve(),
|
36
|
-
ref,
|
37
|
-
setValue: value => column.setFilterValue(currentValue => ({
|
38
|
-
...currentValue,
|
39
|
-
value
|
40
|
-
})),
|
41
|
-
value,
|
42
|
-
disabled: false,
|
43
|
-
readOnly: false
|
44
|
-
});
|
45
|
-
} else if (controlType === 'input') {
|
46
|
-
control = /*#__PURE__*/React__default.createElement(Input, {
|
47
|
-
"aria-label": ariaLabel,
|
48
|
-
onChange: event => column.setFilterValue(currentValue => ({
|
49
|
-
...currentValue,
|
50
|
-
value: event.target.value
|
51
|
-
})),
|
52
|
-
value: String(value !== null && value !== void 0 ? value : '')
|
53
|
-
});
|
54
|
-
} else if (controlType === 'datepicker') {
|
55
|
-
control = /*#__PURE__*/React__default.createElement(Datepicker, {
|
56
|
-
"aria-label": ariaLabel,
|
57
|
-
onChange: event => column.setFilterValue(currentValue => ({
|
58
|
-
...currentValue,
|
59
|
-
value: event.detail
|
60
|
-
})),
|
61
|
-
value: value
|
62
|
-
});
|
63
|
-
} else if (controlType === 'switch') {
|
64
|
-
control = /*#__PURE__*/React__default.createElement(Switch, {
|
65
|
-
"aria-label": ariaLabel,
|
66
|
-
checked: Boolean(value),
|
67
|
-
onChange: checked => column.setFilterValue(currentValue => ({
|
68
|
-
...currentValue,
|
69
|
-
value: checked
|
70
|
-
}))
|
71
|
-
});
|
72
|
-
}
|
73
|
-
const handleRemove = () => {
|
74
|
-
column.setFilterValue(undefined);
|
75
|
-
onRemove === null || onRemove === void 0 ? void 0 : onRemove();
|
76
|
-
};
|
77
|
-
const comparators = guessComparatorsBasedOnControl(control, controlType);
|
78
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
79
|
-
className: "flex gap-2"
|
80
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
81
|
-
className: "flex w-14 flex-shrink-0 items-center justify-end pr-2 text-right"
|
82
|
-
}, index === 0 ? texts.table2.filters.conditions.where : texts.table2.filters.conditions.and), /*#__PURE__*/React__default.createElement(Column, {
|
83
|
-
className: "!w-32 flex-shrink-0",
|
84
|
-
allColumns: allColumns,
|
85
|
-
column: column,
|
86
|
-
index: index,
|
87
|
-
table: table
|
88
|
-
}), /*#__PURE__*/React__default.createElement(Comparator, {
|
89
|
-
className: "!w-32 flex-shrink-0",
|
90
|
-
column: column,
|
91
|
-
comparator: comparator,
|
92
|
-
validComparators: comparators
|
93
|
-
}), comparator !== undefined ? /*#__PURE__*/React__default.createElement("div", {
|
94
|
-
className: "flex flex-grow items-center"
|
95
|
-
}, /*#__PURE__*/React__default.createElement(InferredControl, {
|
96
|
-
column: column,
|
97
|
-
comparator: comparator,
|
98
|
-
value: value
|
99
|
-
})) : null, /*#__PURE__*/React__default.createElement(IconButton, {
|
100
|
-
appearance: "discrete",
|
101
|
-
icon: "close",
|
102
|
-
onClick: handleRemove
|
103
|
-
}));
|
104
|
-
};
|
105
|
-
const guessComparatorsBasedOnControl = (instance, control) => {
|
106
|
-
if ( /*#__PURE__*/React__default.isValidElement(instance)) {
|
107
|
-
const {
|
108
|
-
props,
|
109
|
-
type
|
110
|
-
} = instance;
|
111
|
-
if (type.displayName === 'Select2') {
|
112
|
-
if (props.multiple) {
|
113
|
-
return [Table2FilterComparator.IsOneOf, Table2FilterComparator.IsNoneOf, Table2FilterComparator.IsAllOf];
|
114
|
-
}
|
115
|
-
return [Table2FilterComparator.IsEqualTo, Table2FilterComparator.IsNotEqualTo];
|
116
|
-
}
|
117
|
-
}
|
118
|
-
switch (control) {
|
119
|
-
case 'datepicker':
|
120
|
-
return [Table2FilterComparator.IsEqualTo, Table2FilterComparator.IsNotEqualTo, Table2FilterComparator.IsGreaterThan, Table2FilterComparator.IsLessThan, Table2FilterComparator.IsBetween];
|
121
|
-
case 'switch':
|
122
|
-
return [Table2FilterComparator.IsEqualTo];
|
123
|
-
default:
|
124
|
-
return [Table2FilterComparator.Contains, Table2FilterComparator.DoesNotContain, Table2FilterComparator.IsEqualTo, Table2FilterComparator.IsNotEqualTo, Table2FilterComparator.IsEmpty, Table2FilterComparator.IsNotEmpty, Table2FilterComparator.IsGreaterThan, Table2FilterComparator.IsLessThan, Table2FilterComparator.IsBetween];
|
125
|
-
}
|
126
|
-
};
|
127
|
-
|
128
|
-
export { ColumnFilter };
|
129
|
-
//# sourceMappingURL=ColumnFilter.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ColumnFilter.js","sources":["../../../../../../../../../../src/components/Table2/components/filters/components/ColumnFilter.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as RTColumn, Table as RTTable } from '@tanstack/react-table';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { Input } from '../../../../Input/Input';\nimport { Table2ColumnControlRenderer, Table2Filter, Table2FilterComparator } from '../../../types';\nimport { Datepicker } from '../../../../Datepicker/Datepicker';\nimport { Switch } from '../../../../Switch/Switch';\nimport { Column } from './Column';\nimport { Comparator } from './Comparator';\nimport { InferredControl } from './InferredControl';\nimport { useLocalization } from '../../../../Provider/Localization';\n\nexport type ColumnFilterProps = {\n allColumns: RTColumn<any, any>[];\n column: RTColumn<any, any>;\n index: number;\n table: RTTable<any>;\n onRemove?: () => void;\n};\n\nexport const ColumnFilter = (props: ColumnFilterProps) => {\n const { allColumns, column, index, table, onRemove } = props;\n const { comparator, value } = column.getFilterValue() as Table2Filter;\n const ariaLabel = String(column.columnDef.header ?? '');\n const { texts } = useLocalization();\n const ref = React.useRef(null);\n\n let control;\n const controlType = column.columnDef.meta?.control;\n\n if (typeof controlType === 'function') {\n control = controlType({\n onBlur: () => Promise.resolve(),\n onFocus: () => Promise.resolve(),\n ref,\n setValue: value => column.setFilterValue(currentValue => ({ ...currentValue, value })),\n value,\n disabled: false,\n readOnly: false,\n });\n } else if (controlType === 'input') {\n control = (\n <Input\n aria-label={ariaLabel}\n onChange={event => column.setFilterValue(currentValue => ({ ...currentValue, value: event.target.value }))}\n value={String(value ?? '')}\n />\n );\n } else if (controlType === 'datepicker') {\n control = (\n <Datepicker\n aria-label={ariaLabel}\n onChange={event => column.setFilterValue(currentValue => ({ ...currentValue, value: (event as any).detail }))}\n value={value as Date}\n />\n );\n } else if (controlType === 'switch') {\n control = (\n <Switch\n aria-label={ariaLabel}\n checked={Boolean(value)}\n onChange={checked => column.setFilterValue(currentValue => ({ ...currentValue, value: checked }))}\n />\n );\n }\n\n const handleRemove = () => {\n column.setFilterValue(undefined);\n onRemove?.();\n };\n const comparators = guessComparatorsBasedOnControl(control, controlType);\n\n return (\n <div className=\"flex gap-2\">\n <div className=\"flex w-14 flex-shrink-0 items-center justify-end pr-2 text-right\">\n {index === 0 ? texts.table2.filters.conditions.where : texts.table2.filters.conditions.and}\n </div>\n <Column className=\"!w-32 flex-shrink-0\" allColumns={allColumns} column={column} index={index} table={table} />\n <Comparator className=\"!w-32 flex-shrink-0\" column={column} comparator={comparator} validComparators={comparators} />\n {comparator !== undefined ? (\n <div className=\"flex flex-grow items-center\">\n <InferredControl column={column} comparator={comparator} value={value} />\n </div>\n ) : null}\n <IconButton appearance=\"discrete\" icon=\"close\" onClick={handleRemove} />\n </div>\n );\n};\n\nconst guessComparatorsBasedOnControl = (instance: JSX.Element, control?: Table2ColumnControlRenderer) => {\n if (React.isValidElement(instance)) {\n const { props, type } = instance as any;\n\n if (type.displayName === 'Select2') {\n if (props.multiple) {\n return [Table2FilterComparator.IsOneOf, Table2FilterComparator.IsNoneOf, Table2FilterComparator.IsAllOf];\n }\n\n return [Table2FilterComparator.IsEqualTo, Table2FilterComparator.IsNotEqualTo];\n }\n }\n\n switch (control) {\n case 'datepicker':\n return [\n Table2FilterComparator.IsEqualTo,\n Table2FilterComparator.IsNotEqualTo,\n Table2FilterComparator.IsGreaterThan,\n Table2FilterComparator.IsLessThan,\n Table2FilterComparator.IsBetween,\n ];\n\n case 'switch':\n return [Table2FilterComparator.IsEqualTo];\n\n default:\n return [\n Table2FilterComparator.Contains,\n Table2FilterComparator.DoesNotContain,\n Table2FilterComparator.IsEqualTo,\n Table2FilterComparator.IsNotEqualTo,\n Table2FilterComparator.IsEmpty,\n Table2FilterComparator.IsNotEmpty,\n Table2FilterComparator.IsGreaterThan,\n Table2FilterComparator.IsLessThan,\n Table2FilterComparator.IsBetween,\n ];\n }\n};\n"],"names":["ColumnFilter","props","allColumns","column","index","table","onRemove","comparator","value","getFilterValue","ariaLabel","String","_column$columnDef$hea","columnDef","header","texts","useLocalization","ref","React","useRef","control","controlType","_column$columnDef$met","meta","onBlur","Promise","resolve","onFocus","setValue","setFilterValue","currentValue","disabled","readOnly","Input","onChange","event","target","Datepicker","detail","Switch","checked","Boolean","handleRemove","undefined","comparators","guessComparatorsBasedOnControl","className","table2","filters","conditions","where","and","Column","Comparator","validComparators","InferredControl","IconButton","appearance","icon","onClick","instance","isValidElement","type","displayName","multiple","Table2FilterComparator","IsOneOf","IsNoneOf","IsAllOf","IsEqualTo","IsNotEqualTo","IsGreaterThan","IsLessThan","IsBetween","Contains","DoesNotContain","IsEmpty","IsNotEmpty"],"mappings":";;;;;;;;;;;MAoBaA,YAAY,GAAIC,KAAwB;;EACjD,MAAM;IAAEC,UAAU;IAAEC,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC;GAAU,GAAGL,KAAK;EAC5D,MAAM;IAAEM,UAAU;IAAEC;GAAO,GAAGL,MAAM,CAACM,cAAc,EAAkB;EACrE,MAAMC,SAAS,GAAGC,MAAM,EAAAC,qBAAA,GAACT,MAAM,CAACU,SAAS,CAACC,MAAM,cAAAF,qBAAA,cAAAA,qBAAA,GAAI,EAAE,CAAC;EACvD,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,GAAG,GAAGC,cAAK,CAACC,MAAM,CAAC,IAAI,CAAC;EAE9B,IAAIC,OAAO;EACX,MAAMC,WAAW,IAAAC,qBAAA,GAAGnB,MAAM,CAACU,SAAS,CAACU,IAAI,cAAAD,qBAAA,uBAArBA,qBAAA,CAAuBF,OAAO;EAElD,IAAI,OAAOC,WAAW,KAAK,UAAU,EAAE;IACnCD,OAAO,G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QAChB,OAAO,CAACC,sBAAsB,CAACC,OAAO,EAAED,sBAAsB,CAACE,QAAQ,EAAEF,sBAAsB,CAACG,OAAO,CAAC;;MAG5G,OAAO,CAACH,sBAAsB,CAACI,SAAS,EAAEJ,sBAAsB,CAACK,YAAY,CAAC;;;EAItF,QAAQlD,OAAO;IACX,KAAK,YAAY;MACb,OAAO,CACH6C,sBAAsB,CAACI,SAAS,EAChCJ,sBAAsB,CAACK,YAAY,EACnCL,sBAAsB,CAACM,aAAa,EACpCN,sBAAsB,CAACO,UAAU,EACjCP,sBAAsB,CAACQ,SAAS,CACnC;IAEL,KAAK,QAAQ;MACT,OAAO,CAACR,sBAAsB,CAACI,SAAS,CAAC;IAE7C;MACI,OAAO,CACHJ,sBAAsB,CAACS,QAAQ,EAC/BT,sBAAsB,CAACU,cAAc,EACrCV,sBAAsB,CAACI,SAAS,EAChCJ,sBAAsB,CAACK,YAAY,EACnCL,sBAAsB,CAACW,OAAO,EAC9BX,sBAAsB,CAACY,UAAU,EACjCZ,sBAAsB,CAACM,aAAa,EACpCN,sBAAsB,CAACO,UAAU,EACjCP,sBAAsB,CAACQ,SAAS,CACnC;;AAEb,CAAC;;;;"}
|
package/dist/esm/packages/taco/src/components/Table2/components/filters/components/Comparator.js
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
import React__default from 'react';
|
2
|
-
import { useLocalization } from '../../../../Provider/Localization.js';
|
3
|
-
import { Select2 } from '../../../../Select2/Select2.js';
|
4
|
-
import { Table2FilterComparator } from '../../../types.js';
|
5
|
-
|
6
|
-
const Comparator = ({
|
7
|
-
column,
|
8
|
-
comparator,
|
9
|
-
validComparators,
|
10
|
-
...props
|
11
|
-
}) => {
|
12
|
-
const {
|
13
|
-
texts
|
14
|
-
} = useLocalization();
|
15
|
-
const handleChange = comparator => {
|
16
|
-
column.setFilterValue(currentFilterValue => ({
|
17
|
-
comparator,
|
18
|
-
value: comparator === Table2FilterComparator.IsBetween ? [] : currentFilterValue.value
|
19
|
-
}));
|
20
|
-
};
|
21
|
-
React__default.useEffect(() => {
|
22
|
-
if (comparator === undefined) {
|
23
|
-
const initialComparator = validComparators[0];
|
24
|
-
column.setFilterValue(currentFilterValue => ({
|
25
|
-
comparator: initialComparator,
|
26
|
-
value: initialComparator === Table2FilterComparator.IsBetween && !Array.isArray(currentFilterValue.value) ? [] : currentFilterValue.value
|
27
|
-
}));
|
28
|
-
}
|
29
|
-
}, []);
|
30
|
-
return /*#__PURE__*/React__default.createElement(Select2, Object.assign({}, props, {
|
31
|
-
onChange: handleChange,
|
32
|
-
value: comparator
|
33
|
-
}), validComparators.map(comp => /*#__PURE__*/React__default.createElement(Select2.Option, {
|
34
|
-
key: comp,
|
35
|
-
value: comp
|
36
|
-
}, getComparatorText(comp, texts))));
|
37
|
-
};
|
38
|
-
const getComparatorText = (comparator, texts) => {
|
39
|
-
switch (comparator) {
|
40
|
-
case Table2FilterComparator.Contains:
|
41
|
-
return texts.table2.filters.comparators.contains;
|
42
|
-
case Table2FilterComparator.DoesNotContain:
|
43
|
-
return texts.table2.filters.comparators.doesNotContain;
|
44
|
-
case Table2FilterComparator.IsEqualTo:
|
45
|
-
return texts.table2.filters.comparators.isEqualTo;
|
46
|
-
case Table2FilterComparator.IsNotEqualTo:
|
47
|
-
return texts.table2.filters.comparators.isNotEqualTo;
|
48
|
-
case Table2FilterComparator.IsGreaterThan:
|
49
|
-
return texts.table2.filters.comparators.isGreaterThan;
|
50
|
-
case Table2FilterComparator.IsLessThan:
|
51
|
-
return texts.table2.filters.comparators.isLessThan;
|
52
|
-
case Table2FilterComparator.IsBetween:
|
53
|
-
return texts.table2.filters.comparators.isBetween;
|
54
|
-
case Table2FilterComparator.IsOneOf:
|
55
|
-
return texts.table2.filters.comparators.isOneOf;
|
56
|
-
case Table2FilterComparator.IsNoneOf:
|
57
|
-
return texts.table2.filters.comparators.isNoneOf;
|
58
|
-
case Table2FilterComparator.IsAllOf:
|
59
|
-
return texts.table2.filters.comparators.isAllOf;
|
60
|
-
case Table2FilterComparator.IsEmpty:
|
61
|
-
return texts.table2.filters.comparators.isEmpty;
|
62
|
-
case Table2FilterComparator.IsNotEmpty:
|
63
|
-
return texts.table2.filters.comparators.isNotEmpty;
|
64
|
-
}
|
65
|
-
};
|
66
|
-
|
67
|
-
export { Comparator };
|
68
|
-
//# sourceMappingURL=Comparator.js.map
|
package/dist/esm/packages/taco/src/components/Table2/components/filters/components/Comparator.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"Comparator.js","sources":["../../../../../../../../../../src/components/Table2/components/filters/components/Comparator.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as RTColumn } from '@tanstack/react-table';\nimport { Select2, Select2Props } from '../../../../Select2/Select2';\nimport { Table2FilterComparator } from '../../../types';\nimport { LocalizationTexts, useLocalization } from '../../../../Provider/Localization';\n\ntype ComparatorProps = Omit<Select2Props, 'children'> & {\n column: RTColumn<any, any>;\n comparator?: Table2FilterComparator;\n validComparators: Table2FilterComparator[];\n};\n\nexport const Comparator = ({ column, comparator, validComparators, ...props }: ComparatorProps) => {\n const { texts } = useLocalization();\n const handleChange = comparator => {\n column.setFilterValue(currentFilterValue => ({\n comparator,\n value: comparator === Table2FilterComparator.IsBetween ? [] : currentFilterValue.value,\n }));\n };\n\n React.useEffect(() => {\n if (comparator === undefined) {\n const initialComparator = validComparators[0];\n column.setFilterValue(currentFilterValue => ({\n comparator: initialComparator,\n value:\n initialComparator === Table2FilterComparator.IsBetween && !Array.isArray(currentFilterValue.value)\n ? []\n : currentFilterValue.value,\n }));\n }\n }, []);\n\n return (\n <Select2 {...props} onChange={handleChange} value={comparator}>\n {validComparators.map(comp => (\n <Select2.Option key={comp} value={comp}>\n {getComparatorText(comp, texts)}\n </Select2.Option>\n ))}\n </Select2>\n );\n};\n\nconst getComparatorText = (comparator: Table2FilterComparator, texts: LocalizationTexts) => {\n switch (comparator) {\n case Table2FilterComparator.Contains:\n return texts.table2.filters.comparators.contains;\n case Table2FilterComparator.DoesNotContain:\n return texts.table2.filters.comparators.doesNotContain;\n case Table2FilterComparator.IsEqualTo:\n return texts.table2.filters.comparators.isEqualTo;\n case Table2FilterComparator.IsNotEqualTo:\n return texts.table2.filters.comparators.isNotEqualTo;\n case Table2FilterComparator.IsGreaterThan:\n return texts.table2.filters.comparators.isGreaterThan;\n case Table2FilterComparator.IsLessThan:\n return texts.table2.filters.comparators.isLessThan;\n case Table2FilterComparator.IsBetween:\n return texts.table2.filters.comparators.isBetween;\n case Table2FilterComparator.IsOneOf:\n return texts.table2.filters.comparators.isOneOf;\n case Table2FilterComparator.IsNoneOf:\n return texts.table2.filters.comparators.isNoneOf;\n case Table2FilterComparator.IsAllOf:\n return texts.table2.filters.comparators.isAllOf;\n case Table2FilterComparator.IsEmpty:\n return texts.table2.filters.comparators.isEmpty;\n case Table2FilterComparator.IsNotEmpty:\n return texts.table2.filters.comparators.isNotEmpty;\n }\n};\n"],"names":["Comparator","column","comparator","validComparators","props","texts","useLocalization","handleChange","setFilterValue","currentFilterValue","value","Table2FilterComparator","IsBetween","React","useEffect","undefined","initialComparator","Array","isArray","Select2","onChange","map","comp","Option","key","getComparatorText","Contains","table2","filters","comparators","contains","DoesNotContain","doesNotContain","IsEqualTo","isEqualTo","IsNotEqualTo","isNotEqualTo","IsGreaterThan","isGreaterThan","IsLessThan","isLessThan","isBetween","IsOneOf","isOneOf","IsNoneOf","isNoneOf","IsAllOf","isAllOf","IsEmpty","isEmpty","IsNotEmpty","isNotEmpty"],"mappings":";;;;;MAYaA,UAAU,GAAGA,CAAC;EAAEC,MAAM;EAAEC,UAAU;EAAEC,gBAAgB;EAAE,GAAGC;CAAwB;EAC1F,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,YAAY,GAAGL,UAAU;IAC3BD,MAAM,CAACO,cAAc,CAACC,kBAAkB,KAAK;MACzCP,UAAU;MACVQ,KAAK,EAAER,UAAU,KAAKS,sBAAsB,CAACC,SAAS,GAAG,EAAE,G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xD,KAAKzB,sBAAsB,CAAC0B,aAAa;MACrC,OAAOhC,KAAK,CAACsB,MAAM,CAACC,OAAO,CAACC,WAAW,CAACS,aAAa;IACzD,KAAK3B,sBAAsB,CAAC4B,UAAU;MAClC,OAAOlC,KAAK,CAACsB,MAAM,CAACC,OAAO,CAACC,WAAW,CAACW,UAAU;IACtD,KAAK7B,sBAAsB,CAACC,SAAS;MACjC,OAAOP,KAAK,CAACsB,MAAM,CAACC,OAAO,CAACC,WAAW,CAACY,SAAS;IACrD,KAAK9B,sBAAsB,CAAC+B,OAAO;MAC/B,OAAOrC,KAAK,CAACsB,MAAM,CAACC,OAAO,CAACC,WAAW,CAACc,OAAO;IACnD,KAAKhC,sBAAsB,CAACiC,QAAQ;MAChC,OAAOvC,KAAK,CAACsB,MAAM,CAACC,OAAO,CAACC,WAAW,CAACgB,QAAQ;IACpD,KAAKlC,sBAAsB,CAACmC,OAAO;MAC/B,OAAOzC,KAAK,CAACsB,MAAM,CAACC,OAAO,CAACC,WAAW,CAACkB,OAAO;IACnD,KAAKpC,sBAAsB,CAACqC,OAAO;MAC/B,OAAO3C,KAAK,CAACsB,MAAM,CAACC,OAAO,CAACC,WAAW,CAACoB,OAAO;IACnD,KAAKtC,sBAAsB,CAACuC,UAAU;MAClC,OAAO7C,KAAK,CAACsB,MAAM,CAACC,OAAO,CAACC,WAAW,CAACsB,UAAU;;AAE9D,CAAC;;;;"}
|
package/dist/esm/packages/taco/src/components/Table2/components/filters/components/EmptyFilter.js
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
import React__default from 'react';
|
2
|
-
import { IconButton } from '../../../../IconButton/IconButton.js';
|
3
|
-
import { useLocalization } from '../../../../Provider/Localization.js';
|
4
|
-
import { Input } from '../../../../Input/Input.js';
|
5
|
-
import { Select2 } from '../../../../Select2/Select2.js';
|
6
|
-
|
7
|
-
const EmptyFilter = props => {
|
8
|
-
const {
|
9
|
-
texts
|
10
|
-
} = useLocalization();
|
11
|
-
const {
|
12
|
-
onChange,
|
13
|
-
onRemove,
|
14
|
-
allColumns,
|
15
|
-
table,
|
16
|
-
index,
|
17
|
-
filteredColumns,
|
18
|
-
emptyFilterCount
|
19
|
-
} = props;
|
20
|
-
const handleChange = value => {
|
21
|
-
if (value) {
|
22
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
23
|
-
}
|
24
|
-
};
|
25
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
26
|
-
className: "flex gap-2"
|
27
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
28
|
-
className: "flex w-14 flex-shrink-0 items-center justify-end pr-2 text-right"
|
29
|
-
}, filteredColumns.length > 0 || filteredColumns.length === 0 && index > 0 ? texts.table2.filters.conditions.and : texts.table2.filters.conditions.where), /*#__PURE__*/React__default.createElement(Select2, {
|
30
|
-
className: "!w-32 flex-shrink-0",
|
31
|
-
emptyValue: null,
|
32
|
-
autoFocus: true,
|
33
|
-
onChange: handleChange,
|
34
|
-
value: null
|
35
|
-
}, allColumns.map(c => /*#__PURE__*/React__default.createElement(Select2.Option, {
|
36
|
-
key: c.id,
|
37
|
-
value: c.id,
|
38
|
-
disabled: !c.getCanFilter() || !!table.getState().columnFilters.find(f => f.id === c.id)
|
39
|
-
}, String(c.columnDef.header)))), /*#__PURE__*/React__default.createElement(Select2, {
|
40
|
-
className: "!w-32 flex-shrink-0",
|
41
|
-
value: 1,
|
42
|
-
autoFocus: true,
|
43
|
-
disabled: true
|
44
|
-
}, /*#__PURE__*/React__default.createElement(Select2.Option, {
|
45
|
-
key: 'condition1',
|
46
|
-
value: 1
|
47
|
-
}, texts.table2.filters.emptyFilter.condition), /*#__PURE__*/React__default.createElement(Select2.Option, {
|
48
|
-
key: 'condition2',
|
49
|
-
value: 2
|
50
|
-
}, "Condition2")), /*#__PURE__*/React__default.createElement(Input, {
|
51
|
-
"aria-label": 'Value',
|
52
|
-
className: "flex-grow items-center",
|
53
|
-
disabled: true,
|
54
|
-
value: texts.table2.filters.emptyFilter.value
|
55
|
-
}), (emptyFilterCount > 1 || filteredColumns.length > 0) && /*#__PURE__*/React__default.createElement(IconButton, {
|
56
|
-
appearance: "discrete",
|
57
|
-
icon: "close",
|
58
|
-
onClick: onRemove
|
59
|
-
}));
|
60
|
-
};
|
61
|
-
|
62
|
-
export { EmptyFilter };
|
63
|
-
//# sourceMappingURL=EmptyFilter.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"EmptyFilter.js","sources":["../../../../../../../../../../src/components/Table2/components/filters/components/EmptyFilter.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as RTColumn, Table as RTTable } from '@tanstack/react-table';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { Input } from '../../../../Input/Input';\nimport { Select2, Select2Value } from '../../../../Select2/Select2';\nimport { useLocalization } from '../../../../Provider/Localization';\n\nexport type EmptyFilterProps = {\n allColumns: RTColumn<any, any>[];\n table: RTTable<any>;\n onChange?: (value: Select2Value) => void;\n onRemove?: () => void;\n filteredColumns: RTColumn<any, any>[];\n emptyFilterCount: Number;\n index: Number;\n};\n\nexport const EmptyFilter = (props: EmptyFilterProps) => {\n const { texts } = useLocalization();\n const { onChange, onRemove, allColumns, table, index, filteredColumns, emptyFilterCount } = props;\n\n const handleChange = (value: Select2Value) => {\n if (value) {\n onChange?.(value);\n }\n };\n\n return (\n <div className=\"flex gap-2\">\n <div className=\"flex w-14 flex-shrink-0 items-center justify-end pr-2 text-right\">\n {filteredColumns.length > 0 || (filteredColumns.length === 0 && index > 0)\n ? texts.table2.filters.conditions.and\n : texts.table2.filters.conditions.where}\n </div>\n <Select2 className=\"!w-32 flex-shrink-0\" emptyValue={null} autoFocus onChange={handleChange} value={null}>\n {allColumns.map(c => (\n <Select2.Option\n key={c.id}\n value={c.id}\n disabled={!c.getCanFilter() || !!table.getState().columnFilters.find(f => f.id === c.id)}>\n {String(c.columnDef.header)}\n </Select2.Option>\n ))}\n </Select2>\n <Select2 className=\"!w-32 flex-shrink-0\" value={1} autoFocus disabled>\n <Select2.Option key={'condition1'} value={1}>\n {texts.table2.filters.emptyFilter.condition}\n </Select2.Option>\n <Select2.Option key={'condition2'} value={2}>\n Condition2\n </Select2.Option>\n </Select2>\n <Input\n aria-label={'Value'}\n className=\"flex-grow items-center\"\n disabled\n value={texts.table2.filters.emptyFilter.value}\n />\n {(emptyFilterCount > 1 || filteredColumns.length > 0) && (\n <IconButton appearance=\"discrete\" icon=\"close\" onClick={onRemove} />\n )}\n </div>\n );\n};\n"],"names":["EmptyFilter","props","texts","useLocalization","onChange","onRemove","allColumns","table","index","filteredColumns","emptyFilterCount","handleChange","value","React","className","length","table2","filters","conditions","and","where","Select2","emptyValue","autoFocus","map","c","Option","key","id","disabled","getCanFilter","getState","columnFilters","find","f","String","columnDef","header","emptyFilter","condition","Input","IconButton","appearance","icon","onClick"],"mappings":";;;;;;MAiBaA,WAAW,GAAIC,KAAuB;EAC/C,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC,UAAU;IAAEC,KAAK;IAAEC,KAAK;IAAEC,eAAe;IAAEC;GAAkB,GAAGT,KAAK;EAEjG,MAAMU,YAAY,GAAIC,KAAmB;IACrC,IAAIA,KAAK,EAAE;MACPR,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAGQ,KAAK,CAAC;;GAExB;EAED,oBACIC;IAAKC,SAAS,EAAC;kBACXD;IAAKC,SAAS,EAAC;KACVL,eAAe,CAACM,MAAM,GAAG,CAAC,IAAKN,eAAe,CAACM,MAAM,KAAK,CAAC,IAAIP,KAAK,GAAG,CAAE,GACpEN,KAAK,CAACc,MAAM,CAACC,OAAO,CAACC,UAAU,CAACC,GAAG,GACnCjB,KAAK,CAACc,MAAM,CAACC,OAAO,CAACC,UAAU,CAACE,KAAK,CACzC,eACNP,6BAACQ,OAAO;IAACP,SAAS,EAAC,qBAAqB;IAACQ,UAAU,EAAE,IAAI;IAAEC,SAAS;IAACnB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