@zohodesk/library-platform 1.1.12-exp.1 → 1.1.12-exp.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/bc/app-context/Properties.js +19 -0
- package/es/bc/float-pagination/ActionHandlers.js +1 -0
- package/es/bc/float-pagination/Constants.js +4 -0
- package/es/bc/float-pagination/Properties.js +18 -0
- package/es/bc/float-pagination/index.js +2 -0
- package/es/bc/index.js +0 -1
- package/es/bc/search/Constants.js +3 -0
- package/es/bc/search/EventHandlers.js +1 -0
- package/es/bc/search/Properties.js +11 -0
- package/es/bc/search/index.js +2 -0
- package/es/bc/zlist/Constants.js +0 -1
- package/es/bc/zlist/Types.js +10 -0
- package/es/bc/zrecord/Constants.js +1 -0
- package/es/bc/zrecord/Schemas.js +29 -0
- package/es/bc/zrecord/Types.js +45 -0
- package/es/cc/action-icon/Properties.js +20 -1
- package/es/cc/floating-pagination/Constants.js +6 -0
- package/es/cc/floating-pagination/Events.js +8 -0
- package/es/cc/floating-pagination/Properties.js +56 -0
- package/es/cc/floating-pagination/index.js +3 -0
- package/es/cc/ribbon/Properties.js +59 -0
- package/es/cc/ribbon/index.js +1 -0
- package/es/cc/table-connected/Properties.js +16 -0
- package/es/cc/table-connected/SdkContract.js +21 -0
- package/es/cc/table-connected/constants/Events.js +2 -0
- package/es/cc/table-list/Actions.js +0 -2
- package/es/cc/table-list/Constants.js +1 -1
- package/es/cc/table-list/Events.js +0 -2
- package/es/cc/table-list/Properties.js +34 -3
- package/es/library/behaviours/float-pagination/adapters/controllers/DestructController.js +18 -0
- package/es/library/behaviours/float-pagination/adapters/controllers/FloatPaginationController.js +25 -0
- package/es/library/behaviours/float-pagination/adapters/controllers/InitializeController.js +18 -0
- package/es/library/behaviours/float-pagination/adapters/controllers/ScrollBottomController.js +23 -0
- package/es/library/behaviours/float-pagination/adapters/controllers/ScrollTopController.js +23 -0
- package/es/library/behaviours/float-pagination/adapters/controllers/UpdateIndexController.js +30 -0
- package/es/library/behaviours/float-pagination/adapters/gateway/Repository.js +27 -0
- package/es/library/behaviours/float-pagination/adapters/gateway/Service.js +20 -0
- package/es/library/behaviours/float-pagination/adapters/presenter/Presenter.js +16 -0
- package/es/library/behaviours/float-pagination/applications/interfaces/input/ScrollTopInputModel.js +1 -0
- package/es/library/behaviours/float-pagination/applications/interfaces/input/ScrollbottomInputModel.js +1 -0
- package/es/library/behaviours/float-pagination/applications/interfaces/input/UpdateIndexInputModel.js +1 -0
- package/es/library/behaviours/float-pagination/applications/interfaces/output/FloatPaginationOutputModel.js +1 -0
- package/es/library/behaviours/float-pagination/applications/interfaces/output/IPresenter.js +1 -0
- package/es/library/behaviours/float-pagination/applications/usecases/DestructUsecase.js +15 -0
- package/es/library/behaviours/float-pagination/applications/usecases/FloatPaginationUseCase.js +31 -0
- package/es/library/behaviours/float-pagination/applications/usecases/InitializeUsecase.js +16 -0
- package/es/library/behaviours/float-pagination/applications/usecases/ScrollBottomUseCase.js +23 -0
- package/es/library/behaviours/float-pagination/applications/usecases/ScrollTopUseCase.js +23 -0
- package/es/library/behaviours/float-pagination/applications/usecases/UpdateIndexUseCase.js +28 -0
- package/es/library/behaviours/float-pagination/domain/entities/FloatPagination.js +28 -0
- package/es/library/behaviours/float-pagination/domain/entities/interfaces/IFloatPagination.js +1 -0
- package/es/library/behaviours/float-pagination/frameworks/ui/ActionsHandlerFactory.js +37 -0
- package/es/library/behaviours/float-pagination/frameworks/ui/FloatPaginationBehaviourFactory.js +21 -0
- package/es/library/behaviours/float-pagination/frameworks/utils.js +70 -0
- package/es/library/behaviours/keyboard-controls/adapters/gateways/Repository.js +2 -1
- package/es/library/behaviours/keyboard-controls/applications/usecases/SpacePress.js +1 -1
- package/es/library/behaviours/keyboard-controls/domain/entities/KeyboardControls.js +6 -1
- package/es/library/behaviours/list-selection/domain/entities/ListItemSelection.js +21 -18
- package/es/library/behaviours/search/adapters/controllers/AbstractController.js +9 -0
- package/es/library/behaviours/search/adapters/controllers/SearchController.js +26 -0
- package/es/library/behaviours/search/adapters/controllers/UpdatePropertiesController.js +27 -0
- package/es/library/behaviours/search/adapters/gateway/Repository.js +20 -0
- package/es/library/behaviours/search/adapters/gateway/Service.js +12 -0
- package/es/library/behaviours/{sort-by → search}/adapters/presenter/Presenter.js +2 -2
- package/es/library/behaviours/search/adapters/presenter/SearchTranslator.js +6 -0
- package/es/library/behaviours/search/applications/interfaces/UseCaseDependencies.js +1 -0
- package/es/library/behaviours/search/applications/interfaces/gateways/IRepository.js +1 -0
- package/es/library/behaviours/search/applications/interfaces/gateways/IService.js +1 -0
- package/es/library/behaviours/search/applications/interfaces/input/SearchInputModel.js +1 -0
- package/es/library/behaviours/search/applications/interfaces/input/UpdatePropertiesInputModel.js +1 -0
- package/es/library/behaviours/search/applications/interfaces/output/IPresenter.js +1 -0
- package/es/library/behaviours/search/applications/interfaces/output/SearchOutputModel.js +1 -0
- package/es/library/behaviours/search/applications/usecases/AbstractUseCase.js +17 -0
- package/es/library/behaviours/search/applications/usecases/SearchUseCase.js +28 -0
- package/es/library/behaviours/search/applications/usecases/UpdatePropertiesUsecase.js +25 -0
- package/es/library/behaviours/search/domain/entities/Search.js +23 -0
- package/es/library/behaviours/search/domain/entities/interfaces/ISearch.js +1 -0
- package/es/library/behaviours/search/frameworks/ui/EventHandlerFactory.js +25 -0
- package/es/library/behaviours/search/frameworks/ui/SearchStringStoreBehaviourFactory.js +26 -0
- package/es/library/custom-component/adapters/gateways/event-manager/EventManager.js +5 -0
- package/es/library/custom-component/domain/entities/ComponentProperties.js +1 -1
- package/es/library/custom-component/domain/entities/Logger.js +3 -3
- package/es/library/dot/components/action-location/frameworks/ui/ActionComponentMapping.js +3 -1
- package/es/library/dot/components/table-list/adapters/controllers/ScrollController.js +2 -2
- package/es/library/dot/components/table-list/adapters/controllers/index.js +0 -2
- package/es/library/dot/components/table-list/frameworks/ui/EventHandlersFactory.js +1 -2
- package/es/library/dot/components/table-list/frameworks/ui/TableListView.js +24 -1
- package/es/library/dot/components/table-list/frameworks/ui/css/TableList.module.css +19 -2
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/Row.js +1 -5
- package/es/library/dot/legacy-to-new-arch/action-icon/frameworks/ui/ActionIconView.js +5 -1
- package/es/library/dot/legacy-to-new-arch/floating-pagination/frameworks/ui/FloatingPagination.js +10 -0
- package/es/library/dot/legacy-to-new-arch/floating-pagination/frameworks/ui/FloatingPaginationView.js +47 -0
- package/es/library/dot/legacy-to-new-arch/radio-dropdown/frameworks/ui/RadioDropdownView.js +1 -0
- package/es/library/dot/legacy-to-new-arch/ribbon/frameworks/ui/Ribbon.js +10 -0
- package/es/library/dot/legacy-to-new-arch/ribbon/frameworks/ui/RibbonView.js +37 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/radio-dropdown-field/frameworks/ui/EventHandlersFactory.js +14 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/radio-dropdown-field/frameworks/ui/RadioDropdownField.js +17 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/radio-dropdown-field/frameworks/ui/RadioDropdownFieldView.js +1 -1
- package/es/library/dot/legacy-to-new-arch/table-field-components/tags-list-dropdown-field/frameworks/ui/TagsListDropdownField.js +33 -1
- package/es/library/dot/legacy-to-new-arch/table-field-components/tags-list-dropdown-field/frameworks/ui/TagsListDropdownFieldView.js +1 -1
- package/es/platform/components/table-connected/adapters/controllers/ScrollController.js +29 -8
- package/es/platform/components/table-connected/adapters/controllers/ScrollEndReachedController.js +23 -0
- package/es/platform/components/table-connected/adapters/resources/SmartTableResource.js +169 -8
- package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +37 -6
- package/es/platform/components/table-connected/frameworks/TableConnectedFactory.js +2 -1
- package/es/platform/components/table-connected/frameworks/TableConnectedView.js +2 -0
- package/es/platform/data-source/http-template/getComponentMapping.js +1 -1
- package/es/platform/data-source/http-template/getRecords.js +1 -0
- package/es/platform/data-source/http-template/getSingleRecord.js +51 -0
- package/es/platform/zform/adapters/controllers/GetInitialRecordSuccessController.js +31 -0
- package/es/platform/zform/applications/interfaces/input/GetInitialRecordSuccessUseCaseInputModel.js +1 -0
- package/es/platform/zform/applications/usecases/GetInitialRecordSuccessUseCase.js +132 -0
- package/es/platform/zlist/adapters/controllers/RefreshRecordsRequestedController.js +21 -0
- package/es/platform/zlist/adapters/controllers/SortController.js +2 -2
- package/es/platform/zlist/adapters/gateways/Repository.js +6 -11
- package/es/platform/zlist/adapters/gateways/Service.js +2 -0
- package/es/platform/zlist/adapters/presenters/TableTranslator.js +41 -13
- package/es/platform/zlist/adapters/presenters/translators/ColumnTranslator.js +15 -3
- package/es/platform/zlist/adapters/presenters/translators/Header.js +29 -21
- package/es/platform/zlist/adapters/presenters/translators/HeadersTranslator.js +3 -3
- package/es/platform/zlist/adapters/presenters/translators/Row.js +14 -1
- package/es/platform/zlist/adapters/presenters/translators/fields/DateFieldTranslator.js +21 -3
- package/es/platform/zlist/adapters/presenters/translators/fields/DateTimeFieldTranslator.js +21 -3
- package/es/platform/zlist/adapters/presenters/translators/fields/PhoneFieldTranslator.js +17 -1
- package/es/platform/zlist/adapters/presenters/utils/DateAndTimeFormat.js +25 -0
- package/es/platform/zlist/adapters/presenters/utils/DefaultClientActions.js +7 -4
- package/es/platform/zlist/applications/entities-factory/ListFactory.js +2 -2
- package/es/platform/zlist/applications/interfaces/input/GetSortConfigUseCaseInputModel.js +1 -0
- package/es/platform/zlist/applications/interfaces/input/RefreshRecordsRequestedUseCaseInputModel.js +1 -0
- package/es/platform/zlist/applications/interfaces/input/SetSortConfigUseCaseInputModel.js +1 -0
- package/es/platform/zlist/applications/usecases/GetSortConfigUseCase.js +17 -0
- package/es/platform/zlist/applications/usecases/RecordSuccessCallbackUsecase.js +1 -1
- package/es/platform/zlist/applications/usecases/RefreshRecordsRequestedUseCase.js +17 -0
- package/es/platform/zlist/applications/usecases/SetSortConfigUseCase.js +26 -0
- package/es/platform/zlist/applications/usecases/SortUseCase.js +6 -6
- package/es/platform/zlist/domain/entities/List.js +27 -15
- package/es/platform/zlist/domain/entities/interfaces/Properties.js +5 -5
- package/es/platform/zlist/frameworks/EventHandlersFactory.js +3 -4
- package/es/platform/zlist/frameworks/ZListBehaviourFactory.js +2 -5
- package/es/platform/zrecord/adapters/controllers/UpdateRecordController.js +30 -0
- package/es/platform/zrecord/adapters/gateways/Repository.js +5 -2
- package/es/platform/zrecord/applications/entities-factory/RecordsManagerFactory.js +2 -2
- package/es/platform/zrecord/applications/interfaces/input/ClearAllFiltersUseCaseInputModel.js +1 -0
- package/es/platform/zrecord/applications/interfaces/input/GetFilterConditionUseCaseInputModel.js +1 -0
- package/es/platform/zrecord/applications/interfaces/input/GetFilterConfigUseCaseInputModel.js +1 -0
- package/es/platform/zrecord/applications/interfaces/input/RefreshRecordsUseCaseInputModel.js +1 -0
- package/es/platform/zrecord/applications/interfaces/input/SetFilterUseCaseInputModel.js +1 -0
- package/es/platform/zrecord/applications/interfaces/input/UpdateRecordInputModel.js +0 -0
- package/es/platform/zrecord/applications/usecases/ClearAllFiltersUseCase.js +24 -0
- package/es/platform/zrecord/applications/usecases/GetFilterConditionUseCase.js +15 -0
- package/es/platform/zrecord/applications/usecases/GetFilterConfigUseCase.js +15 -0
- package/es/platform/zrecord/applications/usecases/RefreshRecordsUseCase.js +14 -0
- package/es/platform/zrecord/applications/usecases/SetFilterUseCase.js +24 -0
- package/es/platform/zrecord/applications/usecases/UpdateRecordUseCase.js +30 -0
- package/es/platform/zrecord/domain/entities/Filter.js +247 -0
- package/es/platform/zrecord/domain/entities/RecordsManager.js +19 -1
- package/es/platform/zrecord/domain/entities/interfaces/IFilter.js +1 -0
- package/es/platform/zrecord/frameworks/RecordBehaviourFactory.js +11 -1
- package/package.json +20 -20
- package/es/bc/sort-by/ActionHandlers.js +0 -1
- package/es/bc/sort-by/Constants.js +0 -2
- package/es/bc/sort-by/Properties.js +0 -26
- package/es/bc/sort-by/SortOrderEnum.js +0 -8
- package/es/bc/sort-by/index.js +0 -2
- package/es/library/behaviours/sort-by/adapters/controllers/SortBy.js +0 -28
- package/es/library/behaviours/sort-by/adapters/gateway/Repository.js +0 -19
- package/es/library/behaviours/sort-by/adapters/gateway/Service.js +0 -10
- package/es/library/behaviours/sort-by/applications/usecases/SortBy.js +0 -28
- package/es/library/behaviours/sort-by/domain/entities/SortBy.js +0 -42
- package/es/library/behaviours/sort-by/frameworks/ui/ActionsHandlerFactory.js +0 -23
- package/es/library/behaviours/sort-by/frameworks/ui/DemoBehaviour.js +0 -20
- package/es/library/behaviours/sort-by/frameworks/ui/SortByBehaviourFactory.js +0 -24
- package/es/library/dot/components/table-list/adapters/controllers/SortByController.js +0 -25
- package/es/library/dot/components/table-list/adapters/controllers/SortedController.js +0 -18
- package/es/library/dot/components/table-list/frameworks/ui/handlers/HandleSortClick.js +0 -12
- package/es/platform/zlist/adapters/gateways/SortBy.js +0 -38
- package/es/platform/zlist/domain/entities/SortBy.js +0 -58
- /package/es/{library/behaviours/sort-by/applications/interfaces/UseCaseDependencies.js → bc/float-pagination/types/FloatPaginationBehaviourState.js} +0 -0
- /package/es/{library/behaviours/sort-by/applications/interfaces/gateways/IRepository.js → bc/list-selection/Types.js} +0 -0
- /package/es/{library/behaviours/sort-by/applications/interfaces/gateways/IService.js → cc/table-list/data-types/FloatPaginationConfig.js} +0 -0
- /package/es/library/behaviours/{sort-by → float-pagination}/adapters/controllers/AbstractController.js +0 -0
- /package/es/library/behaviours/{sort-by/applications/interfaces/input/SortByInputModel.js → float-pagination/applications/interfaces/UseCaseDependencies.js} +0 -0
- /package/es/library/behaviours/{sort-by/applications/interfaces/output/IPresenter.js → float-pagination/applications/interfaces/gateways/IRepository.js} +0 -0
- /package/es/library/behaviours/{sort-by/applications/interfaces/output/SortByOutputModel.js → float-pagination/applications/interfaces/gateways/IService.js} +0 -0
- /package/es/library/behaviours/{sort-by/domain/entities/interfaces/ISortBy.js → float-pagination/applications/interfaces/input/DestructInputModel.js} +0 -0
- /package/es/{platform/zlist/applications/interfaces/gateways/ISortBy.js → library/behaviours/float-pagination/applications/interfaces/input/FloatPaginationInputModel.js} +0 -0
- /package/es/{platform/zlist/domain/entities/interfaces/ISortBy.js → library/behaviours/float-pagination/applications/interfaces/input/InitializeInputModel.js} +0 -0
- /package/es/library/behaviours/{sort-by → float-pagination}/applications/usecases/AbstractUseCase.js +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { SmartTableConstants } from "../../../../cc/table-connected";
|
|
2
1
|
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
import { SMART_TABLE_SORTED } from "../../../../cc/table-connected/constants/Events";
|
|
3
3
|
|
|
4
4
|
class SortUseCase extends AbstractUseCase {
|
|
5
5
|
execute(input) {
|
|
6
6
|
const {
|
|
7
|
-
|
|
7
|
+
sortConfig,
|
|
8
8
|
dispatch
|
|
9
9
|
} = input;
|
|
10
10
|
const {
|
|
@@ -12,13 +12,13 @@ class SortUseCase extends AbstractUseCase {
|
|
|
12
12
|
presenter
|
|
13
13
|
} = this.dependencies;
|
|
14
14
|
const list = repository.getList();
|
|
15
|
-
list.
|
|
15
|
+
list.setSortConfig(sortConfig);
|
|
16
|
+
presenter.updateView(list.toObject());
|
|
16
17
|
dispatch(list.createRecordsRefetchAction());
|
|
17
18
|
dispatch({
|
|
18
|
-
type:
|
|
19
|
-
payload:
|
|
19
|
+
type: SMART_TABLE_SORTED,
|
|
20
|
+
payload: sortConfig
|
|
20
21
|
});
|
|
21
|
-
presenter.updateView(list.toObject());
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
}
|
|
@@ -3,13 +3,13 @@ import { FIELD_EXECUTE, FIELD_REFETCH } from "../../../../bc/zfield/Constants";
|
|
|
3
3
|
import { CLIENTACTION_BEHAVIOUR_EXECUTE } from "../../../client-actions/bc/zclient-actions/Constants";
|
|
4
4
|
import { CLIENT_ACTION_TABLE_LIST_COMPONENT_NAME, ZLIST_RECORD_DELETE_SUCCEEDED, ZLIST_RECORD_UPDATE_SUCCEEDED } from "../../../../bc/zlist/Constants";
|
|
5
5
|
import { SmartTableConstants } from "../../../../cc/table-connected";
|
|
6
|
-
import SortBy from "./SortBy";
|
|
7
6
|
import { CLIENTSCRIPT_FETCH } from "../../../client-scripts/bc/zclient-scripts-fetch/Constants";
|
|
7
|
+
import { SortOrder } from "../../../../bc/zlist/Types";
|
|
8
8
|
|
|
9
9
|
class List {
|
|
10
|
-
constructor(limit,
|
|
10
|
+
constructor(limit, sortConfig, query, context, isReOrderLoading, errorState) {
|
|
11
11
|
this.limit = limit;
|
|
12
|
-
this.
|
|
12
|
+
this.sortConfig = sortConfig;
|
|
13
13
|
this.query = query;
|
|
14
14
|
this.context = context;
|
|
15
15
|
this.isReOrderLoading = isReOrderLoading;
|
|
@@ -19,7 +19,7 @@ class List {
|
|
|
19
19
|
toObject() {
|
|
20
20
|
return {
|
|
21
21
|
limit: this.limit,
|
|
22
|
-
|
|
22
|
+
sortConfig: this.sortConfig,
|
|
23
23
|
isReOrderLoading: this.isReOrderLoading,
|
|
24
24
|
errorState: this.errorState.toObject()
|
|
25
25
|
};
|
|
@@ -37,16 +37,12 @@ class List {
|
|
|
37
37
|
this.isReOrderLoading = false;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
this.
|
|
40
|
+
getSortConfig() {
|
|
41
|
+
return this.sortConfig;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
id,
|
|
47
|
-
name
|
|
48
|
-
} = this.sortBy;
|
|
49
|
-
this.sortBy.doSorting(id, name);
|
|
44
|
+
setSortConfig(sortConfig) {
|
|
45
|
+
this.sortConfig = sortConfig;
|
|
50
46
|
}
|
|
51
47
|
|
|
52
48
|
isAcknowledgeBySortBy(metaData) {
|
|
@@ -65,16 +61,32 @@ class List {
|
|
|
65
61
|
return variableName ? computedContext?.[variableName] : computedContext;
|
|
66
62
|
}
|
|
67
63
|
|
|
64
|
+
getSortByQueryString() {
|
|
65
|
+
const {
|
|
66
|
+
fieldName,
|
|
67
|
+
order
|
|
68
|
+
} = this.sortConfig;
|
|
69
|
+
|
|
70
|
+
if (order === SortOrder.DES) {
|
|
71
|
+
return `-${fieldName}`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (order === SortOrder.ASC) {
|
|
75
|
+
return fieldName;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return '';
|
|
79
|
+
}
|
|
80
|
+
|
|
68
81
|
createApiProps() {
|
|
69
82
|
const {
|
|
70
83
|
query,
|
|
71
84
|
limit,
|
|
72
|
-
sortBy,
|
|
73
85
|
context
|
|
74
86
|
} = this;
|
|
75
87
|
return {
|
|
76
88
|
limit,
|
|
77
|
-
sortBy:
|
|
89
|
+
sortBy: this.getSortByQueryString(),
|
|
78
90
|
...query,
|
|
79
91
|
...context
|
|
80
92
|
};
|
|
@@ -357,7 +369,7 @@ class List {
|
|
|
357
369
|
const props = this.createApiProps();
|
|
358
370
|
const metaData = triggerer === 'sortBy' && {
|
|
359
371
|
['SMART_TABLE#SORTED']: {
|
|
360
|
-
sortBy: this.
|
|
372
|
+
sortBy: this.sortConfig
|
|
361
373
|
}
|
|
362
374
|
};
|
|
363
375
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export let
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return
|
|
1
|
+
export let SortModelOrder = /*#__PURE__*/function (SortModelOrder) {
|
|
2
|
+
SortModelOrder["NONE"] = "none";
|
|
3
|
+
SortModelOrder["ASC"] = "ascending";
|
|
4
|
+
SortModelOrder["DES"] = "descending";
|
|
5
|
+
return SortModelOrder;
|
|
6
6
|
}({});
|
|
@@ -9,13 +9,12 @@ import FetchMoreController from "../adapters/controllers/FetchMoreController";
|
|
|
9
9
|
import SortController from "../adapters/controllers/SortController";
|
|
10
10
|
import FieldChangeController from "../adapters/controllers/FieldChangeController";
|
|
11
11
|
import LifeCycleEvents from "../../../cc/component/LifeCycleEventsEnum";
|
|
12
|
-
import SortBy from "../adapters/gateways/SortBy";
|
|
13
12
|
import DeleteMultipleRecordController from "../adapters/controllers/DeleteMultipleRecordController";
|
|
14
13
|
import RecordUpdateController from "../adapters/controllers/RecordUpdateController";
|
|
15
14
|
import DeleteSingleRecordController from "../adapters/controllers/DeleteSingleRecordController";
|
|
16
15
|
import RecordExecuteFailedController from "../adapters/controllers/RecordExecuteFailedController";
|
|
17
16
|
import RecordExecuteSucceededController from "../adapters/controllers/RecordExecuteSucceededController";
|
|
18
|
-
import { RECORD_EXECUTE_FAILED, RECORD_EXECUTE_SUCCEEDED, RECORD_EXECUTE_SUCCESS_CALLBACK } from "../../../bc/zrecord/Constants";
|
|
17
|
+
import { RECORD_EXECUTE_FAILED, RECORD_EXECUTE_SUCCEEDED, RECORD_EXECUTE_SUCCESS_CALLBACK, REFRESH_RECORDS_REQUESTED } from "../../../bc/zrecord/Constants";
|
|
19
18
|
import UpdateSuccessController from "../adapters/controllers/UpdateSuccessController";
|
|
20
19
|
import DeleteSuccessController from "../adapters/controllers/DeleteSuccessController";
|
|
21
20
|
import Presenter from "../adapters/presenters/Presenters";
|
|
@@ -26,14 +25,13 @@ import { FIELD_FETCH_FAILURE } from "../../../bc/zfield/Constants";
|
|
|
26
25
|
import FieldExecuteFailedController from "../adapters/controllers/FieldExecuteFailedController";
|
|
27
26
|
import { CLIENTACTION_EXECUTE_FAILED } from "../../client-actions/bc/zclient-actions/Constants";
|
|
28
27
|
import ResolutionBasedLimitController from "../adapters/controllers/ResolutionBasedLimitController";
|
|
28
|
+
import RefreshRecordsRequestedController from "../adapters/controllers/RefreshRecordsRequestedController";
|
|
29
29
|
export default class ActionHandlersFactory {
|
|
30
30
|
static create() {
|
|
31
31
|
const repository = new Repository();
|
|
32
32
|
const presenter = new Presenter();
|
|
33
|
-
const sortByGateway = new SortBy();
|
|
34
33
|
const service = new Service({
|
|
35
34
|
repository,
|
|
36
|
-
sortBy: sortByGateway,
|
|
37
35
|
presenter
|
|
38
36
|
});
|
|
39
37
|
return {
|
|
@@ -57,6 +55,7 @@ export default class ActionHandlersFactory {
|
|
|
57
55
|
[ZLIST_RECORD_DELETE_SUCCEEDED]: new DeleteSuccessController(service).handle,
|
|
58
56
|
// ({ dispatch, action }) => dispatch({ type: 'SMART_TABLE#RECORD_DELETED', payload: { id: action.payload.id } })
|
|
59
57
|
[ZLIST_RECORD_REORDER]: new ReOrderController(service).handle,
|
|
58
|
+
[REFRESH_RECORDS_REQUESTED]: new RefreshRecordsRequestedController(service).handle,
|
|
60
59
|
[ZLIST_RECORD_REORDER_FAILED]: new ReOrderFailedController(service).handle
|
|
61
60
|
};
|
|
62
61
|
}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import Properties from "../../../bc/zlist/Properties";
|
|
2
2
|
import EventHandlersFactory from "./EventHandlersFactory";
|
|
3
|
+
import { initialSortConfig } from "../../../bc/zlist/Types";
|
|
3
4
|
export default class ZListBehaviourFactory {
|
|
4
5
|
static create() {
|
|
5
6
|
return {
|
|
6
7
|
name: 'zlist',
|
|
7
8
|
setInitialState: () => ({
|
|
8
|
-
|
|
9
|
-
id: '',
|
|
10
|
-
name: '',
|
|
11
|
-
order: 'none'
|
|
12
|
-
},
|
|
9
|
+
sortConfig: initialSortConfig,
|
|
13
10
|
isReOrderLoading: false,
|
|
14
11
|
errorState: {
|
|
15
12
|
canErrorPage: false,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import AbstractController from "./AbstractController";
|
|
2
|
+
export default class UpdateRecordController extends AbstractController {
|
|
3
|
+
handle(event) {
|
|
4
|
+
const {
|
|
5
|
+
state,
|
|
6
|
+
updateState,
|
|
7
|
+
action,
|
|
8
|
+
dispatch
|
|
9
|
+
} = event;
|
|
10
|
+
const {
|
|
11
|
+
payload
|
|
12
|
+
} = action;
|
|
13
|
+
const {
|
|
14
|
+
record,
|
|
15
|
+
moduleName,
|
|
16
|
+
recordId
|
|
17
|
+
} = payload;
|
|
18
|
+
const {
|
|
19
|
+
updateRecordUseCase
|
|
20
|
+
} = this.service;
|
|
21
|
+
updateRecordUseCase.updateDependency(state, updateState);
|
|
22
|
+
updateRecordUseCase.execute({
|
|
23
|
+
record,
|
|
24
|
+
moduleName,
|
|
25
|
+
recordId,
|
|
26
|
+
dispatch
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import RecordsManagerFactory from "../../applications/entities-factory/RecordsManagerFactory";
|
|
2
|
+
import { Filter } from "../../domain/entities/Filter";
|
|
2
3
|
export default class Repository {
|
|
3
4
|
init(state) {
|
|
4
5
|
this.state = state;
|
|
@@ -11,13 +12,15 @@ export default class Repository {
|
|
|
11
12
|
const {
|
|
12
13
|
records = [],
|
|
13
14
|
hasMore,
|
|
14
|
-
isFetching
|
|
15
|
+
isFetching,
|
|
16
|
+
filter
|
|
15
17
|
} = zrecord;
|
|
18
|
+
const filterEntity = new Filter(filter.config, filter.condition, filter.queryString);
|
|
16
19
|
const recordManager = RecordsManagerFactory.create({
|
|
17
20
|
data: records,
|
|
18
21
|
hasMore,
|
|
19
22
|
isFetching
|
|
20
|
-
});
|
|
23
|
+
}, filterEntity);
|
|
21
24
|
return recordManager;
|
|
22
25
|
}
|
|
23
26
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import RecordsManager from "../../domain/entities/RecordsManager";
|
|
2
2
|
import Records from "../../domain/entities/Records";
|
|
3
3
|
export default class RecordsManagerFactory {
|
|
4
|
-
static create(recordsModel) {
|
|
4
|
+
static create(recordsModel, filter) {
|
|
5
5
|
const records = new Records(recordsModel);
|
|
6
|
-
const recordManager = new RecordsManager(records);
|
|
6
|
+
const recordManager = new RecordsManager(records, filter);
|
|
7
7
|
return recordManager;
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/platform/zrecord/applications/interfaces/input/GetFilterConditionUseCaseInputModel.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
import { REFRESH_RECORDS_REQUESTED } from "../../../../bc/zrecord/Constants";
|
|
3
|
+
import { initialFilterConfig } from "../../../../bc/zrecord/Types";
|
|
4
|
+
export default class ClearAllFiltersUseCase extends AbstractUseCase {
|
|
5
|
+
execute(_ref) {
|
|
6
|
+
let {
|
|
7
|
+
dispatch
|
|
8
|
+
} = _ref;
|
|
9
|
+
const {
|
|
10
|
+
repository,
|
|
11
|
+
presenter
|
|
12
|
+
} = this.dependencies;
|
|
13
|
+
const recordManager = repository.getRecordsManagerEntity();
|
|
14
|
+
recordManager.setFilterConfig(initialFilterConfig);
|
|
15
|
+
presenter.updateRecord(recordManager.toObject());
|
|
16
|
+
dispatch({
|
|
17
|
+
type: REFRESH_RECORDS_REQUESTED,
|
|
18
|
+
metaData: {
|
|
19
|
+
filterConfig: initialFilterConfig
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
export default class GetFilterConditionUseCase extends AbstractUseCase {
|
|
3
|
+
execute(_ref) {
|
|
4
|
+
let {
|
|
5
|
+
callback
|
|
6
|
+
} = _ref;
|
|
7
|
+
const {
|
|
8
|
+
repository
|
|
9
|
+
} = this.dependencies;
|
|
10
|
+
const recordManager = repository.getRecordsManagerEntity();
|
|
11
|
+
const filterCondition = recordManager.getFilterCondition();
|
|
12
|
+
callback?.(filterCondition);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
export default class GetFilterConfigUseCase extends AbstractUseCase {
|
|
3
|
+
execute(_ref) {
|
|
4
|
+
let {
|
|
5
|
+
callback
|
|
6
|
+
} = _ref;
|
|
7
|
+
const {
|
|
8
|
+
repository
|
|
9
|
+
} = this.dependencies;
|
|
10
|
+
const recordManager = repository.getRecordsManagerEntity();
|
|
11
|
+
const filterConfig = recordManager.getFilterConfig();
|
|
12
|
+
callback?.(filterConfig);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
import { REFRESH_RECORDS_REQUESTED } from "../../../../bc/zrecord/Constants";
|
|
3
|
+
export default class RefreshRecordsUseCase extends AbstractUseCase {
|
|
4
|
+
execute(_ref) {
|
|
5
|
+
let {
|
|
6
|
+
dispatch
|
|
7
|
+
} = _ref;
|
|
8
|
+
dispatch({
|
|
9
|
+
type: REFRESH_RECORDS_REQUESTED,
|
|
10
|
+
metaData: {}
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
import { REFRESH_RECORDS_REQUESTED } from "../../../../bc/zrecord/Constants";
|
|
3
|
+
export default class SetFilterUseCase extends AbstractUseCase {
|
|
4
|
+
execute(_ref) {
|
|
5
|
+
let {
|
|
6
|
+
filterConfig,
|
|
7
|
+
dispatch
|
|
8
|
+
} = _ref;
|
|
9
|
+
const {
|
|
10
|
+
repository,
|
|
11
|
+
presenter
|
|
12
|
+
} = this.dependencies;
|
|
13
|
+
const recordManager = repository.getRecordsManagerEntity();
|
|
14
|
+
recordManager.setFilterConfig(filterConfig);
|
|
15
|
+
presenter.updateRecord(recordManager.toObject());
|
|
16
|
+
dispatch({
|
|
17
|
+
type: REFRESH_RECORDS_REQUESTED,
|
|
18
|
+
metaData: {
|
|
19
|
+
filterConfig
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
import RecordFactory from "../entities-factory/RecordFactory";
|
|
3
|
+
import { RecordApiActionName } from "../../../../bc/zrecord/Constants";
|
|
4
|
+
|
|
5
|
+
class UpdateRecordUseCase extends AbstractUseCase {
|
|
6
|
+
execute(input) {
|
|
7
|
+
const {
|
|
8
|
+
presenter,
|
|
9
|
+
repository
|
|
10
|
+
} = this.dependencies;
|
|
11
|
+
const {
|
|
12
|
+
record,
|
|
13
|
+
dispatch,
|
|
14
|
+
moduleName,
|
|
15
|
+
recordId
|
|
16
|
+
} = input;
|
|
17
|
+
const recordManager = repository.getRecordsManagerEntity();
|
|
18
|
+
const recordEntity = RecordFactory.createSingleRecord(record);
|
|
19
|
+
const meta = recordManager.createRecordMeta(recordEntity);
|
|
20
|
+
dispatch(recordManager.createDataSourceExecuteEvent({
|
|
21
|
+
record: recordEntity.toObject(),
|
|
22
|
+
moduleName,
|
|
23
|
+
recordId
|
|
24
|
+
}, RecordApiActionName.UPDATE_RECORD, meta));
|
|
25
|
+
presenter.updateRecord(recordManager.toObject());
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default UpdateRecordUseCase;
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { CommonComparators, TextComparators, NumberComparators, DateComparators, ConditionTokens } from "../../../../bc/zrecord/Types";
|
|
2
|
+
export class Filter {
|
|
3
|
+
constructor(config, condition, queryString) {
|
|
4
|
+
this.config = config;
|
|
5
|
+
this.condition = condition;
|
|
6
|
+
this.queryString = queryString;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
getFilterQuery() {
|
|
10
|
+
return this.queryString;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
getConfig() {
|
|
14
|
+
return this.config;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getCondition() {
|
|
18
|
+
return this.condition;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
toObject() {
|
|
22
|
+
return {
|
|
23
|
+
config: this.config,
|
|
24
|
+
condition: this.condition,
|
|
25
|
+
queryString: this.queryString
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
setConfig(config) {
|
|
30
|
+
const condition = this.convertConfigToCondition(config);
|
|
31
|
+
const queryString = this.convertConditionToQueryStringRecursive(condition);
|
|
32
|
+
this.config = config;
|
|
33
|
+
this.condition = condition;
|
|
34
|
+
this.queryString = queryString;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* input:
|
|
38
|
+
* {
|
|
39
|
+
* conditions: [
|
|
40
|
+
* { fieldName: 'productCode', condition: "isn't", value: '12345' },
|
|
41
|
+
* { fieldName: 'quantity', condition: 'is', value: 100 },
|
|
42
|
+
* { fieldName: 'category', condition: 'contains', value: 'electronics' },
|
|
43
|
+
* { fieldName: 'discount', condition: 'is not empty', value: null }
|
|
44
|
+
* ],
|
|
45
|
+
* pattern: "((1and2)or(3and4))"
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* output:
|
|
49
|
+
* {
|
|
50
|
+
* type: 'OR',
|
|
51
|
+
* conditions: [
|
|
52
|
+
* {
|
|
53
|
+
* type: 'AND',
|
|
54
|
+
* conditions: [
|
|
55
|
+
* { type: 'CONDITION', fieldName: 'productCode', condition: "isn't", value: '12345' },
|
|
56
|
+
* { type: 'CONDITION', fieldName: 'quantity', condition: 'is', value: 100 }
|
|
57
|
+
* ]
|
|
58
|
+
* },
|
|
59
|
+
* {
|
|
60
|
+
* type: 'AND',
|
|
61
|
+
* conditions: [
|
|
62
|
+
* { type: 'CONDITION', fieldName: 'category', condition: 'contains', value: 'electronics' },
|
|
63
|
+
* { type: 'CONDITION', fieldName: 'discount', condition: 'is not empty', value: null }
|
|
64
|
+
* ]
|
|
65
|
+
* }
|
|
66
|
+
* ]
|
|
67
|
+
* }
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
convertConfigToCondition(config) {
|
|
72
|
+
const {
|
|
73
|
+
conditions,
|
|
74
|
+
pattern
|
|
75
|
+
} = config;
|
|
76
|
+
|
|
77
|
+
if (conditions.length === 0 || pattern.trim() === '') {
|
|
78
|
+
return null;
|
|
79
|
+
} // Tokenize the pattern
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
const tokens = this.tokenizePattern(pattern);
|
|
83
|
+
const aliases = this.generateAliases(conditions);
|
|
84
|
+
let pos = 0;
|
|
85
|
+
|
|
86
|
+
const parseExpression = () => {
|
|
87
|
+
if (tokens[pos] === '(') {
|
|
88
|
+
pos++; // skip '('
|
|
89
|
+
|
|
90
|
+
const left = parseExpression();
|
|
91
|
+
|
|
92
|
+
if (pos < tokens.length && tokens[pos] === ')') {
|
|
93
|
+
pos++; // skip ')'
|
|
94
|
+
|
|
95
|
+
return left;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const operator = tokens[pos];
|
|
99
|
+
pos++; // skip operator
|
|
100
|
+
|
|
101
|
+
const right = parseExpression();
|
|
102
|
+
|
|
103
|
+
if (tokens[pos] === ')') {
|
|
104
|
+
pos++; // skip ')'
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
type: operator === 'AND' ? ConditionTokens.AND : ConditionTokens.OR,
|
|
109
|
+
conditions: [left, right]
|
|
110
|
+
};
|
|
111
|
+
} else if (/^\d+$/.test(tokens[pos])) {
|
|
112
|
+
const alias = tokens[pos];
|
|
113
|
+
pos++;
|
|
114
|
+
return aliases[alias];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
throw new Error('Invalid pattern');
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
return parseExpression();
|
|
121
|
+
} // Helper method to tokenize the pattern string (e.g. "(1and2)")
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
tokenizePattern(pattern) {
|
|
125
|
+
return pattern.replace(/\(/g, ' ( ').replace(/\)/g, ' ) ').replace(/and/g, ' AND ').replace(/or/g, ' OR ').replace(/not/g, ' NOT ').split(/\s+/).filter(token => token.length > 0);
|
|
126
|
+
} // Helper method to create aliases for the conditions (e.g. "1", "2")
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
generateAliases(conditions) {
|
|
130
|
+
const aliases = {};
|
|
131
|
+
conditions.forEach((condition, index) => {
|
|
132
|
+
const alias = String(index + 1); // Starting with "1"
|
|
133
|
+
|
|
134
|
+
aliases[alias] = {
|
|
135
|
+
type: ConditionTokens.CONDITION,
|
|
136
|
+
fieldName: condition.fieldName,
|
|
137
|
+
condition: condition.condition,
|
|
138
|
+
value: condition.value
|
|
139
|
+
};
|
|
140
|
+
});
|
|
141
|
+
return aliases;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* input:
|
|
145
|
+
* {
|
|
146
|
+
* type: 'OR',
|
|
147
|
+
* conditions: [
|
|
148
|
+
* {
|
|
149
|
+
* type: 'AND',
|
|
150
|
+
* conditions: [
|
|
151
|
+
* { type: 'CONDITION', fieldName: 'productCode', condition: "isn't", value: '12345' },
|
|
152
|
+
* { type: 'CONDITION', fieldName: 'quantity', condition: 'is', value: 100 }
|
|
153
|
+
* ]
|
|
154
|
+
* },
|
|
155
|
+
* {
|
|
156
|
+
* type: 'AND',
|
|
157
|
+
* conditions: [
|
|
158
|
+
* { type: 'CONDITION', fieldName: 'category', condition: 'contains', value: 'electronics' },
|
|
159
|
+
* { type: 'CONDITION', fieldName: 'discount', condition: 'is not empty', value: null }
|
|
160
|
+
* ]
|
|
161
|
+
* }
|
|
162
|
+
* ]
|
|
163
|
+
* }
|
|
164
|
+
*
|
|
165
|
+
* output:
|
|
166
|
+
* "((productCode != 12345 AND quantity = 100) OR (category.contains('electronics') AND discount.isNotEmpty()))"
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
convertConditionToQueryStringRecursive(condition) {
|
|
171
|
+
if (!condition) {
|
|
172
|
+
return '';
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (condition.type === ConditionTokens.CONDITION) {
|
|
176
|
+
const {
|
|
177
|
+
fieldName,
|
|
178
|
+
condition: comp,
|
|
179
|
+
value
|
|
180
|
+
} = condition;
|
|
181
|
+
|
|
182
|
+
switch (comp) {
|
|
183
|
+
case CommonComparators.ISEMPTY:
|
|
184
|
+
return `${fieldName}.isEmpty()`;
|
|
185
|
+
|
|
186
|
+
case CommonComparators.ISNOTEMPTY:
|
|
187
|
+
return `${fieldName}.isNotEmpty()`;
|
|
188
|
+
|
|
189
|
+
case TextComparators.IS:
|
|
190
|
+
return `${fieldName} = '${value}'`;
|
|
191
|
+
|
|
192
|
+
case TextComparators.ISNT:
|
|
193
|
+
return `${fieldName} != '${value}'`;
|
|
194
|
+
|
|
195
|
+
case TextComparators.STARTSWITH:
|
|
196
|
+
return `${fieldName}.startsWith('${value}')`;
|
|
197
|
+
|
|
198
|
+
case TextComparators.ENDSWITH:
|
|
199
|
+
return `${fieldName}.endsWith('${value}')`;
|
|
200
|
+
|
|
201
|
+
case TextComparators.CONTAINS:
|
|
202
|
+
return `${fieldName}.contains('${value}')`;
|
|
203
|
+
|
|
204
|
+
case TextComparators.DOESNTCONTAIN:
|
|
205
|
+
return `!${fieldName}.contains('${value}')`;
|
|
206
|
+
|
|
207
|
+
case NumberComparators.EQUAL:
|
|
208
|
+
return `${fieldName} = ${value}`;
|
|
209
|
+
|
|
210
|
+
case NumberComparators.NOTEQUAL:
|
|
211
|
+
return `${fieldName} != ${value}`;
|
|
212
|
+
|
|
213
|
+
case NumberComparators.LESSTHAN:
|
|
214
|
+
return `${fieldName} < ${value}`;
|
|
215
|
+
|
|
216
|
+
case NumberComparators.LESSTHANEQUAL:
|
|
217
|
+
return `${fieldName} <= ${value}`;
|
|
218
|
+
|
|
219
|
+
case NumberComparators.GREATERTHAN:
|
|
220
|
+
return `${fieldName} > ${value}`;
|
|
221
|
+
|
|
222
|
+
case NumberComparators.GREATERTHANEQUAL:
|
|
223
|
+
return `${fieldName} >= ${value}`;
|
|
224
|
+
|
|
225
|
+
case DateComparators.ISAFTER:
|
|
226
|
+
return `${fieldName} > '${value}'`;
|
|
227
|
+
|
|
228
|
+
case DateComparators.ISBEFORE:
|
|
229
|
+
return `${fieldName} < '${value}'`;
|
|
230
|
+
|
|
231
|
+
case DateComparators.BETWEEN:
|
|
232
|
+
return `${fieldName}.between('${value.start}', '${value.end}')`;
|
|
233
|
+
|
|
234
|
+
case DateComparators.NOTBETWEEN:
|
|
235
|
+
return `!${fieldName}.between('${value.start}', '${value.end}')`;
|
|
236
|
+
|
|
237
|
+
default:
|
|
238
|
+
return '';
|
|
239
|
+
}
|
|
240
|
+
} else {
|
|
241
|
+
const operator = condition.type === ConditionTokens.AND ? ' AND ' : ' OR ';
|
|
242
|
+
const parts = condition.conditions.map(c => this.convertConditionToQueryStringRecursive(c));
|
|
243
|
+
return `(${parts.join(operator)})`;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
}
|