@zohodesk/library-platform 1.1.6-temp-1 → 1.1.7-exp.1
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/sdk/ResourceNamesEnum.js +1 -0
- package/es/bc/zform/Symbol.js +2 -0
- package/es/cc/breadcrumb/Constants.js +7 -0
- package/es/cc/breadcrumb/Events.js +14 -0
- package/es/cc/breadcrumb/Properties.js +35 -0
- package/es/cc/breadcrumb/index.js +3 -0
- package/es/cc/fields/index.js +2 -1
- package/es/cc/form/Properties.js +54 -0
- package/es/cc/form-connected/Constants.js +8 -0
- package/es/cc/form-connected/Properties.js +52 -0
- package/es/cc/form-connected/SdkContract.js +159 -0
- package/es/cc/icon-button/Constants.js +7 -0
- package/es/cc/icon-button/Events.js +5 -0
- package/es/cc/icon-button/Properties.js +86 -0
- package/es/cc/icon-button/index.js +3 -0
- package/es/cc/section/Properties.js +9 -0
- package/es/cc/switch/Properties.js +2 -2
- package/es/library/custom-component/adapters/gateways/event-manager/EventManager.js +2 -2
- package/es/library/dot/components/action-location/frameworks/ui/ActionComponentMapping.js +5 -1
- package/es/library/dot/components/form/adapters/presenter/TransformState.js +64 -21
- package/es/library/dot/components/form/frameworks/ui/FormView.js +11 -5
- package/es/library/dot/components/form/frameworks/ui/sub-components/Sections.js +4 -2
- package/es/library/dot/components/section/frameworks/ui/SectionView.js +3 -5
- package/es/library/dot/components/table-list/frameworks/ui/css/TableList.module.css +72 -40
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/Header.js +1 -1
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/Row.js +2 -2
- package/es/library/dot/legacy-to-new-arch/breadcrumb/frameworks/ui/Breadcrumb.js +12 -0
- package/es/library/dot/legacy-to-new-arch/breadcrumb/frameworks/ui/BreadcrumbView.js +47 -0
- package/es/library/dot/legacy-to-new-arch/breadcrumb/frameworks/ui/css/Breadcrumb.module.css +19 -0
- package/es/library/dot/legacy-to-new-arch/breadcrumb/frameworks/ui/sub-components/BreadcrumbItem.js +58 -0
- package/es/library/dot/legacy-to-new-arch/icon-button/frameworks/ui/IconButton.js +12 -0
- package/es/library/dot/legacy-to-new-arch/icon-button/frameworks/ui/IconButtonView.js +43 -0
- package/es/library/dot/legacy-to-new-arch/switch/frameworks/ui/SwitchView.js +5 -5
- package/es/library/dot/legacy-to-new-arch/table-field-components/switch-field/frameworks/ui/SwitchFieldView.js +1 -0
- package/es/platform/client-actions/cc/action-event-mediator/Properties.js +9 -0
- package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/ActionEventMediatorView.js +3 -1
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActionsRenderer.module.css +4 -0
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActionsRendererView.js +5 -2
- package/es/platform/components/form-connected/adapters/resources/SmartFormResources.js +210 -0
- package/es/platform/components/form-connected/application/interfaces/ISmartFormResources.js +1 -0
- package/es/platform/components/form-connected/frameworks/EventHandlersFactory.js +16 -8
- package/es/platform/components/form-connected/frameworks/FormConnectedFactory.js +27 -3
- package/es/platform/components/form-connected/frameworks/FormConnectedView.js +14 -2
- package/es/platform/components/form-connected/frameworks/FormSdkFactory.js +33 -13
- package/es/platform/components/table-connected/adapters/resources/SmartTableResource.js +0 -52
- package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +4 -1
- package/es/platform/page/index.js +46 -0
- package/es/platform/sdk/adapters/gateways/Service.js +4 -0
- package/es/platform/sdk/application/interfaces/gateways/AbstractResource.js +52 -1
- package/es/platform/sdk/application/usecases/GetResourcesUseCase.js +15 -0
- package/es/platform/sdk/domain/entities/ResourceManager.js +4 -0
- package/es/platform/sdk/frameworks/Sdk.js +7 -0
- package/es/platform/sdk/frameworks/SdkRegistry.js +9 -0
- package/es/platform/zform/adapters/presenter/FormTranslator.js +60 -3
- package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +13 -3
- package/es/platform/zform/adapters/presenter/utils/DefaultClientActions.js +59 -0
- package/es/platform/zform/applications/interfaces/input/DeleteFieldUseCaseInput.js +1 -0
- package/es/platform/zform/applications/interfaces/input/GetFieldValueUseCaseInput.js +1 -0
- package/es/platform/zform/applications/interfaces/input/HideFieldUseCaseInput.js +1 -0
- package/es/platform/zform/applications/interfaces/input/HideSectionUseCaseInput.js +1 -0
- package/es/platform/zform/applications/interfaces/input/InsertFieldUseCaseInput.js +1 -0
- package/es/platform/zform/applications/interfaces/input/SetFieldValueUseCaseInput.js +1 -0
- package/es/platform/zform/applications/interfaces/input/SetFieldsValuesUseCaseInput.js +1 -0
- package/es/platform/zform/applications/interfaces/input/ShowFieldUseCaseInput.js +1 -0
- package/es/platform/zform/applications/interfaces/input/ShowSectionUseCaseInput.js +1 -0
- package/es/platform/zform/applications/interfaces/input/SubmitUseCaseInput.js +1 -0
- package/es/platform/zform/applications/interfaces/input/UpdateFieldUseCaseInput.js +1 -0
- package/es/platform/zform/applications/usecases/DeleteFieldUseCase.js +22 -0
- package/es/platform/zform/applications/usecases/GetFieldValueUseCase.js +23 -0
- package/es/platform/zform/applications/usecases/HideFieldUseCase.js +19 -0
- package/es/platform/zform/applications/usecases/HideSectionUseCase.js +19 -0
- package/es/platform/zform/applications/usecases/InitializeUseCase.js +16 -0
- package/es/platform/zform/applications/usecases/InsertFieldUseCase.js +28 -0
- package/es/platform/zform/applications/usecases/SetFieldValueUseCase.js +44 -0
- package/es/platform/zform/applications/usecases/SetFieldsValuesUseCase.js +51 -0
- package/es/platform/zform/applications/usecases/ShowFieldUseCase.js +19 -0
- package/es/platform/zform/applications/usecases/ShowSectionUseCase.js +19 -0
- package/es/platform/zform/applications/usecases/SubmitUseCase.js +29 -0
- package/es/platform/zform/applications/usecases/UpdateFieldUseCase.js +22 -0
- package/es/platform/zform/domain/ZField.js +14 -0
- package/es/platform/zform/domain/ZForm.js +85 -3
- package/es/platform/zform/frameworks/ui/EventHandlerFactory.js +37 -15
- package/es/platform/zrecord/adapters/controllers/CreateRecordController.js +5 -1
- package/es/platform/zrecord/applications/usecases/CreateRecordUseCase.js +5 -3
- package/package.json +18 -19
|
@@ -68,5 +68,14 @@ export class SdkManager {
|
|
|
68
68
|
return this.presentedData;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
getResources() {
|
|
72
|
+
const {
|
|
73
|
+
getResourcesUseCase
|
|
74
|
+
} = this.service;
|
|
75
|
+
getResourcesUseCase.updateDependencies(this.state, this.setPresentedData);
|
|
76
|
+
getResourcesUseCase.execute({});
|
|
77
|
+
return this.presentedData;
|
|
78
|
+
}
|
|
79
|
+
|
|
71
80
|
}
|
|
72
81
|
export const sdkRegistry = new SdkManager();
|
|
@@ -1,13 +1,56 @@
|
|
|
1
|
+
import ClientActionsTranslator from "../../../client-actions/translators/client-actions-translator";
|
|
1
2
|
import SectionTranslator from "./translators/SectionTranslator";
|
|
3
|
+
import DefaultFormClientActions from "./utils/DefaultClientActions";
|
|
2
4
|
export default class FormTranslator {
|
|
3
5
|
static transformState(state) {
|
|
4
6
|
const {
|
|
5
7
|
componentMapping,
|
|
6
|
-
context
|
|
8
|
+
context,
|
|
9
|
+
isHeaderEnabled = true,
|
|
10
|
+
isFooterEnabled = true,
|
|
11
|
+
submitConfig = {
|
|
12
|
+
text: "Submit",
|
|
13
|
+
isEnabled: true
|
|
14
|
+
},
|
|
15
|
+
cancelConfig = {
|
|
16
|
+
text: "Cancel",
|
|
17
|
+
isEnabled: true
|
|
18
|
+
}
|
|
7
19
|
} = state.properties;
|
|
8
20
|
const {
|
|
9
|
-
zform
|
|
21
|
+
zform,
|
|
22
|
+
zclientAction
|
|
10
23
|
} = state.behaviours;
|
|
24
|
+
const {
|
|
25
|
+
clientActions,
|
|
26
|
+
isFetching: isClientActionsFetching
|
|
27
|
+
} = zclientAction || {};
|
|
28
|
+
let combinedClientActions = DefaultFormClientActions({
|
|
29
|
+
clientActions,
|
|
30
|
+
submitConfig,
|
|
31
|
+
cancelConfig
|
|
32
|
+
});
|
|
33
|
+
const mappedClientActions = mapper(combinedClientActions || []);
|
|
34
|
+
const transformedClientActions = {};
|
|
35
|
+
Object.entries(mappedClientActions).forEach(_ref => {
|
|
36
|
+
let [key, value] = _ref;
|
|
37
|
+
|
|
38
|
+
if (isFooterEnabled && (key === 'footerRightActions' || key === 'footerLeftActions')) {
|
|
39
|
+
let footerActions = ClientActionsTranslator.transform(value, context);
|
|
40
|
+
transformedClientActions[key] = footerActions;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (isHeaderEnabled && (key === 'headerLeftActions' || key === 'headerRightActions')) {
|
|
44
|
+
let headerActions = ClientActionsTranslator.transform(value, context);
|
|
45
|
+
transformedClientActions[key] = headerActions;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
const {
|
|
49
|
+
headerLeftActions,
|
|
50
|
+
headerRightActions,
|
|
51
|
+
footerLeftActions,
|
|
52
|
+
footerRightActions
|
|
53
|
+
} = transformedClientActions;
|
|
11
54
|
const {
|
|
12
55
|
isMyFormFetching,
|
|
13
56
|
isDependencyFetching,
|
|
@@ -33,6 +76,7 @@ export default class FormTranslator {
|
|
|
33
76
|
};
|
|
34
77
|
} else {
|
|
35
78
|
return { ...state,
|
|
79
|
+
...zclientAction,
|
|
36
80
|
viewModel: {
|
|
37
81
|
sections: sections.map(section => {
|
|
38
82
|
const sectionViewModel = SectionTranslator({
|
|
@@ -42,10 +86,23 @@ export default class FormTranslator {
|
|
|
42
86
|
});
|
|
43
87
|
return sectionViewModel;
|
|
44
88
|
}),
|
|
89
|
+
isHeaderEnabled,
|
|
90
|
+
isFooterEnabled,
|
|
91
|
+
headerLeftActions,
|
|
92
|
+
headerRightActions,
|
|
93
|
+
footerLeftActions,
|
|
94
|
+
footerRightActions,
|
|
45
95
|
isLoading: false
|
|
46
96
|
}
|
|
47
97
|
};
|
|
48
98
|
}
|
|
49
99
|
}
|
|
50
100
|
|
|
51
|
-
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const mapper = clientAction => ({
|
|
104
|
+
headerLeftActions: clientAction.filter(action => action.location === 'header_left_actions'),
|
|
105
|
+
headerRightActions: clientAction.filter(action => action.location === 'header_right_actions'),
|
|
106
|
+
footerLeftActions: clientAction.filter(action => action.location === 'footer_left_actions'),
|
|
107
|
+
footerRightActions: clientAction.filter(action => action.location === 'footer_right_actions')
|
|
108
|
+
});
|
|
@@ -2,12 +2,14 @@ import { DefaultFormSectionUIType, fieldTypeToUIType } from "../../../../../cc/f
|
|
|
2
2
|
import * as FieldTranslators from "./fields";
|
|
3
3
|
|
|
4
4
|
function SectionTranslator(_ref) {
|
|
5
|
+
var _componentMapping$sec;
|
|
6
|
+
|
|
5
7
|
let {
|
|
6
8
|
section,
|
|
7
9
|
componentMapping,
|
|
8
10
|
context
|
|
9
11
|
} = _ref;
|
|
10
|
-
const mapping = componentMapping.sections[section.name];
|
|
12
|
+
const mapping = componentMapping === null || componentMapping === void 0 ? void 0 : (_componentMapping$sec = componentMapping.sections) === null || _componentMapping$sec === void 0 ? void 0 : _componentMapping$sec[section.name];
|
|
11
13
|
const defaultViewModel = {
|
|
12
14
|
type: mapping !== null && mapping !== void 0 && mapping.UIComponentName ? mapping.UIComponentName : DefaultFormSectionUIType,
|
|
13
15
|
id: section.id + '',
|
|
@@ -20,11 +22,19 @@ function SectionTranslator(_ref) {
|
|
|
20
22
|
var _componentMapping$fie;
|
|
21
23
|
|
|
22
24
|
const fieldTranslator = FieldTranslators[field.type];
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
+
const {
|
|
26
|
+
UIComponentName,
|
|
27
|
+
translator
|
|
28
|
+
} = (componentMapping === null || componentMapping === void 0 ? void 0 : (_componentMapping$fie = componentMapping.fields) === null || _componentMapping$fie === void 0 ? void 0 : _componentMapping$fie[field.apiName]) || {};
|
|
29
|
+
const type = UIComponentName || fieldTypeToUIType[field.type];
|
|
30
|
+
const viewModel = fieldTranslator({
|
|
25
31
|
field,
|
|
26
32
|
type
|
|
27
33
|
});
|
|
34
|
+
return translator ? translator({
|
|
35
|
+
context,
|
|
36
|
+
field: viewModel
|
|
37
|
+
}) : viewModel;
|
|
28
38
|
})
|
|
29
39
|
};
|
|
30
40
|
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
function getDefaultFormAction(_ref) {
|
|
2
|
+
let {
|
|
3
|
+
type,
|
|
4
|
+
text,
|
|
5
|
+
isEnabled
|
|
6
|
+
} = _ref;
|
|
7
|
+
const isSubmit = type === "submit";
|
|
8
|
+
return {
|
|
9
|
+
id: isSubmit ? "4000000080010" : "4000000080013",
|
|
10
|
+
name: "FORM ACTION",
|
|
11
|
+
component: "form",
|
|
12
|
+
location: "footer_left_actions",
|
|
13
|
+
uiComponentMapping: {
|
|
14
|
+
id: isSubmit ? "4000000080011" : "4000000080014",
|
|
15
|
+
name: isSubmit ? "Submit Button" : "Cancel Button",
|
|
16
|
+
component: "Button",
|
|
17
|
+
propertiesValueMapping: {
|
|
18
|
+
text: text || (isSubmit ? "Submit" : "Cancel"),
|
|
19
|
+
palette: isSubmit ? "primaryFilled" : "secondary"
|
|
20
|
+
},
|
|
21
|
+
eventMappings: [{
|
|
22
|
+
id: isSubmit ? "4000000080012" : "4000000080015",
|
|
23
|
+
sourceEvent: "BUTTON#CLICKED",
|
|
24
|
+
targetEvent: isSubmit ? "SMART_FORM#SUBMIT_CLICKED" : "SMART_FORM#CANCEL_CLICKED",
|
|
25
|
+
payloadValueMapping: {}
|
|
26
|
+
}]
|
|
27
|
+
},
|
|
28
|
+
modules: ["static_module"],
|
|
29
|
+
conditions: {
|
|
30
|
+
fields: [],
|
|
31
|
+
pattern: ""
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default function DefaultFormClientActions(props) {
|
|
37
|
+
const {
|
|
38
|
+
submitConfig,
|
|
39
|
+
cancelConfig,
|
|
40
|
+
clientActions = []
|
|
41
|
+
} = props;
|
|
42
|
+
const finalClientActions = [];
|
|
43
|
+
|
|
44
|
+
if (submitConfig !== null && submitConfig !== void 0 && submitConfig.isEnabled) {
|
|
45
|
+
finalClientActions.push(getDefaultFormAction({
|
|
46
|
+
type: "submit",
|
|
47
|
+
...submitConfig
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (cancelConfig !== null && cancelConfig !== void 0 && cancelConfig.isEnabled) {
|
|
52
|
+
finalClientActions.push(getDefaultFormAction({
|
|
53
|
+
type: "cancel",
|
|
54
|
+
...cancelConfig
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return [...finalClientActions, ...clientActions];
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
|
|
3
|
+
class DeleteFieldUseCase extends AbstractUseCase {
|
|
4
|
+
execute(input) {
|
|
5
|
+
const {
|
|
6
|
+
fieldName,
|
|
7
|
+
dispatch
|
|
8
|
+
} = input;
|
|
9
|
+
const {
|
|
10
|
+
repository,
|
|
11
|
+
presenter
|
|
12
|
+
} = this.dependencies;
|
|
13
|
+
const zformEntitiy = repository.getFormEntity();
|
|
14
|
+
let fieldId = zformEntitiy.getFieldId(fieldName);
|
|
15
|
+
zformEntitiy.deleteField(fieldId);
|
|
16
|
+
let zform = zformEntitiy.toObject();
|
|
17
|
+
presenter.updateFormResponse(zform);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default DeleteFieldUseCase;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
|
|
3
|
+
class GetFieldValueUseCase extends AbstractUseCase {
|
|
4
|
+
execute(input) {
|
|
5
|
+
const {
|
|
6
|
+
fieldName,
|
|
7
|
+
callback,
|
|
8
|
+
dispatch
|
|
9
|
+
} = input;
|
|
10
|
+
const {
|
|
11
|
+
repository,
|
|
12
|
+
presenter
|
|
13
|
+
} = this.dependencies;
|
|
14
|
+
const zformEntitiy = repository.getFormEntity();
|
|
15
|
+
let fieldValue = zformEntitiy.getFieldValue(fieldName);
|
|
16
|
+
let zform = zformEntitiy.toObject();
|
|
17
|
+
presenter.updateFormResponse(zform);
|
|
18
|
+
callback === null || callback === void 0 ? void 0 : callback(fieldValue);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default GetFieldValueUseCase;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
|
|
3
|
+
class HideFieldUseCase extends AbstractUseCase {
|
|
4
|
+
execute(input) {
|
|
5
|
+
const {
|
|
6
|
+
fieldName
|
|
7
|
+
} = input;
|
|
8
|
+
const {
|
|
9
|
+
repository,
|
|
10
|
+
presenter
|
|
11
|
+
} = this.dependencies;
|
|
12
|
+
const form = repository.getFormEntity();
|
|
13
|
+
form.setFieldVisibility(fieldName, false);
|
|
14
|
+
presenter.updateFormResponse(form.toObject());
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default HideFieldUseCase;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
|
|
3
|
+
class HideSectionUseCase extends AbstractUseCase {
|
|
4
|
+
execute(input) {
|
|
5
|
+
const {
|
|
6
|
+
sectionName
|
|
7
|
+
} = input;
|
|
8
|
+
const {
|
|
9
|
+
repository,
|
|
10
|
+
presenter
|
|
11
|
+
} = this.dependencies;
|
|
12
|
+
const form = repository.getFormEntity();
|
|
13
|
+
form.setSectionVisibility(sectionName, false);
|
|
14
|
+
presenter.updateFormResponse(form.toObject());
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default HideSectionUseCase;
|
|
@@ -2,6 +2,7 @@ import AbstractUseCase from "./AbstractUseCase";
|
|
|
2
2
|
import { ZFORM_MY_LAYOUTS_SUCCESS } from "../../../../bc/zform/Symbol";
|
|
3
3
|
import { DATA_SOURCE_EXECUTE as DATA_BROKER_EXECUTE } from "../../../../bc/zdata-source/Constants";
|
|
4
4
|
import { DATA_SOURCE_SUCCESS as DATA_BROKER_SUCCESS, DATA_SOURCE_NO_CONTENT as DATA_BROKER_NO_CONTENT } from "../../../../bc/zdata-source/Symbols";
|
|
5
|
+
import { CLIENTACTION_BEHAVIOUR_EXECUTE } from "../../../client-actions/bc/zclient-actions/Constants";
|
|
5
6
|
|
|
6
7
|
class InitializeUseCase extends AbstractUseCase {
|
|
7
8
|
execute(input) {
|
|
@@ -10,6 +11,21 @@ class InitializeUseCase extends AbstractUseCase {
|
|
|
10
11
|
} = input;
|
|
11
12
|
const zformEntity = this.dependencies.repository.getFormEntity();
|
|
12
13
|
const context = zformEntity.getContext();
|
|
14
|
+
dispatch({
|
|
15
|
+
type: CLIENTACTION_BEHAVIOUR_EXECUTE,
|
|
16
|
+
payload: {
|
|
17
|
+
actionName: 'getClientActions',
|
|
18
|
+
props: {
|
|
19
|
+
moduleName: 'static_module',
|
|
20
|
+
component: 'smart_form',
|
|
21
|
+
limit: '1',
|
|
22
|
+
from: '12',
|
|
23
|
+
servicePrefix: 'zform',
|
|
24
|
+
orgName: 'orgName'
|
|
25
|
+
},
|
|
26
|
+
apiName: 'clientActions'
|
|
27
|
+
}
|
|
28
|
+
});
|
|
13
29
|
dispatch({
|
|
14
30
|
type: DATA_BROKER_EXECUTE,
|
|
15
31
|
payload: {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
import ZField from "../../domain/ZField";
|
|
3
|
+
|
|
4
|
+
class InsertFieldUseCase extends AbstractUseCase {
|
|
5
|
+
execute(input) {
|
|
6
|
+
const {
|
|
7
|
+
sectionName,
|
|
8
|
+
fieldsObj,
|
|
9
|
+
fieldIndex,
|
|
10
|
+
dispatch
|
|
11
|
+
} = input;
|
|
12
|
+
const {
|
|
13
|
+
repository,
|
|
14
|
+
presenter
|
|
15
|
+
} = this.dependencies;
|
|
16
|
+
const zformEntitiy = repository.getFormEntity();
|
|
17
|
+
let sectionId = zformEntitiy.getSectionId({
|
|
18
|
+
sectionName
|
|
19
|
+
});
|
|
20
|
+
let entity = new ZField(fieldsObj);
|
|
21
|
+
zformEntitiy.insertFieldAtPositionInSection(sectionId, entity, fieldIndex);
|
|
22
|
+
let zform = zformEntitiy.toObject();
|
|
23
|
+
presenter.updateFormResponse(zform);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default InsertFieldUseCase;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
import { ZFORM_FIELD_VALUE_CHANGE_REQUEST } from "../../../../bc/zform/Symbol";
|
|
3
|
+
|
|
4
|
+
class SetFieldValueUseCase extends AbstractUseCase {
|
|
5
|
+
execute(input) {
|
|
6
|
+
let {
|
|
7
|
+
fieldName,
|
|
8
|
+
newValue,
|
|
9
|
+
dispatch
|
|
10
|
+
} = input; // let { layoutRuleApplier } = this.dependencies
|
|
11
|
+
|
|
12
|
+
let zformEntitiy = this.dependencies.repository.getFormEntity(); // zformEntitiy.setFieldValue(fieldName, newValue, ({ layoutRules, formData }) => {
|
|
13
|
+
// return layoutRuleApplier.applyRules({
|
|
14
|
+
// layoutRules,
|
|
15
|
+
// formData,
|
|
16
|
+
// myForm: zformEntitiy.toObject()
|
|
17
|
+
// })
|
|
18
|
+
// });
|
|
19
|
+
// let zform = zformEntitiy.toObject();
|
|
20
|
+
// // let { fieldResult, sectionResult } = this.dependencies.layoutRuleApplier.applyRules({
|
|
21
|
+
// // layoutRules,
|
|
22
|
+
// // formData: zformEntitiy.getFormData(),
|
|
23
|
+
// // myForm: zform
|
|
24
|
+
// // });
|
|
25
|
+
// // zformEntitiy.applyLayoutRulesResult(sectionResult, fieldResult)
|
|
26
|
+
// // zform = zformEntitiy.toObject();
|
|
27
|
+
// this.dependencies.presenter.updateFormResponse(zform);
|
|
28
|
+
|
|
29
|
+
dispatch({
|
|
30
|
+
type: ZFORM_FIELD_VALUE_CHANGE_REQUEST,
|
|
31
|
+
payload: {
|
|
32
|
+
sectionId: zformEntitiy.getSectionId({
|
|
33
|
+
fieldName
|
|
34
|
+
}),
|
|
35
|
+
fieldName,
|
|
36
|
+
value: newValue
|
|
37
|
+
},
|
|
38
|
+
metaData: {}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default SetFieldValueUseCase;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
import { ZFORM_FIELD_VALUE_CHANGE_REQUEST } from "../../../../bc/zform/Symbol";
|
|
3
|
+
|
|
4
|
+
class SetFieldsValuesUseCase extends AbstractUseCase {
|
|
5
|
+
execute(input) {
|
|
6
|
+
let {
|
|
7
|
+
fieldsValuesObj,
|
|
8
|
+
dispatch
|
|
9
|
+
} = input; // let { layoutRuleApplier } = this.dependencies
|
|
10
|
+
|
|
11
|
+
let zformEntitiy = this.dependencies.repository.getFormEntity(); // zformEntitiy.setFieldValue(fieldName, newValue, ({ layoutRules, formData }) => {
|
|
12
|
+
// return layoutRuleApplier.applyRules({
|
|
13
|
+
// layoutRules,
|
|
14
|
+
// formData,
|
|
15
|
+
// myForm: zformEntitiy.toObject()
|
|
16
|
+
// })
|
|
17
|
+
// });
|
|
18
|
+
// let zform = zformEntitiy.toObject();
|
|
19
|
+
// // let { fieldResult, sectionResult } = this.dependencies.layoutRuleApplier.applyRules({
|
|
20
|
+
// // layoutRules,
|
|
21
|
+
// // formData: zformEntitiy.getFormData(),
|
|
22
|
+
// // myForm: zform
|
|
23
|
+
// // });
|
|
24
|
+
// // zformEntitiy.applyLayoutRulesResult(sectionResult, fieldResult)
|
|
25
|
+
// // zform = zformEntitiy.toObject();
|
|
26
|
+
// this.dependencies.presenter.updateFormResponse(zform);
|
|
27
|
+
// dispatch({
|
|
28
|
+
// type: ZFORM_FIELD_VALUE_CHANGE_REQUEST,
|
|
29
|
+
// payload: { sectionId: zformEntitiy.getSectionId(sectionName), fieldName: '', value: "" },
|
|
30
|
+
// metaData: {}
|
|
31
|
+
// });
|
|
32
|
+
|
|
33
|
+
Object.entries(fieldsValuesObj).forEach(_ref => {
|
|
34
|
+
let [fieldName, value] = _ref;
|
|
35
|
+
dispatch({
|
|
36
|
+
type: ZFORM_FIELD_VALUE_CHANGE_REQUEST,
|
|
37
|
+
payload: {
|
|
38
|
+
sectionId: zformEntitiy.getSectionId({
|
|
39
|
+
fieldName
|
|
40
|
+
}),
|
|
41
|
+
fieldName,
|
|
42
|
+
value
|
|
43
|
+
},
|
|
44
|
+
metaData: {}
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default SetFieldsValuesUseCase;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
|
|
3
|
+
class ShowFieldUseCase extends AbstractUseCase {
|
|
4
|
+
execute(input) {
|
|
5
|
+
const {
|
|
6
|
+
fieldName
|
|
7
|
+
} = input;
|
|
8
|
+
const {
|
|
9
|
+
repository,
|
|
10
|
+
presenter
|
|
11
|
+
} = this.dependencies;
|
|
12
|
+
const form = repository.getFormEntity();
|
|
13
|
+
form.setFieldVisibility(fieldName, true);
|
|
14
|
+
presenter.updateFormResponse(form.toObject());
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default ShowFieldUseCase;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
|
|
3
|
+
class ShowSectionUseCase extends AbstractUseCase {
|
|
4
|
+
execute(input) {
|
|
5
|
+
const {
|
|
6
|
+
sectionName
|
|
7
|
+
} = input;
|
|
8
|
+
const {
|
|
9
|
+
repository,
|
|
10
|
+
presenter
|
|
11
|
+
} = this.dependencies;
|
|
12
|
+
const form = repository.getFormEntity();
|
|
13
|
+
form.setSectionVisibility(sectionName, true);
|
|
14
|
+
presenter.updateFormResponse(form.toObject());
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default ShowSectionUseCase;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ZFORM_SUBMIT } from "../../../../bc/zform/Symbol";
|
|
2
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
3
|
+
|
|
4
|
+
class SubmitUseCase extends AbstractUseCase {
|
|
5
|
+
execute(input) {
|
|
6
|
+
const {
|
|
7
|
+
dispatch
|
|
8
|
+
} = input;
|
|
9
|
+
const {
|
|
10
|
+
repository,
|
|
11
|
+
presenter
|
|
12
|
+
} = this.dependencies;
|
|
13
|
+
const zformEntity = repository.getFormEntity(); // let zform = zformEntitiy.toObject();
|
|
14
|
+
// presenter.updateFormResponse(zform);
|
|
15
|
+
|
|
16
|
+
const context = { ...zformEntity.getContext()
|
|
17
|
+
};
|
|
18
|
+
dispatch({
|
|
19
|
+
type: ZFORM_SUBMIT,
|
|
20
|
+
payload: {
|
|
21
|
+
props: context
|
|
22
|
+
},
|
|
23
|
+
metaData: {}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default SubmitUseCase;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
|
|
3
|
+
class UpdateFieldUseCase extends AbstractUseCase {
|
|
4
|
+
execute(input) {
|
|
5
|
+
const {
|
|
6
|
+
fieldName,
|
|
7
|
+
fieldProperties,
|
|
8
|
+
dispatch
|
|
9
|
+
} = input;
|
|
10
|
+
const {
|
|
11
|
+
repository,
|
|
12
|
+
presenter
|
|
13
|
+
} = this.dependencies;
|
|
14
|
+
const zformEntitiy = repository.getFormEntity();
|
|
15
|
+
zformEntitiy.updateFieldProperties(fieldName, fieldProperties);
|
|
16
|
+
let zform = zformEntitiy.toObject();
|
|
17
|
+
presenter.updateFormResponse(zform);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default UpdateFieldUseCase;
|
|
@@ -159,6 +159,20 @@ export default class ZField {
|
|
|
159
159
|
return this.errorMessage;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
+
setProperties(fieldProperties) {
|
|
163
|
+
this.displayLabel = fieldProperties.displayLabel !== undefined ? fieldProperties.displayLabel : this.displayLabel;
|
|
164
|
+
this.i18NLabel = fieldProperties.i18NLabel !== undefined ? fieldProperties.i18NLabel : this.i18NLabel;
|
|
165
|
+
this.isMandatory = fieldProperties.isMandatory !== undefined ? fieldProperties.isMandatory : this.isMandatory;
|
|
166
|
+
this.isReadOnly = fieldProperties.isReadOnly !== undefined ? fieldProperties.isReadOnly : this.isReadOnly;
|
|
167
|
+
this.maxLength = fieldProperties.maxLength !== undefined ? fieldProperties.maxLength : this.maxLength;
|
|
168
|
+
this.isVisible = fieldProperties.isVisible !== undefined ? fieldProperties.isVisible : this.isVisible;
|
|
169
|
+
this.value = fieldProperties.value !== undefined ? fieldProperties.value : this.value;
|
|
170
|
+
this.errorMessage = fieldProperties.errorMessage !== undefined ? fieldProperties.errorMessage : this.errorMessage;
|
|
171
|
+
this.pickListValues = fieldProperties.pickListValues !== undefined ? fieldProperties.pickListValues : this.pickListValues;
|
|
172
|
+
this.defaultPickListValues = fieldProperties.defaultPickListValues !== undefined ? fieldProperties.defaultPickListValues : this.defaultPickListValues;
|
|
173
|
+
this.toolTip = fieldProperties.toolTip !== undefined ? fieldProperties.toolTip : this.toolTip;
|
|
174
|
+
}
|
|
175
|
+
|
|
162
176
|
setErrorMessage(errorMessage) {
|
|
163
177
|
this.errorMessage = errorMessage;
|
|
164
178
|
}
|