@zohodesk/library-platform 1.0.2-exp.3 → 1.0.2-exp.5
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
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import TableData from '@zohodesk-private/desk-components/es/table/TableData/TableData';
|
|
3
|
+
import ActionEventMediator from "../../../../../../../../platform/client-actions/components/action-event-mediator/frameworks/ui/ActionEventMediator";
|
|
4
|
+
import { ActionViewGap } from "../../../../../../../../platform/client-actions/components/interfaces/ActionViewModel";
|
|
5
|
+
import { AlignmentOfFlex } from "../../../../../../../../cc/table-list/data-types/Header";
|
|
3
6
|
import FieldComponent from "../field/FieldComponent";
|
|
4
7
|
export default function RowData(_ref) {
|
|
5
8
|
let {
|
|
@@ -10,14 +13,24 @@ export default function RowData(_ref) {
|
|
|
10
13
|
} = _ref;
|
|
11
14
|
let {
|
|
12
15
|
type,
|
|
16
|
+
actions,
|
|
13
17
|
...props
|
|
14
18
|
} = field;
|
|
19
|
+
const hasActions = Boolean(actions === null || actions === void 0 ? void 0 : actions.length);
|
|
15
20
|
return /*#__PURE__*/React.createElement(TableData, {
|
|
16
|
-
$ui_align: alignment,
|
|
21
|
+
$ui_align: hasActions ? null : alignment,
|
|
17
22
|
$data_width: width,
|
|
18
|
-
$flag_flexible: isFlexibleColumns
|
|
23
|
+
$flag_flexible: isFlexibleColumns,
|
|
24
|
+
$customProps_container: hasActions ? {
|
|
25
|
+
$ui_displayMode: 'flex',
|
|
26
|
+
$ui_alignItems: 'center',
|
|
27
|
+
$ui_justifyContent: AlignmentOfFlex[alignment]
|
|
28
|
+
} : null
|
|
19
29
|
}, /*#__PURE__*/React.createElement(FieldComponent, {
|
|
20
30
|
type: type,
|
|
21
31
|
fieldProps: props
|
|
22
|
-
})
|
|
32
|
+
}), hasActions ? /*#__PURE__*/React.createElement(ActionEventMediator, {
|
|
33
|
+
actions: actions,
|
|
34
|
+
gap: ActionViewGap.SMALL
|
|
35
|
+
}) : null);
|
|
23
36
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createCustomComponent } from "../../../../../custom-component";
|
|
2
2
|
import Properties from "../../../../../../cc/action-icon/Properties";
|
|
3
|
-
import ActionIconView from "./ActionIconView";
|
|
3
|
+
import ActionIconView, { ButtonView, FilterDropdownView } from "./ActionIconView";
|
|
4
4
|
const ActionIcon = createCustomComponent({
|
|
5
5
|
name: 'ActionIcon',
|
|
6
6
|
View: ActionIconView,
|
|
@@ -8,4 +8,20 @@ const ActionIcon = createCustomComponent({
|
|
|
8
8
|
events: [],
|
|
9
9
|
eventHandlers: {}
|
|
10
10
|
});
|
|
11
|
-
export default ActionIcon;
|
|
11
|
+
export default ActionIcon; // NOTE: This is a sample of Button action component
|
|
12
|
+
|
|
13
|
+
export const Button = createCustomComponent({
|
|
14
|
+
name: 'Button',
|
|
15
|
+
View: ButtonView,
|
|
16
|
+
properties: Properties,
|
|
17
|
+
events: [],
|
|
18
|
+
eventHandlers: {}
|
|
19
|
+
}); // NOTE: This is a sample of FilterDropdown action component
|
|
20
|
+
|
|
21
|
+
export const FilterDropdown = createCustomComponent({
|
|
22
|
+
name: 'FilterDropdown',
|
|
23
|
+
View: FilterDropdownView,
|
|
24
|
+
properties: Properties,
|
|
25
|
+
events: [],
|
|
26
|
+
eventHandlers: {}
|
|
27
|
+
});
|
|
@@ -24,7 +24,6 @@ export default function ActionIconView(_ref, ref) {
|
|
|
24
24
|
}, /*#__PURE__*/React.createElement(ActionIcon, {
|
|
25
25
|
$ui_iconName: icon,
|
|
26
26
|
$ui_hoverVariant: hoverVariant,
|
|
27
|
-
$flag_gap: true,
|
|
28
27
|
$flag_disabled: isDisabled,
|
|
29
28
|
$i18n_tooltip: label,
|
|
30
29
|
$event_onClick: !isDisabled ? () => {
|
|
@@ -33,4 +32,79 @@ export default function ActionIconView(_ref, ref) {
|
|
|
33
32
|
});
|
|
34
33
|
} : null
|
|
35
34
|
}));
|
|
35
|
+
} // NOTE: This is a sample of Button action component
|
|
36
|
+
|
|
37
|
+
export function ButtonView(_ref2, ref) {
|
|
38
|
+
let {
|
|
39
|
+
state,
|
|
40
|
+
helpers
|
|
41
|
+
} = _ref2;
|
|
42
|
+
const {
|
|
43
|
+
dispatch
|
|
44
|
+
} = helpers;
|
|
45
|
+
const {
|
|
46
|
+
sourceEvent,
|
|
47
|
+
payload
|
|
48
|
+
} = state.properties.appendToActionPayload.eventMappings[0];
|
|
49
|
+
const {
|
|
50
|
+
value
|
|
51
|
+
} = payload;
|
|
52
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
53
|
+
"data-title": value,
|
|
54
|
+
onClick: () => dispatch({
|
|
55
|
+
type: sourceEvent
|
|
56
|
+
}),
|
|
57
|
+
ref: ref
|
|
58
|
+
}, value);
|
|
59
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
60
|
+
ref: ref,
|
|
61
|
+
onClick: () => {
|
|
62
|
+
dispatch({
|
|
63
|
+
type: sourceEvent
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}, value);
|
|
67
|
+
} // NOTE: This is a sample of FilterDropdown action component
|
|
68
|
+
|
|
69
|
+
export function FilterDropdownView(_ref3, ref) {
|
|
70
|
+
let {
|
|
71
|
+
state,
|
|
72
|
+
helpers
|
|
73
|
+
} = _ref3;
|
|
74
|
+
const {
|
|
75
|
+
dispatch
|
|
76
|
+
} = helpers;
|
|
77
|
+
const {
|
|
78
|
+
options,
|
|
79
|
+
isMultiselectable
|
|
80
|
+
} = state.properties;
|
|
81
|
+
const {
|
|
82
|
+
sourceEvent,
|
|
83
|
+
payload
|
|
84
|
+
} = state.properties.appendToActionPayload.eventMappings[0];
|
|
85
|
+
const {
|
|
86
|
+
fieldName: value
|
|
87
|
+
} = payload;
|
|
88
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
89
|
+
"data-title": value,
|
|
90
|
+
onClick: () => dispatch({
|
|
91
|
+
type: sourceEvent
|
|
92
|
+
}),
|
|
93
|
+
ref: ref
|
|
94
|
+
}, value);
|
|
95
|
+
return /*#__PURE__*/React.createElement("select", {
|
|
96
|
+
"data-title": '',
|
|
97
|
+
ref: ref,
|
|
98
|
+
onChange: e => dispatch({
|
|
99
|
+
type: sourceEvent,
|
|
100
|
+
payload: {
|
|
101
|
+
sourcePayload: {
|
|
102
|
+
selectedValue: e.target.value
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
})
|
|
106
|
+
}, options.map((option, index) => /*#__PURE__*/React.createElement("option", {
|
|
107
|
+
key: index,
|
|
108
|
+
value: option.value
|
|
109
|
+
}, option.label)));
|
|
36
110
|
}
|
|
@@ -1,38 +1,31 @@
|
|
|
1
1
|
Client Actions Behaviour
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
This behaviour will allows your library components to fetch client actions for your users.
|
|
5
4
|
|
|
6
5
|
# Implementation
|
|
7
6
|
|
|
8
|
-
ClientActionsBehaviourFactory.create({ getClientActions:
|
|
7
|
+
ClientActionsBehaviourFactory.create({ getClientActions: dataSource.httpTemplates.getClientActions })
|
|
9
8
|
|
|
10
9
|
This above class should be implemeted in the behaviour props of your library components
|
|
11
10
|
|
|
12
|
-
The user needs to passdown the
|
|
11
|
+
The user needs to passdown the dataSource into the behaviour in the format,
|
|
13
12
|
|
|
14
13
|
1. getClientActions => Client Actions GET data broker template
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
15
|
# Integration inside component
|
|
19
16
|
|
|
20
|
-
We need to initialize or mount our behaviour with the component. Refer the eg used in List component below
|
|
17
|
+
We need to initialize or mount our behaviour with the component. Refer the eg used in List component below
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
private createClientActionsFetchAction(): ActionModel {
|
|
20
|
+
const props = this.createApiProps();
|
|
21
|
+
return {
|
|
22
|
+
type: CLIENTACTION_BEHAVIOUR_EXECUTE,
|
|
23
|
+
payload: {
|
|
24
|
+
actionName: 'getClientActions',
|
|
25
|
+
props,
|
|
26
|
+
apiName: 'clientActions'
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
33
30
|
|
|
34
31
|
The function createClientActionsFetchAction is called at Library component mount, which will mount client action behaviour and do the necessary processing.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
@@ -25,7 +25,7 @@ class ExecuteActionBehaviourUseCase extends AbstractUseCase {
|
|
|
25
25
|
presenter.updateClientAction(recordManager.toObject());
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
dispatch(recordManager.
|
|
28
|
+
dispatch(recordManager.createDataSourceExecuteEvent(props, actionName, metaData));
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
-
import {
|
|
2
|
+
import { DATA_SOURCE_REGISTER } from "../../../../../../bc/zdata-source/Constants";
|
|
3
3
|
export default class InitializeUseCase extends AbstractUseCase {
|
|
4
4
|
execute(input) {
|
|
5
5
|
const {
|
|
@@ -7,7 +7,7 @@ export default class InitializeUseCase extends AbstractUseCase {
|
|
|
7
7
|
dispatch
|
|
8
8
|
} = input;
|
|
9
9
|
dispatch({
|
|
10
|
-
type:
|
|
10
|
+
type: DATA_SOURCE_REGISTER,
|
|
11
11
|
payload: {
|
|
12
12
|
apiTemplates
|
|
13
13
|
}
|
package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/ClientActionManager.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { DATA_SOURCE_FAILURE, DATA_SOURCE_NO_CONTENT, DATA_SOURCE_SUCCESS } from "../../../../../../bc/zdata-source/Symbols";
|
|
2
|
+
import { DATA_SOURCE_EXECUTE } from "../../../../../../bc/zdata-source/Constants";
|
|
3
3
|
import { CLIENTACTION_EXECUTE_FAIL_CALLBACK, CLIENTACTION_EXECUTE_SUCCESS_CALLBACK, CLIENTACTION_EXECUTE_SUCCESS_NO_CONTENT_CALLBACK, ClientActionApiActionName } from "../../../../bc/zclient-actions/Constants";
|
|
4
4
|
import GetClientActionsStrategy from "./GetClientActionsStrategy";
|
|
5
5
|
const clientActionExecuteStrategiesMap = {
|
|
@@ -10,7 +10,7 @@ export default class ClientActionManager {
|
|
|
10
10
|
this.clientActions = clientActions;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
createDataSourceMeta(_ref) {
|
|
14
14
|
let {
|
|
15
15
|
actionName,
|
|
16
16
|
successMeta,
|
|
@@ -19,15 +19,15 @@ export default class ClientActionManager {
|
|
|
19
19
|
} = _ref;
|
|
20
20
|
return {
|
|
21
21
|
actionName,
|
|
22
|
-
[
|
|
23
|
-
[
|
|
24
|
-
[
|
|
22
|
+
[DATA_SOURCE_NO_CONTENT]: successNoContentMeta,
|
|
23
|
+
[DATA_SOURCE_FAILURE]: failureMeta,
|
|
24
|
+
[DATA_SOURCE_SUCCESS]: successMeta
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
createDataSourceExecuteEvent(props, actionName, metaData) {
|
|
29
29
|
return {
|
|
30
|
-
type:
|
|
30
|
+
type: DATA_SOURCE_EXECUTE,
|
|
31
31
|
payload: {
|
|
32
32
|
props,
|
|
33
33
|
actionName
|
|
@@ -59,7 +59,7 @@ export default class ClientActionManager {
|
|
|
59
59
|
type: CLIENTACTION_EXECUTE_FAIL_CALLBACK,
|
|
60
60
|
metaData: clientActionExecuteStrategyMeta
|
|
61
61
|
};
|
|
62
|
-
return this.
|
|
62
|
+
return this.createDataSourceMeta({
|
|
63
63
|
actionName,
|
|
64
64
|
successNoContentMeta,
|
|
65
65
|
failureMeta,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ActionViewGap } from "../../components/interfaces/ActionViewModel";
|
|
1
2
|
import { actionSchema } from "../dynamic-action-component/Properties";
|
|
2
3
|
export const actionsSchema = {
|
|
3
4
|
type: 'array',
|
|
@@ -19,5 +20,15 @@ export default {
|
|
|
19
20
|
}
|
|
20
21
|
},
|
|
21
22
|
defaultValue: ''
|
|
23
|
+
},
|
|
24
|
+
gap: {
|
|
25
|
+
required: false,
|
|
26
|
+
defaultValue: ActionViewGap.NONE,
|
|
27
|
+
typeMetadata: {
|
|
28
|
+
schema: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
enum: Object.values(ActionViewGap)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
22
33
|
}
|
|
23
34
|
};
|
|
@@ -7,11 +7,13 @@ export default function ActionEventMediatorView(_ref, ref) {
|
|
|
7
7
|
} = _ref;
|
|
8
8
|
const {
|
|
9
9
|
actions,
|
|
10
|
-
renderComponentType
|
|
10
|
+
renderComponentType,
|
|
11
|
+
gap
|
|
11
12
|
} = state.properties;
|
|
12
13
|
const ActionRenderComponent = ComponentRegistry.get(renderComponentType) || RowActionsRenderer;
|
|
13
14
|
return /*#__PURE__*/React.createElement(ActionRenderComponent, {
|
|
14
15
|
actions: actions,
|
|
16
|
+
gap: gap,
|
|
15
17
|
getRef: ref
|
|
16
18
|
});
|
|
17
19
|
}
|
|
@@ -21,9 +21,9 @@ export default class EventHandlersFactory {
|
|
|
21
21
|
const unmountController = new UnmountController(destroyUseCase);
|
|
22
22
|
const propertiesChangeController = new PropertiesChangeController(propertiesChangeUseCase);
|
|
23
23
|
return {
|
|
24
|
-
MOUNT: initializeController.handle,
|
|
25
|
-
UPDATE_PROPERTIES: propertiesChangeController.handle,
|
|
26
|
-
UNMOUNT: unmountController.handle
|
|
24
|
+
['ActionEventMediator#MOUNT']: initializeController.handle,
|
|
25
|
+
['ActionEventMediator#UPDATE_PROPERTIES']: propertiesChangeController.handle,
|
|
26
|
+
['ActionEventMediator#UNMOUNT']: unmountController.handle
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ComponentRegistry from "../../../../../../library/custom-component/frameworks/ui/ComponentRegistry";
|
|
3
|
+
import ActionComponentMapping from "../../../../../../library/dot/components/action-location/frameworks/ui/ActionComponentMapping";
|
|
3
4
|
|
|
4
5
|
function DynamicComponentView(_ref, ref) {
|
|
5
6
|
let {
|
|
@@ -13,7 +14,7 @@ function DynamicComponentView(_ref, ref) {
|
|
|
13
14
|
properties,
|
|
14
15
|
eventMappings
|
|
15
16
|
} = action;
|
|
16
|
-
const Component = ComponentRegistry.get(component);
|
|
17
|
+
const Component = ComponentRegistry.get(component) || ActionComponentMapping[component];
|
|
17
18
|
|
|
18
19
|
if (!Component) {
|
|
19
20
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -30,5 +31,4 @@ function DynamicComponentView(_ref, ref) {
|
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
;
|
|
34
34
|
export default DynamicComponentView;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[dir=ltr] .actions {
|
|
2
|
+
padding-left: var(--zd_size4)
|
|
3
|
+
}[dir=rtl] .actions {
|
|
4
|
+
padding-right: var(--zd_size4)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.gap_small {
|
|
8
|
+
gap: var(--zd_size4)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.gap_medium {
|
|
12
|
+
gap: var(--zd_size8)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.gap_large {
|
|
16
|
+
gap: var(--zd_size12)
|
|
17
|
+
}
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Flex from '@zohodesk/layout/es/Flex/Flex';
|
|
3
3
|
import DynamicActionComponent from "../../../dynamic-component/frameworks/ui/DynamicActionComponent";
|
|
4
|
+
import { ActionViewGap } from "../../../interfaces/ActionViewModel";
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import style from "./RowActionsRenderer.module.css";
|
|
4
7
|
|
|
5
8
|
function RowActionsRendererView(_ref, ref) {
|
|
6
9
|
let {
|
|
7
10
|
state
|
|
8
11
|
} = _ref;
|
|
9
12
|
const {
|
|
10
|
-
actions
|
|
13
|
+
actions,
|
|
14
|
+
gap
|
|
11
15
|
} = state.properties;
|
|
12
16
|
return /*#__PURE__*/React.createElement(Flex, {
|
|
13
17
|
ref: ref,
|
|
14
18
|
$ui_displayMode: "inline",
|
|
15
|
-
$ui_alignItems: "center"
|
|
19
|
+
$ui_alignItems: "center",
|
|
20
|
+
$ui_className: `${style.actions} ${gap !== ActionViewGap.NONE ? style[`gap_${gap}`] : ''}`
|
|
16
21
|
}, actions.map((action, index) => {
|
|
17
22
|
return /*#__PURE__*/React.createElement(DynamicActionComponent, {
|
|
18
23
|
action: action,
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
let getAvailableFields = {
|
|
2
|
-
name:
|
|
3
|
-
api:
|
|
2
|
+
name: 'availableFields',
|
|
3
|
+
api: '/{{servicePrefix}}/{{orgName}}/api/v1/views/availableFields',
|
|
4
4
|
parameters: `{
|
|
5
5
|
"departmentId":"{{departmentId}}",
|
|
6
6
|
"module":"{{moduleName}}"
|
|
7
7
|
}`,
|
|
8
|
-
type:
|
|
8
|
+
type: 'GET',
|
|
9
9
|
transformer: res => res.fields,
|
|
10
10
|
properties: {
|
|
11
11
|
moduleName: {
|
|
12
12
|
required: true,
|
|
13
13
|
typeMetadata: {
|
|
14
14
|
schema: {
|
|
15
|
-
type:
|
|
15
|
+
type: 'string'
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
},
|
|
@@ -20,7 +20,7 @@ let getAvailableFields = {
|
|
|
20
20
|
required: true,
|
|
21
21
|
typeMetadata: {
|
|
22
22
|
schema: {
|
|
23
|
-
type:
|
|
23
|
+
type: 'string'
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
let getClientActions = {
|
|
2
|
-
name:
|
|
3
|
-
api:
|
|
2
|
+
name: 'uiActions',
|
|
3
|
+
api: '/{{servicePrefix}}/{{orgName}}/api/v1/clientActions',
|
|
4
4
|
parameters: `{
|
|
5
5
|
"from":{{from}},
|
|
6
6
|
"limit":{{limit}},
|
|
7
7
|
"library": "{{library}}",
|
|
8
8
|
"module": "{{moduleName}}"
|
|
9
9
|
}`,
|
|
10
|
-
type:
|
|
10
|
+
type: 'GET',
|
|
11
11
|
transformer: data => data,
|
|
12
12
|
properties: {
|
|
13
13
|
modelName: {
|
|
14
14
|
required: true,
|
|
15
15
|
typeMetadata: {
|
|
16
16
|
schema: {
|
|
17
|
-
type:
|
|
17
|
+
type: 'string'
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
let getSelectedFields = {
|
|
2
|
-
name:
|
|
3
|
-
api:
|
|
2
|
+
name: 'selectedFields',
|
|
3
|
+
api: '/{{servicePrefix}}/{{orgName}}/api/v1/views/{{viewId}}/selectedFields',
|
|
4
4
|
parameters: `{
|
|
5
5
|
"departmentId":"{{departmentId}}"
|
|
6
6
|
}`,
|
|
7
|
-
type:
|
|
7
|
+
type: 'GET',
|
|
8
8
|
transformer: res => res.fields,
|
|
9
9
|
properties: {
|
|
10
10
|
viewId: {
|
|
11
11
|
required: true,
|
|
12
12
|
typeMetadata: {
|
|
13
13
|
schema: {
|
|
14
|
-
type:
|
|
14
|
+
type: 'string'
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
},
|
|
@@ -20,7 +20,7 @@ let getSelectedFields = {
|
|
|
20
20
|
defaultValue: 1,
|
|
21
21
|
typeMetadata: {
|
|
22
22
|
schema: {
|
|
23
|
-
type:
|
|
23
|
+
type: 'number'
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -7,7 +7,7 @@ import getSelectedFields from "./http-template/getSelectedFields";
|
|
|
7
7
|
import getClientActions from "./http-template/getClientActions";
|
|
8
8
|
import { RecordApiActionName } from "../../bc/zrecord/Constants";
|
|
9
9
|
import deleteRecord from "./http-template/deleteRecord";
|
|
10
|
-
let
|
|
10
|
+
let dataSource = {
|
|
11
11
|
httpTemplates: {
|
|
12
12
|
[RecordApiActionName.GET_RECORDS]: getRecords,
|
|
13
13
|
[RecordApiActionName.UPDATE_RECORD]: updateRecord,
|
|
@@ -18,5 +18,5 @@ let record = {
|
|
|
18
18
|
getSelectedFields
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
export default
|
|
21
|
+
export default dataSource; // let ticketsRecordSerice = createRecord(tickets, () => {});
|
|
22
22
|
// export default ticketsRecordSerice;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// REVIEW: Function never used
|
|
2
2
|
function createCf(item, key) {
|
|
3
3
|
return Object.keys(item).reduce((res, next) => {
|
|
4
|
-
if ([key,
|
|
4
|
+
if ([key, 'id', 'createdTime'].includes(next)) {
|
|
5
5
|
return res;
|
|
6
6
|
} else {
|
|
7
7
|
res[next] = item[next];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import DataSourceFactory from "../../applications/entities-factory/DataSourceFactory";
|
|
4
4
|
export default class Repository {
|
|
5
5
|
constructor() {
|
|
6
6
|
_defineProperty(this, "state", void 0);
|
|
@@ -10,14 +10,14 @@ export default class Repository {
|
|
|
10
10
|
this.state = state;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
getDataSourceEntity(templateHelpers) {
|
|
14
14
|
const {
|
|
15
|
-
|
|
15
|
+
dataSource
|
|
16
16
|
} = this.state.behaviours;
|
|
17
17
|
const {
|
|
18
18
|
apiTemplates
|
|
19
|
-
} =
|
|
20
|
-
const recordManager =
|
|
19
|
+
} = dataSource;
|
|
20
|
+
const recordManager = DataSourceFactory.create(apiTemplates, templateHelpers);
|
|
21
21
|
return recordManager;
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -12,10 +12,10 @@ export default class Presenter {
|
|
|
12
12
|
this.state = state;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
updateBehaviourState(
|
|
15
|
+
updateBehaviourState(dataSourceBehaviourState) {
|
|
16
16
|
this.state = { ...this.state,
|
|
17
17
|
behaviours: { ...this.state.behaviours,
|
|
18
|
-
|
|
18
|
+
dataSource: dataSourceBehaviourState
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
this.updateState(this.state);
|
|
@@ -23,10 +23,10 @@ export default class Presenter {
|
|
|
23
23
|
|
|
24
24
|
updateAPITemplates(apiTemplates) {
|
|
25
25
|
const {
|
|
26
|
-
|
|
26
|
+
dataSource
|
|
27
27
|
} = this.state.behaviours;
|
|
28
28
|
this.updateBehaviourState({
|
|
29
|
-
apiTemplates: { ...(
|
|
29
|
+
apiTemplates: { ...(dataSource === null || dataSource === void 0 ? void 0 : dataSource.apiTemplates),
|
|
30
30
|
...apiTemplates
|
|
31
31
|
}
|
|
32
32
|
});
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import APITemplatesFactory from "./APITemplatesFactory";
|
|
2
|
-
import
|
|
3
|
-
export default class
|
|
2
|
+
import DataSource from "../../domain/entities/DataSource";
|
|
3
|
+
export default class DataSourceFactory {
|
|
4
4
|
static create(httpTemplates, templateHelpers) {
|
|
5
5
|
const apiTemplates = APITemplatesFactory.create(httpTemplates, templateHelpers);
|
|
6
|
-
|
|
7
|
-
return dataBroker;
|
|
6
|
+
return new DataSource(apiTemplates);
|
|
8
7
|
}
|
|
9
8
|
|
|
10
9
|
}
|
package/es/platform/{zdata-broker → zdata-source}/applications/usecases/ExecuteActionUseCase.js
RENAMED
|
@@ -12,9 +12,9 @@ class ExecuteActionUseCase extends AbstractUseCase {
|
|
|
12
12
|
metaData,
|
|
13
13
|
actionName
|
|
14
14
|
} = input;
|
|
15
|
-
const
|
|
16
|
-
const apiDetails =
|
|
17
|
-
dispatch(
|
|
15
|
+
const dataSource = repository.getDataSourceEntity(templateHelpers);
|
|
16
|
+
const apiDetails = dataSource.getApiDetails(actionName, props);
|
|
17
|
+
dispatch(dataSource.createFetchEvent(apiDetails, metaData));
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
}
|
|
@@ -11,10 +11,10 @@ class FailureUseCase extends AbstractUseCase {
|
|
|
11
11
|
metaData,
|
|
12
12
|
error
|
|
13
13
|
} = input;
|
|
14
|
-
const
|
|
14
|
+
const dataSource = repository.getDataSourceEntity(templateHelpers);
|
|
15
15
|
|
|
16
|
-
if (
|
|
17
|
-
const events =
|
|
16
|
+
if (dataSource.isMetaHasDataSourceSignature(metaData)) {
|
|
17
|
+
const events = dataSource.createFailureEvents(error, metaData);
|
|
18
18
|
events.forEach(action => {
|
|
19
19
|
dispatch(action);
|
|
20
20
|
});
|
|
@@ -10,10 +10,10 @@ class NoContentUseCase extends AbstractUseCase {
|
|
|
10
10
|
dispatch,
|
|
11
11
|
metaData
|
|
12
12
|
} = input;
|
|
13
|
-
const
|
|
13
|
+
const dataSource = repository.getDataSourceEntity(templateHelpers);
|
|
14
14
|
|
|
15
|
-
if (
|
|
16
|
-
const events =
|
|
15
|
+
if (dataSource.isMetaHasDataSourceSignature(metaData)) {
|
|
16
|
+
const events = dataSource.createNoContentEvents(metaData);
|
|
17
17
|
events.forEach(action => {
|
|
18
18
|
dispatch(action);
|
|
19
19
|
});
|