@zohodesk/library-platform 1.1.9-alpha.1 → 1.1.9-exp.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/bc/app-context/Constants.js +0 -0
- package/es/bc/app-context/Event.js +1 -0
- package/es/bc/app-context/EventHandlers.js +0 -0
- package/es/bc/app-context/Properties.js +58 -0
- package/es/bc/zform/Properties.js +6 -0
- package/es/bc/zlist/Properties.js +6 -0
- package/es/cc/component/ErrorStructure.js +9 -0
- package/es/cc/error-state/ErrorTypes.js +11 -0
- package/es/cc/error-state/Properties.js +31 -0
- package/es/cc/error-state/index.js +2 -0
- package/es/cc/fields/currency/Model.js +2 -0
- package/es/cc/fields/text/Properties.js +1 -1
- package/es/cc/form-connected/ExternalConstants.js +11 -0
- package/es/cc/form-connected/index.js +1 -1
- package/es/cc/switch/Properties.js +2 -2
- package/es/cc/table-connected/Events.js +1 -1
- package/es/cc/table-connected/Properties.js +6 -0
- package/es/cc/table-connected/constants/Events.js +1 -8
- package/es/cc/table-connected/constants/ExternalConstants.js +9 -0
- package/es/cc/table-connected/constants/index.js +2 -1
- package/es/index.js +12 -2
- package/es/library/custom-component/domain/entities/ComponentProperties.js +121 -0
- package/es/library/custom-component/domain/entities/Logger.js +63 -0
- package/es/library/custom-component/domain/entities/interfaces/IComponentProperties.js +0 -0
- package/es/library/custom-component/frameworks/json-schema-validator/Validator.js +71 -10
- package/es/library/dot/components/form/frameworks/ui/FormView.js +3 -1
- package/es/library/dot/components/form-fields/currency/frameworks/ui/CurrencyView.js +15 -3
- package/es/library/dot/components/form-fields/currency/frameworks/ui/EventHandlerFactory.js +8 -0
- package/es/library/dot/components/section/frameworks/ui/SectionView.js +1 -0
- package/es/library/dot/components/table-list/adapters/controllers/KeyboardRowClickController.js +1 -1
- package/es/library/dot/components/table-list/frameworks/ui/css/TableList.module.css +1 -0
- package/es/library/dot/legacy-to-new-arch/error-state/frameworks/ui/ErrorState.js +10 -0
- package/es/library/dot/legacy-to-new-arch/error-state/frameworks/ui/ErrorStateView.js +68 -0
- package/es/library/dot/legacy-to-new-arch/switch/frameworks/ui/SwitchView.js +5 -5
- package/es/library/dot/legacy-to-new-arch/table-field-components/currency-field/frameworks/ui/CurrencyFieldView.js +10 -2
- package/es/library/dot/legacy-to-new-arch/table-field-components/switch-field/frameworks/ui/SwitchFieldView.js +0 -1
- package/es/library/translator-common/adapters/presenter/formatCurrency.js +42 -0
- package/es/library/translator-common/index.js +2 -1
- package/es/platform/app-context-behaviour/adapters/controllers/AbstractController.js +7 -0
- package/es/platform/app-context-behaviour/adapters/controllers/InitializeController.js +19 -0
- package/es/platform/app-context-behaviour/adapters/gateways/Service.js +7 -0
- package/es/platform/app-context-behaviour/adapters/presenters/Presenter.js +18 -0
- package/es/platform/app-context-behaviour/adapters/resources/AppResource.js +25 -0
- package/es/platform/app-context-behaviour/applications/AbstractUseCase.js +6 -0
- package/es/platform/app-context-behaviour/applications/interfaces/UsecaseDependencies.js +1 -0
- package/es/platform/app-context-behaviour/applications/interfaces/gateways/IService.js +1 -0
- package/es/platform/app-context-behaviour/applications/interfaces/input/InitializeUseCaseInputModel.js +1 -0
- package/es/platform/app-context-behaviour/applications/interfaces/output/BehaviourState.js +1 -0
- package/es/platform/app-context-behaviour/applications/interfaces/output/IPresenter.js +1 -0
- package/es/platform/app-context-behaviour/applications/interfaces/resources/ApiHeaderContract.js +1 -0
- package/es/platform/app-context-behaviour/applications/interfaces/resources/ContextContract.js +1 -0
- package/es/platform/app-context-behaviour/applications/interfaces/resources/IAppResource.js +1 -0
- package/es/platform/app-context-behaviour/applications/usecases/InitializeUseCase.js +15 -0
- package/es/platform/app-context-behaviour/frameworks/AppContextBehaviourFactory.js +31 -0
- package/es/platform/app-context-behaviour/frameworks/EventHandlerFactory.js +25 -0
- package/es/platform/components/form-connected/frameworks/EventHandlersFactory.js +1 -1
- package/es/platform/components/form-connected/frameworks/FallbackView.js +23 -0
- package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +4 -4
- package/es/platform/data-source/http-template/getDependencyMappings.js +18 -0
- package/es/platform/data-source/http-template/getLayoutRules.js +29 -0
- package/es/platform/data-source/http-template/getMyForm.js +19 -0
- package/es/platform/data-source/http-template/getMyLayout.js +43 -0
- package/es/platform/data-source/http-template/getValidationRules.js +30 -0
- package/es/platform/zform/adapters/controllers/ApiFailureController.js +31 -0
- package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +7 -2
- package/es/platform/zform/adapters/presenter/translators/fields/CurrencyFieldTranslator.js +9 -1
- package/es/platform/zform/adapters/presenter/utils/sanitizeHtmlString.js +11 -0
- package/es/platform/zform/applications/interfaces/input/ApiFailureInputModel.js +1 -0
- package/es/platform/zform/applications/usecases/ApiFailureUseCase.js +30 -0
- package/es/platform/zform/domain/ZForm.js +1 -0
- package/es/platform/zform/frameworks/ui/EventHandlerFactory.js +1 -1
- package/es/platform/zlist/adapters/presenters/TableTranslator.js +1 -1
- package/es/platform/zlist/adapters/presenters/translators/ColumnTranslator.js +3 -3
- package/es/platform/zlist/adapters/presenters/translators/Row.js +3 -2
- package/es/platform/zlist/adapters/presenters/translators/RowsTranslator.js +4 -2
- package/es/platform/zlist/adapters/presenters/translators/fields/CurrencyFieldTranslator.js +7 -2
- package/es/platform/zlist/adapters/presenters/translators/fields/FormulaFieldTranslator.js +7 -2
- package/es/platform/zlist/domain/entities/List.js +2 -2
- package/package.json +19 -15
package/es/library/dot/components/table-list/adapters/controllers/KeyboardRowClickController.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import SmartTableConstants from "../../../../../../cc/table-connected/constants/
|
|
1
|
+
import SmartTableConstants from "../../../../../../cc/table-connected/constants/ExternalConstants";
|
|
2
2
|
import AbstractController from "./AbstractController";
|
|
3
3
|
|
|
4
4
|
class KeyboardRowClickController extends AbstractController {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createCustomComponent } from "../../../../../custom-component";
|
|
2
|
+
import ErrorStateProperties from "../../../../../../cc/error-state/Properties";
|
|
3
|
+
import ErrorStateView from "./ErrorStateView";
|
|
4
|
+
let ErrorState = createCustomComponent({
|
|
5
|
+
name: "ErrorState",
|
|
6
|
+
View: ErrorStateView,
|
|
7
|
+
properties: ErrorStateProperties,
|
|
8
|
+
eventHandlers: {}
|
|
9
|
+
});
|
|
10
|
+
export default ErrorState;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ErrorTypes from "../../../../../../cc/error-state/ErrorTypes";
|
|
3
|
+
import { i18NProviderUtils } from '@zohodesk/i18n';
|
|
4
|
+
import Inconvenience from '@zohodesk/dot/lib/version2/errorstate/Inconvenience/Inconvenience';
|
|
5
|
+
import OopsSomethingMiss from '@zohodesk/dot/lib/version2/errorstate/OopsSomethingMiss/OopsSomethingMiss';
|
|
6
|
+
import UnableToProcess from '@zohodesk/dot/lib/version2/errorstate/UnableToProcessRequest/UnableToProcessRequest';
|
|
7
|
+
import PermissionDenied from '@zohodesk/dot/lib/version2/errorstate/UnauthorizedLogin/UnauthorizedLogin';
|
|
8
|
+
import UrlNotFound from '@zohodesk/dot/lib/version2/errorstate/UrlNotFound/UrlNotFound';
|
|
9
|
+
import WillBeRightBack from '@zohodesk/dot/lib/version2/errorstate/WillBeRightBack/WillBeRightBack';
|
|
10
|
+
const errorStateComponents = {
|
|
11
|
+
[ErrorTypes.Inconvenience]: Inconvenience,
|
|
12
|
+
[ErrorTypes.OopsSomethingMiss]: OopsSomethingMiss,
|
|
13
|
+
[ErrorTypes.UnableToProcess]: UnableToProcess,
|
|
14
|
+
[ErrorTypes.PermissionDenied]: PermissionDenied,
|
|
15
|
+
[ErrorTypes.UrlNotFound]: UrlNotFound,
|
|
16
|
+
[ErrorTypes.WillBeRightBack]: WillBeRightBack
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const getErrorStateContent = type => {
|
|
20
|
+
const errorStateContent = {
|
|
21
|
+
[ErrorTypes.Inconvenience]: {
|
|
22
|
+
title: i18NProviderUtils.getI18NValue('support.error.inconvenience.v2.title'),
|
|
23
|
+
description: i18NProviderUtils.getI18NValue('support.error.inconvenience.v2.message')
|
|
24
|
+
},
|
|
25
|
+
[ErrorTypes.OopsSomethingMiss]: {
|
|
26
|
+
title: i18NProviderUtils.getI18NValue('support.error.oops.something.miss'),
|
|
27
|
+
description: i18NProviderUtils.getI18NValue('support.error.oops.something.miss.desc')
|
|
28
|
+
},
|
|
29
|
+
[ErrorTypes.UnableToProcess]: {
|
|
30
|
+
title: i18NProviderUtils.getI18NValue('support.something.went.wrong'),
|
|
31
|
+
description: i18NProviderUtils.getI18NValue('support.unable.to.process.your.request.desc')
|
|
32
|
+
},
|
|
33
|
+
[ErrorTypes.PermissionDenied]: {
|
|
34
|
+
title: i18NProviderUtils.getI18NValue('support.error.lable.insufficient'),
|
|
35
|
+
description: i18NProviderUtils.getI18NValue('support.error.lable.insufficient.message')
|
|
36
|
+
},
|
|
37
|
+
[ErrorTypes.UrlNotFound]: {
|
|
38
|
+
title: i18NProviderUtils.getI18NValue('support.label.requested.url.not.found'),
|
|
39
|
+
description: i18NProviderUtils.getI18NValue('support.label.requested.url.not.found.desc')
|
|
40
|
+
},
|
|
41
|
+
[ErrorTypes.WillBeRightBack]: {
|
|
42
|
+
title: i18NProviderUtils.getI18NValue('support.crmlabel.err.whoa'),
|
|
43
|
+
description: i18NProviderUtils.getI18NValue('support.something.went.wrong')
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
return errorStateContent[type] || errorStateContent[ErrorTypes.Inconvenience];
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
function ErrorStateView(_ref, ref) {
|
|
50
|
+
let {
|
|
51
|
+
state
|
|
52
|
+
} = _ref;
|
|
53
|
+
const {
|
|
54
|
+
type,
|
|
55
|
+
title,
|
|
56
|
+
description
|
|
57
|
+
} = state.properties;
|
|
58
|
+
const ErrorComponent = errorStateComponents[type];
|
|
59
|
+
const errorStateContent = getErrorStateContent(type);
|
|
60
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
ref: ref
|
|
62
|
+
}, /*#__PURE__*/React.createElement(ErrorComponent, {
|
|
63
|
+
title: title || errorStateContent.title,
|
|
64
|
+
description: description || errorStateContent.description
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export default ErrorStateView;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import Switch from '@zohodesk/
|
|
2
|
+
import Switch from '@zohodesk-private/dot-registry/es/Switch/Switch';
|
|
3
3
|
import { useUniqueId } from '@zohodesk/components/es/Provider/IdProvider';
|
|
4
4
|
import { SwitchConstants } from "../../../../../../cc";
|
|
5
5
|
|
|
@@ -21,14 +21,14 @@ function SwitchView(_ref, ref) {
|
|
|
21
21
|
let id = getId();
|
|
22
22
|
return /*#__PURE__*/React.createElement(Switch, {
|
|
23
23
|
customProps: {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
container: {
|
|
25
|
+
ref
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
id: id,
|
|
29
29
|
size: size,
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
isChecked: checked,
|
|
31
|
+
isDisabled: disabled,
|
|
32
32
|
title: tooltip,
|
|
33
33
|
onChange: () => {
|
|
34
34
|
dispatch({
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Text } from "../../../..";
|
|
3
|
+
import { formatCurrency } from "../../../../../../translator-common";
|
|
3
4
|
export function CurrencyFieldView(_ref, ref) {
|
|
4
5
|
let {
|
|
5
6
|
state
|
|
6
7
|
} = _ref;
|
|
7
8
|
const {
|
|
8
|
-
value
|
|
9
|
+
value,
|
|
10
|
+
currencyLocale,
|
|
11
|
+
currencySymbol
|
|
9
12
|
} = state.properties;
|
|
13
|
+
const formatedValue = formatCurrency({
|
|
14
|
+
value,
|
|
15
|
+
locale: currencyLocale,
|
|
16
|
+
symbol: currencySymbol
|
|
17
|
+
});
|
|
10
18
|
return /*#__PURE__*/React.createElement(Text, {
|
|
11
19
|
getRef: ref,
|
|
12
|
-
text:
|
|
20
|
+
text: formatedValue
|
|
13
21
|
});
|
|
14
22
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
function isValidNumber() {
|
|
2
|
+
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
3
|
+
const rejexPattern = new RegExp('^(\\d+\\.?\\d*|\\.\\d+)$');
|
|
4
|
+
const isValidInt = rejexPattern.test(value);
|
|
5
|
+
return isValidInt;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default function formatCurrency(_ref) {
|
|
9
|
+
let {
|
|
10
|
+
value,
|
|
11
|
+
symbol = 'Rs.',
|
|
12
|
+
locale = 'IN'
|
|
13
|
+
} = _ref;
|
|
14
|
+
const isValidInt = isValidNumber(value);
|
|
15
|
+
|
|
16
|
+
if (isValidInt && symbol) {
|
|
17
|
+
const currencyArr = new Intl.NumberFormat(`en-${locale}`).formatToParts(value);
|
|
18
|
+
let currencyVal = '';
|
|
19
|
+
currencyArr.map(val => {
|
|
20
|
+
if (val.type == 'group') {
|
|
21
|
+
currencyVal += ',';
|
|
22
|
+
} else if (val.type == 'integer') {
|
|
23
|
+
currencyVal += val.value;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
if (value.indexOf('.') != -1) {
|
|
28
|
+
const fractionVal = value.split(".")[1];
|
|
29
|
+
|
|
30
|
+
for (let i = fractionVal.length - 1; i >= 0; i--) {
|
|
31
|
+
if (fractionVal[i] != 0) {
|
|
32
|
+
currencyVal += `.${fractionVal.slice(0, i + 1)}`;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return `${symbol}${currencyVal}`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default as TransFormState } from "./adapters/presenter/TransFormState";
|
|
1
|
+
export { default as TransFormState } from "./adapters/presenter/TransFormState";
|
|
2
|
+
export { default as formatCurrency } from "./adapters/presenter/formatCurrency";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AbstractController } from "./AbstractController";
|
|
2
|
+
export class InitializeController extends AbstractController {
|
|
3
|
+
handle(_ref) {
|
|
4
|
+
let {
|
|
5
|
+
state
|
|
6
|
+
} = _ref;
|
|
7
|
+
const {
|
|
8
|
+
service
|
|
9
|
+
} = this;
|
|
10
|
+
const context = state.properties.context;
|
|
11
|
+
const {
|
|
12
|
+
initializeUseCase
|
|
13
|
+
} = service;
|
|
14
|
+
initializeUseCase.execute({
|
|
15
|
+
context
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// import { State } from '../gateways/State';
|
|
2
|
+
class Presenter {
|
|
3
|
+
updateDependencies(state, updateState) {
|
|
4
|
+
this.state = state;
|
|
5
|
+
this.updateState = updateState;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
updateView(view) {
|
|
9
|
+
this.updateState({ ...this.state,
|
|
10
|
+
behaviours: { ...this.state.behaviours,
|
|
11
|
+
appContext: view
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default Presenter;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AbstractResource } from "../../../sdk/application/interfaces/gateways/AbstractResource";
|
|
2
|
+
|
|
3
|
+
/** Sample Implementation of AppResource */
|
|
4
|
+
export class AppResource extends AbstractResource {
|
|
5
|
+
initialize() {}
|
|
6
|
+
|
|
7
|
+
destroy() {}
|
|
8
|
+
|
|
9
|
+
initializeContext(context) {
|
|
10
|
+
this.context = context;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
initializeApiHeader(headers) {
|
|
14
|
+
this.headers = headers;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getContext() {
|
|
18
|
+
return this.context;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
getApiHeader() {
|
|
22
|
+
return this.headers;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/platform/app-context-behaviour/applications/interfaces/resources/ApiHeaderContract.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/platform/app-context-behaviour/applications/interfaces/resources/ContextContract.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import AbstractUseCase from "../AbstractUseCase";
|
|
2
|
+
export class InitializeUseCase extends AbstractUseCase {
|
|
3
|
+
execute(_ref) {
|
|
4
|
+
let {
|
|
5
|
+
instanceName
|
|
6
|
+
} = _ref;
|
|
7
|
+
const {
|
|
8
|
+
appResource,
|
|
9
|
+
presenter
|
|
10
|
+
} = this.dependencies;
|
|
11
|
+
const context = appResource.getContext();
|
|
12
|
+
presenter.updateView(context);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import AppContextProperties from "../../../bc/app-context/Properties";
|
|
2
|
+
import { platformSDK } from "../../sdk/frameworks/Sdk";
|
|
3
|
+
import ResourceNamesEnum from "../../../bc/sdk/ResourceNamesEnum";
|
|
4
|
+
|
|
5
|
+
class AppContextBehaviourFactory {
|
|
6
|
+
static create() {
|
|
7
|
+
return {
|
|
8
|
+
name: 'appContext',
|
|
9
|
+
setInitialState: _ref => {
|
|
10
|
+
let {
|
|
11
|
+
properties: {
|
|
12
|
+
context
|
|
13
|
+
}
|
|
14
|
+
} = _ref;
|
|
15
|
+
const appResource = platformSDK[ResourceNamesEnum.APP];
|
|
16
|
+
return {
|
|
17
|
+
headers: appResource.getApiHeader(),
|
|
18
|
+
context: { ...appResource.getContext(),
|
|
19
|
+
...context
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
// eventHandlers: EventHandlerFactory.create(),
|
|
24
|
+
eventHandlers: {},
|
|
25
|
+
properties: AppContextProperties
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default AppContextBehaviourFactory;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import LifeCycleEvents from "../../../cc/component/LifeCycleEventsEnum";
|
|
2
|
+
import ResourceNamesEnum from "../../../bc/sdk/ResourceNamesEnum";
|
|
3
|
+
import { Service } from "../adapters/gateways/Service";
|
|
4
|
+
import { InitializeController } from "../adapters/controllers/InitializeController";
|
|
5
|
+
import { platformSDK } from "../../sdk/frameworks/Sdk";
|
|
6
|
+
import Presenter from "../adapters/presenters/Presenter";
|
|
7
|
+
|
|
8
|
+
class EventHandlerFactory {
|
|
9
|
+
static create() {
|
|
10
|
+
const appResource = platformSDK[ResourceNamesEnum.APP]; // NOTE: here 'app' should match the resource name in the sdk registry
|
|
11
|
+
|
|
12
|
+
const presenter = new Presenter();
|
|
13
|
+
const dependencies = {
|
|
14
|
+
appResource,
|
|
15
|
+
presenter
|
|
16
|
+
};
|
|
17
|
+
const service = new Service(dependencies);
|
|
18
|
+
return {
|
|
19
|
+
[LifeCycleEvents.MOUNT]: new InitializeController(service).handle
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default EventHandlerFactory;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import SmartFormConstants from "../../../../cc/form-connected/
|
|
1
|
+
import SmartFormConstants from "../../../../cc/form-connected/ExternalConstants";
|
|
2
2
|
import FormSdkFactory from "./FormSdkFactory";
|
|
3
3
|
import FormConstants from "../../../../cc/form/Constants";
|
|
4
4
|
import { ZFORM_FIELD_BLURRED, ZFORM_FIELD_VALUE_CHANGED, ZFORM_SUBMIT_SUCCESS, ZFORM_SUBMIT_VALIDATION_FAILURE } from "../../../../bc/zform/Symbol";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ErrorState from "../../../../library/dot/legacy-to-new-arch/error-state/frameworks/ui/ErrorState";
|
|
3
|
+
import { ErrorCodes } from "../../../../cc/component/ErrorStructure";
|
|
4
|
+
import ErrorTypes from "../../../../cc/error-state/ErrorTypes";
|
|
5
|
+
|
|
6
|
+
function FallbackView(_ref, ref) {
|
|
7
|
+
let {
|
|
8
|
+
error
|
|
9
|
+
} = _ref;
|
|
10
|
+
const map = {
|
|
11
|
+
[ErrorCodes.API_FAILED]: ErrorTypes.UrlNotFound,
|
|
12
|
+
[ErrorCodes.PROPERTY_VALIDATION_FAILED]: ErrorTypes.OopsSomethingMiss,
|
|
13
|
+
[ErrorCodes.EVENT_HANDLER_FAILED]: ErrorTypes.Inconvenience,
|
|
14
|
+
[ErrorCodes.UNKNOWN_ERROR]: ErrorTypes.Inconvenience
|
|
15
|
+
};
|
|
16
|
+
const errorType = map[error.code] === undefined ? ErrorTypes.Inconvenience : map[error.code];
|
|
17
|
+
return /*#__PURE__*/React.createElement(ErrorState, {
|
|
18
|
+
type: errorType,
|
|
19
|
+
getRef: ref
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default /*#__PURE__*/React.forwardRef(FallbackView);
|
|
@@ -74,7 +74,7 @@ export default class EventHandlersFactory {
|
|
|
74
74
|
dispatch
|
|
75
75
|
} = _ref2;
|
|
76
76
|
return dispatch({
|
|
77
|
-
type: SmartTableConstants.
|
|
77
|
+
type: SmartTableConstants.ExternalConstants.RECORDS_SELECTED,
|
|
78
78
|
payload: action.payload
|
|
79
79
|
});
|
|
80
80
|
},
|
|
@@ -84,7 +84,7 @@ export default class EventHandlersFactory {
|
|
|
84
84
|
dispatch
|
|
85
85
|
} = _ref3;
|
|
86
86
|
return dispatch({
|
|
87
|
-
type: SmartTableConstants.
|
|
87
|
+
type: SmartTableConstants.ExternalConstants.RECORDS_DESELECTED,
|
|
88
88
|
payload: action.payload
|
|
89
89
|
});
|
|
90
90
|
},
|
|
@@ -94,7 +94,7 @@ export default class EventHandlersFactory {
|
|
|
94
94
|
dispatch
|
|
95
95
|
} = _ref4;
|
|
96
96
|
return dispatch({
|
|
97
|
-
type: SmartTableConstants.
|
|
97
|
+
type: SmartTableConstants.ExternalConstants.SELECTION_LIMIT_EXCEEDED,
|
|
98
98
|
payload: action.payload
|
|
99
99
|
});
|
|
100
100
|
},
|
|
@@ -107,7 +107,7 @@ export default class EventHandlersFactory {
|
|
|
107
107
|
|
|
108
108
|
if (action.metaData && action.metaData.isReOrder) {
|
|
109
109
|
dispatch({
|
|
110
|
-
type: SmartTableConstants.
|
|
110
|
+
type: SmartTableConstants.ExternalConstants.REORDER_SUCCESS,
|
|
111
111
|
payload: action.payload
|
|
112
112
|
});
|
|
113
113
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const getDependencyMappings = {
|
|
2
|
+
name: 'getDependencyMappings',
|
|
3
|
+
api: '/{{servicePrefix}}/{{orgName}}/api/v1/dependencyMappings',
|
|
4
|
+
parameters: `{"layoutId":"{{layoutId}}"}`,
|
|
5
|
+
type: 'GET',
|
|
6
|
+
transformer: data => data,
|
|
7
|
+
properties: {
|
|
8
|
+
layoutId: {
|
|
9
|
+
required: true,
|
|
10
|
+
typeMetadata: {
|
|
11
|
+
schema: {
|
|
12
|
+
type: 'string'
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export default getDependencyMappings;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Assuming GetTemplate interface is defined
|
|
2
|
+
const getLayoutRules = {
|
|
3
|
+
name: 'getLayoutRules',
|
|
4
|
+
api: '/{{servicePrefix}}/{{orgName}}/api/v1/layouts/{{layoutId}}/layoutRules',
|
|
5
|
+
parameters: `{"activeRulesOnly":{{activeRulesOnly}}}`,
|
|
6
|
+
type: 'GET',
|
|
7
|
+
transformer: data => data,
|
|
8
|
+
properties: {
|
|
9
|
+
layoutId: {
|
|
10
|
+
required: true,
|
|
11
|
+
typeMetadata: {
|
|
12
|
+
schema: {
|
|
13
|
+
type: 'string'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
activeRulesOnly: {
|
|
18
|
+
required: true,
|
|
19
|
+
typeMetadata: {
|
|
20
|
+
schema: {
|
|
21
|
+
type: 'boolean'
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
defaultValue: true // Assuming true as a default if parameter is optional
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export default getLayoutRules;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Assuming similar structure to PatchTemplate
|
|
2
|
+
const getMyForm = {
|
|
3
|
+
name: 'getMyForm',
|
|
4
|
+
api: '/{{servicePrefix}}/{{orgName}}/api/v1/myForm',
|
|
5
|
+
parameters: `{"layoutId":"{{layoutId}}"}`,
|
|
6
|
+
type: 'GET',
|
|
7
|
+
transformer: data => data,
|
|
8
|
+
properties: {
|
|
9
|
+
layoutId: {
|
|
10
|
+
required: true,
|
|
11
|
+
typeMetadata: {
|
|
12
|
+
schema: {
|
|
13
|
+
type: 'string'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export default getMyForm;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Assumed you have a GetTemplate interface similar to PatchTemplate
|
|
2
|
+
const getMyLayouts = {
|
|
3
|
+
name: 'getMyLayouts',
|
|
4
|
+
api: '/{{servicePrefix}}/{{orgName}}/api/v1/myLayouts',
|
|
5
|
+
parameters: `{"module":"{{module}}","departmentId":"{{departmentId}}","from":"{{from}}","limit":"{{limit}}"}`,
|
|
6
|
+
type: 'GET',
|
|
7
|
+
transformer: data => data,
|
|
8
|
+
properties: {
|
|
9
|
+
module: {
|
|
10
|
+
required: true,
|
|
11
|
+
typeMetadata: {
|
|
12
|
+
schema: {
|
|
13
|
+
type: 'string'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
departmentId: {
|
|
18
|
+
required: true,
|
|
19
|
+
typeMetadata: {
|
|
20
|
+
schema: {
|
|
21
|
+
type: 'string'
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
from: {
|
|
26
|
+
required: true,
|
|
27
|
+
typeMetadata: {
|
|
28
|
+
schema: {
|
|
29
|
+
type: 'string'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
limit: {
|
|
34
|
+
required: true,
|
|
35
|
+
typeMetadata: {
|
|
36
|
+
schema: {
|
|
37
|
+
type: 'string'
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
export default getMyLayouts;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Assuming GetTemplate interface is similar to PatchTemplate
|
|
2
|
+
import { transFormValidationRules } from "../utils/validation-rules/TransFormValidationRules";
|
|
3
|
+
const getValidationRules = {
|
|
4
|
+
name: 'getValidationRules',
|
|
5
|
+
api: '/{{servicePrefix}}/{{orgName}}/api/v1/layouts/{{layoutId}}/validationRules',
|
|
6
|
+
parameters: `{"activeRulesOnly":{{activeRulesOnly}}}`,
|
|
7
|
+
type: 'GET',
|
|
8
|
+
transformer: transFormValidationRules,
|
|
9
|
+
properties: {
|
|
10
|
+
layoutId: {
|
|
11
|
+
required: true,
|
|
12
|
+
typeMetadata: {
|
|
13
|
+
schema: {
|
|
14
|
+
type: 'string'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
activeRulesOnly: {
|
|
19
|
+
required: true,
|
|
20
|
+
typeMetadata: {
|
|
21
|
+
schema: {
|
|
22
|
+
type: 'boolean'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
defaultValue: true // Assuming default behavior if not provided
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
export default getValidationRules;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import AbstractController from "./AbstractController";
|
|
2
|
+
|
|
3
|
+
class ApiFailureController extends AbstractController {
|
|
4
|
+
handle(event) {
|
|
5
|
+
const {
|
|
6
|
+
apiFailureUseCase
|
|
7
|
+
} = this.service;
|
|
8
|
+
const {
|
|
9
|
+
state,
|
|
10
|
+
updateState,
|
|
11
|
+
action,
|
|
12
|
+
dispatch
|
|
13
|
+
} = event;
|
|
14
|
+
const {
|
|
15
|
+
payload,
|
|
16
|
+
metaData
|
|
17
|
+
} = action;
|
|
18
|
+
const {
|
|
19
|
+
error
|
|
20
|
+
} = payload;
|
|
21
|
+
apiFailureUseCase.updateDependency(state, updateState);
|
|
22
|
+
apiFailureUseCase.execute({
|
|
23
|
+
error,
|
|
24
|
+
metaData,
|
|
25
|
+
dispatch
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default ApiFailureController;
|