@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,61 @@
|
|
|
1
|
+
import { mergeStyles, getTheme } from "@fluentui/react/lib/Styling";
|
|
2
|
+
import { IDialogProps } from './interfaces/index';
|
|
3
|
+
|
|
4
|
+
export const getRootStyles = (props: IDialogProps): string => {
|
|
5
|
+
const theme = getTheme();
|
|
6
|
+
const rootStyles = mergeStyles(({
|
|
7
|
+
selectors: {
|
|
8
|
+
'.ms-Dialog-main': {
|
|
9
|
+
width: props.width,
|
|
10
|
+
minHeight: props.minHeight ?? 0,
|
|
11
|
+
height: props.height,
|
|
12
|
+
},
|
|
13
|
+
'@media(max-width: 768px)': {
|
|
14
|
+
'.ms-Dialog-main': {
|
|
15
|
+
width: '100vw',
|
|
16
|
+
height: '100svh',
|
|
17
|
+
maxWidth: '100vw',
|
|
18
|
+
maxHeight: '100svh'
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
'.ms-Dialog-subText': {
|
|
22
|
+
color: theme.palette.black
|
|
23
|
+
},
|
|
24
|
+
'.ms-Dialog-content': {
|
|
25
|
+
overflow: 'auto',
|
|
26
|
+
paddingBottom: 24,
|
|
27
|
+
flex: 1
|
|
28
|
+
},
|
|
29
|
+
'.ms-Dialog-content, .ms-Dialog-actions': {
|
|
30
|
+
paddingLeft: 24,
|
|
31
|
+
paddingRight: 24,
|
|
32
|
+
width: 'initial'
|
|
33
|
+
},
|
|
34
|
+
'.ms-Dialog-actions': {
|
|
35
|
+
borderTop: `1px solid ${theme.semanticColors.bodyDivider}`,
|
|
36
|
+
paddingBottom: 24,
|
|
37
|
+
paddingTop: 24,
|
|
38
|
+
margin: 'initial',
|
|
39
|
+
flex: '0 0 auto'
|
|
40
|
+
},
|
|
41
|
+
'.ms-Dialog-inner': {
|
|
42
|
+
padding: 0,
|
|
43
|
+
display: 'flex',
|
|
44
|
+
flexDirection: 'column',
|
|
45
|
+
flexGrow: 1,
|
|
46
|
+
overflow: 'hidden'
|
|
47
|
+
},
|
|
48
|
+
'.ms-Modal-scrollableContent': {
|
|
49
|
+
overflow: 'hidden',
|
|
50
|
+
display: 'flex',
|
|
51
|
+
'> div': {
|
|
52
|
+
display: 'flex',
|
|
53
|
+
flexDirection: 'column'
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
}));
|
|
60
|
+
return rootStyles;
|
|
61
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { Dialog as DialogBase } from '@fluentui/react/lib/Dialog';
|
|
3
|
+
import { IDialogProps } from './interfaces';
|
|
4
|
+
import { defaultProps } from './Constants';
|
|
5
|
+
import { getRootStyles } from './Styles';
|
|
6
|
+
|
|
7
|
+
const Dialog: React.FC<IDialogProps> = (props) => {
|
|
8
|
+
return (
|
|
9
|
+
<DialogBase
|
|
10
|
+
{...props}
|
|
11
|
+
modalProps={{
|
|
12
|
+
...props.modalProps,
|
|
13
|
+
allowTouchBodyScroll: props.modalProps?.allowTouchBodyScroll ?? matchMedia('(hover: none)').matches ? true : undefined,
|
|
14
|
+
className: `${props.modalProps?.className} ${getRootStyles(props)}`
|
|
15
|
+
}}
|
|
16
|
+
>
|
|
17
|
+
{props.children}
|
|
18
|
+
</DialogBase>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
export default Dialog;
|
|
22
|
+
Dialog.defaultProps = defaultProps;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { CommandBar, CommandBarButton, MessageBar, MessageBarType, Spinner, SpinnerSize } from "@fluentui/react";
|
|
2
|
+
import { useGridInstance } from "../../hooks/useGridInstance";
|
|
3
|
+
import { useSave } from "./hooks/useSave";
|
|
4
|
+
import React, { useState } from 'react';
|
|
5
|
+
import { getSaveStyles } from "./styles";
|
|
6
|
+
import { ChangeEditor } from "./components/ChangeEditor/ChangeEditor";
|
|
7
|
+
import { useRecordUpdateServiceController } from "../../services/RecordUpdateService/controllers/useRecordUpdateServiceController";
|
|
8
|
+
|
|
9
|
+
export const Save = () => {
|
|
10
|
+
const grid = useGridInstance();
|
|
11
|
+
const labels = grid.labels;
|
|
12
|
+
const styles = getSaveStyles();
|
|
13
|
+
const { isDirty, updatedRecords, hasInvalidRecords, clearAll } = useRecordUpdateServiceController();
|
|
14
|
+
const { isSaving, saveBtnProps, save } = useSave();
|
|
15
|
+
const [changeEditorOpened, setChangeEditorOpened] = useState<boolean>(false);
|
|
16
|
+
|
|
17
|
+
const onMessageClick = () => {
|
|
18
|
+
console.log('click')
|
|
19
|
+
if (!isDirty) {
|
|
20
|
+
//return;
|
|
21
|
+
}
|
|
22
|
+
setChangeEditorOpened(true);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<>
|
|
27
|
+
<div onClick={onMessageClick} className={styles.root} data-dirty={isDirty}>
|
|
28
|
+
<MessageBar
|
|
29
|
+
messageBarType={!hasInvalidRecords ? MessageBarType.info : MessageBarType.error}
|
|
30
|
+
actions={
|
|
31
|
+
<div className={styles.actions}>
|
|
32
|
+
<CommandBarButton
|
|
33
|
+
text={isSaving ? saveBtnProps.text : undefined}
|
|
34
|
+
disabled={saveBtnProps.disabled}
|
|
35
|
+
onRenderIcon={isSaving ? () => <Spinner size={SpinnerSize.small} /> : undefined}
|
|
36
|
+
iconProps={{
|
|
37
|
+
iconName: saveBtnProps.iconName,
|
|
38
|
+
}}
|
|
39
|
+
onClick={(e) => {
|
|
40
|
+
e.stopPropagation()
|
|
41
|
+
save();
|
|
42
|
+
}}
|
|
43
|
+
/>
|
|
44
|
+
<CommandBarButton
|
|
45
|
+
disabled={saveBtnProps.disabled && !hasInvalidRecords && !grid.props.parameters.ChangeEditorMode}
|
|
46
|
+
iconProps={{
|
|
47
|
+
iconName: 'Delete'
|
|
48
|
+
}}
|
|
49
|
+
onClick={(e) => {
|
|
50
|
+
e.stopPropagation();
|
|
51
|
+
clearAll();
|
|
52
|
+
}}
|
|
53
|
+
/>
|
|
54
|
+
</div>
|
|
55
|
+
} isMultiline={false}>
|
|
56
|
+
{isDirty &&
|
|
57
|
+
<span className={styles.notificationText} dangerouslySetInnerHTML={{
|
|
58
|
+
__html: labels["saving-changenotification"]({ numOfChanges: updatedRecords.length })
|
|
59
|
+
}}></span>
|
|
60
|
+
}
|
|
61
|
+
</MessageBar>
|
|
62
|
+
</div>
|
|
63
|
+
{changeEditorOpened &&
|
|
64
|
+
<ChangeEditor onDismiss={(e) => {
|
|
65
|
+
//@ts-ignore
|
|
66
|
+
if(e?.code === 'Escape') {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
setChangeEditorOpened(false);
|
|
70
|
+
}} />
|
|
71
|
+
}
|
|
72
|
+
</>
|
|
73
|
+
)
|
|
74
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { DialogFooter, FocusTrapZone, ICommandBarItemProps, IDialogProps, PrimaryButton, Spinner, SpinnerSize, useTheme } from "@fluentui/react";
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { useGridInstance } from "../../../../hooks/useGridInstance";
|
|
4
|
+
import { useRecordUpdateServiceController } from "../../../../services/RecordUpdateService/controllers/useRecordUpdateServiceController";
|
|
5
|
+
import { IUpdatedRecord } from "../../../../services/RecordUpdateService/model/RecordUpdateService";
|
|
6
|
+
import { IEntityColumn, IEntityRecord } from "../../../../../interfaces";
|
|
7
|
+
import Dialog from "../../../Dialog";
|
|
8
|
+
import { RecordGrids } from "./components/RecordGrids/RecordGrids";
|
|
9
|
+
import { DataType } from "../../../../enums/DataType";
|
|
10
|
+
import { getChangeEditorStyles } from "./styles";
|
|
11
|
+
import { useSave } from "../../hooks/useSave";
|
|
12
|
+
import React from 'react';
|
|
13
|
+
|
|
14
|
+
export const ChangeEditor = (props: IDialogProps) => {
|
|
15
|
+
const grid = useGridInstance();
|
|
16
|
+
const labels = grid.labels;
|
|
17
|
+
const controller = useRecordUpdateServiceController();
|
|
18
|
+
const { isSaving, saveBtnProps, save } = useSave();
|
|
19
|
+
const updatedRecords = controller.updatedRecords;
|
|
20
|
+
|
|
21
|
+
const styles = getChangeEditorStyles(useTheme());
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (updatedRecords.length === 0) {
|
|
24
|
+
props.onDismiss?.();
|
|
25
|
+
}
|
|
26
|
+
}, [updatedRecords]);
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
return <Dialog
|
|
30
|
+
{...props}
|
|
31
|
+
width={1000}
|
|
32
|
+
minWidth={'80%'}
|
|
33
|
+
modalProps={{
|
|
34
|
+
isBlocking: true,
|
|
35
|
+
className: styles.root,
|
|
36
|
+
layerProps: {
|
|
37
|
+
eventBubblingEnabled: true
|
|
38
|
+
}
|
|
39
|
+
}}
|
|
40
|
+
dialogContentProps={{
|
|
41
|
+
showCloseButton: true,
|
|
42
|
+
title: labels["saving-changepreview-title"]({
|
|
43
|
+
numOfChanges: updatedRecords.length
|
|
44
|
+
})
|
|
45
|
+
}}
|
|
46
|
+
hidden={false}>
|
|
47
|
+
<div className={styles.recordGrids}>
|
|
48
|
+
{updatedRecords.map(record => <RecordGrids key={record.getRecordId()} record={record} />)}
|
|
49
|
+
</div>
|
|
50
|
+
<DialogFooter>
|
|
51
|
+
<PrimaryButton
|
|
52
|
+
className={styles.saveBtn}
|
|
53
|
+
text={saveBtnProps.text}
|
|
54
|
+
disabled={saveBtnProps.disabled}
|
|
55
|
+
onClick={() => save()}
|
|
56
|
+
>
|
|
57
|
+
{isSaving &&
|
|
58
|
+
<Spinner size={SpinnerSize.small} />
|
|
59
|
+
}
|
|
60
|
+
</PrimaryButton>
|
|
61
|
+
</DialogFooter>
|
|
62
|
+
</Dialog>
|
|
63
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Grid } from '../../../../../../../Grid';
|
|
3
|
+
import { useGridInstance } from '../../../../../../hooks/useGridInstance';
|
|
4
|
+
import { IUpdatedRecord } from '../../../../../../services/RecordUpdateService/model/RecordUpdateService';
|
|
5
|
+
import { Text } from '@fluentui/react/lib/Text';
|
|
6
|
+
import { IEntityColumn, IEntityRecord, IGrid, IGridParameters } from '../../../../../../../interfaces';
|
|
7
|
+
import { Icon } from '@fluentui/react/lib/components/Icon/Icon';
|
|
8
|
+
import { getRecordGridStyles } from './styles';
|
|
9
|
+
import { useTheme } from '@fluentui/react';
|
|
10
|
+
|
|
11
|
+
interface IRecordGrids {
|
|
12
|
+
record: IUpdatedRecord;
|
|
13
|
+
}
|
|
14
|
+
export const RecordGrids = (props: IRecordGrids) => {
|
|
15
|
+
const grid = useGridInstance();
|
|
16
|
+
const record = { ...props.record };
|
|
17
|
+
const styles = getRecordGridStyles(useTheme());
|
|
18
|
+
const sharedProps: IGrid = {
|
|
19
|
+
context: grid.pcfContext,
|
|
20
|
+
parameters: {
|
|
21
|
+
EnableFiltering: {
|
|
22
|
+
raw: false
|
|
23
|
+
},
|
|
24
|
+
EnablePagination: {
|
|
25
|
+
raw: false
|
|
26
|
+
},
|
|
27
|
+
EnableSorting: {
|
|
28
|
+
raw: false
|
|
29
|
+
},
|
|
30
|
+
EnableNavigation: {
|
|
31
|
+
raw: false
|
|
32
|
+
},
|
|
33
|
+
IsNested: {
|
|
34
|
+
raw: true
|
|
35
|
+
},
|
|
36
|
+
Grid: {
|
|
37
|
+
...grid.dataset,
|
|
38
|
+
sorting: [],
|
|
39
|
+
columns: [...record.columns.values()],
|
|
40
|
+
filtering: {
|
|
41
|
+
...grid.dataset.filtering,
|
|
42
|
+
getFilter: () => {
|
|
43
|
+
return {
|
|
44
|
+
conditions: [],
|
|
45
|
+
filterOperator: 0,
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
getSelectedRecordIds: () => [],
|
|
50
|
+
paging: {
|
|
51
|
+
...grid.dataset.paging,
|
|
52
|
+
pageSize: 1
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
} as IGridParameters
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const invalidColumns = (() => {
|
|
59
|
+
const columns: IEntityColumn[] = [];
|
|
60
|
+
for(const column of record.columns.values()) {
|
|
61
|
+
if(!record.isValid(column.name)) {
|
|
62
|
+
columns.push(column);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return columns;
|
|
66
|
+
})();
|
|
67
|
+
|
|
68
|
+
const hasInvalidColumn = invalidColumns.length > 0;
|
|
69
|
+
|
|
70
|
+
const getOriginalRecord = (record: IUpdatedRecord): IEntityRecord => {
|
|
71
|
+
return {
|
|
72
|
+
getFormattedValue: (columnKey: string) => record.getOriginalFormattedValue(columnKey),
|
|
73
|
+
getRecordId: () => record.getRecordId(),
|
|
74
|
+
getNamedReference: () => record.getNamedReference(),
|
|
75
|
+
getValue: (columnKey: string) => record.getOriginalValue(columnKey),
|
|
76
|
+
save: async () => {
|
|
77
|
+
const result = await record.save();
|
|
78
|
+
grid.pcfContext.factory.requestRender();
|
|
79
|
+
},
|
|
80
|
+
//only comes when clear is called to return to the original value
|
|
81
|
+
setValue: (columnKey: string, value: any) => {
|
|
82
|
+
record.clear();
|
|
83
|
+
//TODO: the internal record id map wont get updated
|
|
84
|
+
//with the references to updated records until they appear
|
|
85
|
+
//in the grid => you cant see the changes
|
|
86
|
+
grid.pcfContext.factory.requestRender();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const getUpdatedRecord = (record: IUpdatedRecord): IEntityRecord => {
|
|
91
|
+
return {
|
|
92
|
+
getFormattedValue: (columnKey: string) => record.getFormattedValue(columnKey),
|
|
93
|
+
getRecordId: () => record.getRecordId(),
|
|
94
|
+
getNamedReference: () => record.getNamedReference(),
|
|
95
|
+
getValue: (columnKey: string) => record.getValue(columnKey),
|
|
96
|
+
save: () => { throw new Error('Should not be called!') },
|
|
97
|
+
setValue: (columnKey: string, value: any) => {
|
|
98
|
+
record.setValue(columnKey, value)
|
|
99
|
+
grid.pcfContext.factory.requestRender();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<div className={styles.root}>
|
|
106
|
+
<div className={styles.readOnlyGrid}>
|
|
107
|
+
<div className={styles.gridTitleWrapper}>
|
|
108
|
+
<Text title={record.getOriginalFormattedPrimaryNameValue()} variant='large'>{record.getOriginalFormattedPrimaryNameValue()}</Text>
|
|
109
|
+
</div>
|
|
110
|
+
<Grid
|
|
111
|
+
{...sharedProps}
|
|
112
|
+
parameters={{
|
|
113
|
+
...sharedProps.parameters,
|
|
114
|
+
ChangeEditorMode: {
|
|
115
|
+
raw: "read",
|
|
116
|
+
error: hasInvalidColumn,
|
|
117
|
+
},
|
|
118
|
+
Grid: {
|
|
119
|
+
...sharedProps.parameters.Grid,
|
|
120
|
+
error: hasInvalidColumn,
|
|
121
|
+
errorMessage: hasInvalidColumn ? grid.labels['saving-validation-error']({
|
|
122
|
+
columnDisplayNames: invalidColumns.map( x => x.displayName).join(', ')
|
|
123
|
+
}): undefined,
|
|
124
|
+
records: {
|
|
125
|
+
[record.getRecordId()]: getOriginalRecord(record)
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
} as IGridParameters} />
|
|
130
|
+
</div>
|
|
131
|
+
<Icon iconName="DoubleChevronDown8" />
|
|
132
|
+
<div className={styles.editableGrid}>
|
|
133
|
+
<Grid
|
|
134
|
+
{...sharedProps}
|
|
135
|
+
parameters={{
|
|
136
|
+
...sharedProps.parameters,
|
|
137
|
+
ChangeEditorMode: {
|
|
138
|
+
raw: "edit"
|
|
139
|
+
},
|
|
140
|
+
EnableEditing: {
|
|
141
|
+
raw: true
|
|
142
|
+
},
|
|
143
|
+
Grid: {
|
|
144
|
+
...sharedProps.parameters.Grid,
|
|
145
|
+
records: {
|
|
146
|
+
[record.getRecordId()]: getUpdatedRecord(record)
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
} as IGridParameters} />
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
)
|
|
153
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ITheme, mergeStyleSets } from "@fluentui/react";
|
|
2
|
+
|
|
3
|
+
export const getRecordGridStyles = (theme: ITheme) => {
|
|
4
|
+
return mergeStyleSets({
|
|
5
|
+
root: {
|
|
6
|
+
borderRadius: 5,
|
|
7
|
+
padding: 8,
|
|
8
|
+
paddingTop: 10,
|
|
9
|
+
gap: 15,
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexDirection: 'column',
|
|
12
|
+
justifyContent: 'center',
|
|
13
|
+
backgroundColor: theme.semanticColors.bodyBackground,
|
|
14
|
+
boxShadow: theme.semanticColors.cardShadow,
|
|
15
|
+
'>span': {
|
|
16
|
+
fontWeight: 600
|
|
17
|
+
},
|
|
18
|
+
'>i': {
|
|
19
|
+
alignSelf: 'center',
|
|
20
|
+
fontSize: 22,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
},
|
|
24
|
+
readOnlyGrid: {
|
|
25
|
+
'.ag-theme-balham > div > .ms-MessageBar': {
|
|
26
|
+
minHeight: 0,
|
|
27
|
+
height: 0,
|
|
28
|
+
'.ms-MessageBar-actionsSingleLine': {
|
|
29
|
+
position: 'relative',
|
|
30
|
+
top: -28
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
gridTitleWrapper: {
|
|
35
|
+
borderBottom: `1px solid ${theme.semanticColors.bodyDivider}`,
|
|
36
|
+
paddingBottom: 10,
|
|
37
|
+
'>span': {
|
|
38
|
+
fontWeight: 600,
|
|
39
|
+
fontSize: 15,
|
|
40
|
+
overflow: 'hidden',
|
|
41
|
+
whiteSpace: 'nowrap',
|
|
42
|
+
textOverflow: 'ellipsis',
|
|
43
|
+
display: 'block',
|
|
44
|
+
maxWidth: 'calc(100% - 130px)'
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
editableGrid: {
|
|
48
|
+
position: 'relative',
|
|
49
|
+
top: -5
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ITheme, mergeStyleSets } from "@fluentui/react";
|
|
2
|
+
|
|
3
|
+
export const getChangeEditorStyles = (theme: ITheme) => {
|
|
4
|
+
return mergeStyleSets({
|
|
5
|
+
root: {
|
|
6
|
+
'.ag-row': {
|
|
7
|
+
borderBottom: 'none'
|
|
8
|
+
},
|
|
9
|
+
'.ms-Dialog-title': {
|
|
10
|
+
borderBottom: `1px solid ${theme.semanticColors.bodyDivider}`
|
|
11
|
+
},
|
|
12
|
+
'.ms-Dialog-content': {
|
|
13
|
+
backgroundColor: 'var(--talxis-main-bodyBackgroundMain, #faf9f8)'
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
recordGrids: {
|
|
17
|
+
marginTop: 15,
|
|
18
|
+
display: 'flex',
|
|
19
|
+
flexDirection: 'column',
|
|
20
|
+
gap: 15,
|
|
21
|
+
},
|
|
22
|
+
saveBtn: {
|
|
23
|
+
'.ms-Button-flexContainer': {
|
|
24
|
+
gap: 5,
|
|
25
|
+
'>span': {
|
|
26
|
+
order: 2
|
|
27
|
+
},
|
|
28
|
+
'>div': {
|
|
29
|
+
order: 1
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { useGridInstance } from "../../../hooks/useGridInstance";
|
|
3
|
+
import { useRecordUpdateServiceController } from "../../../services/RecordUpdateService/controllers/useRecordUpdateServiceController";
|
|
4
|
+
|
|
5
|
+
interface ISaveBtnProps {
|
|
6
|
+
disabled: boolean,
|
|
7
|
+
text: string,
|
|
8
|
+
iconName: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface ISave {
|
|
12
|
+
isSaving: boolean,
|
|
13
|
+
saveBtnProps: ISaveBtnProps,
|
|
14
|
+
save: () => Promise<boolean>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const useSave = (): ISave => {
|
|
18
|
+
const grid = useGridInstance();
|
|
19
|
+
const labels = grid.labels;
|
|
20
|
+
const controller = useRecordUpdateServiceController();
|
|
21
|
+
const [isSaving, setIsSaving] = useState<boolean>(false);
|
|
22
|
+
|
|
23
|
+
const save = async (): Promise<boolean> => {
|
|
24
|
+
setIsSaving(true);
|
|
25
|
+
const result = await controller.saveAll();
|
|
26
|
+
setIsSaving(false);
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const getSaveBtnProps = (): ISaveBtnProps => {
|
|
31
|
+
if (isSaving) {
|
|
32
|
+
return {
|
|
33
|
+
disabled: true,
|
|
34
|
+
iconName: 'SaveInPropgre',
|
|
35
|
+
text: labels["saving-saving"](),
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (controller.isDirty) {
|
|
39
|
+
return {
|
|
40
|
+
disabled: (controller.hasInvalidRecords || grid.props.parameters.ChangeEditorMode?.error) ? true : false,
|
|
41
|
+
iconName: 'Save',
|
|
42
|
+
text: labels["saving-save"]()
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
disabled: true,
|
|
48
|
+
iconName: 'Save',
|
|
49
|
+
text: labels["saving-save"]()
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
isSaving: isSaving,
|
|
55
|
+
saveBtnProps: getSaveBtnProps(),
|
|
56
|
+
save: save
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { mergeStyleSets } from "@fluentui/react"
|
|
2
|
+
|
|
3
|
+
export const getSaveStyles = () => {
|
|
4
|
+
return mergeStyleSets({
|
|
5
|
+
root: {
|
|
6
|
+
'&[data-dirty="false"]': {
|
|
7
|
+
'.ms-MessageBar': {
|
|
8
|
+
backgroundColor: 'transparent',
|
|
9
|
+
'.ms-MessageBar-icon': {
|
|
10
|
+
display: 'none'
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
'.ms-MessageBar-icon': {
|
|
15
|
+
alignItems: 'center'
|
|
16
|
+
},
|
|
17
|
+
'.ms-MessageBar-actionsSingleLine': {
|
|
18
|
+
marginRight: 0
|
|
19
|
+
},
|
|
20
|
+
'.ms-MessageBar-innerText': {
|
|
21
|
+
textAlign: 'left'
|
|
22
|
+
},
|
|
23
|
+
'&[data-dirty="true"]': {
|
|
24
|
+
cursor: 'pointer'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
notificationText: {
|
|
28
|
+
whiteSpace: 'normal',
|
|
29
|
+
},
|
|
30
|
+
actions: {
|
|
31
|
+
height: '100%',
|
|
32
|
+
'.ms-Button': {
|
|
33
|
+
height: '100%',
|
|
34
|
+
backgroundColor: 'transparent',
|
|
35
|
+
':last-child': {
|
|
36
|
+
marginLeft: 0
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useContext, useEffect, useState } from "react"
|
|
2
|
+
import equal from 'fast-deep-equal/es6';
|
|
3
|
+
import { IEntityRecord } from "../../interfaces";
|
|
4
|
+
import { Grid } from "../model/Grid";
|
|
5
|
+
import { IGridColumn } from "../interfaces/IGridColumn";
|
|
6
|
+
import { GridContext } from "../../Grid";
|
|
7
|
+
|
|
8
|
+
interface IGridController {
|
|
9
|
+
columns: IGridColumn[],
|
|
10
|
+
records: IEntityRecord[]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const useGridController = (gridInstance?: Grid): IGridController => {
|
|
14
|
+
const grid = gridInstance ?? useContext(GridContext).gridInstance;
|
|
15
|
+
const [columns, setColumns] = useState<IGridColumn[]>(grid.columns);
|
|
16
|
+
const [records, setRecords] = useState<IEntityRecord[]>(() => grid.refreshRecords());
|
|
17
|
+
|
|
18
|
+
const getRecordValues = (columns: IGridColumn[], records: IEntityRecord[]) => {
|
|
19
|
+
const newRecordValues = records.map(x => {
|
|
20
|
+
const values = [];
|
|
21
|
+
for(const column of columns) {
|
|
22
|
+
values.push(x.getValue(column.key))
|
|
23
|
+
}
|
|
24
|
+
return values;
|
|
25
|
+
});
|
|
26
|
+
return newRecordValues;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//only change columns and records reference if there is a change
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
(async () => {
|
|
32
|
+
const newColumns = await grid.refreshColumns();
|
|
33
|
+
const newRecordValues = getRecordValues(newColumns, grid.refreshRecords());
|
|
34
|
+
if(!equal(newColumns, columns)) {
|
|
35
|
+
setColumns(newColumns);
|
|
36
|
+
}
|
|
37
|
+
if(!equal(newRecordValues, getRecordValues(newColumns, records))) {
|
|
38
|
+
setRecords(grid.records);
|
|
39
|
+
}
|
|
40
|
+
})();
|
|
41
|
+
}, [grid.shouldRerender]);
|
|
42
|
+
return {
|
|
43
|
+
columns,
|
|
44
|
+
records
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export enum DatasetConditionOperator {
|
|
2
|
+
None = -1,
|
|
3
|
+
Equal = 0,
|
|
4
|
+
NotEqual = 1,
|
|
5
|
+
GreaterThan = 2,
|
|
6
|
+
LessThan = 3,
|
|
7
|
+
GreaterEqual = 4,
|
|
8
|
+
LessEqual = 5,
|
|
9
|
+
Like = 6,
|
|
10
|
+
NotLike = 7,
|
|
11
|
+
In = 8,
|
|
12
|
+
NotIn = 9,
|
|
13
|
+
Null = 12,
|
|
14
|
+
NotNull = 13,
|
|
15
|
+
Yesterday = 14,
|
|
16
|
+
Today = 15,
|
|
17
|
+
Tomorrow = 16,
|
|
18
|
+
Last7Days = 17,
|
|
19
|
+
Next7Days = 18,
|
|
20
|
+
LastWeek = 19,
|
|
21
|
+
ThisWeek = 20,
|
|
22
|
+
LastMonth = 22,
|
|
23
|
+
ThisMonth = 23,
|
|
24
|
+
On = 25,
|
|
25
|
+
OnOrBefore = 26,
|
|
26
|
+
OnOrAfter = 27,
|
|
27
|
+
LastYear = 28,
|
|
28
|
+
ThisYear = 29,
|
|
29
|
+
LastXDays = 33,
|
|
30
|
+
NextXDays = 34,
|
|
31
|
+
LastXMonths = 37,
|
|
32
|
+
NextXMonths = 38,
|
|
33
|
+
Contains = 49,
|
|
34
|
+
BeginWith = 54,
|
|
35
|
+
DoesNotBeginWith = 55,
|
|
36
|
+
EndsWith = 56,
|
|
37
|
+
DoesNotEndWith = 57,
|
|
38
|
+
InFiscalPeriodAndYear = 70,
|
|
39
|
+
Above = 75,
|
|
40
|
+
Under = 76,
|
|
41
|
+
NotUnder = 77,
|
|
42
|
+
AboveOrEqual = 78,
|
|
43
|
+
UnderOrEqual = 79,
|
|
44
|
+
ContainValues = 87,
|
|
45
|
+
DoesNotContainValues = 88
|
|
46
|
+
}
|