@talxis/base-controls 1.2408.1 → 1.2408.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DateTime/DateTime.js +133 -1
- package/dist/components/DateTime/DateTime.js.map +1 -0
- package/dist/components/DateTime/components/Calendar.js +63 -1
- package/dist/components/DateTime/components/Calendar.js.map +1 -0
- package/dist/components/DateTime/hooks/useDateTime.js +137 -1
- package/dist/components/DateTime/hooks/useDateTime.js.map +1 -0
- package/dist/components/DateTime/index.js +3 -1
- package/dist/components/DateTime/index.js.map +1 -0
- package/dist/components/DateTime/styles.js +37 -1
- package/dist/components/DateTime/styles.js.map +1 -0
- package/dist/components/DateTime/translations.js +23 -1
- package/dist/components/DateTime/translations.js.map +1 -0
- package/dist/components/Decimal/Decimal.js +200 -1
- package/dist/components/Decimal/Decimal.js.map +1 -0
- package/dist/components/Decimal/components/ArrowButtons.js +38 -1
- package/dist/components/Decimal/components/ArrowButtons.js.map +1 -0
- package/dist/components/Decimal/components/styles.js +26 -1
- package/dist/components/Decimal/components/styles.js.map +1 -0
- package/dist/components/Decimal/index.js +2 -1
- package/dist/components/Decimal/index.js.map +1 -0
- package/dist/components/Decimal/interfaces.d.ts +1 -1
- package/dist/components/Duration/Duration.js +132 -1
- package/dist/components/Duration/Duration.js.map +1 -0
- package/dist/components/Duration/durationOptions.d.ts +2 -0
- package/dist/components/Duration/durationOptions.js +27 -0
- package/dist/components/Duration/durationOptions.js.map +1 -0
- package/dist/components/Duration/index.js +2 -1
- package/dist/components/Duration/index.js.map +1 -0
- package/dist/components/Duration/translations.js +31 -1
- package/dist/components/Duration/translations.js.map +1 -0
- package/dist/components/Grid/Grid.js +30 -1
- package/dist/components/Grid/Grid.js.map +1 -0
- package/dist/components/Grid/GridContext.js +6 -1
- package/dist/components/Grid/GridContext.js.map +1 -0
- package/dist/components/Grid/constants.js +4 -1
- package/dist/components/Grid/constants.js.map +1 -0
- package/dist/components/Grid/core/components/AgGrid/AgGrid.js +85 -1
- package/dist/components/Grid/core/components/AgGrid/AgGrid.js.map +1 -0
- package/dist/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/EmptyRecords.js +12 -1
- package/dist/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/EmptyRecords.js.map +1 -0
- package/dist/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/styles.js +23 -1
- package/dist/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/styles.js.map +1 -0
- package/dist/components/Grid/core/components/AgGrid/components/LoadingOverlay/LoadingOverlay.js +11 -1
- package/dist/components/Grid/core/components/AgGrid/components/LoadingOverlay/LoadingOverlay.js.map +1 -0
- package/dist/components/Grid/core/components/AgGrid/components/LoadingOverlay/styles.js +82 -1
- package/dist/components/Grid/core/components/AgGrid/components/LoadingOverlay/styles.js.map +1 -0
- package/dist/components/Grid/core/components/AgGrid/controllers/useAgGridController.js +169 -1
- package/dist/components/Grid/core/components/AgGrid/controllers/useAgGridController.js.map +1 -0
- package/dist/components/Grid/core/components/AgGrid/model/AgGrid.js +116 -1
- package/dist/components/Grid/core/components/AgGrid/model/AgGrid.js.map +1 -0
- package/dist/components/Grid/core/components/AgGrid/styles.js +91 -1
- package/dist/components/Grid/core/components/AgGrid/styles.js.map +1 -0
- package/dist/components/Grid/core/components/Cell/Commands/Commands.js +29 -1
- package/dist/components/Grid/core/components/Cell/Commands/Commands.js.map +1 -0
- package/dist/components/Grid/core/components/Cell/Commands/Icon.js +14 -1
- package/dist/components/Grid/core/components/Cell/Commands/Icon.js.map +1 -0
- package/dist/components/Grid/core/components/Cell/Commands/styles.js +54 -1
- package/dist/components/Grid/core/components/Cell/Commands/styles.js.map +1 -0
- package/dist/components/Grid/core/components/Cell/Commands/useCommands.js +52 -1
- package/dist/components/Grid/core/components/Cell/Commands/useCommands.js.map +1 -0
- package/dist/components/Grid/core/components/Cell/EditableCell/EditableCell.js +148 -1
- package/dist/components/Grid/core/components/Cell/EditableCell/EditableCell.js.map +1 -0
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyCell.js +139 -1
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyCell.js.map +1 -0
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyOptionSet/ReadOnlyOptionSet.js +49 -1
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyOptionSet/ReadOnlyOptionSet.js.map +1 -0
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyOptionSet/styles.js +27 -1
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyOptionSet/styles.js.map +1 -0
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/styles.js +58 -1
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/styles.js.map +1 -0
- package/dist/components/Grid/core/components/ColumnHeader/ColumnHeader.js +60 -1
- package/dist/components/Grid/core/components/ColumnHeader/ColumnHeader.js.map +1 -0
- package/dist/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/GlobalCheckbox.js +26 -1
- package/dist/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/GlobalCheckbox.js.map +1 -0
- package/dist/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/styles.js +19 -1
- package/dist/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/styles.js.map +1 -0
- package/dist/components/Grid/core/components/ColumnHeader/styles.js +44 -1
- package/dist/components/Grid/core/components/ColumnHeader/styles.js.map +1 -0
- package/dist/components/Grid/core/components/Component/Component.js +53 -1
- package/dist/components/Grid/core/components/Component/Component.js.map +1 -0
- package/dist/components/Grid/core/components/Component/controller/useComponentController.js +31 -1
- package/dist/components/Grid/core/components/Component/controller/useComponentController.js.map +1 -0
- package/dist/components/Grid/core/components/Component/model/Component.js +225 -1
- package/dist/components/Grid/core/components/Component/model/Component.js.map +1 -0
- package/dist/components/Grid/core/components/Dialog/Constants.js +9 -1
- package/dist/components/Grid/core/components/Dialog/Constants.js.map +1 -0
- package/dist/components/Grid/core/components/Dialog/Styles.js +61 -1
- package/dist/components/Grid/core/components/Dialog/Styles.js.map +1 -0
- package/dist/components/Grid/core/components/Dialog/index.js +16 -1
- package/dist/components/Grid/core/components/Dialog/index.js.map +1 -0
- package/dist/components/Grid/core/components/Dialog/interfaces/index.js +1 -0
- package/dist/components/Grid/core/components/Dialog/interfaces/index.js.map +1 -0
- package/dist/components/Grid/core/components/Save/Save.js +47 -1
- package/dist/components/Grid/core/components/Save/Save.js.map +1 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/ChangeEditor.js +39 -1
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/ChangeEditor.js.map +1 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/RecordGrids.js +136 -1
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/RecordGrids.js.map +1 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/styles.js +54 -1
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/styles.js.map +1 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/styles.js +37 -1
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/styles.js.map +1 -0
- package/dist/components/Grid/core/components/Save/hooks/useSave.js +45 -1
- package/dist/components/Grid/core/components/Save/hooks/useSave.js.map +1 -0
- package/dist/components/Grid/core/components/Save/styles.js +44 -1
- package/dist/components/Grid/core/components/Save/styles.js.map +1 -0
- package/dist/components/Grid/core/controllers/useGridController.js +39 -1
- package/dist/components/Grid/core/controllers/useGridController.js.map +1 -0
- package/dist/components/Grid/core/enums/ConditionOperator.js +50 -1
- package/dist/components/Grid/core/enums/ConditionOperator.js.map +1 -0
- package/dist/components/Grid/core/enums/DataType.js +30 -1
- package/dist/components/Grid/core/enums/DataType.js.map +1 -0
- package/dist/components/Grid/core/hooks/useGridInstance.js +9 -1
- package/dist/components/Grid/core/hooks/useGridInstance.js.map +1 -0
- package/dist/components/Grid/core/hooks/useRefreshCallback.js +20 -1
- package/dist/components/Grid/core/hooks/useRefreshCallback.js.map +1 -0
- package/dist/components/Grid/core/hooks/useRerender.js +13 -1
- package/dist/components/Grid/core/hooks/useRerender.js.map +1 -0
- package/dist/components/Grid/core/model/Grid.js +249 -1
- package/dist/components/Grid/core/model/Grid.js.map +1 -0
- package/dist/components/Grid/core/model/GridDependency.js +28 -1
- package/dist/components/Grid/core/model/GridDependency.js.map +1 -0
- package/dist/components/Grid/core/model/Metadata.js +22 -1
- package/dist/components/Grid/core/model/Metadata.js.map +1 -0
- package/dist/components/Grid/core/services/RecordUpdateService/controllers/useRecordUpdateServiceController.js +25 -1
- package/dist/components/Grid/core/services/RecordUpdateService/controllers/useRecordUpdateServiceController.js.map +1 -0
- package/dist/components/Grid/core/services/RecordUpdateService/model/RecordUpdateService.js +190 -1
- package/dist/components/Grid/core/services/RecordUpdateService/model/RecordUpdateService.js.map +1 -0
- package/dist/components/Grid/filtering/components/FilterCallout/FilterCallout.js +50 -1
- package/dist/components/Grid/filtering/components/FilterCallout/FilterCallout.js.map +1 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionOperator/ConditionOperator.js +58 -1
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionOperator/ConditionOperator.js.map +1 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/ConditionValue.js +52 -1
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/ConditionValue.js.map +1 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/model/ConditionComponentValue.js +125 -1
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/model/ConditionComponentValue.js.map +1 -0
- package/dist/components/Grid/filtering/components/FilterCallout/styles.js +40 -1
- package/dist/components/Grid/filtering/components/FilterCallout/styles.js.map +1 -0
- package/dist/components/Grid/filtering/constants.js +51 -1
- package/dist/components/Grid/filtering/constants.js.map +1 -0
- package/dist/components/Grid/filtering/controller/useColumnFilterConditionController.js +42 -1
- package/dist/components/Grid/filtering/controller/useColumnFilterConditionController.js.map +1 -0
- package/dist/components/Grid/filtering/model/Condition.js +297 -1
- package/dist/components/Grid/filtering/model/Condition.js.map +1 -0
- package/dist/components/Grid/filtering/model/Filtering.js +78 -1
- package/dist/components/Grid/filtering/model/Filtering.js.map +1 -0
- package/dist/components/Grid/filtering/utils/FilteringUtilts.js +195 -1
- package/dist/components/Grid/filtering/utils/FilteringUtilts.js.map +1 -0
- package/dist/components/Grid/index.js +2 -1
- package/dist/components/Grid/index.js.map +1 -0
- package/dist/components/Grid/paging/components/Paging/Paging.js +63 -1
- package/dist/components/Grid/paging/components/Paging/Paging.js.map +1 -0
- package/dist/components/Grid/paging/components/Paging/styles.js +41 -1
- package/dist/components/Grid/paging/components/Paging/styles.js.map +1 -0
- package/dist/components/Grid/paging/controllers/usePagingController.js +23 -1
- package/dist/components/Grid/paging/controllers/usePagingController.js.map +1 -0
- package/dist/components/Grid/paging/model/Paging.js +56 -1
- package/dist/components/Grid/paging/model/Paging.js.map +1 -0
- package/dist/components/Grid/selection/controllers/useSelectionController.js +17 -1
- package/dist/components/Grid/selection/controllers/useSelectionController.js.map +1 -0
- package/dist/components/Grid/selection/model/Selection.js +69 -1
- package/dist/components/Grid/selection/model/Selection.js.map +1 -0
- package/dist/components/Grid/sorting/Sorting.js +33 -1
- package/dist/components/Grid/sorting/Sorting.js.map +1 -0
- package/dist/components/Grid/sorting/components/SortingContextualMenu/SortingContextualMenu.js +120 -1
- package/dist/components/Grid/sorting/components/SortingContextualMenu/SortingContextualMenu.js.map +1 -0
- package/dist/components/Grid/sorting/components/SortingContextualMenu/styles.js +15 -1
- package/dist/components/Grid/sorting/components/SortingContextualMenu/styles.js.map +1 -0
- package/dist/components/Grid/sorting/controllers/useColumnSortingController.js +21 -1
- package/dist/components/Grid/sorting/controllers/useColumnSortingController.js.map +1 -0
- package/dist/components/Grid/translations.js +81 -1
- package/dist/components/Grid/translations.js.map +1 -0
- package/dist/components/Grid/validation/controllers/useRecordValidationController.js +25 -1
- package/dist/components/Grid/validation/controllers/useRecordValidationController.js.map +1 -0
- package/dist/components/Grid/validation/model/ColumnValidation.js +84 -1
- package/dist/components/Grid/validation/model/ColumnValidation.js.map +1 -0
- package/dist/components/Lookup/Lookup.js +201 -1
- package/dist/components/Lookup/Lookup.js.map +1 -0
- package/dist/components/Lookup/components/RecordCreator.js +37 -1
- package/dist/components/Lookup/components/RecordCreator.js.map +1 -0
- package/dist/components/Lookup/components/TargetSelector.js +19 -1
- package/dist/components/Lookup/components/TargetSelector.js.map +1 -0
- package/dist/components/Lookup/hooks/useFetchXml.js +27 -1
- package/dist/components/Lookup/hooks/useFetchXml.js.map +1 -0
- package/dist/components/Lookup/hooks/useLoadedEntities.js +20 -1
- package/dist/components/Lookup/hooks/useLoadedEntities.js.map +1 -0
- package/dist/components/Lookup/hooks/useLookup.js +111 -1
- package/dist/components/Lookup/hooks/useLookup.js.map +1 -0
- package/dist/components/Lookup/index.js +3 -1
- package/dist/components/Lookup/index.js.map +1 -0
- package/dist/components/Lookup/styles.js +98 -1
- package/dist/components/Lookup/styles.js.map +1 -0
- package/dist/components/Lookup/translations.js +33 -1
- package/dist/components/Lookup/translations.js.map +1 -0
- package/dist/components/MultiSelectOptionSet/MultiSelectOptionSet.js +74 -1
- package/dist/components/MultiSelectOptionSet/MultiSelectOptionSet.js.map +1 -0
- package/dist/components/MultiSelectOptionSet/index.js +2 -1
- package/dist/components/MultiSelectOptionSet/index.js.map +1 -0
- package/dist/components/OptionSet/OptionSet.js +61 -1
- package/dist/components/OptionSet/OptionSet.js.map +1 -0
- package/dist/components/OptionSet/index.js +2 -1
- package/dist/components/OptionSet/index.js.map +1 -0
- package/dist/components/TextField/TextField.js +113 -1
- package/dist/components/TextField/TextField.js.map +1 -0
- package/dist/components/TextField/index.js +2 -1
- package/dist/components/TextField/index.js.map +1 -0
- package/dist/components/TwoOptions/TwoOptions.js +36 -1
- package/dist/components/TwoOptions/TwoOptions.js.map +1 -0
- package/dist/components/TwoOptions/index.js +2 -1
- package/dist/components/TwoOptions/index.js.map +1 -0
- package/dist/constants.js +35 -1
- package/dist/constants.js.map +1 -0
- package/dist/hooks/index.js +7 -1
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/useControl.js +95 -1
- package/dist/hooks/useControl.js.map +1 -0
- package/dist/hooks/useControlSizing.js +15 -1
- package/dist/hooks/useControlSizing.js.map +1 -0
- package/dist/hooks/useControlTheme.js +9 -1
- package/dist/hooks/useControlTheme.js.map +1 -0
- package/dist/hooks/useFocusIn.js +33 -1
- package/dist/hooks/useFocusIn.js.map +1 -0
- package/dist/hooks/useInputBasedControl.js +38 -1
- package/dist/hooks/useInputBasedControl.js.map +1 -0
- package/dist/hooks/useMouseOver.js +23 -1
- package/dist/hooks/useMouseOver.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -0
- package/dist/interfaces/index.js +1 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/utils/Numeral.js +64 -1
- package/dist/utils/Numeral.js.map +1 -0
- package/dist/utils/Theme.js +72 -1
- package/dist/utils/Theme.js.map +1 -0
- package/dist/utils/index.js +3 -1
- package/dist/utils/index.js.map +1 -0
- package/package.json +4 -2
- package/dist/Grid-b7e6190d.js +0 -1
- package/dist/components/DateTime/interfaces.js +0 -1
- package/dist/components/Decimal/interfaces.js +0 -1
- package/dist/components/Duration/interfaces.js +0 -1
- package/dist/components/Grid/core/interfaces/IGridColumn.js +0 -1
- package/dist/components/Grid/core/interfaces/IGridContext.js +0 -1
- package/dist/components/Grid/interfaces.js +0 -1
- package/dist/components/Lookup/interfaces.js +0 -1
- package/dist/components/MultiSelectOptionSet/interfaces.js +0 -1
- package/dist/components/OptionSet/interfaces.js +0 -1
- package/dist/components/TextField/interfaces.js +0 -1
- package/dist/components/TwoOptions/interfaces.js +0 -1
- package/dist/interfaces/context.js +0 -1
- package/dist/interfaces/parameters.js +0 -1
- package/dist/interfaces/property.js +0 -1
- package/dist/interfaces/theme.js +0 -1
|
@@ -1 +1,39 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useTheme, DialogFooter, PrimaryButton, Spinner, SpinnerSize } from '@fluentui/react';
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { useGridInstance } from '../../../../hooks/useGridInstance.js';
|
|
5
|
+
import { useRecordUpdateServiceController } from '../../../../services/RecordUpdateService/controllers/useRecordUpdateServiceController.js';
|
|
6
|
+
import Dialog from '../../../Dialog/index.js';
|
|
7
|
+
import { RecordGrids } from './components/RecordGrids/RecordGrids.js';
|
|
8
|
+
import { getChangeEditorStyles } from './styles.js';
|
|
9
|
+
import { useSave } from '../../hooks/useSave.js';
|
|
10
|
+
|
|
11
|
+
const ChangeEditor = (props) => {
|
|
12
|
+
const grid = useGridInstance();
|
|
13
|
+
const labels = grid.labels;
|
|
14
|
+
const controller = useRecordUpdateServiceController();
|
|
15
|
+
const { isSaving, saveBtnProps, save } = useSave();
|
|
16
|
+
const updatedRecords = controller.updatedRecords;
|
|
17
|
+
const styles = getChangeEditorStyles(useTheme());
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (updatedRecords.length === 0) {
|
|
20
|
+
props.onDismiss?.();
|
|
21
|
+
}
|
|
22
|
+
}, [updatedRecords]);
|
|
23
|
+
return jsxs(Dialog, { ...props, width: 1000, minWidth: '80%', modalProps: {
|
|
24
|
+
isBlocking: true,
|
|
25
|
+
className: styles.root,
|
|
26
|
+
layerProps: {
|
|
27
|
+
eventBubblingEnabled: true
|
|
28
|
+
}
|
|
29
|
+
}, dialogContentProps: {
|
|
30
|
+
showCloseButton: true,
|
|
31
|
+
title: labels["saving-changepreview-title"]({
|
|
32
|
+
numOfChanges: updatedRecords.length
|
|
33
|
+
})
|
|
34
|
+
}, hidden: false, children: [jsx("div", { className: styles.recordGrids, children: updatedRecords.map(record => jsx(RecordGrids, { record: record }, record.getRecordId())) }), jsx(DialogFooter, { children: jsx(PrimaryButton, { className: styles.saveBtn, text: saveBtnProps.text, disabled: saveBtnProps.disabled, onClick: () => save(), children: isSaving &&
|
|
35
|
+
jsx(Spinner, { size: SpinnerSize.small }) }) })] });
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { ChangeEditor };
|
|
39
|
+
//# sourceMappingURL=ChangeEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChangeEditor.js","sources":["../../../../../../../../src/components/Grid/core/components/Save/components/ChangeEditor/ChangeEditor.tsx"],"sourcesContent":["import { DialogFooter, FocusTrapZone, ICommandBarItemProps, IDialogProps, PrimaryButton, Spinner, SpinnerSize, useTheme } from \"@fluentui/react\";\nimport { useEffect } from 'react';\nimport { useGridInstance } from \"../../../../hooks/useGridInstance\";\nimport { useRecordUpdateServiceController } from \"../../../../services/RecordUpdateService/controllers/useRecordUpdateServiceController\";\nimport { IUpdatedRecord } from \"../../../../services/RecordUpdateService/model/RecordUpdateService\";\nimport { IEntityColumn, IEntityRecord } from \"../../../../../interfaces\";\nimport Dialog from \"../../../Dialog\";\nimport { RecordGrids } from \"./components/RecordGrids/RecordGrids\";\nimport { DataType } from \"../../../../enums/DataType\";\nimport { getChangeEditorStyles } from \"./styles\";\nimport { useSave } from \"../../hooks/useSave\";\nimport React from 'react';\n\nexport const ChangeEditor = (props: IDialogProps) => {\n const grid = useGridInstance();\n const labels = grid.labels;\n const controller = useRecordUpdateServiceController();\n const { isSaving, saveBtnProps, save } = useSave();\n const updatedRecords = controller.updatedRecords;\n\n const styles = getChangeEditorStyles(useTheme());\n useEffect(() => {\n if (updatedRecords.length === 0) {\n props.onDismiss?.();\n }\n }, [updatedRecords]);\n\n\n return <Dialog\n {...props}\n width={1000}\n minWidth={'80%'}\n modalProps={{\n isBlocking: true,\n className: styles.root,\n layerProps: {\n eventBubblingEnabled: true\n }\n }}\n dialogContentProps={{\n showCloseButton: true,\n title: labels[\"saving-changepreview-title\"]({\n numOfChanges: updatedRecords.length\n })\n }}\n hidden={false}>\n <div className={styles.recordGrids}>\n {updatedRecords.map(record => <RecordGrids key={record.getRecordId()} record={record} />)}\n </div>\n <DialogFooter>\n <PrimaryButton\n className={styles.saveBtn}\n text={saveBtnProps.text}\n disabled={saveBtnProps.disabled}\n onClick={() => save()}\n >\n {isSaving &&\n <Spinner size={SpinnerSize.small} />\n }\n </PrimaryButton>\n </DialogFooter>\n </Dialog>\n}"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;AAaa,MAAA,YAAY,GAAG,CAAC,KAAmB,KAAI;AAChD,IAAA,MAAM,IAAI,GAAG,eAAe,EAAE,CAAC;AAC/B,IAAA,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;AAC3B,IAAA,MAAM,UAAU,GAAG,gCAAgC,EAAE,CAAC;IACtD,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC;AACnD,IAAA,MAAM,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;AAEjD,IAAA,MAAM,MAAM,GAAG,qBAAqB,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjD,SAAS,CAAC,MAAK;AACX,QAAA,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;AAC7B,YAAA,KAAK,CAAC,SAAS,IAAI,CAAC;AACvB,SAAA;AACL,KAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;AAGrB,IAAA,OAAOA,IAAC,CAAA,MAAM,EACN,EAAA,GAAA,KAAK,EACT,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,KAAK,EACf,UAAU,EAAE;AACR,YAAA,UAAU,EAAE,IAAI;YAChB,SAAS,EAAE,MAAM,CAAC,IAAI;AACtB,YAAA,UAAU,EAAE;AACR,gBAAA,oBAAoB,EAAE,IAAI;AAC7B,aAAA;AACJ,SAAA,EACD,kBAAkB,EAAE;AAChB,YAAA,eAAe,EAAE,IAAI;AACrB,YAAA,KAAK,EAAE,MAAM,CAAC,4BAA4B,CAAC,CAAC;gBACxC,YAAY,EAAE,cAAc,CAAC,MAAM;aACtC,CAAC;AACL,SAAA,EACD,MAAM,EAAE,KAAK,EAAA,QAAA,EAAA,CACTC,GAAK,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,MAAM,CAAC,WAAW,EAC7B,QAAA,EAAA,cAAc,CAAC,GAAG,CAAC,MAAM,IAAIA,GAAC,CAAA,WAAW,IAA4B,MAAM,EAAE,MAAM,EAAA,EAApC,MAAM,CAAC,WAAW,EAAE,CAAoB,CAAC,EAAA,CACvF,EACVA,GAAA,CAAC,YAAY,EAAA,EAAA,QAAA,EACTA,GAAC,CAAA,aAAa,EACV,EAAA,SAAS,EAAE,MAAM,CAAC,OAAO,EACzB,IAAI,EAAE,YAAY,CAAC,IAAI,EACvB,QAAQ,EAAE,YAAY,CAAC,QAAQ,EAC/B,OAAO,EAAE,MAAM,IAAI,EAAE,YAEpB,QAAQ;wBACLA,GAAC,CAAA,OAAO,EAAC,EAAA,IAAI,EAAE,WAAW,CAAC,KAAK,EAAI,CAAA,EAAA,CAE5B,EACL,CAAA,CAAA,EAAA,CACV,CAAA;AACb;;;;"}
|
|
@@ -1 +1,136 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Grid } from '../../../../../../../Grid.js';
|
|
3
|
+
import { useGridInstance } from '../../../../../../hooks/useGridInstance.js';
|
|
4
|
+
import { useTheme, Text, Icon } from '@fluentui/react';
|
|
5
|
+
import { getRecordGridStyles } from './styles.js';
|
|
6
|
+
|
|
7
|
+
const RecordGrids = (props) => {
|
|
8
|
+
const grid = useGridInstance();
|
|
9
|
+
const record = { ...props.record };
|
|
10
|
+
const styles = getRecordGridStyles(useTheme());
|
|
11
|
+
const sharedProps = {
|
|
12
|
+
context: {
|
|
13
|
+
...grid.pcfContext,
|
|
14
|
+
mode: {
|
|
15
|
+
...grid.pcfContext.mode,
|
|
16
|
+
//needed so the nested grids to do not interfere with the state of parent grid
|
|
17
|
+
setControlState: (state) => false
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
state: {},
|
|
21
|
+
parameters: {
|
|
22
|
+
EnableFiltering: {
|
|
23
|
+
raw: false
|
|
24
|
+
},
|
|
25
|
+
EnablePagination: {
|
|
26
|
+
raw: false
|
|
27
|
+
},
|
|
28
|
+
EnableSorting: {
|
|
29
|
+
raw: false
|
|
30
|
+
},
|
|
31
|
+
EnableNavigation: {
|
|
32
|
+
raw: false
|
|
33
|
+
},
|
|
34
|
+
SelectableRows: {
|
|
35
|
+
type: 'static',
|
|
36
|
+
raw: 'none'
|
|
37
|
+
},
|
|
38
|
+
Grid: {
|
|
39
|
+
...grid.dataset,
|
|
40
|
+
sorting: [],
|
|
41
|
+
columns: [...record.columns.values()],
|
|
42
|
+
filtering: {
|
|
43
|
+
...grid.dataset.filtering,
|
|
44
|
+
getFilter: () => {
|
|
45
|
+
return {
|
|
46
|
+
conditions: [],
|
|
47
|
+
filterOperator: 0,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
getSelectedRecordIds: () => [],
|
|
52
|
+
paging: {
|
|
53
|
+
...grid.dataset.paging,
|
|
54
|
+
pageSize: 1
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const invalidColumns = (() => {
|
|
60
|
+
const columns = [];
|
|
61
|
+
for (const column of record.columns.values()) {
|
|
62
|
+
if (!record.isValid(column.name)) {
|
|
63
|
+
columns.push(column);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return columns;
|
|
67
|
+
})();
|
|
68
|
+
const hasInvalidColumn = invalidColumns.length > 0;
|
|
69
|
+
const getOriginalRecord = (record) => {
|
|
70
|
+
return {
|
|
71
|
+
getFormattedValue: (columnKey) => record.getOriginalFormattedValue(columnKey),
|
|
72
|
+
getRecordId: () => record.getRecordId(),
|
|
73
|
+
getNamedReference: () => record.getNamedReference(),
|
|
74
|
+
getValue: (columnKey) => record.getOriginalValue(columnKey),
|
|
75
|
+
save: async () => {
|
|
76
|
+
await record.save();
|
|
77
|
+
grid.pcfContext.factory.requestRender();
|
|
78
|
+
},
|
|
79
|
+
//only comes when clear is called to return to the original value
|
|
80
|
+
setValue: (columnKey, value) => {
|
|
81
|
+
record.clear();
|
|
82
|
+
//TODO: the internal record id map wont get updated
|
|
83
|
+
//with the references to updated records until they appear
|
|
84
|
+
//in the grid => you cant see the changes
|
|
85
|
+
grid.pcfContext.factory.requestRender();
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
const getUpdatedRecord = (record) => {
|
|
90
|
+
return {
|
|
91
|
+
getFormattedValue: (columnKey) => record.getFormattedValue(columnKey),
|
|
92
|
+
getRecordId: () => record.getRecordId(),
|
|
93
|
+
getNamedReference: () => record.getNamedReference(),
|
|
94
|
+
getValue: (columnKey) => record.getValue(columnKey),
|
|
95
|
+
save: () => { throw new Error('Should not be called!'); },
|
|
96
|
+
setValue: (columnKey, value) => {
|
|
97
|
+
record.setValue(columnKey, value);
|
|
98
|
+
grid.pcfContext.factory.requestRender();
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
return (jsxs("div", { className: styles.root, children: [jsxs("div", { className: styles.readOnlyGrid, children: [jsx("div", { className: styles.gridTitleWrapper, children: jsx(Text, { title: record.getOriginalFormattedPrimaryNameValue(), variant: 'large', children: record.getOriginalFormattedPrimaryNameValue() }) }), jsx(Grid, { ...sharedProps, parameters: {
|
|
103
|
+
...sharedProps.parameters,
|
|
104
|
+
ChangeEditorMode: {
|
|
105
|
+
raw: "read",
|
|
106
|
+
error: hasInvalidColumn,
|
|
107
|
+
},
|
|
108
|
+
Grid: {
|
|
109
|
+
...sharedProps.parameters.Grid,
|
|
110
|
+
error: hasInvalidColumn,
|
|
111
|
+
errorMessage: hasInvalidColumn ? grid.labels['saving-validation-error']({
|
|
112
|
+
columnDisplayNames: invalidColumns.map(x => x.displayName).join(', ')
|
|
113
|
+
}) : undefined,
|
|
114
|
+
records: {
|
|
115
|
+
[record.getRecordId()]: getOriginalRecord(record)
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
} })] }), jsx(Icon, { iconName: "DoubleChevronDown8" }), jsx("div", { className: styles.editableGrid, children: jsx(Grid, { ...sharedProps, parameters: {
|
|
119
|
+
...sharedProps.parameters,
|
|
120
|
+
ChangeEditorMode: {
|
|
121
|
+
raw: "edit"
|
|
122
|
+
},
|
|
123
|
+
EnableEditing: {
|
|
124
|
+
raw: true
|
|
125
|
+
},
|
|
126
|
+
Grid: {
|
|
127
|
+
...sharedProps.parameters.Grid,
|
|
128
|
+
records: {
|
|
129
|
+
[record.getRecordId()]: getUpdatedRecord(record)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
} }) })] }));
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export { RecordGrids };
|
|
136
|
+
//# sourceMappingURL=RecordGrids.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecordGrids.js","sources":["../../../../../../../../../../src/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/RecordGrids.tsx"],"sourcesContent":["import React from 'react';\nimport { Grid } from '../../../../../../../Grid';\nimport { useGridInstance } from '../../../../../../hooks/useGridInstance';\nimport { IUpdatedRecord } from '../../../../../../services/RecordUpdateService/model/RecordUpdateService';\nimport { Text } from '@fluentui/react';\nimport { IEntityColumn, IEntityRecord, IGrid, IGridParameters } from '../../../../../../../interfaces';\nimport { Icon } from '@fluentui/react';\nimport { getRecordGridStyles } from './styles';\nimport { useTheme } from '@fluentui/react';\n\ninterface IRecordGrids {\n record: IUpdatedRecord;\n}\nexport const RecordGrids = (props: IRecordGrids) => {\n const grid = useGridInstance();\n const record = { ...props.record };\n const styles = getRecordGridStyles(useTheme());\n const sharedProps: IGrid = {\n context: {\n ...grid.pcfContext,\n mode: {\n ...grid.pcfContext.mode,\n //needed so the nested grids to do not interfere with the state of parent grid\n setControlState: (state: ComponentFramework.Dictionary) => false\n }\n },\n state: {},\n parameters: {\n EnableFiltering: {\n raw: false\n },\n EnablePagination: {\n raw: false\n },\n EnableSorting: {\n raw: false\n },\n EnableNavigation: {\n raw: false\n },\n SelectableRows: {\n type: 'static',\n raw: 'none'\n },\n Grid: {\n ...grid.dataset,\n sorting: [],\n columns: [...record.columns.values()],\n filtering: {\n ...grid.dataset.filtering,\n getFilter: () => {\n return {\n conditions: [],\n filterOperator: 0,\n }\n }\n },\n getSelectedRecordIds: () => [],\n paging: {\n ...grid.dataset.paging,\n pageSize: 1\n }\n }\n } as IGridParameters\n }\n\n const invalidColumns = (() => {\n const columns: IEntityColumn[] = [];\n for(const column of record.columns.values()) {\n if(!record.isValid(column.name)) {\n columns.push(column);\n }\n }\n return columns;\n })();\n\n const hasInvalidColumn = invalidColumns.length > 0;\n\n const getOriginalRecord = (record: IUpdatedRecord): IEntityRecord => {\n return {\n getFormattedValue: (columnKey: string) => record.getOriginalFormattedValue(columnKey),\n getRecordId: () => record.getRecordId(),\n getNamedReference: () => record.getNamedReference(),\n getValue: (columnKey: string) => record.getOriginalValue(columnKey),\n save: async () => {\n const result = await record.save();\n grid.pcfContext.factory.requestRender();\n },\n //only comes when clear is called to return to the original value\n setValue: (columnKey: string, value: any) => {\n record.clear();\n //TODO: the internal record id map wont get updated\n //with the references to updated records until they appear \n //in the grid => you cant see the changes \n grid.pcfContext.factory.requestRender();\n }\n }\n }\n const getUpdatedRecord = (record: IUpdatedRecord): IEntityRecord => {\n return {\n getFormattedValue: (columnKey: string) => record.getFormattedValue(columnKey),\n getRecordId: () => record.getRecordId(),\n getNamedReference: () => record.getNamedReference(),\n getValue: (columnKey: string) => record.getValue(columnKey),\n save: () => { throw new Error('Should not be called!') },\n setValue: (columnKey: string, value: any) => {\n record.setValue(columnKey, value)\n grid.pcfContext.factory.requestRender();\n }\n }\n }\n\n return (\n <div className={styles.root}>\n <div className={styles.readOnlyGrid}>\n <div className={styles.gridTitleWrapper}>\n <Text title={record.getOriginalFormattedPrimaryNameValue()} variant='large'>{record.getOriginalFormattedPrimaryNameValue()}</Text>\n </div>\n <Grid\n {...sharedProps}\n parameters={{\n ...sharedProps.parameters,\n ChangeEditorMode: {\n raw: \"read\",\n error: hasInvalidColumn,\n },\n Grid: {\n ...sharedProps.parameters.Grid,\n error: hasInvalidColumn,\n errorMessage: hasInvalidColumn ? grid.labels['saving-validation-error']({\n columnDisplayNames: invalidColumns.map( x => x.displayName).join(', ')\n }): undefined,\n records: {\n [record.getRecordId()]: getOriginalRecord(record)\n }\n },\n\n } as IGridParameters} />\n </div>\n <Icon iconName=\"DoubleChevronDown8\" />\n <div className={styles.editableGrid}>\n <Grid\n {...sharedProps}\n parameters={{\n ...sharedProps.parameters,\n ChangeEditorMode: {\n raw: \"edit\"\n },\n EnableEditing: {\n raw: true\n },\n Grid: {\n ...sharedProps.parameters.Grid,\n records: {\n [record.getRecordId()]: getUpdatedRecord(record)\n }\n }\n } as IGridParameters} />\n </div>\n </div>\n )\n}"],"names":["_jsxs","_jsx"],"mappings":";;;;;;AAaa,MAAA,WAAW,GAAG,CAAC,KAAmB,KAAI;AAC/C,IAAA,MAAM,IAAI,GAAG,eAAe,EAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;AACnC,IAAA,MAAM,MAAM,GAAG,mBAAmB,CAAC,QAAQ,EAAE,CAAC,CAAC;AAC/C,IAAA,MAAM,WAAW,GAAU;AACvB,QAAA,OAAO,EAAE;YACL,GAAG,IAAI,CAAC,UAAU;AAClB,YAAA,IAAI,EAAE;AACF,gBAAA,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI;;AAEvB,gBAAA,eAAe,EAAE,CAAC,KAAoC,KAAK,KAAK;AAC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G,iBAAiB,CAAC,MAAM,CAAC;AACpD,iCAAA;AACJ,6BAAA;yBAEe,EAAI,CAAA,CAAA,EAAA,CAC1B,EACNA,GAAC,CAAA,IAAI,IAAC,QAAQ,EAAC,oBAAoB,EAAA,CAAG,EACtCA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,YAAY,EAC/B,QAAA,EAAAA,GAAA,CAAC,IAAI,EACG,EAAA,GAAA,WAAW,EACf,UAAU,EAAE;wBACR,GAAG,WAAW,CAAC,UAAU;AACzB,wBAAA,gBAAgB,EAAE;AACd,4BAAA,GAAG,EAAE,MAAM;AACd,yBAAA;AACD,wBAAA,aAAa,EAAE;AACX,4BAAA,GAAG,EAAE,IAAI;AACZ,yBAAA;AACD,wBAAA,IAAI,EAAE;AACF,4BAAA,GAAG,WAAW,CAAC,UAAU,CAAC,IAAI;AAC9B,4BAAA,OAAO,EAAE;gCACL,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,gBAAgB,CAAC,MAAM,CAAC;AACnD,6BAAA;AACJ,yBAAA;qBACe,EAAI,CAAA,EAAA,CAC1B,CACJ,EAAA,CAAA,EACT;AACL;;;;"}
|
|
@@ -1 +1,54 @@
|
|
|
1
|
-
import{mergeStyleSets
|
|
1
|
+
import { mergeStyleSets } from '@fluentui/react';
|
|
2
|
+
|
|
3
|
+
const getRecordGridStyles = (theme) => {
|
|
4
|
+
return mergeStyleSets({
|
|
5
|
+
root: {
|
|
6
|
+
borderRadius: 5,
|
|
7
|
+
padding: 8,
|
|
8
|
+
paddingTop: 10,
|
|
9
|
+
gap: 25,
|
|
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
|
+
readOnlyGrid: {
|
|
24
|
+
'.ag-theme-balham > div > .ms-MessageBar': {
|
|
25
|
+
minHeight: 0,
|
|
26
|
+
height: 0,
|
|
27
|
+
'.ms-MessageBar-actionsSingleLine': {
|
|
28
|
+
position: 'relative',
|
|
29
|
+
top: -28
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
gridTitleWrapper: {
|
|
34
|
+
borderBottom: `1px solid ${theme.semanticColors.bodyDivider}`,
|
|
35
|
+
paddingBottom: 10,
|
|
36
|
+
'>span': {
|
|
37
|
+
fontWeight: 600,
|
|
38
|
+
fontSize: 15,
|
|
39
|
+
overflow: 'hidden',
|
|
40
|
+
whiteSpace: 'nowrap',
|
|
41
|
+
textOverflow: 'ellipsis',
|
|
42
|
+
display: 'block',
|
|
43
|
+
maxWidth: 'calc(100% - 130px)'
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
editableGrid: {
|
|
47
|
+
position: 'relative',
|
|
48
|
+
top: -5
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export { getRecordGridStyles };
|
|
54
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../../../../../../../src/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/styles.ts"],"sourcesContent":["import { ITheme, mergeStyleSets } from \"@fluentui/react\";\n\nexport const getRecordGridStyles = (theme: ITheme) => {\n return mergeStyleSets({\n root: {\n borderRadius: 5,\n padding: 8,\n paddingTop: 10,\n gap: 25,\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n backgroundColor: theme.semanticColors.bodyBackground,\n boxShadow: theme.semanticColors.cardShadow,\n '>span': {\n fontWeight: 600\n },\n '>i': {\n alignSelf: 'center',\n fontSize: 22,\n }\n\n },\n readOnlyGrid: {\n '.ag-theme-balham > div > .ms-MessageBar': {\n minHeight: 0,\n height: 0,\n '.ms-MessageBar-actionsSingleLine': {\n position: 'relative',\n top: -28\n }\n }\n },\n gridTitleWrapper: {\n borderBottom: `1px solid ${theme.semanticColors.bodyDivider}`,\n paddingBottom: 10,\n '>span': {\n fontWeight: 600,\n fontSize: 15,\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n display: 'block',\n maxWidth: 'calc(100% - 130px)'\n },\n },\n editableGrid: {\n position: 'relative',\n top: -5\n }\n })\n}"],"names":[],"mappings":";;AAEa,MAAA,mBAAmB,GAAG,CAAC,KAAa,KAAI;AACjD,IAAA,OAAO,cAAc,CAAC;AAClB,QAAA,IAAI,EAAE;AACF,YAAA,YAAY,EAAE,CAAC;AACf,YAAA,OAAO,EAAE,CAAC;AACV,YAAA,UAAU,EAAE,EAAE;AACd,YAAA,GAAG,EAAE,EAAE;AACP,YAAA,OAAO,EAAE,MAAM;AACf,YAAA,aAAa,EAAE,QAAQ;AACvB,YAAA,cAAc,EAAE,QAAQ;AACxB,YAAA,eAAe,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc;AACpD,YAAA,SAAS,EAAE,KAAK,CAAC,cAAc,CAAC,UAAU;AAC1C,YAAA,OAAO,EAAE;AACL,gBAAA,UAAU,EAAE,GAAG;AAClB,aAAA;AACD,YAAA,IAAI,EAAE;AACF,gBAAA,SAAS,EAAE,QAAQ;AACnB,gBAAA,QAAQ,EAAE,EAAE;AACf,aAAA;AAEJ,SAAA;AACD,QAAA,YAAY,EAAE;AACV,YAAA,yCAAyC,EAAE;AACvC,gBAAA,SAAS,EAAE,CAAC;AACZ,gBAAA,MAAM,EAAE,CAAC;AACT,gBAAA,kCAAkC,EAAE;AAChC,oBAAA,QAAQ,EAAE,UAAU;oBACpB,GAAG,EAAE,CAAC,EAAE;AACX,iBAAA;AACJ,aAAA;AACJ,SAAA;AACD,QAAA,gBAAgB,EAAE;AACd,YAAA,YAAY,EAAE,CAAa,UAAA,EAAA,KAAK,CAAC,cAAc,CAAC,WAAW,CAAE,CAAA;AAC7D,YAAA,aAAa,EAAE,EAAE;AACjB,YAAA,OAAO,EAAE;AACL,gBAAA,UAAU,EAAE,GAAG;AACf,gBAAA,QAAQ,EAAE,EAAE;AACZ,gBAAA,QAAQ,EAAE,QAAQ;AAClB,gBAAA,UAAU,EAAE,QAAQ;AACpB,gBAAA,YAAY,EAAE,UAAU;AACxB,gBAAA,OAAO,EAAE,OAAO;AAChB,gBAAA,QAAQ,EAAE,oBAAoB;AACjC,aAAA;AACJ,SAAA;AACD,QAAA,YAAY,EAAE;AACV,YAAA,QAAQ,EAAE,UAAU;YACpB,GAAG,EAAE,CAAC,CAAC;AACV,SAAA;AACJ,KAAA,CAAC,CAAA;AACN;;;;"}
|
|
@@ -1 +1,37 @@
|
|
|
1
|
-
import{mergeStyleSets
|
|
1
|
+
import { mergeStyleSets } from '@fluentui/react';
|
|
2
|
+
|
|
3
|
+
const getChangeEditorStyles = (theme) => {
|
|
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
|
+
};
|
|
35
|
+
|
|
36
|
+
export { getChangeEditorStyles };
|
|
37
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../../../../../src/components/Grid/core/components/Save/components/ChangeEditor/styles.ts"],"sourcesContent":["import { ITheme, mergeStyleSets } from \"@fluentui/react\";\n\nexport const getChangeEditorStyles = (theme: ITheme) => {\n return mergeStyleSets({\n root: {\n '.ag-row': {\n borderBottom: 'none'\n },\n '.ms-Dialog-title': {\n borderBottom: `1px solid ${theme.semanticColors.bodyDivider}`\n },\n '.ms-Dialog-content': {\n backgroundColor: 'var(--talxis-main-bodyBackgroundMain, #faf9f8)'\n }\n },\n recordGrids: {\n marginTop: 15,\n display: 'flex',\n flexDirection: 'column',\n gap: 15,\n },\n saveBtn: {\n '.ms-Button-flexContainer': {\n gap: 5,\n '>span': {\n order: 2\n },\n '>div': {\n order: 1\n }\n }\n }\n })\n}"],"names":[],"mappings":";;AAEa,MAAA,qBAAqB,GAAG,CAAC,KAAa,KAAI;AACnD,IAAA,OAAO,cAAc,CAAC;AAClB,QAAA,IAAI,EAAE;AACF,YAAA,SAAS,EAAE;AACP,gBAAA,YAAY,EAAE,MAAM;AACvB,aAAA;AACD,YAAA,kBAAkB,EAAE;AAChB,gBAAA,YAAY,EAAE,CAAa,UAAA,EAAA,KAAK,CAAC,cAAc,CAAC,WAAW,CAAE,CAAA;AAChE,aAAA;AACD,YAAA,oBAAoB,EAAE;AAClB,gBAAA,eAAe,EAAE,gDAAgD;AACpE,aAAA;AACJ,SAAA;AACD,QAAA,WAAW,EAAE;AACT,YAAA,SAAS,EAAE,EAAE;AACb,YAAA,OAAO,EAAE,MAAM;AACf,YAAA,aAAa,EAAE,QAAQ;AACvB,YAAA,GAAG,EAAE,EAAE;AACV,SAAA;AACD,QAAA,OAAO,EAAE;AACL,YAAA,0BAA0B,EAAE;AACxB,gBAAA,GAAG,EAAE,CAAC;AACN,gBAAA,OAAO,EAAE;AACL,oBAAA,KAAK,EAAE,CAAC;AACX,iBAAA;AACD,gBAAA,MAAM,EAAE;AACJ,oBAAA,KAAK,EAAE,CAAC;AACX,iBAAA;AACJ,aAAA;AACJ,SAAA;AACJ,KAAA,CAAC,CAAA;AACN;;;;"}
|
|
@@ -1 +1,45 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { useGridInstance } from '../../../hooks/useGridInstance.js';
|
|
3
|
+
import { useRecordUpdateServiceController } from '../../../services/RecordUpdateService/controllers/useRecordUpdateServiceController.js';
|
|
4
|
+
|
|
5
|
+
const useSave = () => {
|
|
6
|
+
const grid = useGridInstance();
|
|
7
|
+
const labels = grid.labels;
|
|
8
|
+
const controller = useRecordUpdateServiceController();
|
|
9
|
+
const [isSaving, setIsSaving] = useState(false);
|
|
10
|
+
const save = async () => {
|
|
11
|
+
setIsSaving(true);
|
|
12
|
+
const result = await controller.saveAll();
|
|
13
|
+
setIsSaving(false);
|
|
14
|
+
return result;
|
|
15
|
+
};
|
|
16
|
+
const getSaveBtnProps = () => {
|
|
17
|
+
if (isSaving) {
|
|
18
|
+
return {
|
|
19
|
+
disabled: true,
|
|
20
|
+
iconName: 'SaveInPropgre',
|
|
21
|
+
text: labels["saving-saving"](),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
if (controller.isDirty) {
|
|
25
|
+
return {
|
|
26
|
+
disabled: (controller.hasInvalidRecords || grid.props.parameters.ChangeEditorMode?.error) ? true : false,
|
|
27
|
+
iconName: 'Save',
|
|
28
|
+
text: labels["saving-save"]()
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
disabled: true,
|
|
33
|
+
iconName: 'Save',
|
|
34
|
+
text: labels["saving-save"]()
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
isSaving: isSaving,
|
|
39
|
+
saveBtnProps: getSaveBtnProps(),
|
|
40
|
+
save: save
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { useSave };
|
|
45
|
+
//# sourceMappingURL=useSave.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSave.js","sources":["../../../../../../../src/components/Grid/core/components/Save/hooks/useSave.ts"],"sourcesContent":["import { useState } from \"react\";\nimport { useGridInstance } from \"../../../hooks/useGridInstance\";\nimport { useRecordUpdateServiceController } from \"../../../services/RecordUpdateService/controllers/useRecordUpdateServiceController\";\n\ninterface ISaveBtnProps {\n disabled: boolean,\n text: string,\n iconName: string\n}\n\ninterface ISave {\n isSaving: boolean,\n saveBtnProps: ISaveBtnProps,\n save: () => Promise<boolean>\n}\n\nexport const useSave = (): ISave => {\n const grid = useGridInstance();\n const labels = grid.labels;\n const controller = useRecordUpdateServiceController();\n const [isSaving, setIsSaving] = useState<boolean>(false);\n\n const save = async (): Promise<boolean> => {\n setIsSaving(true);\n const result = await controller.saveAll();\n setIsSaving(false);\n return result;\n }\n\n const getSaveBtnProps = (): ISaveBtnProps => {\n if (isSaving) {\n return {\n disabled: true,\n iconName: 'SaveInPropgre',\n text: labels[\"saving-saving\"](),\n }\n }\n if (controller.isDirty) {\n return {\n disabled: (controller.hasInvalidRecords || grid.props.parameters.ChangeEditorMode?.error) ? true : false,\n iconName: 'Save',\n text: labels[\"saving-save\"]()\n\n }\n }\n return {\n disabled: true,\n iconName: 'Save',\n text: labels[\"saving-save\"]()\n }\n }\n\n return {\n isSaving: isSaving,\n saveBtnProps: getSaveBtnProps(),\n save: save\n }\n\n}"],"names":[],"mappings":";;;;AAgBO,MAAM,OAAO,GAAG,MAAY;AAC/B,IAAA,MAAM,IAAI,GAAG,eAAe,EAAE,CAAC;AAC/B,IAAA,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CA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ui/react';
|
|
2
|
+
|
|
3
|
+
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
|
+
};
|
|
42
|
+
|
|
43
|
+
export { getSaveStyles };
|
|
44
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../../../src/components/Grid/core/components/Save/styles.ts"],"sourcesContent":["import { mergeStyleSets } from \"@fluentui/react\"\n\nexport const getSaveStyles = () => {\n return mergeStyleSets({\n root: {\n '&[data-dirty=\"false\"]': {\n '.ms-MessageBar': {\n backgroundColor: 'transparent',\n '.ms-MessageBar-icon': {\n display: 'none'\n }\n }\n },\n '.ms-MessageBar-icon': {\n alignItems: 'center'\n },\n '.ms-MessageBar-actionsSingleLine': {\n marginRight: 0\n },\n '.ms-MessageBar-innerText': {\n textAlign: 'left'\n },\n '&[data-dirty=\"true\"]': {\n cursor: 'pointer'\n }\n },\n notificationText: {\n whiteSpace: 'normal',\n },\n actions: {\n height: '100%',\n '.ms-Button': {\n height: '100%',\n backgroundColor: 'transparent',\n ':last-child': {\n marginLeft: 0\n }\n }\n }\n });\n}"],"names":[],"mappings":";;AAEO,MAAM,aAAa,GAAG,MAAK;AAC9B,IAAA,OAAO,cAAc,CAAC;AAClB,QAAA,IAAI,EAAE;AACF,YAAA,uBAAuB,EAAE;AACrB,gBAAA,gBAAgB,EAAE;AACd,oBAAA,eAAe,EAAE,aAAa;AAC9B,oBAAA,qBAAqB,EAAE;AACnB,wBAAA,OAAO,EAAE,MAAM;AAClB,qBAAA;AACJ,iBAAA;AACJ,aAAA;AACD,YAAA,qBAAqB,EAAE;AACnB,gBAAA,UAAU,EAAE,QAAQ;AACvB,aAAA;AACD,YAAA,kCAAkC,EAAE;AAChC,gBAAA,WAAW,EAAE,CAAC;AACjB,aAAA;AACD,YAAA,0BAA0B,EAAE;AACxB,gBAAA,SAAS,EAAE,MAAM;AACpB,aAAA;AACD,YAAA,sBAAsB,EAAE;AACpB,gBAAA,MAAM,EAAE,SAAS;AACpB,aAAA;AACJ,SAAA;AACD,QAAA,gBAAgB,EAAE;AACd,YAAA,UAAU,EAAE,QAAQ;AACvB,SAAA;AACD,QAAA,OAAO,EAAE;AACL,YAAA,MAAM,EAAE,MAAM;AACd,YAAA,YAAY,EAAE;AACV,gBAAA,MAAM,EAAE,MAAM;AACd,gBAAA,eAAe,EAAE,aAAa;AAC9B,gBAAA,aAAa,EAAE;AACX,oBAAA,UAAU,EAAE,CAAC;AAChB,iBAAA;AACJ,aAAA;AACJ,SAAA;AACJ,KAAA,CAAC,CAAC;AACP;;;;"}
|
|
@@ -1 +1,39 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { useContext, useState, useEffect } from 'react';
|
|
2
|
+
import equal from 'fast-deep-equal/es6';
|
|
3
|
+
import { GridContext } from '../../GridContext.js';
|
|
4
|
+
|
|
5
|
+
const useGridController = (gridInstance) => {
|
|
6
|
+
const grid = gridInstance ?? useContext(GridContext).gridInstance;
|
|
7
|
+
const [columns, setColumns] = useState(grid.columns);
|
|
8
|
+
const [records, setRecords] = useState(() => grid.refreshRecords());
|
|
9
|
+
const getRecordValues = (columns, records) => {
|
|
10
|
+
const newRecordValues = records.map(x => {
|
|
11
|
+
const values = [];
|
|
12
|
+
for (const column of columns) {
|
|
13
|
+
values.push(x.getValue(column.key));
|
|
14
|
+
}
|
|
15
|
+
return values;
|
|
16
|
+
});
|
|
17
|
+
return newRecordValues;
|
|
18
|
+
};
|
|
19
|
+
//only change columns and records reference if there is a change
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
(async () => {
|
|
22
|
+
const newColumns = await grid.refreshColumns();
|
|
23
|
+
const newRecordValues = getRecordValues(newColumns, grid.refreshRecords());
|
|
24
|
+
if (!equal(newColumns, columns)) {
|
|
25
|
+
setColumns(newColumns);
|
|
26
|
+
}
|
|
27
|
+
if (!equal(newRecordValues, getRecordValues(newColumns, records))) {
|
|
28
|
+
setRecords(grid.records);
|
|
29
|
+
}
|
|
30
|
+
})();
|
|
31
|
+
}, [grid.shouldRerender]);
|
|
32
|
+
return {
|
|
33
|
+
columns,
|
|
34
|
+
records
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { useGridController };
|
|
39
|
+
//# sourceMappingURL=useGridController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGridController.js","sources":["../../../../../src/components/Grid/core/controllers/useGridController.ts"],"sourcesContent":["import { useContext, useEffect, useState } from \"react\"\nimport equal from 'fast-deep-equal/es6';\nimport { IEntityRecord } from \"../../interfaces\";\nimport { Grid } from \"../model/Grid\";\nimport { IGridColumn } from \"../interfaces/IGridColumn\";\nimport { GridContext } from \"../../GridContext\";\n\ninterface IGridController {\n columns: IGridColumn[],\n records: IEntityRecord[]\n}\n\nexport const useGridController = (gridInstance?: Grid): IGridController => {\n const grid = gridInstance ?? useContext(GridContext).gridInstance;\n const [columns, setColumns] = useState<IGridColumn[]>(grid.columns);\n const [records, setRecords] = useState<IEntityRecord[]>(() => grid.refreshRecords());\n\n const getRecordValues = (columns: IGridColumn[], records: IEntityRecord[]) => {\n const newRecordValues = records.map(x => {\n const values = [];\n for(const column of columns) {\n values.push(x.getValue(column.key))\n }\n return values;\n });\n return newRecordValues;\n }\n\n //only change columns and records reference if there is a change\n useEffect(() => {\n (async () => {\n const newColumns = await grid.refreshColumns();\n const newRecordValues = getRecordValues(newColumns, grid.refreshRecords());\n if(!equal(newColumns, columns)) {\n setColumns(newColumns);\n }\n if(!equal(newRecordValues, getRecordValues(newColumns, records))) {\n setRecords(grid.records);\n }\n })();\n }, [grid.shouldRerender]);\n return {\n columns,\n records\n }\n}"],"names":[],"mappings":";;;;AAYa,MAAA,iBAAiB,GAAG,CAAC,YAAmB,KAAqB;IACtE,MAAM,IAAI,GAAG,YAAY,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC;AAClE,IAAA,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,OAAO,CAAC,CAAC;AACpE,IAAA,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAkB,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;AAErF,IAAA,MAAM,eAAe,GAAG,CAAC,OAAsB,EAAE,OAAwB,KAAI;QACzE,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,IAAG;YACpC,MAAM,MAAM,GAAG,EAAE,CAAC;AAClB,YAAA,KAAI,MAAM,MAAM,IAAI,OAAO,EAAE;AACzB,gBAAA,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;AACtC,aAAA;AACD,YAAA,OAAO,MAAM,CAAC;AAClB,SAAC,CAAC,CAAC;AACH,QAAA,OAAO,eAAe,CAAC;AAC3B,KAAC,CAAA;;IAGD,SAAS,CAAC,MAAK;QACX,CAAC,YAAW;AACR,YAAA,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAC/C,MAAM,eAAe,GAAG,eAAe,CAAC,UAAU,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;AAC3E,YAAA,IAAG,CAAC,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE;gBAC5B,UAAU,CAAC,UAAU,CAAC,CAAC;AAC1B,aAAA;AACD,YAAA,IAAG,CAAC,KAAK,CAAC,eAAe,EAAE,eAAe,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,EAAE;AAC9D,gBAAA,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC5B,aAAA;SACJ,GAAG,CAAC;AACT,KAAC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;IAC1B,OAAO;QACH,OAAO;QACP,OAAO;KACV,CAAA;AACL;;;;"}
|
|
@@ -1 +1,50 @@
|
|
|
1
|
-
var
|
|
1
|
+
var DatasetConditionOperator;
|
|
2
|
+
(function (DatasetConditionOperator) {
|
|
3
|
+
DatasetConditionOperator[DatasetConditionOperator["None"] = -1] = "None";
|
|
4
|
+
DatasetConditionOperator[DatasetConditionOperator["Equal"] = 0] = "Equal";
|
|
5
|
+
DatasetConditionOperator[DatasetConditionOperator["NotEqual"] = 1] = "NotEqual";
|
|
6
|
+
DatasetConditionOperator[DatasetConditionOperator["GreaterThan"] = 2] = "GreaterThan";
|
|
7
|
+
DatasetConditionOperator[DatasetConditionOperator["LessThan"] = 3] = "LessThan";
|
|
8
|
+
DatasetConditionOperator[DatasetConditionOperator["GreaterEqual"] = 4] = "GreaterEqual";
|
|
9
|
+
DatasetConditionOperator[DatasetConditionOperator["LessEqual"] = 5] = "LessEqual";
|
|
10
|
+
DatasetConditionOperator[DatasetConditionOperator["Like"] = 6] = "Like";
|
|
11
|
+
DatasetConditionOperator[DatasetConditionOperator["NotLike"] = 7] = "NotLike";
|
|
12
|
+
DatasetConditionOperator[DatasetConditionOperator["In"] = 8] = "In";
|
|
13
|
+
DatasetConditionOperator[DatasetConditionOperator["NotIn"] = 9] = "NotIn";
|
|
14
|
+
DatasetConditionOperator[DatasetConditionOperator["Null"] = 12] = "Null";
|
|
15
|
+
DatasetConditionOperator[DatasetConditionOperator["NotNull"] = 13] = "NotNull";
|
|
16
|
+
DatasetConditionOperator[DatasetConditionOperator["Yesterday"] = 14] = "Yesterday";
|
|
17
|
+
DatasetConditionOperator[DatasetConditionOperator["Today"] = 15] = "Today";
|
|
18
|
+
DatasetConditionOperator[DatasetConditionOperator["Tomorrow"] = 16] = "Tomorrow";
|
|
19
|
+
DatasetConditionOperator[DatasetConditionOperator["Last7Days"] = 17] = "Last7Days";
|
|
20
|
+
DatasetConditionOperator[DatasetConditionOperator["Next7Days"] = 18] = "Next7Days";
|
|
21
|
+
DatasetConditionOperator[DatasetConditionOperator["LastWeek"] = 19] = "LastWeek";
|
|
22
|
+
DatasetConditionOperator[DatasetConditionOperator["ThisWeek"] = 20] = "ThisWeek";
|
|
23
|
+
DatasetConditionOperator[DatasetConditionOperator["LastMonth"] = 22] = "LastMonth";
|
|
24
|
+
DatasetConditionOperator[DatasetConditionOperator["ThisMonth"] = 23] = "ThisMonth";
|
|
25
|
+
DatasetConditionOperator[DatasetConditionOperator["On"] = 25] = "On";
|
|
26
|
+
DatasetConditionOperator[DatasetConditionOperator["OnOrBefore"] = 26] = "OnOrBefore";
|
|
27
|
+
DatasetConditionOperator[DatasetConditionOperator["OnOrAfter"] = 27] = "OnOrAfter";
|
|
28
|
+
DatasetConditionOperator[DatasetConditionOperator["LastYear"] = 28] = "LastYear";
|
|
29
|
+
DatasetConditionOperator[DatasetConditionOperator["ThisYear"] = 29] = "ThisYear";
|
|
30
|
+
DatasetConditionOperator[DatasetConditionOperator["LastXDays"] = 33] = "LastXDays";
|
|
31
|
+
DatasetConditionOperator[DatasetConditionOperator["NextXDays"] = 34] = "NextXDays";
|
|
32
|
+
DatasetConditionOperator[DatasetConditionOperator["LastXMonths"] = 37] = "LastXMonths";
|
|
33
|
+
DatasetConditionOperator[DatasetConditionOperator["NextXMonths"] = 38] = "NextXMonths";
|
|
34
|
+
DatasetConditionOperator[DatasetConditionOperator["Contains"] = 49] = "Contains";
|
|
35
|
+
DatasetConditionOperator[DatasetConditionOperator["BeginWith"] = 54] = "BeginWith";
|
|
36
|
+
DatasetConditionOperator[DatasetConditionOperator["DoesNotBeginWith"] = 55] = "DoesNotBeginWith";
|
|
37
|
+
DatasetConditionOperator[DatasetConditionOperator["EndsWith"] = 56] = "EndsWith";
|
|
38
|
+
DatasetConditionOperator[DatasetConditionOperator["DoesNotEndWith"] = 57] = "DoesNotEndWith";
|
|
39
|
+
DatasetConditionOperator[DatasetConditionOperator["InFiscalPeriodAndYear"] = 70] = "InFiscalPeriodAndYear";
|
|
40
|
+
DatasetConditionOperator[DatasetConditionOperator["Above"] = 75] = "Above";
|
|
41
|
+
DatasetConditionOperator[DatasetConditionOperator["Under"] = 76] = "Under";
|
|
42
|
+
DatasetConditionOperator[DatasetConditionOperator["NotUnder"] = 77] = "NotUnder";
|
|
43
|
+
DatasetConditionOperator[DatasetConditionOperator["AboveOrEqual"] = 78] = "AboveOrEqual";
|
|
44
|
+
DatasetConditionOperator[DatasetConditionOperator["UnderOrEqual"] = 79] = "UnderOrEqual";
|
|
45
|
+
DatasetConditionOperator[DatasetConditionOperator["ContainValues"] = 87] = "ContainValues";
|
|
46
|
+
DatasetConditionOperator[DatasetConditionOperator["DoesNotContainValues"] = 88] = "DoesNotContainValues";
|
|
47
|
+
})(DatasetConditionOperator || (DatasetConditionOperator = {}));
|
|
48
|
+
|
|
49
|
+
export { DatasetConditionOperator };
|
|
50
|
+
//# sourceMappingURL=ConditionOperator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConditionOperator.js","sources":["../../../../../src/components/Grid/core/enums/ConditionOperator.ts"],"sourcesContent":["export enum DatasetConditionOperator {\n None = -1,\n Equal = 0,\n NotEqual = 1,\n GreaterThan = 2,\n LessThan = 3,\n GreaterEqual = 4,\n LessEqual = 5,\n Like = 6,\n NotLike = 7,\n In = 8,\n NotIn = 9,\n Null = 12,\n NotNull = 13,\n Yesterday = 14,\n Today = 15,\n Tomorrow = 16,\n Last7Days = 17,\n Next7Days = 18,\n LastWeek = 19,\n ThisWeek = 20,\n LastMonth = 22,\n ThisMonth = 23,\n On = 25,\n OnOrBefore = 26,\n OnOrAfter = 27,\n LastYear = 28,\n ThisYear = 29,\n LastXDays = 33,\n NextXDays = 34,\n LastXMonths = 37,\n NextXMonths = 38,\n Contains = 49,\n BeginWith = 54,\n DoesNotBeginWith = 55,\n EndsWith = 56,\n DoesNotEndWith = 57,\n InFiscalPeriodAndYear = 70,\n Above = 75,\n Under = 76,\n NotUnder = 77,\n AboveOrEqual = 78,\n UnderOrEqual = 79,\n ContainValues = 87,\n DoesNotContainValues = 88\n }"],"names":[],"mappings":"IAAY,yBA6CT;AA7CH,CAAA,UAAY,wBAAwB,EAAA;AAChC,IAAA,wBAAA,CAAA,wBAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,CAAA,GAAA,MAAS,CAAA;AACT,IAAA,wBAAA,CAAA,wBAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAS,CAAA;AACT,IAAA,wBAAA,CAAA,wBAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAY,CAAA;AACZ,IAAA,wBAAA,CAAA,wBAAA,CAAA,aAAA,CAAA,GAAA,CAAA,CAAA,GAAA,aAAe,CAAA;AACf,IAAA,wBAAA,CAAA,wBAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAA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