@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,25 +0,0 @@
|
|
|
1
|
-
export enum DataType {
|
|
2
|
-
SINGLE_LINE_TEXT = 'SingleLine.Text',
|
|
3
|
-
SINGLE_LINE_TEXT_AREA = 'SingleLine.TextArea',
|
|
4
|
-
SINGLE_LINE_EMAIL = 'SingleLine.Email',
|
|
5
|
-
SINGLE_LINE_PHONE = 'SingleLine.Phone',
|
|
6
|
-
SINGLE_LINE_URL = 'SingleLine.URL',
|
|
7
|
-
MULTIPLE = 'Multiple',
|
|
8
|
-
WHOLE_NONE = 'Whole.None',
|
|
9
|
-
DECIMAL = 'Decimal',
|
|
10
|
-
FP = 'FP',
|
|
11
|
-
DATE_AND_TIME_DATE_AND_TIME = 'DateAndTime.DateAndTime',
|
|
12
|
-
DATE_AND_TIME_DATE_ONLY = 'DateAndTime.DateOnly',
|
|
13
|
-
CURRENCY = 'Currency',
|
|
14
|
-
OPTIONSET = 'OptionSet',
|
|
15
|
-
MULTI_SELECT_OPTIONSET = 'MultiSelectPicklist',
|
|
16
|
-
TWO_OPTIONS = 'TwoOptions',
|
|
17
|
-
LOOKUP_SIMPLE = 'Lookup.Simple',
|
|
18
|
-
LOOKUP_OWNER = 'Lookup.Owner',
|
|
19
|
-
// Not supported in pcf dataset - https://learn.microsoft.com/en-us/power-apps/developer/component-framework/manifest-schema-reference/property-set#value-elements-that-are-not-supported
|
|
20
|
-
WHOLE_LANGUAGE = 'Whole.Language',
|
|
21
|
-
WHOLE_DURATION = 'Whole.Duration',
|
|
22
|
-
WHOLE_TIMEZONE = 'Whole.TimeZone',
|
|
23
|
-
FILE = 'File',
|
|
24
|
-
IMAGE = 'Image',
|
|
25
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useEffect, useMemo } from "react";
|
|
2
|
-
import { GridDependency } from "../model/GridDependency";
|
|
3
|
-
|
|
4
|
-
export const useRefreshCallback = (model: GridDependency | Promise<GridDependency>, refreshCallback: () => any) => {
|
|
5
|
-
const id = useMemo(() => crypto.randomUUID(), [])
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
(async () => {
|
|
8
|
-
const _model = await model;
|
|
9
|
-
_model.addRefreshCallback(id, refreshCallback);
|
|
10
|
-
})();
|
|
11
|
-
console.log('refresh callback added')
|
|
12
|
-
return () => {
|
|
13
|
-
(async () => {
|
|
14
|
-
const _model = await model;
|
|
15
|
-
_model.removeRefreshCallback(id);
|
|
16
|
-
|
|
17
|
-
})();
|
|
18
|
-
}
|
|
19
|
-
}, []);
|
|
20
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react"
|
|
2
|
-
|
|
3
|
-
export const useRerender = (): [
|
|
4
|
-
number,
|
|
5
|
-
(fn?: () => any | Promise<any>) => void
|
|
6
|
-
] => {
|
|
7
|
-
const [rerender, setRerender] = useState<number>(0);
|
|
8
|
-
|
|
9
|
-
const renderDecorator = async (fn?: () => any | Promise<any>) => {
|
|
10
|
-
await fn?.();
|
|
11
|
-
setRerender(c => c + 1);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return [rerender, renderDecorator];
|
|
15
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { DataType } from "../enums/DataType";
|
|
2
|
-
|
|
3
|
-
export interface IGridColumn {
|
|
4
|
-
key: string;
|
|
5
|
-
attributeName: string;
|
|
6
|
-
isPrimary?: boolean;
|
|
7
|
-
dataType?: DataType;
|
|
8
|
-
displayName?: string;
|
|
9
|
-
entityAliasName?: string;
|
|
10
|
-
isFilterable?: boolean;
|
|
11
|
-
isSortable?: boolean;
|
|
12
|
-
isSorted?: boolean;
|
|
13
|
-
isFiltered?: boolean;
|
|
14
|
-
isSortedDescending?: boolean;
|
|
15
|
-
isEditable?: boolean;
|
|
16
|
-
isResizable?: boolean;
|
|
17
|
-
isRequired?: boolean;
|
|
18
|
-
width?: number;
|
|
19
|
-
}
|
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
import { IDatasetProperty } from "../../../../interfaces";
|
|
2
|
-
import { StringProps } from "../../../../types";
|
|
3
|
-
import { Filtering } from "../../filtering/model/Filtering";
|
|
4
|
-
import { IEntityColumn, IEntityRecord, IGrid, IGridTranslations } from "../../interfaces";
|
|
5
|
-
import { Paging } from "../../paging/model/Paging";
|
|
6
|
-
import { Selection } from "../../selection/model/Selection";
|
|
7
|
-
import { Sorting } from "../../sorting/Sorting";
|
|
8
|
-
import { DataType } from "../enums/DataType";
|
|
9
|
-
import { IGridColumn } from "../interfaces/IGridColumn";
|
|
10
|
-
import { RecordUpdateService } from "../services/RecordUpdateService/model/RecordUpdateService";
|
|
11
|
-
import { Metadata } from "./Metadata";
|
|
12
|
-
|
|
13
|
-
export class Grid {
|
|
14
|
-
private _props: IGrid;
|
|
15
|
-
private _dataset: IDatasetProperty
|
|
16
|
-
private _pcfContext: ComponentFramework.Context<any>;
|
|
17
|
-
private _columns: IGridColumn[] = [];
|
|
18
|
-
private _records: IEntityRecord[] = [];
|
|
19
|
-
private _labels: Required<StringProps<IGridTranslations>>;
|
|
20
|
-
private _shouldRerender: boolean = false;
|
|
21
|
-
//TODO: the dependencies might not have fully loaded grid
|
|
22
|
-
//need to make sure that the grid is initialized before creating them
|
|
23
|
-
private _dependencies: {
|
|
24
|
-
recordUpdateService: RecordUpdateService,
|
|
25
|
-
filtering: Filtering,
|
|
26
|
-
sorting: Sorting,
|
|
27
|
-
metadata: Metadata,
|
|
28
|
-
selection: Selection,
|
|
29
|
-
paging: Paging
|
|
30
|
-
};
|
|
31
|
-
constructor(props: IGrid, labels: Required<StringProps<IGridTranslations>>) {
|
|
32
|
-
this._props = props;
|
|
33
|
-
this._dataset = props.parameters.Grid;
|
|
34
|
-
this._pcfContext = props.context;
|
|
35
|
-
this._labels = labels;
|
|
36
|
-
|
|
37
|
-
this._dependencies = {
|
|
38
|
-
recordUpdateService: new RecordUpdateService(this),
|
|
39
|
-
filtering: new Filtering(this),
|
|
40
|
-
selection: new Selection(this),
|
|
41
|
-
metadata: new Metadata(this),
|
|
42
|
-
sorting: new Sorting(this),
|
|
43
|
-
paging: new Paging(this)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
};
|
|
47
|
-
public get isNavigationEnabled() {
|
|
48
|
-
//enabled by default
|
|
49
|
-
return this.parameters.EnableNavigation?.raw !== false;
|
|
50
|
-
}
|
|
51
|
-
public get isEditable() {
|
|
52
|
-
return this._columns.find(x => x.isEditable) ? true : false;
|
|
53
|
-
}
|
|
54
|
-
public get parameters() {
|
|
55
|
-
return this._props.parameters
|
|
56
|
-
}
|
|
57
|
-
public get error() {
|
|
58
|
-
return this._dataset.error;
|
|
59
|
-
}
|
|
60
|
-
public get errorMessage() {
|
|
61
|
-
return this._dataset.errorMessage
|
|
62
|
-
}
|
|
63
|
-
public get labels() {
|
|
64
|
-
return this._labels;
|
|
65
|
-
}
|
|
66
|
-
public get dataset() {
|
|
67
|
-
return this._dataset;
|
|
68
|
-
}
|
|
69
|
-
public get pcfContext() {
|
|
70
|
-
return this._pcfContext;
|
|
71
|
-
}
|
|
72
|
-
public get props() {
|
|
73
|
-
return this._props;
|
|
74
|
-
}
|
|
75
|
-
public get columns() {
|
|
76
|
-
return this._columns;
|
|
77
|
-
}
|
|
78
|
-
public get records() {
|
|
79
|
-
return this._records;
|
|
80
|
-
}
|
|
81
|
-
public get recordUpdateService() {
|
|
82
|
-
return this._dependencies.recordUpdateService;
|
|
83
|
-
}
|
|
84
|
-
public get sorting() {
|
|
85
|
-
return this._dependencies.sorting;
|
|
86
|
-
}
|
|
87
|
-
public get metadata() {
|
|
88
|
-
return this._dependencies.metadata;
|
|
89
|
-
}
|
|
90
|
-
public get filtering() {
|
|
91
|
-
return this._dependencies.filtering;
|
|
92
|
-
}
|
|
93
|
-
public get selection() {
|
|
94
|
-
return this._dependencies.selection;
|
|
95
|
-
}
|
|
96
|
-
public get paging() {
|
|
97
|
-
return this._dependencies.paging;
|
|
98
|
-
}
|
|
99
|
-
public get shouldRerender() {
|
|
100
|
-
return this._shouldRerender;
|
|
101
|
-
}
|
|
102
|
-
public get loading() {
|
|
103
|
-
return this._dataset.loading;
|
|
104
|
-
}
|
|
105
|
-
public get state() {
|
|
106
|
-
return this._props.state;
|
|
107
|
-
}
|
|
108
|
-
public get isNested() {
|
|
109
|
-
return this.parameters.IsNested?.raw === true;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
public openDatasetItem(entityReference: ComponentFramework.EntityReference) {
|
|
113
|
-
const clickedRecord = this._records.find(x => x.getRecordId() === entityReference.id.guid);
|
|
114
|
-
//we need to make sure the item we are opening gets selected in order for the
|
|
115
|
-
//OnOpenRecord ribbon scripts to work correctly
|
|
116
|
-
//if no record found we have clicked a lookup, no selection should be happening in that case
|
|
117
|
-
if (clickedRecord) {
|
|
118
|
-
this.selection.toggle(clickedRecord, true, true, true);
|
|
119
|
-
}
|
|
120
|
-
this._dataset.openDatasetItem(entityReference);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
public updateDependencies(props: IGrid): void {
|
|
124
|
-
this._props = props;
|
|
125
|
-
this._dataset = props.parameters.Grid;
|
|
126
|
-
this._pcfContext = props.context;
|
|
127
|
-
for (const [key, dependency] of Object.entries(this._dependencies)) {
|
|
128
|
-
dependency.onDependenciesUpdated()
|
|
129
|
-
}
|
|
130
|
-
this._shouldRerender = !this.shouldRerender;
|
|
131
|
-
}
|
|
132
|
-
public async refreshColumns(): Promise<IGridColumn[]> {
|
|
133
|
-
const gridColumns: IGridColumn[] = [];
|
|
134
|
-
for (const column of this._dataset.columns) {
|
|
135
|
-
const sorted = this._dataset.sorting?.find(sort => sort.name === column.name);
|
|
136
|
-
const entityAliasName = column.name?.includes('.') ? column.name.split('.')[0] : null;
|
|
137
|
-
const attributeName = entityAliasName ? column.name.split('.')[1] : column.name;
|
|
138
|
-
switch (column.dataType) {
|
|
139
|
-
case DataType.FILE:
|
|
140
|
-
case DataType.IMAGE: {
|
|
141
|
-
if (entityAliasName) {
|
|
142
|
-
//we do not support file fields with linked entities
|
|
143
|
-
//the getValue API throws an error in Power Apps
|
|
144
|
-
continue;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
const gridColumn = {
|
|
149
|
-
entityAliasName: entityAliasName,
|
|
150
|
-
attributeName: attributeName,
|
|
151
|
-
key: entityAliasName ? `${entityAliasName}.${attributeName}` : attributeName,
|
|
152
|
-
isPrimary: column.isPrimary,
|
|
153
|
-
dataType: column.dataType as DataType,
|
|
154
|
-
displayName: column.displayName,
|
|
155
|
-
//comes from extended
|
|
156
|
-
isFilterable: this._isColumnFilterable(column),
|
|
157
|
-
isRequired: column.isRequired,
|
|
158
|
-
isSortable: this._isColumnSortable(column),
|
|
159
|
-
isSorted: sorted ? true : false,
|
|
160
|
-
isSortedDescending: sorted?.sortDirection === 1 ? true : false,
|
|
161
|
-
width: column.visualSizeFactor,
|
|
162
|
-
//comes from extended
|
|
163
|
-
isResizable: column.isResizable ?? true,
|
|
164
|
-
} as IGridColumn;
|
|
165
|
-
|
|
166
|
-
const condition = await this.filtering.condition(gridColumn);
|
|
167
|
-
gridColumn.isFiltered = condition.isAppliedToDataset;
|
|
168
|
-
gridColumn.isEditable = await this._isColumnEditable(gridColumn);
|
|
169
|
-
gridColumn.isRequired = await this._isColumnRequired(gridColumn);
|
|
170
|
-
|
|
171
|
-
if (gridColumn.displayName?.startsWith('__ribbon')) {
|
|
172
|
-
gridColumn.key = '__ribbon',
|
|
173
|
-
gridColumn.displayName.split('__ribbon$')?.[1]
|
|
174
|
-
gridColumn.isFilterable = false;
|
|
175
|
-
gridColumn.isSortable = false;
|
|
176
|
-
}
|
|
177
|
-
gridColumns.push(gridColumn);
|
|
178
|
-
}
|
|
179
|
-
if(this.selection.type !== undefined) {
|
|
180
|
-
gridColumns.unshift({
|
|
181
|
-
key: '__checkbox',
|
|
182
|
-
attributeName: '__checkbox',
|
|
183
|
-
width: 45,
|
|
184
|
-
})
|
|
185
|
-
}
|
|
186
|
-
this._columns = gridColumns;
|
|
187
|
-
return gridColumns;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
public refreshRecords(): IEntityRecord[] {
|
|
191
|
-
const records = [];
|
|
192
|
-
for (const [_, record] of Object.entries(this._dataset.records)) {
|
|
193
|
-
records.push(record);
|
|
194
|
-
}
|
|
195
|
-
this._records = records;
|
|
196
|
-
return records
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
private async _isColumnEditable(column: IGridColumn): Promise<boolean> {
|
|
200
|
-
//top priority, overriden through props
|
|
201
|
-
if (column.isEditable) {
|
|
202
|
-
return true;
|
|
203
|
-
}
|
|
204
|
-
//only allow editing if specifically allowed
|
|
205
|
-
if (!this._props.parameters.EnableEditing?.raw) {
|
|
206
|
-
return false;
|
|
207
|
-
}
|
|
208
|
-
//we are not supporting editing for linked entities
|
|
209
|
-
if (column.entityAliasName) {
|
|
210
|
-
return false;
|
|
211
|
-
}
|
|
212
|
-
//these field types do not support editing
|
|
213
|
-
switch (column.dataType) {
|
|
214
|
-
case DataType.FILE:
|
|
215
|
-
case DataType.IMAGE: {
|
|
216
|
-
return false;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
const metadata = await this._pcfContext.utils.getEntityMetadata(this._dataset.getTargetEntityType(), [column.attributeName]);
|
|
220
|
-
//IsEditable is not available in Power Apps
|
|
221
|
-
return metadata.Attributes.get(column.attributeName).attributeDescriptor.IsValidForUpdate
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
private async _isColumnRequired(column: IGridColumn) {
|
|
225
|
-
if (column.isRequired) {
|
|
226
|
-
return true;
|
|
227
|
-
}
|
|
228
|
-
if (!this.parameters.EnableEditing?.raw) {
|
|
229
|
-
return false;
|
|
230
|
-
}
|
|
231
|
-
const metadata = await this.metadata.get(column);
|
|
232
|
-
const requiredLevel = metadata.Attributes.get(column.attributeName).attributeDescriptor.RequiredLevel;
|
|
233
|
-
if (requiredLevel === 1 || requiredLevel === 2) {
|
|
234
|
-
return true;
|
|
235
|
-
}
|
|
236
|
-
return false;
|
|
237
|
-
}
|
|
238
|
-
private _isColumnSortable(column: IEntityColumn) {
|
|
239
|
-
if (this._props.parameters.EnableSorting?.raw === false) {
|
|
240
|
-
return false;
|
|
241
|
-
}
|
|
242
|
-
return !column.disableSorting;
|
|
243
|
-
}
|
|
244
|
-
private _isColumnFilterable(column: IEntityColumn) {
|
|
245
|
-
if (this.props.parameters.EnableFiltering?.raw === false) {
|
|
246
|
-
return false;
|
|
247
|
-
}
|
|
248
|
-
return column.isFilterable ?? true;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Grid } from "./Grid";
|
|
2
|
-
|
|
3
|
-
export class GridDependency {
|
|
4
|
-
protected _grid: Grid;
|
|
5
|
-
protected _refreshCallbacks: Map<string, () => any> = new Map();
|
|
6
|
-
|
|
7
|
-
constructor(grid: Grid) {
|
|
8
|
-
this._grid = grid;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
public addRefreshCallback(id: string, callback: () => any) {
|
|
12
|
-
this._refreshCallbacks.set(id, callback);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
public removeRefreshCallback(id: string) {
|
|
16
|
-
this._refreshCallbacks.delete(id);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public onDependenciesUpdated() {
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
protected _triggerRefreshCallbacks() {
|
|
24
|
-
for(const refreshCallback of this._refreshCallbacks.values()) {
|
|
25
|
-
refreshCallback();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
protected get _dataset() {
|
|
29
|
-
return this._grid.dataset;
|
|
30
|
-
}
|
|
31
|
-
protected get _pcfContext() {
|
|
32
|
-
return this._grid.pcfContext;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { IGridColumn } from "../interfaces/IGridColumn";
|
|
2
|
-
import { GridDependency } from "./GridDependency";
|
|
3
|
-
|
|
4
|
-
export class Metadata extends GridDependency {
|
|
5
|
-
public async get(column: IGridColumn): Promise<ComponentFramework.PropertyHelper.EntityMetadata> {
|
|
6
|
-
if(column.entityAliasName) {
|
|
7
|
-
const linkedEntity = this._grid.dataset.linking.getLinkedEntities().find(x => x.alias === column.entityAliasName)!;
|
|
8
|
-
return await this._grid.pcfContext.utils.getEntityMetadata(linkedEntity.name, [column.attributeName]);
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
11
|
-
return await this._grid.pcfContext.utils.getEntityMetadata(this._grid.dataset.getTargetEntityType(), [column.attributeName]);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
public async getOptions(column: IGridColumn): Promise<[number | boolean, ComponentFramework.PropertyHelper.OptionMetadata[]]> {
|
|
15
|
-
const columnMetadata = await this.get(column);
|
|
16
|
-
const options = columnMetadata.Attributes.get(column.attributeName).attributeDescriptor.OptionSet as ComponentFramework.PropertyHelper.OptionMetadata[]
|
|
17
|
-
const defaultValue = columnMetadata.Attributes.get(column.attributeName).DefaultFormValue as number | boolean;
|
|
18
|
-
return [defaultValue, options];
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { useGridInstance } from "../../../hooks/useGridInstance";
|
|
2
|
-
import { IUpdatedRecord } from "../model/RecordUpdateService";
|
|
3
|
-
|
|
4
|
-
interface IRecordUpdateServiceController {
|
|
5
|
-
isDirty: boolean,
|
|
6
|
-
hasInvalidRecords: boolean
|
|
7
|
-
updatedRecords: IUpdatedRecord[];
|
|
8
|
-
saveAll: () => Promise<boolean>;
|
|
9
|
-
clearAll: () => void,
|
|
10
|
-
record(recordId: string): {
|
|
11
|
-
get: () => IUpdatedRecord | undefined
|
|
12
|
-
setValue: (columnName: string, value: any) => void
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const useRecordUpdateServiceController = (): IRecordUpdateServiceController => {
|
|
17
|
-
const grid = useGridInstance();
|
|
18
|
-
const recordUpdateService = grid.recordUpdateService;
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
isDirty: recordUpdateService.isDirty,
|
|
22
|
-
hasInvalidRecords: recordUpdateService.hasInvalidRecords,
|
|
23
|
-
updatedRecords: [...recordUpdateService.updatedRecords.values()],
|
|
24
|
-
saveAll: () => recordUpdateService.saveAll(),
|
|
25
|
-
clearAll: () => recordUpdateService.clearAll(),
|
|
26
|
-
record: (recordId: string) => {
|
|
27
|
-
const record = recordUpdateService.record(recordId);
|
|
28
|
-
return {
|
|
29
|
-
get: () => record.get(),
|
|
30
|
-
setValue: (columnName: string, value: any) => {
|
|
31
|
-
record.setValue(columnName, value)
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import equal from "fast-deep-equal/es6";
|
|
2
|
-
import { cloneDeep } from "lodash";
|
|
3
|
-
import numeral from "numeral";
|
|
4
|
-
import { NumeralPCF } from "../../../../../../utils/NumeralPCF";
|
|
5
|
-
import { IEntityColumn, IEntityRecord } from "../../../../interfaces";
|
|
6
|
-
import { ColumnValidation } from "../../../../validation/model/ColumnValidation";
|
|
7
|
-
import { DataType } from "../../../enums/DataType";
|
|
8
|
-
import { Grid } from "../../../model/Grid";
|
|
9
|
-
import { GridDependency } from "../../../model/GridDependency";
|
|
10
|
-
|
|
11
|
-
export interface IUpdatedRecord extends Omit<IEntityRecord, 'save'> {
|
|
12
|
-
columns: Map<string, IEntityColumn>,
|
|
13
|
-
isValid: (columnKey: string) => boolean,
|
|
14
|
-
getOriginalValue: (columnKey: string) => any;
|
|
15
|
-
getOriginalFormattedValue: (columnKey: string) => any;
|
|
16
|
-
getOriginalFormattedPrimaryNameValue: () => any;
|
|
17
|
-
save: () => Promise<boolean>,
|
|
18
|
-
clear: () => void;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export class RecordUpdateService extends GridDependency {
|
|
22
|
-
private _updatedRecords: Map<string, IUpdatedRecord> = new Map();
|
|
23
|
-
private _internalRecordMap: Map<string, IEntityRecord> = new Map();
|
|
24
|
-
|
|
25
|
-
constructor(grid: Grid) {
|
|
26
|
-
super(grid);
|
|
27
|
-
const updatedRecordsFromState: IUpdatedRecord[] | undefined = this._grid.state?.['__updatedRecords'];
|
|
28
|
-
//@ts-ignore - getRecordId could be undefined if it comes from serialized state
|
|
29
|
-
if(updatedRecordsFromState && updatedRecordsFromState?.length > 0 && updatedRecordsFromState[0].getRecordId) {
|
|
30
|
-
this._updatedRecords = new Map(updatedRecordsFromState.map(x => {
|
|
31
|
-
const originalClear = x.clear;
|
|
32
|
-
const originalSetValue = x.setValue;
|
|
33
|
-
const originalSave = x.save;
|
|
34
|
-
x.clear = () => {
|
|
35
|
-
this._updatedRecords.delete(x.getRecordId());
|
|
36
|
-
originalClear();
|
|
37
|
-
this._pcfContext.factory.requestRender();
|
|
38
|
-
}
|
|
39
|
-
x.save = async () => {
|
|
40
|
-
const result = await originalSave();
|
|
41
|
-
if(result) {
|
|
42
|
-
this._updatedRecords.delete(x.getRecordId());
|
|
43
|
-
}
|
|
44
|
-
[...x.columns.values()].map(col => {
|
|
45
|
-
this._internalRecordMap.get(x.getRecordId())?.setValue(col.name, x.getValue(col.name));
|
|
46
|
-
})
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
x.setValue = (columnName: string, value: any) => {
|
|
50
|
-
originalSetValue(columnName, value);
|
|
51
|
-
this._pcfContext.factory.requestRender();
|
|
52
|
-
}
|
|
53
|
-
return [x.getRecordId(), x]
|
|
54
|
-
}))
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public get updatedRecords() {
|
|
59
|
-
if (this._isReadOnlyChangeEditor() && this._updatedRecords.size === 0) {
|
|
60
|
-
const record = this._grid.records[0];
|
|
61
|
-
for (const column of this._grid.columns) {
|
|
62
|
-
this.record(record.getRecordId()).setValue(column.key, record.getValue(column.key), true);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return [...this._updatedRecords.values()];
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
public get isDirty() {
|
|
69
|
-
return this._updatedRecords.size > 0;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
public get hasInvalidRecords() {
|
|
73
|
-
return [...this._updatedRecords.values()].find(x => {
|
|
74
|
-
for(const column of x.columns.values()) {
|
|
75
|
-
if(!x.isValid(column.name)) {
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return false;
|
|
80
|
-
}) ? true : false;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
public record(recordId: string) {
|
|
84
|
-
return {
|
|
85
|
-
get: () => this._updatedRecords.get(recordId),
|
|
86
|
-
setValue: (columnKey: string, value: any, doNotPropagateToDatasetRecord?: boolean) => {
|
|
87
|
-
if(!doNotPropagateToDatasetRecord && this._isEqual(columnKey, this._internalRecordMap.get(recordId)!.getValue(columnKey), value)) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
const updatedRecord = this._updatedRecords.get(recordId);
|
|
91
|
-
if (!updatedRecord) {
|
|
92
|
-
const deepCopiedRecord = cloneDeep(this._internalRecordMap.get(recordId)!);
|
|
93
|
-
this._updatedRecords.set(recordId, {
|
|
94
|
-
columns: new Map([[columnKey, this._getEntityColumnByKey(columnKey)]]),
|
|
95
|
-
getRecordId: () => recordId,
|
|
96
|
-
getValue: (columnKey: string) => this._internalRecordMap.get(recordId)?.getValue(columnKey)!,
|
|
97
|
-
getFormattedValue: (columnKey: string) => this._internalRecordMap.get(recordId)?.getFormattedValue(columnKey)!,
|
|
98
|
-
getNamedReference: () => deepCopiedRecord.getNamedReference(),
|
|
99
|
-
getOriginalValue: (columnKey: string) => deepCopiedRecord.getValue(columnKey),
|
|
100
|
-
getOriginalFormattedValue: (columnKey: string) => deepCopiedRecord.getFormattedValue(columnKey),
|
|
101
|
-
getOriginalFormattedPrimaryNameValue: () => {
|
|
102
|
-
let primaryColumn = this._dataset.columns.find(x => x.isPrimary);
|
|
103
|
-
if(!primaryColumn) {
|
|
104
|
-
primaryColumn = this._dataset.columns[0];
|
|
105
|
-
}
|
|
106
|
-
let value = deepCopiedRecord.getFormattedValue(primaryColumn.name);
|
|
107
|
-
if(!value) {
|
|
108
|
-
value = this._grid.labels["no-name"]();
|
|
109
|
-
}
|
|
110
|
-
return value;
|
|
111
|
-
},
|
|
112
|
-
setValue: (columnKey: string, value: any) => {
|
|
113
|
-
const updatedRecord = this._updatedRecords.get(recordId);
|
|
114
|
-
let originalValue = updatedRecord?.getOriginalValue(columnKey);
|
|
115
|
-
//if the new change is equal to the original record state, clear the internal dirty state
|
|
116
|
-
if(originalValue == value || equal(value, originalValue)) {
|
|
117
|
-
updatedRecord?.columns.delete(columnKey);
|
|
118
|
-
if(updatedRecord?.columns.size === 0) {
|
|
119
|
-
this._updatedRecords.delete(recordId);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
this._internalRecordMap.get(recordId)?.setValue(columnKey, value);
|
|
123
|
-
},
|
|
124
|
-
isValid: (columnKey: string) => {
|
|
125
|
-
const column = this._grid.columns.find(x => x.key === columnKey);
|
|
126
|
-
if(!column) {
|
|
127
|
-
return true;
|
|
128
|
-
}
|
|
129
|
-
const [result, message] = new ColumnValidation(this._grid, column).validate(this._internalRecordMap.get(recordId)?.getValue(columnKey)!)
|
|
130
|
-
return result;
|
|
131
|
-
},
|
|
132
|
-
clear: () => {
|
|
133
|
-
const updatedRecord = this._updatedRecords.get(recordId);
|
|
134
|
-
const columns = [...updatedRecord!.columns.values()];
|
|
135
|
-
this._updatedRecords.delete(recordId);
|
|
136
|
-
for(const column of columns) {
|
|
137
|
-
this._internalRecordMap.get(recordId)?.setValue(column.name, deepCopiedRecord.getValue(column.name));
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
save: async () => {
|
|
141
|
-
try {
|
|
142
|
-
await this._internalRecordMap.get(recordId)?.save();
|
|
143
|
-
this._updatedRecords.delete(recordId);
|
|
144
|
-
}
|
|
145
|
-
catch (err) {
|
|
146
|
-
this._grid.pcfContext.navigation.openErrorDialog({
|
|
147
|
-
message: 'An error occurred during saving. Some of you changes might now have been saved.',
|
|
148
|
-
//@ts-ignore
|
|
149
|
-
details: err.message
|
|
150
|
-
})
|
|
151
|
-
return false;
|
|
152
|
-
}
|
|
153
|
-
return true;
|
|
154
|
-
}
|
|
155
|
-
})
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
updatedRecord.columns.set(columnKey, this._getEntityColumnByKey(columnKey))
|
|
159
|
-
}
|
|
160
|
-
if (!doNotPropagateToDatasetRecord) {
|
|
161
|
-
const updatedRecord = this._updatedRecords.get(recordId);
|
|
162
|
-
if(this._isEqual(columnKey, updatedRecord?.getOriginalValue(columnKey)!, value)) {
|
|
163
|
-
updatedRecord?.columns.delete(columnKey);
|
|
164
|
-
if(updatedRecord?.columns.size === 0) {
|
|
165
|
-
this._updatedRecords.delete(recordId);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
updatedRecord?.setValue(columnKey, value);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
public async saveAll(): Promise<boolean> {
|
|
175
|
-
const savePromises: Promise<boolean>[] = [];
|
|
176
|
-
for (const record of this._updatedRecords.values()) {
|
|
177
|
-
savePromises.push(record.save());
|
|
178
|
-
}
|
|
179
|
-
const result = await Promise.all(savePromises);
|
|
180
|
-
return !result.find(x => x === false)
|
|
181
|
-
}
|
|
182
|
-
public async clearAll() {
|
|
183
|
-
for (const record of this._updatedRecords.values()) {
|
|
184
|
-
record.clear();
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
public onDependenciesUpdated(): void {
|
|
189
|
-
for (const [recordId, record] of Object.entries(this._grid.dataset.records)) {
|
|
190
|
-
this._internalRecordMap.set(recordId, record);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
private _getEntityColumnByKey(columnKey: string) {
|
|
194
|
-
const gridColumn = this._grid.columns.find(x => x.key === columnKey)!;
|
|
195
|
-
return this._dataset.columns.find(x => {
|
|
196
|
-
if (!gridColumn.entityAliasName) {
|
|
197
|
-
return x.name === gridColumn.attributeName;
|
|
198
|
-
}
|
|
199
|
-
return x.name === gridColumn.attributeName && x.alias === gridColumn.entityAliasName;
|
|
200
|
-
})!;
|
|
201
|
-
}
|
|
202
|
-
private _isReadOnlyChangeEditor() {
|
|
203
|
-
return this._grid.props.parameters.ChangeEditorMode?.raw === 'read';
|
|
204
|
-
}
|
|
205
|
-
private _isEqual(columnKey: string, oldValue: any, newValue: any) {
|
|
206
|
-
const column = this._grid.columns.find(x => x.key === columnKey);
|
|
207
|
-
//skip in special case for currency
|
|
208
|
-
//PCF has no info about the currency, which sometimes make it to ouput change
|
|
209
|
-
if(column?.dataType === DataType.CURRENCY) {
|
|
210
|
-
NumeralPCF.currency(this._grid.pcfContext.userSettings.numberFormattingInfo);
|
|
211
|
-
newValue = numeral(newValue).value();
|
|
212
|
-
if(newValue === oldValue) {
|
|
213
|
-
return true
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
if(oldValue == newValue) {
|
|
218
|
-
return true;
|
|
219
|
-
}
|
|
220
|
-
return equal(oldValue, newValue);
|
|
221
|
-
}
|
|
222
|
-
}
|