@talxis/base-controls 1.2408.1 → 1.2408.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DateTime/DateTime.js +133 -1
- package/dist/components/DateTime/DateTime.js.map +1 -0
- package/dist/components/DateTime/components/Calendar.js +63 -1
- package/dist/components/DateTime/components/Calendar.js.map +1 -0
- package/dist/components/DateTime/hooks/useDateTime.js +137 -1
- package/dist/components/DateTime/hooks/useDateTime.js.map +1 -0
- package/dist/components/DateTime/index.js +3 -1
- package/dist/components/DateTime/index.js.map +1 -0
- package/dist/components/DateTime/styles.js +37 -1
- package/dist/components/DateTime/styles.js.map +1 -0
- package/dist/components/DateTime/translations.js +23 -1
- package/dist/components/DateTime/translations.js.map +1 -0
- package/dist/components/Decimal/Decimal.js +200 -1
- package/dist/components/Decimal/Decimal.js.map +1 -0
- package/dist/components/Decimal/components/ArrowButtons.js +38 -1
- package/dist/components/Decimal/components/ArrowButtons.js.map +1 -0
- package/dist/components/Decimal/components/styles.js +26 -1
- package/dist/components/Decimal/components/styles.js.map +1 -0
- package/dist/components/Decimal/index.js +2 -1
- package/dist/components/Decimal/index.js.map +1 -0
- package/dist/components/Decimal/interfaces.d.ts +1 -1
- package/dist/components/Duration/Duration.js +132 -1
- package/dist/components/Duration/Duration.js.map +1 -0
- package/dist/components/Duration/durationOptions.d.ts +2 -0
- package/dist/components/Duration/durationOptions.js +27 -0
- package/dist/components/Duration/durationOptions.js.map +1 -0
- package/dist/components/Duration/index.js +2 -1
- package/dist/components/Duration/index.js.map +1 -0
- package/dist/components/Duration/translations.js +31 -1
- package/dist/components/Duration/translations.js.map +1 -0
- package/dist/components/Grid/Grid.js +30 -1
- package/dist/components/Grid/Grid.js.map +1 -0
- package/dist/components/Grid/GridContext.js +6 -1
- package/dist/components/Grid/GridContext.js.map +1 -0
- package/dist/components/Grid/constants.js +4 -1
- package/dist/components/Grid/constants.js.map +1 -0
- package/dist/components/Grid/core/components/AgGrid/AgGrid.js +85 -1
- package/dist/components/Grid/core/components/AgGrid/AgGrid.js.map +1 -0
- package/dist/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/EmptyRecords.js +12 -1
- package/dist/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/EmptyRecords.js.map +1 -0
- package/dist/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/styles.js +23 -1
- package/dist/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/styles.js.map +1 -0
- package/dist/components/Grid/core/components/AgGrid/components/LoadingOverlay/LoadingOverlay.js +11 -1
- package/dist/components/Grid/core/components/AgGrid/components/LoadingOverlay/LoadingOverlay.js.map +1 -0
- package/dist/components/Grid/core/components/AgGrid/components/LoadingOverlay/styles.js +82 -1
- package/dist/components/Grid/core/components/AgGrid/components/LoadingOverlay/styles.js.map +1 -0
- package/dist/components/Grid/core/components/AgGrid/controllers/useAgGridController.js +169 -1
- package/dist/components/Grid/core/components/AgGrid/controllers/useAgGridController.js.map +1 -0
- package/dist/components/Grid/core/components/AgGrid/model/AgGrid.js +116 -1
- package/dist/components/Grid/core/components/AgGrid/model/AgGrid.js.map +1 -0
- package/dist/components/Grid/core/components/AgGrid/styles.js +91 -1
- package/dist/components/Grid/core/components/AgGrid/styles.js.map +1 -0
- package/dist/components/Grid/core/components/Cell/Commands/Commands.js +29 -1
- package/dist/components/Grid/core/components/Cell/Commands/Commands.js.map +1 -0
- package/dist/components/Grid/core/components/Cell/Commands/Icon.js +14 -1
- package/dist/components/Grid/core/components/Cell/Commands/Icon.js.map +1 -0
- package/dist/components/Grid/core/components/Cell/Commands/styles.js +54 -1
- package/dist/components/Grid/core/components/Cell/Commands/styles.js.map +1 -0
- package/dist/components/Grid/core/components/Cell/Commands/useCommands.js +52 -1
- package/dist/components/Grid/core/components/Cell/Commands/useCommands.js.map +1 -0
- package/dist/components/Grid/core/components/Cell/EditableCell/EditableCell.js +148 -1
- package/dist/components/Grid/core/components/Cell/EditableCell/EditableCell.js.map +1 -0
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyCell.js +139 -1
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyCell.js.map +1 -0
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyOptionSet/ReadOnlyOptionSet.js +49 -1
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyOptionSet/ReadOnlyOptionSet.js.map +1 -0
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyOptionSet/styles.js +27 -1
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyOptionSet/styles.js.map +1 -0
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/styles.js +58 -1
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/styles.js.map +1 -0
- package/dist/components/Grid/core/components/ColumnHeader/ColumnHeader.js +60 -1
- package/dist/components/Grid/core/components/ColumnHeader/ColumnHeader.js.map +1 -0
- package/dist/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/GlobalCheckbox.js +26 -1
- package/dist/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/GlobalCheckbox.js.map +1 -0
- package/dist/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/styles.js +19 -1
- package/dist/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/styles.js.map +1 -0
- package/dist/components/Grid/core/components/ColumnHeader/styles.js +44 -1
- package/dist/components/Grid/core/components/ColumnHeader/styles.js.map +1 -0
- package/dist/components/Grid/core/components/Component/Component.js +53 -1
- package/dist/components/Grid/core/components/Component/Component.js.map +1 -0
- package/dist/components/Grid/core/components/Component/controller/useComponentController.js +31 -1
- package/dist/components/Grid/core/components/Component/controller/useComponentController.js.map +1 -0
- package/dist/components/Grid/core/components/Component/model/Component.js +225 -1
- package/dist/components/Grid/core/components/Component/model/Component.js.map +1 -0
- package/dist/components/Grid/core/components/Dialog/Constants.js +9 -1
- package/dist/components/Grid/core/components/Dialog/Constants.js.map +1 -0
- package/dist/components/Grid/core/components/Dialog/Styles.js +61 -1
- package/dist/components/Grid/core/components/Dialog/Styles.js.map +1 -0
- package/dist/components/Grid/core/components/Dialog/index.js +16 -1
- package/dist/components/Grid/core/components/Dialog/index.js.map +1 -0
- package/dist/components/Grid/core/components/Dialog/interfaces/index.js +1 -0
- package/dist/components/Grid/core/components/Dialog/interfaces/index.js.map +1 -0
- package/dist/components/Grid/core/components/Save/Save.js +47 -1
- package/dist/components/Grid/core/components/Save/Save.js.map +1 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/ChangeEditor.js +39 -1
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/ChangeEditor.js.map +1 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/RecordGrids.js +136 -1
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/RecordGrids.js.map +1 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/styles.js +54 -1
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/styles.js.map +1 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/styles.js +37 -1
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/styles.js.map +1 -0
- package/dist/components/Grid/core/components/Save/hooks/useSave.js +45 -1
- package/dist/components/Grid/core/components/Save/hooks/useSave.js.map +1 -0
- package/dist/components/Grid/core/components/Save/styles.js +44 -1
- package/dist/components/Grid/core/components/Save/styles.js.map +1 -0
- package/dist/components/Grid/core/controllers/useGridController.js +39 -1
- package/dist/components/Grid/core/controllers/useGridController.js.map +1 -0
- package/dist/components/Grid/core/enums/ConditionOperator.js +50 -1
- package/dist/components/Grid/core/enums/ConditionOperator.js.map +1 -0
- package/dist/components/Grid/core/enums/DataType.js +30 -1
- package/dist/components/Grid/core/enums/DataType.js.map +1 -0
- package/dist/components/Grid/core/hooks/useGridInstance.js +9 -1
- package/dist/components/Grid/core/hooks/useGridInstance.js.map +1 -0
- package/dist/components/Grid/core/hooks/useRefreshCallback.js +20 -1
- package/dist/components/Grid/core/hooks/useRefreshCallback.js.map +1 -0
- package/dist/components/Grid/core/hooks/useRerender.js +13 -1
- package/dist/components/Grid/core/hooks/useRerender.js.map +1 -0
- package/dist/components/Grid/core/model/Grid.js +249 -1
- package/dist/components/Grid/core/model/Grid.js.map +1 -0
- package/dist/components/Grid/core/model/GridDependency.js +28 -1
- package/dist/components/Grid/core/model/GridDependency.js.map +1 -0
- package/dist/components/Grid/core/model/Metadata.js +22 -1
- package/dist/components/Grid/core/model/Metadata.js.map +1 -0
- package/dist/components/Grid/core/services/RecordUpdateService/controllers/useRecordUpdateServiceController.js +25 -1
- package/dist/components/Grid/core/services/RecordUpdateService/controllers/useRecordUpdateServiceController.js.map +1 -0
- package/dist/components/Grid/core/services/RecordUpdateService/model/RecordUpdateService.js +190 -1
- package/dist/components/Grid/core/services/RecordUpdateService/model/RecordUpdateService.js.map +1 -0
- package/dist/components/Grid/filtering/components/FilterCallout/FilterCallout.js +50 -1
- package/dist/components/Grid/filtering/components/FilterCallout/FilterCallout.js.map +1 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionOperator/ConditionOperator.js +58 -1
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionOperator/ConditionOperator.js.map +1 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/ConditionValue.js +52 -1
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/ConditionValue.js.map +1 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/model/ConditionComponentValue.js +125 -1
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/model/ConditionComponentValue.js.map +1 -0
- package/dist/components/Grid/filtering/components/FilterCallout/styles.js +40 -1
- package/dist/components/Grid/filtering/components/FilterCallout/styles.js.map +1 -0
- package/dist/components/Grid/filtering/constants.js +51 -1
- package/dist/components/Grid/filtering/constants.js.map +1 -0
- package/dist/components/Grid/filtering/controller/useColumnFilterConditionController.js +42 -1
- package/dist/components/Grid/filtering/controller/useColumnFilterConditionController.js.map +1 -0
- package/dist/components/Grid/filtering/model/Condition.js +297 -1
- package/dist/components/Grid/filtering/model/Condition.js.map +1 -0
- package/dist/components/Grid/filtering/model/Filtering.js +78 -1
- package/dist/components/Grid/filtering/model/Filtering.js.map +1 -0
- package/dist/components/Grid/filtering/utils/FilteringUtilts.js +195 -1
- package/dist/components/Grid/filtering/utils/FilteringUtilts.js.map +1 -0
- package/dist/components/Grid/index.js +2 -1
- package/dist/components/Grid/index.js.map +1 -0
- package/dist/components/Grid/paging/components/Paging/Paging.js +63 -1
- package/dist/components/Grid/paging/components/Paging/Paging.js.map +1 -0
- package/dist/components/Grid/paging/components/Paging/styles.js +41 -1
- package/dist/components/Grid/paging/components/Paging/styles.js.map +1 -0
- package/dist/components/Grid/paging/controllers/usePagingController.js +23 -1
- package/dist/components/Grid/paging/controllers/usePagingController.js.map +1 -0
- package/dist/components/Grid/paging/model/Paging.js +56 -1
- package/dist/components/Grid/paging/model/Paging.js.map +1 -0
- package/dist/components/Grid/selection/controllers/useSelectionController.js +17 -1
- package/dist/components/Grid/selection/controllers/useSelectionController.js.map +1 -0
- package/dist/components/Grid/selection/model/Selection.js +69 -1
- package/dist/components/Grid/selection/model/Selection.js.map +1 -0
- package/dist/components/Grid/sorting/Sorting.js +33 -1
- package/dist/components/Grid/sorting/Sorting.js.map +1 -0
- package/dist/components/Grid/sorting/components/SortingContextualMenu/SortingContextualMenu.js +120 -1
- package/dist/components/Grid/sorting/components/SortingContextualMenu/SortingContextualMenu.js.map +1 -0
- package/dist/components/Grid/sorting/components/SortingContextualMenu/styles.js +15 -1
- package/dist/components/Grid/sorting/components/SortingContextualMenu/styles.js.map +1 -0
- package/dist/components/Grid/sorting/controllers/useColumnSortingController.js +21 -1
- package/dist/components/Grid/sorting/controllers/useColumnSortingController.js.map +1 -0
- package/dist/components/Grid/translations.js +81 -1
- package/dist/components/Grid/translations.js.map +1 -0
- package/dist/components/Grid/validation/controllers/useRecordValidationController.js +25 -1
- package/dist/components/Grid/validation/controllers/useRecordValidationController.js.map +1 -0
- package/dist/components/Grid/validation/model/ColumnValidation.js +84 -1
- package/dist/components/Grid/validation/model/ColumnValidation.js.map +1 -0
- package/dist/components/Lookup/Lookup.js +201 -1
- package/dist/components/Lookup/Lookup.js.map +1 -0
- package/dist/components/Lookup/components/RecordCreator.js +37 -1
- package/dist/components/Lookup/components/RecordCreator.js.map +1 -0
- package/dist/components/Lookup/components/TargetSelector.js +19 -1
- package/dist/components/Lookup/components/TargetSelector.js.map +1 -0
- package/dist/components/Lookup/hooks/useFetchXml.js +27 -1
- package/dist/components/Lookup/hooks/useFetchXml.js.map +1 -0
- package/dist/components/Lookup/hooks/useLoadedEntities.js +20 -1
- package/dist/components/Lookup/hooks/useLoadedEntities.js.map +1 -0
- package/dist/components/Lookup/hooks/useLookup.js +111 -1
- package/dist/components/Lookup/hooks/useLookup.js.map +1 -0
- package/dist/components/Lookup/index.js +3 -1
- package/dist/components/Lookup/index.js.map +1 -0
- package/dist/components/Lookup/styles.js +98 -1
- package/dist/components/Lookup/styles.js.map +1 -0
- package/dist/components/Lookup/translations.js +33 -1
- package/dist/components/Lookup/translations.js.map +1 -0
- package/dist/components/MultiSelectOptionSet/MultiSelectOptionSet.js +74 -1
- package/dist/components/MultiSelectOptionSet/MultiSelectOptionSet.js.map +1 -0
- package/dist/components/MultiSelectOptionSet/index.js +2 -1
- package/dist/components/MultiSelectOptionSet/index.js.map +1 -0
- package/dist/components/OptionSet/OptionSet.js +61 -1
- package/dist/components/OptionSet/OptionSet.js.map +1 -0
- package/dist/components/OptionSet/index.js +2 -1
- package/dist/components/OptionSet/index.js.map +1 -0
- package/dist/components/TextField/TextField.js +113 -1
- package/dist/components/TextField/TextField.js.map +1 -0
- package/dist/components/TextField/index.js +2 -1
- package/dist/components/TextField/index.js.map +1 -0
- package/dist/components/TwoOptions/TwoOptions.js +36 -1
- package/dist/components/TwoOptions/TwoOptions.js.map +1 -0
- package/dist/components/TwoOptions/index.js +2 -1
- package/dist/components/TwoOptions/index.js.map +1 -0
- package/dist/constants.js +35 -1
- package/dist/constants.js.map +1 -0
- package/dist/hooks/index.js +7 -1
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/useControl.js +95 -1
- package/dist/hooks/useControl.js.map +1 -0
- package/dist/hooks/useControlSizing.js +15 -1
- package/dist/hooks/useControlSizing.js.map +1 -0
- package/dist/hooks/useControlTheme.js +9 -1
- package/dist/hooks/useControlTheme.js.map +1 -0
- package/dist/hooks/useFocusIn.js +33 -1
- package/dist/hooks/useFocusIn.js.map +1 -0
- package/dist/hooks/useInputBasedControl.js +38 -1
- package/dist/hooks/useInputBasedControl.js.map +1 -0
- package/dist/hooks/useMouseOver.js +23 -1
- package/dist/hooks/useMouseOver.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -0
- package/dist/interfaces/index.js +1 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/utils/Numeral.js +64 -1
- package/dist/utils/Numeral.js.map +1 -0
- package/dist/utils/Theme.js +72 -1
- package/dist/utils/Theme.js.map +1 -0
- package/dist/utils/index.js +3 -1
- package/dist/utils/index.js.map +1 -0
- package/package.json +4 -2
- package/dist/Grid-b7e6190d.js +0 -1
- package/dist/components/DateTime/interfaces.js +0 -1
- package/dist/components/Decimal/interfaces.js +0 -1
- package/dist/components/Duration/interfaces.js +0 -1
- package/dist/components/Grid/core/interfaces/IGridColumn.js +0 -1
- package/dist/components/Grid/core/interfaces/IGridContext.js +0 -1
- package/dist/components/Grid/interfaces.js +0 -1
- package/dist/components/Lookup/interfaces.js +0 -1
- package/dist/components/MultiSelectOptionSet/interfaces.js +0 -1
- package/dist/components/OptionSet/interfaces.js +0 -1
- package/dist/components/TextField/interfaces.js +0 -1
- package/dist/components/TwoOptions/interfaces.js +0 -1
- package/dist/interfaces/context.js +0 -1
- package/dist/interfaces/parameters.js +0 -1
- package/dist/interfaces/property.js +0 -1
- package/dist/interfaces/theme.js +0 -1
|
@@ -1 +1,40 @@
|
|
|
1
|
-
import{mergeStyleSets
|
|
1
|
+
import { mergeStyleSets } from '@fluentui/react';
|
|
2
|
+
|
|
3
|
+
const filterCalloutStyles = mergeStyleSets({
|
|
4
|
+
controls: {
|
|
5
|
+
display: 'flex',
|
|
6
|
+
flexDirection: 'column',
|
|
7
|
+
gap: 10,
|
|
8
|
+
flexGrow: 1
|
|
9
|
+
},
|
|
10
|
+
root: {
|
|
11
|
+
minHeight: 200,
|
|
12
|
+
padding: 16,
|
|
13
|
+
'.ms-Callout-main': {
|
|
14
|
+
display: 'flex',
|
|
15
|
+
flexDirection: 'column',
|
|
16
|
+
gap: 10
|
|
17
|
+
},
|
|
18
|
+
'.TALXIS__combobox__root, [class*="TALXIS__textfield__root"], [class*="TALXIS__tag-picker__root"]': {
|
|
19
|
+
padding: `0x !important`
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
title: {
|
|
23
|
+
fontWeight: 600,
|
|
24
|
+
flexGrow: 1
|
|
25
|
+
},
|
|
26
|
+
header: {
|
|
27
|
+
display: 'flex',
|
|
28
|
+
'i': {
|
|
29
|
+
fontSize: 12
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
footer: {
|
|
33
|
+
display: 'flex',
|
|
34
|
+
gap: 10,
|
|
35
|
+
justifyContent: 'flex-end'
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export { filterCalloutStyles };
|
|
40
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../../../src/components/Grid/filtering/components/FilterCallout/styles.ts"],"sourcesContent":["import { mergeStyleSets } from \"@fluentui/react\";\n\nexport const filterCalloutStyles = mergeStyleSets({\n controls: {\n display: 'flex',\n flexDirection: 'column',\n gap: 10,\n flexGrow: 1\n },\n root: {\n minHeight: 200,\n padding: 16,\n '.ms-Callout-main': {\n display: 'flex',\n flexDirection: 'column',\n gap: 10\n },\n '.TALXIS__combobox__root, [class*=\"TALXIS__textfield__root\"], [class*=\"TALXIS__tag-picker__root\"]': {\n padding: `0x !important`\n }\n },\n title: {\n fontWeight: 600,\n flexGrow: 1\n },\n header: {\n display: 'flex',\n 'i': {\n fontSize: 12\n }\n },\n footer: {\n display: 'flex',\n gap: 10,\n justifyContent: 'flex-end'\n }\n});"],"names":[],"mappings":";;AAEO,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAC9C,IAAA,QAAQ,EAAE;AACN,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,aAAa,EAAE,QAAQ;AACvB,QAAA,GAAG,EAAE,EAAE;AACP,QAAA,QAAQ,EAAE,CAAC;AACd,KAAA;AACD,IAAA,IAAI,EAAE;AACF,QAAA,SAAS,EAAE,GAAG;AACd,QAAA,OAAO,EAAE,EAAE;AACX,QAAA,kBAAkB,EAAE;AAChB,YAAA,OAAO,EAAE,MAAM;AACf,YAAA,aAAa,EAAE,QAAQ;AACvB,YAAA,GAAG,EAAE,EAAE;AACV,SAAA;AACD,QAAA,kGAAkG,EAAE;AAChG,YAAA,OAAO,EAAE,CAAe,aAAA,CAAA;AAC3B,SAAA;AACJ,KAAA;AACD,IAAA,KAAK,EAAE;AACH,QAAA,UAAU,EAAE,GAAG;AACf,QAAA,QAAQ,EAAE,CAAC;AACd,KAAA;AACD,IAAA,MAAM,EAAE;AACJ,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,GAAG,EAAE;AACD,YAAA,QAAQ,EAAE,EAAE;AACf,SAAA;AACJ,KAAA;AACD,IAAA,MAAM,EAAE;AACJ,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,GAAG,EAAE,EAAE;AACP,QAAA,cAAc,EAAE,UAAU;AAC7B,KAAA;AACJ,CAAA;;;;"}
|
|
@@ -1 +1,51 @@
|
|
|
1
|
-
import{DatasetConditionOperator
|
|
1
|
+
import { DatasetConditionOperator } from '../core/enums/ConditionOperator.js';
|
|
2
|
+
|
|
3
|
+
const OPERATORS = [
|
|
4
|
+
{ type: DatasetConditionOperator.None, key: 'condition-none' },
|
|
5
|
+
{ type: DatasetConditionOperator.Equal, key: 'condition-equal' },
|
|
6
|
+
{ type: DatasetConditionOperator.NotEqual, key: 'condition-notequal' },
|
|
7
|
+
{ type: DatasetConditionOperator.GreaterThan, key: 'condition-greaterthan' },
|
|
8
|
+
{ type: DatasetConditionOperator.LessThan, key: 'condition-lessthan' },
|
|
9
|
+
{ type: DatasetConditionOperator.GreaterEqual, key: 'condition-greaterequal' },
|
|
10
|
+
{ type: DatasetConditionOperator.LessEqual, key: 'condition-lessequal' },
|
|
11
|
+
{ type: DatasetConditionOperator.Like, key: 'condition-like' },
|
|
12
|
+
{ type: DatasetConditionOperator.NotLike, key: 'condition-notlike' },
|
|
13
|
+
{ type: DatasetConditionOperator.In, key: 'condition-in' },
|
|
14
|
+
{ type: DatasetConditionOperator.NotIn, key: 'condition-notin' },
|
|
15
|
+
{ type: DatasetConditionOperator.Null, key: 'condition-null' },
|
|
16
|
+
{ type: DatasetConditionOperator.NotNull, key: 'condition-notnull' },
|
|
17
|
+
{ type: DatasetConditionOperator.Yesterday, key: 'condition-yesterday' },
|
|
18
|
+
{ type: DatasetConditionOperator.Today, key: 'condition-today' },
|
|
19
|
+
{ type: DatasetConditionOperator.Tomorrow, key: 'condition-tomorrow' },
|
|
20
|
+
{ type: DatasetConditionOperator.Last7Days, key: 'condition-last7days' },
|
|
21
|
+
{ type: DatasetConditionOperator.Next7Days, key: 'condition-next7days' },
|
|
22
|
+
{ type: DatasetConditionOperator.LastWeek, key: 'condition-lastweek' },
|
|
23
|
+
{ type: DatasetConditionOperator.ThisWeek, key: 'condition-thisweek' },
|
|
24
|
+
{ type: DatasetConditionOperator.LastMonth, key: 'condition-lastmonth' },
|
|
25
|
+
{ type: DatasetConditionOperator.ThisMonth, key: 'condition-thismonth' },
|
|
26
|
+
{ type: DatasetConditionOperator.On, key: 'condition-on' },
|
|
27
|
+
{ type: DatasetConditionOperator.OnOrBefore, key: 'condition-onorbefore' },
|
|
28
|
+
{ type: DatasetConditionOperator.OnOrAfter, key: 'condition-onorafter' },
|
|
29
|
+
{ type: DatasetConditionOperator.LastYear, key: 'condition-lastyear' },
|
|
30
|
+
{ type: DatasetConditionOperator.ThisYear, key: 'condition-thisyear' },
|
|
31
|
+
{ type: DatasetConditionOperator.LastXDays, key: 'condition-lastxdays' },
|
|
32
|
+
{ type: DatasetConditionOperator.NextXDays, key: 'condition-nextxdays' },
|
|
33
|
+
{ type: DatasetConditionOperator.LastXMonths, key: 'condition-lastxmonths' },
|
|
34
|
+
{ type: DatasetConditionOperator.NextXMonths, key: 'condition-nextxmonths' },
|
|
35
|
+
{ type: DatasetConditionOperator.Contains, key: 'condition-contains' },
|
|
36
|
+
{ type: DatasetConditionOperator.BeginWith, key: 'condition-beginwith' },
|
|
37
|
+
{ type: DatasetConditionOperator.DoesNotBeginWith, key: 'condition-doesnotbeginwith' },
|
|
38
|
+
{ type: DatasetConditionOperator.EndsWith, key: 'condition-endswith' },
|
|
39
|
+
{ type: DatasetConditionOperator.DoesNotEndWith, key: 'condition-doesnotendwith' },
|
|
40
|
+
{ type: DatasetConditionOperator.InFiscalPeriodAndYear, key: 'condition-infiscalperiodandyear' },
|
|
41
|
+
{ type: DatasetConditionOperator.Above, key: 'condition-above' },
|
|
42
|
+
{ type: DatasetConditionOperator.Under, key: 'condition-under' },
|
|
43
|
+
{ type: DatasetConditionOperator.NotUnder, key: 'condition-notunder' },
|
|
44
|
+
{ type: DatasetConditionOperator.AboveOrEqual, key: 'condition-aboveorequal' },
|
|
45
|
+
{ type: DatasetConditionOperator.UnderOrEqual, key: 'condition-underorequal' },
|
|
46
|
+
{ type: DatasetConditionOperator.ContainValues, key: 'condition-containvalues' },
|
|
47
|
+
{ type: DatasetConditionOperator.DoesNotContainValues, key: 'condition-doesnotcontainvalues' }, // Added missing operator
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
export { OPERATORS };
|
|
51
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../src/components/Grid/filtering/constants.ts"],"sourcesContent":["import { DatasetConditionOperator } from \"../core/enums/ConditionOperator\";\n\nexport const OPERATORS = [\n { type: DatasetConditionOperator.None, key: 'condition-none' },\n { type: DatasetConditionOperator.Equal, key: 'condition-equal' },\n { type: DatasetConditionOperator.NotEqual, key: 'condition-notequal' },\n { type: DatasetConditionOperator.GreaterThan, key: 'condition-greaterthan' },\n { type: DatasetConditionOperator.LessThan, key: 'condition-lessthan' },\n { type: DatasetConditionOperator.GreaterEqual, key: 'condition-greaterequal' },\n { type: DatasetConditionOperator.LessEqual, key: 'condition-lessequal' },\n { type: DatasetConditionOperator.Like, key: 'condition-like' },\n { type: DatasetConditionOperator.NotLike, key: 'condition-notlike' },\n { type: DatasetConditionOperator.In, key: 'condition-in' },\n { type: DatasetConditionOperator.NotIn, key: 'condition-notin' },\n { type: DatasetConditionOperator.Null, key: 'condition-null' },\n { type: DatasetConditionOperator.NotNull, key: 'condition-notnull' },\n { type: DatasetConditionOperator.Yesterday, key: 'condition-yesterday' },\n { type: DatasetConditionOperator.Today, key: 'condition-today' },\n { type: DatasetConditionOperator.Tomorrow, key: 'condition-tomorrow' },\n { type: DatasetConditionOperator.Last7Days, key: 'condition-last7days' },\n { type: DatasetConditionOperator.Next7Days, key: 'condition-next7days' },\n { type: DatasetConditionOperator.LastWeek, key: 'condition-lastweek' },\n { type: DatasetConditionOperator.ThisWeek, key: 'condition-thisweek' },\n { type: DatasetConditionOperator.LastMonth, key: 'condition-lastmonth' },\n { type: DatasetConditionOperator.ThisMonth, key: 'condition-thismonth' },\n { type: DatasetConditionOperator.On, key: 'condition-on' },\n { type: DatasetConditionOperator.OnOrBefore, key: 'condition-onorbefore' },\n { type: DatasetConditionOperator.OnOrAfter, key: 'condition-onorafter' },\n { type: DatasetConditionOperator.LastYear, key: 'condition-lastyear' },\n { type: DatasetConditionOperator.ThisYear, key: 'condition-thisyear' },\n { type: DatasetConditionOperator.LastXDays, key: 'condition-lastxdays' },\n { type: DatasetConditionOperator.NextXDays, key: 'condition-nextxdays' },\n { type: DatasetConditionOperator.LastXMonths, key: 'condition-lastxmonths' },\n { type: DatasetConditionOperator.NextXMonths, key: 'condition-nextxmonths' },\n { type: DatasetConditionOperator.Contains, key: 'condition-contains' },\n { type: DatasetConditionOperator.BeginWith, key: 'condition-beginwith' },\n { type: DatasetConditionOperator.DoesNotBeginWith, key: 'condition-doesnotbeginwith' },\n { type: DatasetConditionOperator.EndsWith, key: 'condition-endswith' },\n { type: DatasetConditionOperator.DoesNotEndWith, key: 'condition-doesnotendwith' },\n { type: DatasetConditionOperator.InFiscalPeriodAndYear, key: 'condition-infiscalperiodandyear' },\n { type: DatasetConditionOperator.Above, key: 'condition-above' },\n { type: DatasetConditionOperator.Under, key: 'condition-under' },\n { type: DatasetConditionOperator.NotUnder, key: 'condition-notunder' },\n { type: DatasetConditionOperator.AboveOrEqual, key: 'condition-aboveorequal' },\n { type: DatasetConditionOperator.UnderOrEqual, key: 'condition-underorequal' },\n { type: DatasetConditionOperator.ContainValues, key: 'condition-containvalues' },\n { type: DatasetConditionOperator.DoesNotContainValues, key: 'condition-doesnotcontainvalues' }, // Added missing operator\n];"],"names":[],"mappings":";;AAEa,MAAA,SAAS,GAAG;IACrB,EAAE,IAAI,EAAE,wBAAwB,CAAC,IAAI,EAAE,GAAG,EAAE,gBAAgB,EAAE;IAC9D,EAAE,IAAI,EAAE,wBAAwB,CAAC,KAAK,EAAE,GAAG,EAAE,iBAAiB,EAAE;IAChE,EAAE,IAAI,EAAE,wBAAwB,CAAC,QAAQ,EAAE,GAAG,EAAE,oBAAoB,EAAE;IACtE,EAAE,IAAI,EAAE,wBAAwB,CAAC,WAAW,EAAE,GAAG,EAAE,uBAAuB,EA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,EAAE,0BAA0B,EAAE;IAClF,EAAE,IAAI,EAAE,wBAAwB,CAAC,qBAAqB,EAAE,GAAG,EAAE,iCAAiC,EAAE;IAChG,EAAE,IAAI,EAAE,wBAAwB,CAAC,KAAK,EAAE,GAAG,EAAE,iBAAiB,EAAE;IAChE,EAAE,IAAI,EAAE,wBAAwB,CAAC,KAAK,EAAE,GAAG,EAAE,iBAAiB,EAAE;IAChE,EAAE,IAAI,EAAE,wBAAwB,CAAC,QAAQ,EAAE,GAAG,EAAE,oBAAoB,EAAE;IACtE,EAAE,IAAI,EAAE,wBAAwB,CAAC,YAAY,EAAE,GAAG,EAAE,wBAAwB,EAAE;IAC9E,EAAE,IAAI,EAAE,wBAAwB,CAAC,YAAY,EAAE,GAAG,EAAE,wBAAwB,EAAE;IAC9E,EAAE,IAAI,EAAE,wBAAwB,CAAC,aAAa,EAAE,GAAG,EAAE,yBAAyB,EAAE;IAChF,EAAE,IAAI,EAAE,wBAAwB,CAAC,oBAAoB,EAAE,GAAG,EAAE,gCAAgC,EAAE;;;;;"}
|
|
@@ -1 +1,42 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { useMemo, useState, useEffect } from 'react';
|
|
2
|
+
import { useGridInstance } from '../../core/hooks/useGridInstance.js';
|
|
3
|
+
import { useRefreshCallback } from '../../core/hooks/useRefreshCallback.js';
|
|
4
|
+
|
|
5
|
+
const useColumnFilterConditionController = (column) => {
|
|
6
|
+
const filtering = useGridInstance().filtering;
|
|
7
|
+
const conditionPromise = useMemo(() => filtering.condition(column), []);
|
|
8
|
+
const [controller, setController] = useState();
|
|
9
|
+
const refresh = async () => {
|
|
10
|
+
const condition = await conditionPromise;
|
|
11
|
+
setController(prevState => ({
|
|
12
|
+
...prevState,
|
|
13
|
+
isAppliedToDataset: condition.isAppliedToDataset,
|
|
14
|
+
column: condition?.column,
|
|
15
|
+
operator: {
|
|
16
|
+
get: () => condition.operator.get(),
|
|
17
|
+
set: (operator) => condition.operator.set(operator)
|
|
18
|
+
},
|
|
19
|
+
value: {
|
|
20
|
+
valid: condition.isValid,
|
|
21
|
+
get: () => condition.value.get(),
|
|
22
|
+
set: (value) => condition.value.set(value)
|
|
23
|
+
},
|
|
24
|
+
remove: () => condition?.remove(),
|
|
25
|
+
save: () => condition?.save(),
|
|
26
|
+
clear: () => condition?.clear()
|
|
27
|
+
}));
|
|
28
|
+
};
|
|
29
|
+
useRefreshCallback(conditionPromise, refresh);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
(async () => {
|
|
32
|
+
refresh();
|
|
33
|
+
})();
|
|
34
|
+
}, []);
|
|
35
|
+
if (!controller) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
return controller;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export { useColumnFilterConditionController };
|
|
42
|
+
//# sourceMappingURL=useColumnFilterConditionController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useColumnFilterConditionController.js","sources":["../../../../../src/components/Grid/filtering/controller/useColumnFilterConditionController.ts"],"sourcesContent":["import { useEffect, useMemo, useRef, useState } from \"react\";\nimport { DatasetConditionOperator } from \"../../core/enums/ConditionOperator\";\nimport { useGridInstance } from \"../../core/hooks/useGridInstance\"\nimport { useRefreshCallback } from \"../../core/hooks/useRefreshCallback\";\nimport { useRerender } from \"../../core/hooks/useRerender\";\nimport { IGridColumn } from \"../../core/interfaces/IGridColumn\";\nimport { Condition } from \"../model/Condition\";\n\nexport interface IColumnFilterConditionController {\n isAppliedToDataset: boolean,\n column: IGridColumn,\n value: {\n valid: boolean;\n get: () => any;\n set: (value: any) => void;\n }\n operator: {\n get: () => DatasetConditionOperator | undefined;\n set: (operator: DatasetConditionOperator) => void;\n },\n remove: () => void;\n save: () => Promise<boolean>;\n clear: () => void;\n}\n\nexport const useColumnFilterConditionController = (column: IGridColumn): IColumnFilterConditionController | null => {\n const filtering = useGridInstance().filtering;\n const conditionPromise = useMemo(() => filtering.condition(column), []);\n const [controller, setController] = useState<IColumnFilterConditionController>();\n \n const refresh = async () => {\n const condition = await conditionPromise;\n setController(prevState => ({\n ...prevState,\n isAppliedToDataset: condition.isAppliedToDataset,\n column: condition?.column,\n operator: {\n get: () => condition.operator.get(),\n set: (operator) => condition.operator.set(operator)\n },\n value: {\n valid: condition.isValid,\n get: () => condition.value.get(),\n set: (value) => condition.value.set(value)\n },\n remove: () => condition?.remove(),\n save: () => condition?.save(),\n clear: () => condition?.clear()\n }))\n }\n useRefreshCallback(conditionPromise, refresh);\n useEffect(() => {\n (async () => {\n refresh();\n })();\n }, []);\n\n\n if(!controller) {\n return null;\n }\n return controller;\n}"],"names":[],"mappings":";;;;AAyBa,MAAA,kCAAkC,GAAG,CAAC,MAAmB,KAA6C;AAC/G,IAAA,MAAM,SAAS,GAAG,eAAe,EAAE,CAAC,SAAS,CAAC;AAC9C,IAAA,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;IACxE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,EAAoC,CAAC;AAEjF,IAAA,MAAM,OAAO,GAAG,YAAW;AACvB,QAAA,MAAM,SAAS,GAAG,MAAM,gBAAgB,CAAC;AACzC,QAAA,aAAa,CAAC,SAAS,KAAK;AACxB,YAAA,GAAG,SAAS;YACZ,kBAAkB,EAAE,SAAS,CAAC,kBAAkB;YAChD,MAAM,EAAE,SAAS,EAAE,MAAM;AACzB,YAAA,QAAQ,EAAE;gBACN,GAAG,EAAE,MAAM,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE;AACnC,gBAAA,GAAG,EAAE,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;AACtD,aAAA;AACD,YAAA,KAAK,EAAE;gBACH,KAAK,EAAE,SAAS,CAAC,OAAO;gBACxB,GAAG,EAAE,MAAM,SAAS,CAAC,KAAK,CAAC,GAAG,EAAE;AAChC,gBAAA,GAAG,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC;AAC7C,aAAA;AACD,YAAA,MAAM,EAAE,MAAM,SAAS,EAAE,MAAM,EAAE;AACjC,YAAA,IAAI,EAAE,MAAM,SAAS,EAAE,IAAI,EAAE;AAC7B,YAAA,KAAK,EAAE,MAAM,SAAS,EAAE,KAAK,EAAE;AAClC,SAAA,CAAC,CAAC,CAAA;AACP,KAAC,CAAA;AACD,IAAA,kBAAkB,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IAC9C,SAAS,CAAC,MAAK;QACX,CAAC,YAAW;AACR,YAAA,OAAO,EAAE,CAAC;SACb,GAAG,CAAC;KACR,EAAE,EAAE,CAAC,CAAC;IAGP,IAAG,CAAC,UAAU,EAAE;AACZ,QAAA,OAAO,IAAI,CAAC;AACf,KAAA;AACD,IAAA,OAAO,UAAU,CAAC;AACtB;;;;"}
|
|
@@ -1 +1,297 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { DatasetConditionOperator } from '../../core/enums/ConditionOperator.js';
|
|
2
|
+
import { DataType } from '../../core/enums/DataType.js';
|
|
3
|
+
import { GridDependency } from '../../core/model/GridDependency.js';
|
|
4
|
+
import { ColumnValidation } from '../../validation/model/ColumnValidation.js';
|
|
5
|
+
import { FilteringUtils } from '../utils/FilteringUtilts.js';
|
|
6
|
+
|
|
7
|
+
class Condition extends GridDependency {
|
|
8
|
+
constructor(grid, column) {
|
|
9
|
+
super(grid);
|
|
10
|
+
this._isAppliedToDataset = false;
|
|
11
|
+
this._conditionExpression = {};
|
|
12
|
+
this._conditionUtils = FilteringUtils.condition();
|
|
13
|
+
this._isValid = true;
|
|
14
|
+
this._initialized = false;
|
|
15
|
+
this._column = { ...column };
|
|
16
|
+
switch (this._column.dataType) {
|
|
17
|
+
//this will skip regex validation since it is not desirable during filtering (we have contains and stuff)
|
|
18
|
+
case DataType.SINGLE_LINE_EMAIL:
|
|
19
|
+
case DataType.SINGLE_LINE_URL: {
|
|
20
|
+
this._column.dataType = DataType.SINGLE_LINE_TEXT;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return new Proxy(this, {
|
|
24
|
+
get: (target, prop) => {
|
|
25
|
+
if (prop !== 'init') {
|
|
26
|
+
if (!target._initialized) {
|
|
27
|
+
throw new Error('Condition has not been initialized. Make sure to call the init() method on the condition object before any operations.');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//@ts-ignore
|
|
31
|
+
if (typeof target[prop] === 'function') {
|
|
32
|
+
//@ts-ignore
|
|
33
|
+
return target[prop].bind(target);
|
|
34
|
+
}
|
|
35
|
+
//@ts-ignore
|
|
36
|
+
return target[prop];
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
async init() {
|
|
41
|
+
if (!this._inicializationPromise) {
|
|
42
|
+
this._inicializationPromise = new Promise(async (resolve) => {
|
|
43
|
+
const [map, key] = await this._getConditionFromFilterExpression();
|
|
44
|
+
if (!key) {
|
|
45
|
+
this._conditionExpression = this._getDefault();
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
this._isAppliedToDataset = true;
|
|
49
|
+
this._conditionExpression = map.get(key);
|
|
50
|
+
}
|
|
51
|
+
this._conditionExpression.conditionOperator = this._operatorDecorator(this._conditionExpression.conditionOperator, this._conditionExpression.value, true);
|
|
52
|
+
this._conditionExpression.value = this._valueDecorator(this._conditionExpression.conditionOperator, this._conditionExpression.value, true);
|
|
53
|
+
this._conditionExpression.attributeName = await this._attributeNameDecorator(this._conditionExpression.conditionOperator, this._conditionExpression.attributeName, true);
|
|
54
|
+
resolve(true);
|
|
55
|
+
this._initialized = true;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return this._inicializationPromise;
|
|
59
|
+
}
|
|
60
|
+
get isRemoved() {
|
|
61
|
+
return this._isRemoved;
|
|
62
|
+
}
|
|
63
|
+
get column() {
|
|
64
|
+
return this._column;
|
|
65
|
+
}
|
|
66
|
+
get isAppliedToDataset() {
|
|
67
|
+
return this._isAppliedToDataset;
|
|
68
|
+
}
|
|
69
|
+
get isValid() {
|
|
70
|
+
return this._isValid;
|
|
71
|
+
}
|
|
72
|
+
async getExpression() {
|
|
73
|
+
const result = { ...this._conditionExpression };
|
|
74
|
+
result.conditionOperator = this._operatorDecorator(this._conditionExpression.conditionOperator, this._conditionExpression.value);
|
|
75
|
+
result.value = this._valueDecorator(this._conditionExpression.conditionOperator, this._conditionExpression.value);
|
|
76
|
+
result.attributeName = await this._attributeNameDecorator(this._conditionExpression.conditionOperator, this._conditionExpression.attributeName);
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
async save() {
|
|
80
|
+
if (!await this.value.isValid()) {
|
|
81
|
+
this._isValid = false;
|
|
82
|
+
this._triggerRefreshCallbacks();
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
const filterExpression = this._filterExpression;
|
|
86
|
+
if (this._isAppliedToDataset || this._isRemoved) {
|
|
87
|
+
const [map, key] = await this._getConditionFromFilterExpression();
|
|
88
|
+
map.delete(key);
|
|
89
|
+
filterExpression.conditions = [...map.values()];
|
|
90
|
+
}
|
|
91
|
+
if (!this._isRemoved) {
|
|
92
|
+
filterExpression.conditions.push(await this.getExpression());
|
|
93
|
+
}
|
|
94
|
+
this._dataset.filtering.setFilter(filterExpression);
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
remove() {
|
|
98
|
+
this._isRemoved = true;
|
|
99
|
+
}
|
|
100
|
+
clear() {
|
|
101
|
+
this._inicializationPromise = undefined;
|
|
102
|
+
}
|
|
103
|
+
get operator() {
|
|
104
|
+
return {
|
|
105
|
+
get: () => this._get('operator'),
|
|
106
|
+
set: (conditionOperator) => {
|
|
107
|
+
const previousOperator = this._conditionExpression.conditionOperator;
|
|
108
|
+
this._set("operator", conditionOperator, null);
|
|
109
|
+
const isCurrentEditable = this._conditionUtils.value(conditionOperator).isManuallyEditable;
|
|
110
|
+
const isPreviousEditable = this._conditionUtils.value(previousOperator).isManuallyEditable;
|
|
111
|
+
if (isCurrentEditable !== isPreviousEditable) {
|
|
112
|
+
// we are transitioning between editable and non-editable operators and the value of these data types needs to be set to null
|
|
113
|
+
// to prevent type incompability
|
|
114
|
+
switch (this._column.dataType) {
|
|
115
|
+
case DataType.MULTI_SELECT_OPTIONSET:
|
|
116
|
+
case DataType.OPTIONSET:
|
|
117
|
+
case DataType.TWO_OPTIONS:
|
|
118
|
+
case DataType.LOOKUP_SIMPLE:
|
|
119
|
+
case DataType.LOOKUP_OWNER:
|
|
120
|
+
case DataType.LOOKUP_CUSTOMER:
|
|
121
|
+
case DataType.DATE_AND_TIME_DATE_AND_TIME:
|
|
122
|
+
case DataType.DATE_AND_TIME_DATE_ONLY: {
|
|
123
|
+
this._conditionExpression.value = "";
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
get value() {
|
|
132
|
+
return {
|
|
133
|
+
get: () => this._get('value'),
|
|
134
|
+
set: (value) => this._set("value", undefined, value),
|
|
135
|
+
isValid: async () => {
|
|
136
|
+
if (this._conditionUtils.operator(this.operator.get()).doesNotAllowValue) {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
const [result, errorMessage] = await new ColumnValidation(this._grid, this._column, true).validate(await this.value.get());
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
_get(type) {
|
|
145
|
+
if (type === 'operator') {
|
|
146
|
+
return this._conditionExpression.conditionOperator;
|
|
147
|
+
}
|
|
148
|
+
return this._conditionExpression.value;
|
|
149
|
+
}
|
|
150
|
+
_set(type, conditionOperator, value) {
|
|
151
|
+
this._isValid = true;
|
|
152
|
+
if (type === 'operator') {
|
|
153
|
+
this._conditionExpression.conditionOperator = conditionOperator;
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
this._conditionExpression.value = value;
|
|
157
|
+
}
|
|
158
|
+
this._triggerRefreshCallbacks();
|
|
159
|
+
}
|
|
160
|
+
async _attributeNameDecorator(conditionOperator, attributeName, undecorate) {
|
|
161
|
+
if (!this._conditionUtils.value(conditionOperator).isManuallyEditable) {
|
|
162
|
+
return attributeName;
|
|
163
|
+
}
|
|
164
|
+
switch (this._column.dataType) {
|
|
165
|
+
case DataType.OPTIONSET:
|
|
166
|
+
case DataType.TWO_OPTIONS:
|
|
167
|
+
case DataType.LOOKUP_OWNER:
|
|
168
|
+
case DataType.LOOKUP_SIMPLE:
|
|
169
|
+
case DataType.LOOKUP_CUSTOMER: {
|
|
170
|
+
if (undecorate) {
|
|
171
|
+
if (attributeName.endsWith('name')) {
|
|
172
|
+
return attributeName.slice(0, -4);
|
|
173
|
+
}
|
|
174
|
+
return attributeName;
|
|
175
|
+
}
|
|
176
|
+
if (attributeName.endsWith('name')) {
|
|
177
|
+
return attributeName;
|
|
178
|
+
}
|
|
179
|
+
return `${attributeName}name`;
|
|
180
|
+
}
|
|
181
|
+
default: {
|
|
182
|
+
return attributeName;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
_valueDecorator(conditionOperator, value, undecorate) {
|
|
187
|
+
switch (conditionOperator) {
|
|
188
|
+
case DatasetConditionOperator.BeginWith:
|
|
189
|
+
case DatasetConditionOperator.DoesNotBeginWith: {
|
|
190
|
+
if (undecorate) {
|
|
191
|
+
return value.slice(0, -1);
|
|
192
|
+
}
|
|
193
|
+
return `${value}%`;
|
|
194
|
+
}
|
|
195
|
+
case DatasetConditionOperator.EndsWith:
|
|
196
|
+
case DatasetConditionOperator.DoesNotEndWith: {
|
|
197
|
+
if (undecorate) {
|
|
198
|
+
return value.slice(1);
|
|
199
|
+
}
|
|
200
|
+
return `%${value}`;
|
|
201
|
+
}
|
|
202
|
+
case DatasetConditionOperator.Like:
|
|
203
|
+
case DatasetConditionOperator.NotLike: {
|
|
204
|
+
if (undecorate) {
|
|
205
|
+
return value.slice(1, -1);
|
|
206
|
+
}
|
|
207
|
+
return `%${value}%`;
|
|
208
|
+
}
|
|
209
|
+
default: {
|
|
210
|
+
return value;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
_operatorDecorator(conditionOperator, value, undecorate) {
|
|
215
|
+
switch (this._column.dataType) {
|
|
216
|
+
case DataType.MULTI_SELECT_OPTIONSET:
|
|
217
|
+
case DataType.OPTIONSET:
|
|
218
|
+
case DataType.TWO_OPTIONS:
|
|
219
|
+
case DataType.LOOKUP_OWNER:
|
|
220
|
+
case DataType.LOOKUP_SIMPLE:
|
|
221
|
+
case DataType.LOOKUP_CUSTOMER: {
|
|
222
|
+
//we need to switch the operators based on the number of selected options
|
|
223
|
+
if (typeof value !== 'string') {
|
|
224
|
+
if (undecorate) {
|
|
225
|
+
switch (conditionOperator) {
|
|
226
|
+
case DatasetConditionOperator.In: {
|
|
227
|
+
return DatasetConditionOperator.Equal;
|
|
228
|
+
}
|
|
229
|
+
case DatasetConditionOperator.NotIn: {
|
|
230
|
+
return DatasetConditionOperator.NotEqual;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
switch (conditionOperator) {
|
|
235
|
+
case DatasetConditionOperator.Equal: {
|
|
236
|
+
return DatasetConditionOperator.In;
|
|
237
|
+
}
|
|
238
|
+
case DatasetConditionOperator.NotEqual: {
|
|
239
|
+
return DatasetConditionOperator.NotIn;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
switch (conditionOperator) {
|
|
245
|
+
case DatasetConditionOperator.In: {
|
|
246
|
+
return DatasetConditionOperator.Equal;
|
|
247
|
+
}
|
|
248
|
+
case DatasetConditionOperator.NotIn: {
|
|
249
|
+
return DatasetConditionOperator.NotEqual;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return conditionOperator;
|
|
256
|
+
}
|
|
257
|
+
_getDefault() {
|
|
258
|
+
const cond = {
|
|
259
|
+
attributeName: this._column.attributeName,
|
|
260
|
+
conditionOperator: DatasetConditionOperator.Equal,
|
|
261
|
+
entityAliasName: this._column.entityAliasName,
|
|
262
|
+
value: ""
|
|
263
|
+
};
|
|
264
|
+
switch (this._column.dataType) {
|
|
265
|
+
case DataType.DATE_AND_TIME_DATE_AND_TIME:
|
|
266
|
+
case DataType.DATE_AND_TIME_DATE_ONLY: {
|
|
267
|
+
cond.conditionOperator = DatasetConditionOperator.On;
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
case DataType.IMAGE:
|
|
271
|
+
case DataType.FILE: {
|
|
272
|
+
cond.conditionOperator = DatasetConditionOperator.NotNull;
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return cond;
|
|
277
|
+
}
|
|
278
|
+
get _filterExpression() {
|
|
279
|
+
return structuredClone(this._dataset.filtering.getFilter()) ?? {
|
|
280
|
+
conditions: [],
|
|
281
|
+
filterOperator: 0
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
async _getConditionFromFilterExpression() {
|
|
285
|
+
const map = new Map(this._filterExpression.conditions.map(x => [x.attributeName, x]));
|
|
286
|
+
for (const cond of map.values()) {
|
|
287
|
+
const conditionAttributeName = await this._attributeNameDecorator(cond.conditionOperator, cond.attributeName, true);
|
|
288
|
+
if (conditionAttributeName === this._column.attributeName) {
|
|
289
|
+
return [map, cond.attributeName];
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return [map, ""];
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export { Condition };
|
|
297
|
+
//# sourceMappingURL=Condition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Condition.js","sources":["../../../../../src/components/Grid/filtering/model/Condition.ts"],"sourcesContent":["import { DatasetConditionOperator } from \"../../core/enums/ConditionOperator\";\nimport { DataType } from \"../../core/enums/DataType\";\nimport { IGridColumn } from \"../../core/interfaces/IGridColumn\";\nimport { Grid } from \"../../core/model/Grid\";\nimport { GridDependency } from \"../../core/model/GridDependency\";\nimport { ColumnValidation } from \"../../validation/model/ColumnValidation\";\nimport { FilteringUtils } from \"../utils/FilteringUtilts\";\n\nexport class Condition extends GridDependency {\n private _column: IGridColumn;\n private _isAppliedToDataset: boolean = false;\n private _conditionExpression: ComponentFramework.PropertyHelper.DataSetApi.ConditionExpression = {} as any;\n private _isRemoved?: boolean;\n private _conditionUtils = FilteringUtils.condition();\n private _isValid: boolean = true;\n private _inicializationPromise: Promise<boolean> | undefined;\n private _initialized: boolean = false;\n\n constructor(grid: Grid, column: IGridColumn) {\n super(grid);\n this._column = {...column};\n switch(this._column.dataType) {\n //this will skip regex validation since it is not desirable during filtering (we have contains and stuff)\n case DataType.SINGLE_LINE_EMAIL:\n case DataType.SINGLE_LINE_URL: {\n this._column.dataType = DataType.SINGLE_LINE_TEXT;\n }\n }\n return new Proxy(this, {\n get: (target, prop) => {\n if(prop !== 'init') {\n if(!target._initialized) {\n throw new Error('Condition has not been initialized. Make sure to call the init() method on the condition object before any operations.')\n }\n }\n //@ts-ignore\n if (typeof target[prop] === 'function') {\n //@ts-ignore\n return target[prop].bind(target);\n }\n //@ts-ignore\n return target[prop];\n }\n })\n }\n public async init() {\n if (!this._inicializationPromise) {\n this._inicializationPromise = new Promise(async (resolve) => {\n const [map, key] = await this._getConditionFromFilterExpression();\n if(!key) {\n this._conditionExpression = this._getDefault();\n }\n else {\n this._isAppliedToDataset = true;\n this._conditionExpression = map.get(key)!;\n }\n this._conditionExpression.conditionOperator = this._operatorDecorator(this._conditionExpression.conditionOperator, this._conditionExpression.value, true) as any;\n this._conditionExpression.value = this._valueDecorator(this._conditionExpression.conditionOperator, this._conditionExpression.value, true);\n this._conditionExpression.attributeName = await this._attributeNameDecorator(this._conditionExpression.conditionOperator, this._conditionExpression.attributeName, true);\n resolve(true);\n this._initialized = true;\n })\n }\n return this._inicializationPromise;\n }\n public get isRemoved() {\n return this._isRemoved;\n }\n\n public get column() {\n return this._column;\n }\n\n public get isAppliedToDataset() {\n return this._isAppliedToDataset;\n }\n\n public get isValid() {\n return this._isValid;\n }\n\n public async getExpression() {\n const result = { ...this._conditionExpression };\n result.conditionOperator = this._operatorDecorator(this._conditionExpression.conditionOperator, this._conditionExpression.value) as any;\n result.value = this._valueDecorator(this._conditionExpression.conditionOperator, this._conditionExpression.value);\n result.attributeName = await this._attributeNameDecorator(this._conditionExpression.conditionOperator, this._conditionExpression.attributeName);\n return result;\n\n }\n public async save(): Promise<boolean> {\n if (!await this.value.isValid()) {\n this._isValid = false;\n this._triggerRefreshCallbacks();\n return false;\n }\n const filterExpression = this._filterExpression;\n if (this._isAppliedToDataset || this._isRemoved) {\n const [map, key] = await this._getConditionFromFilterExpression();\n map.delete(key);\n filterExpression.conditions = [...map.values()];\n }\n if (!this._isRemoved) {\n filterExpression.conditions.push(await this.getExpression());\n }\n this._dataset.filtering.setFilter(filterExpression);\n return true;\n\n }\n public remove() {\n this._isRemoved = true;\n }\n public clear() {\n this._inicializationPromise = undefined;\n }\n public get operator() {\n return {\n get: () => this._get('operator') as DatasetConditionOperator,\n set: (conditionOperator: DatasetConditionOperator) => {\n const previousOperator = this._conditionExpression.conditionOperator\n this._set(\"operator\", conditionOperator, null);\n const isCurrentEditable = this._conditionUtils.value(conditionOperator).isManuallyEditable;\n const isPreviousEditable = this._conditionUtils.value(previousOperator).isManuallyEditable;\n\n if (isCurrentEditable !== isPreviousEditable) {\n // we are transitioning between editable and non-editable operators and the value of these data types needs to be set to null\n // to prevent type incompability\n switch (this._column.dataType) {\n case DataType.MULTI_SELECT_OPTIONSET:\n case DataType.OPTIONSET:\n case DataType.TWO_OPTIONS:\n case DataType.LOOKUP_SIMPLE:\n case DataType.LOOKUP_OWNER:\n case DataType.LOOKUP_CUSTOMER:\n case DataType.DATE_AND_TIME_DATE_AND_TIME:\n case DataType.DATE_AND_TIME_DATE_ONLY: {\n this._conditionExpression!.value = \"\"\n break;\n }\n }\n }\n },\n }\n }\n\n public get value() {\n return {\n get: () => this._get('value') as any,\n set: (value: any) => this._set(\"value\", undefined, value),\n isValid: async () => {\n if(this._conditionUtils.operator(this.operator.get()).doesNotAllowValue) {\n return true;\n }\n const [result, errorMessage] = await new ColumnValidation(this._grid, this._column, true).validate(await this.value.get());\n return result;\n }\n }\n }\n private _get(type: 'operator' | 'value'): DatasetConditionOperator | any {\n if (type === 'operator') {\n return this._conditionExpression.conditionOperator;\n }\n return this._conditionExpression.value;\n }\n private _set(type: 'operator' | 'value', conditionOperator?: DatasetConditionOperator, value?: any) {\n this._isValid = true;\n if (type === 'operator') {\n this._conditionExpression.conditionOperator = conditionOperator as any;\n }\n else {\n this._conditionExpression.value = value;\n }\n this._triggerRefreshCallbacks();\n }\n\n private async _attributeNameDecorator(conditionOperator: DatasetConditionOperator, attributeName: string, undecorate?: boolean) {\n if (!this._conditionUtils.value(conditionOperator).isManuallyEditable) {\n return attributeName;\n }\n switch (this._column.dataType) {\n case DataType.OPTIONSET:\n case DataType.TWO_OPTIONS:\n case DataType.LOOKUP_OWNER:\n case DataType.LOOKUP_SIMPLE:\n case DataType.LOOKUP_CUSTOMER: {\n if (undecorate) {\n if (attributeName.endsWith('name')) {\n return attributeName.slice(0, -4);\n }\n return attributeName;\n }\n if (attributeName.endsWith('name')) {\n return attributeName;\n }\n return `${attributeName}name`\n }\n default: {\n return attributeName;\n }\n }\n }\n private _valueDecorator(conditionOperator: DatasetConditionOperator, value: any, undecorate?: boolean) {\n switch (conditionOperator) {\n case DatasetConditionOperator.BeginWith:\n case DatasetConditionOperator.DoesNotBeginWith: {\n if (undecorate) {\n return value.slice(0, -1);\n }\n return `${value}%`;\n }\n case DatasetConditionOperator.EndsWith:\n case DatasetConditionOperator.DoesNotEndWith: {\n if (undecorate) {\n return value.slice(1)\n }\n return `%${value}`;\n }\n case DatasetConditionOperator.Like:\n case DatasetConditionOperator.NotLike: {\n if (undecorate) {\n return value.slice(1, -1)\n }\n return `%${value}%`;\n }\n default: {\n return value;\n }\n }\n }\n\n private _operatorDecorator(conditionOperator: DatasetConditionOperator, value: any, undecorate?: boolean): DatasetConditionOperator {\n switch (this._column.dataType) {\n case DataType.MULTI_SELECT_OPTIONSET:\n case DataType.OPTIONSET:\n case DataType.TWO_OPTIONS:\n case DataType.LOOKUP_OWNER:\n case DataType.LOOKUP_SIMPLE:\n case DataType.LOOKUP_CUSTOMER: {\n //we need to switch the operators based on the number of selected options\n if (typeof value !== 'string') {\n if(undecorate) {\n switch(conditionOperator) {\n case DatasetConditionOperator.In: {\n return DatasetConditionOperator.Equal\n }\n case DatasetConditionOperator.NotIn: {\n return DatasetConditionOperator.NotEqual;\n }\n }\n }\n switch (conditionOperator) {\n case DatasetConditionOperator.Equal: {\n return DatasetConditionOperator.In;\n }\n case DatasetConditionOperator.NotEqual: {\n return DatasetConditionOperator.NotIn;\n }\n }\n }\n else {\n switch (conditionOperator) {\n case DatasetConditionOperator.In: {\n return DatasetConditionOperator.Equal;\n }\n case DatasetConditionOperator.NotIn: {\n return DatasetConditionOperator.NotEqual;\n }\n }\n }\n }\n }\n return conditionOperator;\n }\n\n private _getDefault(): ComponentFramework.PropertyHelper.DataSetApi.ConditionExpression {\n const cond: ComponentFramework.PropertyHelper.DataSetApi.ConditionExpression = {\n attributeName: this._column.attributeName,\n conditionOperator: DatasetConditionOperator.Equal,\n entityAliasName: this._column.entityAliasName,\n value: \"\"\n }\n switch (this._column.dataType) {\n case DataType.DATE_AND_TIME_DATE_AND_TIME:\n case DataType.DATE_AND_TIME_DATE_ONLY: {\n cond.conditionOperator = DatasetConditionOperator.On;\n break;\n }\n case DataType.IMAGE:\n case DataType.FILE: {\n cond.conditionOperator = DatasetConditionOperator.NotNull as any;\n break;\n }\n }\n return cond;\n }\n private get _filterExpression() {\n return structuredClone(this._dataset.filtering.getFilter()) ?? {\n conditions: [],\n filterOperator: 0\n }\n }\n private async _getConditionFromFilterExpression(): Promise<[Map<string, ComponentFramework.PropertyHelper.DataSetApi.ConditionExpression>, string]> {\n const map = new Map<string, ComponentFramework.PropertyHelper.DataSetApi.ConditionExpression>(this._filterExpression.conditions.map(x => [x.attributeName, x]));\n for (const cond of map.values()) {\n const conditionAttributeName = await this._attributeNameDecorator(cond.conditionOperator, cond.attributeName, true);\n if(conditionAttributeName === this._column.attributeName) {\n return [map, cond.attributeName]\n }\n }\n return [map, \"\"];\n }\n}"],"names":[],"mappings":";;;;;;AAQM,MAAO,SAAU,SAAQ,cAAc,CAAA;IAUzC,WAAY,CAAA,IAAU,EAAE,MAAmB,EAAA;QACvC,KAAK,CAAC,IAAI,CAAC,CAAC;QATR,IAAmB,CAAA,mBAAA,GAAY,KAAK,CAAC;QACrC,IAAoB,CAAA,oBAAA,GAAqE,EAAS,CAAC;AAEnG,QAAA,IAAA,CAAA,eAAe,GAAG,cAAc,CAAC,SAAS,EAAE,CAAC;QAC7C,IAAQ,CAAA,QAAA,GAAY,IAAI,CAAC;QAEzB,IAAY,CAAA,YAAA,GAAY,KAAK,CAAC;AAIlC,QAAA,IAAI,CAAC,OAAO,GAAG,EAAC,GAAG,MAAM,EAAC,CAAC;AAC3B,QAAA,QAAO,IAAI,CAAC,OAAO,CAAC,QAAQ;;YAExB,KAAK,QAAQ,CAAC,iBAAiB,CAAC;AAChC,YAAA,KAAK,QAAQ,CAAC,eAAe,EAAE;gBAC3B,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,gBAAgB,CAAC;AACrD,aAAA;AACJ,SAAA;AACD,QAAA,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE;AACnB,YAAA,GAAG,EAAE,CAAC,MAAM,EAAE,IAAI,KAAI;gBAClB,IAAG,IAAI,KAAK,MAAM,EAAE;AAChB,oBAAA,IAAG,CAAC,MAAM,CAAC,YA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,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAChK,QAAA,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,MAAM,EAAE,EAAE;AAC7B,YAAA,MAAM,sBAAsB,GAAG,MAAM,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;AACpH,YAAA,IAAG,sBAAsB,KAAK,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE;AACtD,gBAAA,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,CAAC,CAAA;AACnC,aAAA;AACJ,SAAA;AACD,QAAA,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;KACpB;AACJ;;;;"}
|
|
@@ -1 +1,78 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { GridDependency } from '../../core/model/GridDependency.js';
|
|
2
|
+
import { Condition } from './Condition.js';
|
|
3
|
+
|
|
4
|
+
class Filtering extends GridDependency {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this._conditions = new Map();
|
|
8
|
+
}
|
|
9
|
+
async save() {
|
|
10
|
+
const filterExpression = this._filterExpression;
|
|
11
|
+
for (const condition of this._conditions.values()) {
|
|
12
|
+
if (!condition.value.isValid()) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
const expression = await condition.getExpression();
|
|
16
|
+
if (condition.isAppliedToDataset || condition.isRemoved) {
|
|
17
|
+
filterExpression.conditions = this._filterExpression.conditions.filter(cond => this._getColumnKeyFromCondition(cond) !== condition.column.key);
|
|
18
|
+
}
|
|
19
|
+
if (!condition.isRemoved) {
|
|
20
|
+
filterExpression.conditions.push(expression);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
this.clear();
|
|
24
|
+
this._dataset.filtering.setFilter(filterExpression);
|
|
25
|
+
this._dataset.refresh();
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
clear() {
|
|
29
|
+
this._conditions.clear();
|
|
30
|
+
}
|
|
31
|
+
async condition(column) {
|
|
32
|
+
const columnKey = column.key;
|
|
33
|
+
if (!this._conditions.get(columnKey)) {
|
|
34
|
+
this._conditions.set(columnKey, new Condition(this._grid, column));
|
|
35
|
+
}
|
|
36
|
+
const cond = new Proxy(this._conditions.get(columnKey), {
|
|
37
|
+
get: (target, prop) => {
|
|
38
|
+
if (prop === 'save') {
|
|
39
|
+
return async () => {
|
|
40
|
+
const saveResult = await target.save();
|
|
41
|
+
if (saveResult) {
|
|
42
|
+
this._conditions.delete(target.column.key);
|
|
43
|
+
this._dataset.refresh();
|
|
44
|
+
}
|
|
45
|
+
return saveResult;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if (prop === 'clear') {
|
|
49
|
+
this._conditions.delete(target.column.key);
|
|
50
|
+
}
|
|
51
|
+
//@ts-ignore
|
|
52
|
+
if (typeof target[prop] === 'function') {
|
|
53
|
+
//@ts-ignore
|
|
54
|
+
return target[prop].bind(target);
|
|
55
|
+
}
|
|
56
|
+
//@ts-ignore
|
|
57
|
+
return target[prop];
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
await cond.init();
|
|
61
|
+
return cond;
|
|
62
|
+
}
|
|
63
|
+
get _filterExpression() {
|
|
64
|
+
return structuredClone(this._grid.dataset.filtering.getFilter()) ?? {
|
|
65
|
+
conditions: [],
|
|
66
|
+
filterOperator: 0
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
_getColumnKeyFromCondition(condition) {
|
|
70
|
+
if (condition.entityAliasName) {
|
|
71
|
+
return `${condition.entityAliasName}.${condition.attributeName}`;
|
|
72
|
+
}
|
|
73
|
+
return condition.attributeName;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { Filtering };
|
|
78
|
+
//# sourceMappingURL=Filtering.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Filtering.js","sources":["../../../../../src/components/Grid/filtering/model/Filtering.ts"],"sourcesContent":["import { IGridColumn } from \"../../core/interfaces/IGridColumn\";\nimport { GridDependency } from \"../../core/model/GridDependency\";\nimport { Condition } from \"./Condition\";\n\nexport class Filtering extends GridDependency {\n private _conditions: Map<string, Condition> = new Map();\n\n public async save(): Promise<boolean> {\n const filterExpression = this._filterExpression;\n for (const condition of this._conditions.values()) {\n if(!condition.value.isValid()) {\n return false;\n }\n const expression = await condition.getExpression();\n if (condition.isAppliedToDataset || condition.isRemoved) {\n filterExpression.conditions = this._filterExpression.conditions.filter(cond => this._getColumnKeyFromCondition(cond) !== condition.column.key);\n }\n if (!condition.isRemoved) {\n filterExpression.conditions.push(expression)\n }\n }\n this.clear();\n this._dataset.filtering.setFilter(filterExpression);\n this._dataset.refresh();\n return true;\n }\n\n public clear() {\n this._conditions.clear();\n }\n\n public async condition(column: IGridColumn): Promise<Condition> {\n const columnKey = column.key\n if (!this._conditions.get(columnKey)) {\n this._conditions.set(columnKey, new Condition(this._grid, column))\n }\n const cond = new Proxy(this._conditions.get(columnKey)!, {\n get: (target, prop) => {\n if (prop === 'save') {\n return async () => {\n const saveResult = await target.save();\n if (saveResult) {\n this._conditions.delete(target.column.key);\n this._dataset.refresh();\n }\n return saveResult;\n };\n }\n if(prop === 'clear') {\n this._conditions.delete(target.column.key);\n }\n //@ts-ignore\n if (typeof target[prop] === 'function') {\n //@ts-ignore\n return target[prop].bind(target);\n }\n //@ts-ignore\n return target[prop];\n },\n });\n await cond.init();\n return cond;\n }\n\n private get _filterExpression() {\n return structuredClone(this._grid.dataset.filtering.getFilter()) ?? {\n conditions: [],\n filterOperator: 0\n }\n }\n\n private _getColumnKeyFromCondition(condition: ComponentFramework.PropertyHelper.DataSetApi.ConditionExpression) {\n if (condition.entityAliasName) {\n return `${condition.entityAliasName}.${condition.attributeName}`;\n }\n return condition.attributeName;\n }\n}\n"],"names":[],"mappings":";;;AAIM,MAAO,SAAU,SA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