@zohodesk/library-platform 1.0.2-exp.3 → 1.0.2-exp.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/es/bc/{zdata-broker → zdata-source}/Actions.js +6 -6
- package/es/bc/{zdata-broker → zdata-source}/Constants.js +6 -5
- package/es/bc/zdata-source/EventHandlers.js +2 -0
- package/es/bc/zdata-source/Symbols.js +5 -0
- package/es/bc/zfield/ActionHandlers.js +1 -1
- package/es/bc/zlist/EventHandlers.js +1 -1
- package/es/bc/zlist/Properties.js +16 -32
- package/es/cc/action-icon/Properties.js +31 -0
- package/es/cc/action-location/Properties.js +9 -24
- package/es/cc/table-connected/Constants.js +4 -0
- package/es/cc/table-connected/Properties.js +11 -57
- package/es/cc/table-list/Properties.js +2 -2
- package/es/cc/table-list/data-types/Header.js +6 -0
- package/es/desk-frameworks/table-connected/frameworks/ListSdkFactory.js +88 -1
- package/es/desk-frameworks/table-connected/frameworks/TableConnectedFactory.js +21 -7
- package/es/desk-frameworks/table-connected/frameworks/TableConnectedView.js +5 -2
- package/es/library/dot/components/action-location/frameworks/ui/ActionComponentMapping.js +4 -2
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/HeaderData.js +16 -3
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/RowActions.js +6 -4
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/RowData.js +16 -3
- package/es/library/dot/legacy-to-new-arch/action-icon/frameworks/ui/ActionIcon.js +18 -2
- package/es/library/dot/legacy-to-new-arch/action-icon/frameworks/ui/ActionIconView.js +75 -1
- package/es/platform/client-actions/behaviour/zclient-actions/Readme.md +14 -21
- package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/ExecuteActionBehaviourUseCase.js +1 -1
- package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/InitializeUseCase.js +2 -2
- package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/ClientActionManager.js +9 -9
- package/es/platform/client-actions/cc/action-event-mediator/Properties.js +11 -0
- package/es/platform/client-actions/cc/dynamic-action-component/Properties.js +1 -1
- package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/ActionEventMediatorView.js +3 -1
- package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/EventHandlersFactory.js +3 -3
- package/es/platform/client-actions/components/dynamic-component/frameworks/ui/DynamicActionComponentView.js +2 -2
- package/es/platform/client-actions/components/interfaces/ActionViewModel.js +7 -0
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActionsRenderer.module.css +17 -0
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActionsRendererView.js +7 -2
- package/es/platform/{data-broker → data-source}/http-template/getAvailableFields.js +5 -5
- package/es/platform/{data-broker → data-source}/http-template/getClientActions.js +4 -4
- package/es/platform/{data-broker → data-source}/http-template/getSelectedFields.js +5 -5
- package/es/platform/{data-broker → data-source}/index.js +2 -2
- package/es/platform/{data-broker → data-source}/utils/transformer/CreateCf.js +1 -1
- package/es/platform/{zdata-broker/adapters/controllers/DataBrokerExecutorController.js → zdata-source/adapters/controllers/DataSourceExecutorController.js} +1 -1
- package/es/platform/{zdata-broker → zdata-source}/adapters/gateways/Repository.js +5 -5
- package/es/platform/{zdata-broker → zdata-source}/adapters/presenters/Presenter.js +4 -4
- package/es/platform/{zdata-broker/applications/entities-factory/DataBrokerFactory.js → zdata-source/applications/entities-factory/DataSourceFactory.js} +3 -4
- package/es/platform/{zdata-broker → zdata-source}/applications/usecases/ExecuteActionUseCase.js +3 -3
- package/es/platform/{zdata-broker → zdata-source}/applications/usecases/FailureUseCase.js +3 -3
- package/es/platform/{zdata-broker → zdata-source}/applications/usecases/NoContentUseCase.js +3 -3
- package/es/platform/{zdata-broker → zdata-source}/applications/usecases/SuccessUseCase.js +4 -4
- package/es/platform/{zdata-broker/domain/entities/DataBroker.js → zdata-source/domain/entities/DataSource.js} +12 -12
- package/es/platform/zdata-source/domain/entities/interfaces/MetaData.js +1 -0
- package/es/platform/{zdata-broker → zdata-source}/frameworks/DataBrokerBehaviourFactory.js +2 -2
- package/es/platform/{zdata-broker → zdata-source}/frameworks/EventHandlersFactory.js +7 -12
- package/es/platform/zfield/applications/usecases/ExecuteActionUseCase.js +1 -1
- package/es/platform/zfield/applications/usecases/InitializeUseCase.js +2 -2
- package/es/platform/zfield/applications/usecases/RefetchUseCase.js +1 -1
- package/es/platform/zfield/domain/entities/fields-manager/FieldsManager.js +5 -5
- package/es/platform/zfield/frameworks/ActionHandlerFactory.js +4 -4
- package/es/platform/zlist/adapters/controllers/DeleteSuccessController.js +25 -0
- package/es/platform/zlist/adapters/controllers/UpdateSuccessController.js +25 -0
- package/es/platform/zlist/adapters/gateways/Repository.js +8 -9
- package/es/platform/zlist/adapters/gateways/Service.js +8 -0
- package/es/platform/zlist/adapters/presenters/TableTranslator.js +46 -34
- package/es/platform/zlist/adapters/presenters/translators/ColumnTranslator.js +16 -8
- package/es/platform/zlist/adapters/presenters/translators/Header.js +7 -2
- package/es/platform/zlist/adapters/presenters/translators/HeadersTranslator.js +4 -2
- package/es/platform/zlist/adapters/presenters/translators/Row.js +10 -6
- package/es/platform/zlist/adapters/presenters/translators/RowActionTranslator.js +6 -6
- package/es/platform/zlist/adapters/presenters/translators/RowsTranslator.js +7 -5
- package/es/platform/zlist/adapters/presenters/translators/actions/ActionsTranslator.js +89 -0
- package/es/platform/zlist/applications/entities-factory/ListFactory.js +2 -2
- package/es/platform/zlist/applications/usecases/DeleteSuccessUseCase.js +19 -0
- package/es/platform/zlist/applications/usecases/UpdateSuccessUseCase.js +19 -0
- package/es/platform/zlist/domain/entities/List.js +38 -10
- package/es/platform/zlist/frameworks/EventHandlersFactory.js +17 -23
- package/es/platform/zrecord/applications/usecases/ExecuteActionUseCase.js +1 -1
- package/es/platform/zrecord/applications/usecases/FetchMoreUseCase.js +1 -1
- package/es/platform/zrecord/applications/usecases/InitializeUseCase.js +2 -2
- package/es/platform/zrecord/applications/usecases/RefetchUseCase.js +1 -1
- package/es/platform/zrecord/domain/entities/RecordsManager.js +10 -10
- package/package.json +4 -4
- package/es/bc/zdata-broker/EventHandlers.js +0 -2
- package/es/bc/zdata-broker/Symbols.js +0 -5
- package/es/desk-frameworks/table-connected/frameworks/__tests__/TableConnectedFactory.spec.js +0 -453
- package/es/desk-frameworks/table-connected/frameworks/__tests__/mock/data-broker/http-template/getAvailableFields.js +0 -86
- package/es/desk-frameworks/table-connected/frameworks/__tests__/mock/data-broker/http-template/getRecords.js +0 -81
- package/es/desk-frameworks/table-connected/frameworks/__tests__/mock/data-broker/http-template/getSelectedFields.js +0 -32
- package/es/desk-frameworks/table-connected/frameworks/__tests__/mock/data-broker/index.js +0 -11
- package/es/platform/zdata-broker/domain/entities/interfaces/MetaData.js +0 -1
- /package/es/bc/{zdata-broker → zdata-source}/Properties.js +0 -0
- /package/es/platform/{data-broker → data-source}/dbc/index.js +0 -0
- /package/es/platform/{data-broker → data-source}/http-template/deleteRecord.js +0 -0
- /package/es/platform/{data-broker → data-source}/http-template/deleteRecords.js +0 -0
- /package/es/platform/{data-broker → data-source}/http-template/getRecords.js +0 -0
- /package/es/platform/{data-broker → data-source}/http-template/updateRecord.js +0 -0
- /package/es/platform/{data-broker → data-source}/utils/transformer/Transformer.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/adapters/controllers/AbstractController.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/adapters/controllers/FailureController.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/adapters/controllers/NoContentController.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/adapters/controllers/RegisterController.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/adapters/controllers/SuccessController.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/adapters/gateways/Service.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/adapters/gateways/TemplateHelpers.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/entities-factory/APITemplatesFactory.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/interfaces/InputDependencies.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/interfaces/gateways/IRepository.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/interfaces/gateways/IService.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/interfaces/gateways/ITemplateHelpers.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/interfaces/gateways/State.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/interfaces/input/ExecuteActionInputModel.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/interfaces/input/FailureInputModel.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/interfaces/input/NoContentInputModel.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/interfaces/input/RegisterInputModel.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/interfaces/input/SuccessInputModel.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/interfaces/output/IPresenter.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/usecases/AbstractUseCase.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/usecases/RegisterUseCase.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/domain/entities/APITemplate.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/domain/entities/APITemplates.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/domain/entities/interfaces/APIDetailsModel.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/domain/entities/interfaces/APITemplateModel.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/domain/entities/interfaces/APITemplatesModel.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/domain/entities/interfaces/ApiEnum.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/domain/entities/interfaces/BehaviourState.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/domain/entities/interfaces/EventModel.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/domain/entities/interfaces/IAPITemplate.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/domain/entities/interfaces/IAPITemplates.js +0 -0
- /package/es/platform/{zdata-broker/domain/entities/interfaces/IDataBroker.js → zdata-source/domain/entities/interfaces/IDataSource.js} +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/domain/entities/interfaces/ITemplateHelpers.js +0 -0
- /package/es/platform/zlist/adapters/presenters/translators/interfaces/{FieldUiMapping.js → Context.js} +0 -0
- /package/es/platform/zlist/adapters/presenters/translators/interfaces/{PageContext.js → FieldComponentMapping.js} +0 -0
|
@@ -14,12 +14,12 @@ class SuccessUseCase extends AbstractUseCase {
|
|
|
14
14
|
const {
|
|
15
15
|
actionName
|
|
16
16
|
} = metaData;
|
|
17
|
-
const
|
|
17
|
+
const dataSource = repository.getDataSourceEntity(templateHelpers);
|
|
18
18
|
|
|
19
|
-
if (
|
|
20
|
-
const transformer =
|
|
19
|
+
if (dataSource.isMetaHasDataSourceSignature(metaData)) {
|
|
20
|
+
const transformer = dataSource.getTransformer(actionName);
|
|
21
21
|
const transformedResponse = transformer(response);
|
|
22
|
-
const events =
|
|
22
|
+
const events = dataSource.createSuccessEvents(transformedResponse, metaData);
|
|
23
23
|
events.forEach(action => {
|
|
24
24
|
dispatch(action);
|
|
25
25
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FETCH } from "../../../../bc/zhttp/Constants";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export default class
|
|
2
|
+
import { DATA_SOURCE_EXECUTE_FAILED, DATA_SOURCE_EXECUTE_NO_CONTENT_SUCCEEDED, DATA_SOURCE_EXECUTE_SUCCEEDED } from "../../../../bc/zdata-source/Constants";
|
|
3
|
+
import { DATA_SOURCE_FAILURE, DATA_SOURCE_NO_CONTENT, DATA_SOURCE_SIGNATURE, DATA_SOURCE_SUCCESS } from "../../../../bc/zdata-source/Symbols";
|
|
4
|
+
export default class DataSource {
|
|
5
5
|
constructor(apiTemplates) {
|
|
6
6
|
this.apiTemplates = apiTemplates;
|
|
7
7
|
}
|
|
@@ -11,14 +11,14 @@ export default class DataBroker {
|
|
|
11
11
|
type: FETCH,
|
|
12
12
|
payload: apiDetails,
|
|
13
13
|
metaData: {
|
|
14
|
-
signature:
|
|
14
|
+
signature: DATA_SOURCE_SIGNATURE,
|
|
15
15
|
...metaData
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
return metaData.signature ===
|
|
20
|
+
isMetaHasDataSourceSignature(metaData) {
|
|
21
|
+
return metaData.signature === DATA_SOURCE_SIGNATURE;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
createSuccessEvents(transformedResponse, fullMetaData) {
|
|
@@ -28,7 +28,7 @@ export default class DataBroker {
|
|
|
28
28
|
const {
|
|
29
29
|
type,
|
|
30
30
|
metaData
|
|
31
|
-
} = fullMetaData[
|
|
31
|
+
} = fullMetaData[DATA_SOURCE_SUCCESS];
|
|
32
32
|
const actions = [];
|
|
33
33
|
type && actions.push({
|
|
34
34
|
type,
|
|
@@ -38,7 +38,7 @@ export default class DataBroker {
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
actions.push({
|
|
41
|
-
type:
|
|
41
|
+
type: DATA_SOURCE_EXECUTE_SUCCEEDED,
|
|
42
42
|
metaData,
|
|
43
43
|
payload: {
|
|
44
44
|
actionName,
|
|
@@ -55,7 +55,7 @@ export default class DataBroker {
|
|
|
55
55
|
const {
|
|
56
56
|
type,
|
|
57
57
|
metaData
|
|
58
|
-
} = fullMetaData[
|
|
58
|
+
} = fullMetaData[DATA_SOURCE_NO_CONTENT];
|
|
59
59
|
const actions = [];
|
|
60
60
|
type && actions.push({
|
|
61
61
|
type,
|
|
@@ -63,7 +63,7 @@ export default class DataBroker {
|
|
|
63
63
|
payload: {}
|
|
64
64
|
});
|
|
65
65
|
actions.push({
|
|
66
|
-
type:
|
|
66
|
+
type: DATA_SOURCE_EXECUTE_NO_CONTENT_SUCCEEDED,
|
|
67
67
|
metaData,
|
|
68
68
|
payload: {
|
|
69
69
|
actionName
|
|
@@ -79,7 +79,7 @@ export default class DataBroker {
|
|
|
79
79
|
const {
|
|
80
80
|
type,
|
|
81
81
|
metaData
|
|
82
|
-
} = fullMetaData[
|
|
82
|
+
} = fullMetaData[DATA_SOURCE_FAILURE];
|
|
83
83
|
const actions = [];
|
|
84
84
|
type && actions.push({
|
|
85
85
|
type,
|
|
@@ -89,7 +89,7 @@ export default class DataBroker {
|
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
actions.push({
|
|
92
|
-
type:
|
|
92
|
+
type: DATA_SOURCE_EXECUTE_FAILED,
|
|
93
93
|
metaData,
|
|
94
94
|
payload: {
|
|
95
95
|
actionName,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { DATA_SOURCE_FAILURE, DATA_SOURCE_NO_CONTENT, DATA_SOURCE_SUCCESS } from "../../../../../bc/zdata-source/Symbols";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import EventHandlersFactory from "./EventHandlersFactory";
|
|
2
|
-
export default class
|
|
2
|
+
export default class DataSourceBehaviourFactory {
|
|
3
3
|
static create() {
|
|
4
4
|
return {
|
|
5
|
-
name: '
|
|
5
|
+
name: 'dataSource',
|
|
6
6
|
eventHandlers: EventHandlersFactory.create(),
|
|
7
7
|
properties: {},
|
|
8
8
|
setInitialState: () => ({})
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DATA_SOURCE_EXECUTE, DATA_SOURCE_REGISTER } from "../../../bc/zdata-source/Constants";
|
|
2
2
|
import { FETCH_FAILED, FETCH_SUCCESS, FETCH_SUCCESS_NO_CONTENT } from "../../../bc/zhttp/Constants";
|
|
3
3
|
import Presenter from "../adapters/presenters/Presenter";
|
|
4
4
|
import Repository from "../adapters/gateways/Repository";
|
|
5
5
|
import RegisterController from "../adapters/controllers/RegisterController";
|
|
6
|
-
import
|
|
6
|
+
import DataSourceExecutorController from "../adapters/controllers/DataSourceExecutorController";
|
|
7
7
|
import FailureController from "../adapters/controllers/FailureController";
|
|
8
8
|
import SuccessController from "../adapters/controllers/SuccessController";
|
|
9
9
|
import NoContentController from "../adapters/controllers/NoContentController";
|
|
@@ -25,17 +25,12 @@ export default class EventHandlersFactory {
|
|
|
25
25
|
|
|
26
26
|
static create() {
|
|
27
27
|
const service = this.createService();
|
|
28
|
-
const registerController = new RegisterController(service);
|
|
29
|
-
const dataBrokerExecuteController = new DataBrokerExecutorController(service);
|
|
30
|
-
const failureController = new FailureController(service);
|
|
31
|
-
const successController = new SuccessController(service);
|
|
32
|
-
const noContentController = new NoContentController(service);
|
|
33
28
|
return {
|
|
34
|
-
[
|
|
35
|
-
[
|
|
36
|
-
[FETCH_FAILED]:
|
|
37
|
-
[FETCH_SUCCESS]:
|
|
38
|
-
[FETCH_SUCCESS_NO_CONTENT]:
|
|
29
|
+
[DATA_SOURCE_REGISTER]: new RegisterController(service).handle,
|
|
30
|
+
[DATA_SOURCE_EXECUTE]: new DataSourceExecutorController(service).handle,
|
|
31
|
+
[FETCH_FAILED]: new FailureController(service).handle,
|
|
32
|
+
[FETCH_SUCCESS]: new SuccessController(service).handle,
|
|
33
|
+
[FETCH_SUCCESS_NO_CONTENT]: new NoContentController(service).handle
|
|
39
34
|
};
|
|
40
35
|
}
|
|
41
36
|
|
|
@@ -12,7 +12,7 @@ class ExecuteActionUseCase extends AbstractUseCase {
|
|
|
12
12
|
} = input;
|
|
13
13
|
const fieldManager = repository.getFieldManager();
|
|
14
14
|
fieldManager.startFetching(apiName);
|
|
15
|
-
dispatch(fieldManager.
|
|
15
|
+
dispatch(fieldManager.createDataSourceExecuteEvent(props, apiName));
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DATA_SOURCE_REGISTER } from "../../../../bc/zdata-source/Constants";
|
|
2
2
|
import AbstractUseCase from "./AbstractUseCase";
|
|
3
3
|
|
|
4
4
|
class InitializeUseCase extends AbstractUseCase {
|
|
@@ -8,7 +8,7 @@ class InitializeUseCase extends AbstractUseCase {
|
|
|
8
8
|
dispatch
|
|
9
9
|
} = input;
|
|
10
10
|
dispatch({
|
|
11
|
-
type:
|
|
11
|
+
type: DATA_SOURCE_REGISTER,
|
|
12
12
|
payload: {
|
|
13
13
|
apiTemplates
|
|
14
14
|
}
|
|
@@ -12,7 +12,7 @@ class RefetchUseCase extends AbstractUseCase {
|
|
|
12
12
|
} = input;
|
|
13
13
|
const fieldManager = repository.getFieldManager();
|
|
14
14
|
fieldManager.startFetching(apiName);
|
|
15
|
-
dispatch(fieldManager.
|
|
15
|
+
dispatch(fieldManager.createDataSourceExecuteEvent(props, apiName));
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FIELD_FETCH_FAILURE, FIELD_FETCH_NO_CONTENT, FIELD_FETCH_SUCCESS } from "../../../../../bc/zfield/Constants";
|
|
2
2
|
import FieldApiName from "../interfaces/FieldApiName";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { DATA_SOURCE_EXECUTE } from "../../../../../bc/zdata-source/Constants";
|
|
4
|
+
import { DATA_SOURCE_SUCCESS } from "../../../../../bc/zdata-source/Symbols";
|
|
5
5
|
|
|
6
6
|
class FieldManager {
|
|
7
7
|
constructor(fields, selectedFields, isFieldsFetching, isSelectedFieldsFetching) {
|
|
@@ -39,16 +39,16 @@ class FieldManager {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
createDataSourceExecuteEvent(props, apiName) {
|
|
43
43
|
return {
|
|
44
|
-
type:
|
|
44
|
+
type: DATA_SOURCE_EXECUTE,
|
|
45
45
|
payload: {
|
|
46
46
|
props,
|
|
47
47
|
actionName: apiName
|
|
48
48
|
},
|
|
49
49
|
metaData: {
|
|
50
50
|
actionName: apiName,
|
|
51
|
-
[
|
|
51
|
+
[DATA_SOURCE_SUCCESS]: {
|
|
52
52
|
metaData: {
|
|
53
53
|
apiName
|
|
54
54
|
}
|
|
@@ -10,7 +10,7 @@ import FetchFailureController from "../adapters/controllers/FetchFailureControll
|
|
|
10
10
|
import FetchNoContentController from "../adapters/controllers/FetchNoContentController";
|
|
11
11
|
import RefetchController from "../adapters/controllers/RefetchController";
|
|
12
12
|
import Presenter from "../adapters/presenters/Presenter";
|
|
13
|
-
import {
|
|
13
|
+
import { DATA_SOURCE_EXECUTE_FAILED, DATA_SOURCE_EXECUTE_NO_CONTENT_SUCCEEDED, DATA_SOURCE_EXECUTE_SUCCEEDED } from "../../../bc/zdata-source/Constants";
|
|
14
14
|
|
|
15
15
|
class ActionHandlerFactory {
|
|
16
16
|
static create(apiTemplates) {
|
|
@@ -32,9 +32,9 @@ class ActionHandlerFactory {
|
|
|
32
32
|
MOUNT: new InitializeController(service, apiTemplates).handle,
|
|
33
33
|
[FIELD_EXECUTE]: new ExecuteActionController(service).handle,
|
|
34
34
|
[FIELD_REFETCH]: new RefetchController(service).handle,
|
|
35
|
-
[
|
|
36
|
-
[
|
|
37
|
-
[
|
|
35
|
+
[DATA_SOURCE_EXECUTE_SUCCEEDED]: new FetchSuccessController(service).handle,
|
|
36
|
+
[DATA_SOURCE_EXECUTE_FAILED]: new FetchFailureController(service).handle,
|
|
37
|
+
[DATA_SOURCE_EXECUTE_NO_CONTENT_SUCCEEDED]: new FetchNoContentController(service).handle
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import AbstractController from "./AbstractController";
|
|
2
|
+
|
|
3
|
+
class DeleteSuccessController extends AbstractController {
|
|
4
|
+
handle(event) {
|
|
5
|
+
const {
|
|
6
|
+
state,
|
|
7
|
+
dispatch,
|
|
8
|
+
action
|
|
9
|
+
} = event;
|
|
10
|
+
const {
|
|
11
|
+
recordId
|
|
12
|
+
} = action.payload;
|
|
13
|
+
const {
|
|
14
|
+
deleteSuccessUseCase
|
|
15
|
+
} = this.service;
|
|
16
|
+
deleteSuccessUseCase.updateDependency(state);
|
|
17
|
+
deleteSuccessUseCase.execute({
|
|
18
|
+
dispatch,
|
|
19
|
+
recordId
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default DeleteSuccessController;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import AbstractController from "./AbstractController";
|
|
2
|
+
|
|
3
|
+
class UpdateSuccessController extends AbstractController {
|
|
4
|
+
handle(event) {
|
|
5
|
+
const {
|
|
6
|
+
state,
|
|
7
|
+
dispatch,
|
|
8
|
+
action
|
|
9
|
+
} = event;
|
|
10
|
+
const {
|
|
11
|
+
recordId
|
|
12
|
+
} = action.payload;
|
|
13
|
+
const {
|
|
14
|
+
updateSuccessUseCase
|
|
15
|
+
} = this.service;
|
|
16
|
+
updateSuccessUseCase.updateDependency(state);
|
|
17
|
+
updateSuccessUseCase.execute({
|
|
18
|
+
dispatch,
|
|
19
|
+
recordId
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default UpdateSuccessController;
|
|
@@ -13,22 +13,21 @@ class Repository {
|
|
|
13
13
|
|
|
14
14
|
getList() {
|
|
15
15
|
const {
|
|
16
|
-
limit,
|
|
17
16
|
sortBy,
|
|
18
|
-
|
|
17
|
+
departmentId,
|
|
18
|
+
viewId,
|
|
19
19
|
moduleName,
|
|
20
|
-
|
|
20
|
+
context
|
|
21
21
|
} = this.state.properties;
|
|
22
22
|
const list = ListFactory.createList({
|
|
23
|
-
|
|
24
|
-
filter: {
|
|
25
|
-
departmentId
|
|
26
|
-
viewId
|
|
27
|
-
orgId: filter.orgId,
|
|
23
|
+
context,
|
|
24
|
+
filter: {
|
|
25
|
+
departmentId,
|
|
26
|
+
viewId,
|
|
28
27
|
moduleName
|
|
29
28
|
},
|
|
30
29
|
sortBy,
|
|
31
|
-
limit
|
|
30
|
+
limit: 50
|
|
32
31
|
});
|
|
33
32
|
return list;
|
|
34
33
|
}
|
|
@@ -10,6 +10,8 @@ import RecordUpdateUseCase from "../../applications/usecases/RecordUpdateUseCase
|
|
|
10
10
|
import DeleteSingleRecordUseCase from "../../applications/usecases/DeleteSingleRecordUseCase";
|
|
11
11
|
import RecordExecuteSucceededUseCase from "../../applications/usecases/RecordExecuteSucceededUseCase";
|
|
12
12
|
import RecordExecuteFailedUseCase from "../../applications/usecases/RecordExecuteFailedUseCase";
|
|
13
|
+
import UpdateSuccessUseCase from "../../applications/usecases/UpdateSuccessUseCase";
|
|
14
|
+
import DeleteSuccessUseCase from "../../applications/usecases/DeleteSuccessUseCase";
|
|
13
15
|
|
|
14
16
|
class Service {
|
|
15
17
|
constructor(dependencies) {
|
|
@@ -35,6 +37,10 @@ class Service {
|
|
|
35
37
|
|
|
36
38
|
_defineProperty(this, "recordUpdateUseCase", void 0);
|
|
37
39
|
|
|
40
|
+
_defineProperty(this, "updateSuccessUseCase", void 0);
|
|
41
|
+
|
|
42
|
+
_defineProperty(this, "deleteSuccessUseCase", void 0);
|
|
43
|
+
|
|
38
44
|
this.initializeUseCase = new InitializeUseCase(this.dependencies);
|
|
39
45
|
this.propertiesChangeUseCase = new PropertiesChangeUseCase(this.dependencies);
|
|
40
46
|
this.fetchMoreUseCase = new FetchMoreUseCase(this.dependencies);
|
|
@@ -45,6 +51,8 @@ class Service {
|
|
|
45
51
|
this.recordExecuteSucceededUseCase = new RecordExecuteSucceededUseCase(this.dependencies);
|
|
46
52
|
this.recordExecuteFailedUseCase = new RecordExecuteFailedUseCase(this.dependencies);
|
|
47
53
|
this.recordUpdateUseCase = new RecordUpdateUseCase(this.dependencies);
|
|
54
|
+
this.updateSuccessUseCase = new UpdateSuccessUseCase(this.dependencies);
|
|
55
|
+
this.deleteSuccessUseCase = new DeleteSuccessUseCase(this.dependencies);
|
|
48
56
|
}
|
|
49
57
|
|
|
50
58
|
}
|
|
@@ -8,22 +8,6 @@ import { TableListConstants } from "../../../../cc/table-list";
|
|
|
8
8
|
|
|
9
9
|
const fallbackToDefault = (value, defaultValue) => [undefined, null].includes(value) ? defaultValue : value;
|
|
10
10
|
|
|
11
|
-
const splitActions = rowActions => {
|
|
12
|
-
const noUiActions = [];
|
|
13
|
-
const newRowActions = [];
|
|
14
|
-
rowActions.forEach(action => {
|
|
15
|
-
if (!action.uiType || action.uiType === 'no-ui') {
|
|
16
|
-
noUiActions.push(action);
|
|
17
|
-
} else {
|
|
18
|
-
newRowActions.push(action);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
return {
|
|
22
|
-
noUiActions,
|
|
23
|
-
newRowActions
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
|
|
27
11
|
export default class TableTranslator {
|
|
28
12
|
static transformState(state) {
|
|
29
13
|
const {
|
|
@@ -31,28 +15,29 @@ export default class TableTranslator {
|
|
|
31
15
|
properties
|
|
32
16
|
} = state;
|
|
33
17
|
const {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
pageContext
|
|
18
|
+
componentMapping,
|
|
19
|
+
context
|
|
37
20
|
} = properties;
|
|
21
|
+
context['servicePrefix'] = 'supportapi/zd'; // FIX: servicePrefix defaultValue should be available from properties
|
|
22
|
+
|
|
38
23
|
const {
|
|
39
24
|
zrecord,
|
|
40
|
-
zfield
|
|
25
|
+
zfield,
|
|
26
|
+
zclientAction
|
|
41
27
|
} = fallbackToDefault(behaviours, {}); // FIX: behaviours should be available by default
|
|
42
28
|
|
|
43
29
|
const {
|
|
44
30
|
records,
|
|
45
31
|
isFetching: isRecordsFetching
|
|
46
|
-
} = fallbackToDefault(zrecord, {}); // FIX: zrecord should be available by
|
|
32
|
+
} = fallbackToDefault(zrecord, {}); // FIX: zrecord should be available by defau
|
|
47
33
|
|
|
48
|
-
const fieldUiMapping = uiMapping.fields;
|
|
49
|
-
const rowActionsUiType = uiMapping.rowActionsComponentName;
|
|
50
34
|
const {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} =
|
|
54
|
-
|
|
55
|
-
const
|
|
35
|
+
clientActions,
|
|
36
|
+
isFetching: isClientActionsFetching
|
|
37
|
+
} = fallbackToDefault(zclientAction, {}); // FIX: zclientAction should be available by defaultlt
|
|
38
|
+
|
|
39
|
+
const fieldComponentMapping = componentMapping.fields;
|
|
40
|
+
const rowActionsUiType = componentMapping.rowActionsComponentName;
|
|
56
41
|
const {
|
|
57
42
|
fields: availableFields,
|
|
58
43
|
selectedFields,
|
|
@@ -62,22 +47,49 @@ export default class TableTranslator {
|
|
|
62
47
|
|
|
63
48
|
const isLoading = !!(isRecordsFetching || isAvailableFieldsFetching || isSelectedFieldsFetching);
|
|
64
49
|
const fields = selectedFields === null || selectedFields === void 0 ? void 0 : selectedFields.map(selectedField => availableFields === null || availableFields === void 0 ? void 0 : availableFields.find(availableField => availableField.name === selectedField)).filter(f => f != undefined);
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
50
|
+
const {
|
|
51
|
+
headerActions,
|
|
52
|
+
fieldActions,
|
|
53
|
+
rowActions,
|
|
54
|
+
noLocation
|
|
55
|
+
} = mapClientActions(clientActions || []);
|
|
56
|
+
const isRowClickable = noLocation.some(action => action.uiComponentMapping.eventMappings.some(mapping => mapping.sourceEvent === TableListConstants.TABLE_LIST_ROW_CLICKED));
|
|
57
|
+
const rowCursor = isRowClickable ? RowCursor.Pointer : RowCursor.Default;
|
|
58
|
+
const headersTranslator = new HeadersTranslator(fields, headerActions, context);
|
|
59
|
+
const rowsTranslator = new RowsTranslator(records, fields, rowActions, context, fieldComponentMapping, rowActionsUiType, fieldActions); // const actionTranslator = new ClientActionsTranslator(clientActions, records, fields, pageContext);
|
|
60
|
+
// const translators = [headersTranslator.getTranslator(), rowsTranslator.getTranslator(), actionTranslator.getTranslator()];
|
|
61
|
+
|
|
62
|
+
const translators = [headersTranslator.getTranslator(), rowsTranslator.getTranslator()];
|
|
63
|
+
const data = Pipeline.run(translators, {}); // TODO: Implement ModuleTableModel, and move data and isLoading to tableViewModel Object
|
|
68
64
|
|
|
69
65
|
return {
|
|
70
66
|
properties,
|
|
71
67
|
behaviours,
|
|
72
68
|
rowCursor,
|
|
73
69
|
rowActionsConfig: {
|
|
74
|
-
hasActions: Boolean(
|
|
70
|
+
hasActions: Boolean(rowActions === null || rowActions === void 0 ? void 0 : rowActions.length),
|
|
71
|
+
// Boolean(newRowActions?.length),
|
|
75
72
|
columnWidth: ColumnWidth.XSmall
|
|
76
73
|
},
|
|
77
74
|
isLoading,
|
|
78
|
-
emptyStateUiType:
|
|
79
|
-
data
|
|
75
|
+
emptyStateUiType: componentMapping.emptyState || '',
|
|
76
|
+
data
|
|
80
77
|
};
|
|
81
78
|
}
|
|
82
79
|
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function mapClientActions(clientActions) {
|
|
83
|
+
const allowedActingLocations = ['header_actions', 'field_actions', 'row_actions', null];
|
|
84
|
+
clientActions.forEach(action => {
|
|
85
|
+
if (!allowedActingLocations.includes(action.location)) {
|
|
86
|
+
console.warn('Client action without location:', action.location);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
return {
|
|
90
|
+
headerActions: clientActions.filter(action => action.location && action.location === 'header_actions'),
|
|
91
|
+
fieldActions: clientActions.filter(action => action.location && action.location === 'field_actions'),
|
|
92
|
+
rowActions: clientActions.filter(action => action.location && action.location === 'row_actions'),
|
|
93
|
+
noLocation: clientActions.filter(action => !action.location)
|
|
94
|
+
};
|
|
83
95
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import EmptyViewModel from "./EmptyViewModel";
|
|
2
2
|
import * as FieldTranslators from "./fields";
|
|
3
|
+
import ClientActionsTranslator from "../../../../client-actions/translators/client-actions-translator";
|
|
3
4
|
|
|
4
|
-
function ColumnTranslator(field, record,
|
|
5
|
+
function ColumnTranslator(field, record, fieldComponentMapping, fieldActions) {
|
|
5
6
|
var _record$cf;
|
|
6
7
|
|
|
7
8
|
const {
|
|
@@ -10,25 +11,32 @@ function ColumnTranslator(field, record, fieldUiMapping) {
|
|
|
10
11
|
type
|
|
11
12
|
} = field;
|
|
12
13
|
const value = isCustomField ? (_record$cf = record.cf) === null || _record$cf === void 0 ? void 0 : _record$cf[name] : record[name];
|
|
14
|
+
const actions = ClientActionsTranslator.transform(fieldActions, {
|
|
15
|
+
field,
|
|
16
|
+
record
|
|
17
|
+
});
|
|
13
18
|
|
|
14
19
|
if (!value && value !== false) {
|
|
15
|
-
return EmptyViewModel(
|
|
20
|
+
return EmptyViewModel();
|
|
16
21
|
}
|
|
17
22
|
|
|
18
|
-
if (
|
|
19
|
-
field.uiType =
|
|
23
|
+
if (fieldComponentMapping[name]) {
|
|
24
|
+
field.uiType = fieldComponentMapping[name];
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
const fieldTranslator = FieldTranslators[type];
|
|
23
28
|
|
|
24
29
|
if (!fieldTranslator) {
|
|
25
30
|
console.error(`Field type ${type} not supported`);
|
|
26
|
-
return EmptyViewModel(
|
|
31
|
+
return EmptyViewModel();
|
|
27
32
|
}
|
|
28
33
|
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
return {
|
|
35
|
+
actions,
|
|
36
|
+
...fieldTranslator(field, value, {
|
|
37
|
+
recordId: record.id
|
|
38
|
+
})
|
|
39
|
+
};
|
|
32
40
|
}
|
|
33
41
|
|
|
34
42
|
export default ColumnTranslator;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import ColumnSizeTranslator from "./ColumnSizeTranslator";
|
|
2
2
|
import ColumnAlignmentTranslator from "./ColumnAlignmentTranslator";
|
|
3
|
+
import ClientActionsTranslator from "../../../../client-actions/translators/client-actions-translator";
|
|
3
4
|
|
|
4
|
-
function HeaderTranslator(field) {
|
|
5
|
+
function HeaderTranslator(field, actions, context) {
|
|
5
6
|
const {
|
|
6
7
|
id,
|
|
7
8
|
name,
|
|
@@ -9,13 +10,17 @@ function HeaderTranslator(field) {
|
|
|
9
10
|
isSortable,
|
|
10
11
|
type
|
|
11
12
|
} = field;
|
|
13
|
+
const transformedActions = ClientActionsTranslator.transform(actions, { ...context,
|
|
14
|
+
field
|
|
15
|
+
});
|
|
12
16
|
return {
|
|
13
17
|
id: id,
|
|
14
18
|
name: name,
|
|
15
19
|
text: displayLabel,
|
|
16
20
|
sortable: isSortable,
|
|
17
21
|
alignment: ColumnAlignmentTranslator(type),
|
|
18
|
-
width: ColumnSizeTranslator(type)
|
|
22
|
+
width: ColumnSizeTranslator(type),
|
|
23
|
+
actions: transformedActions
|
|
19
24
|
};
|
|
20
25
|
}
|
|
21
26
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import HeaderTranslator from "./Header";
|
|
2
2
|
export default class HeadersTranslator {
|
|
3
|
-
constructor(fields) {
|
|
3
|
+
constructor(fields, actions, context) {
|
|
4
4
|
this.fields = fields;
|
|
5
|
+
this.actions = actions;
|
|
6
|
+
this.context = context;
|
|
5
7
|
this.pipe = this.pipe.bind(this);
|
|
6
8
|
}
|
|
7
9
|
|
|
@@ -10,7 +12,7 @@ export default class HeadersTranslator {
|
|
|
10
12
|
return [];
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
return this.fields.map(field => HeaderTranslator(field));
|
|
15
|
+
return this.fields.map(field => HeaderTranslator(field, this.actions, this.context));
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
pipe(viewModel) {
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import ColumnTranslator from "./ColumnTranslator";
|
|
2
|
-
import
|
|
2
|
+
import ClientActionsTranslator from "../../../../client-actions/translators/client-actions-translator";
|
|
3
3
|
export default function RowTranslator(_ref) {
|
|
4
4
|
let {
|
|
5
5
|
record,
|
|
6
6
|
fields,
|
|
7
|
-
|
|
7
|
+
fieldComponentMapping,
|
|
8
8
|
rowActionsUiType,
|
|
9
9
|
rowActions,
|
|
10
|
-
|
|
10
|
+
fieldActions,
|
|
11
|
+
context
|
|
11
12
|
} = _ref;
|
|
13
|
+
const actions = ClientActionsTranslator.transform(rowActions, { ...context,
|
|
14
|
+
record
|
|
15
|
+
});
|
|
12
16
|
return {
|
|
13
17
|
id: record.id,
|
|
14
|
-
columns: fields.map(field => ColumnTranslator(field, record,
|
|
18
|
+
columns: fields.map(field => ColumnTranslator(field, record, fieldComponentMapping, fieldActions)),
|
|
15
19
|
rowActionLocation: {
|
|
16
|
-
type: rowActionsUiType
|
|
17
|
-
actions
|
|
20
|
+
type: rowActionsUiType,
|
|
21
|
+
actions
|
|
18
22
|
}
|
|
19
23
|
};
|
|
20
24
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import TemplateHelpers from "../../../../zdata-
|
|
1
|
+
import TemplateHelpers from "../../../../zdata-source/adapters/gateways/TemplateHelpers";
|
|
2
2
|
const templateHelpers = new TemplateHelpers();
|
|
3
|
-
export default function RowActionTranslator(rowAction, record,
|
|
3
|
+
export default function RowActionTranslator(rowAction, record, context) {
|
|
4
4
|
const templateContext = {
|
|
5
|
-
orgName:
|
|
6
|
-
departmentName:
|
|
7
|
-
moduleSanitatedName:
|
|
5
|
+
orgName: context.orgName,
|
|
6
|
+
departmentName: context.departmentName,
|
|
7
|
+
moduleSanitatedName: context.moduleSanitatedName,
|
|
8
8
|
record,
|
|
9
|
-
moduleName:
|
|
9
|
+
moduleName: context.moduleName,
|
|
10
10
|
recordId: record.id
|
|
11
11
|
};
|
|
12
12
|
const properties = PropertiesTranslator(rowAction.properties, templateContext);
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import RowTranslator from "./Row";
|
|
2
2
|
export default class RowsTranslator {
|
|
3
|
-
constructor(records, fields, rowActions,
|
|
3
|
+
constructor(records, fields, rowActions, context, fieldComponentMapping, rowActionsUiType, fieldActions) {
|
|
4
4
|
this.records = records;
|
|
5
5
|
this.fields = fields;
|
|
6
6
|
this.rowActions = rowActions;
|
|
7
|
-
this.
|
|
8
|
-
this.
|
|
7
|
+
this.context = context;
|
|
8
|
+
this.fieldComponentMapping = fieldComponentMapping;
|
|
9
9
|
this.rowActionsUiType = rowActionsUiType;
|
|
10
|
+
this.fieldActions = fieldActions;
|
|
10
11
|
this.pipe = this.pipe.bind(this);
|
|
11
12
|
}
|
|
12
13
|
|
|
@@ -18,10 +19,11 @@ export default class RowsTranslator {
|
|
|
18
19
|
return this.records.map(record => RowTranslator({
|
|
19
20
|
record,
|
|
20
21
|
fields: this.fields,
|
|
21
|
-
|
|
22
|
+
fieldComponentMapping: this.fieldComponentMapping,
|
|
22
23
|
rowActionsUiType: this.rowActionsUiType,
|
|
23
24
|
rowActions: this.rowActions,
|
|
24
|
-
|
|
25
|
+
fieldActions: this.fieldActions,
|
|
26
|
+
context: this.context
|
|
25
27
|
}));
|
|
26
28
|
}
|
|
27
29
|
|