@talxis/base-controls 1.2406.2
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/.env +1 -0
- package/.eslintrc +117 -0
- package/.npmgitignore +9 -0
- package/.vscode/settings.json +3 -0
- package/.yalcignore +2 -0
- package/README.md +18 -0
- package/azure-pipelines.yml +44 -0
- package/dist/Lookup-eb1505b3.js +1 -0
- package/dist/NumeralPCF-a609b7be.js +1 -0
- package/dist/components/DateTime/DateTime.d.ts +3 -0
- package/dist/components/DateTime/DateTime.js +1 -0
- package/dist/components/DateTime/components/Calendar.d.ts +12 -0
- package/dist/components/DateTime/hooks/useDateTime.d.ts +6 -0
- package/dist/components/DateTime/index.d.ts +2 -0
- package/dist/components/DateTime/interfaces.d.ts +31 -0
- package/dist/components/DateTime/styles.d.ts +34 -0
- package/dist/components/DateTime/translations.d.ts +3 -0
- package/dist/components/Decimal/Decimal.d.ts +3 -0
- package/dist/components/Decimal/Decimal.js +1 -0
- package/dist/components/Decimal/index.d.ts +2 -0
- package/dist/components/Decimal/interfaces.d.ts +13 -0
- package/dist/components/Duration/Duration.d.ts +3 -0
- package/dist/components/Duration/Duration.js +1 -0
- package/dist/components/Duration/index.d.ts +2 -0
- package/dist/components/Duration/interfaces.d.ts +31 -0
- package/dist/components/Duration/translations.d.ts +2 -0
- package/dist/components/Grid/Grid.d.ts +5 -0
- package/dist/components/Grid/Grid.js +10 -0
- package/dist/components/Grid/core/components/AgGrid/AgGrid.d.ts +2 -0
- package/dist/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/EmptyRecords.d.ts +2 -0
- package/dist/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/styles.d.ts +18 -0
- package/dist/components/Grid/core/components/AgGrid/components/LoadingOverlay/LoadingOverlay.d.ts +2 -0
- package/dist/components/Grid/core/components/AgGrid/controllers/useAgGridController.d.ts +12 -0
- package/dist/components/Grid/core/components/AgGrid/model/AgGrid.d.ts +13 -0
- package/dist/components/Grid/core/components/AgGrid/styles.d.ts +69 -0
- package/dist/components/Grid/core/components/Cell/Commands/Commands.d.ts +7 -0
- package/dist/components/Grid/core/components/Cell/Commands/Icon.d.ts +7 -0
- package/dist/components/Grid/core/components/Cell/Commands/styles.d.ts +19 -0
- package/dist/components/Grid/core/components/Cell/Commands/useCommands.d.ts +5 -0
- package/dist/components/Grid/core/components/Cell/EditableCell/EditableCell.d.ts +10 -0
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyCell.d.ts +11 -0
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyOptionSet/ReadOnlyOptionSet.d.ts +10 -0
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyOptionSet/styles.d.ts +22 -0
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/styles.d.ts +47 -0
- package/dist/components/Grid/core/components/ColumnHeader/ColumnHeader.d.ts +6 -0
- package/dist/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/GlobalCheckbox.d.ts +2 -0
- package/dist/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/styles.d.ts +13 -0
- package/dist/components/Grid/core/components/ColumnHeader/styles.d.ts +37 -0
- package/dist/components/Grid/core/components/Component/Component.d.ts +11 -0
- package/dist/components/Grid/core/components/Component/controller/useComponentController.d.ts +9 -0
- package/dist/components/Grid/core/components/Component/model/Component.d.ts +10 -0
- package/dist/components/Grid/core/components/Dialog/Constants.d.ts +2 -0
- package/dist/components/Grid/core/components/Dialog/Styles.d.ts +2 -0
- package/dist/components/Grid/core/components/Dialog/index.d.ts +4 -0
- package/dist/components/Grid/core/components/Save/Save.d.ts +2 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/ChangeEditor.d.ts +3 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/RecordGrids.d.ts +7 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/styles.d.ts +48 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/styles.d.ts +31 -0
- package/dist/components/Grid/core/components/Save/hooks/useSave.d.ts +12 -0
- package/dist/components/Grid/core/components/Save/styles.d.ts +37 -0
- package/dist/components/Grid/core/controllers/useGridController.d.ts +9 -0
- package/dist/components/Grid/core/enums/ConditionOperator.d.ts +46 -0
- package/dist/components/Grid/core/enums/DataType.d.ts +24 -0
- package/dist/components/Grid/core/hooks/useGridInstance.d.ts +2 -0
- package/dist/components/Grid/core/hooks/useRefreshCallback.d.ts +2 -0
- package/dist/components/Grid/core/hooks/useRerender.d.ts +1 -0
- package/dist/components/Grid/core/interfaces/IGridColumn.d.ts +18 -0
- package/dist/components/Grid/core/interfaces/IGridContext.d.ts +4 -0
- package/dist/components/Grid/core/model/Grid.d.ts +51 -0
- package/dist/components/Grid/core/model/GridDependency.d.ts +13 -0
- package/dist/components/Grid/core/model/Metadata.d.ts +7 -0
- package/dist/components/Grid/core/services/RecordUpdateService/controllers/useRecordUpdateServiceController.d.ts +14 -0
- package/dist/components/Grid/core/services/RecordUpdateService/model/RecordUpdateService.d.ts +30 -0
- package/dist/components/Grid/filtering/components/FilterCallout/FilterCallout.d.ts +8 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionOperator/ConditionOperator.d.ts +7 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/ConditionValue.d.ts +7 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/model/ConditionComponentValue.d.ts +30 -0
- package/dist/components/Grid/filtering/components/FilterCallout/styles.d.ts +35 -0
- package/dist/components/Grid/filtering/constants.d.ts +5 -0
- package/dist/components/Grid/filtering/controller/useColumnFilterConditionController.d.ts +19 -0
- package/dist/components/Grid/filtering/model/Condition.d.ts +47 -0
- package/dist/components/Grid/filtering/model/Filtering.d.ts +11 -0
- package/dist/components/Grid/filtering/utils/FilteringUtilts.d.ts +34 -0
- package/dist/components/Grid/interfaces.d.ts +254 -0
- package/dist/components/Grid/paging/components/Paging/Paging.d.ts +2 -0
- package/dist/components/Grid/paging/components/Paging/styles.d.ts +35 -0
- package/dist/components/Grid/paging/controllers/usePagingController.d.ts +16 -0
- package/dist/components/Grid/paging/model/Paging.d.ts +15 -0
- package/dist/components/Grid/selection/controllers/useSelectionController.d.ts +11 -0
- package/dist/components/Grid/selection/model/Selection.d.ts +13 -0
- package/dist/components/Grid/sorting/Sorting.d.ts +9 -0
- package/dist/components/Grid/sorting/components/SortingContextualMenu/SortingContextualMenu.d.ts +8 -0
- package/dist/components/Grid/sorting/components/SortingContextualMenu/styles.d.ts +9 -0
- package/dist/components/Grid/sorting/controllers/useColumnSortingController.d.ts +8 -0
- package/dist/components/Grid/translations.d.ts +2 -0
- package/dist/components/Grid/validation/controllers/useRecordValidationController.d.ts +8 -0
- package/dist/components/Grid/validation/model/ColumnValidation.d.ts +11 -0
- package/dist/components/Lookup/Lookup.d.ts +3 -0
- package/dist/components/Lookup/Lookup.js +1 -0
- package/dist/components/Lookup/components/RecordCreator.d.ts +10 -0
- package/dist/components/Lookup/components/TargetSelector.d.ts +10 -0
- package/dist/components/Lookup/hooks/useFetchXml.d.ts +3 -0
- package/dist/components/Lookup/hooks/useLoadedEntities.d.ts +6 -0
- package/dist/components/Lookup/hooks/useLookup.d.ts +8 -0
- package/dist/components/Lookup/index.d.ts +2 -0
- package/dist/components/Lookup/interfaces.d.ts +52 -0
- package/dist/components/Lookup/lib.d.ts +1164 -0
- package/dist/components/Lookup/styles.d.ts +90 -0
- package/dist/components/Lookup/translations.d.ts +2 -0
- package/dist/components/MultiSelectOptionSet/MultiSelectOptionSet.d.ts +3 -0
- package/dist/components/MultiSelectOptionSet/MultiSelectOptionSet.js +1 -0
- package/dist/components/MultiSelectOptionSet/index.d.ts +2 -0
- package/dist/components/MultiSelectOptionSet/interfaces.d.ts +11 -0
- package/dist/components/OptionSet/OptionSet.d.ts +3 -0
- package/dist/components/OptionSet/OptionSet.js +1 -0
- package/dist/components/OptionSet/index.d.ts +2 -0
- package/dist/components/OptionSet/interfaces.d.ts +13 -0
- package/dist/components/TextField/TextField.d.ts +3 -0
- package/dist/components/TextField/TextField.js +1 -0
- package/dist/components/TextField/hooks/useTextField.d.ts +2 -0
- package/dist/components/TextField/index.d.ts +2 -0
- package/dist/components/TextField/interfaces.d.ts +15 -0
- package/dist/components/TwoOptions/TwoOptions.d.ts +3 -0
- package/dist/components/TwoOptions/TwoOptions.js +1 -0
- package/dist/components/TwoOptions/index.d.ts +2 -0
- package/dist/components/TwoOptions/interfaces.d.ts +13 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useComponent.d.ts +7 -0
- package/dist/hooks/useComponent.js +1 -0
- package/dist/hooks/useFocusIn.d.ts +1 -0
- package/dist/hooks/useFocusIn.js +1 -0
- package/dist/hooks/useInputBasedComponent.d.ts +32 -0
- package/dist/hooks/useInputBasedComponent.js +1 -0
- package/dist/hooks/useMouseOver.d.ts +1 -0
- package/dist/hooks/useMouseOver.js +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/interfaces/context.d.ts +20 -0
- package/dist/interfaces/index.d.ts +9 -0
- package/dist/interfaces/parameters.d.ts +23 -0
- package/dist/interfaces/property.d.ts +100 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/utils/NumeralPCF.d.ts +6 -0
- package/examples/Currency/Currency/ControlManifest.Input.xml +53 -0
- package/examples/Currency/Currency/index.ts +66 -0
- package/examples/Currency/Currency.pcfproj +46 -0
- package/examples/Currency/package-lock.json +15900 -0
- package/examples/Currency/package.json +29 -0
- package/examples/Currency/pcfconfig.json +3 -0
- package/examples/Currency/tsconfig.json +7 -0
- package/examples/DateTime/DateTime/ControlManifest.Input.xml +58 -0
- package/examples/DateTime/DateTime/index.ts +69 -0
- package/examples/DateTime/DateTime.pcfproj +46 -0
- package/examples/DateTime/package-lock.json +15900 -0
- package/examples/DateTime/package.json +29 -0
- package/examples/DateTime/pcfconfig.json +3 -0
- package/examples/DateTime/tsconfig.json +7 -0
- package/examples/Decimal/Decimal/ControlManifest.Input.xml +66 -0
- package/examples/Decimal/Decimal/index.ts +66 -0
- package/examples/Decimal/Decimal.pcfproj +46 -0
- package/examples/Decimal/package-lock.json +15900 -0
- package/examples/Decimal/package.json +28 -0
- package/examples/Decimal/pcfconfig.json +3 -0
- package/examples/Decimal/tsconfig.json +7 -0
- package/examples/Duration/Duration/ControlManifest.Input.xml +53 -0
- package/examples/Duration/Duration/index.ts +66 -0
- package/examples/Duration/Duration.pcfproj +46 -0
- package/examples/Duration/package-lock.json +15900 -0
- package/examples/Duration/package.json +29 -0
- package/examples/Duration/pcfconfig.json +3 -0
- package/examples/Duration/tsconfig.json +7 -0
- package/examples/Grid/Grid/ControlManifest.Input.xml +28 -0
- package/examples/Grid/Grid/index.ts +100 -0
- package/examples/Grid/Grid.pcfproj +46 -0
- package/examples/Grid/package-lock.json +15901 -0
- package/examples/Grid/package.json +30 -0
- package/examples/Grid/pcfconfig.json +3 -0
- package/examples/Grid/tsconfig.json +7 -0
- package/examples/Lookup/Lookup/ControlManifest.Input.xml +51 -0
- package/examples/Lookup/Lookup/index.ts +90 -0
- package/examples/Lookup/Lookup.pcfproj +46 -0
- package/examples/Lookup/package-lock.json +15900 -0
- package/examples/Lookup/package.json +29 -0
- package/examples/Lookup/pcfconfig.json +3 -0
- package/examples/Lookup/tsconfig.json +8 -0
- package/examples/MultiSelectOptionSet/MultiSelectOptionSet/ControlManifest.Input.xml +53 -0
- package/examples/MultiSelectOptionSet/MultiSelectOptionSet/index.ts +86 -0
- package/examples/MultiSelectOptionSet/MultiSelectOptionSet.pcfproj +46 -0
- package/examples/MultiSelectOptionSet/package-lock.json +15900 -0
- package/examples/MultiSelectOptionSet/package.json +31 -0
- package/examples/MultiSelectOptionSet/pcfconfig.json +3 -0
- package/examples/MultiSelectOptionSet/tsconfig.json +7 -0
- package/examples/OptionSet/OptionSet/ControlManifest.Input.xml +53 -0
- package/examples/OptionSet/OptionSet/index.ts +70 -0
- package/examples/OptionSet/OptionSet.pcfproj +46 -0
- package/examples/OptionSet/package-lock.json +15900 -0
- package/examples/OptionSet/package.json +29 -0
- package/examples/OptionSet/pcfconfig.json +3 -0
- package/examples/OptionSet/tsconfig.json +7 -0
- package/examples/TwoOptions/TwoOptions/ControlManifest.Input.xml +53 -0
- package/examples/TwoOptions/TwoOptions/index.ts +69 -0
- package/examples/TwoOptions/TwoOptions.pcfproj +46 -0
- package/examples/TwoOptions/package-lock.json +15900 -0
- package/examples/TwoOptions/package.json +29 -0
- package/examples/TwoOptions/pcfconfig.json +3 -0
- package/examples/TwoOptions/tsconfig.json +7 -0
- package/package.json +94 -0
- package/public/index.html +43 -0
- package/public/manifest.json +25 -0
- package/rollup.config.js +44 -0
- package/src/components/DateTime/DateTime.tsx +97 -0
- package/src/components/DateTime/components/Calendar.tsx +80 -0
- package/src/components/DateTime/hooks/useDateTime.ts +144 -0
- package/src/components/DateTime/index.ts +2 -0
- package/src/components/DateTime/interfaces.ts +22 -0
- package/src/components/DateTime/styles.ts +37 -0
- package/src/components/DateTime/translations.ts +18 -0
- package/src/components/Decimal/Decimal.tsx +120 -0
- package/src/components/Decimal/index.ts +2 -0
- package/src/components/Decimal/interfaces.ts +20 -0
- package/src/components/Duration/Duration.tsx +143 -0
- package/src/components/Duration/index.ts +2 -0
- package/src/components/Duration/interfaces.ts +22 -0
- package/src/components/Duration/translations.ts +30 -0
- package/src/components/Grid/Grid.tsx +24 -0
- package/src/components/Grid/core/components/AgGrid/AgGrid.tsx +206 -0
- package/src/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/EmptyRecords.tsx +16 -0
- package/src/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/styles.ts +20 -0
- package/src/components/Grid/core/components/AgGrid/components/LoadingOverlay/LoadingOverlay.tsx +7 -0
- package/src/components/Grid/core/components/AgGrid/controllers/useAgGridController.ts +68 -0
- package/src/components/Grid/core/components/AgGrid/model/AgGrid.ts +100 -0
- package/src/components/Grid/core/components/AgGrid/styles.ts +72 -0
- package/src/components/Grid/core/components/Cell/Commands/Commands.tsx +32 -0
- package/src/components/Grid/core/components/Cell/Commands/Icon.tsx +17 -0
- package/src/components/Grid/core/components/Cell/Commands/styles.ts +21 -0
- package/src/components/Grid/core/components/Cell/Commands/useCommands.tsx +53 -0
- package/src/components/Grid/core/components/Cell/EditableCell/EditableCell.tsx +140 -0
- package/src/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyCell.tsx +176 -0
- package/src/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyOptionSet/ReadOnlyOptionSet.tsx +67 -0
- package/src/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyOptionSet/styles.ts +24 -0
- package/src/components/Grid/core/components/Cell/ReadOnlyCell/styles.ts +56 -0
- package/src/components/Grid/core/components/ColumnHeader/ColumnHeader.tsx +71 -0
- package/src/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/GlobalCheckbox.tsx +31 -0
- package/src/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/styles.ts +16 -0
- package/src/components/Grid/core/components/ColumnHeader/styles.ts +40 -0
- package/src/components/Grid/core/components/Component/Component.tsx +59 -0
- package/src/components/Grid/core/components/Component/controller/useComponentController.ts +39 -0
- package/src/components/Grid/core/components/Component/model/Component.ts +251 -0
- package/src/components/Grid/core/components/Dialog/Constants.tsx +8 -0
- package/src/components/Grid/core/components/Dialog/Styles.tsx +61 -0
- package/src/components/Grid/core/components/Dialog/index.tsx +22 -0
- package/src/components/Grid/core/components/Dialog/interfaces/index.d.ts +7 -0
- package/src/components/Grid/core/components/Save/Save.tsx +74 -0
- package/src/components/Grid/core/components/Save/components/ChangeEditor/ChangeEditor.tsx +63 -0
- package/src/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/RecordGrids.tsx +153 -0
- package/src/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/styles.ts +52 -0
- package/src/components/Grid/core/components/Save/components/ChangeEditor/styles.ts +34 -0
- package/src/components/Grid/core/components/Save/hooks/useSave.ts +59 -0
- package/src/components/Grid/core/components/Save/styles.ts +41 -0
- package/src/components/Grid/core/controllers/useGridController.ts +46 -0
- package/src/components/Grid/core/enums/ConditionOperator.ts +46 -0
- package/src/components/Grid/core/enums/DataType.ts +25 -0
- package/src/components/Grid/core/hooks/useGridInstance.ts +7 -0
- package/src/components/Grid/core/hooks/useRefreshCallback.ts +20 -0
- package/src/components/Grid/core/hooks/useRerender.ts +15 -0
- package/src/components/Grid/core/interfaces/IGridColumn.ts +19 -0
- package/src/components/Grid/core/interfaces/IGridContext.ts +7 -0
- package/src/components/Grid/core/model/Grid.ts +250 -0
- package/src/components/Grid/core/model/GridDependency.ts +34 -0
- package/src/components/Grid/core/model/Metadata.ts +20 -0
- package/src/components/Grid/core/services/RecordUpdateService/controllers/useRecordUpdateServiceController.ts +36 -0
- package/src/components/Grid/core/services/RecordUpdateService/model/RecordUpdateService.ts +222 -0
- package/src/components/Grid/filtering/components/FilterCallout/FilterCallout.tsx +83 -0
- package/src/components/Grid/filtering/components/FilterCallout/components/ConditionOperator/ConditionOperator.tsx +66 -0
- package/src/components/Grid/filtering/components/FilterCallout/components/ConditionValue/ConditionValue.tsx +48 -0
- package/src/components/Grid/filtering/components/FilterCallout/components/ConditionValue/model/ConditionComponentValue.ts +120 -0
- package/src/components/Grid/filtering/components/FilterCallout/styles.ts +37 -0
- package/src/components/Grid/filtering/constants.ts +48 -0
- package/src/components/Grid/filtering/controller/useColumnFilterConditionController.ts +63 -0
- package/src/components/Grid/filtering/model/Condition.ts +309 -0
- package/src/components/Grid/filtering/model/Filtering.ts +78 -0
- package/src/components/Grid/filtering/utils/FilteringUtilts.ts +190 -0
- package/src/components/Grid/interfaces.ts +109 -0
- package/src/components/Grid/paging/components/Paging/Paging.tsx +76 -0
- package/src/components/Grid/paging/components/Paging/styles.ts +38 -0
- package/src/components/Grid/paging/controllers/usePagingController.ts +34 -0
- package/src/components/Grid/paging/model/Paging.ts +49 -0
- package/src/components/Grid/selection/controllers/useSelectionController.ts +25 -0
- package/src/components/Grid/selection/model/Selection.ts +60 -0
- package/src/components/Grid/sorting/Sorting.ts +30 -0
- package/src/components/Grid/sorting/components/SortingContextualMenu/SortingContextualMenu.tsx +126 -0
- package/src/components/Grid/sorting/components/SortingContextualMenu/styles.ts +12 -0
- package/src/components/Grid/sorting/controllers/useColumnSortingController.ts +26 -0
- package/src/components/Grid/translations.ts +80 -0
- package/src/components/Grid/validation/controllers/useRecordValidationController.ts +31 -0
- package/src/components/Grid/validation/model/ColumnValidation.ts +81 -0
- package/src/components/Lookup/Lookup.tsx +199 -0
- package/src/components/Lookup/components/RecordCreator.tsx +53 -0
- package/src/components/Lookup/components/TargetSelector.tsx +43 -0
- package/src/components/Lookup/hooks/useFetchXml.ts +31 -0
- package/src/components/Lookup/hooks/useLoadedEntities.ts +23 -0
- package/src/components/Lookup/hooks/useLookup.ts +126 -0
- package/src/components/Lookup/index.ts +2 -0
- package/src/components/Lookup/interfaces.ts +45 -0
- package/src/components/Lookup/lib.ts +3110 -0
- package/src/components/Lookup/styles.ts +106 -0
- package/src/components/Lookup/translations.ts +28 -0
- package/src/components/MultiSelectOptionSet/MultiSelectOptionSet.tsx +83 -0
- package/src/components/MultiSelectOptionSet/index.ts +2 -0
- package/src/components/MultiSelectOptionSet/interfaces.ts +14 -0
- package/src/components/OptionSet/OptionSet.tsx +67 -0
- package/src/components/OptionSet/index.ts +2 -0
- package/src/components/OptionSet/interfaces.ts +17 -0
- package/src/components/TextField/TextField.tsx +58 -0
- package/src/components/TextField/hooks/useTextField.ts +42 -0
- package/src/components/TextField/index.ts +2 -0
- package/src/components/TextField/interfaces.ts +20 -0
- package/src/components/TwoOptions/TwoOptions.tsx +43 -0
- package/src/components/TwoOptions/index.ts +2 -0
- package/src/components/TwoOptions/interfaces.ts +17 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useComponent.ts +83 -0
- package/src/hooks/useFocusIn.ts +23 -0
- package/src/hooks/useInputBasedComponent.ts +71 -0
- package/src/hooks/useMouseOver.ts +23 -0
- package/src/index.tsx +12 -0
- package/src/interfaces/context.ts +21 -0
- package/src/interfaces/index.ts +12 -0
- package/src/interfaces/parameters.ts +26 -0
- package/src/interfaces/property.ts +111 -0
- package/src/sandbox/index.tsx +137 -0
- package/src/sandbox/mock/Context.ts +18 -0
- package/src/sandbox/mock/Formatting.ts +186 -0
- package/src/sandbox/mock/Mode.ts +25 -0
- package/src/sandbox/mock/UserSettings.ts +31 -0
- package/src/sandbox/mock/Utility.ts +14 -0
- package/src/sandbox/shared/durationList.tsx +24 -0
- package/src/sandbox/shared/multiSelectOptionList.tsx +5 -0
- package/src/sandbox/shared/optionList.tsx +5 -0
- package/src/stories/Introduction.stories.mdx +122 -0
- package/src/stories/assets/code-brackets.svg +1 -0
- package/src/stories/assets/colors.svg +1 -0
- package/src/stories/assets/comments.svg +1 -0
- package/src/stories/assets/direction.svg +1 -0
- package/src/stories/assets/flow.svg +1 -0
- package/src/stories/assets/plugin.svg +1 -0
- package/src/stories/assets/repo.svg +1 -0
- package/src/stories/assets/stackalt.svg +1 -0
- package/src/types/index.ts +3 -0
- package/src/utils/NumeralPCF.ts +62 -0
- package/tsconfig.json +28 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Callout, IconButton, PrimaryButton, Button, ICalloutProps } from '@fluentui/react';
|
|
3
|
+
import { Text } from '@fluentui/react/lib/Text';
|
|
4
|
+
import { filterCalloutStyles } from './styles';
|
|
5
|
+
import { IColumnFilterConditionController, useColumnFilterConditionController } from '../../controller/useColumnFilterConditionController';
|
|
6
|
+
import { IGridColumn } from '../../../core/interfaces/IGridColumn';
|
|
7
|
+
import { FilteringUtils } from '../../utils/FilteringUtilts';
|
|
8
|
+
import { ConditionOperator } from './components/ConditionOperator/ConditionOperator';
|
|
9
|
+
import { ConditionValue } from './components/ConditionValue/ConditionValue';
|
|
10
|
+
import { useGridInstance } from '../../../core/hooks/useGridInstance';
|
|
11
|
+
|
|
12
|
+
export interface IFilterCallout extends ICalloutProps {
|
|
13
|
+
column: IGridColumn;
|
|
14
|
+
onDismiss: () => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const FilterCallout = (props: IFilterCallout) => {
|
|
18
|
+
const {column, onDismiss} = {...props};
|
|
19
|
+
const condition = useColumnFilterConditionController(column);
|
|
20
|
+
const grid = useGridInstance();
|
|
21
|
+
const conditionRef = React.useRef<IColumnFilterConditionController | null>();
|
|
22
|
+
conditionRef.current = condition;
|
|
23
|
+
const conditionOperator = condition?.operator.get();
|
|
24
|
+
const conditionValue = condition?.value.get();
|
|
25
|
+
const conditionUtils = FilteringUtils.condition();
|
|
26
|
+
|
|
27
|
+
const isDeleteButtonDisabled = () => {
|
|
28
|
+
switch(conditionValue) {
|
|
29
|
+
case null:
|
|
30
|
+
case undefined:
|
|
31
|
+
case "": {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
React.useEffect(() => {
|
|
39
|
+
return () => {
|
|
40
|
+
conditionRef.current?.clear();
|
|
41
|
+
}
|
|
42
|
+
}, []);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Callout
|
|
46
|
+
{...props}
|
|
47
|
+
calloutWidth={230}
|
|
48
|
+
className={filterCalloutStyles.root}>
|
|
49
|
+
<div className={filterCalloutStyles.header}>
|
|
50
|
+
<Text className={filterCalloutStyles.title} variant="mediumPlus">{grid.labels['filtermenu-filterby']()}</Text>
|
|
51
|
+
<IconButton onClick={() => onDismiss()} iconProps={{
|
|
52
|
+
iconName: 'ChromeClose',
|
|
53
|
+
}} />
|
|
54
|
+
</div>
|
|
55
|
+
{condition &&
|
|
56
|
+
<>
|
|
57
|
+
<div className={filterCalloutStyles.controls}>
|
|
58
|
+
<ConditionOperator column={column} />
|
|
59
|
+
{conditionUtils.value(conditionOperator!).isEditable &&
|
|
60
|
+
<ConditionValue
|
|
61
|
+
column={column} />
|
|
62
|
+
}
|
|
63
|
+
</div>
|
|
64
|
+
<div className={filterCalloutStyles.footer}>
|
|
65
|
+
<PrimaryButton text={grid.labels['filtermenu-applybutton']()}
|
|
66
|
+
onClick={async () => {
|
|
67
|
+
if(await condition.save()) {
|
|
68
|
+
props.onDismiss();
|
|
69
|
+
}
|
|
70
|
+
}} />
|
|
71
|
+
{conditionUtils.value(conditionOperator!).isEditable &&
|
|
72
|
+
<Button text={grid.labels['filtermenu-clearbutton']()}
|
|
73
|
+
disabled={isDeleteButtonDisabled()}
|
|
74
|
+
onClick={() => {
|
|
75
|
+
condition.value.set(null);
|
|
76
|
+
}} />
|
|
77
|
+
}
|
|
78
|
+
</div>
|
|
79
|
+
</>
|
|
80
|
+
}
|
|
81
|
+
</Callout>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ComboBox } from '@talxis/react-components/dist/components/ComboBox';
|
|
2
|
+
import { DataType } from '../../../../../core/enums/DataType';
|
|
3
|
+
import { IComboBoxOption } from '@fluentui/react/lib/components/ComboBox/ComboBox.types';
|
|
4
|
+
import { FilteringUtils } from '../../../../utils/FilteringUtilts';
|
|
5
|
+
import { useGridInstance } from '../../../../../core/hooks/useGridInstance';
|
|
6
|
+
import { useColumnFilterConditionController } from '../../../../controller/useColumnFilterConditionController';
|
|
7
|
+
import { IGridColumn } from '../../../../../core/interfaces/IGridColumn';
|
|
8
|
+
import { DatasetConditionOperator } from '../../../../../core/enums/ConditionOperator';
|
|
9
|
+
import React from 'react';
|
|
10
|
+
|
|
11
|
+
interface IConditionOperator {
|
|
12
|
+
column: IGridColumn;
|
|
13
|
+
}
|
|
14
|
+
export const ConditionOperator = (props: IConditionOperator) => {
|
|
15
|
+
const { column } = { ...props };
|
|
16
|
+
const operatorUtils = FilteringUtils.condition().operator();
|
|
17
|
+
const grid = useGridInstance();
|
|
18
|
+
const condition = useColumnFilterConditionController(column);
|
|
19
|
+
|
|
20
|
+
//TODO: add missing text operator (begins with, ends with)
|
|
21
|
+
const getOptions = (): IComboBoxOption[] => {
|
|
22
|
+
let operators = operatorUtils.textFieldOperators;
|
|
23
|
+
switch (column.dataType) {
|
|
24
|
+
case DataType.WHOLE_NONE:
|
|
25
|
+
case DataType.DECIMAL:
|
|
26
|
+
case DataType.FP:
|
|
27
|
+
case DataType.CURRENCY:
|
|
28
|
+
operators = operatorUtils.numberOperators;
|
|
29
|
+
break;
|
|
30
|
+
case DataType.DATE_AND_TIME_DATE_AND_TIME:
|
|
31
|
+
case DataType.DATE_AND_TIME_DATE_ONLY:
|
|
32
|
+
operators = operatorUtils.dateOperators;
|
|
33
|
+
break;
|
|
34
|
+
case DataType.MULTI_SELECT_OPTIONSET:
|
|
35
|
+
operators = operatorUtils.multipleOptionSetOperators;
|
|
36
|
+
break;
|
|
37
|
+
case DataType.FILE:
|
|
38
|
+
case DataType.IMAGE: {
|
|
39
|
+
operators = operatorUtils.fileOperators;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return operators.map(operator => {
|
|
43
|
+
return {
|
|
44
|
+
key: operator.type,
|
|
45
|
+
text: grid.labels[operator.key]()
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
if(!condition) {
|
|
50
|
+
return <></>
|
|
51
|
+
}
|
|
52
|
+
return <ComboBox
|
|
53
|
+
{...props}
|
|
54
|
+
selectedKey={condition.operator.get()}
|
|
55
|
+
shouldRestoreFocus={false}
|
|
56
|
+
options={getOptions()}
|
|
57
|
+
useComboBoxAsMenuWidth
|
|
58
|
+
styles={{
|
|
59
|
+
callout: {
|
|
60
|
+
maxHeight: '300px !important'
|
|
61
|
+
}
|
|
62
|
+
}}
|
|
63
|
+
onChange={(e, option) => {
|
|
64
|
+
condition.operator.set(option!.key as DatasetConditionOperator)
|
|
65
|
+
}} />;
|
|
66
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useEffect, useMemo, useRef } from "react";
|
|
2
|
+
import { Component } from "../../../../../core/components/Component/Component";
|
|
3
|
+
import { IGridColumn } from "../../../../../core/interfaces/IGridColumn";
|
|
4
|
+
import { IColumnFilterConditionController, useColumnFilterConditionController } from "../../../../controller/useColumnFilterConditionController";
|
|
5
|
+
import { ConditionComponentValue } from "./model/ConditionComponentValue";
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
interface IConditionValue {
|
|
9
|
+
column: IGridColumn;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const ConditionValue = (props: IConditionValue) => {
|
|
13
|
+
const condition = useColumnFilterConditionController(props.column);
|
|
14
|
+
if (!condition) {
|
|
15
|
+
return <></>
|
|
16
|
+
}
|
|
17
|
+
return <InternalConditionValue {...condition} />
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const InternalConditionValue = (controller: IColumnFilterConditionController) => {
|
|
21
|
+
const componentContainerRef = useRef<HTMLDivElement>(null);
|
|
22
|
+
const controllerRef = useRef<IColumnFilterConditionController>(controller);
|
|
23
|
+
controllerRef.current = controller;
|
|
24
|
+
const conditionComponentValue = useMemo(() => new ConditionComponentValue(controllerRef), []);
|
|
25
|
+
const column = conditionComponentValue.column;
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (conditionComponentValue.get() === null) {
|
|
29
|
+
const input = componentContainerRef.current?.querySelector('input')
|
|
30
|
+
input?.focus()
|
|
31
|
+
}
|
|
32
|
+
}, [conditionComponentValue.get()])
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div ref={componentContainerRef}>
|
|
36
|
+
<Component
|
|
37
|
+
column={column}
|
|
38
|
+
value={conditionComponentValue.get()}
|
|
39
|
+
onNotifyOutputChanged={(value) => conditionComponentValue.set(value)}
|
|
40
|
+
additionalParameters={{
|
|
41
|
+
MultipleEnabled: {
|
|
42
|
+
raw: true
|
|
43
|
+
}
|
|
44
|
+
}}
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
|
+
import { DatasetConditionOperator } from "../../../../../../core/enums/ConditionOperator";
|
|
3
|
+
import { DataType } from "../../../../../../core/enums/DataType";
|
|
4
|
+
import { IColumnFilterConditionController } from "../../../../../controller/useColumnFilterConditionController";
|
|
5
|
+
import { FilteringUtils } from "../../../../../utils/FilteringUtilts";
|
|
6
|
+
|
|
7
|
+
export class ConditionComponentValue {
|
|
8
|
+
//needs to be ref to keep the current reference
|
|
9
|
+
private _columnFilterConditionControllerRef: React.MutableRefObject<IColumnFilterConditionController>;
|
|
10
|
+
private _conditionUtils = FilteringUtils.condition();
|
|
11
|
+
|
|
12
|
+
constructor(columnFilterConditionControllerRef: React.MutableRefObject<IColumnFilterConditionController>) {
|
|
13
|
+
this._columnFilterConditionControllerRef = columnFilterConditionControllerRef;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public get column() {
|
|
17
|
+
const _column = {...this._columnFilterConditionController.column};
|
|
18
|
+
//always needs to be required for filter values if non valid value is present
|
|
19
|
+
if(!this._columnFilterConditionController.value.valid) {
|
|
20
|
+
_column.isRequired = true;
|
|
21
|
+
}
|
|
22
|
+
switch (this._columnFilterConditionController.column.dataType) {
|
|
23
|
+
case DataType.OPTIONSET:
|
|
24
|
+
case DataType.TWO_OPTIONS: {
|
|
25
|
+
_column.dataType = DataType.MULTI_SELECT_OPTIONSET;
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
//In Power Apps, DateTime fields filters do not allow setting filters for time, only for the date
|
|
29
|
+
case DataType.DATE_AND_TIME_DATE_AND_TIME: {
|
|
30
|
+
_column.dataType = DataType.DATE_AND_TIME_DATE_ONLY;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
this._conditionUtils.operator(this._operator.get()).allowsOnlyNumber
|
|
35
|
+
if (this._conditionUtils.operator(this._operator.get()).allowsOnlyNumber) {
|
|
36
|
+
_column.dataType = DataType.WHOLE_NONE;
|
|
37
|
+
}
|
|
38
|
+
if (this._conditionUtils.operator(this._operator.get()).allowsOnlyFreeText) {
|
|
39
|
+
_column.dataType = DataType.SINGLE_LINE_TEXT;
|
|
40
|
+
}
|
|
41
|
+
return _column;
|
|
42
|
+
}
|
|
43
|
+
public get() {
|
|
44
|
+
let value = this._value.get();
|
|
45
|
+
if (!value) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
switch (this.column.dataType) {
|
|
49
|
+
case DataType.MULTI_SELECT_OPTIONSET: {
|
|
50
|
+
if (typeof value === 'string') {
|
|
51
|
+
value = [value];
|
|
52
|
+
}
|
|
53
|
+
return value.map((x: string) => parseInt(x))
|
|
54
|
+
}
|
|
55
|
+
case DataType.LOOKUP_OWNER:
|
|
56
|
+
case DataType.LOOKUP_SIMPLE: {
|
|
57
|
+
if (typeof value === 'string') {
|
|
58
|
+
value = [value];
|
|
59
|
+
}
|
|
60
|
+
return value.map((x: string) => {
|
|
61
|
+
return {
|
|
62
|
+
entityType: "",
|
|
63
|
+
name: "",
|
|
64
|
+
id: x
|
|
65
|
+
} as ComponentFramework.LookupValue;
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return value;
|
|
70
|
+
}
|
|
71
|
+
public set(value: any) {
|
|
72
|
+
switch (this.column.dataType) {
|
|
73
|
+
case DataType.DATE_AND_TIME_DATE_AND_TIME:
|
|
74
|
+
case DataType.DATE_AND_TIME_DATE_ONLY: {
|
|
75
|
+
if(value instanceof Date) {
|
|
76
|
+
|
|
77
|
+
//the column of date time is always converted to Date column in Power Apps
|
|
78
|
+
value = dayjs(value).format('YYYY-MM-DD');
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
case DataType.MULTI_SELECT_OPTIONSET: {
|
|
83
|
+
switch (this._operator.get()) {
|
|
84
|
+
case DatasetConditionOperator.Equal:
|
|
85
|
+
case DatasetConditionOperator.NotEqual: {
|
|
86
|
+
if (value?.length === 1) {
|
|
87
|
+
value = value[0].toString();
|
|
88
|
+
this._value.set(value);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
for (let i = 0; i < value?.length; i++) {
|
|
94
|
+
value[i] = value[i].toString()
|
|
95
|
+
}
|
|
96
|
+
this._value.set(value);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
case DataType.LOOKUP_OWNER:
|
|
100
|
+
case DataType.LOOKUP_SIMPLE: {
|
|
101
|
+
if(value?.length > 1) {
|
|
102
|
+
value = value.map((x: ComponentFramework.LookupValue) => x.id);
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
value = value[0]?.id;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
this._value.set(value);
|
|
110
|
+
}
|
|
111
|
+
private get _columnFilterConditionController() {
|
|
112
|
+
return this._columnFilterConditionControllerRef.current;
|
|
113
|
+
}
|
|
114
|
+
private get _value() {
|
|
115
|
+
return this._columnFilterConditionController.value;
|
|
116
|
+
}
|
|
117
|
+
private get _operator() {
|
|
118
|
+
return this._columnFilterConditionController.operator;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { mergeStyleSets } from "@fluentui/react";
|
|
2
|
+
|
|
3
|
+
export const filterCalloutStyles = mergeStyleSets({
|
|
4
|
+
controls: {
|
|
5
|
+
display: 'flex',
|
|
6
|
+
flexDirection: 'column',
|
|
7
|
+
gap: 10,
|
|
8
|
+
flexGrow: 1
|
|
9
|
+
},
|
|
10
|
+
root: {
|
|
11
|
+
minHeight: 200,
|
|
12
|
+
padding: 16,
|
|
13
|
+
'.ms-Callout-main': {
|
|
14
|
+
display: 'flex',
|
|
15
|
+
flexDirection: 'column',
|
|
16
|
+
gap: 10
|
|
17
|
+
},
|
|
18
|
+
'.TALXIS__combobox__root, [class*="TALXIS__textfield__root"], [class*="TALXIS__tag-picker__root"]': {
|
|
19
|
+
padding: `0x !important`
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
title: {
|
|
23
|
+
fontWeight: 600,
|
|
24
|
+
flexGrow: 1
|
|
25
|
+
},
|
|
26
|
+
header: {
|
|
27
|
+
display: 'flex',
|
|
28
|
+
'i': {
|
|
29
|
+
fontSize: 12
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
footer: {
|
|
33
|
+
display: 'flex',
|
|
34
|
+
gap: 10,
|
|
35
|
+
justifyContent: 'flex-end'
|
|
36
|
+
}
|
|
37
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { DatasetConditionOperator } from "../core/enums/ConditionOperator";
|
|
2
|
+
|
|
3
|
+
export const OPERATORS = [
|
|
4
|
+
{ type: DatasetConditionOperator.None, key: 'condition-none' },
|
|
5
|
+
{ type: DatasetConditionOperator.Equal, key: 'condition-equal' },
|
|
6
|
+
{ type: DatasetConditionOperator.NotEqual, key: 'condition-notequal' },
|
|
7
|
+
{ type: DatasetConditionOperator.GreaterThan, key: 'condition-greaterthan' },
|
|
8
|
+
{ type: DatasetConditionOperator.LessThan, key: 'condition-lessthan' },
|
|
9
|
+
{ type: DatasetConditionOperator.GreaterEqual, key: 'condition-greaterequal' },
|
|
10
|
+
{ type: DatasetConditionOperator.LessEqual, key: 'condition-lessequal' },
|
|
11
|
+
{ type: DatasetConditionOperator.Like, key: 'condition-like' },
|
|
12
|
+
{ type: DatasetConditionOperator.NotLike, key: 'condition-notlike' },
|
|
13
|
+
{ type: DatasetConditionOperator.In, key: 'condition-in' },
|
|
14
|
+
{ type: DatasetConditionOperator.NotIn, key: 'condition-notin' },
|
|
15
|
+
{ type: DatasetConditionOperator.Null, key: 'condition-null' },
|
|
16
|
+
{ type: DatasetConditionOperator.NotNull, key: 'condition-notnull' },
|
|
17
|
+
{ type: DatasetConditionOperator.Yesterday, key: 'condition-yesterday' },
|
|
18
|
+
{ type: DatasetConditionOperator.Today, key: 'condition-today' },
|
|
19
|
+
{ type: DatasetConditionOperator.Tomorrow, key: 'condition-tomorrow' },
|
|
20
|
+
{ type: DatasetConditionOperator.Last7Days, key: 'condition-last7days' },
|
|
21
|
+
{ type: DatasetConditionOperator.Next7Days, key: 'condition-next7days' },
|
|
22
|
+
{ type: DatasetConditionOperator.LastWeek, key: 'condition-lastweek' },
|
|
23
|
+
{ type: DatasetConditionOperator.ThisWeek, key: 'condition-thisweek' },
|
|
24
|
+
{ type: DatasetConditionOperator.LastMonth, key: 'condition-lastmonth' },
|
|
25
|
+
{ type: DatasetConditionOperator.ThisMonth, key: 'condition-thismonth' },
|
|
26
|
+
{ type: DatasetConditionOperator.On, key: 'condition-on' },
|
|
27
|
+
{ type: DatasetConditionOperator.OnOrBefore, key: 'condition-onorbefore' },
|
|
28
|
+
{ type: DatasetConditionOperator.OnOrAfter, key: 'condition-onorafter' },
|
|
29
|
+
{ type: DatasetConditionOperator.LastYear, key: 'condition-lastyear' },
|
|
30
|
+
{ type: DatasetConditionOperator.ThisYear, key: 'condition-thisyear' },
|
|
31
|
+
{ type: DatasetConditionOperator.LastXDays, key: 'condition-lastxdays' },
|
|
32
|
+
{ type: DatasetConditionOperator.NextXDays, key: 'condition-nextxdays' },
|
|
33
|
+
{ type: DatasetConditionOperator.LastXMonths, key: 'condition-lastxmonths' },
|
|
34
|
+
{ type: DatasetConditionOperator.NextXMonths, key: 'condition-nextxmonths' },
|
|
35
|
+
{ type: DatasetConditionOperator.Contains, key: 'condition-contains' },
|
|
36
|
+
{ type: DatasetConditionOperator.BeginWith, key: 'condition-beginwith' },
|
|
37
|
+
{ type: DatasetConditionOperator.DoesNotBeginWith, key: 'condition-doesnotbeginwith' },
|
|
38
|
+
{ type: DatasetConditionOperator.EndsWith, key: 'condition-endswith' },
|
|
39
|
+
{ type: DatasetConditionOperator.DoesNotEndWith, key: 'condition-doesnotendwith' },
|
|
40
|
+
{ type: DatasetConditionOperator.InFiscalPeriodAndYear, key: 'condition-infiscalperiodandyear' },
|
|
41
|
+
{ type: DatasetConditionOperator.Above, key: 'condition-above' },
|
|
42
|
+
{ type: DatasetConditionOperator.Under, key: 'condition-under' },
|
|
43
|
+
{ type: DatasetConditionOperator.NotUnder, key: 'condition-notunder' },
|
|
44
|
+
{ type: DatasetConditionOperator.AboveOrEqual, key: 'condition-aboveorequal' },
|
|
45
|
+
{ type: DatasetConditionOperator.UnderOrEqual, key: 'condition-underorequal' },
|
|
46
|
+
{ type: DatasetConditionOperator.ContainValues, key: 'condition-containvalues' },
|
|
47
|
+
{ type: DatasetConditionOperator.DoesNotContainValues, key: 'condition-doesnotcontainvalues' }, // Added missing operator
|
|
48
|
+
];
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { DatasetConditionOperator } from "../../core/enums/ConditionOperator";
|
|
3
|
+
import { useGridInstance } from "../../core/hooks/useGridInstance"
|
|
4
|
+
import { useRefreshCallback } from "../../core/hooks/useRefreshCallback";
|
|
5
|
+
import { useRerender } from "../../core/hooks/useRerender";
|
|
6
|
+
import { IGridColumn } from "../../core/interfaces/IGridColumn";
|
|
7
|
+
import { Condition } from "../model/Condition";
|
|
8
|
+
|
|
9
|
+
export interface IColumnFilterConditionController {
|
|
10
|
+
isAppliedToDataset: boolean,
|
|
11
|
+
column: IGridColumn,
|
|
12
|
+
value: {
|
|
13
|
+
valid: boolean;
|
|
14
|
+
get: () => any;
|
|
15
|
+
set: (value: any) => void;
|
|
16
|
+
}
|
|
17
|
+
operator: {
|
|
18
|
+
get: () => DatasetConditionOperator | undefined;
|
|
19
|
+
set: (operator: DatasetConditionOperator) => void;
|
|
20
|
+
},
|
|
21
|
+
remove: () => void;
|
|
22
|
+
save: () => Promise<boolean>;
|
|
23
|
+
clear: () => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const useColumnFilterConditionController = (column: IGridColumn): IColumnFilterConditionController | null => {
|
|
27
|
+
const filtering = useGridInstance().filtering;
|
|
28
|
+
const conditionPromise = useMemo(() => filtering.condition(column), []);
|
|
29
|
+
const [controller, setController] = useState<IColumnFilterConditionController>();
|
|
30
|
+
|
|
31
|
+
const refresh = async () => {
|
|
32
|
+
const condition = await conditionPromise;
|
|
33
|
+
setController(prevState => ({
|
|
34
|
+
...prevState,
|
|
35
|
+
isAppliedToDataset: condition.isAppliedToDataset,
|
|
36
|
+
column: condition?.column,
|
|
37
|
+
operator: {
|
|
38
|
+
get: () => condition.operator.get(),
|
|
39
|
+
set: (operator) => condition.operator.set(operator)
|
|
40
|
+
},
|
|
41
|
+
value: {
|
|
42
|
+
valid: condition.isValid,
|
|
43
|
+
get: () => condition.value.get(),
|
|
44
|
+
set: (value) => condition.value.set(value)
|
|
45
|
+
},
|
|
46
|
+
remove: () => condition?.remove(),
|
|
47
|
+
save: () => condition?.save(),
|
|
48
|
+
clear: () => condition?.clear()
|
|
49
|
+
}))
|
|
50
|
+
}
|
|
51
|
+
useRefreshCallback(conditionPromise, refresh);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
(async () => {
|
|
54
|
+
refresh();
|
|
55
|
+
})();
|
|
56
|
+
}, []);
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
if(!controller) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
return controller;
|
|
63
|
+
}
|