@talxis/base-controls 1.2406.2 → 1.2406.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/.env +0 -1
- package/.eslintrc +0 -117
- package/.npmgitignore +0 -9
- package/.vscode/settings.json +0 -3
- package/.yalcignore +0 -2
- package/azure-pipelines.yml +0 -44
- package/examples/Currency/Currency/ControlManifest.Input.xml +0 -53
- package/examples/Currency/Currency/index.ts +0 -66
- package/examples/Currency/Currency.pcfproj +0 -46
- package/examples/Currency/package-lock.json +0 -15900
- package/examples/Currency/package.json +0 -29
- package/examples/Currency/pcfconfig.json +0 -3
- package/examples/Currency/tsconfig.json +0 -7
- package/examples/DateTime/DateTime/ControlManifest.Input.xml +0 -58
- package/examples/DateTime/DateTime/index.ts +0 -69
- package/examples/DateTime/DateTime.pcfproj +0 -46
- package/examples/DateTime/package-lock.json +0 -15900
- package/examples/DateTime/package.json +0 -29
- package/examples/DateTime/pcfconfig.json +0 -3
- package/examples/DateTime/tsconfig.json +0 -7
- package/examples/Decimal/Decimal/ControlManifest.Input.xml +0 -66
- package/examples/Decimal/Decimal/index.ts +0 -66
- package/examples/Decimal/Decimal.pcfproj +0 -46
- package/examples/Decimal/package-lock.json +0 -15900
- package/examples/Decimal/package.json +0 -28
- package/examples/Decimal/pcfconfig.json +0 -3
- package/examples/Decimal/tsconfig.json +0 -7
- package/examples/Duration/Duration/ControlManifest.Input.xml +0 -53
- package/examples/Duration/Duration/index.ts +0 -66
- package/examples/Duration/Duration.pcfproj +0 -46
- package/examples/Duration/package-lock.json +0 -15900
- package/examples/Duration/package.json +0 -29
- package/examples/Duration/pcfconfig.json +0 -3
- package/examples/Duration/tsconfig.json +0 -7
- package/examples/Grid/Grid/ControlManifest.Input.xml +0 -28
- package/examples/Grid/Grid/index.ts +0 -100
- package/examples/Grid/Grid.pcfproj +0 -46
- package/examples/Grid/package-lock.json +0 -15901
- package/examples/Grid/package.json +0 -30
- package/examples/Grid/pcfconfig.json +0 -3
- package/examples/Grid/tsconfig.json +0 -7
- package/examples/Lookup/Lookup/ControlManifest.Input.xml +0 -51
- package/examples/Lookup/Lookup/index.ts +0 -90
- package/examples/Lookup/Lookup.pcfproj +0 -46
- package/examples/Lookup/package-lock.json +0 -15900
- package/examples/Lookup/package.json +0 -29
- package/examples/Lookup/pcfconfig.json +0 -3
- package/examples/Lookup/tsconfig.json +0 -8
- package/examples/MultiSelectOptionSet/MultiSelectOptionSet/ControlManifest.Input.xml +0 -53
- package/examples/MultiSelectOptionSet/MultiSelectOptionSet/index.ts +0 -86
- package/examples/MultiSelectOptionSet/MultiSelectOptionSet.pcfproj +0 -46
- package/examples/MultiSelectOptionSet/package-lock.json +0 -15900
- package/examples/MultiSelectOptionSet/package.json +0 -31
- package/examples/MultiSelectOptionSet/pcfconfig.json +0 -3
- package/examples/MultiSelectOptionSet/tsconfig.json +0 -7
- package/examples/OptionSet/OptionSet/ControlManifest.Input.xml +0 -53
- package/examples/OptionSet/OptionSet/index.ts +0 -70
- package/examples/OptionSet/OptionSet.pcfproj +0 -46
- package/examples/OptionSet/package-lock.json +0 -15900
- package/examples/OptionSet/package.json +0 -29
- package/examples/OptionSet/pcfconfig.json +0 -3
- package/examples/OptionSet/tsconfig.json +0 -7
- package/examples/TwoOptions/TwoOptions/ControlManifest.Input.xml +0 -53
- package/examples/TwoOptions/TwoOptions/index.ts +0 -69
- package/examples/TwoOptions/TwoOptions.pcfproj +0 -46
- package/examples/TwoOptions/package-lock.json +0 -15900
- package/examples/TwoOptions/package.json +0 -29
- package/examples/TwoOptions/pcfconfig.json +0 -3
- package/examples/TwoOptions/tsconfig.json +0 -7
- package/public/index.html +0 -43
- package/public/manifest.json +0 -25
- package/rollup.config.js +0 -44
- package/src/components/DateTime/DateTime.tsx +0 -97
- package/src/components/DateTime/components/Calendar.tsx +0 -80
- package/src/components/DateTime/hooks/useDateTime.ts +0 -144
- package/src/components/DateTime/index.ts +0 -2
- package/src/components/DateTime/interfaces.ts +0 -22
- package/src/components/DateTime/styles.ts +0 -37
- package/src/components/DateTime/translations.ts +0 -18
- package/src/components/Decimal/Decimal.tsx +0 -120
- package/src/components/Decimal/index.ts +0 -2
- package/src/components/Decimal/interfaces.ts +0 -20
- package/src/components/Duration/Duration.tsx +0 -143
- package/src/components/Duration/index.ts +0 -2
- package/src/components/Duration/interfaces.ts +0 -22
- package/src/components/Duration/translations.ts +0 -30
- package/src/components/Grid/Grid.tsx +0 -24
- package/src/components/Grid/core/components/AgGrid/AgGrid.tsx +0 -206
- package/src/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/EmptyRecords.tsx +0 -16
- package/src/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/styles.ts +0 -20
- package/src/components/Grid/core/components/AgGrid/components/LoadingOverlay/LoadingOverlay.tsx +0 -7
- package/src/components/Grid/core/components/AgGrid/controllers/useAgGridController.ts +0 -68
- package/src/components/Grid/core/components/AgGrid/model/AgGrid.ts +0 -100
- package/src/components/Grid/core/components/AgGrid/styles.ts +0 -72
- package/src/components/Grid/core/components/Cell/Commands/Commands.tsx +0 -32
- package/src/components/Grid/core/components/Cell/Commands/Icon.tsx +0 -17
- package/src/components/Grid/core/components/Cell/Commands/styles.ts +0 -21
- package/src/components/Grid/core/components/Cell/Commands/useCommands.tsx +0 -53
- package/src/components/Grid/core/components/Cell/EditableCell/EditableCell.tsx +0 -140
- package/src/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyCell.tsx +0 -176
- package/src/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyOptionSet/ReadOnlyOptionSet.tsx +0 -67
- package/src/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyOptionSet/styles.ts +0 -24
- package/src/components/Grid/core/components/Cell/ReadOnlyCell/styles.ts +0 -56
- package/src/components/Grid/core/components/ColumnHeader/ColumnHeader.tsx +0 -71
- package/src/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/GlobalCheckbox.tsx +0 -31
- package/src/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/styles.ts +0 -16
- package/src/components/Grid/core/components/ColumnHeader/styles.ts +0 -40
- package/src/components/Grid/core/components/Component/Component.tsx +0 -59
- package/src/components/Grid/core/components/Component/controller/useComponentController.ts +0 -39
- package/src/components/Grid/core/components/Component/model/Component.ts +0 -251
- package/src/components/Grid/core/components/Dialog/Constants.tsx +0 -8
- package/src/components/Grid/core/components/Dialog/Styles.tsx +0 -61
- package/src/components/Grid/core/components/Dialog/index.tsx +0 -22
- package/src/components/Grid/core/components/Dialog/interfaces/index.d.ts +0 -7
- package/src/components/Grid/core/components/Save/Save.tsx +0 -74
- package/src/components/Grid/core/components/Save/components/ChangeEditor/ChangeEditor.tsx +0 -63
- package/src/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/RecordGrids.tsx +0 -153
- package/src/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/styles.ts +0 -52
- package/src/components/Grid/core/components/Save/components/ChangeEditor/styles.ts +0 -34
- package/src/components/Grid/core/components/Save/hooks/useSave.ts +0 -59
- package/src/components/Grid/core/components/Save/styles.ts +0 -41
- package/src/components/Grid/core/controllers/useGridController.ts +0 -46
- package/src/components/Grid/core/enums/ConditionOperator.ts +0 -46
- package/src/components/Grid/core/enums/DataType.ts +0 -25
- package/src/components/Grid/core/hooks/useGridInstance.ts +0 -7
- package/src/components/Grid/core/hooks/useRefreshCallback.ts +0 -20
- package/src/components/Grid/core/hooks/useRerender.ts +0 -15
- package/src/components/Grid/core/interfaces/IGridColumn.ts +0 -19
- package/src/components/Grid/core/interfaces/IGridContext.ts +0 -7
- package/src/components/Grid/core/model/Grid.ts +0 -250
- package/src/components/Grid/core/model/GridDependency.ts +0 -34
- package/src/components/Grid/core/model/Metadata.ts +0 -20
- package/src/components/Grid/core/services/RecordUpdateService/controllers/useRecordUpdateServiceController.ts +0 -36
- package/src/components/Grid/core/services/RecordUpdateService/model/RecordUpdateService.ts +0 -222
- package/src/components/Grid/filtering/components/FilterCallout/FilterCallout.tsx +0 -83
- package/src/components/Grid/filtering/components/FilterCallout/components/ConditionOperator/ConditionOperator.tsx +0 -66
- package/src/components/Grid/filtering/components/FilterCallout/components/ConditionValue/ConditionValue.tsx +0 -48
- package/src/components/Grid/filtering/components/FilterCallout/components/ConditionValue/model/ConditionComponentValue.ts +0 -120
- package/src/components/Grid/filtering/components/FilterCallout/styles.ts +0 -37
- package/src/components/Grid/filtering/constants.ts +0 -48
- package/src/components/Grid/filtering/controller/useColumnFilterConditionController.ts +0 -63
- package/src/components/Grid/filtering/model/Condition.ts +0 -309
- package/src/components/Grid/filtering/model/Filtering.ts +0 -78
- package/src/components/Grid/filtering/utils/FilteringUtilts.ts +0 -190
- package/src/components/Grid/interfaces.ts +0 -109
- package/src/components/Grid/paging/components/Paging/Paging.tsx +0 -76
- package/src/components/Grid/paging/components/Paging/styles.ts +0 -38
- package/src/components/Grid/paging/controllers/usePagingController.ts +0 -34
- package/src/components/Grid/paging/model/Paging.ts +0 -49
- package/src/components/Grid/selection/controllers/useSelectionController.ts +0 -25
- package/src/components/Grid/selection/model/Selection.ts +0 -60
- package/src/components/Grid/sorting/Sorting.ts +0 -30
- package/src/components/Grid/sorting/components/SortingContextualMenu/SortingContextualMenu.tsx +0 -126
- package/src/components/Grid/sorting/components/SortingContextualMenu/styles.ts +0 -12
- package/src/components/Grid/sorting/controllers/useColumnSortingController.ts +0 -26
- package/src/components/Grid/translations.ts +0 -80
- package/src/components/Grid/validation/controllers/useRecordValidationController.ts +0 -31
- package/src/components/Grid/validation/model/ColumnValidation.ts +0 -81
- package/src/components/Lookup/Lookup.tsx +0 -199
- package/src/components/Lookup/components/RecordCreator.tsx +0 -53
- package/src/components/Lookup/components/TargetSelector.tsx +0 -43
- package/src/components/Lookup/hooks/useFetchXml.ts +0 -31
- package/src/components/Lookup/hooks/useLoadedEntities.ts +0 -23
- package/src/components/Lookup/hooks/useLookup.ts +0 -126
- package/src/components/Lookup/index.ts +0 -2
- package/src/components/Lookup/interfaces.ts +0 -45
- package/src/components/Lookup/lib.ts +0 -3110
- package/src/components/Lookup/styles.ts +0 -106
- package/src/components/Lookup/translations.ts +0 -28
- package/src/components/MultiSelectOptionSet/MultiSelectOptionSet.tsx +0 -83
- package/src/components/MultiSelectOptionSet/index.ts +0 -2
- package/src/components/MultiSelectOptionSet/interfaces.ts +0 -14
- package/src/components/OptionSet/OptionSet.tsx +0 -67
- package/src/components/OptionSet/index.ts +0 -2
- package/src/components/OptionSet/interfaces.ts +0 -17
- package/src/components/TextField/TextField.tsx +0 -58
- package/src/components/TextField/hooks/useTextField.ts +0 -42
- package/src/components/TextField/index.ts +0 -2
- package/src/components/TextField/interfaces.ts +0 -20
- package/src/components/TwoOptions/TwoOptions.tsx +0 -43
- package/src/components/TwoOptions/index.ts +0 -2
- package/src/components/TwoOptions/interfaces.ts +0 -17
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useComponent.ts +0 -83
- package/src/hooks/useFocusIn.ts +0 -23
- package/src/hooks/useInputBasedComponent.ts +0 -71
- package/src/hooks/useMouseOver.ts +0 -23
- package/src/index.tsx +0 -12
- package/src/interfaces/context.ts +0 -21
- package/src/interfaces/index.ts +0 -12
- package/src/interfaces/parameters.ts +0 -26
- package/src/interfaces/property.ts +0 -111
- package/src/sandbox/index.tsx +0 -137
- package/src/sandbox/mock/Context.ts +0 -18
- package/src/sandbox/mock/Formatting.ts +0 -186
- package/src/sandbox/mock/Mode.ts +0 -25
- package/src/sandbox/mock/UserSettings.ts +0 -31
- package/src/sandbox/mock/Utility.ts +0 -14
- package/src/sandbox/shared/durationList.tsx +0 -24
- package/src/sandbox/shared/multiSelectOptionList.tsx +0 -5
- package/src/sandbox/shared/optionList.tsx +0 -5
- package/src/stories/Introduction.stories.mdx +0 -122
- package/src/stories/assets/code-brackets.svg +0 -1
- package/src/stories/assets/colors.svg +0 -1
- package/src/stories/assets/comments.svg +0 -1
- package/src/stories/assets/direction.svg +0 -1
- package/src/stories/assets/flow.svg +0 -1
- package/src/stories/assets/plugin.svg +0 -1
- package/src/stories/assets/repo.svg +0 -1
- package/src/stories/assets/stackalt.svg +0 -1
- package/src/types/index.ts +0 -3
- package/src/utils/NumeralPCF.ts +0 -62
- package/tsconfig.json +0 -28
|
@@ -1,61 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
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;
|
|
@@ -1,74 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,153 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
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
|
-
}
|