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