@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,76 @@
|
|
|
1
|
+
import { ComboBox, CommandBarButton, ContextualMenuItemType, IComboBoxOption, IContextualMenuItem, useTheme } from '@fluentui/react';
|
|
2
|
+
import { CommandBar } from '@fluentui/react/lib/components/CommandBar/CommandBar';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { useGridInstance } from '../../../core/hooks/useGridInstance';
|
|
5
|
+
import { usePagingController } from '../../controllers/usePagingController';
|
|
6
|
+
import { getPagingStyles } from './styles';
|
|
7
|
+
|
|
8
|
+
export const Paging = () => {
|
|
9
|
+
const labels = useGridInstance().labels;
|
|
10
|
+
const paging = usePagingController();
|
|
11
|
+
const styles = getPagingStyles(useTheme());
|
|
12
|
+
|
|
13
|
+
const getPageSizeOptions = (): IContextualMenuItem[] => {
|
|
14
|
+
const sizes = ['25', '50', '75', '100', '250'];
|
|
15
|
+
return sizes.map(size => {
|
|
16
|
+
return {
|
|
17
|
+
key: size,
|
|
18
|
+
text: size,
|
|
19
|
+
checked: parseInt(size) === paging.pageSize,
|
|
20
|
+
className: styles.pageSizeOption,
|
|
21
|
+
onClick: () => paging.setPageSize(parseInt(size))
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
return (
|
|
26
|
+
<div className={styles.root}>
|
|
27
|
+
<div className={styles.pageSizeBtnWrapper}>
|
|
28
|
+
<CommandBarButton
|
|
29
|
+
text={labels['paging-pages']({ start: paging.pageFirstRecordOrder, end: paging.pageLastRecordOrder, recordcount: paging.totalResultCount >= 0 ? paging.totalResultCount : "5000+" })}
|
|
30
|
+
menuProps={{
|
|
31
|
+
items: [
|
|
32
|
+
{
|
|
33
|
+
key: 'header',
|
|
34
|
+
itemType: ContextualMenuItemType.Header,
|
|
35
|
+
text: 'Počet záznamů na stránce',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
key: 'divider',
|
|
39
|
+
itemType: ContextualMenuItemType.Divider,
|
|
40
|
+
},
|
|
41
|
+
...getPageSizeOptions()
|
|
42
|
+
]
|
|
43
|
+
}}
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
<CommandBar
|
|
47
|
+
className={styles.pagination}
|
|
48
|
+
items={[]}
|
|
49
|
+
farItems={[{
|
|
50
|
+
key: 'FirstPage',
|
|
51
|
+
iconOnly: true,
|
|
52
|
+
iconProps: { iconName: 'DoubleChevronLeft' },
|
|
53
|
+
disabled: !paging.hasPreviousPage,
|
|
54
|
+
onClick: () => paging.reset()
|
|
55
|
+
}, {
|
|
56
|
+
key: 'PreviousPage',
|
|
57
|
+
iconOnly: true,
|
|
58
|
+
iconProps: { iconName: 'Back' },
|
|
59
|
+
disabled: !paging.hasPreviousPage,
|
|
60
|
+
onClick: () => paging.loadPreviousPage()
|
|
61
|
+
}, {
|
|
62
|
+
key: 'CurrentPage',
|
|
63
|
+
text: `${labels['paging-page']()} ${paging.pageNumber.toString()}`,
|
|
64
|
+
className: styles.currentPageBtn,
|
|
65
|
+
disabled: true,
|
|
66
|
+
}, {
|
|
67
|
+
key: 'NextPage',
|
|
68
|
+
iconOnly: true,
|
|
69
|
+
iconProps: { iconName: 'Forward' },
|
|
70
|
+
disabled: !paging.hasNextPage,
|
|
71
|
+
onClick: () => paging.loadNextPage()
|
|
72
|
+
}]}
|
|
73
|
+
/>
|
|
74
|
+
</div>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { mergeStyleSets, ITheme } from "@fluentui/react";
|
|
2
|
+
|
|
3
|
+
export const getPagingStyles = (theme: ITheme) => {
|
|
4
|
+
return mergeStyleSets({
|
|
5
|
+
root: {
|
|
6
|
+
display: 'flex',
|
|
7
|
+
flexWrap: 'wrap',
|
|
8
|
+
justifyContent: 'center'
|
|
9
|
+
},
|
|
10
|
+
pagination: {
|
|
11
|
+
'.ms-CommandBar': {
|
|
12
|
+
paddingLeft: 0,
|
|
13
|
+
paddingRight: 0,
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
currentPageBtn: {
|
|
17
|
+
'.ms-Button-label': {
|
|
18
|
+
color: theme.semanticColors.bodyText
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
pageSizeBtnWrapper: {
|
|
22
|
+
flexGrow: 1,
|
|
23
|
+
display: 'flex',
|
|
24
|
+
'.ms-Button-label': {
|
|
25
|
+
whiteSpace: 'nowrap',
|
|
26
|
+
},
|
|
27
|
+
'.ms-Button': {
|
|
28
|
+
height: 44
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
pageSizeOption: {
|
|
32
|
+
'& .is-checked': {
|
|
33
|
+
backgroundColor: theme.semanticColors.buttonBackgroundHovered,
|
|
34
|
+
fontWeight: 600
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useGridInstance } from "../../core/hooks/useGridInstance"
|
|
2
|
+
|
|
3
|
+
interface IPagingController {
|
|
4
|
+
pageNumber: number,
|
|
5
|
+
pageSize: number,
|
|
6
|
+
totalResultCount: number,
|
|
7
|
+
hasPreviousPage: boolean,
|
|
8
|
+
hasNextPage: boolean,
|
|
9
|
+
pageFirstRecordOrder: number,
|
|
10
|
+
pageLastRecordOrder: number,
|
|
11
|
+
loadNextPage: () => void,
|
|
12
|
+
loadPreviousPage: () => void,
|
|
13
|
+
loadExactPage: (pageNumber: number) => void,
|
|
14
|
+
setPageSize: (pageSize: number) => void,
|
|
15
|
+
reset: () => void
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const usePagingController = (): IPagingController => {
|
|
19
|
+
const paging = useGridInstance().paging;
|
|
20
|
+
return {
|
|
21
|
+
pageNumber: paging.pageNumber,
|
|
22
|
+
pageSize: paging.pageSize,
|
|
23
|
+
totalResultCount: paging.totalResultCount,
|
|
24
|
+
hasPreviousPage: paging.hasPreviousPage,
|
|
25
|
+
hasNextPage: paging.hasNextPage,
|
|
26
|
+
pageFirstRecordOrder: paging.pageFirstRecordOrder,
|
|
27
|
+
pageLastRecordOrder: paging.pageLastRecordOrder,
|
|
28
|
+
loadExactPage: (pageNumber: number) => paging.loadExactPage(pageNumber),
|
|
29
|
+
loadNextPage: () => paging.loadNextPage(),
|
|
30
|
+
loadPreviousPage: () => paging.loadPreviousPage(),
|
|
31
|
+
setPageSize: (pageSize) => paging.setPageSize(pageSize),
|
|
32
|
+
reset: () => paging.reset()
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { GridDependency } from "../../core/model/GridDependency";
|
|
2
|
+
|
|
3
|
+
export class Paging extends GridDependency {
|
|
4
|
+
|
|
5
|
+
public get pageNumber() {
|
|
6
|
+
return this._dataset.paging.pageNumber;
|
|
7
|
+
}
|
|
8
|
+
public get pageSize() {
|
|
9
|
+
return this._dataset.paging.pageSize;
|
|
10
|
+
}
|
|
11
|
+
public get totalResultCount() {
|
|
12
|
+
return this._dataset.paging.totalResultCount;
|
|
13
|
+
}
|
|
14
|
+
public get hasPreviousPage() {
|
|
15
|
+
return this._dataset.paging.hasPreviousPage;
|
|
16
|
+
}
|
|
17
|
+
public get hasNextPage() {
|
|
18
|
+
return this._dataset.paging.hasNextPage;
|
|
19
|
+
}
|
|
20
|
+
public get pageFirstRecordOrder() {
|
|
21
|
+
return (this.pageNumber - 1) * this.pageSize + (this.totalResultCount === 0 ? 0 : 1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public get pageLastRecordOrder() {
|
|
25
|
+
return this.pageNumber * this.pageSize;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public loadNextPage() {
|
|
29
|
+
this.loadExactPage(this.pageNumber + 1)
|
|
30
|
+
}
|
|
31
|
+
public loadPreviousPage() {
|
|
32
|
+
this.loadExactPage(this.pageNumber - 1);
|
|
33
|
+
}
|
|
34
|
+
public loadExactPage(pageNumber: number) {
|
|
35
|
+
this._dataset.paging.loadExactPage(pageNumber);
|
|
36
|
+
}
|
|
37
|
+
public setPageSize(pageSize: number) {
|
|
38
|
+
this._dataset.paging.setPageSize(pageSize);
|
|
39
|
+
this._dataset.refresh();
|
|
40
|
+
//in Power Apps the new page size can sometimes come only after second refresh #smh
|
|
41
|
+
//@ts-ignore - Portal types
|
|
42
|
+
if (!window.TALXIS?.Portal) {
|
|
43
|
+
this._dataset.refresh()
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
public reset() {
|
|
47
|
+
this._dataset.paging.reset();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useGridInstance } from "../../core/hooks/useGridInstance";
|
|
2
|
+
import { IEntityRecord } from "../../interfaces";
|
|
3
|
+
|
|
4
|
+
interface ISelectionController {
|
|
5
|
+
type: "multiple" | "single" | undefined;
|
|
6
|
+
selectedRecordIds: string[],
|
|
7
|
+
allRecordsSelected: boolean;
|
|
8
|
+
toggle: (record: IEntityRecord, state: boolean) => void;
|
|
9
|
+
clear: () => void,
|
|
10
|
+
selectAll: () => void
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const useSelectionController = (): ISelectionController => {
|
|
14
|
+
const grid = useGridInstance();
|
|
15
|
+
const selection = grid.selection;
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
type: selection.type,
|
|
19
|
+
selectedRecordIds: selection.selectedRecordIds,
|
|
20
|
+
allRecordsSelected: selection.allRecordsSelected,
|
|
21
|
+
toggle: (record: IEntityRecord, state: boolean) => selection.toggle(record, state),
|
|
22
|
+
clear: () => selection.clear(),
|
|
23
|
+
selectAll: () => selection.selectAll()
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { GridDependency } from "../../core/model/GridDependency";
|
|
2
|
+
|
|
3
|
+
export class Selection extends GridDependency {
|
|
4
|
+
private _selectedRecordIdsSet: Set<string> = new Set<string>();
|
|
5
|
+
private debounceTimer: ReturnType<typeof setTimeout> | null = null;
|
|
6
|
+
|
|
7
|
+
public toggle(record: ComponentFramework.PropertyHelper.DataSetApi.EntityRecord, newState: boolean, clearExistingSelection?: boolean, disableDebounce?: boolean) {
|
|
8
|
+
const recordId = record.getRecordId();
|
|
9
|
+
if(!this.debounceTimer) {
|
|
10
|
+
this._selectedRecordIdsSet = new Set(this.selectedRecordIds);
|
|
11
|
+
}
|
|
12
|
+
if (clearExistingSelection) {
|
|
13
|
+
this._selectedRecordIdsSet.clear();
|
|
14
|
+
}
|
|
15
|
+
if (newState === false) {
|
|
16
|
+
this._selectedRecordIdsSet.delete(recordId);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
if (this.type === 'single') {
|
|
20
|
+
this._selectedRecordIdsSet.clear();
|
|
21
|
+
}
|
|
22
|
+
this._selectedRecordIdsSet.add(recordId);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (this.debounceTimer !== null) {
|
|
26
|
+
clearTimeout(this.debounceTimer);
|
|
27
|
+
}
|
|
28
|
+
if(disableDebounce) {
|
|
29
|
+
this._setSelectedRecords();
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
this.debounceTimer = setTimeout(() => {
|
|
33
|
+
this._setSelectedRecords();
|
|
34
|
+
}, 0);
|
|
35
|
+
}
|
|
36
|
+
public get selectedRecordIds() {
|
|
37
|
+
return this._dataset.getSelectedRecordIds();
|
|
38
|
+
}
|
|
39
|
+
public get allRecordsSelected() {
|
|
40
|
+
return this.selectedRecordIds.length === this._dataset.sortedRecordIds.length;
|
|
41
|
+
}
|
|
42
|
+
public get type() {
|
|
43
|
+
if(this._grid.props.parameters.SelectableRows?.raw === 'none') {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
return this._grid.props.parameters.SelectableRows?.raw;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public clear() {
|
|
50
|
+
this._grid.dataset.setSelectedRecordIds([]);
|
|
51
|
+
}
|
|
52
|
+
public selectAll() {
|
|
53
|
+
this._grid.dataset.setSelectedRecordIds(this._dataset.sortedRecordIds)
|
|
54
|
+
}
|
|
55
|
+
private _setSelectedRecords() {
|
|
56
|
+
this._grid.dataset.setSelectedRecordIds([...this._selectedRecordIdsSet.values()]);
|
|
57
|
+
this.debounceTimer = null; // Reset debounce timer after execution
|
|
58
|
+
this._selectedRecordIdsSet = new Set();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { IGridColumn } from "../core/interfaces/IGridColumn";
|
|
2
|
+
import { GridDependency } from "../core/model/GridDependency";
|
|
3
|
+
export class Sorting extends GridDependency {
|
|
4
|
+
public get(column: IGridColumn) {
|
|
5
|
+
return {
|
|
6
|
+
value: this._dataset.sorting.find(x => x.name === column.key),
|
|
7
|
+
sort: (direction: ComponentFramework.PropertyHelper.DataSetApi.Types.SortDirection) => {
|
|
8
|
+
const sortMap: Map<string, ComponentFramework.PropertyHelper.DataSetApi.SortStatus> = new Map(this._dataset.sorting.map(x => [x.name, x]));
|
|
9
|
+
//sorting across multiple columns is currently not supported in Portal
|
|
10
|
+
//@ts-ignore - types
|
|
11
|
+
if(window.TALXIS?.Portal) {
|
|
12
|
+
sortMap.clear();
|
|
13
|
+
}
|
|
14
|
+
sortMap.set(column.key, {
|
|
15
|
+
name: column.key,
|
|
16
|
+
sortDirection: direction
|
|
17
|
+
})
|
|
18
|
+
//Power Apps only allows setting of sorting like this - https://stackoverflow.com/questions/1232040/how-do-i-empty-an-array-in-javascript
|
|
19
|
+
//this is so stupid
|
|
20
|
+
while (this._dataset.sorting.length) {
|
|
21
|
+
this._dataset.sorting.pop()
|
|
22
|
+
}
|
|
23
|
+
for (const sort of sortMap.values()) {
|
|
24
|
+
this._dataset.sorting.push(sort);
|
|
25
|
+
}
|
|
26
|
+
this._dataset.refresh();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
package/src/components/Grid/sorting/components/SortingContextualMenu/SortingContextualMenu.tsx
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { ContextualMenu, ContextualMenuItemType, IContextualMenuItem, IContextualMenuProps, useTheme } from '@fluentui/react';
|
|
3
|
+
import { IGridColumn } from '../../../core/interfaces/IGridColumn';
|
|
4
|
+
import { DataType } from '../../../core/enums/DataType';
|
|
5
|
+
import { getColumnHeaderContextualMenuStyles } from './styles';
|
|
6
|
+
import { useGridInstance } from '../../../core/hooks/useGridInstance';
|
|
7
|
+
import { useColumnSortingController } from '../../controllers/useColumnSortingController';
|
|
8
|
+
import { useColumnFilterConditionController } from '../../../filtering/controller/useColumnFilterConditionController';
|
|
9
|
+
|
|
10
|
+
export interface ISortingContextualMenu extends Omit<IContextualMenuProps, 'items'> {
|
|
11
|
+
column: IGridColumn;
|
|
12
|
+
onDismiss: (e?: Event | React.MouseEvent<Element, MouseEvent> | React.KeyboardEvent<Element>, dismissAll?: boolean, showFilterCallout?: boolean) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const SortingContextualMenu = (props: ISortingContextualMenu) => {
|
|
16
|
+
|
|
17
|
+
const grid = useGridInstance();
|
|
18
|
+
const labels = grid.labels;
|
|
19
|
+
const styles = getColumnHeaderContextualMenuStyles(useTheme());
|
|
20
|
+
const {column, onDismiss} = {...props};
|
|
21
|
+
const sorting = useColumnSortingController(column);
|
|
22
|
+
const condition = useColumnFilterConditionController(column);
|
|
23
|
+
const [items, setItems] = useState<IContextualMenuItem[]>([]);
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
(async() => {
|
|
27
|
+
setItems(await getItems())
|
|
28
|
+
})();
|
|
29
|
+
}, [condition]);
|
|
30
|
+
|
|
31
|
+
const getTwoOptionsSortLabel = async (isDesc?: boolean) => {
|
|
32
|
+
const [defaultValue, options] = await grid.metadata.getOptions(column);
|
|
33
|
+
if(!isDesc) {
|
|
34
|
+
return `${options[0].Label} ${labels['filtersortmenu-sorttwooption-joint']()} ${options[1].Label}`
|
|
35
|
+
}
|
|
36
|
+
return `${options[1].Label} ${labels['filtersortmenu-sorttwooption-joint']()} ${options[0].Label}`
|
|
37
|
+
}
|
|
38
|
+
const getLabel = async (isDesc?: boolean) => {
|
|
39
|
+
switch (column.dataType) {
|
|
40
|
+
case DataType.WHOLE_NONE:
|
|
41
|
+
case DataType.DECIMAL:
|
|
42
|
+
case DataType.FP:
|
|
43
|
+
case DataType.CURRENCY: {
|
|
44
|
+
if (!isDesc) {
|
|
45
|
+
return labels['filtersortmenu-sortnumber-a-z']()
|
|
46
|
+
}
|
|
47
|
+
return labels['filtersortmenu-sortnumber-z-a']()
|
|
48
|
+
}
|
|
49
|
+
case DataType.DATE_AND_TIME_DATE_AND_TIME:
|
|
50
|
+
case DataType.DATE_AND_TIME_DATE_ONLY: {
|
|
51
|
+
if (!isDesc) {
|
|
52
|
+
return labels['filtersortmenu-sortdate-a-z']()
|
|
53
|
+
}
|
|
54
|
+
return labels['filtersortmenu-sortdate-z-a']()
|
|
55
|
+
}
|
|
56
|
+
case DataType.TWO_OPTIONS: {
|
|
57
|
+
return getTwoOptionsSortLabel(isDesc);
|
|
58
|
+
}
|
|
59
|
+
default: {
|
|
60
|
+
if (!isDesc) {
|
|
61
|
+
return labels['filtersortmenu-sorttext-a-z']()
|
|
62
|
+
}
|
|
63
|
+
return labels['filtersortmenu-sorttext-z-a']()
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const getItems = async (): Promise<IContextualMenuItem[]> => {
|
|
69
|
+
if(!condition) {
|
|
70
|
+
return []
|
|
71
|
+
}
|
|
72
|
+
const items: IContextualMenuItem[] = [
|
|
73
|
+
{
|
|
74
|
+
key: 'sort_asc',
|
|
75
|
+
checked: column.isSorted && !column.isSortedDescending,
|
|
76
|
+
disabled: !column.isSortable || column.dataType === DataType.MULTI_SELECT_OPTIONSET,
|
|
77
|
+
text: await getLabel(),
|
|
78
|
+
className: styles.item,
|
|
79
|
+
iconProps: {
|
|
80
|
+
iconName: 'SortUp'
|
|
81
|
+
},
|
|
82
|
+
onClick: () => sorting.sort(0)
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
key: 'sort_desc',
|
|
86
|
+
checked: column.isSorted && column.isSortedDescending,
|
|
87
|
+
disabled: !column.isSortable || column.dataType === DataType.MULTI_SELECT_OPTIONSET,
|
|
88
|
+
text: await getLabel(true),
|
|
89
|
+
className: styles.item,
|
|
90
|
+
iconProps: {
|
|
91
|
+
iconName: 'SortDown'
|
|
92
|
+
},
|
|
93
|
+
onClick: () => sorting.sort(1)
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
key: 'divider',
|
|
97
|
+
itemType: ContextualMenuItemType.Divider
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
key: 'filter',
|
|
101
|
+
className: styles.item,
|
|
102
|
+
disabled: !column.isFilterable,
|
|
103
|
+
text: labels['filtermenu-filterby'](),
|
|
104
|
+
iconProps: {
|
|
105
|
+
iconName: 'Filter'
|
|
106
|
+
},
|
|
107
|
+
onClick: (e) => onDismiss(e, false, true)
|
|
108
|
+
}
|
|
109
|
+
];
|
|
110
|
+
if (condition.isAppliedToDataset) {
|
|
111
|
+
items.push({
|
|
112
|
+
key: 'clearFilter',
|
|
113
|
+
text: labels['filtersortmenu-clearfilter'](),
|
|
114
|
+
iconProps: {
|
|
115
|
+
iconName: 'ClearFilter'
|
|
116
|
+
},
|
|
117
|
+
onClick: () => {
|
|
118
|
+
condition.remove();
|
|
119
|
+
condition.save();
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return items
|
|
124
|
+
}
|
|
125
|
+
return <ContextualMenu {...props} items={items} />;
|
|
126
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { mergeStyleSets, ITheme } from "@fluentui/react";
|
|
2
|
+
|
|
3
|
+
export const getColumnHeaderContextualMenuStyles = (theme: ITheme) => {
|
|
4
|
+
return mergeStyleSets({
|
|
5
|
+
item: {
|
|
6
|
+
'& .is-checked': {
|
|
7
|
+
backgroundColor: theme.semanticColors.buttonBackgroundHovered,
|
|
8
|
+
fontWeight: 600
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { useGridInstance } from "../../core/hooks/useGridInstance";
|
|
3
|
+
import { IGridColumn } from "../../core/interfaces/IGridColumn";
|
|
4
|
+
|
|
5
|
+
interface ISortingController {
|
|
6
|
+
value: ComponentFramework.PropertyHelper.DataSetApi.SortStatus | undefined;
|
|
7
|
+
sort: (sortDirection: ComponentFramework.PropertyHelper.DataSetApi.Types.SortDirection) => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const useColumnSortingController = (column: IGridColumn): ISortingController => {
|
|
11
|
+
const grid = useGridInstance();
|
|
12
|
+
const sorting = grid.sorting.get(column);
|
|
13
|
+
|
|
14
|
+
const getController = (): ISortingController => {
|
|
15
|
+
return {
|
|
16
|
+
value: sorting.value,
|
|
17
|
+
sort: (direction) => sorting.sort(direction)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const [controller, setController] = useState<ISortingController>(() => getController())
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
setController(getController())
|
|
24
|
+
}, [sorting.value]);
|
|
25
|
+
return controller;
|
|
26
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { IGridTranslations } from "./interfaces";
|
|
2
|
+
|
|
3
|
+
export const gridTranslations: IGridTranslations = {
|
|
4
|
+
"condition-none": { 1029: "Žádná", 1033: "None" },
|
|
5
|
+
"condition-equal": { 1029: "Je rovno", 1033: "Equals" },
|
|
6
|
+
"condition-notequal": { 1029: "Není rovno", 1033: "Does not equal" },
|
|
7
|
+
"condition-greaterthan": { 1029: "Větší než", 1033: "Greater than" },
|
|
8
|
+
"condition-lessthan": { 1029: "Menší než", 1033: "Less than" },
|
|
9
|
+
"condition-greaterequal": { 1029: "Větší než nebo rovno", 1033: "Greater than or equal to" },
|
|
10
|
+
"condition-lessequal": { 1029: "Menší než nebo rovno", 1033: "Less than or equal to" },
|
|
11
|
+
"condition-like": { 1029: "Obsahuje", 1033: "Contains" },
|
|
12
|
+
"condition-notlike": { 1029: "Neobsahuje", 1033: "Does not contain" },
|
|
13
|
+
"condition-null": { 1029: "Neobsahuje data", 1033: "Does not contain data" },
|
|
14
|
+
"condition-notnull": { 1029: "Obsahuje data", 1033: "Contains data" },
|
|
15
|
+
"condition-beginwith": { 1029: "Začíná na", 1033: "Begins with" },
|
|
16
|
+
"condition-doesnotbeginwith": { 1029: "Nezačíná na", 1033: "Does not begin with" },
|
|
17
|
+
"condition-endswith": { 1029: "Končí na", 1033: "Ends with" },
|
|
18
|
+
"condition-doesnotendwith": { 1029: "Nekončí na", 1033: "Does not end with" },
|
|
19
|
+
"condition-yesterday": { 1029: "Včera", 1033: "Yesterday" },
|
|
20
|
+
"condition-today": { 1029: "Dneska", 1033: "Today" },
|
|
21
|
+
"condition-tomorrow": { 1029: "Zítra", 1033: "Tomorrow" },
|
|
22
|
+
"condition-last7days": { 1029: "Posledních 7 dnů", 1033: "Last 7 days" },
|
|
23
|
+
"condition-next7days": { 1029: "Příštích 7 dnů", 1033: "Next 7 days" },
|
|
24
|
+
"condition-lastweek": { 1029: "Minulý týden", 1033: "Last week" },
|
|
25
|
+
"condition-thisweek": { 1029: "Tento týden", 1033: "This week" },
|
|
26
|
+
"condition-lastmonth": { 1029: "Minulý měsíc", 1033: "Last month" },
|
|
27
|
+
"condition-thismonth": { 1029: "Tento měsíc", 1033: "This month" },
|
|
28
|
+
"condition-on": { 1029: "V den", 1033: "On" },
|
|
29
|
+
"condition-onorbefore": { 1029: "Před dnem (včetně)", 1033: "On or before" },
|
|
30
|
+
"condition-onorafter": { 1029: "Po dni (včetně)", 1033: "On or after" },
|
|
31
|
+
"condition-lastyear": { 1029: "Poslední rok", 1033: "Last year" },
|
|
32
|
+
"condition-thisyear": { 1029: "Tento rok", 1033: "This year" },
|
|
33
|
+
"condition-lastxdays": { 1029: "Posledních X dnů", 1033: "Last X days" },
|
|
34
|
+
"condition-nextxdays": { 1029: "Příštích X dnů", 1033: "Next X days" },
|
|
35
|
+
"condition-lastxmonths": { 1029: "Posledních X měsíců", 1033: "Last X months" },
|
|
36
|
+
"condition-nextxmonths": { 1029: "Příštích X měsíců", 1033: "Next X months" },
|
|
37
|
+
"condition-contains": { 1029: "Obsahuje", 1033: "Contains" },
|
|
38
|
+
"condition-infiscalperiodandyear": { 1029: "Toto fiskální období a rok", 1033: "In fiscal period and year" },
|
|
39
|
+
"condition-above": { 1029: "Nad", 1033: "Above" },
|
|
40
|
+
"condition-under": { 1029: "Pod", 1033: "Under" },
|
|
41
|
+
"condition-notunder": { 1029: "Není pod", 1033: "Not under" },
|
|
42
|
+
"condition-aboveorequal": { 1029: "Je nad nebo se rovná", 1033: "Above or equal" },
|
|
43
|
+
"condition-underorequal": { 1029: "Je pod nebo se rovná", 1033: "Under or equal" },
|
|
44
|
+
"condition-containvalues": { 1029: "Obsahuje hodnoty", 1033: "Contain values" },
|
|
45
|
+
"condition-doesnotcontainvalues": { 1029: "Neobsahuje hodnoty", 1033: "Does not contain values" },
|
|
46
|
+
"filtermenu-filterby": { 1029: "Filtrovat podle", 1033: "Filter By" },
|
|
47
|
+
"filtermenu-applybutton": { 1029: "Použít", 1033: "Apply" },
|
|
48
|
+
"filtermenu-clearbutton": { 1029: "Vymazat", 1033: "Clear" },
|
|
49
|
+
"filtersortmenu-sorttext-a-z": { 1029: "Seřadit od A do Z", 1033: "Sort A to Z" },
|
|
50
|
+
"filtersortmenu-sorttext-z-a": { 1029: "Seřadit od Z do A", 1033: "Sort Z to A" },
|
|
51
|
+
"filtersortmenu-sortdate-a-z": { 1029: "Seřadit od nejstarších", 1033: "Sort older to newer" },
|
|
52
|
+
"filtersortmenu-sortdate-z-a": { 1029: "Seřadit od nejnovějších", 1033: "Sort newer to older" },
|
|
53
|
+
"filtersortmenu-sortnumber-a-z": { 1029: "Seřadit od nejmenších", 1033: "Sort smaller to larger" },
|
|
54
|
+
"filtersortmenu-sortnumber-z-a": { 1029: "Seřadit od největších", 1033: "Sort larger to smaller" },
|
|
55
|
+
"filtersortmenu-sorttwooption-a-z": { 1029: "Seřadit od nejmenších", 1033: "No to Yes" },
|
|
56
|
+
"filtersortmenu-sorttwooption-z-a": { 1029: "Seřadit od největších", 1033: "Yes to No" },
|
|
57
|
+
"filtersortmenu-sorttwooption-joint": { 1029: "až", 1033: "to" },
|
|
58
|
+
"filtersortmenu-filterby": { 1029: "Filtrovat podle", 1033: "Filter by" },
|
|
59
|
+
"filtersortmenu-clearfilter": { 1029: "Vymazat filtr", 1033: "Clear filter" },
|
|
60
|
+
"paging-of": { 1029: "z", 1033: "of" },
|
|
61
|
+
"paging-firstpage": { 1029: "První strana", 1033: "First page" },
|
|
62
|
+
"paging-previouspage": { 1029: "Předchozí", 1033: "Previous" },
|
|
63
|
+
"paging-page": { 1029: "Strana", 1033: "Page" },
|
|
64
|
+
"paging-nextpage": { 1029: "Další", 1033: "Next" },
|
|
65
|
+
"paging-lastpage": { 1029: "Poslední strana", 1033: "Last page" },
|
|
66
|
+
"paging-pages": {1029: "{{start}} - {{end}} z {{recordcount}}", 1033: "{{start}} - {{end}} of {{recordcount}}"},
|
|
67
|
+
"norecordsfound": {1029: 'Nenašli jsme nic, co by se zde dalo zobrazit', 1033: 'No records found'},
|
|
68
|
+
"saving-changenotification": {1029: "Počet upravených záznamů: <b>{{numOfChanges}}</b>. Klikněte <u>zde</u> pro jejich zobrazení.", 1033: "Number of updated records: <b>{{numOfChanges}}</b>. Click <u>here</u> to review."},
|
|
69
|
+
"saving-save": {1029: "Uložit", 1033: "Save"},
|
|
70
|
+
"saving-saving": {1029: "Ukládání...", 1033: "Saving..."},
|
|
71
|
+
"saving-changepreview-title": {1033: 'Number of updated rows: {{numOfChanges}}', 1029: 'Počet upravených záznamů: {{numOfChanges}}'},
|
|
72
|
+
"saving-validation-error": {1029: 'Pro uložení záznamu je nutné opravit chybové hodnoty následujících sloupců: <b>{{columnDisplayNames}}</b>', 1033: 'Folowing columns have validation errors: <b>{{columnDisplayNames}}</b>'},
|
|
73
|
+
"validation-input-value": {1029: 'Zadejte hodnotu', 1033: 'Please enter value.'},
|
|
74
|
+
"validation-email": {1029: 'Neplatný formát emailové adresy.', 1033: 'Invalid Email address format.'},
|
|
75
|
+
"validation-url": {1029: 'Neplatný formát webové adresy.', 1033: 'Invalid URL format.'},
|
|
76
|
+
"validation-date": {1029: 'Neplatný formát datumu.', 1033: 'Invalid Date format.'},
|
|
77
|
+
"validation-number": {1029: 'Neplatný formát čísla.', 1033: 'Invalid Number format.'},
|
|
78
|
+
"no-name": {1029: '(Bez názvu)', 1033: '(No Name)'},
|
|
79
|
+
};
|
|
80
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { useGridInstance } from "../../core/hooks/useGridInstance";
|
|
3
|
+
import { IGridColumn } from "../../core/interfaces/IGridColumn";
|
|
4
|
+
import { ColumnValidation } from "../model/ColumnValidation";
|
|
5
|
+
|
|
6
|
+
interface IRecordValidation {
|
|
7
|
+
column: IGridColumn;
|
|
8
|
+
record: ComponentFramework.PropertyHelper.DataSetApi.EntityRecord;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const useColumnValidationController = (props: IRecordValidation): [boolean, string] => {
|
|
12
|
+
const grid = useGridInstance();
|
|
13
|
+
const column = props.column;
|
|
14
|
+
const record = props.record;
|
|
15
|
+
const columnValidation = useMemo(() => {return new ColumnValidation(grid, column)}, []);
|
|
16
|
+
|
|
17
|
+
const [isValid, setIsValid] = useState<boolean>(true);
|
|
18
|
+
const [errorMessage, setErrorMessage] = useState<string>("");
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if(!column.isEditable) {
|
|
22
|
+
//we are not doing validation for non-editable columns
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const [isValid, errorMessage] = columnValidation.validate(record.getValue(column.key));
|
|
26
|
+
setIsValid(isValid);
|
|
27
|
+
setErrorMessage(errorMessage);
|
|
28
|
+
}, [record.getValue(column.key)]);
|
|
29
|
+
|
|
30
|
+
return [isValid, errorMessage];
|
|
31
|
+
}
|