slick-table 1.0.17 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +26 -26
- package/dist/index.es.js +1385 -1385
- package/dist/types/shared/lib/slickgrid/lib/editors/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/types/shared/model/enums/EKey.d.ts +2 -1
- package/dist/types/shared/model/enums/EKey.d.ts.map +1 -1
- package/package.json +8 -3
- package/src/App.tsx +9 -0
- package/src/app/styles/global.scss +31 -0
- package/src/app/styles/slickgrid.scss +13 -0
- package/src/app/types/index.d.ts +9 -0
- package/src/entities/popup/index.ts +2 -0
- package/src/entities/popup/lib/index.ts +1 -0
- package/src/entities/popup/lib/visibility/index.ts +1 -0
- package/src/entities/popup/lib/visibility/makeVisible.ts +9 -0
- package/src/entities/popup/ui/Overlay/Overlay.style.ts +14 -0
- package/src/entities/popup/ui/Overlay/Overlay.test.tsx +19 -0
- package/src/entities/popup/ui/Overlay/Overlay.tsx +20 -0
- package/src/entities/popup/ui/Overlay/index.ts +1 -0
- package/src/entities/popup/ui/Popup.style.ts +17 -0
- package/src/entities/popup/ui/Popup.tsx +12 -0
- package/src/entities/popup/ui/index.ts +2 -0
- package/src/entities/skeleton/Skeleton.style.ts +10 -0
- package/src/entities/skeleton/Skeleton.tsx +11 -0
- package/src/entities/skeleton/index.ts +1 -0
- package/src/features/column-filters/index.ts +1 -0
- package/src/features/column-filters/lib/filter/applyFilter.ts +25 -0
- package/src/features/column-filters/lib/filter/index.ts +1 -0
- package/src/features/column-filters/lib/hooks/index.ts +2 -0
- package/src/features/column-filters/lib/hooks/useOpenMenu.ts +43 -0
- package/src/features/column-filters/lib/hooks/useSubscribeToEvent.ts +17 -0
- package/src/features/column-filters/lib/index.ts +4 -0
- package/src/features/column-filters/lib/props/datePickerProps.tsx +11 -0
- package/src/features/column-filters/lib/props/index.ts +1 -0
- package/src/features/column-filters/lib/select/firstIn.ts +22 -0
- package/src/features/column-filters/lib/select/index.ts +1 -0
- package/src/features/column-filters/model/consts/defaultValue.ts +6 -0
- package/src/features/column-filters/model/consts/id.ts +1 -0
- package/src/features/column-filters/model/consts/index.ts +3 -0
- package/src/features/column-filters/model/consts/label.ts +5 -0
- package/src/features/column-filters/model/index.ts +2 -0
- package/src/features/column-filters/model/types/IProps.ts +9 -0
- package/src/features/column-filters/model/types/index.ts +1 -0
- package/src/features/column-filters/ui/BooleanInput/BooleanInput.style.ts +10 -0
- package/src/features/column-filters/ui/BooleanInput/BooleanInput.tsx +53 -0
- package/src/features/column-filters/ui/BooleanInput/index.ts +1 -0
- package/src/features/column-filters/ui/ButtonReset/ButtonReset.style.ts +10 -0
- package/src/features/column-filters/ui/ButtonReset/ButtonReset.tsx +39 -0
- package/src/features/column-filters/ui/ButtonReset/index.ts +1 -0
- package/src/features/column-filters/ui/ColumnFilters.style.ts +12 -0
- package/src/features/column-filters/ui/ColumnFilters.tsx +44 -0
- package/src/features/column-filters/ui/DateBetween/DateBetween.tsx +52 -0
- package/src/features/column-filters/ui/DateBetween/index.ts +1 -0
- package/src/features/column-filters/ui/DateInput/DateInput.tsx +36 -0
- package/src/features/column-filters/ui/DateInput/index.ts +1 -0
- package/src/features/column-filters/ui/InputArea/InputArea.tsx +63 -0
- package/src/features/column-filters/ui/InputArea/index.ts +1 -0
- package/src/features/column-filters/ui/MultipleSelect/index.ts +1 -0
- package/src/features/column-filters/ui/MultipleSelect/lib/index.ts +2 -0
- package/src/features/column-filters/ui/MultipleSelect/lib/props/index.ts +1 -0
- package/src/features/column-filters/ui/MultipleSelect/lib/props/props.ts +36 -0
- package/src/features/column-filters/ui/MultipleSelect/lib/sorting/ascending.ts +17 -0
- package/src/features/column-filters/ui/MultipleSelect/lib/sorting/index.ts +1 -0
- package/src/features/column-filters/ui/MultipleSelect/model/IValue.ts +1 -0
- package/src/features/column-filters/ui/MultipleSelect/model/index.ts +1 -0
- package/src/features/column-filters/ui/MultipleSelect/ui/MultipleSelect.style.ts +9 -0
- package/src/features/column-filters/ui/MultipleSelect/ui/MultipleSelect.tsx +72 -0
- package/src/features/column-filters/ui/MultipleSelect/ui/index.ts +1 -0
- package/src/features/column-filters/ui/NumberBetween/NumberBetween.tsx +42 -0
- package/src/features/column-filters/ui/NumberBetween/index.ts +1 -0
- package/src/features/column-filters/ui/NumberInput/NumberInput.tsx +24 -0
- package/src/features/column-filters/ui/NumberInput/index.ts +1 -0
- package/src/features/column-filters/ui/SelectFilter/index.ts +1 -0
- package/src/features/column-filters/ui/SelectFilter/model/index.ts +1 -0
- package/src/features/column-filters/ui/SelectFilter/model/options/index.ts +1 -0
- package/src/features/column-filters/ui/SelectFilter/model/options/options.ts +66 -0
- package/src/features/column-filters/ui/SelectFilter/ui/SelectFilter.tsx +50 -0
- package/src/features/column-filters/ui/SelectFilter/ui/index.ts +1 -0
- package/src/features/column-filters/ui/TextInput/TextInput.tsx +23 -0
- package/src/features/column-filters/ui/TextInput/index.ts +1 -0
- package/src/features/column-filters/ui/index.ts +1 -0
- package/src/features/context-menu/index.ts +1 -0
- package/src/features/context-menu/lib/hooks/index.ts +1 -0
- package/src/features/context-menu/lib/hooks/useSubscribeToEvent.ts +27 -0
- package/src/features/context-menu/lib/index.ts +1 -0
- package/src/features/context-menu/model/consts/id.ts +1 -0
- package/src/features/context-menu/model/consts/index.ts +1 -0
- package/src/features/context-menu/model/index.ts +1 -0
- package/src/features/context-menu/ui/ButtonDownloadCSV/ButtonDownloadCSV.tsx +34 -0
- package/src/features/context-menu/ui/ButtonDownloadCSV/index.ts +1 -0
- package/src/features/context-menu/ui/ButtonGroup/ButtonGroup.tsx +28 -0
- package/src/features/context-menu/ui/ButtonGroup/index.ts +1 -0
- package/src/features/context-menu/ui/ButtonResetFilters/index.ts +1 -0
- package/src/features/context-menu/ui/ButtonResetFilters/lib/index.ts +1 -0
- package/src/features/context-menu/ui/ButtonResetFilters/lib/visibility/hasFiltersApplied.ts +8 -0
- package/src/features/context-menu/ui/ButtonResetFilters/lib/visibility/index.ts +1 -0
- package/src/features/context-menu/ui/ButtonResetFilters/ui/ButtonResetFilters.tsx +39 -0
- package/src/features/context-menu/ui/ButtonResetFilters/ui/index.ts +1 -0
- package/src/features/context-menu/ui/ButtonUngroup/ButtonUngroup.tsx +28 -0
- package/src/features/context-menu/ui/ButtonUngroup/index.ts +1 -0
- package/src/features/context-menu/ui/CollapseAll/CollapseAll.tsx +31 -0
- package/src/features/context-menu/ui/CollapseAll/index.ts +1 -0
- package/src/features/context-menu/ui/ContextMenu.style.ts +29 -0
- package/src/features/context-menu/ui/ContextMenu.tsx +55 -0
- package/src/features/context-menu/ui/CopyToClipboard/CopyToClipboard.tsx +42 -0
- package/src/features/context-menu/ui/CopyToClipboard/index.ts +1 -0
- package/src/features/context-menu/ui/ExpandAll/ExpandAll.tsx +30 -0
- package/src/features/context-menu/ui/ExpandAll/index.ts +1 -0
- package/src/features/context-menu/ui/Print/index.ts +1 -0
- package/src/features/context-menu/ui/Print/ui/Print.tsx +25 -0
- package/src/features/context-menu/ui/Print/ui/index.ts +1 -0
- package/src/features/context-menu/ui/index.ts +1 -0
- package/src/index.scss +2 -0
- package/src/index.ts +40 -0
- package/src/main.tsx +15 -0
- package/src/setupTests.ts +5 -0
- package/src/shared/lib/an-event/index.ts +31 -0
- package/src/shared/lib/datetime/dateToString.spec.ts +11 -0
- package/src/shared/lib/datetime/dateToString.ts +8 -0
- package/src/shared/lib/datetime/getTime.spec.ts +10 -0
- package/src/shared/lib/datetime/getTime.ts +3 -0
- package/src/shared/lib/datetime/index.ts +2 -0
- package/src/shared/lib/debounce/index.ts +11 -0
- package/src/shared/lib/dom/elementNotVisible.spec.ts +72 -0
- package/src/shared/lib/dom/elementNotVisible.ts +9 -0
- package/src/shared/lib/dom/index.ts +1 -0
- package/src/shared/lib/format/IOptions.ts +11 -0
- package/src/shared/lib/format/addParentheses.spec.ts +9 -0
- package/src/shared/lib/format/addParentheses.ts +7 -0
- package/src/shared/lib/format/formatNumber.spec.ts +50 -0
- package/src/shared/lib/format/formatNumber.ts +62 -0
- package/src/shared/lib/format/index.ts +2 -0
- package/src/shared/lib/localStrore/index.ts +1 -0
- package/src/shared/lib/localStrore/lib/getSlickTable.ts +5 -0
- package/src/shared/lib/localStrore/lib/getSorting.ts +5 -0
- package/src/shared/lib/localStrore/lib/index.ts +3 -0
- package/src/shared/lib/localStrore/lib/setSorting.ts +8 -0
- package/src/shared/lib/localStrore/model/enums/EStorageKey.ts +4 -0
- package/src/shared/lib/localStrore/model/enums/index.ts +1 -0
- package/src/shared/lib/localStrore/model/index.ts +3 -0
- package/src/shared/lib/localStrore/model/localStore.ts +28 -0
- package/src/shared/lib/localStrore/model/types/ILastSorting.ts +4 -0
- package/src/shared/lib/localStrore/model/types/ISlickTable.ts +1 -0
- package/src/shared/lib/localStrore/model/types/ISorting.ts +3 -0
- package/src/shared/lib/localStrore/model/types/index.ts +3 -0
- package/src/shared/lib/numbers/index.ts +1 -0
- package/src/shared/lib/numbers/toNumber.spec.ts +25 -0
- package/src/shared/lib/numbers/toNumber.ts +11 -0
- package/src/shared/lib/regexp/dates.spec.ts +23 -0
- package/src/shared/lib/regexp/dates.ts +6 -0
- package/src/shared/lib/regexp/escapeSpecialChar.spec.ts +24 -0
- package/src/shared/lib/regexp/escapeSpecialChar.ts +4 -0
- package/src/shared/lib/regexp/index.ts +2 -0
- package/src/shared/lib/slickgrid/index.ts +70 -0
- package/src/shared/lib/slickgrid/lib/callbacks/getOnKeyDownCallback.ts +12 -0
- package/src/shared/lib/slickgrid/lib/callbacks/index.ts +4 -0
- package/src/shared/lib/slickgrid/lib/callbacks/onCellChange.ts +13 -0
- package/src/shared/lib/slickgrid/lib/callbacks/onRowCountChanged.ts +12 -0
- package/src/shared/lib/slickgrid/lib/callbacks/onRowsChanged.ts +8 -0
- package/src/shared/lib/slickgrid/lib/contextMenu/index.ts +1 -0
- package/src/shared/lib/slickgrid/lib/contextMenu/openContextMenu.ts +17 -0
- package/src/shared/lib/slickgrid/lib/editors/Autocomplete/Autocomplete.ts +155 -0
- package/src/shared/lib/slickgrid/lib/editors/Autocomplete/EditorAutocomplete.ts +66 -0
- package/src/shared/lib/slickgrid/lib/editors/Autocomplete/EditorSelectWithSearch.ts +79 -0
- package/src/shared/lib/slickgrid/lib/editors/Autocomplete/index.ts +3 -0
- package/src/shared/lib/slickgrid/lib/editors/EditorAmount.ts +82 -0
- package/src/shared/lib/slickgrid/lib/editors/EditorDate.ts +127 -0
- package/src/shared/lib/slickgrid/lib/editors/EditorSelectNumber.ts +16 -0
- package/src/shared/lib/slickgrid/lib/editors/EditorSelectString.ts +95 -0
- package/src/shared/lib/slickgrid/lib/editors/index.ts +9 -0
- package/src/shared/lib/slickgrid/lib/formatters/DateFormatter.ts +9 -0
- package/src/shared/lib/slickgrid/lib/formatters/FormatterCheck.ts +11 -0
- package/src/shared/lib/slickgrid/lib/formatters/PercentFormatter.spec.ts +11 -0
- package/src/shared/lib/slickgrid/lib/formatters/PercentFormatter.ts +8 -0
- package/src/shared/lib/slickgrid/lib/formatters/StringFormatter.ts +2 -0
- package/src/shared/lib/slickgrid/lib/formatters/getFormatterNumber.ts +17 -0
- package/src/shared/lib/slickgrid/lib/formatters/index.ts +5 -0
- package/src/shared/lib/slickgrid/lib/functions/addNewRow.ts +22 -0
- package/src/shared/lib/slickgrid/lib/functions/commitCurrentEdit.ts +6 -0
- package/src/shared/lib/slickgrid/lib/functions/copySelectedRows.ts +34 -0
- package/src/shared/lib/slickgrid/lib/functions/deleteRows.ts +20 -0
- package/src/shared/lib/slickgrid/lib/functions/getActiveRowId.ts +16 -0
- package/src/shared/lib/slickgrid/lib/functions/getDisplayedRows.ts +13 -0
- package/src/shared/lib/slickgrid/lib/functions/getLastRow.ts +6 -0
- package/src/shared/lib/slickgrid/lib/functions/getNextId.ts +18 -0
- package/src/shared/lib/slickgrid/lib/functions/index.ts +10 -0
- package/src/shared/lib/slickgrid/lib/functions/isDeletionDangerous.ts +21 -0
- package/src/shared/lib/slickgrid/lib/functions/wereEdited.ts +12 -0
- package/src/shared/lib/slickgrid/lib/grouping/formatterGroupTotals.test.ts +59 -0
- package/src/shared/lib/slickgrid/lib/grouping/formatterGroupTotals.ts +21 -0
- package/src/shared/lib/slickgrid/lib/grouping/index.ts +1 -0
- package/src/shared/lib/slickgrid/lib/highlighting/getColumnsHash.ts +8 -0
- package/src/shared/lib/slickgrid/lib/highlighting/highlightCell.ts +21 -0
- package/src/shared/lib/slickgrid/lib/highlighting/highlightColumns.ts +24 -0
- package/src/shared/lib/slickgrid/lib/highlighting/index.ts +2 -0
- package/src/shared/lib/slickgrid/lib/hooks/eventClickOnTable.ts +17 -0
- package/src/shared/lib/slickgrid/lib/hooks/index.ts +4 -0
- package/src/shared/lib/slickgrid/lib/hooks/useHotKeys.ts +39 -0
- package/src/shared/lib/slickgrid/lib/hooks/useListenIfTablesWereEdited.ts +36 -0
- package/src/shared/lib/slickgrid/lib/hooks/useResizeCanvas.ts +18 -0
- package/src/shared/lib/slickgrid/lib/hooks/useUpdateTotal.ts +17 -0
- package/src/shared/lib/slickgrid/lib/hotKeys/hotKeysCopy.ts +7 -0
- package/src/shared/lib/slickgrid/lib/hotKeys/hotKeysDelete.ts +7 -0
- package/src/shared/lib/slickgrid/lib/hotKeys/hotKeysRedo.ts +7 -0
- package/src/shared/lib/slickgrid/lib/hotKeys/hotKeysReverse.ts +7 -0
- package/src/shared/lib/slickgrid/lib/hotKeys/hotKeysUndo.ts +7 -0
- package/src/shared/lib/slickgrid/lib/hotKeys/index.ts +7 -0
- package/src/shared/lib/slickgrid/lib/hotKeys/nothingToCopy.ts +14 -0
- package/src/shared/lib/slickgrid/lib/hotKeys/positionToPaste.ts +12 -0
- package/src/shared/lib/slickgrid/lib/index.ts +61 -0
- package/src/shared/lib/slickgrid/lib/selection/getUpdates.ts +41 -0
- package/src/shared/lib/slickgrid/lib/selection/index.ts +2 -0
- package/src/shared/lib/slickgrid/lib/selection/selectedRows.ts +17 -0
- package/src/shared/lib/slickgrid/lib/sorting/ColumnSorter.ts +163 -0
- package/src/shared/lib/slickgrid/lib/sorting/index.ts +1 -0
- package/src/shared/lib/slickgrid/lib/total-calculator/TotalCalculator.ts +71 -0
- package/src/shared/lib/slickgrid/lib/total-calculator/index.ts +1 -0
- package/src/shared/lib/slickgrid/lib/validators/DateValidator.ts +12 -0
- package/src/shared/lib/slickgrid/lib/validators/EmptyStringValidator.ts +5 -0
- package/src/shared/lib/slickgrid/lib/validators/LengthValidator.ts +7 -0
- package/src/shared/lib/slickgrid/lib/validators/index.ts +3 -0
- package/src/shared/lib/slickgrid/model/SlickTable/csvDownloadManager/DownloadManager.ts +110 -0
- package/src/shared/lib/slickgrid/model/SlickTable/csvDownloadManager/index.ts +1 -0
- package/src/shared/lib/slickgrid/model/SlickTable/filters/DeletedRowsFilter.test.ts +36 -0
- package/src/shared/lib/slickgrid/model/SlickTable/filters/DeletedRowsFilter.ts +12 -0
- package/src/shared/lib/slickgrid/model/SlickTable/filters/Filter.test.ts +80 -0
- package/src/shared/lib/slickgrid/model/SlickTable/filters/Filter.ts +52 -0
- package/src/shared/lib/slickgrid/model/SlickTable/filters/WithoutFilter.ts +30 -0
- package/src/shared/lib/slickgrid/model/SlickTable/filters/decorators/ColumnFilter/DecoratorColumnFilter.test.ts +216 -0
- package/src/shared/lib/slickgrid/model/SlickTable/filters/decorators/ColumnFilter/DecoratorColumnFilter.ts +53 -0
- package/src/shared/lib/slickgrid/model/SlickTable/filters/decorators/ColumnFilter/Filter.test.ts +264 -0
- package/src/shared/lib/slickgrid/model/SlickTable/filters/decorators/ColumnFilter/Filter.ts +108 -0
- package/src/shared/lib/slickgrid/model/SlickTable/filters/decorators/ColumnFilter/index.ts +1 -0
- package/src/shared/lib/slickgrid/model/SlickTable/filters/decorators/DecoratorEndingDate.ts +16 -0
- package/src/shared/lib/slickgrid/model/SlickTable/filters/decorators/DecoratorFilter.test.ts +139 -0
- package/src/shared/lib/slickgrid/model/SlickTable/filters/decorators/DecoratorFilter.ts +55 -0
- package/src/shared/lib/slickgrid/model/SlickTable/filters/decorators/DecoratorPeriod.ts +24 -0
- package/src/shared/lib/slickgrid/model/SlickTable/filters/decorators/index.ts +4 -0
- package/src/shared/lib/slickgrid/model/SlickTable/filters/index.ts +9 -0
- package/src/shared/lib/slickgrid/model/SlickTable/hotKeys/DefaultHotKeys.ts +116 -0
- package/src/shared/lib/slickgrid/model/SlickTable/hotKeys/WithoutHotKeys.ts +20 -0
- package/src/shared/lib/slickgrid/model/SlickTable/hotKeys/decorators/HotKeysDecorator.ts +32 -0
- package/src/shared/lib/slickgrid/model/SlickTable/hotKeys/decorators/PreventCopying.ts +18 -0
- package/src/shared/lib/slickgrid/model/SlickTable/hotKeys/decorators/RedoUndoOnly.ts +18 -0
- package/src/shared/lib/slickgrid/model/SlickTable/hotKeys/decorators/WithConfirmationOfDeletion.ts +33 -0
- package/src/shared/lib/slickgrid/model/SlickTable/hotKeys/decorators/index.ts +4 -0
- package/src/shared/lib/slickgrid/model/SlickTable/hotKeys/index.ts +8 -0
- package/src/shared/lib/slickgrid/model/SlickTable/index.ts +19 -0
- package/src/shared/lib/slickgrid/model/SlickTable/printer/DefaultPrinter.test.ts +226 -0
- package/src/shared/lib/slickgrid/model/SlickTable/printer/DefaultPrinter.ts +179 -0
- package/src/shared/lib/slickgrid/model/SlickTable/printer/index.ts +1 -0
- package/src/shared/lib/slickgrid/model/SlickTable/printer/model/consts/cssStyles.ts +46 -0
- package/src/shared/lib/slickgrid/model/SlickTable/printer/model/consts/index.ts +1 -0
- package/src/shared/lib/slickgrid/model/SlickTable/printer/model/index.ts +1 -0
- package/src/shared/lib/slickgrid/model/SlickTable/table/SlickTable.test.ts +72 -0
- package/src/shared/lib/slickgrid/model/SlickTable/table/SlickTable.ts +168 -0
- package/src/shared/lib/slickgrid/model/SlickTable/table/index.ts +1 -0
- package/src/shared/lib/slickgrid/model/events/eventContextMenu.ts +10 -0
- package/src/shared/lib/slickgrid/model/events/index.ts +1 -0
- package/src/shared/lib/slickgrid/model/index.ts +18 -0
- package/src/shared/lib/slickgrid/ui/HeaderButtons/index.ts +2 -0
- package/src/shared/lib/slickgrid/ui/HeaderButtons/lib/handleClick/handleHeaderButtons.ts +27 -0
- package/src/shared/lib/slickgrid/ui/HeaderButtons/lib/handleClick/index.ts +1 -0
- package/src/shared/lib/slickgrid/ui/HeaderButtons/lib/highlighting/headerButtons.ts +45 -0
- package/src/shared/lib/slickgrid/ui/HeaderButtons/lib/highlighting/index.ts +1 -0
- package/src/shared/lib/slickgrid/ui/HeaderButtons/lib/index.ts +2 -0
- package/src/shared/lib/slickgrid/ui/HeaderButtons/model/buttons/index.ts +1 -0
- package/src/shared/lib/slickgrid/ui/HeaderButtons/model/buttons/openColumnFilter.ts +10 -0
- package/src/shared/lib/slickgrid/ui/HeaderButtons/model/event/eventOpenColumnFilters.ts +13 -0
- package/src/shared/lib/slickgrid/ui/HeaderButtons/model/event/index.ts +1 -0
- package/src/shared/lib/slickgrid/ui/HeaderButtons/model/index.ts +2 -0
- package/src/shared/lib/slickgrid/ui/SlickgridTable/index.ts +1 -0
- package/src/shared/lib/slickgrid/ui/SlickgridTable/lib/callbacks/index.ts +1 -0
- package/src/shared/lib/slickgrid/ui/SlickgridTable/lib/callbacks/onAddNewRow.ts +34 -0
- package/src/shared/lib/slickgrid/ui/SlickgridTable/lib/hooks/index.ts +1 -0
- package/src/shared/lib/slickgrid/ui/SlickgridTable/lib/hooks/useGrid.ts +142 -0
- package/src/shared/lib/slickgrid/ui/SlickgridTable/lib/index.ts +2 -0
- package/src/shared/lib/slickgrid/ui/SlickgridTable/model/defaultOptions.ts +8 -0
- package/src/shared/lib/slickgrid/ui/SlickgridTable/model/index.ts +2 -0
- package/src/shared/lib/slickgrid/ui/SlickgridTable/model/types/Props.ts +46 -0
- package/src/shared/lib/slickgrid/ui/SlickgridTable/model/types/index.ts +1 -0
- package/src/shared/lib/slickgrid/ui/SlickgridTable/ui/SlickgridTable.tsx +57 -0
- package/src/shared/lib/slickgrid/ui/SlickgridTable/ui/index.ts +1 -0
- package/src/shared/lib/slickgrid/ui/columns/columnCheckboxSelector/columnCheckboxSelector.ts +7 -0
- package/src/shared/lib/slickgrid/ui/columns/columnCheckboxSelector/index.ts +1 -0
- package/src/shared/lib/slickgrid/ui/columns/columnIsEdited/index.ts +1 -0
- package/src/shared/lib/slickgrid/ui/columns/columnIsEdited/lib/index.ts +1 -0
- package/src/shared/lib/slickgrid/ui/columns/columnIsEdited/lib/setEditedMark.spec.ts +11 -0
- package/src/shared/lib/slickgrid/ui/columns/columnIsEdited/lib/setEditedMark.ts +7 -0
- package/src/shared/lib/slickgrid/ui/columns/columnIsEdited/ui/columnIsEdited.ts +16 -0
- package/src/shared/lib/slickgrid/ui/columns/columnIsEdited/ui/index.ts +1 -0
- package/src/shared/lib/slickgrid/ui/columns/index.ts +2 -0
- package/src/shared/lib/slickgrid/ui/index.ts +9 -0
- package/src/shared/lib/slickgrid/ui/styles/WithTableStyles/WithTableStyles.style.ts +157 -0
- package/src/shared/lib/slickgrid/ui/styles/WithTableStyles/WithTableStyles.tsx +11 -0
- package/src/shared/lib/slickgrid/ui/styles/WithTableStyles/index.ts +1 -0
- package/src/shared/lib/slickgrid/ui/styles/index.ts +1 -0
- package/src/shared/lib/slickgrid/ui/styles/keyframes/index.ts +1 -0
- package/src/shared/lib/slickgrid/ui/styles/keyframes/wink.ts +7 -0
- package/src/shared/lib/sorting/Sort.ts +31 -0
- package/src/shared/lib/sorting/index.ts +1 -0
- package/src/shared/lib/stringCalculator/index.ts +2 -0
- package/src/shared/lib/stringCalculator/stringCalculator.js +834 -0
- package/src/shared/lib/stringCalculator/stringCalculator.spec.ts +16 -0
- package/src/shared/lib/strings/deleteDoubleQuotes.spec.ts +11 -0
- package/src/shared/lib/strings/deleteDoubleQuotes.ts +5 -0
- package/src/shared/lib/strings/index.ts +3 -0
- package/src/shared/lib/strings/removeHtml.spec.ts +29 -0
- package/src/shared/lib/strings/removeHtml.ts +5 -0
- package/src/shared/lib/strings/toStringWithCommas.spec.ts +16 -0
- package/src/shared/lib/strings/toStringWithCommas.ts +15 -0
- package/src/shared/model/consts/columnId.ts +1 -0
- package/src/shared/model/consts/dateFormats.ts +5 -0
- package/src/shared/model/consts/index.ts +4 -0
- package/src/shared/model/consts/invalidDate.ts +1 -0
- package/src/shared/model/consts/noPrivilegesMessage.ts +1 -0
- package/src/shared/model/enums/EColumnFilter.ts +16 -0
- package/src/shared/model/enums/EColumnFiltersGroup.ts +10 -0
- package/src/shared/model/enums/EDateFormat.ts +11 -0
- package/src/shared/model/enums/EKey.ts +9 -0
- package/src/shared/model/enums/EKeyCode.ts +8 -0
- package/src/shared/model/enums/ESortType.ts +15 -0
- package/src/shared/model/enums/index.ts +6 -0
- package/src/shared/model/types/IColumn.ts +11 -0
- package/src/shared/model/types/IColumnFilterValue.ts +4 -0
- package/src/shared/model/types/IDownloadManager.ts +6 -0
- package/src/shared/model/types/IEditedRow.ts +5 -0
- package/src/shared/model/types/IExternalVariables.ts +1 -0
- package/src/shared/model/types/IFilter.ts +17 -0
- package/src/shared/model/types/IFilterArguments.ts +14 -0
- package/src/shared/model/types/IGrouping.ts +12 -0
- package/src/shared/model/types/IHotKeysBehavior.ts +15 -0
- package/src/shared/model/types/IObserver.ts +3 -0
- package/src/shared/model/types/IPrinter.ts +24 -0
- package/src/shared/model/types/ISlickRow.ts +1 -0
- package/src/shared/model/types/ISlickTable.ts +41 -0
- package/src/shared/model/types/ITotalCalculator.ts +5 -0
- package/src/shared/model/types/TGridRow.ts +6 -0
- package/src/shared/model/types/index.ts +15 -0
- package/src/shared/ui/ContextSelect/ContextSelect.style.ts +9 -0
- package/src/shared/ui/ContextSelect/ContextSelect.tsx +87 -0
- package/src/shared/ui/ContextSelect/index.ts +2 -0
- package/src/shared/ui/notification/index.ts +1 -0
- package/src/shared/ui/notification/model/index.ts +1 -0
- package/src/shared/ui/notification/ui/index.style.ts +13 -0
- package/src/shared/ui/notification/ui/index.tsx +41 -0
- package/src/shared/ui/styles/WithDatePickerStyles.ts +11 -0
- package/src/shared/ui/styles/index.ts +1 -0
- package/src/vite-env.d.ts +1 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { AdapterMoment } from "@mui/x-date-pickers/AdapterMoment";
|
|
2
|
+
import { DatePicker } from "@mui/x-date-pickers/DatePicker";
|
|
3
|
+
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
|
4
|
+
import { Moment } from "moment/moment";
|
|
5
|
+
import { FC } from "react";
|
|
6
|
+
|
|
7
|
+
import { INVALID_DATE } from "shared/model/consts";
|
|
8
|
+
import { EDateFormat } from "shared/model/enums";
|
|
9
|
+
import { WithDatePickerStyles } from "shared/ui/styles";
|
|
10
|
+
|
|
11
|
+
import { applyFilter, datePickerProps } from "../../lib";
|
|
12
|
+
import { IProps, defaultValue, label } from "../../model";
|
|
13
|
+
|
|
14
|
+
export const DateBetween: FC<Omit<IProps, "label">> = ({ setValue, value }) => {
|
|
15
|
+
function onChange1(date: Moment | null) {
|
|
16
|
+
const dayString = date?.format(EDateFormat.db) || "";
|
|
17
|
+
const newValue = {
|
|
18
|
+
...value,
|
|
19
|
+
1: dayString === INVALID_DATE ? defaultValue[1] : dayString,
|
|
20
|
+
};
|
|
21
|
+
setValue(newValue);
|
|
22
|
+
applyFilter(newValue);
|
|
23
|
+
}
|
|
24
|
+
function onChange2(date: Moment | null) {
|
|
25
|
+
const dayString = date?.format(EDateFormat.db) || "";
|
|
26
|
+
const newValue = {
|
|
27
|
+
...value,
|
|
28
|
+
2: dayString === INVALID_DATE ? defaultValue[2] : dayString,
|
|
29
|
+
};
|
|
30
|
+
setValue(newValue);
|
|
31
|
+
applyFilter(newValue);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<LocalizationProvider dateAdapter={AdapterMoment}>
|
|
36
|
+
<WithDatePickerStyles>
|
|
37
|
+
<DatePicker
|
|
38
|
+
label={label.from}
|
|
39
|
+
onChange={onChange1}
|
|
40
|
+
{...datePickerProps(value[1])}
|
|
41
|
+
/>
|
|
42
|
+
</WithDatePickerStyles>
|
|
43
|
+
<WithDatePickerStyles>
|
|
44
|
+
<DatePicker
|
|
45
|
+
label={label.to}
|
|
46
|
+
onChange={onChange2}
|
|
47
|
+
{...datePickerProps(value[2])}
|
|
48
|
+
/>
|
|
49
|
+
</WithDatePickerStyles>
|
|
50
|
+
</LocalizationProvider>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DateBetween } from "./DateBetween";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AdapterMoment } from "@mui/x-date-pickers/AdapterMoment";
|
|
2
|
+
import { DatePicker } from "@mui/x-date-pickers/DatePicker";
|
|
3
|
+
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
|
4
|
+
import { Moment } from "moment/moment";
|
|
5
|
+
import { FC } from "react";
|
|
6
|
+
|
|
7
|
+
import { INVALID_DATE } from "shared/model/consts";
|
|
8
|
+
import { EDateFormat } from "shared/model/enums";
|
|
9
|
+
import { WithDatePickerStyles } from "shared/ui/styles";
|
|
10
|
+
|
|
11
|
+
import { applyFilter, datePickerProps } from "../../lib";
|
|
12
|
+
import { IProps, defaultValue } from "../../model";
|
|
13
|
+
|
|
14
|
+
export const DateInput: FC<IProps> = ({ label, setValue, value }) => {
|
|
15
|
+
function onChange(date: Moment | null) {
|
|
16
|
+
const dayString = date?.format(EDateFormat.db) || "";
|
|
17
|
+
const newValue = {
|
|
18
|
+
...value,
|
|
19
|
+
1: dayString === INVALID_DATE ? defaultValue[1] : dayString,
|
|
20
|
+
};
|
|
21
|
+
setValue(newValue);
|
|
22
|
+
applyFilter(newValue);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<LocalizationProvider dateAdapter={AdapterMoment}>
|
|
27
|
+
<WithDatePickerStyles>
|
|
28
|
+
<DatePicker
|
|
29
|
+
label={label}
|
|
30
|
+
onChange={onChange}
|
|
31
|
+
{...datePickerProps(value[1])}
|
|
32
|
+
/>
|
|
33
|
+
</WithDatePickerStyles>
|
|
34
|
+
</LocalizationProvider>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DateInput } from "./DateInput";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { FC, Fragment } from "react";
|
|
2
|
+
|
|
3
|
+
import { EColumnFilter } from "shared/model/enums";
|
|
4
|
+
|
|
5
|
+
import { IProps, label } from "../../model";
|
|
6
|
+
import { BooleanInput } from "../BooleanInput";
|
|
7
|
+
import { DateBetween } from "../DateBetween";
|
|
8
|
+
import { DateInput } from "../DateInput";
|
|
9
|
+
import { MultipleSelect } from "../MultipleSelect";
|
|
10
|
+
import { NumberBetween } from "../NumberBetween";
|
|
11
|
+
import { NumberInput } from "../NumberInput";
|
|
12
|
+
import { TextInput } from "../TextInput";
|
|
13
|
+
|
|
14
|
+
export const InputArea: FC<Props> = ({ filterId, setValue, value }) => {
|
|
15
|
+
return (
|
|
16
|
+
<Fragment>
|
|
17
|
+
{filterId === EColumnFilter.Boolean && (
|
|
18
|
+
<BooleanInput setValue={setValue} value={value} />
|
|
19
|
+
)}
|
|
20
|
+
{filterId === EColumnFilter.TextEqual && (
|
|
21
|
+
<TextInput setValue={setValue} value={value} />
|
|
22
|
+
)}
|
|
23
|
+
{filterId === EColumnFilter.TextNotEqual && (
|
|
24
|
+
<TextInput setValue={setValue} value={value} />
|
|
25
|
+
)}
|
|
26
|
+
{filterId === EColumnFilter.TextContain && (
|
|
27
|
+
<TextInput setValue={setValue} value={value} />
|
|
28
|
+
)}
|
|
29
|
+
{filterId === EColumnFilter.TextNotContain && (
|
|
30
|
+
<TextInput setValue={setValue} value={value} />
|
|
31
|
+
)}
|
|
32
|
+
{filterId === EColumnFilter.MultipleSelect && (
|
|
33
|
+
<MultipleSelect setValue={setValue} value={value} />
|
|
34
|
+
)}
|
|
35
|
+
{filterId === EColumnFilter.NumberEqual && (
|
|
36
|
+
<NumberInput label={label.filter} setValue={setValue} value={value} />
|
|
37
|
+
)}
|
|
38
|
+
{filterId === EColumnFilter.NumberFrom && (
|
|
39
|
+
<NumberInput label={label.from} setValue={setValue} value={value} />
|
|
40
|
+
)}
|
|
41
|
+
{filterId === EColumnFilter.NumberTo && (
|
|
42
|
+
<NumberInput label={label.to} setValue={setValue} value={value} />
|
|
43
|
+
)}
|
|
44
|
+
{filterId === EColumnFilter.NumberBetween && (
|
|
45
|
+
<NumberBetween setValue={setValue} value={value} />
|
|
46
|
+
)}
|
|
47
|
+
{filterId === EColumnFilter.DateEqual && (
|
|
48
|
+
<DateInput label={label.filter} setValue={setValue} value={value} />
|
|
49
|
+
)}
|
|
50
|
+
{filterId === EColumnFilter.DateFrom && (
|
|
51
|
+
<DateInput label={label.from} setValue={setValue} value={value} />
|
|
52
|
+
)}
|
|
53
|
+
{filterId === EColumnFilter.DateTo && (
|
|
54
|
+
<DateInput label={label.to} setValue={setValue} value={value} />
|
|
55
|
+
)}
|
|
56
|
+
{filterId === EColumnFilter.DateBetween && (
|
|
57
|
+
<DateBetween setValue={setValue} value={value} />
|
|
58
|
+
)}
|
|
59
|
+
</Fragment>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
type Props = Omit<IProps, "label"> & { filterId: EColumnFilter };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { InputArea } from "./InputArea";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MultipleSelect } from "./ui";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { props } from "./props";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SlickDataView } from "slickgrid";
|
|
2
|
+
|
|
3
|
+
import { eventOpenColumnFilters } from "shared/lib/slickgrid";
|
|
4
|
+
|
|
5
|
+
import { IValue } from "../../model";
|
|
6
|
+
|
|
7
|
+
const emptyProps = { label: "", options: [] };
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Molds label and options list for multiple select.
|
|
11
|
+
*
|
|
12
|
+
* @returns {Object} contains "label" and "options" fields.
|
|
13
|
+
*/
|
|
14
|
+
export function props(): { label: string; options: IValue[] } {
|
|
15
|
+
const { columnId, table } = eventOpenColumnFilters;
|
|
16
|
+
const grid = table?.grid;
|
|
17
|
+
if (!grid) return emptyProps;
|
|
18
|
+
const column = grid?.getColumns().find(({ id }) => id === columnId);
|
|
19
|
+
if (!column) return emptyProps;
|
|
20
|
+
const label = column.name as string;
|
|
21
|
+
|
|
22
|
+
const options: IValue[] = [];
|
|
23
|
+
const { formatter, id } = column;
|
|
24
|
+
const dataView: SlickDataView = grid.getData();
|
|
25
|
+
const optionsSet = new Set<IValue>();
|
|
26
|
+
const items = dataView.getItems();
|
|
27
|
+
items.forEach((item) => {
|
|
28
|
+
optionsSet.add(
|
|
29
|
+
formatter ? formatter(0, 0, item[id], column, null, grid) : item[id],
|
|
30
|
+
);
|
|
31
|
+
});
|
|
32
|
+
for (const option of optionsSet) {
|
|
33
|
+
options.push(option);
|
|
34
|
+
}
|
|
35
|
+
return { label, options };
|
|
36
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IValue } from "../../model";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Callback for sorting array elements ascending.
|
|
5
|
+
*
|
|
6
|
+
* @param {Number | String} a element of an array.
|
|
7
|
+
* @param {Number | String} b element of an array.
|
|
8
|
+
* @returns Sorting result.
|
|
9
|
+
*/
|
|
10
|
+
export function ascending(a: IValue, b: IValue): number {
|
|
11
|
+
if (typeof a === "string" && typeof b === "string") {
|
|
12
|
+
return a.localeCompare(b);
|
|
13
|
+
} else if (typeof a === "number" && typeof b === "number") {
|
|
14
|
+
return a - b;
|
|
15
|
+
}
|
|
16
|
+
return 0;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ascending } from "./ascending";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type IValue = number | string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { IValue } from "./IValue";
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FormControl,
|
|
3
|
+
InputLabel,
|
|
4
|
+
ListItemText,
|
|
5
|
+
MenuItem,
|
|
6
|
+
OutlinedInput,
|
|
7
|
+
Select,
|
|
8
|
+
SelectChangeEvent,
|
|
9
|
+
} from "@mui/material";
|
|
10
|
+
import React from "react";
|
|
11
|
+
|
|
12
|
+
import { applyFilter } from "../../../lib";
|
|
13
|
+
import { IProps } from "../../../model";
|
|
14
|
+
import { ascending, props } from "../lib";
|
|
15
|
+
import { IValue } from "../model";
|
|
16
|
+
|
|
17
|
+
import Styled from "./MultipleSelect.style";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Generates multiple select based on values represented in the column
|
|
21
|
+
*/
|
|
22
|
+
export const MultipleSelect: React.FC<Props> = ({ setValue, value }) => {
|
|
23
|
+
const selectedValues = JSON.parse(value[1] || '["All"]');
|
|
24
|
+
|
|
25
|
+
const { label, options } = props();
|
|
26
|
+
|
|
27
|
+
const handleChange = (event: SelectChangeEvent<unknown>) => {
|
|
28
|
+
const targetValue = event.target.value as string[];
|
|
29
|
+
let newValue;
|
|
30
|
+
if (targetValue[targetValue.length - 1] === "All" || !targetValue.length) {
|
|
31
|
+
newValue = { 1: "", 2: "" };
|
|
32
|
+
} else {
|
|
33
|
+
if (targetValue.length > 1 && targetValue[0] === "All") {
|
|
34
|
+
targetValue.shift();
|
|
35
|
+
}
|
|
36
|
+
newValue = {
|
|
37
|
+
...value,
|
|
38
|
+
1: JSON.stringify(targetValue),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
setValue(newValue);
|
|
42
|
+
applyFilter(newValue);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<FormControl size={"small"}>
|
|
47
|
+
<InputLabel id="column-filter-multiple-select-label">{label}</InputLabel>
|
|
48
|
+
<Select
|
|
49
|
+
labelId="column-filter-multiple-select-label"
|
|
50
|
+
id="column-filter-multiple-select"
|
|
51
|
+
multiple
|
|
52
|
+
value={selectedValues}
|
|
53
|
+
onChange={handleChange}
|
|
54
|
+
input={<OutlinedInput label={label} />}
|
|
55
|
+
renderValue={(selected: unknown) => (selected as IValue[]).join(", ")}
|
|
56
|
+
>
|
|
57
|
+
<MenuItem key={0} value={"All"}>
|
|
58
|
+
<Styled.Checkbox checked={selectedValues.indexOf("All") > -1} />
|
|
59
|
+
<ListItemText primary={"All"} />
|
|
60
|
+
</MenuItem>
|
|
61
|
+
{options.sort(ascending).map((option) => (
|
|
62
|
+
<MenuItem key={option} value={option}>
|
|
63
|
+
<Styled.Checkbox checked={selectedValues.indexOf(option) > -1} />
|
|
64
|
+
<ListItemText primary={option} />
|
|
65
|
+
</MenuItem>
|
|
66
|
+
))}
|
|
67
|
+
</Select>
|
|
68
|
+
</FormControl>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
type Props = Omit<IProps, "label">;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MultipleSelect } from "./MultipleSelect";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { TextField } from "@mui/material";
|
|
2
|
+
import { ChangeEvent, FC, Fragment } from "react";
|
|
3
|
+
|
|
4
|
+
import { applyFilter } from "../../lib";
|
|
5
|
+
import { IProps, label } from "../../model";
|
|
6
|
+
|
|
7
|
+
export const NumberBetween: FC<Omit<IProps, "label">> = ({
|
|
8
|
+
setValue,
|
|
9
|
+
value,
|
|
10
|
+
}) => {
|
|
11
|
+
function onChange1(event: ChangeEvent<HTMLInputElement>) {
|
|
12
|
+
const newValue = { ...value, 1: event.target.value };
|
|
13
|
+
setValue(newValue);
|
|
14
|
+
applyFilter(newValue);
|
|
15
|
+
}
|
|
16
|
+
function onChange2(event: ChangeEvent<HTMLInputElement>) {
|
|
17
|
+
const newValue = { ...value, 2: event.target.value };
|
|
18
|
+
setValue(newValue);
|
|
19
|
+
applyFilter(newValue);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Fragment>
|
|
24
|
+
<TextField
|
|
25
|
+
label={label.from}
|
|
26
|
+
value={value[1]}
|
|
27
|
+
type={"number"}
|
|
28
|
+
onChange={onChange1}
|
|
29
|
+
size={"small"}
|
|
30
|
+
autoComplete={"off"}
|
|
31
|
+
/>
|
|
32
|
+
<TextField
|
|
33
|
+
label={label.to}
|
|
34
|
+
value={value[2]}
|
|
35
|
+
type={"number"}
|
|
36
|
+
onChange={onChange2}
|
|
37
|
+
size={"small"}
|
|
38
|
+
autoComplete={"off"}
|
|
39
|
+
/>
|
|
40
|
+
</Fragment>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NumberBetween } from "./NumberBetween";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { TextField } from "@mui/material";
|
|
2
|
+
import { ChangeEvent, FC } from "react";
|
|
3
|
+
|
|
4
|
+
import { applyFilter } from "../../lib";
|
|
5
|
+
import { IProps } from "../../model";
|
|
6
|
+
|
|
7
|
+
export const NumberInput: FC<IProps> = ({ label, setValue, value }) => {
|
|
8
|
+
function onChange(event: ChangeEvent<HTMLInputElement>) {
|
|
9
|
+
const newValue = { ...value, 1: event.target.value };
|
|
10
|
+
setValue(newValue);
|
|
11
|
+
applyFilter(newValue);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<TextField
|
|
16
|
+
label={label}
|
|
17
|
+
value={value[1]}
|
|
18
|
+
type={"number"}
|
|
19
|
+
onChange={onChange}
|
|
20
|
+
size={"small"}
|
|
21
|
+
autoComplete={"off"}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NumberInput } from "./NumberInput";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SelectFilter } from "./ui";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { options } from "./options";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { options } from "./options";
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { EColumnFilter, EColumnFiltersGroup } from "shared/model/enums";
|
|
2
|
+
import { IContextSelectValue } from "shared/ui/ContextSelect";
|
|
3
|
+
|
|
4
|
+
const dateBetween: IContextSelectValue = {
|
|
5
|
+
id: EColumnFilter.DateBetween,
|
|
6
|
+
name: "Between",
|
|
7
|
+
};
|
|
8
|
+
const dateEqual: IContextSelectValue = {
|
|
9
|
+
id: EColumnFilter.DateEqual,
|
|
10
|
+
name: "Equal",
|
|
11
|
+
};
|
|
12
|
+
const dateFrom: IContextSelectValue = {
|
|
13
|
+
id: EColumnFilter.DateFrom,
|
|
14
|
+
name: "From",
|
|
15
|
+
};
|
|
16
|
+
const dateTo: IContextSelectValue = { id: EColumnFilter.DateTo, name: "To" };
|
|
17
|
+
const numberBetween: IContextSelectValue = {
|
|
18
|
+
id: EColumnFilter.NumberBetween,
|
|
19
|
+
name: "Between",
|
|
20
|
+
};
|
|
21
|
+
const numberEqual: IContextSelectValue = {
|
|
22
|
+
id: EColumnFilter.NumberEqual,
|
|
23
|
+
name: "Equal",
|
|
24
|
+
};
|
|
25
|
+
const numberFrom: IContextSelectValue = {
|
|
26
|
+
id: EColumnFilter.NumberFrom,
|
|
27
|
+
name: "From",
|
|
28
|
+
};
|
|
29
|
+
const numberTo: IContextSelectValue = {
|
|
30
|
+
id: EColumnFilter.NumberTo,
|
|
31
|
+
name: "To",
|
|
32
|
+
};
|
|
33
|
+
const textContain: IContextSelectValue = {
|
|
34
|
+
id: EColumnFilter.TextContain,
|
|
35
|
+
name: "Contains",
|
|
36
|
+
};
|
|
37
|
+
const textEqual: IContextSelectValue = {
|
|
38
|
+
id: EColumnFilter.TextEqual,
|
|
39
|
+
name: "Equal",
|
|
40
|
+
};
|
|
41
|
+
const textNotContain: IContextSelectValue = {
|
|
42
|
+
id: EColumnFilter.TextNotContain,
|
|
43
|
+
name: "Does not contain",
|
|
44
|
+
};
|
|
45
|
+
const textNotEqual: IContextSelectValue = {
|
|
46
|
+
id: EColumnFilter.TextNotEqual,
|
|
47
|
+
name: "Not equal",
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const numberFilters = [numberEqual, numberFrom, numberTo, numberBetween];
|
|
51
|
+
|
|
52
|
+
export const options: IOptions = {
|
|
53
|
+
[EColumnFiltersGroup.Boolean]: [],
|
|
54
|
+
[EColumnFiltersGroup.Date]: [dateEqual, dateFrom, dateTo, dateBetween],
|
|
55
|
+
[EColumnFiltersGroup.MultipleSelect]: [],
|
|
56
|
+
[EColumnFiltersGroup.Number]: numberFilters,
|
|
57
|
+
[EColumnFiltersGroup.NumberFormatted]: numberFilters,
|
|
58
|
+
[EColumnFiltersGroup.Text]: [
|
|
59
|
+
textContain,
|
|
60
|
+
textNotContain,
|
|
61
|
+
textEqual,
|
|
62
|
+
textNotEqual,
|
|
63
|
+
],
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
type IOptions = Record<EColumnFiltersGroup, IContextSelectValue[]>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { SelectChangeEvent } from "@mui/material";
|
|
2
|
+
import { Dispatch, FC, SetStateAction } from "react";
|
|
3
|
+
|
|
4
|
+
import { eventOpenColumnFilters } from "shared/lib/slickgrid";
|
|
5
|
+
import { EColumnFilter } from "shared/model/enums";
|
|
6
|
+
import { ContextSelect } from "shared/ui/ContextSelect";
|
|
7
|
+
|
|
8
|
+
import { options } from "../model";
|
|
9
|
+
|
|
10
|
+
export const SelectFilter: FC<IProps> = ({ filterId, setFilterId }) => {
|
|
11
|
+
const list = options[eventOpenColumnFilters.group];
|
|
12
|
+
const value = list.some(({ id }) => id === filterId) ? filterId : list[0]?.id;
|
|
13
|
+
|
|
14
|
+
function onChange(event: SelectChangeEvent<string | number>) {
|
|
15
|
+
const { columnId, table } = eventOpenColumnFilters;
|
|
16
|
+
if (!columnId || !table) return;
|
|
17
|
+
const args = table.filter.args;
|
|
18
|
+
const id = event.target.value as number;
|
|
19
|
+
if (!args.columnFilters) return;
|
|
20
|
+
table.filter.args = {
|
|
21
|
+
...args,
|
|
22
|
+
columnFilters: {
|
|
23
|
+
...args.columnFilters,
|
|
24
|
+
[columnId]: {
|
|
25
|
+
...args.columnFilters[columnId],
|
|
26
|
+
filterId: id,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
setFilterId(id);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (!value) return null;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<ContextSelect
|
|
37
|
+
name={""}
|
|
38
|
+
list={list}
|
|
39
|
+
onChange={onChange}
|
|
40
|
+
width={"100%"}
|
|
41
|
+
showSelect={false}
|
|
42
|
+
value={value}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
interface IProps {
|
|
48
|
+
filterId: EColumnFilter;
|
|
49
|
+
setFilterId: Dispatch<SetStateAction<EColumnFilter>>;
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SelectFilter } from "./SelectFilter";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TextField } from "@mui/material";
|
|
2
|
+
import { ChangeEvent, FC } from "react";
|
|
3
|
+
|
|
4
|
+
import { applyFilter } from "../../lib";
|
|
5
|
+
import { IProps, label } from "../../model";
|
|
6
|
+
|
|
7
|
+
export const TextInput: FC<Omit<IProps, "label">> = ({ setValue, value }) => {
|
|
8
|
+
function onChange(event: ChangeEvent<HTMLInputElement>) {
|
|
9
|
+
const newValue = { ...value, 1: event.target.value };
|
|
10
|
+
setValue(newValue);
|
|
11
|
+
applyFilter(newValue);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<TextField
|
|
16
|
+
label={label.filter}
|
|
17
|
+
value={value[1]}
|
|
18
|
+
onChange={onChange}
|
|
19
|
+
size={"small"}
|
|
20
|
+
autoComplete={"off"}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TextInput } from "./TextInput";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ColumnFilters } from "./ColumnFilters";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ContextMenu } from "./ui";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useSubscribeToEvent } from "./useSubscribeToEvent";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction, useEffect } from "react";
|
|
2
|
+
|
|
3
|
+
import { eventContextMenu } from "shared/lib/slickgrid";
|
|
4
|
+
|
|
5
|
+
import { makeVisible } from "entities/popup";
|
|
6
|
+
|
|
7
|
+
import { CONTEXT_MENU } from "../../model";
|
|
8
|
+
|
|
9
|
+
export function useSubscribeToEvent(
|
|
10
|
+
setIsOpened: Dispatch<SetStateAction<boolean>>,
|
|
11
|
+
) {
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
function callback() {
|
|
14
|
+
setIsOpened(true);
|
|
15
|
+
setTimeout(() => {
|
|
16
|
+
const menu = document.getElementById(CONTEXT_MENU);
|
|
17
|
+
if (!menu) return;
|
|
18
|
+
const { x, y } = eventContextMenu;
|
|
19
|
+
makeVisible(menu, x, y);
|
|
20
|
+
}, 0);
|
|
21
|
+
}
|
|
22
|
+
eventContextMenu.subscribe(callback);
|
|
23
|
+
return () => {
|
|
24
|
+
eventContextMenu.unsubscribe(callback);
|
|
25
|
+
};
|
|
26
|
+
}, []);
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useSubscribeToEvent } from "./hooks";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const CONTEXT_MENU = "context_menu";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CONTEXT_MENU } from "./id";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CONTEXT_MENU } from "./consts";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Dispatch, FC, SetStateAction } from "react";
|
|
2
|
+
|
|
3
|
+
import { eventContextMenu } from "shared/lib/slickgrid";
|
|
4
|
+
|
|
5
|
+
import Styled from "../ContextMenu.style";
|
|
6
|
+
|
|
7
|
+
export const ButtonDownloadCSV: FC<TProps> = ({
|
|
8
|
+
clientId,
|
|
9
|
+
clientName,
|
|
10
|
+
setIsOpened,
|
|
11
|
+
}) => {
|
|
12
|
+
const onClick = (): void => {
|
|
13
|
+
const table = eventContextMenu.table;
|
|
14
|
+
const grid = table?.grid;
|
|
15
|
+
if (!table || !grid) {
|
|
16
|
+
setIsOpened(false);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
table.downloadManager.download(table, clientId, clientName);
|
|
20
|
+
setIsOpened(false);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Styled.Li onClick={onClick}>
|
|
25
|
+
<Styled.Icon className={"sgi sgi-download"}></Styled.Icon>Download as CSV
|
|
26
|
+
</Styled.Li>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type TProps = {
|
|
31
|
+
clientId: number;
|
|
32
|
+
clientName: string;
|
|
33
|
+
setIsOpened: Dispatch<SetStateAction<boolean>>;
|
|
34
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ButtonDownloadCSV } from "./ButtonDownloadCSV";
|