slick-table 1.0.18 → 1.1.1
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 +31 -31
- package/dist/index.es.js +162 -157
- package/dist/types/shared/lib/slickgrid/lib/sorting/ColumnSorter.d.ts +1 -0
- package/dist/types/shared/lib/slickgrid/lib/sorting/ColumnSorter.d.ts.map +1 -1
- package/dist/types/shared/lib/sorting/Sort.d.ts +1 -0
- package/dist/types/shared/lib/sorting/Sort.d.ts.map +1 -1
- package/dist/types/shared/model/enums/ESortType.d.ts +3 -1
- package/dist/types/shared/model/enums/ESortType.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 +166 -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 +37 -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 +17 -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,139 @@
|
|
|
1
|
+
import { SlickGrid } from "slickgrid";
|
|
2
|
+
|
|
3
|
+
import { ISlickRow } from "shared/model/types";
|
|
4
|
+
import { IFilter } from "shared/model/types";
|
|
5
|
+
|
|
6
|
+
import { SlickTable } from "../../table";
|
|
7
|
+
import { DecoratorFilter } from "./DecoratorFilter";
|
|
8
|
+
|
|
9
|
+
class TestDecoratorFilter extends DecoratorFilter {
|
|
10
|
+
filterFn(): boolean {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
describe("DecoratorFilter", () => {
|
|
16
|
+
let decoratorFilter: TestDecoratorFilter;
|
|
17
|
+
let mockFilter: IFilter;
|
|
18
|
+
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
mockFilter = {
|
|
21
|
+
getFilterFn: jest.fn(),
|
|
22
|
+
reset: jest.fn(),
|
|
23
|
+
print: jest.fn(),
|
|
24
|
+
args: {},
|
|
25
|
+
grid: {} as SlickGrid,
|
|
26
|
+
tableId: "test-table",
|
|
27
|
+
} as unknown as IFilter;
|
|
28
|
+
|
|
29
|
+
decoratorFilter = new TestDecoratorFilter(mockFilter);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("should combine the decorator's filterFn with the wrapped filter's filterFn", () => {
|
|
33
|
+
jest
|
|
34
|
+
.spyOn(mockFilter, "getFilterFn")
|
|
35
|
+
.mockReturnValue((row) => row.id % 2 === 0);
|
|
36
|
+
|
|
37
|
+
jest
|
|
38
|
+
.spyOn(decoratorFilter, "filterFn")
|
|
39
|
+
.mockImplementation((row: ISlickRow) => row.value > 10);
|
|
40
|
+
|
|
41
|
+
const combinedFilterFn = decoratorFilter.getFilterFn();
|
|
42
|
+
|
|
43
|
+
const row1 = { id: 1, value: 15 };
|
|
44
|
+
const row2 = { id: 2, value: 5 };
|
|
45
|
+
const row3 = { id: 3, value: 20 };
|
|
46
|
+
const row4 = { id: 4, value: 25 };
|
|
47
|
+
|
|
48
|
+
expect(combinedFilterFn(row1, {})).toBe(false);
|
|
49
|
+
expect(combinedFilterFn(row2, {})).toBe(false);
|
|
50
|
+
expect(combinedFilterFn(row3, {})).toBe(false);
|
|
51
|
+
expect(combinedFilterFn(row4, {})).toBe(true);
|
|
52
|
+
|
|
53
|
+
expect(mockFilter.getFilterFn).toHaveBeenCalledTimes(1);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("should set and get args through the decorator", () => {
|
|
57
|
+
const testArgs = { key: "value" };
|
|
58
|
+
|
|
59
|
+
decoratorFilter.args = testArgs;
|
|
60
|
+
expect(decoratorFilter.args).toEqual(testArgs);
|
|
61
|
+
expect(mockFilter.args).toEqual(testArgs);
|
|
62
|
+
|
|
63
|
+
const retrievedArgs = decoratorFilter.args;
|
|
64
|
+
|
|
65
|
+
expect(retrievedArgs).toEqual(testArgs);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("should set and get grid through the decorator", () => {
|
|
69
|
+
mockFilter.grid = null;
|
|
70
|
+
decoratorFilter = new TestDecoratorFilter(mockFilter);
|
|
71
|
+
const testGrid = {} as SlickGrid;
|
|
72
|
+
decoratorFilter.grid = testGrid;
|
|
73
|
+
|
|
74
|
+
expect(decoratorFilter.grid).toBe(testGrid);
|
|
75
|
+
expect(mockFilter.grid).toBe(testGrid);
|
|
76
|
+
|
|
77
|
+
const retrievedGrid = decoratorFilter.grid;
|
|
78
|
+
|
|
79
|
+
expect(retrievedGrid).toBe(testGrid);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("should set and get tableId through the decorator", () => {
|
|
83
|
+
const testTableId = "test-table-id";
|
|
84
|
+
|
|
85
|
+
mockFilter.tableId = "";
|
|
86
|
+
decoratorFilter.tableId = testTableId;
|
|
87
|
+
|
|
88
|
+
expect(decoratorFilter.tableId).toBe(testTableId);
|
|
89
|
+
expect(mockFilter.tableId).toBe(testTableId);
|
|
90
|
+
|
|
91
|
+
const retrievedTableId = decoratorFilter.tableId;
|
|
92
|
+
expect(retrievedTableId).toBe(testTableId);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it("should register the filter with the grid and apply it to the data view", () => {
|
|
96
|
+
mockFilter.args = { testArg: "value" };
|
|
97
|
+
mockFilter.grid = null;
|
|
98
|
+
jest.spyOn(mockFilter, "getFilterFn").mockReturnValue(() => true);
|
|
99
|
+
|
|
100
|
+
const mockDataView = {
|
|
101
|
+
setFilter: jest.fn(),
|
|
102
|
+
setFilterArgs: jest.fn(),
|
|
103
|
+
refresh: jest.fn(),
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const mockGrid = {
|
|
107
|
+
getData: jest.fn().mockReturnValue(mockDataView),
|
|
108
|
+
} as unknown as SlickGrid;
|
|
109
|
+
|
|
110
|
+
decoratorFilter.register(mockGrid, "test-table-id");
|
|
111
|
+
|
|
112
|
+
expect(decoratorFilter.tableId).toBe("test-table-id");
|
|
113
|
+
expect(decoratorFilter.grid).toBe(mockGrid);
|
|
114
|
+
expect(mockGrid.getData).toHaveBeenCalled();
|
|
115
|
+
expect(mockDataView.setFilter).toHaveBeenCalledWith(expect.any(Function));
|
|
116
|
+
expect(mockDataView.setFilterArgs).toHaveBeenCalledWith(mockFilter.args);
|
|
117
|
+
expect(mockDataView.refresh).toHaveBeenCalled();
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it("should return the wrapped filter's print result when print is called", () => {
|
|
121
|
+
const mockTable = {} as SlickTable;
|
|
122
|
+
const mockPrintResult = [
|
|
123
|
+
document.createElement("tr"),
|
|
124
|
+
document.createElement("tr"),
|
|
125
|
+
];
|
|
126
|
+
|
|
127
|
+
jest.spyOn(mockFilter, "print").mockReturnValue(mockPrintResult);
|
|
128
|
+
const result = decoratorFilter.print(mockTable);
|
|
129
|
+
|
|
130
|
+
expect(mockFilter.print).toHaveBeenCalledWith(mockTable);
|
|
131
|
+
expect(result).toBe(mockPrintResult);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it("should reset both the decorator and the wrapped filter when reset is called", () => {
|
|
135
|
+
decoratorFilter.reset();
|
|
136
|
+
|
|
137
|
+
expect(mockFilter.reset).toHaveBeenCalledTimes(1);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { FilterFn, SlickDataView, SlickGrid } from "slickgrid";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
IFilter,
|
|
5
|
+
IFilterArguments,
|
|
6
|
+
ISlickRow,
|
|
7
|
+
ISlickTable,
|
|
8
|
+
} from "shared/model/types";
|
|
9
|
+
|
|
10
|
+
export abstract class DecoratorFilter implements IFilter {
|
|
11
|
+
protected filter: IFilter;
|
|
12
|
+
constructor(filter: IFilter) {
|
|
13
|
+
this.filter = filter;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
abstract filterFn(row: ISlickRow, args: IFilterArguments): boolean;
|
|
17
|
+
public getFilterFn(): FilterFn<ISlickRow> {
|
|
18
|
+
const filterFn = this.filter.getFilterFn();
|
|
19
|
+
return (row, args): boolean => {
|
|
20
|
+
return this.filterFn(row, args) && filterFn(row, args);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
public register(grid: SlickGrid, tableId: string): void {
|
|
24
|
+
this.tableId = tableId;
|
|
25
|
+
this.grid = grid;
|
|
26
|
+
const dataView: SlickDataView = grid.getData();
|
|
27
|
+
dataView.setFilter(this.getFilterFn());
|
|
28
|
+
dataView.setFilterArgs(this.args);
|
|
29
|
+
dataView.refresh();
|
|
30
|
+
}
|
|
31
|
+
public reset() {
|
|
32
|
+
this.filter.reset();
|
|
33
|
+
}
|
|
34
|
+
public print(table: ISlickTable): HTMLTableRowElement[] {
|
|
35
|
+
return this.filter.print(table);
|
|
36
|
+
}
|
|
37
|
+
set args(args) {
|
|
38
|
+
this.filter.args = args;
|
|
39
|
+
}
|
|
40
|
+
set grid(grid) {
|
|
41
|
+
this.filter.grid = grid;
|
|
42
|
+
}
|
|
43
|
+
set tableId(table) {
|
|
44
|
+
this.filter.tableId = table;
|
|
45
|
+
}
|
|
46
|
+
get args() {
|
|
47
|
+
return this.filter.args;
|
|
48
|
+
}
|
|
49
|
+
get grid() {
|
|
50
|
+
return this.filter.grid;
|
|
51
|
+
}
|
|
52
|
+
get tableId() {
|
|
53
|
+
return this.filter.tableId;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import moment from "moment/moment";
|
|
2
|
+
|
|
3
|
+
import { dateFormats } from "shared/model/consts";
|
|
4
|
+
|
|
5
|
+
import { DecoratorFilter } from "./DecoratorFilter";
|
|
6
|
+
|
|
7
|
+
export class DecoratorPeriod extends DecoratorFilter {
|
|
8
|
+
public filterFn(row: Record<string, any>, filterArgs: IFilterArgs): boolean {
|
|
9
|
+
const { endDate, startDate } = filterArgs;
|
|
10
|
+
if (endDate && startDate) {
|
|
11
|
+
const start = moment(startDate);
|
|
12
|
+
const end = moment(endDate);
|
|
13
|
+
const recordDate = moment(row.date, dateFormats);
|
|
14
|
+
return recordDate.isBetween(start, end, undefined, "[]");
|
|
15
|
+
} else {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface IFilterArgs {
|
|
22
|
+
endDate: string;
|
|
23
|
+
startDate: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { DeletedRowsFilter } from "./DeletedRowsFilter";
|
|
2
|
+
export { Filter } from "./Filter";
|
|
3
|
+
export { WithoutFilter } from "./WithoutFilter";
|
|
4
|
+
export {
|
|
5
|
+
DecoratorEndingDate,
|
|
6
|
+
DecoratorFilter,
|
|
7
|
+
DecoratorColumnFilter,
|
|
8
|
+
DecoratorPeriod,
|
|
9
|
+
} from "./decorators";
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OnKeyDownEventArgs,
|
|
3
|
+
SlickDataView,
|
|
4
|
+
SlickEventData,
|
|
5
|
+
SlickGrid,
|
|
6
|
+
} from "slickgrid";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
IExternalVariables,
|
|
10
|
+
IHotKeysBehavior,
|
|
11
|
+
ISlickRow,
|
|
12
|
+
ISlickTable,
|
|
13
|
+
TGridRow,
|
|
14
|
+
} from "shared/model/types";
|
|
15
|
+
|
|
16
|
+
import {
|
|
17
|
+
copySelectedRows,
|
|
18
|
+
hotKeysCopy,
|
|
19
|
+
hotKeysDelete,
|
|
20
|
+
hotKeysRedo,
|
|
21
|
+
hotKeysUndo,
|
|
22
|
+
nothingToCopy,
|
|
23
|
+
} from "../../../lib";
|
|
24
|
+
|
|
25
|
+
export class DefaultHotKeys implements IHotKeysBehavior {
|
|
26
|
+
private externalVariables: IExternalVariables = {};
|
|
27
|
+
private commandQueue: ISlickRow[][] = [];
|
|
28
|
+
private queueIndex = -1;
|
|
29
|
+
|
|
30
|
+
private getQueueIndex(): number {
|
|
31
|
+
return this.queueIndex;
|
|
32
|
+
}
|
|
33
|
+
private setQueueIndex(queueIndex: number): void {
|
|
34
|
+
this.queueIndex = queueIndex;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public handleKeyboardEvent(
|
|
38
|
+
event: SlickEventData<OnKeyDownEventArgs>,
|
|
39
|
+
table: ISlickTable,
|
|
40
|
+
): void {
|
|
41
|
+
const grid = table.grid;
|
|
42
|
+
if (!table.isActive) return;
|
|
43
|
+
if (!grid) return;
|
|
44
|
+
const dataView: SlickDataView = grid.getData();
|
|
45
|
+
if (hotKeysCopy(event)) {
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
event.stopImmediatePropagation();
|
|
48
|
+
if (nothingToCopy(grid)) return;
|
|
49
|
+
if (this.externalVariables.editingAllowed === false) return;
|
|
50
|
+
copySelectedRows(grid);
|
|
51
|
+
grid.invalidate();
|
|
52
|
+
this.pushToCommandQueue(grid);
|
|
53
|
+
table.isEdited = true;
|
|
54
|
+
} else if (hotKeysDelete(event)) {
|
|
55
|
+
event.preventDefault();
|
|
56
|
+
event.stopImmediatePropagation();
|
|
57
|
+
const selectedRows = grid.getSelectedRows();
|
|
58
|
+
if (!selectedRows.length) return;
|
|
59
|
+
selectedRows.forEach((rowNumber): void => {
|
|
60
|
+
const row = dataView.getItem<TGridRow>(rowNumber);
|
|
61
|
+
row.isDeleted = true;
|
|
62
|
+
});
|
|
63
|
+
grid.setSelectedRows([]);
|
|
64
|
+
dataView.refresh();
|
|
65
|
+
grid.invalidate();
|
|
66
|
+
this.pushToCommandQueue(grid);
|
|
67
|
+
table.isEdited = true;
|
|
68
|
+
} else if (hotKeysUndo(event)) {
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
event.stopImmediatePropagation();
|
|
71
|
+
const queueIndex = this.getQueueIndex();
|
|
72
|
+
if (queueIndex < 1) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const newQueueIndex = queueIndex - 1;
|
|
76
|
+
this.setQueueIndex(newQueueIndex);
|
|
77
|
+
dataView.setItems(copy(this.commandQueue[newQueueIndex]));
|
|
78
|
+
grid.invalidate();
|
|
79
|
+
table.isEdited = newQueueIndex !== 0;
|
|
80
|
+
} else if (hotKeysRedo(event)) {
|
|
81
|
+
event.preventDefault();
|
|
82
|
+
event.stopImmediatePropagation();
|
|
83
|
+
const queueIndex = this.getQueueIndex();
|
|
84
|
+
if (queueIndex === this.commandQueue.length - 1) return;
|
|
85
|
+
const newQueueIndex = queueIndex + 1;
|
|
86
|
+
this.setQueueIndex(newQueueIndex);
|
|
87
|
+
dataView.setItems(copy(this.commandQueue[newQueueIndex]));
|
|
88
|
+
grid.invalidate();
|
|
89
|
+
table.isEdited = true;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
public pushToCommandQueue(grid: SlickGrid | null): void {
|
|
93
|
+
if (!grid) return;
|
|
94
|
+
const dataView: SlickDataView = grid.getData();
|
|
95
|
+
const rows = dataView.getItems();
|
|
96
|
+
const queueIndex = this.getQueueIndex();
|
|
97
|
+
const newQueueIndex = queueIndex + 1;
|
|
98
|
+
this.commandQueue.length = newQueueIndex;
|
|
99
|
+
this.commandQueue.push(copy(rows));
|
|
100
|
+
this.setQueueIndex(newQueueIndex);
|
|
101
|
+
}
|
|
102
|
+
public resetQueue(): void {
|
|
103
|
+
this.commandQueue.length = 0;
|
|
104
|
+
this.queueIndex = -1;
|
|
105
|
+
}
|
|
106
|
+
public setExternalVariables(variables: IExternalVariables): void {
|
|
107
|
+
this.externalVariables = { ...this.externalVariables, ...variables };
|
|
108
|
+
}
|
|
109
|
+
public getExternalVariables(): IExternalVariables {
|
|
110
|
+
return this.externalVariables;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function copy(rows: ISlickRow[]): ISlickRow[] {
|
|
115
|
+
return rows.map((row) => ({ ...row }));
|
|
116
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IExternalVariables, IHotKeysBehavior } from "shared/model/types";
|
|
2
|
+
|
|
3
|
+
export class WithoutHotKeys implements IHotKeysBehavior {
|
|
4
|
+
handleKeyboardEvent(): void {
|
|
5
|
+
// does nothing
|
|
6
|
+
}
|
|
7
|
+
pushToCommandQueue(): void {
|
|
8
|
+
// does nothing
|
|
9
|
+
}
|
|
10
|
+
resetQueue(): void {
|
|
11
|
+
// does nothing
|
|
12
|
+
}
|
|
13
|
+
setExternalVariables(_variables: IExternalVariables): void {
|
|
14
|
+
// does nothing
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getExternalVariables(): IExternalVariables {
|
|
18
|
+
return {};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { OnKeyDownEventArgs, SlickEventData, SlickGrid } from "slickgrid";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
IExternalVariables,
|
|
5
|
+
IHotKeysBehavior,
|
|
6
|
+
ISlickTable,
|
|
7
|
+
} from "shared/model/types";
|
|
8
|
+
|
|
9
|
+
export class HotKeysDecorator implements IHotKeysBehavior {
|
|
10
|
+
protected hotKeysBehaviour: IHotKeysBehavior;
|
|
11
|
+
constructor(hotKeysBehaviour: IHotKeysBehavior) {
|
|
12
|
+
this.hotKeysBehaviour = hotKeysBehaviour;
|
|
13
|
+
}
|
|
14
|
+
public handleKeyboardEvent(
|
|
15
|
+
event: SlickEventData<OnKeyDownEventArgs>,
|
|
16
|
+
table: ISlickTable,
|
|
17
|
+
): void {
|
|
18
|
+
this.hotKeysBehaviour.handleKeyboardEvent(event, table);
|
|
19
|
+
}
|
|
20
|
+
public pushToCommandQueue(grid: SlickGrid | null): void {
|
|
21
|
+
this.hotKeysBehaviour.pushToCommandQueue(grid);
|
|
22
|
+
}
|
|
23
|
+
public resetQueue(): void {
|
|
24
|
+
this.hotKeysBehaviour.resetQueue();
|
|
25
|
+
}
|
|
26
|
+
public setExternalVariables(variables: IExternalVariables): void {
|
|
27
|
+
this.hotKeysBehaviour.setExternalVariables(variables);
|
|
28
|
+
}
|
|
29
|
+
public getExternalVariables(): IExternalVariables {
|
|
30
|
+
return this.hotKeysBehaviour.getExternalVariables();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OnKeyDownEventArgs, SlickEventData } from "slickgrid";
|
|
2
|
+
|
|
3
|
+
import { ISlickTable } from "shared/model/types";
|
|
4
|
+
|
|
5
|
+
import { hotKeysCopy } from "../../../../lib";
|
|
6
|
+
import { HotKeysDecorator } from "./HotKeysDecorator";
|
|
7
|
+
|
|
8
|
+
export class PreventCopying extends HotKeysDecorator {
|
|
9
|
+
public handleKeyboardEvent(
|
|
10
|
+
event: SlickEventData<OnKeyDownEventArgs>,
|
|
11
|
+
table: ISlickTable,
|
|
12
|
+
): void {
|
|
13
|
+
if (!table.isActive) return;
|
|
14
|
+
if (!hotKeysCopy(event)) {
|
|
15
|
+
super.handleKeyboardEvent.call(this, event, table);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OnKeyDownEventArgs, SlickEventData } from "slickgrid";
|
|
2
|
+
|
|
3
|
+
import { ISlickTable } from "shared/model/types";
|
|
4
|
+
|
|
5
|
+
import { hotKeysRedo, hotKeysUndo } from "../../../../lib";
|
|
6
|
+
import { HotKeysDecorator } from "./HotKeysDecorator";
|
|
7
|
+
|
|
8
|
+
export class RedoUndoOnly extends HotKeysDecorator {
|
|
9
|
+
public handleKeyboardEvent(
|
|
10
|
+
event: SlickEventData<OnKeyDownEventArgs>,
|
|
11
|
+
table: ISlickTable,
|
|
12
|
+
): void {
|
|
13
|
+
if (!table.isActive) return;
|
|
14
|
+
if (hotKeysRedo(event) || hotKeysUndo(event)) {
|
|
15
|
+
super.handleKeyboardEvent.call(this, event, table);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
package/src/shared/lib/slickgrid/model/SlickTable/hotKeys/decorators/WithConfirmationOfDeletion.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { OnKeyDownEventArgs, SlickEventData } from "slickgrid";
|
|
2
|
+
|
|
3
|
+
import { NO_PRIVILEGES_MESSAGE } from "shared/model/consts";
|
|
4
|
+
import { ISlickTable } from "shared/model/types";
|
|
5
|
+
import { showNotification } from "shared/ui/notification";
|
|
6
|
+
|
|
7
|
+
import { hotKeysDelete, isDeletionDangerous } from "../../../../lib";
|
|
8
|
+
import { HotKeysDecorator } from "./HotKeysDecorator";
|
|
9
|
+
|
|
10
|
+
export class WithConfirmationOfDeletion extends HotKeysDecorator {
|
|
11
|
+
public handleKeyboardEvent(
|
|
12
|
+
event: SlickEventData<OnKeyDownEventArgs>,
|
|
13
|
+
table: ISlickTable,
|
|
14
|
+
): void {
|
|
15
|
+
if (!table.isActive) return;
|
|
16
|
+
if (hotKeysDelete(event)) {
|
|
17
|
+
event.preventDefault();
|
|
18
|
+
event.stopImmediatePropagation();
|
|
19
|
+
// if (clientIsLocked()) return;
|
|
20
|
+
if (isDeletionDangerous(table)) {
|
|
21
|
+
if (this.getExternalVariables().isAllowed === false) {
|
|
22
|
+
showNotification(NO_PRIVILEGES_MESSAGE, "info");
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
this.getExternalVariables().setIsDialogOpened(true);
|
|
26
|
+
} else {
|
|
27
|
+
super.handleKeyboardEvent.call(this, event, table);
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
super.handleKeyboardEvent.call(this, event, table);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { DownloadManager } from "./csvDownloadManager";
|
|
2
|
+
export {
|
|
3
|
+
DefaultHotKeys,
|
|
4
|
+
HotKeysDecorator,
|
|
5
|
+
PreventCopying,
|
|
6
|
+
RedoUndoOnly,
|
|
7
|
+
WithConfirmationOfDeletion,
|
|
8
|
+
WithoutHotKeys,
|
|
9
|
+
} from "./hotKeys";
|
|
10
|
+
export {
|
|
11
|
+
DecoratorEndingDate,
|
|
12
|
+
DecoratorFilter,
|
|
13
|
+
DecoratorColumnFilter,
|
|
14
|
+
DecoratorPeriod,
|
|
15
|
+
DeletedRowsFilter,
|
|
16
|
+
Filter,
|
|
17
|
+
} from "./filters";
|
|
18
|
+
export { DefaultPrinter } from "./printer";
|
|
19
|
+
export { SlickTable } from "./table";
|