@zohodesk/library-platform 1.1.8-exp.1 → 1.1.8-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/zform/Symbol.js +1 -0
- package/es/cc/fields/field/FormDefaultUIType.js +1 -1
- package/es/cc/fields/text/Properties.js +9 -0
- package/es/cc/textarea/Properties.js +11 -0
- package/es/index.js +2 -1
- package/es/library/dot/components/form/frameworks/ui/DefaultComponentRegister.js +2 -1
- package/es/library/dot/components/form/frameworks/ui/css/Form.module.css +0 -3
- package/es/library/dot/components/form-fields/checkbox/frameworks/ui/CheckboxView.js +1 -3
- package/es/library/dot/components/form-fields/index.js +2 -1
- package/es/library/dot/components/form-fields/lookup/frameworks/ui/EventHandlerFactory.js +70 -0
- package/es/library/dot/components/form-fields/lookup/frameworks/ui/Lookup.js +13 -0
- package/es/library/dot/components/form-fields/lookup/frameworks/ui/LookupView.js +51 -0
- package/es/library/dot/components/form-fields/textarea/frameworks/ui/TextAreaView.js +4 -2
- package/es/library/dot/legacy-to-new-arch/date/frameworks/ui/DateView.js +8 -3
- package/es/library/dot/legacy-to-new-arch/date/frameworks/ui/css/DateView.module.css +3 -0
- package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/LabelView.js +5 -7
- package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/css/Label.module.css +3 -5
- package/es/library/dot/legacy-to-new-arch/multi-select/frameworks/ui/MultiSelectView.js +13 -3
- package/es/library/dot/legacy-to-new-arch/multi-select/frameworks/ui/css/MultiSelectView.module.css +37 -0
- package/es/library/dot/legacy-to-new-arch/text-area/frameworks/ui/TextAreaView.js +22 -4
- package/es/library/dot/legacy-to-new-arch/text-area/frameworks/ui/css/TextAreaView.module.css +40 -0
- package/es/platform/client-actions/behaviour/zclient-actions/frameworks/sdk/ClientActionsSDKFactory.js +2 -2
- package/es/platform/client-actions/components/interfaces/ActionViewModel.js +1 -0
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActionsRenderer.module.css +5 -1
- package/es/platform/components/app/adapters/resources/AppResource.js +13 -0
- package/es/platform/components/form-connected/frameworks/EventHandlersFactory.js +2 -2
- package/es/platform/components/form-connected/frameworks/FormSdkFactory.js +2 -2
- package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +2 -2
- package/es/platform/components/table-connected/frameworks/ListSdkFactory.js +2 -2
- package/es/platform/data-source/http-template/fetchLookupFields.js +24 -0
- package/es/platform/data-source/index.js +3 -1
- package/es/platform/data-source/utils/validation-rules/TransFormValidationRules.js +6 -1
- package/es/platform/sdk/adapters/gateways/Service.js +4 -0
- package/es/platform/sdk/application/usecases/GetResourcesUseCase.js +12 -0
- package/es/platform/sdk/domain/entities/ResourceManager.js +21 -11
- package/es/platform/sdk/frameworks/Sdk.js +13 -2
- package/es/platform/sdk/frameworks/SdkRegistry.js +9 -0
- package/es/platform/zform/adapters/controllers/LookupFieldController.js +23 -0
- package/es/platform/zform/adapters/gateway/Service.js +4 -0
- package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +1 -1
- package/es/platform/zform/adapters/presenter/translators/fields/LookUpFieldTranslator.js +2 -1
- package/es/platform/zform/adapters/presenter/utils/DefaultClientActions.js +66 -65
- package/es/platform/zform/applications/interfaces/input/LookUpFieldSuccessUseCaseInputModel.js +1 -0
- package/es/platform/zform/applications/usecases/LookupFieldSuccessUseCase.js +40 -0
- package/es/platform/zform/applications/usecases/MyFormSuccessUseCase.js +35 -1
- package/es/platform/zform/domain/ZField.js +14 -8
- package/es/platform/zform/frameworks/ui/EventHandlerFactory.js +6 -3
- package/package.json +1 -2
- package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/sub-components/ui/LabelAction.js +0 -9
- package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/sub-components/ui/LabelActionView.js +0 -38
- package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/sub-components/ui/css/LabelAction.module.css +0 -4
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const fetchLookupFields = {
|
|
2
|
+
name: 'fetchLookupFields',
|
|
3
|
+
api: '/{{servicePrefix}}/{{orgName}}/api/v1/layouts/{{layoutId}}/lookupFields',
|
|
4
|
+
parameters: `{}`,
|
|
5
|
+
type: 'GET',
|
|
6
|
+
transformer: data => data,
|
|
7
|
+
getResponse: async _ref => {
|
|
8
|
+
let {
|
|
9
|
+
params,
|
|
10
|
+
payload
|
|
11
|
+
} = _ref;
|
|
12
|
+
},
|
|
13
|
+
properties: {
|
|
14
|
+
layoutId: {
|
|
15
|
+
required: true,
|
|
16
|
+
typeMetadata: {
|
|
17
|
+
schema: {
|
|
18
|
+
type: 'string'
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
export default fetchLookupFields;
|
|
@@ -16,6 +16,7 @@ import fetchDependencyMappings from "./http-template/fetchDependencyMappings";
|
|
|
16
16
|
import fetchValidationRules from "./http-template/fetchValidationRules";
|
|
17
17
|
import createRecord from "./http-template/createRecord";
|
|
18
18
|
import updateSelectedFields from "./http-template/updateSelectedFields";
|
|
19
|
+
import fetchLookupFields from "./http-template/fetchLookupFields";
|
|
19
20
|
let dataSource = {
|
|
20
21
|
httpTemplates: {
|
|
21
22
|
[RecordApiActionName.GET_RECORDS]: getRecords,
|
|
@@ -33,7 +34,8 @@ let dataSource = {
|
|
|
33
34
|
fetchMyForm,
|
|
34
35
|
fetchLayoutRules,
|
|
35
36
|
fetchDependencyMappings,
|
|
36
|
-
fetchValidationRules
|
|
37
|
+
fetchValidationRules,
|
|
38
|
+
fetchLookupFields
|
|
37
39
|
}
|
|
38
40
|
};
|
|
39
41
|
export default dataSource; // let ticketsRecordSerice = createRecord(tickets, () => {});
|
|
@@ -23,7 +23,8 @@ const map = {
|
|
|
23
23
|
Date: DateFieldConditions,
|
|
24
24
|
DateTime: DateTimeFieldConditions,
|
|
25
25
|
Picklist: PicklistFieldConditions,
|
|
26
|
-
Multiselect: MultiSelectFieldConditions
|
|
26
|
+
Multiselect: MultiSelectFieldConditions,
|
|
27
|
+
LookUp: LookupFieldConditions
|
|
27
28
|
};
|
|
28
29
|
export function getBasicValidationRulesForField(field) {
|
|
29
30
|
const {
|
|
@@ -40,6 +41,10 @@ export function getBasicValidationRulesForField(field) {
|
|
|
40
41
|
};
|
|
41
42
|
}
|
|
42
43
|
|
|
44
|
+
function LookupFieldConditions(field) {
|
|
45
|
+
return [MandatoryCondition(field)];
|
|
46
|
+
}
|
|
47
|
+
|
|
43
48
|
function TextFieldConditions(field) {
|
|
44
49
|
return [MandatoryCondition(field), MaxLengthCondition(field)];
|
|
45
50
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
|
|
3
|
+
import { GetResourcesUseCase } from "../../application/usecases/GetResourcesUseCase";
|
|
3
4
|
import { CreateResourceInstanceUseCase } from "../../application/usecases/CreateResourceInstanceUseCase";
|
|
4
5
|
import { DestructResourceInstanceUseCase } from "../../application/usecases/DestructResourceInstanceUseCase";
|
|
5
6
|
import { GetResourceInstanceUseCase } from "../../application/usecases/GetResourceInstanceUseCase";
|
|
@@ -7,6 +8,8 @@ import { RegisterResourceUseCase } from "../../application/usecases/RegisterReso
|
|
|
7
8
|
import { SyncStateWithResourceUseCase } from "../../application/usecases/SyncStateWithResourceUseCase";
|
|
8
9
|
export class Service {
|
|
9
10
|
constructor(dependencies) {
|
|
11
|
+
_defineProperty(this, "getResourcesUseCase", void 0);
|
|
12
|
+
|
|
10
13
|
_defineProperty(this, "createResourceInstanceUseCase", void 0);
|
|
11
14
|
|
|
12
15
|
_defineProperty(this, "destructResourceInstanceUseCase", void 0);
|
|
@@ -17,6 +20,7 @@ export class Service {
|
|
|
17
20
|
|
|
18
21
|
_defineProperty(this, "getResourceInstanceUseCase", void 0);
|
|
19
22
|
|
|
23
|
+
this.getResourcesUseCase = new GetResourcesUseCase(dependencies);
|
|
20
24
|
this.createResourceInstanceUseCase = new CreateResourceInstanceUseCase(dependencies);
|
|
21
25
|
this.destructResourceInstanceUseCase = new DestructResourceInstanceUseCase(dependencies);
|
|
22
26
|
this.syncStateWithResourceUseCase = new SyncStateWithResourceUseCase(dependencies);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AbstractUseCase } from "./AbstractUseCase";
|
|
2
|
+
export class GetResourcesUseCase extends AbstractUseCase {
|
|
3
|
+
execute() {
|
|
4
|
+
const {
|
|
5
|
+
repository,
|
|
6
|
+
presenter
|
|
7
|
+
} = this.dependencies;
|
|
8
|
+
const resourceManager = repository.getResourceManager();
|
|
9
|
+
presenter.presentData(resourceManager.getResources());
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const DEFAULT_INSTANCE_NAME = '__default__';
|
|
1
2
|
export class ResourceManager {
|
|
2
3
|
constructor() {
|
|
3
4
|
let resources = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -15,6 +16,14 @@ export class ResourceManager {
|
|
|
15
16
|
return ((_resourceInstances$re = resourceInstances[resourceName]) === null || _resourceInstances$re === void 0 ? void 0 : _resourceInstances$re[instanceName]) || null;
|
|
16
17
|
}
|
|
17
18
|
|
|
19
|
+
getResources() {
|
|
20
|
+
return Object.fromEntries(Object.entries(this.resourceInstances).map(_ref => {
|
|
21
|
+
let [resourceName, instance] = _ref;
|
|
22
|
+
const instanceName = Object.keys(instance)[0];
|
|
23
|
+
return [resourceName, instanceName === DEFAULT_INSTANCE_NAME ? this.getResourceInstance(resourceName, '__default__') : instanceName => this.getResourceInstance(resourceName, instanceName)];
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
|
|
18
27
|
createResourceInstance(resourceName, instanceName) {
|
|
19
28
|
const {
|
|
20
29
|
resourceInstances,
|
|
@@ -22,18 +31,19 @@ export class ResourceManager {
|
|
|
22
31
|
} = this;
|
|
23
32
|
const ResourceClass = resources[resourceName];
|
|
24
33
|
|
|
25
|
-
if (ResourceClass) {
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
if (!ResourceClass) {
|
|
35
|
+
console.warn(`Resource class not found for: ${resourceName}`);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
28
38
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
39
|
+
const instance = new ResourceClass();
|
|
40
|
+
instance.initialize();
|
|
32
41
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
console.warn(`Resource class not found for: ${resourceName}`);
|
|
42
|
+
if (!resourceInstances[resourceName]) {
|
|
43
|
+
resourceInstances[resourceName] = {};
|
|
36
44
|
}
|
|
45
|
+
|
|
46
|
+
resourceInstances[resourceName][instanceName || DEFAULT_INSTANCE_NAME] = instance;
|
|
37
47
|
}
|
|
38
48
|
|
|
39
49
|
destructResourceInstance(resourceName, instanceName) {
|
|
@@ -64,7 +74,7 @@ export class ResourceManager {
|
|
|
64
74
|
resources[resourceName] = resource;
|
|
65
75
|
}
|
|
66
76
|
|
|
67
|
-
syncStateWithResource(
|
|
77
|
+
syncStateWithResource(_ref2) {
|
|
68
78
|
var _resourceInstances$re3;
|
|
69
79
|
|
|
70
80
|
let {
|
|
@@ -73,7 +83,7 @@ export class ResourceManager {
|
|
|
73
83
|
state,
|
|
74
84
|
dispatch,
|
|
75
85
|
updateState
|
|
76
|
-
} =
|
|
86
|
+
} = _ref2;
|
|
77
87
|
const {
|
|
78
88
|
resourceInstances
|
|
79
89
|
} = this;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import ResourceNamesEnum from "../../../bc/sdk/ResourceNamesEnum";
|
|
2
2
|
import { sdkRegistry } from "./SdkRegistry";
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated
|
|
6
|
+
*/
|
|
7
|
+
export const platformSDK_old = {
|
|
4
8
|
[ResourceNamesEnum.SMART_TABLE](instanceName) {
|
|
5
9
|
return sdkRegistry.getResourceInstance({
|
|
6
10
|
resourceName: ResourceNamesEnum.SMART_TABLE,
|
|
@@ -8,6 +12,7 @@ export const platformSDK = {
|
|
|
8
12
|
});
|
|
9
13
|
},
|
|
10
14
|
|
|
15
|
+
// ['app']: sdkRegistry.getResourceInstance({ resourceName: 'app' }),
|
|
11
16
|
[ResourceNamesEnum.SMART_FORM](instanceName) {
|
|
12
17
|
return sdkRegistry.getResourceInstance({
|
|
13
18
|
resourceName: ResourceNamesEnum.SMART_FORM,
|
|
@@ -22,4 +27,10 @@ export const platformSDK = {
|
|
|
22
27
|
});
|
|
23
28
|
}
|
|
24
29
|
|
|
25
|
-
};
|
|
30
|
+
};
|
|
31
|
+
export const platformSDK = new Proxy({}, {
|
|
32
|
+
get(_, prop) {
|
|
33
|
+
return sdkRegistry.getResources()[prop];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
});
|
|
@@ -35,6 +35,15 @@ export class SdkManager {
|
|
|
35
35
|
createResourceInstanceUseCase.execute(input);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
getResources() {
|
|
39
|
+
const {
|
|
40
|
+
getResourcesUseCase
|
|
41
|
+
} = this.service;
|
|
42
|
+
getResourcesUseCase.updateDependencies(this.state, this.setPresentedData);
|
|
43
|
+
getResourcesUseCase.execute(null);
|
|
44
|
+
return this.presentedData;
|
|
45
|
+
}
|
|
46
|
+
|
|
38
47
|
destructResourceInstance(input) {
|
|
39
48
|
const {
|
|
40
49
|
destructResourceInstanceUseCase
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import AbstractController from "./AbstractController";
|
|
2
|
+
|
|
3
|
+
class LookupFieldController extends AbstractController {
|
|
4
|
+
handle(event) {
|
|
5
|
+
let {
|
|
6
|
+
lookupFieldSuccessUseCase
|
|
7
|
+
} = this.service;
|
|
8
|
+
let {
|
|
9
|
+
state,
|
|
10
|
+
updateState,
|
|
11
|
+
action,
|
|
12
|
+
dispatch
|
|
13
|
+
} = event;
|
|
14
|
+
lookupFieldSuccessUseCase.updateDependency(state, updateState);
|
|
15
|
+
lookupFieldSuccessUseCase.execute({
|
|
16
|
+
dispatch,
|
|
17
|
+
fieldMetadataResponse: action.payload.response
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default LookupFieldController;
|
|
@@ -16,6 +16,7 @@ import FieldBlurUseCase from "../../applications/usecases/FieldBlurUseCase";
|
|
|
16
16
|
import SubmitValidationCompletedUseCase from "../../applications/usecases/SubmitValidationCompletedUseCase";
|
|
17
17
|
import ValidationRulesExecutionResultUseCase from "../../applications/usecases/ValidationRulesExecutionResultUseCase";
|
|
18
18
|
import ValidateFieldUseCase from "../../applications/usecases/ValidateFieldUseCase";
|
|
19
|
+
import LookupFieldSuccessUseCase from "../../applications/usecases/LookupFieldSuccessUseCase";
|
|
19
20
|
|
|
20
21
|
class Service {
|
|
21
22
|
constructor(dependencies) {
|
|
@@ -53,6 +54,8 @@ class Service {
|
|
|
53
54
|
|
|
54
55
|
_defineProperty(this, "submitValidationCompletedUseCase", void 0);
|
|
55
56
|
|
|
57
|
+
_defineProperty(this, "lookupFieldSuccessUseCase", void 0);
|
|
58
|
+
|
|
56
59
|
this.formSubmitUseCase = new FormSubmitUseCase(dependencies);
|
|
57
60
|
this.initializeUseCase = new InitializeUseCase(dependencies);
|
|
58
61
|
this.myLayoutSuccessUseCase = new MyLayoutSuccessUseCase(dependencies);
|
|
@@ -69,6 +72,7 @@ class Service {
|
|
|
69
72
|
this.validateFieldUseCase = new ValidateFieldUseCase(dependencies);
|
|
70
73
|
this.validationRulesExecutionResultUseCase = new ValidationRulesExecutionResultUseCase(dependencies);
|
|
71
74
|
this.submitValidationCompletedUseCase = new SubmitValidationCompletedUseCase(dependencies);
|
|
75
|
+
this.lookupFieldSuccessUseCase = new LookupFieldSuccessUseCase(dependencies);
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
}
|
|
@@ -72,7 +72,7 @@ function SectionTranslator(_ref) {
|
|
|
72
72
|
|
|
73
73
|
fieldPreModified['labelActions'] = labelActions; // Final fieldActions to fieldPreModified
|
|
74
74
|
|
|
75
|
-
if (field.type !== "Boolean"
|
|
75
|
+
if (field.type !== "Boolean") {
|
|
76
76
|
fieldPreModified['actions'] = transformedActions.fieldActions;
|
|
77
77
|
} // Placeholder check
|
|
78
78
|
|
|
@@ -18,7 +18,8 @@ const LookUpFieldTranslator = _ref => {
|
|
|
18
18
|
readonly: field.isReadOnly,
|
|
19
19
|
// visibility: field.isVisible,
|
|
20
20
|
isVisible: field.isVisible,
|
|
21
|
-
errorMessage: field.errorMessage || ''
|
|
21
|
+
errorMessage: field.errorMessage || '',
|
|
22
|
+
lookup: field.lookup
|
|
22
23
|
};
|
|
23
24
|
return fieldModified;
|
|
24
25
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { i18NProviderUtils } from '@zohodesk/i18n';
|
|
1
2
|
export default function DefaultFormClientActions(props) {
|
|
2
3
|
const {
|
|
3
4
|
submitConfig,
|
|
@@ -8,14 +9,14 @@ export default function DefaultFormClientActions(props) {
|
|
|
8
9
|
|
|
9
10
|
if (submitConfig !== null && submitConfig !== void 0 && submitConfig.isEnabled) {
|
|
10
11
|
finalClientActions.push(getDefaultFormAction({
|
|
11
|
-
type:
|
|
12
|
+
type: 'submit',
|
|
12
13
|
...submitConfig
|
|
13
14
|
}));
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
if (cancelConfig !== null && cancelConfig !== void 0 && cancelConfig.isEnabled) {
|
|
17
18
|
finalClientActions.push(getDefaultFormAction({
|
|
18
|
-
type:
|
|
19
|
+
type: 'cancel',
|
|
19
20
|
...cancelConfig
|
|
20
21
|
}));
|
|
21
22
|
}
|
|
@@ -31,99 +32,99 @@ function getDefaultFormAction(_ref) {
|
|
|
31
32
|
text,
|
|
32
33
|
isEnabled
|
|
33
34
|
} = _ref;
|
|
34
|
-
const isSubmit = type ===
|
|
35
|
+
const isSubmit = type === 'submit';
|
|
35
36
|
return {
|
|
36
|
-
id: isSubmit ?
|
|
37
|
-
name:
|
|
38
|
-
component:
|
|
39
|
-
location:
|
|
37
|
+
id: isSubmit ? '4000000080010' : '4000000080013',
|
|
38
|
+
name: 'FORM ACTION',
|
|
39
|
+
component: 'form',
|
|
40
|
+
location: 'footer_left_actions',
|
|
40
41
|
uiComponentMapping: {
|
|
41
|
-
id: isSubmit ?
|
|
42
|
-
name: isSubmit ?
|
|
43
|
-
component:
|
|
42
|
+
id: isSubmit ? '4000000080011' : '4000000080014',
|
|
43
|
+
name: isSubmit ? 'Submit Button' : 'Cancel Button',
|
|
44
|
+
component: 'Button',
|
|
44
45
|
propertiesValueMapping: {
|
|
45
|
-
text:
|
|
46
|
-
palette: isSubmit ?
|
|
46
|
+
text: isSubmit ? i18NProviderUtils.getI18NValue('crm.button.submit') : i18NProviderUtils.getI18NValue('support.label.cancel'),
|
|
47
|
+
palette: isSubmit ? 'primaryFilled' : 'secondary'
|
|
47
48
|
},
|
|
48
49
|
eventMappings: [{
|
|
49
|
-
id: isSubmit ?
|
|
50
|
-
sourceEvent:
|
|
51
|
-
targetEvent: isSubmit ?
|
|
50
|
+
id: isSubmit ? '4000000080012' : '4000000080015',
|
|
51
|
+
sourceEvent: 'BUTTON#CLICKED',
|
|
52
|
+
targetEvent: isSubmit ? 'SMART_FORM#SUBMIT_CLICKED' : 'SMART_FORM#CANCEL_CLICKED',
|
|
52
53
|
payloadValueMapping: {}
|
|
53
54
|
}]
|
|
54
55
|
},
|
|
55
|
-
modules: [
|
|
56
|
+
modules: ['static_module'],
|
|
56
57
|
conditions: {
|
|
57
58
|
fields: [],
|
|
58
|
-
pattern:
|
|
59
|
+
pattern: ''
|
|
59
60
|
}
|
|
60
61
|
};
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
function getDefaultFieldInfoAction() {
|
|
64
65
|
return {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
uiComponentMapping: {
|
|
67
|
+
component: 'ActionIcon',
|
|
68
|
+
name: 'Info Icon',
|
|
69
|
+
id: '4000000081003',
|
|
70
|
+
propertiesValueMapping: {
|
|
71
|
+
hoverVariant: 'primary',
|
|
72
|
+
icon: 'ZD-information',
|
|
73
|
+
label: 'Default Info Icon'
|
|
73
74
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
eventMappings: [{
|
|
76
|
+
payloadValueMapping: {},
|
|
77
|
+
id: '4000000081005'
|
|
77
78
|
}]
|
|
78
79
|
},
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
conditions: {
|
|
81
|
+
fields: [{
|
|
82
|
+
fieldName: '{{@context.apiName}}',
|
|
83
|
+
condition: 'in',
|
|
84
|
+
value: ['gadget_name', 'gadget_description', 'cf_total_qa_issues', 'cf_is_pm_reviewed_1', 'cf_related_gadget', 'priority', 'cf_tested_by', 'cf_security_dri', 'cf_git_merge_request_url', 'release_deadline', 'cf_tentative_eta', 'cf_mutation_coverage', 'cf_support_phone', 'cf_test_coverage_score', 'cf_budget_allocation', 'cf_brand_owner', 'cf_brand_launch_date', 'cf_marketing_channel']
|
|
84
85
|
}],
|
|
85
|
-
|
|
86
|
+
pattern: '1'
|
|
86
87
|
},
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
modifiedTime: '2024-11-21T06:11:59.000Z',
|
|
89
|
+
component: 'form',
|
|
90
|
+
name: 'FORM ACTION',
|
|
91
|
+
createdTime: '2024-11-21T06:11:59.000Z',
|
|
92
|
+
location: 'field_label_actions',
|
|
93
|
+
id: '4000000081009',
|
|
94
|
+
modules: ['static_module']
|
|
94
95
|
};
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
function getDefaultFieldEphiAction() {
|
|
98
99
|
return {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
100
|
+
uiComponentMapping: {
|
|
101
|
+
component: 'HighlightedValue',
|
|
102
|
+
name: 'EPHI Tag',
|
|
103
|
+
id: '4000000082003',
|
|
104
|
+
propertiesValueMapping: {
|
|
105
|
+
text: 'ePHI',
|
|
106
|
+
color: 'green',
|
|
107
|
+
tooltip: 'ePHI is individually identifiable protected health information sent or stored electronically.'
|
|
107
108
|
},
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
eventMappings: [{
|
|
110
|
+
payloadValueMapping: {},
|
|
111
|
+
id: '4000000082005'
|
|
111
112
|
}]
|
|
112
113
|
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
conditions: {
|
|
115
|
+
fields: [{
|
|
116
|
+
fieldName: '{{@context.apiName}}',
|
|
117
|
+
condition: 'in',
|
|
118
|
+
value: ['gadget_name', 'cf_total_qa_issues', 'cf_security_dri', 'cf_git_merge_request_url', 'cf_mutation_coverage', 'cf_support_phone', 'cf_test_coverage_score', 'cf_brand_owner']
|
|
118
119
|
}],
|
|
119
|
-
|
|
120
|
+
pattern: '1'
|
|
120
121
|
},
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
122
|
+
modifiedTime: '2024-11-21T06:11:59.000Z',
|
|
123
|
+
component: 'form',
|
|
124
|
+
name: 'FORM ACTION',
|
|
125
|
+
createdTime: '2024-11-21T06:11:59.000Z',
|
|
126
|
+
location: 'field_label_actions',
|
|
127
|
+
id: '4000000082009',
|
|
128
|
+
modules: ['static_module']
|
|
128
129
|
};
|
|
129
130
|
}
|
package/es/platform/zform/applications/interfaces/input/LookUpFieldSuccessUseCaseInputModel.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
4
|
+
|
|
5
|
+
class LookUpFieldSuccessUseCase extends AbstractUseCase {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
|
|
9
|
+
_defineProperty(this, "getSelectedFieldLookup", (currentData, LookupField) => currentData.apiName === LookupField);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
execute(input) {
|
|
13
|
+
const {
|
|
14
|
+
repository,
|
|
15
|
+
presenter,
|
|
16
|
+
layoutRuleApplier
|
|
17
|
+
} = this.dependencies;
|
|
18
|
+
const {
|
|
19
|
+
dispatch,
|
|
20
|
+
fieldMetadataResponse
|
|
21
|
+
} = input;
|
|
22
|
+
const {
|
|
23
|
+
data
|
|
24
|
+
} = fieldMetadataResponse;
|
|
25
|
+
const zFormEntity = this.dependencies.repository.getFormEntity();
|
|
26
|
+
data.forEach(fieldValue => {
|
|
27
|
+
zFormEntity.updateFieldProperties(fieldValue.apiName, fieldValue);
|
|
28
|
+
});
|
|
29
|
+
let zform = zFormEntity.toObject();
|
|
30
|
+
presenter.updateFormResponse(zform);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function hasMatchingApiName(listA, listB) {
|
|
36
|
+
const apiNamesB = new Set(listB.map(item => item.apiName));
|
|
37
|
+
return listA.some(item => apiNamesB.has(item.apiName));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default LookUpFieldSuccessUseCase;
|
|
@@ -3,7 +3,7 @@ import ZSection from "../../domain/ZSection";
|
|
|
3
3
|
import ZField from "../../domain/ZField";
|
|
4
4
|
import { DATA_SOURCE_EXECUTE } from "../../../../bc/zdata-source/Constants";
|
|
5
5
|
import { DATA_SOURCE_SUCCESS, DATA_SOURCE_NO_CONTENT, DATA_SOURCE_FAILURE } from "../../../../bc/zdata-source/Symbols";
|
|
6
|
-
import { ZFORM_VALIDATION_RULES_FAILURE, ZFORM_VALIDATION_RULES_SUCCESS } from "../../../../bc/zform/Symbol";
|
|
6
|
+
import { ZFORM_VALIDATION_RULES_FAILURE, ZFORM_VALIDATION_RULES_SUCCESS, ZFORM_LOOKUP_FIELD_SUCCESS } from "../../../../bc/zform/Symbol";
|
|
7
7
|
|
|
8
8
|
class MyFormSuccessUseCase extends AbstractUseCase {
|
|
9
9
|
execute(input) {
|
|
@@ -24,6 +24,7 @@ class MyFormSuccessUseCase extends AbstractUseCase {
|
|
|
24
24
|
const context = { ...zFormEntity.getContext(),
|
|
25
25
|
layoutId: zFormEntity.getLayoutId()
|
|
26
26
|
};
|
|
27
|
+
const lookupFields = sections.flatMap(section => section.fields.filter(field => field.type === 'LookUp'));
|
|
27
28
|
const sectionEntities = sections.map(section => {
|
|
28
29
|
const fields = section.fields.map(field => {
|
|
29
30
|
const entity = new ZField(field);
|
|
@@ -57,6 +58,39 @@ class MyFormSuccessUseCase extends AbstractUseCase {
|
|
|
57
58
|
});
|
|
58
59
|
});
|
|
59
60
|
|
|
61
|
+
if (lookupFields.length > 0) {
|
|
62
|
+
dispatch({
|
|
63
|
+
type: DATA_SOURCE_EXECUTE,
|
|
64
|
+
payload: {
|
|
65
|
+
actionName: 'fetchLookupFields',
|
|
66
|
+
props: { ...context
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
metaData: {
|
|
70
|
+
actionName: 'fetchLookupFields',
|
|
71
|
+
//hack
|
|
72
|
+
[DATA_SOURCE_NO_CONTENT]: {
|
|
73
|
+
type: ZFORM_LOOKUP_FIELD_SUCCESS,
|
|
74
|
+
metaData: {
|
|
75
|
+
actionName: 'fetchLookupFields'
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
// [DATA_SOURCE_FAILURE]: {
|
|
79
|
+
// type: ZFORM_LOOKUP_FIELD_SUCCESS,
|
|
80
|
+
// metaData: {
|
|
81
|
+
// actionName: 'fetchValidationRules'
|
|
82
|
+
// }
|
|
83
|
+
// },
|
|
84
|
+
[DATA_SOURCE_SUCCESS]: {
|
|
85
|
+
type: ZFORM_LOOKUP_FIELD_SUCCESS,
|
|
86
|
+
metaData: {
|
|
87
|
+
actionName: 'fetchLookupFields'
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
60
94
|
if (!disableValidationRule) {
|
|
61
95
|
presenter.updateFormResponse(zFormEntity.toObject());
|
|
62
96
|
dispatch({
|
|
@@ -25,7 +25,8 @@ export default class ZField {
|
|
|
25
25
|
toolTipType,
|
|
26
26
|
defaultValue,
|
|
27
27
|
isPHI,
|
|
28
|
-
subType
|
|
28
|
+
subType,
|
|
29
|
+
lookup
|
|
29
30
|
} = _ref;
|
|
30
31
|
|
|
31
32
|
_defineProperty(this, "displayLabel", void 0);
|
|
@@ -76,6 +77,8 @@ export default class ZField {
|
|
|
76
77
|
|
|
77
78
|
_defineProperty(this, "isPHI", void 0);
|
|
78
79
|
|
|
80
|
+
_defineProperty(this, "lookup", void 0);
|
|
81
|
+
|
|
79
82
|
this.displayLabel = displayLabel;
|
|
80
83
|
this.apiName = apiName;
|
|
81
84
|
this.isCustomField = isCustomField;
|
|
@@ -99,7 +102,8 @@ export default class ZField {
|
|
|
99
102
|
this.toolTip = toolTip;
|
|
100
103
|
this.toolTipType = toolTipType;
|
|
101
104
|
this.defaultValue = defaultValue;
|
|
102
|
-
this.isPHI = isPHI;
|
|
105
|
+
this.isPHI = isPHI;
|
|
106
|
+
this.lookup = lookup; // if(value===undefined){
|
|
103
107
|
// this.setDefaultValue()
|
|
104
108
|
// }
|
|
105
109
|
}
|
|
@@ -109,8 +113,8 @@ export default class ZField {
|
|
|
109
113
|
return false;
|
|
110
114
|
}
|
|
111
115
|
|
|
112
|
-
if (typeof defaultValue ===
|
|
113
|
-
return defaultValue ===
|
|
116
|
+
if (typeof defaultValue === 'string') {
|
|
117
|
+
return defaultValue === 'true' ? true : false;
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
return defaultValue;
|
|
@@ -121,8 +125,8 @@ export default class ZField {
|
|
|
121
125
|
return [];
|
|
122
126
|
}
|
|
123
127
|
|
|
124
|
-
if (typeof defaultValue ===
|
|
125
|
-
return defaultValue.split(
|
|
128
|
+
if (typeof defaultValue === 'string') {
|
|
129
|
+
return defaultValue.split(';');
|
|
126
130
|
}
|
|
127
131
|
|
|
128
132
|
return defaultValue;
|
|
@@ -157,7 +161,7 @@ export default class ZField {
|
|
|
157
161
|
|
|
158
162
|
setValue(value) {
|
|
159
163
|
if (this.value !== value) {
|
|
160
|
-
this.errorMessage =
|
|
164
|
+
this.errorMessage = ''; // Reset error message when value changes
|
|
161
165
|
}
|
|
162
166
|
|
|
163
167
|
this.value = value;
|
|
@@ -188,6 +192,7 @@ export default class ZField {
|
|
|
188
192
|
this.defaultPickListValues = fieldProperties.defaultPickListValues !== undefined ? fieldProperties.defaultPickListValues : this.defaultPickListValues;
|
|
189
193
|
this.toolTip = fieldProperties.toolTip !== undefined ? fieldProperties.toolTip : this.toolTip;
|
|
190
194
|
this.decimalPlaces = fieldProperties.decimalPlaces !== undefined ? fieldProperties.decimalPlaces : this.decimalPlaces;
|
|
195
|
+
this.lookup = fieldProperties.lookup !== undefined ? fieldProperties.lookup : this.lookup;
|
|
191
196
|
}
|
|
192
197
|
|
|
193
198
|
setErrorMessage(errorMessage) {
|
|
@@ -241,7 +246,8 @@ export default class ZField {
|
|
|
241
246
|
toolTipType: this.toolTipType,
|
|
242
247
|
defaultValue: this.defaultValue,
|
|
243
248
|
isPHI: this.isPHI,
|
|
244
|
-
subType: this.subType
|
|
249
|
+
subType: this.subType,
|
|
250
|
+
lookup: this.lookup
|
|
245
251
|
};
|
|
246
252
|
}
|
|
247
253
|
|