@zohodesk/library-platform 1.1.6 → 1.1.7-exp.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/bc/sdk/ResourceNamesEnum.js +2 -0
- package/es/bc/zform/Properties.js +3 -26
- package/es/bc/zform/Symbol.js +2 -0
- package/es/bc/zlist/Constants.js +3 -1
- package/es/bc/zrecord/Constants.js +1 -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/field/FormDefaultUIType.js +37 -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 +95 -1
- 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/index.js +1 -0
- package/es/cc/section/Properties.js +25 -0
- package/es/cc/table-connected/Properties.js +8 -0
- package/es/cc/table-connected/constants/Events.js +1 -0
- package/es/index.js +6 -1
- package/es/library/dot/components/action-location/frameworks/ui/ActionComponentMapping.js +5 -1
- package/es/library/dot/components/action-location/usecases/interactors/PropertiesChangeUseCase.js +1 -1
- package/es/library/dot/components/form/adapters/presenter/TransformState.js +70 -3
- package/es/library/dot/components/form/frameworks/ui/DefaultComponentRegister.js +28 -0
- package/es/library/dot/components/form/frameworks/ui/Form.js +2 -0
- package/es/library/dot/components/form/frameworks/ui/FormView.js +47 -26
- package/es/library/dot/components/form/frameworks/ui/css/Form.module.css +8 -4
- package/es/library/dot/components/form/frameworks/ui/sub-components/Sections.js +9 -9
- package/es/library/dot/components/section/frameworks/ui/RenderField.js +19 -0
- package/es/library/dot/components/section/frameworks/ui/Section.js +13 -4
- package/es/library/dot/components/section/frameworks/ui/SectionView.js +7 -28
- 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 +7 -13
- 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/platform/client-actions/bc/zclient-actions/SdkContract.js +35 -0
- package/es/platform/client-actions/behaviour/zclient-actions/adapters/resources/ClientActionResource.js +105 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/IClientActionResource.js +1 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/input/GetClientActionLocationInputModel.js +1 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/input/GetClientActionUIComponentPropertiesInputModel.js +1 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/input/GetClientActionsInputModel.js +1 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/input/UpdateClientActionUIComponentPropertiesInputModel.js +1 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/GetClientActionLocationUseCase.js +20 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/GetClientActionUIComponentPropertiesUseCase.js +20 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/GetClientActionsUseCase.js +18 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/UpdateClientActionUIComponentPropertiesUseCase.js +32 -0
- package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/ClientAction.js +12 -0
- package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/ClientActionManager.js +45 -0
- package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/UIComponentMapping.js +10 -0
- package/es/platform/client-actions/behaviour/zclient-actions/frameworks/sdk/ClientActionsSDKFactory.js +29 -0
- package/es/platform/client-actions/cc/action-event-mediator/Properties.js +9 -0
- package/es/platform/client-actions/components/action-event-mediator/applications/usecases/PropertiesChangeUseCase.js +1 -1
- package/es/platform/client-actions/components/action-event-mediator/domain/entities/ActionEventMediatorEntity.js +7 -3
- package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/ActionEventMediatorView.js +3 -1
- package/es/platform/client-actions/components/dynamic-component/frameworks/ui/DynamicActionComponentView.js +4 -2
- 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 +15 -1
- package/es/platform/components/table-connected/frameworks/TableConnectedFactory.js +6 -1
- package/es/platform/data-source/http-template/getClientActions.js +2 -2
- package/es/platform/sdk/application/interfaces/gateways/AbstractResource.js +52 -1
- package/es/platform/sdk/frameworks/Sdk.js +14 -0
- package/es/platform/zform/adapters/presenter/FormTranslator.js +90 -46
- package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +51 -26
- package/es/platform/zform/adapters/presenter/translators/interfaces/ComponentMapping.js +1 -0
- package/es/platform/zform/adapters/presenter/translators/interfaces/FieldContract.js +1 -0
- package/es/platform/zform/adapters/presenter/translators/interfaces/FormTranslatorState.js +1 -0
- package/es/platform/zform/adapters/presenter/translators/interfaces/SectionContract.js +1 -0
- 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/domain/ZSection.js +6 -0
- package/es/platform/zform/frameworks/layout-rules/calculateLayoutRulesResult.js +1 -1
- package/es/platform/zform/frameworks/layout-rules/runSingleFieldCondition.js +1 -1
- package/es/platform/zform/frameworks/layout-rules/validator.js +0 -1
- package/es/platform/zform/frameworks/ui/EventHandlerFactory.js +37 -15
- package/es/platform/zlist/adapters/presenters/TableTranslator.js +3 -2
- package/es/platform/zlist/applications/usecases/RecordSuccessCallbackUsecase.js +4 -1
- package/es/platform/zlist/domain/entities/List.js +9 -3
- package/es/platform/zrecord/adapters/controllers/CreateRecordController.js +5 -1
- package/es/platform/zrecord/adapters/controllers/SetRecordsController.js +7 -3
- package/es/platform/zrecord/applications/usecases/CreateRecordUseCase.js +5 -3
- package/es/platform/zrecord/applications/usecases/SetRecordsUseCase.js +11 -1
- package/package.json +8 -6
- package/es/library/dot/components/section/adapters/presenter/TransFormState.js +0 -26
|
@@ -16,6 +16,7 @@ export default class ActionEventMediatorEntity {
|
|
|
16
16
|
return e => {
|
|
17
17
|
const {
|
|
18
18
|
eventMappings,
|
|
19
|
+
actionId,
|
|
19
20
|
...payloadItems
|
|
20
21
|
} = e.detail.payload;
|
|
21
22
|
const eventMapping = eventMappings.find(eventMapping => eventMapping.sourceEvent === event);
|
|
@@ -25,14 +26,17 @@ export default class ActionEventMediatorEntity {
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
const dispatchEvent = eventMapping.targetEvent;
|
|
28
|
-
const
|
|
29
|
+
const eventMappingPayload = eventMapping.payload;
|
|
29
30
|
const replacementContext = {
|
|
30
31
|
"@payload": payloadItems
|
|
31
32
|
};
|
|
32
|
-
const resolvedPayload = TemplateResolver.replaceContextVariablesInObject(
|
|
33
|
+
const resolvedPayload = TemplateResolver.replaceContextVariablesInObject(eventMappingPayload, replacementContext);
|
|
33
34
|
this.dispatch({
|
|
34
35
|
type: dispatchEvent,
|
|
35
|
-
payload: resolvedPayload
|
|
36
|
+
payload: resolvedPayload,
|
|
37
|
+
metaData: {
|
|
38
|
+
clientActionId: actionId
|
|
39
|
+
}
|
|
36
40
|
});
|
|
37
41
|
};
|
|
38
42
|
}
|
|
@@ -8,10 +8,12 @@ export default function ActionEventMediatorView(_ref, ref) {
|
|
|
8
8
|
const {
|
|
9
9
|
actions,
|
|
10
10
|
renderComponentType,
|
|
11
|
-
gap
|
|
11
|
+
gap,
|
|
12
|
+
testId
|
|
12
13
|
} = state.properties;
|
|
13
14
|
const ActionRenderComponent = ComponentRegistry.get(renderComponentType) || RowActionsRenderer;
|
|
14
15
|
return /*#__PURE__*/React.createElement(ActionRenderComponent, {
|
|
16
|
+
testId: testId,
|
|
15
17
|
actions: actions,
|
|
16
18
|
gap: gap,
|
|
17
19
|
getRef: ref
|
|
@@ -12,7 +12,8 @@ function DynamicComponentView(_ref, ref) {
|
|
|
12
12
|
const {
|
|
13
13
|
component,
|
|
14
14
|
properties,
|
|
15
|
-
eventMappings
|
|
15
|
+
eventMappings,
|
|
16
|
+
id: actionId
|
|
16
17
|
} = action;
|
|
17
18
|
const Component = ComponentRegistry.get(component) || ActionComponentMapping[component];
|
|
18
19
|
|
|
@@ -26,7 +27,8 @@ function DynamicComponentView(_ref, ref) {
|
|
|
26
27
|
getRef: ref,
|
|
27
28
|
...properties,
|
|
28
29
|
appendToActionPayload: {
|
|
29
|
-
eventMappings
|
|
30
|
+
eventMappings,
|
|
31
|
+
actionId
|
|
30
32
|
}
|
|
31
33
|
});
|
|
32
34
|
}
|
|
@@ -11,13 +11,16 @@ function RowActionsRendererView(_ref, ref) {
|
|
|
11
11
|
} = _ref;
|
|
12
12
|
const {
|
|
13
13
|
actions,
|
|
14
|
-
gap
|
|
14
|
+
gap,
|
|
15
|
+
testId
|
|
15
16
|
} = state.properties;
|
|
16
17
|
return /*#__PURE__*/React.createElement(Flex, {
|
|
17
18
|
ref: ref,
|
|
19
|
+
testId: testId,
|
|
20
|
+
customId: testId,
|
|
18
21
|
$ui_displayMode: "inline",
|
|
19
22
|
$ui_alignItems: "center",
|
|
20
|
-
$ui_className: `${gap !== ActionViewGap.NONE ? style[`gap_${gap}`] : ''}`
|
|
23
|
+
$ui_className: `${style.wrapper} ${gap !== ActionViewGap.NONE ? style[`gap_${gap}`] : ''}`
|
|
21
24
|
}, actions.map((action, index) => {
|
|
22
25
|
return /*#__PURE__*/React.createElement(DynamicActionComponent, {
|
|
23
26
|
action: action,
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import ZFormRepository from "../../../../zform/adapters/gateway/FormRepository";
|
|
2
|
+
import ZFormPresenter from "../../../../zform/adapters/presenter/FormPresenter";
|
|
3
|
+
import ZFormValidator from "../../../../zform/frameworks/validation-rules/Validator";
|
|
4
|
+
import ZFormLayoutRuleApplier from "../../../../zform/frameworks/layout-rules/LayoutRuleApplier";
|
|
5
|
+
import HideSectionUseCase from "../../../../zform/applications/usecases/HideSectionUseCase";
|
|
6
|
+
import ShowSectionUseCase from "../../../../zform/applications/usecases/ShowSectionUseCase";
|
|
7
|
+
import ShowFieldUseCase from "../../../../zform/applications/usecases/ShowFieldUseCase";
|
|
8
|
+
import HideFieldUseCase from "../../../../zform/applications/usecases/HideFieldUseCase";
|
|
9
|
+
import SetFieldValueUseCase from "../../../../zform/applications/usecases/SetFieldValueUseCase";
|
|
10
|
+
import SetFieldsValuesUseCase from "../../../../zform/applications/usecases/SetFieldsValuesUseCase";
|
|
11
|
+
import InsertFieldUseCase from "../../../../zform/applications/usecases/InsertFieldUseCase";
|
|
12
|
+
import DeleteFieldUseCase from "../../../../zform/applications/usecases/DeleteFieldUseCase";
|
|
13
|
+
import UpdateFieldUseCase from "../../../../zform/applications/usecases/UpdateFieldUseCase";
|
|
14
|
+
import GetFieldValueUseCase from "../../../../zform/applications/usecases/GetFieldValueUseCase";
|
|
15
|
+
import SubmitUseCase from "../../../../zform/applications/usecases/SubmitUseCase";
|
|
16
|
+
import { AbstractResource } from "../../../../sdk/application/interfaces/gateways/AbstractResource";
|
|
17
|
+
import { SdkContracts } from "../../../../../cc/form-connected/SdkContract"; // hack
|
|
18
|
+
|
|
19
|
+
import { validations as defaultFieldValidations } from "../../../../../library/behaviours/field-validation/frameworks/utils/FormBasicValidationAdaptor";
|
|
20
|
+
export class SmartFormResources extends AbstractResource {
|
|
21
|
+
initialize() {}
|
|
22
|
+
|
|
23
|
+
destroy() {}
|
|
24
|
+
|
|
25
|
+
createUseCase(dependencies, UseCaseClass) {
|
|
26
|
+
var _usecase$updateDepend, _usecase$updateDepend2;
|
|
27
|
+
|
|
28
|
+
const {
|
|
29
|
+
state,
|
|
30
|
+
updateState
|
|
31
|
+
} = this.dependencies;
|
|
32
|
+
const usecase = new UseCaseClass(dependencies);
|
|
33
|
+
(_usecase$updateDepend = usecase.updateDependencies) === null || _usecase$updateDepend === void 0 ? void 0 : _usecase$updateDepend.call(usecase, state, updateState);
|
|
34
|
+
(_usecase$updateDepend2 = usecase.updateDependency) === null || _usecase$updateDepend2 === void 0 ? void 0 : _usecase$updateDepend2.call(usecase, state, updateState);
|
|
35
|
+
return usecase;
|
|
36
|
+
} // private getFormDependencies(): ZFormUseCaseDependencies {
|
|
37
|
+
// const dependencies: ZFormUseCaseDependencies = {
|
|
38
|
+
// repository: new ZFormRepository(),
|
|
39
|
+
// presenter: new ZFormPresenter(),
|
|
40
|
+
// validator: new ZFormValidator(),
|
|
41
|
+
// layoutRuleApplier: new ZFormLayoutRuleApplier()
|
|
42
|
+
// };
|
|
43
|
+
// return dependencies;
|
|
44
|
+
// }
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
getFormDependencies() {
|
|
48
|
+
const dependencies = {
|
|
49
|
+
repository: new ZFormRepository(),
|
|
50
|
+
presenter: new ZFormPresenter(),
|
|
51
|
+
validator: new ZFormValidator(defaultFieldValidations),
|
|
52
|
+
// Hack Need to pass customValidators
|
|
53
|
+
layoutRuleApplier: new ZFormLayoutRuleApplier()
|
|
54
|
+
};
|
|
55
|
+
return dependencies;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
hideSection(sectionName) {
|
|
59
|
+
this.validateInput('hideSection', {
|
|
60
|
+
sectionName
|
|
61
|
+
}, SdkContracts.hideSectionInputMeta);
|
|
62
|
+
const dependencies = this.getFormDependencies();
|
|
63
|
+
const usecase = this.createUseCase(dependencies, HideSectionUseCase);
|
|
64
|
+
usecase.execute({
|
|
65
|
+
sectionName
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
showSection(sectionName) {
|
|
70
|
+
this.validateInput('showSection', {
|
|
71
|
+
sectionName
|
|
72
|
+
}, SdkContracts.showSectionInputMeta);
|
|
73
|
+
const dependencies = this.getFormDependencies();
|
|
74
|
+
const usecase = this.createUseCase(dependencies, ShowSectionUseCase);
|
|
75
|
+
usecase.execute({
|
|
76
|
+
sectionName
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
hideField(fieldName) {
|
|
81
|
+
this.validateInput('hideField', {
|
|
82
|
+
fieldName
|
|
83
|
+
}, SdkContracts.hideFieldInputMeta);
|
|
84
|
+
const dependencies = this.getFormDependencies();
|
|
85
|
+
const usecase = this.createUseCase(dependencies, HideFieldUseCase);
|
|
86
|
+
usecase.execute({
|
|
87
|
+
fieldName
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
showField(fieldName) {
|
|
92
|
+
this.validateInput('showField', {
|
|
93
|
+
fieldName
|
|
94
|
+
}, SdkContracts.showFieldInputMeta);
|
|
95
|
+
const dependencies = this.getFormDependencies();
|
|
96
|
+
const usecase = this.createUseCase(dependencies, ShowFieldUseCase);
|
|
97
|
+
usecase.execute({
|
|
98
|
+
fieldName
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
setFieldValue(fieldName, newValue) {
|
|
103
|
+
this.validateInput('setFieldValue', {
|
|
104
|
+
fieldName,
|
|
105
|
+
newValue
|
|
106
|
+
}, SdkContracts.setFieldValueInputMeta);
|
|
107
|
+
const {
|
|
108
|
+
dispatch
|
|
109
|
+
} = this.dependencies;
|
|
110
|
+
const dependencies = this.getFormDependencies();
|
|
111
|
+
const usecase = this.createUseCase(dependencies, SetFieldValueUseCase);
|
|
112
|
+
usecase.execute({
|
|
113
|
+
fieldName,
|
|
114
|
+
newValue,
|
|
115
|
+
dispatch
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
setFieldsValue(fieldsValuesObj) {
|
|
120
|
+
this.validateInput('setFieldsValue', {
|
|
121
|
+
fieldsValuesObj
|
|
122
|
+
}, SdkContracts.setFieldsValueInputMeta);
|
|
123
|
+
const {
|
|
124
|
+
dispatch
|
|
125
|
+
} = this.dependencies;
|
|
126
|
+
const dependencies = this.getFormDependencies();
|
|
127
|
+
const usecase = this.createUseCase(dependencies, SetFieldsValuesUseCase);
|
|
128
|
+
usecase.execute({
|
|
129
|
+
fieldsValuesObj,
|
|
130
|
+
dispatch
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
insertField(input) {
|
|
135
|
+
this.validateInput('insertField', input, SdkContracts.insertFieldInputMeta);
|
|
136
|
+
const {
|
|
137
|
+
dispatch
|
|
138
|
+
} = this.dependencies;
|
|
139
|
+
const dependencies = this.getFormDependencies();
|
|
140
|
+
const usecase = this.createUseCase(dependencies, InsertFieldUseCase);
|
|
141
|
+
usecase.execute({ ...input,
|
|
142
|
+
dispatch
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
deleteField(fieldName) {
|
|
147
|
+
this.validateInput('deleteField', {
|
|
148
|
+
fieldName
|
|
149
|
+
}, SdkContracts.deleteFieldInputMeta);
|
|
150
|
+
const {
|
|
151
|
+
dispatch
|
|
152
|
+
} = this.dependencies;
|
|
153
|
+
const dependencies = this.getFormDependencies();
|
|
154
|
+
const usecase = this.createUseCase(dependencies, DeleteFieldUseCase);
|
|
155
|
+
usecase.execute({
|
|
156
|
+
fieldName,
|
|
157
|
+
dispatch
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
updateField(fieldName, fieldProperties) {
|
|
162
|
+
this.validateInput('updateField', {
|
|
163
|
+
fieldName,
|
|
164
|
+
fieldProperties
|
|
165
|
+
}, SdkContracts.updateFieldInputMeta);
|
|
166
|
+
const {
|
|
167
|
+
dispatch
|
|
168
|
+
} = this.dependencies;
|
|
169
|
+
const dependencies = this.getFormDependencies();
|
|
170
|
+
const usecase = this.createUseCase(dependencies, UpdateFieldUseCase);
|
|
171
|
+
usecase.execute({
|
|
172
|
+
fieldName,
|
|
173
|
+
fieldProperties,
|
|
174
|
+
dispatch
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
getFieldValue(fieldName) {
|
|
179
|
+
const {
|
|
180
|
+
getData,
|
|
181
|
+
setData
|
|
182
|
+
} = this.createCallback();
|
|
183
|
+
this.validateInput('getFieldValue', {
|
|
184
|
+
fieldName
|
|
185
|
+
}, SdkContracts.getFieldValueInputMeta);
|
|
186
|
+
const {
|
|
187
|
+
dispatch
|
|
188
|
+
} = this.dependencies;
|
|
189
|
+
const dependencies = this.getFormDependencies();
|
|
190
|
+
const usecase = this.createUseCase(dependencies, GetFieldValueUseCase);
|
|
191
|
+
usecase.execute({
|
|
192
|
+
fieldName,
|
|
193
|
+
callback: setData,
|
|
194
|
+
dispatch
|
|
195
|
+
});
|
|
196
|
+
return getData();
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
submit() {
|
|
200
|
+
const {
|
|
201
|
+
dispatch
|
|
202
|
+
} = this.dependencies;
|
|
203
|
+
const dependencies = this.getFormDependencies();
|
|
204
|
+
const usecase = this.createUseCase(dependencies, SubmitUseCase);
|
|
205
|
+
usecase.execute({
|
|
206
|
+
dispatch
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,21 +2,28 @@ import SmartFormConstants from "../../../../cc/form-connected/Constants";
|
|
|
2
2
|
import FormSdkFactory from "./FormSdkFactory";
|
|
3
3
|
import FormConstants from "../../../../cc/form/Constants";
|
|
4
4
|
import { ZFORM_FIELD_VALUE_CHANGED } from "../../../../bc/zform/Symbol";
|
|
5
|
+
import { platformSDK } from "../../../sdk/frameworks/Sdk";
|
|
5
6
|
const {
|
|
6
7
|
SMART_FORM_FIELD_FOCUSED,
|
|
7
8
|
SMART_FORM_FIELD_BLURRED,
|
|
8
9
|
SMART_FORM_FIELD_VALUE_CHANGED
|
|
9
|
-
} = SmartFormConstants;
|
|
10
|
+
} = SmartFormConstants; // function createHandlerWithSdk(handler) {
|
|
11
|
+
// return input => {
|
|
12
|
+
// const { state, dispatch } = input;
|
|
13
|
+
// handler(input, FormSdkFactory.create({ state, dispatch }));
|
|
14
|
+
// };
|
|
15
|
+
// }
|
|
10
16
|
|
|
11
17
|
function createHandlerWithSdk(handler) {
|
|
12
18
|
return input => {
|
|
13
19
|
const {
|
|
14
|
-
state
|
|
15
|
-
dispatch
|
|
20
|
+
state
|
|
16
21
|
} = input;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
const instanceName = state.properties.instanceName;
|
|
23
|
+
handler({ ...input,
|
|
24
|
+
platformSDK
|
|
25
|
+
}, FormSdkFactory.create({
|
|
26
|
+
instanceName
|
|
20
27
|
}));
|
|
21
28
|
};
|
|
22
29
|
}
|
|
@@ -31,7 +38,7 @@ export default class EventHandlersFactory {
|
|
|
31
38
|
|
|
32
39
|
static create(eventHandlers) {
|
|
33
40
|
const wrapped = EventHandlersFactory.createWrapped(eventHandlers);
|
|
34
|
-
return {
|
|
41
|
+
return {
|
|
35
42
|
[FormConstants.FORM_FIELD_FOCUSED]: _ref => {
|
|
36
43
|
let {
|
|
37
44
|
action,
|
|
@@ -84,7 +91,8 @@ export default class EventHandlersFactory {
|
|
|
84
91
|
value
|
|
85
92
|
}
|
|
86
93
|
});
|
|
87
|
-
}
|
|
94
|
+
},
|
|
95
|
+
...wrapped
|
|
88
96
|
};
|
|
89
97
|
}
|
|
90
98
|
|
|
@@ -3,28 +3,52 @@ import { createCustomComponent } from "../../../../library/custom-component";
|
|
|
3
3
|
import ZHttpBehaviourFactory from "../../../zhttp/frameworks/ZHttpBehaviourFactory";
|
|
4
4
|
import RecordBehaviourFactory from "../../../zrecord/frameworks/RecordBehaviourFactory";
|
|
5
5
|
import FormConnectedView from "./FormConnectedView";
|
|
6
|
-
import
|
|
6
|
+
import defaultDataSource from "../../../data-source";
|
|
7
7
|
import DataBrokerBehaviourFactory from "../../../zdata-source/frameworks/DataBrokerBehaviourFactory";
|
|
8
8
|
import FormTranslator from "../../../zform/adapters/presenter/FormTranslator";
|
|
9
9
|
import ZFormBehaviourFactory from "../../../zform/frameworks/ui/ZFormBehaviourFactory";
|
|
10
10
|
import FieldValidationBehaviourFactory from "../../../../library/behaviours/field-validation/frameworks/ui/FieldValidationBehaviourFactory";
|
|
11
11
|
import EventHandlersfactory from "./EventHandlersFactory";
|
|
12
|
+
import SdkBehaviourFactory from "../../../sdk-behaviour/frameworks/SdkBehaviourFactory";
|
|
13
|
+
import ResourceNamesEnum from "../../../../bc/sdk/ResourceNamesEnum";
|
|
14
|
+
import { sdkRegistry } from "../../../sdk/frameworks/SdkRegistry";
|
|
15
|
+
import { SmartFormResources } from "../adapters/resources/SmartFormResources";
|
|
16
|
+
import ClientActionsBehaviourFactory from "../../../client-actions/behaviour/zclient-actions/frameworks/ClientActionsBehaviourFactory";
|
|
17
|
+
sdkRegistry.registerResource({
|
|
18
|
+
resourceName: ResourceNamesEnum.SMART_FORM,
|
|
19
|
+
resource: SmartFormResources
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
function combineDataSourceWithDefault(dataSource) {
|
|
23
|
+
return { ...defaultDataSource,
|
|
24
|
+
...dataSource,
|
|
25
|
+
httpTemplates: { ...defaultDataSource.httpTemplates,
|
|
26
|
+
...(dataSource === null || dataSource === void 0 ? void 0 : dataSource.httpTemplates)
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
12
31
|
export default class FormConnectedFactory {
|
|
13
32
|
static create(_ref) {
|
|
14
33
|
let {
|
|
15
34
|
name,
|
|
16
35
|
customValidators,
|
|
17
|
-
|
|
36
|
+
dataSource,
|
|
18
37
|
eventHandlers = {},
|
|
19
38
|
View = FormConnectedView
|
|
20
39
|
} = _ref;
|
|
40
|
+
|
|
41
|
+
const _dataSource = combineDataSourceWithDefault(dataSource);
|
|
42
|
+
|
|
21
43
|
return createCustomComponent({
|
|
22
44
|
name: name,
|
|
23
45
|
View: View,
|
|
24
46
|
properties: Properties,
|
|
25
47
|
eventHandlers: EventHandlersfactory.create(eventHandlers),
|
|
26
48
|
transformState: FormTranslator.transformState,
|
|
27
|
-
behaviours: [
|
|
49
|
+
behaviours: [SdkBehaviourFactory.create([ResourceNamesEnum.SMART_FORM]), ClientActionsBehaviourFactory.create({
|
|
50
|
+
getClientActions: _dataSource.httpTemplates.getClientActions
|
|
51
|
+
}), ZHttpBehaviourFactory.create(), DataBrokerBehaviourFactory.create(), RecordBehaviourFactory.create(_dataSource.httpTemplates), FieldValidationBehaviourFactory.create(), ZFormBehaviourFactory.create({
|
|
28
52
|
customValidators
|
|
29
53
|
})]
|
|
30
54
|
});
|
|
@@ -8,12 +8,24 @@ function View(_ref, ref) {
|
|
|
8
8
|
} = _ref;
|
|
9
9
|
const {
|
|
10
10
|
isLoading,
|
|
11
|
-
sections = []
|
|
11
|
+
sections = [],
|
|
12
|
+
isHeaderEnabled,
|
|
13
|
+
isFooterEnabled,
|
|
14
|
+
headerLeftActions,
|
|
15
|
+
headerRightActions,
|
|
16
|
+
footerLeftActions,
|
|
17
|
+
footerRightActions
|
|
12
18
|
} = state.viewModel;
|
|
13
19
|
return /*#__PURE__*/React.createElement(Form, {
|
|
14
20
|
getRef: ref,
|
|
15
21
|
isLoading: isLoading,
|
|
16
|
-
sections: sections
|
|
22
|
+
sections: sections,
|
|
23
|
+
isHeaderEnabled: isHeaderEnabled,
|
|
24
|
+
isFooterEnabled: isFooterEnabled,
|
|
25
|
+
headerLeftActions: headerLeftActions,
|
|
26
|
+
headerRightActions: headerRightActions,
|
|
27
|
+
footerLeftActions: footerLeftActions,
|
|
28
|
+
footerRightActions: footerRightActions
|
|
17
29
|
});
|
|
18
30
|
}
|
|
19
31
|
|
|
@@ -1,22 +1,42 @@
|
|
|
1
|
-
/* eslint-disable max-lines-per-function */
|
|
1
|
+
// /* eslint-disable max-lines-per-function */
|
|
2
|
+
import { platformSDK } from "../../../sdk/frameworks/Sdk";
|
|
3
|
+
import ResourceNamesEnum from "../../../../bc/sdk/ResourceNamesEnum";
|
|
2
4
|
export default class FormSdkFactory {
|
|
5
|
+
static getFormSdks(smartForm) {
|
|
6
|
+
return {
|
|
7
|
+
hideSection: sectionName => smartForm.hideSection(sectionName),
|
|
8
|
+
showSection: sectionName => smartForm.showSection(sectionName),
|
|
9
|
+
hideField: fieldName => smartForm.hideField(fieldName),
|
|
10
|
+
showField: fieldName => smartForm.showField(fieldName),
|
|
11
|
+
setFieldValue: (fieldName, newValue) => smartForm.setFieldValue(fieldName, newValue),
|
|
12
|
+
setFieldsValue: fieldsValuesObj => smartForm.setFieldsValue(fieldsValuesObj),
|
|
13
|
+
insertField: input => smartForm.insertField(input),
|
|
14
|
+
deleteField: fieldName => smartForm.deleteField(fieldName),
|
|
15
|
+
updateField: (fieldName, fieldProperties) => smartForm.updateField(fieldName, fieldProperties),
|
|
16
|
+
getFieldValue: fieldName => smartForm.getFieldValue(fieldName),
|
|
17
|
+
submit: () => smartForm.submit()
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
3
21
|
static create(_ref) {
|
|
4
22
|
let {
|
|
5
|
-
|
|
23
|
+
instanceName
|
|
6
24
|
} = _ref;
|
|
25
|
+
const smartForm = platformSDK[ResourceNamesEnum.SMART_FORM](instanceName);
|
|
26
|
+
const formSdks = FormSdkFactory.getFormSdks(smartForm);
|
|
7
27
|
return {
|
|
8
28
|
zform: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
29
|
+
hideSection: formSdks.hideSection,
|
|
30
|
+
showSection: formSdks.showSection,
|
|
31
|
+
hideField: formSdks.hideField,
|
|
32
|
+
showField: formSdks.showField,
|
|
33
|
+
setFieldValue: formSdks.setFieldValue,
|
|
34
|
+
setFieldsValue: formSdks.setFieldsValue,
|
|
35
|
+
insertField: formSdks.insertField,
|
|
36
|
+
deleteField: formSdks.deleteField,
|
|
37
|
+
updateField: formSdks.updateField,
|
|
38
|
+
getFieldValue: formSdks.getFieldValue,
|
|
39
|
+
submit: formSdks.submit
|
|
20
40
|
}
|
|
21
41
|
};
|
|
22
42
|
}
|
|
@@ -17,53 +17,11 @@ import UpdateMultipleRecordUseCase from "../../../../zlist/applications/usecases
|
|
|
17
17
|
import GetContextUseCase from "../../../../zlist/applications/usecases/GetContextUseCase";
|
|
18
18
|
import ReOrderUseCase from "../../../../zlist/applications/usecases/ReOrderUseCase";
|
|
19
19
|
import { SdkContracts } from "../../../../../cc/table-connected/SdkContract";
|
|
20
|
-
import Validator from "../../../../../library/custom-component/frameworks/json-schema-validator/Validator";
|
|
21
|
-
import ErrorPrinter from "./ErrorPrinter";
|
|
22
20
|
export class SmartTableResource extends AbstractResource {
|
|
23
21
|
initialize() {}
|
|
24
22
|
|
|
25
23
|
destroy() {}
|
|
26
24
|
|
|
27
|
-
safeValidateInput(meta, input) {
|
|
28
|
-
try {
|
|
29
|
-
const result = Validator.validate(meta, input);
|
|
30
|
-
return result;
|
|
31
|
-
} catch (error) {
|
|
32
|
-
return {
|
|
33
|
-
isValid: false,
|
|
34
|
-
errors: [{
|
|
35
|
-
dataPath: '',
|
|
36
|
-
keyword: 'internal',
|
|
37
|
-
message: 'invalid schema'
|
|
38
|
-
}]
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
validateInput(methodName, input, meta) {
|
|
44
|
-
const {
|
|
45
|
-
isValid,
|
|
46
|
-
errors
|
|
47
|
-
} = this.safeValidateInput(meta, input);
|
|
48
|
-
|
|
49
|
-
if (!isValid) {
|
|
50
|
-
const title = `%c Invalid sdk input for %c${methodName}`;
|
|
51
|
-
const styles = ['color: red; font-weight: bold;', 'color: #FF6F61; font-weight: bold;'];
|
|
52
|
-
ErrorPrinter.displaySchemaErrors({
|
|
53
|
-
msg: title,
|
|
54
|
-
styles
|
|
55
|
-
}, errors, '');
|
|
56
|
-
throw {
|
|
57
|
-
code: 'ValidationError',
|
|
58
|
-
message: `Invalid input for ${methodName}`,
|
|
59
|
-
details: {
|
|
60
|
-
methodName,
|
|
61
|
-
errors
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
25
|
getRecordDependencies() {
|
|
68
26
|
const dependencies = {
|
|
69
27
|
repository: new ZRecordRepository(),
|
|
@@ -102,16 +60,6 @@ export class SmartTableResource extends AbstractResource {
|
|
|
102
60
|
return usecase;
|
|
103
61
|
}
|
|
104
62
|
|
|
105
|
-
createCallback() {
|
|
106
|
-
let temp = null;
|
|
107
|
-
return {
|
|
108
|
-
setData: data => {
|
|
109
|
-
temp = data;
|
|
110
|
-
},
|
|
111
|
-
getData: () => temp
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
|
|
115
63
|
getRecords() {
|
|
116
64
|
const {
|
|
117
65
|
getData,
|
|
@@ -15,6 +15,7 @@ import ScrollController from "../adapters/controllers/ScrollController";
|
|
|
15
15
|
import ColumnChooserUpdateController from "../adapters/controllers/ColumnChooserUpdateController";
|
|
16
16
|
import ColumnChooserOpenedController from "../adapters/controllers/ColumnChooserOpenedController";
|
|
17
17
|
import { platformSDK } from "../../../sdk/frameworks/Sdk";
|
|
18
|
+
import { SET_RECORDS_SUCCESS } from "../../../../bc/zrecord/Constants";
|
|
18
19
|
import ErrorEventHandlersFactory from "./ErrorEventHandlersFactory";
|
|
19
20
|
const {
|
|
20
21
|
TABLE_LIST_RESIZE_START_REQUESTED,
|
|
@@ -97,7 +98,20 @@ export default class EventHandlersFactory {
|
|
|
97
98
|
payload: action.payload
|
|
98
99
|
});
|
|
99
100
|
},
|
|
100
|
-
[TABLE_LIST_ROW_DRAG_END]: new ReOrderFinishController().handle
|
|
101
|
+
[TABLE_LIST_ROW_DRAG_END]: new ReOrderFinishController().handle,
|
|
102
|
+
[SET_RECORDS_SUCCESS]: _ref5 => {
|
|
103
|
+
let {
|
|
104
|
+
action,
|
|
105
|
+
dispatch
|
|
106
|
+
} = _ref5;
|
|
107
|
+
|
|
108
|
+
if (action.metaData && action.metaData.isReOrder) {
|
|
109
|
+
dispatch({
|
|
110
|
+
type: SmartTableConstants.Events.REORDER_SUCCESS,
|
|
111
|
+
payload: action.payload
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
101
115
|
};
|
|
102
116
|
return mergeEventHandlers([defaultEventHandlers, ErrorEventHandlersFactory.create(), wrapped]);
|
|
103
117
|
}
|
|
@@ -18,10 +18,15 @@ import SdkBehaviourFactory from "../../../sdk-behaviour/frameworks/SdkBehaviourF
|
|
|
18
18
|
import ResourceNamesEnum from "../../../../bc/sdk/ResourceNamesEnum";
|
|
19
19
|
import { sdkRegistry } from "../../../sdk/frameworks/SdkRegistry";
|
|
20
20
|
import { SmartTableResource } from "../adapters/resources/SmartTableResource";
|
|
21
|
+
import { ClientActionResource } from "../../../client-actions/behaviour/zclient-actions/adapters/resources/ClientActionResource";
|
|
21
22
|
sdkRegistry.registerResource({
|
|
22
23
|
resourceName: ResourceNamesEnum.SMART_TABLE,
|
|
23
24
|
resource: SmartTableResource
|
|
24
25
|
});
|
|
26
|
+
sdkRegistry.registerResource({
|
|
27
|
+
resourceName: ResourceNamesEnum.CLIENT_ACTION,
|
|
28
|
+
resource: ClientActionResource
|
|
29
|
+
});
|
|
25
30
|
import KeyboardControlBehaviourFactory from "../../../../library/behaviours/keyboard-controls/frameworks/KeyboardControlBehaviourFactory";
|
|
26
31
|
|
|
27
32
|
function combineDataSourceWithDefault(dataSource) {
|
|
@@ -62,7 +67,7 @@ export default class TableConnectedFactory {
|
|
|
62
67
|
}
|
|
63
68
|
|
|
64
69
|
static getBehaviours(_dataSource) {
|
|
65
|
-
return [SdkBehaviourFactory.create([ResourceNamesEnum.SMART_TABLE]), TableColumnResizerBehaviorFactory.create(), KeyboardControlBehaviourFactory.create(), LocalStorageBehaviourFactory.create(), ZHttpBehaviourFactory.create(), DataSourceBehaviourFactory.create(), ...TableConnectedFactory.getPlatformBehaviours(_dataSource), ColumnChooserBehaviourFactory.create(), ListItemSelectionBehaviourFactory.create()];
|
|
70
|
+
return [SdkBehaviourFactory.create([ResourceNamesEnum.SMART_TABLE, ResourceNamesEnum.CLIENT_ACTION]), TableColumnResizerBehaviorFactory.create(), KeyboardControlBehaviourFactory.create(), LocalStorageBehaviourFactory.create(), ZHttpBehaviourFactory.create(), DataSourceBehaviourFactory.create(), ...TableConnectedFactory.getPlatformBehaviours(_dataSource), ColumnChooserBehaviourFactory.create(), ListItemSelectionBehaviourFactory.create()];
|
|
66
71
|
}
|
|
67
72
|
|
|
68
73
|
static getPlatformBehaviours(_dataSource) {
|