slick-table 1.0.18 → 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/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,28 @@
|
|
|
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 ButtonGroup: FC<IProps> = ({ setIsOpened }) => {
|
|
8
|
+
const table = eventContextMenu.table;
|
|
9
|
+
|
|
10
|
+
function group() {
|
|
11
|
+
if (!table) return;
|
|
12
|
+
table.grouping = { isGrouped: true };
|
|
13
|
+
setIsOpened(false);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (table?.grouping.isGrouped !== false) return null;
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Styled.Li onClick={group}>
|
|
20
|
+
<Styled.Icon className={"sgi sgi-link"}></Styled.Icon>
|
|
21
|
+
Group
|
|
22
|
+
</Styled.Li>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
interface IProps {
|
|
27
|
+
setIsOpened: Dispatch<SetStateAction<boolean>>;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ButtonGroup } from "./ButtonGroup";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ButtonResetFilters } from "./ui";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { hasFiltersApplied } from "./visibility";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { hasFiltersApplied } from "./hasFiltersApplied";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Divider } from "@mui/material";
|
|
2
|
+
import { Dispatch, FC, Fragment, SetStateAction } from "react";
|
|
3
|
+
|
|
4
|
+
import { eventContextMenu, headerButtons } from "shared/lib/slickgrid";
|
|
5
|
+
|
|
6
|
+
import { hasFiltersApplied } from "../lib";
|
|
7
|
+
|
|
8
|
+
import Styled from "../../ContextMenu.style";
|
|
9
|
+
|
|
10
|
+
export const ButtonResetFilters: FC<IProps> = ({ setIsOpened }) => {
|
|
11
|
+
const table = eventContextMenu.table;
|
|
12
|
+
function onClick() {
|
|
13
|
+
if (!table) {
|
|
14
|
+
setIsOpened(false);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const args = table.filter.args;
|
|
18
|
+
delete args.columnFilters;
|
|
19
|
+
table.filter.args = args;
|
|
20
|
+
headerButtons.highlightAllColumns(args, table.id);
|
|
21
|
+
setIsOpened(false);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (!hasFiltersApplied(table)) return null;
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<Fragment>
|
|
28
|
+
<Divider />
|
|
29
|
+
<Styled.Li onClick={onClick}>
|
|
30
|
+
<Styled.Icon className={"sgi sgi-notification-clear-all"}></Styled.Icon>
|
|
31
|
+
Reset column filters
|
|
32
|
+
</Styled.Li>
|
|
33
|
+
</Fragment>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
interface IProps {
|
|
38
|
+
setIsOpened: Dispatch<SetStateAction<boolean>>;
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ButtonResetFilters } from "./ButtonResetFilters";
|
|
@@ -0,0 +1,28 @@
|
|
|
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 ButtonUngroup: FC<IProps> = ({ setIsOpened }) => {
|
|
8
|
+
const table = eventContextMenu.table;
|
|
9
|
+
|
|
10
|
+
function group() {
|
|
11
|
+
if (!table) return;
|
|
12
|
+
table.grouping = { isGrouped: false };
|
|
13
|
+
setIsOpened(false);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (!table?.grouping.isGrouped) return null;
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Styled.Li onClick={group}>
|
|
20
|
+
<Styled.Icon className={"sgi sgi-link-off"}></Styled.Icon>
|
|
21
|
+
Ungroup
|
|
22
|
+
</Styled.Li>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
interface IProps {
|
|
27
|
+
setIsOpened: Dispatch<SetStateAction<boolean>>;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ButtonUngroup } from "./ButtonUngroup";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { Dispatch, SetStateAction } from "react";
|
|
2
|
+
import { SlickDataView } from "slickgrid";
|
|
3
|
+
|
|
4
|
+
import { eventContextMenu } from "shared/lib/slickgrid";
|
|
5
|
+
|
|
6
|
+
import Styled from "../ContextMenu.style";
|
|
7
|
+
|
|
8
|
+
export const CollapseAll: React.FC<Props> = ({ setIsOpened }) => {
|
|
9
|
+
const table = eventContextMenu.table;
|
|
10
|
+
|
|
11
|
+
function onClick() {
|
|
12
|
+
const grid = table?.grid;
|
|
13
|
+
if (!grid) return;
|
|
14
|
+
const dataView: SlickDataView = grid.getData();
|
|
15
|
+
dataView.collapseAllGroups();
|
|
16
|
+
setIsOpened(false);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (!table?.grouping.isGrouped) return null;
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Styled.Li onClick={onClick}>
|
|
23
|
+
<Styled.Icon className={"sgi sgi-collapse-all-outline"}></Styled.Icon>
|
|
24
|
+
Collapse all groups
|
|
25
|
+
</Styled.Li>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
interface Props {
|
|
30
|
+
setIsOpened: Dispatch<SetStateAction<boolean>>;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CollapseAll } from "./CollapseAll";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { styled } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
const UlStyled = styled("ul")({
|
|
4
|
+
display: "flex",
|
|
5
|
+
flexDirection: "column",
|
|
6
|
+
rowGap: "0.5em",
|
|
7
|
+
margin: "0",
|
|
8
|
+
paddingLeft: "0.5em",
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const LiStyled = styled("li")({
|
|
12
|
+
display: "flex",
|
|
13
|
+
alignItems: "center",
|
|
14
|
+
columnGap: "0.5em",
|
|
15
|
+
cursor: "pointer",
|
|
16
|
+
"&:hover": {
|
|
17
|
+
scale: "1.05",
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const Icon = styled("span")({
|
|
22
|
+
backgroundColor: "#1E456F",
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
Ul: UlStyled,
|
|
27
|
+
Li: LiStyled,
|
|
28
|
+
Icon,
|
|
29
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { FC, Fragment, useState } from "react";
|
|
2
|
+
|
|
3
|
+
import { Overlay, Popup } from "entities/popup";
|
|
4
|
+
|
|
5
|
+
import { useSubscribeToEvent } from "../lib";
|
|
6
|
+
import { CONTEXT_MENU } from "../model";
|
|
7
|
+
import { ButtonDownloadCSV } from "./ButtonDownloadCSV";
|
|
8
|
+
import { ButtonGroup } from "./ButtonGroup";
|
|
9
|
+
import { ButtonResetFilters } from "./ButtonResetFilters";
|
|
10
|
+
import { ButtonUngroup } from "./ButtonUngroup";
|
|
11
|
+
import { CollapseAll } from "./CollapseAll";
|
|
12
|
+
import { CopyToClipboard } from "./CopyToClipboard";
|
|
13
|
+
import { ExpandAll } from "./ExpandAll";
|
|
14
|
+
import { Print } from "./Print";
|
|
15
|
+
|
|
16
|
+
import Styled from "./ContextMenu.style";
|
|
17
|
+
|
|
18
|
+
export const ContextMenu: FC<Props> = ({ clientId, clientName }) => {
|
|
19
|
+
const [isOpened, setIsOpened] = useState(false);
|
|
20
|
+
|
|
21
|
+
useSubscribeToEvent(setIsOpened);
|
|
22
|
+
|
|
23
|
+
if (!isOpened) return null;
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Fragment>
|
|
27
|
+
<Overlay setIsOpened={setIsOpened} />
|
|
28
|
+
<Popup id={CONTEXT_MENU}>
|
|
29
|
+
<Styled.Ul>
|
|
30
|
+
<Print
|
|
31
|
+
clientId={clientId}
|
|
32
|
+
clientName={clientName}
|
|
33
|
+
setIsOpened={setIsOpened}
|
|
34
|
+
/>
|
|
35
|
+
<CopyToClipboard setIsOpened={setIsOpened} />
|
|
36
|
+
<ButtonDownloadCSV
|
|
37
|
+
clientId={clientId}
|
|
38
|
+
clientName={clientName}
|
|
39
|
+
setIsOpened={setIsOpened}
|
|
40
|
+
/>
|
|
41
|
+
<ButtonResetFilters setIsOpened={setIsOpened} />
|
|
42
|
+
<ButtonUngroup setIsOpened={setIsOpened} />
|
|
43
|
+
<ButtonGroup setIsOpened={setIsOpened} />
|
|
44
|
+
<ExpandAll setIsOpened={setIsOpened} />
|
|
45
|
+
<CollapseAll setIsOpened={setIsOpened} />
|
|
46
|
+
</Styled.Ul>
|
|
47
|
+
</Popup>
|
|
48
|
+
</Fragment>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
interface Props {
|
|
53
|
+
clientId: number;
|
|
54
|
+
clientName: string;
|
|
55
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Dispatch, FC, SetStateAction } from "react";
|
|
2
|
+
|
|
3
|
+
import { eventContextMenu } from "shared/lib/slickgrid";
|
|
4
|
+
import { showNotification } from "shared/ui/notification";
|
|
5
|
+
|
|
6
|
+
import Styled from "../ContextMenu.style";
|
|
7
|
+
|
|
8
|
+
export const CopyToClipboard: FC<IProps> = ({ setIsOpened }) => {
|
|
9
|
+
function onClick() {
|
|
10
|
+
const table = eventContextMenu.table;
|
|
11
|
+
const grid = table?.grid;
|
|
12
|
+
if (!grid || !table) {
|
|
13
|
+
setIsOpened(false);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
window.navigator.clipboard
|
|
18
|
+
.writeText(table.downloadManager.createCSV(table))
|
|
19
|
+
.then((): void => {
|
|
20
|
+
showNotification("Copied to clipboard", "info");
|
|
21
|
+
})
|
|
22
|
+
.catch((): void => {
|
|
23
|
+
showNotification("Failed to copy to clipboard", "warning");
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
if (grid.getSelectionModel()) {
|
|
27
|
+
grid.setSelectedRows([]);
|
|
28
|
+
}
|
|
29
|
+
setIsOpened(false);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Styled.Li onClick={onClick}>
|
|
34
|
+
<Styled.Icon className={"sgi sgi-content-copy"}></Styled.Icon>Copy to
|
|
35
|
+
clipboard
|
|
36
|
+
</Styled.Li>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
interface IProps {
|
|
41
|
+
setIsOpened: Dispatch<SetStateAction<boolean>>;
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CopyToClipboard } from "./CopyToClipboard";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React, { Dispatch, SetStateAction } from "react";
|
|
2
|
+
import { SlickDataView } from "slickgrid";
|
|
3
|
+
|
|
4
|
+
import { eventContextMenu } from "shared/lib/slickgrid";
|
|
5
|
+
|
|
6
|
+
import Styled from "../ContextMenu.style";
|
|
7
|
+
|
|
8
|
+
export const ExpandAll: React.FC<Props> = ({ setIsOpened }) => {
|
|
9
|
+
const table = eventContextMenu.table;
|
|
10
|
+
function onClick() {
|
|
11
|
+
const grid = table?.grid;
|
|
12
|
+
if (!grid) return;
|
|
13
|
+
const dataView: SlickDataView = grid.getData();
|
|
14
|
+
dataView.expandAllGroups();
|
|
15
|
+
setIsOpened(false);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (!table?.grouping.isGrouped) return null;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Styled.Li onClick={onClick}>
|
|
22
|
+
<Styled.Icon className={"sgi sgi-expand-all-outline"}></Styled.Icon>Expand
|
|
23
|
+
all groups
|
|
24
|
+
</Styled.Li>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
interface Props {
|
|
29
|
+
setIsOpened: Dispatch<SetStateAction<boolean>>;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ExpandAll } from "./ExpandAll";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Print } from "./ui";
|
|
@@ -0,0 +1,25 @@
|
|
|
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 Print: FC<IProps> = ({ clientId, clientName, setIsOpened }) => {
|
|
8
|
+
function onClick(): void {
|
|
9
|
+
const table = eventContextMenu.table;
|
|
10
|
+
table?.printer.print(table, clientId, clientName);
|
|
11
|
+
setIsOpened(false);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<Styled.Li onClick={onClick}>
|
|
16
|
+
<Styled.Icon className={"sgi sgi-printer"}></Styled.Icon>Print
|
|
17
|
+
</Styled.Li>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
interface IProps {
|
|
22
|
+
clientId: number;
|
|
23
|
+
clientName: string;
|
|
24
|
+
setIsOpened: Dispatch<SetStateAction<boolean>>;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Print } from "./Print";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ContextMenu } from "./ContextMenu";
|
package/src/index.scss
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export { Skeleton } from "entities/skeleton";
|
|
2
|
+
export { ColumnFilters } from "features/column-filters";
|
|
3
|
+
export { ContextMenu } from "features/context-menu";
|
|
4
|
+
export {
|
|
5
|
+
Autocomplete,
|
|
6
|
+
ColumnSorter,
|
|
7
|
+
DecoratorColumnFilter,
|
|
8
|
+
DecoratorFilter,
|
|
9
|
+
DefaultHotKeys,
|
|
10
|
+
DefaultPrinter,
|
|
11
|
+
DeletedRowsFilter,
|
|
12
|
+
Filter,
|
|
13
|
+
HotKeysDecorator,
|
|
14
|
+
PreventCopying,
|
|
15
|
+
RedoUndoOnly,
|
|
16
|
+
SlickTable,
|
|
17
|
+
SlickgridTable,
|
|
18
|
+
TotalCalculator,
|
|
19
|
+
columnIsEdited,
|
|
20
|
+
columnCheckboxSelector,
|
|
21
|
+
commitCurrentEdit,
|
|
22
|
+
copySelectedRows,
|
|
23
|
+
formatterGroupTotals,
|
|
24
|
+
getDisplayedRows,
|
|
25
|
+
getNextId,
|
|
26
|
+
handleHeaderButtons,
|
|
27
|
+
headerButtons,
|
|
28
|
+
openColumnFilter,
|
|
29
|
+
openContextMenu,
|
|
30
|
+
useListenIfTablesWereEdited,
|
|
31
|
+
} from "shared/lib/slickgrid";
|
|
32
|
+
export type {
|
|
33
|
+
IPrinter,
|
|
34
|
+
ISlickTable,
|
|
35
|
+
IColumn,
|
|
36
|
+
IFilter,
|
|
37
|
+
IFilterArguments,
|
|
38
|
+
IHotKeysBehavior,
|
|
39
|
+
} from "shared/model/types";
|
|
40
|
+
export { EColumnFiltersGroup, ESortType } from "shared/model/enums";
|
package/src/main.tsx
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StrictMode } from "react";
|
|
2
|
+
import { createRoot } from "react-dom/client";
|
|
3
|
+
import Sortable from "sortablejs";
|
|
4
|
+
|
|
5
|
+
import App from "./App";
|
|
6
|
+
import "./index.scss";
|
|
7
|
+
|
|
8
|
+
createRoot(document.getElementById("root")!).render(
|
|
9
|
+
<StrictMode>
|
|
10
|
+
<App />
|
|
11
|
+
</StrictMode>,
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
// SortableJS is a hard dependency for the "slickgrid" library
|
|
15
|
+
window.Sortable = Sortable;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export class AnEvent implements Observable {
|
|
2
|
+
private readonly observers: Observer[];
|
|
3
|
+
constructor() {
|
|
4
|
+
this.observers = [];
|
|
5
|
+
}
|
|
6
|
+
subscribe(observer: Observer) {
|
|
7
|
+
const index = this.observers.indexOf(observer);
|
|
8
|
+
if (!~index) {
|
|
9
|
+
this.observers.push(observer);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
unsubscribe(observer: Observer) {
|
|
13
|
+
const index = this.observers.indexOf(observer);
|
|
14
|
+
if (~this.observers.indexOf(observer)) {
|
|
15
|
+
this.observers.splice(index, 1);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
notify() {
|
|
19
|
+
for (const observer of this.observers) {
|
|
20
|
+
observer();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface Observable {
|
|
26
|
+
subscribe(observer: () => void): void;
|
|
27
|
+
unsubscribe(observer: () => void): void;
|
|
28
|
+
notify(): void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type Observer = () => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { dateToString } from "./dateToString";
|
|
2
|
+
|
|
3
|
+
test("Return expected values", () => {
|
|
4
|
+
expect(dateToString("12/25/95")).toBe("12/25/95");
|
|
5
|
+
expect(dateToString("1/1/95")).toBe("01/01/95");
|
|
6
|
+
expect(dateToString("1/1/21")).toBe("01/01/21");
|
|
7
|
+
expect(dateToString("2022-05-25")).toBe("05/25/22");
|
|
8
|
+
expect(dateToString("2022-5-5")).toBe("05/05/22");
|
|
9
|
+
expect(dateToString("2022-11-15T00:00:00.000Z")).toBe("11/15/22");
|
|
10
|
+
expect(dateToString("2022-11-15T00:00:00.000Z")).toBe("11/15/22");
|
|
11
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import moment from "moment";
|
|
2
|
+
|
|
3
|
+
import { dateFormats } from "shared/model/consts";
|
|
4
|
+
import { EDateFormat } from "shared/model/enums";
|
|
5
|
+
|
|
6
|
+
export const dateToString = (date: Date | string | null): string => {
|
|
7
|
+
return date ? moment(date, dateFormats).format(EDateFormat.ui) : "";
|
|
8
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// todo define types
|
|
2
|
+
export function debounce<T>(callBackFn: T, delay = 300): T {
|
|
3
|
+
let timeout: NodeJS.Timeout;
|
|
4
|
+
//@ts-ignore
|
|
5
|
+
return function (...args: any[]) {
|
|
6
|
+
//@ts-ignore
|
|
7
|
+
const fnCall = () => callBackFn.apply(this, args);
|
|
8
|
+
clearTimeout(timeout);
|
|
9
|
+
timeout = setTimeout(fnCall, delay);
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { elementNotVisible } from "./elementNotVisible";
|
|
2
|
+
|
|
3
|
+
describe("elementNotVisible", () => {
|
|
4
|
+
let getBoundingClientRect: jest.Mock;
|
|
5
|
+
let originalScrollHeight: number;
|
|
6
|
+
let originalScrollWidth: number;
|
|
7
|
+
|
|
8
|
+
beforeAll(() => {
|
|
9
|
+
originalScrollHeight = document.documentElement.scrollHeight;
|
|
10
|
+
originalScrollWidth = document.documentElement.scrollWidth;
|
|
11
|
+
Object.defineProperty(document.documentElement, "scrollHeight", {
|
|
12
|
+
value: 1000,
|
|
13
|
+
writable: true,
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(document.documentElement, "scrollWidth", {
|
|
16
|
+
value: 1000,
|
|
17
|
+
writable: true,
|
|
18
|
+
});
|
|
19
|
+
getBoundingClientRect = jest.fn();
|
|
20
|
+
document.querySelector = jest.fn();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
afterAll(() => {
|
|
24
|
+
Object.defineProperty(document.documentElement, "scrollHeight", {
|
|
25
|
+
value: originalScrollHeight,
|
|
26
|
+
writable: true,
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(document.documentElement, "scrollWidth", {
|
|
29
|
+
value: originalScrollWidth,
|
|
30
|
+
writable: true,
|
|
31
|
+
});
|
|
32
|
+
jest.clearAllMocks();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("should return true if the container is not found", () => {
|
|
36
|
+
(document.querySelector as jest.Mock).mockReturnValue(null);
|
|
37
|
+
expect(elementNotVisible(".nonexistent")).toBe(true);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("should return true if the container is out of view", () => {
|
|
41
|
+
(document.querySelector as jest.Mock).mockReturnValue({
|
|
42
|
+
getBoundingClientRect,
|
|
43
|
+
});
|
|
44
|
+
getBoundingClientRect.mockReturnValue({
|
|
45
|
+
bottom: -1,
|
|
46
|
+
left: 0,
|
|
47
|
+
right: 0,
|
|
48
|
+
top: 0,
|
|
49
|
+
});
|
|
50
|
+
expect(elementNotVisible(".out-of-view")).toBe(true);
|
|
51
|
+
getBoundingClientRect.mockReturnValue({
|
|
52
|
+
bottom: 0,
|
|
53
|
+
left: 1001,
|
|
54
|
+
right: 1002,
|
|
55
|
+
top: 0,
|
|
56
|
+
});
|
|
57
|
+
expect(elementNotVisible(".out-of-view")).toBe(true);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("should return false if the container is within view", () => {
|
|
61
|
+
(document.querySelector as jest.Mock).mockReturnValue({
|
|
62
|
+
getBoundingClientRect,
|
|
63
|
+
});
|
|
64
|
+
getBoundingClientRect.mockReturnValue({
|
|
65
|
+
bottom: 500,
|
|
66
|
+
left: 100,
|
|
67
|
+
right: 200,
|
|
68
|
+
top: 100,
|
|
69
|
+
});
|
|
70
|
+
expect(elementNotVisible(".in-view")).toBe(false);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function elementNotVisible(selector: string): boolean {
|
|
2
|
+
const container = document.querySelector(selector);
|
|
3
|
+
if (!container) return true;
|
|
4
|
+
const { scrollHeight, scrollWidth } = document.documentElement;
|
|
5
|
+
const { bottom, left, right, top } = container.getBoundingClientRect();
|
|
6
|
+
return (
|
|
7
|
+
bottom <= 0 || left >= scrollWidth || right <= 0 || top >= scrollHeight
|
|
8
|
+
);
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { elementNotVisible } from "./elementNotVisible";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface IOptions {
|
|
2
|
+
decimalPlaces?: number;
|
|
3
|
+
decimalSeparator?: string;
|
|
4
|
+
thousandsSeparator?: string;
|
|
5
|
+
negativeInParentheses?: boolean;
|
|
6
|
+
zeroAsBlank?: boolean;
|
|
7
|
+
currencySymbol?: string;
|
|
8
|
+
positiveClass?: string;
|
|
9
|
+
negativeClass?: string;
|
|
10
|
+
noHTML?: boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { addParentheses } from "./addParentheses";
|
|
2
|
+
|
|
3
|
+
describe("addParentheses", () => {
|
|
4
|
+
test("must add parentheses", () => {
|
|
5
|
+
expect(addParentheses("-5")).toBe("(5)");
|
|
6
|
+
expect(addParentheses("-5.125")).toBe("(5.125)");
|
|
7
|
+
expect(addParentheses("5")).toBe("(5)");
|
|
8
|
+
});
|
|
9
|
+
});
|