@zohodesk/library-platform 1.1.9-exp.1 → 1.1.10
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/field-validation/Constants.js +4 -0
- package/es/bc/field-validation/EventHandlers.js +1 -0
- package/es/bc/field-validation/Events.js +106 -0
- package/es/bc/field-validation/FieldTypes.js +20 -0
- package/es/bc/field-validation/Properties.js +11 -0
- package/es/bc/field-validation/index.js +5 -0
- package/es/cc/ephi-tag/Properties.js +1 -0
- package/es/cc/ephi-tag/index.js +1 -0
- package/es/cc/info-icon/Properties.js +10 -0
- package/es/cc/info-icon/index.js +1 -0
- package/es/{platform/app-context-behaviour → library/behaviours/field-validation}/adapters/controllers/AbstractController.js +4 -2
- package/es/library/behaviours/field-validation/adapters/controllers/ValidateFieldController.js +32 -0
- package/es/library/behaviours/field-validation/adapters/controllers/ValidateFieldsController.js +31 -0
- package/es/library/behaviours/field-validation/adapters/gateway/Repository.js +23 -0
- package/es/library/behaviours/field-validation/adapters/gateway/Service.js +18 -0
- package/es/library/behaviours/field-validation/applications/interfaces/input/FieldData.js +17 -0
- package/es/library/behaviours/field-validation/applications/usecases/AbstractUseCase.js +15 -0
- package/es/library/behaviours/field-validation/applications/usecases/ValidateField.js +29 -0
- package/es/library/behaviours/field-validation/applications/usecases/ValidateFields.js +28 -0
- package/es/library/behaviours/field-validation/domain/FieldValidation.js +94 -0
- package/es/library/behaviours/field-validation/domain/field-vise-validations/BooleanValidation.js +28 -0
- package/es/library/behaviours/field-validation/domain/field-vise-validations/CurrencyValidation.js +49 -0
- package/es/library/behaviours/field-validation/domain/field-vise-validations/DateTimeValidation.js +24 -0
- package/es/library/behaviours/field-validation/domain/field-vise-validations/DateValidation.js +24 -0
- package/es/library/behaviours/field-validation/domain/field-vise-validations/DecimalValidation.js +49 -0
- package/es/library/behaviours/field-validation/domain/field-vise-validations/EmailValidation.js +28 -0
- package/es/library/behaviours/field-validation/domain/field-vise-validations/IntegerValidation.js +39 -0
- package/es/library/behaviours/field-validation/domain/field-vise-validations/LookUpValidation.js +24 -0
- package/es/library/behaviours/field-validation/domain/field-vise-validations/MultiSelectValidation.js +26 -0
- package/es/library/behaviours/field-validation/domain/field-vise-validations/PercentValidation.js +28 -0
- package/es/library/behaviours/field-validation/domain/field-vise-validations/PhoneValidation.js +39 -0
- package/es/library/behaviours/field-validation/domain/field-vise-validations/PicklistValidation.js +24 -0
- package/es/library/behaviours/field-validation/domain/field-vise-validations/TextAreaValidation.js +39 -0
- package/es/library/behaviours/field-validation/domain/field-vise-validations/TextBoxValidation.js +39 -0
- package/es/library/behaviours/field-validation/domain/field-vise-validations/URLValidation.js +28 -0
- package/es/library/behaviours/field-validation/domain/interfaces/FieldTypes.js +20 -0
- package/es/library/behaviours/field-validation/domain/interfaces/ValidationsEnum.js +22 -0
- package/es/library/behaviours/field-validation/domain/interfaces/ValidationsMap.js +1 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/IDateField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/IDateTimeField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/IDecimalField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/IEmailField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/IIntegerField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/ILookUpField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/IMultiSelectField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/IPercentField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/IPhoneField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/IPicklistField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/ITextAreaField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/ITextBoxField.js +0 -0
- package/es/library/behaviours/field-validation/domain/interfaces/fields/IURLField.js +0 -0
- package/es/library/behaviours/field-validation/frameworks/ui/EventHandlerFactory.js +23 -0
- package/es/library/behaviours/field-validation/frameworks/ui/FieldValidationBehaviourFactory.js +27 -0
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/BooleanFieldValidation.test.js +137 -0
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/CurrencyFieldValidation.test.js +228 -0
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/DateFieldValidation.test.js +108 -0
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/DateTimeFieldValidation.test.js +108 -0
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/DecimalFieldValidation.test.js +257 -0
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/EmailFieldValidation.test.js +139 -0
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/FieldValidationBehaviour.test.js +171 -0
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/IntegerFieldValidation.test.js +168 -0
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/LookUpFieldValidation.test.js +108 -0
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/MultiSelectFieldValidation.test.js +79 -0
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/PercentFieldValidation.test.js +108 -0
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/PhoneFieldValidation.test.js +168 -0
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/PicklistFieldValidation.test.js +79 -0
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/TextAreaFieldValidation.test.js +170 -0
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/TextBoxFieldValidation.test.js +170 -0
- package/es/library/behaviours/field-validation/frameworks/ui/__tests__/URLFieldValidation.test.js +108 -0
- package/es/library/behaviours/field-validation/frameworks/utils/FormBasicValidationAdaptor.js +228 -0
- package/es/library/behaviours/field-validation/frameworks/utils/__tests__/formValidate.test.js +284 -0
- package/es/library/behaviours/field-validation/frameworks/utils/formValidate.js +334 -0
- package/es/library/dot/components/form-fields/checkbox/adapters/presenter/TransformState.js +22 -0
- package/es/library/dot/components/form-fields/currency/adapters/presenter/TransformState.js +81 -0
- package/es/library/dot/components/form-fields/date/adapters/presenter/TransformState.js +22 -0
- package/es/library/dot/components/form-fields/datetime/adapters/presenter/TransformState.js +22 -0
- package/es/library/dot/components/form-fields/decimal/adapters/presenter/TransformState.js +31 -0
- package/es/library/dot/components/form-fields/email/adapters/presenter/TransformState.js +23 -0
- package/es/library/dot/components/form-fields/ephi-tag/frameworks/ui/EPHITag.js +10 -0
- package/es/library/dot/components/form-fields/ephi-tag/frameworks/ui/EPHITagView.js +21 -0
- package/es/library/dot/components/form-fields/ephi-tag/frameworks/ui/css/EPHITag.module.css +3 -0
- package/es/library/dot/components/form-fields/info-icon/frameworks/ui/InfoIcon.js +10 -0
- package/es/library/dot/components/form-fields/info-icon/frameworks/ui/InfoIconView.js +21 -0
- package/es/library/dot/components/form-fields/info-icon/frameworks/ui/css/InfoIcon.module.css +3 -0
- package/es/library/dot/components/form-fields/multi-select/adapters/presenter/TransformState.js +31 -0
- package/es/library/dot/components/form-fields/number/adapters/presenter/TransformState.js +31 -0
- package/es/library/dot/components/form-fields/percentage/adapters/presenter/TransformState.js +31 -0
- package/es/library/dot/components/form-fields/phone/adapters/presenter/TransformState.js +31 -0
- package/es/library/dot/components/form-fields/pick-list/adapters/presenter/TransformState.js +23 -0
- package/es/library/dot/components/form-fields/textarea/adapters/presenter/TransformState.js +23 -0
- package/es/library/dot/components/form-fields/textbox/adapters/presenter/TransformState.js +32 -0
- package/es/library/dot/components/form-fields/url/adapters/presenter/TransformState.js +31 -0
- package/es/library/dot/components/section/adapters/presenter/TransFormState.js +26 -0
- package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/sub-components/ui/LabelAction.js +9 -0
- package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/sub-components/ui/LabelActionView.js +38 -0
- package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/sub-components/ui/css/LabelAction.module.css +4 -0
- package/es/platform/components/form-connected/adapters/resources/SmartFormResources.js +18 -0
- package/es/platform/components/form-connected/frameworks/FormSdkFactory.js +4 -2
- package/es/platform/zdata-source/domain/entities/APITemplate.js +2 -1
- package/es/platform/zform/adapters/controllers/ValidateErrorMessageController.js +22 -0
- package/es/platform/zform/applications/interfaces/input/GetIsFieldValueChangedUseCaseInput.js +1 -0
- package/es/platform/zform/applications/interfaces/input/ValidateErrorMessageInputModel.js +1 -0
- package/es/platform/zform/applications/usecases/GetIsFieldValueChanged.js +35 -0
- package/es/platform/zform/applications/usecases/ValidateErrorMessageUseCase.js +33 -0
- package/es/platform/zform/applications/usecases/ValidateFieldRequestUseCase.js +56 -0
- package/es/platform/zform/domain/ZField.js +4 -0
- package/package.json +1 -1
- package/es/bc/app-context/Event.js +0 -1
- package/es/bc/app-context/Properties.js +0 -58
- package/es/cc/component/ErrorStructure.js +0 -9
- package/es/cc/error-state/ErrorTypes.js +0 -11
- package/es/cc/error-state/Properties.js +0 -31
- package/es/cc/error-state/index.js +0 -2
- package/es/library/custom-component/domain/entities/ComponentProperties.js +0 -121
- package/es/library/custom-component/domain/entities/Logger.js +0 -63
- package/es/library/dot/legacy-to-new-arch/error-state/frameworks/ui/ErrorState.js +0 -10
- package/es/library/dot/legacy-to-new-arch/error-state/frameworks/ui/ErrorStateView.js +0 -68
- package/es/platform/app-context-behaviour/adapters/controllers/InitializeController.js +0 -19
- package/es/platform/app-context-behaviour/adapters/gateways/Service.js +0 -7
- package/es/platform/app-context-behaviour/adapters/presenters/Presenter.js +0 -18
- package/es/platform/app-context-behaviour/adapters/resources/AppResource.js +0 -25
- package/es/platform/app-context-behaviour/applications/AbstractUseCase.js +0 -6
- package/es/platform/app-context-behaviour/applications/usecases/InitializeUseCase.js +0 -15
- package/es/platform/app-context-behaviour/frameworks/AppContextBehaviourFactory.js +0 -31
- package/es/platform/app-context-behaviour/frameworks/EventHandlerFactory.js +0 -25
- package/es/platform/components/form-connected/frameworks/FallbackView.js +0 -23
- package/es/platform/data-source/http-template/getDependencyMappings.js +0 -18
- package/es/platform/data-source/http-template/getLayoutRules.js +0 -29
- package/es/platform/data-source/http-template/getMyForm.js +0 -19
- package/es/platform/data-source/http-template/getMyLayout.js +0 -43
- package/es/platform/data-source/http-template/getValidationRules.js +0 -30
- package/es/platform/zform/adapters/controllers/ApiFailureController.js +0 -31
- package/es/platform/zform/applications/usecases/ApiFailureUseCase.js +0 -30
- /package/es/{platform/app-context-behaviour/applications/interfaces/UsecaseDependencies.js → library/behaviours/field-validation/applications/interfaces/UseCaseDependencies.js} +0 -0
- /package/es/{platform/app-context-behaviour/applications/interfaces/gateways/IService.js → library/behaviours/field-validation/applications/interfaces/gateways/IRepository.js} +0 -0
- /package/es/{platform/app-context-behaviour/applications/interfaces/input/InitializeUseCaseInputModel.js → library/behaviours/field-validation/applications/interfaces/gateways/IService.js} +0 -0
- /package/es/{platform/app-context-behaviour/applications/interfaces/output/BehaviourState.js → library/behaviours/field-validation/applications/interfaces/input/FieldValidationInputModel.js} +0 -0
- /package/es/{platform/app-context-behaviour/applications/interfaces/output/IPresenter.js → library/behaviours/field-validation/applications/interfaces/input/ValidateFieldsInputModel.js} +0 -0
- /package/es/{bc/app-context/Constants.js → library/behaviours/field-validation/domain/interfaces/IField.js} +0 -0
- /package/es/{platform/app-context-behaviour/applications/interfaces/resources/ApiHeaderContract.js → library/behaviours/field-validation/domain/interfaces/IFieldValidation.js} +0 -0
- /package/es/{platform/app-context-behaviour/applications/interfaces/resources/ContextContract.js → library/behaviours/field-validation/domain/interfaces/IFieldViseValidation.js} +0 -0
- /package/es/{platform/app-context-behaviour/applications/interfaces/resources/IAppResource.js → library/behaviours/field-validation/domain/interfaces/ValidationResult.js} +0 -0
- /package/es/{platform/zform/applications/interfaces/input/ApiFailureInputModel.js → library/behaviours/field-validation/domain/interfaces/ValidationsArray.js} +0 -0
- /package/es/{bc/app-context/EventHandlers.js → library/behaviours/field-validation/domain/interfaces/fields/IBooleanField.js} +0 -0
- /package/es/library/{custom-component/domain/entities/interfaces/IComponentProperties.js → behaviours/field-validation/domain/interfaces/fields/ICurrencyField.js} +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export function TransformState(state) {
|
|
2
|
+
const {
|
|
3
|
+
ePHI,
|
|
4
|
+
tooltip
|
|
5
|
+
} = state.properties;
|
|
6
|
+
let actions = [];
|
|
7
|
+
|
|
8
|
+
if (tooltip) {
|
|
9
|
+
actions.push({
|
|
10
|
+
type: 'InfoIcon',
|
|
11
|
+
eventMappings: [],
|
|
12
|
+
properties: {
|
|
13
|
+
tooltip
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (ePHI) {
|
|
19
|
+
actions.push({
|
|
20
|
+
type: 'EPHITag',
|
|
21
|
+
properties: {},
|
|
22
|
+
eventMappings: []
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return { ...state,
|
|
27
|
+
viewModel: { ...state.properties,
|
|
28
|
+
actions
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export function TransformState(state) {
|
|
2
|
+
const {
|
|
3
|
+
ePHI,
|
|
4
|
+
tooltip
|
|
5
|
+
} = state.properties;
|
|
6
|
+
let actions = [];
|
|
7
|
+
|
|
8
|
+
if (tooltip) {
|
|
9
|
+
actions.push({
|
|
10
|
+
type: 'InfoIcon',
|
|
11
|
+
eventMappings: [],
|
|
12
|
+
properties: {
|
|
13
|
+
tooltip
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (ePHI) {
|
|
19
|
+
actions.push({
|
|
20
|
+
type: 'EPHITag',
|
|
21
|
+
properties: {},
|
|
22
|
+
eventMappings: []
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return { ...state,
|
|
27
|
+
viewModel: { ...state.properties,
|
|
28
|
+
actions
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// import TransFormState from '../../adapters/presenter/TransFormState';
|
|
2
|
+
export function TransformState(state) {
|
|
3
|
+
const {
|
|
4
|
+
tooltip
|
|
5
|
+
} = state.properties;
|
|
6
|
+
let actions = [];
|
|
7
|
+
|
|
8
|
+
if (tooltip) {
|
|
9
|
+
actions.push({
|
|
10
|
+
type: 'InfoIcon',
|
|
11
|
+
eventMappings: [],
|
|
12
|
+
properties: {
|
|
13
|
+
tooltip
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return { ...state,
|
|
19
|
+
properties: { ...state.properties,
|
|
20
|
+
actions
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// import TransFormState from '../../adapters/presenter/TransFormState';
|
|
2
|
+
export function TransformState(state) {
|
|
3
|
+
const {
|
|
4
|
+
tooltip
|
|
5
|
+
} = state.properties;
|
|
6
|
+
let actions = [];
|
|
7
|
+
|
|
8
|
+
if (tooltip) {
|
|
9
|
+
actions.push({
|
|
10
|
+
type: 'InfoIcon',
|
|
11
|
+
eventMappings: [],
|
|
12
|
+
properties: {
|
|
13
|
+
tooltip
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return { ...state,
|
|
19
|
+
properties: { ...state.properties,
|
|
20
|
+
actions
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// import TransFormState from '../../adapters/presenter/TransFormState';
|
|
2
|
+
export function TransformState(state) {
|
|
3
|
+
const {
|
|
4
|
+
ePHI,
|
|
5
|
+
tooltip
|
|
6
|
+
} = state.properties;
|
|
7
|
+
let actions = [];
|
|
8
|
+
|
|
9
|
+
if (tooltip) {
|
|
10
|
+
actions.push({
|
|
11
|
+
type: 'InfoIcon',
|
|
12
|
+
eventMappings: [],
|
|
13
|
+
properties: {
|
|
14
|
+
tooltip
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (ePHI) {
|
|
20
|
+
actions.push({
|
|
21
|
+
type: 'EPHITag',
|
|
22
|
+
properties: {},
|
|
23
|
+
eventMappings: []
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return { ...state,
|
|
28
|
+
properties: { ...state.properties,
|
|
29
|
+
actions
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export function TransformState(state) {
|
|
2
|
+
const {
|
|
3
|
+
ePHI,
|
|
4
|
+
tooltip
|
|
5
|
+
} = state.properties;
|
|
6
|
+
let actions = [];
|
|
7
|
+
|
|
8
|
+
if (tooltip) {
|
|
9
|
+
actions.push({
|
|
10
|
+
type: 'InfoIcon',
|
|
11
|
+
eventMappings: [],
|
|
12
|
+
properties: {
|
|
13
|
+
tooltip
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (ePHI) {
|
|
19
|
+
actions.push({
|
|
20
|
+
type: 'EPHITag',
|
|
21
|
+
properties: {},
|
|
22
|
+
eventMappings: []
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return { ...state,
|
|
27
|
+
viewModel: { ...state.properties,
|
|
28
|
+
actions
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* eslint-disable @zohodesk/architecturerules/return-void */
|
|
2
|
+
export default function TransFormState(state) {
|
|
3
|
+
const {
|
|
4
|
+
fields
|
|
5
|
+
} = state.properties;
|
|
6
|
+
|
|
7
|
+
if (Array.isArray(fields) === false) {
|
|
8
|
+
return state;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const slotContract = fields.filter(field => field.isVisible).map(field => {
|
|
12
|
+
const {
|
|
13
|
+
type,
|
|
14
|
+
...properties
|
|
15
|
+
} = field;
|
|
16
|
+
return {
|
|
17
|
+
type,
|
|
18
|
+
properties
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
return { ...state,
|
|
22
|
+
properties: { ...state.properties,
|
|
23
|
+
fields: slotContract
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/sub-components/ui/LabelAction.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createCustomComponent } from "../../../../../../../custom-component";
|
|
2
|
+
import ActionLocationProperties from "../../../../../../../../cc/action-location/Properties";
|
|
3
|
+
import LabelActionView from "./LabelActionView";
|
|
4
|
+
export default createCustomComponent({
|
|
5
|
+
name: 'LabelAction',
|
|
6
|
+
properties: ActionLocationProperties,
|
|
7
|
+
eventHandlers: {},
|
|
8
|
+
View: LabelActionView
|
|
9
|
+
});
|
package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/sub-components/ui/LabelActionView.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Flex from '@zohodesk/layout/es/Flex/Flex';
|
|
3
|
+
import ComponentRegistry from "../../../../../../../custom-component/frameworks/ui/ComponentRegistry";
|
|
4
|
+
import ActionComponentMapping from "../../../../../../components/action-location/frameworks/ui/ActionComponentMapping"; // @ts-ignore
|
|
5
|
+
|
|
6
|
+
import style from "./css/LabelAction.module.css";
|
|
7
|
+
|
|
8
|
+
function LabelActionView(_ref, ref) {
|
|
9
|
+
let {
|
|
10
|
+
state
|
|
11
|
+
} = _ref;
|
|
12
|
+
const {
|
|
13
|
+
actions
|
|
14
|
+
} = state.properties;
|
|
15
|
+
return /*#__PURE__*/React.createElement(Flex, {
|
|
16
|
+
ref: ref,
|
|
17
|
+
$ui_displayMode: "inline",
|
|
18
|
+
$ui_alignItems: "center",
|
|
19
|
+
$ui_className: style.container
|
|
20
|
+
}, actions.map((action, index) => {
|
|
21
|
+
const {
|
|
22
|
+
type,
|
|
23
|
+
properties,
|
|
24
|
+
eventMappings
|
|
25
|
+
} = action;
|
|
26
|
+
const ActionUiType = ActionComponentMapping[type] || ComponentRegistry.get(type);
|
|
27
|
+
return /*#__PURE__*/React.createElement(ActionUiType, {
|
|
28
|
+
key: index,
|
|
29
|
+
...properties,
|
|
30
|
+
appendToActionPayload: {
|
|
31
|
+
eventMappings
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
;
|
|
38
|
+
export default LabelActionView;
|
|
@@ -21,6 +21,7 @@ import SetFieldErrorMessageUseCase from "../../../../zform/applications/usecases
|
|
|
21
21
|
import FocusFieldUseCase from "../../../../zform/applications/usecases/FocusFieldUseCase";
|
|
22
22
|
import InsertValidationRuleUseCase from "../../../../zform/applications/usecases/InsertValidationRuleSuccessUseCase";
|
|
23
23
|
import GetFieldErrorMessageUseCase from "../../../../zform/applications/usecases/GetFieldErrorMessageUseCase";
|
|
24
|
+
import GetIsFieldValueChangedUseCase from "../../../../zform/applications/usecases/GetIsFieldValueChanged";
|
|
24
25
|
export class SmartFormResources extends AbstractResource {
|
|
25
26
|
initialize() {}
|
|
26
27
|
|
|
@@ -287,4 +288,21 @@ export class SmartFormResources extends AbstractResource {
|
|
|
287
288
|
});
|
|
288
289
|
}
|
|
289
290
|
|
|
291
|
+
getIsFieldValueChanged() {
|
|
292
|
+
const {
|
|
293
|
+
getData,
|
|
294
|
+
setData
|
|
295
|
+
} = this.createCallback();
|
|
296
|
+
const {
|
|
297
|
+
dispatch
|
|
298
|
+
} = this.dependencies;
|
|
299
|
+
const dependencies = this.getFormDependencies();
|
|
300
|
+
const usecase = this.createUseCase(dependencies, GetIsFieldValueChangedUseCase);
|
|
301
|
+
usecase.execute({
|
|
302
|
+
callback: setData,
|
|
303
|
+
dispatch
|
|
304
|
+
});
|
|
305
|
+
return getData();
|
|
306
|
+
}
|
|
307
|
+
|
|
290
308
|
}
|
|
@@ -14,7 +14,8 @@ export default class FormSdkFactory {
|
|
|
14
14
|
deleteField: fieldName => smartForm.deleteField(fieldName),
|
|
15
15
|
updateField: (fieldName, fieldProperties) => smartForm.updateField(fieldName, fieldProperties),
|
|
16
16
|
getFieldValue: fieldName => smartForm.getFieldValue(fieldName),
|
|
17
|
-
submit: () => smartForm.submit()
|
|
17
|
+
submit: () => smartForm.submit(),
|
|
18
|
+
getIsFieldValueChanged: () => smartForm.getIsFieldValueChanged()
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
21
|
|
|
@@ -36,7 +37,8 @@ export default class FormSdkFactory {
|
|
|
36
37
|
deleteField: formSdks.deleteField,
|
|
37
38
|
updateField: formSdks.updateField,
|
|
38
39
|
getFieldValue: formSdks.getFieldValue,
|
|
39
|
-
submit: formSdks.submit
|
|
40
|
+
submit: formSdks.submit,
|
|
41
|
+
getIsFieldValueChanged: formSdks.getIsFieldValueChanged
|
|
40
42
|
}
|
|
41
43
|
};
|
|
42
44
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import AbstractController from "./AbstractController";
|
|
2
|
+
|
|
3
|
+
class ValidateErrorMessageController extends AbstractController {
|
|
4
|
+
handle(event) {
|
|
5
|
+
const {
|
|
6
|
+
validateErrorMessageUseCase
|
|
7
|
+
} = this.service;
|
|
8
|
+
let {
|
|
9
|
+
state,
|
|
10
|
+
action,
|
|
11
|
+
updateState,
|
|
12
|
+
dispatch
|
|
13
|
+
} = event;
|
|
14
|
+
validateErrorMessageUseCase.updateDependency(state, updateState);
|
|
15
|
+
validateErrorMessageUseCase.execute({
|
|
16
|
+
dispatch
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default ValidateErrorMessageController;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
|
|
3
|
+
class GetIsFieldValueChangedUseCase extends AbstractUseCase {
|
|
4
|
+
execute(input) {
|
|
5
|
+
const {
|
|
6
|
+
callback,
|
|
7
|
+
dispatch
|
|
8
|
+
} = input;
|
|
9
|
+
const {
|
|
10
|
+
repository,
|
|
11
|
+
presenter
|
|
12
|
+
} = this.dependencies;
|
|
13
|
+
const zformEntitiy = repository.getFormEntity();
|
|
14
|
+
let allFields = zformEntitiy.getAllFields();
|
|
15
|
+
const isFieldValueChanged = allFields.some(field => {
|
|
16
|
+
const value = field.getValue();
|
|
17
|
+
const defaultValue = field.getDefaultValue();
|
|
18
|
+
const isEmpty = value === null || value === '';
|
|
19
|
+
|
|
20
|
+
if (field.getType() === "Boolean") {
|
|
21
|
+
return value !== defaultValue; // simple compare
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const cond1 = defaultValue && value !== defaultValue;
|
|
25
|
+
const cond2 = !defaultValue && !isEmpty;
|
|
26
|
+
return cond1 || cond2;
|
|
27
|
+
});
|
|
28
|
+
let zform = zformEntitiy.toObject();
|
|
29
|
+
presenter.updateFormResponse(zform);
|
|
30
|
+
callback?.(isFieldValueChanged);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default GetIsFieldValueChangedUseCase;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
import { ZFORM_ERROR, ZFORM_SUBMIT_SUCCESS } from "../../../../bc/zform/Symbol";
|
|
3
|
+
|
|
4
|
+
class ValidateErrorMessageUseCase extends AbstractUseCase {
|
|
5
|
+
execute(input) {
|
|
6
|
+
const {
|
|
7
|
+
dispatch
|
|
8
|
+
} = input;
|
|
9
|
+
const zformEntitiy = this.dependencies.repository.getFormEntity();
|
|
10
|
+
|
|
11
|
+
if (zformEntitiy.hasError()) {
|
|
12
|
+
let errorMessages = zformEntitiy.getVisibleFieldsErrorMessages();
|
|
13
|
+
dispatch({
|
|
14
|
+
type: ZFORM_ERROR,
|
|
15
|
+
payload: {
|
|
16
|
+
message: "Form has error",
|
|
17
|
+
errorMessages: errorMessages
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
let visibleFieldsData = zformEntitiy.getVisibleFieldsData();
|
|
22
|
+
dispatch({
|
|
23
|
+
type: ZFORM_SUBMIT_SUCCESS,
|
|
24
|
+
payload: {
|
|
25
|
+
formData: visibleFieldsData
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default ValidateErrorMessageUseCase;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
import { VALIDATE_FIELD } from "../../../../bc/field-validation/Constants";
|
|
3
|
+
import { ZFORM_VALIDATION_ERROR } from "../../../../bc/zform/Symbol";
|
|
4
|
+
|
|
5
|
+
class ValidateFieldRequestUseCase extends AbstractUseCase {
|
|
6
|
+
execute(input) {
|
|
7
|
+
let {
|
|
8
|
+
fieldName,
|
|
9
|
+
dispatch
|
|
10
|
+
} = input;
|
|
11
|
+
let zformEntitiy = this.dependencies.repository.getFormEntity();
|
|
12
|
+
let fieldEntity = zformEntitiy.getFieldByApiName(fieldName);
|
|
13
|
+
|
|
14
|
+
if (fieldEntity) {
|
|
15
|
+
let field = fieldEntity.toObject();
|
|
16
|
+
dispatch({
|
|
17
|
+
type: VALIDATE_FIELD,
|
|
18
|
+
payload: {
|
|
19
|
+
field: { ...field,
|
|
20
|
+
required: field.isMandatory
|
|
21
|
+
},
|
|
22
|
+
value: field.value
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
zformEntitiy.executeValidateRuleOnField(fieldName, _ref => {
|
|
26
|
+
let {
|
|
27
|
+
validationRules,
|
|
28
|
+
formData
|
|
29
|
+
} = _ref;
|
|
30
|
+
const zform = zformEntitiy.toObject();
|
|
31
|
+
return this.dependencies.validator.validateAsync({
|
|
32
|
+
validationRules,
|
|
33
|
+
formData,
|
|
34
|
+
myForm: zform
|
|
35
|
+
}).then(res => {
|
|
36
|
+
if (res) {
|
|
37
|
+
dispatch({
|
|
38
|
+
type: ZFORM_VALIDATION_ERROR,
|
|
39
|
+
payload: res
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return true; //hack ts error
|
|
44
|
+
});
|
|
45
|
+
}).finally(() => {
|
|
46
|
+
dispatch({
|
|
47
|
+
type: "ZFORM#VALIDATE_SUBMIT_FIELD_HAS_ERROR_MESSAGE",
|
|
48
|
+
payload: zformEntitiy.toObject()
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default ValidateFieldRequestUseCase;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default [];
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
context: {
|
|
3
|
-
required: false,
|
|
4
|
-
typeMetadata: {
|
|
5
|
-
schema: {
|
|
6
|
-
type: 'object',
|
|
7
|
-
properties: {
|
|
8
|
-
orgId: {
|
|
9
|
-
type: 'string'
|
|
10
|
-
},
|
|
11
|
-
// zlist
|
|
12
|
-
orgName: {
|
|
13
|
-
type: 'string'
|
|
14
|
-
},
|
|
15
|
-
// zlist, zform
|
|
16
|
-
servicePrefix: {
|
|
17
|
-
type: 'string'
|
|
18
|
-
},
|
|
19
|
-
// zlist, zform
|
|
20
|
-
modules: {
|
|
21
|
-
// zlist
|
|
22
|
-
type: 'array',
|
|
23
|
-
items: {
|
|
24
|
-
type: 'object',
|
|
25
|
-
properties: {
|
|
26
|
-
apiKey: {
|
|
27
|
-
type: 'string'
|
|
28
|
-
},
|
|
29
|
-
hasRecycleBin: {
|
|
30
|
-
type: 'boolean'
|
|
31
|
-
},
|
|
32
|
-
nameField: {
|
|
33
|
-
type: 'string'
|
|
34
|
-
}
|
|
35
|
-
} // required: ['apiKey', 'nameField']
|
|
36
|
-
// NOTE: making required should handled inside AppContextBehaviourFactory in future if needed
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
departmentName: {
|
|
41
|
-
type: 'string'
|
|
42
|
-
},
|
|
43
|
-
// zlist
|
|
44
|
-
routing: {
|
|
45
|
-
type: 'object'
|
|
46
|
-
},
|
|
47
|
-
// zlist
|
|
48
|
-
additionalData: {
|
|
49
|
-
type: 'object'
|
|
50
|
-
} // zform
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
// required: ['orgName'],
|
|
54
|
-
additionalProperties: false
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export let ErrorCodes = /*#__PURE__*/function (ErrorCodes) {
|
|
2
|
-
ErrorCodes["PROPERTY_VALIDATION_FAILED"] = "PROPERTY_VALIDATION_FAILED";
|
|
3
|
-
ErrorCodes["API_FAILED"] = "API_FAILED";
|
|
4
|
-
ErrorCodes["EVENT_HANDLER_FAILED"] = "EVENT_HANDLER_FAILED";
|
|
5
|
-
ErrorCodes["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
|
|
6
|
-
return ErrorCodes;
|
|
7
|
-
}({});
|
|
8
|
-
export const ACA_ERROR_OCCURRED = 'ACA#ERROR_OCCURRED';
|
|
9
|
-
export const ERROR_OCCURRED_SUFFIX = '#ERROR_OCCURRED';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
var ErrorTypes = /*#__PURE__*/function (ErrorTypes) {
|
|
2
|
-
ErrorTypes["Inconvenience"] = "Inconvenience";
|
|
3
|
-
ErrorTypes["OopsSomethingMiss"] = "OopsSomethingMiss";
|
|
4
|
-
ErrorTypes["UnableToProcess"] = "UnableToProcess";
|
|
5
|
-
ErrorTypes["PermissionDenied"] = "PermissionDenied";
|
|
6
|
-
ErrorTypes["UrlNotFound"] = "UrlNotFound";
|
|
7
|
-
ErrorTypes["WillBeRightBack"] = "WillBeRightBack";
|
|
8
|
-
return ErrorTypes;
|
|
9
|
-
}(ErrorTypes || {});
|
|
10
|
-
|
|
11
|
-
export default ErrorTypes;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import ErrorTypes from "./ErrorTypes";
|
|
2
|
-
export default {
|
|
3
|
-
type: {
|
|
4
|
-
defaultValue: ErrorTypes.OopsSomethingMiss,
|
|
5
|
-
required: false,
|
|
6
|
-
typeMetadata: {
|
|
7
|
-
schema: {
|
|
8
|
-
type: 'string',
|
|
9
|
-
enum: Object.values(ErrorTypes)
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
title: {
|
|
14
|
-
defaultValue: '',
|
|
15
|
-
required: false,
|
|
16
|
-
typeMetadata: {
|
|
17
|
-
schema: {
|
|
18
|
-
type: 'string'
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
description: {
|
|
23
|
-
defaultValue: '',
|
|
24
|
-
required: false,
|
|
25
|
-
typeMetadata: {
|
|
26
|
-
schema: {
|
|
27
|
-
type: 'string'
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|