@zohodesk/library-platform 1.1.13 → 1.2.0-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/column-chooser/EventHandlers.js +1 -2
- package/es/bc/sdk/ResourceNamesEnum.js +1 -0
- package/es/bc/zform/Properties.js +20 -0
- package/es/bc/zform/Symbol.js +3 -0
- package/es/bc/zrecord/Constants.js +2 -0
- package/es/cc/action-band/Properties.js +37 -0
- package/es/cc/action-band/constants/ExternalConstants.js +3 -1
- package/es/cc/component/Dispatch.js +1 -0
- package/es/cc/component/LifeCycleEventsEnum.js +1 -0
- package/es/cc/component/index.js +3 -0
- package/es/cc/fields/currency/Properties.js +9 -0
- package/es/cc/fields/decimal/Properties.js +9 -0
- package/es/cc/fields/email/Properties.js +9 -0
- package/es/cc/fields/lookup/Properties.js +10 -26
- package/es/cc/fields/multi-line/Properties.js +1 -0
- package/es/cc/fields/number/Properties.js +10 -1
- package/es/cc/fields/phone/Properties.js +9 -0
- package/es/cc/fields/text/Properties.js +2 -2
- package/es/cc/fields/url/Properties.js +9 -0
- package/es/cc/one-unification/Constants.js +24 -0
- package/es/cc/one-unification/unified-navigation/ActionTypes.js +1 -0
- package/es/cc/one-unification/unified-navigation/CommonTypes.js +1 -0
- package/es/cc/one-unification/unified-navigation/ConfigTypes.js +1 -0
- package/es/cc/one-unification/unified-navigation/HandlerTypes.js +1 -0
- package/es/cc/one-unification/unified-navigation/Types.js +1 -0
- package/es/cc/one-unification/unified-navigation/UnifiedNavigation.d.js +0 -0
- package/es/cc/one-unification/unified-navigation/index.js +1 -0
- package/es/cc/smart-navigation/Constants.js +8 -0
- package/es/cc/smart-navigation/Events.js +107 -0
- package/es/cc/smart-navigation/Properties.js +87 -0
- package/es/cc/smart-navigation/index.js +4 -0
- package/es/cc/table-column-chooser/Constants.js +2 -1
- package/es/cc/table-connected/SdkContract.js +22 -0
- package/es/cc/text/Properties.js +100 -0
- package/es/cc/textbox/Properties.js +1 -1
- package/es/index.js +8 -3
- package/es/library/behaviours/clip-wrap/applications/usecases/ClipWrapUpdateUseCase.js +19 -0
- package/es/library/behaviours/library-loader/adapters/controllers/LibraryLoaderController.js +17 -0
- package/es/library/behaviours/library-loader/adapters/gateways/LibraryLoaderAdapter.js +29 -0
- package/es/library/behaviours/library-loader/applications/usecases/LoadLibraryUseCase.js +42 -0
- package/es/library/behaviours/library-loader/domain/entities/interfaces/ILibraryLoader.js +1 -0
- package/es/library/behaviours/library-loader/frameworks/LibraryLoaderBehaviour.js +26 -0
- package/es/library/behaviours/search/adapters/controllers/UpdatePropertiesController.js +9 -4
- package/es/library/custom-component/adapters/gateways/event-manager/EventManager.js +4 -3
- package/es/library/custom-component/applications/usecases/DispatchUseCase.js +1 -0
- package/es/library/custom-component/applications/usecases/InitializeUseCase.js +1 -0
- package/es/library/custom-component/applications/usecases/MountUseCase.js +1 -0
- package/es/library/custom-component/applications/usecases/SetRefUseCase.js +7 -0
- package/es/library/custom-component/applications/usecases/UnmountUseCase.js +1 -0
- package/es/library/custom-component/applications/usecases/UpdatePropertyUseCase.js +1 -0
- package/es/library/custom-component/domain/entities/Component.js +1 -0
- package/es/library/custom-component/domain/entities/Logger.js +4 -9
- package/es/library/dot/components/form-fields/currency/frameworks/ui/CurrencyView.js +2 -0
- package/es/library/dot/components/form-fields/decimal/frameworks/ui/DecimalView.js +2 -0
- package/es/library/dot/components/form-fields/email/frameworks/ui/Email.js +1 -1
- package/es/library/dot/components/form-fields/email/frameworks/ui/EmailView.js +2 -0
- package/es/library/dot/components/form-fields/number/frameworks/ui/NumberView.js +2 -0
- package/es/library/dot/components/form-fields/phone/frameworks/ui/PhoneView.js +2 -0
- package/es/library/dot/components/form-fields/textarea/frameworks/ui/TextArea.js +1 -1
- package/es/library/dot/components/form-fields/textarea/frameworks/ui/TextAreaView.js +4 -2
- package/es/library/dot/components/form-fields/textbox/frameworks/ui/TextBoxView.js +2 -0
- package/es/library/dot/components/form-fields/url/frameworks/ui/UrlView.js +2 -0
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/HeaderData.js +1 -1
- package/es/library/dot/legacy-to-new-arch/table-field-components/text-field/frameworks/ui/TextFieldView.js +20 -0
- package/es/library/dot/legacy-to-new-arch/text/frameworks/ui/Text.js +2 -2
- package/es/library/dot/legacy-to-new-arch/text/frameworks/ui/TextView.js +22 -1
- package/es/platform/app-context-behaviour/adapters/controllers/AbstractController.js +9 -0
- package/es/platform/app-context-behaviour/adapters/controllers/UpdatePropertiesController.js +32 -0
- package/es/platform/app-context-behaviour/adapters/gateway/Repository.js +22 -0
- package/es/platform/app-context-behaviour/adapters/gateway/Service.js +10 -0
- package/es/platform/app-context-behaviour/adapters/presenter/Presenter.js +16 -0
- package/es/platform/app-context-behaviour/applications/interfaces/UseCaseDependencies.js +1 -0
- package/es/platform/app-context-behaviour/applications/interfaces/gateways/IRepository.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/UpdatePropertiesInputModel.js +1 -0
- package/es/platform/app-context-behaviour/applications/interfaces/output/BehaviourOutputModel.js +1 -0
- package/es/platform/app-context-behaviour/applications/interfaces/output/IPresenter.js +1 -0
- package/es/platform/app-context-behaviour/applications/usecases/AbstractUseCase.js +17 -0
- package/es/platform/app-context-behaviour/applications/usecases/UpdatePropertiesUsecase.js +25 -0
- package/es/platform/app-context-behaviour/domain/entities/AppContext.js +44 -0
- package/es/platform/app-context-behaviour/domain/entities/interfaces/IAppContext.js +1 -0
- package/es/platform/app-context-behaviour/frameworks/AppContextBehaviourFactory.js +2 -2
- package/es/platform/app-context-behaviour/frameworks/EventHandlerFactory.js +22 -0
- package/es/platform/client-actions/behaviour/zclient-actions/adapters/presenters/FilterUtils.js +11 -0
- package/es/platform/client-actions/behaviour/zclient-actions/adapters/resources/ClientActionsFetchSDK.js +76 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/ClientActionsAPIGatewayParams.js +1 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/ClientActionsFetchSDKParams.js +10 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/IClientActionsFetchSDK.js +0 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/adapters/resources/ClientScriptsFetchSDK.js +43 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/applications/interfaces/ClientScriptsAPIGatewayParams.js +1 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/applications/interfaces/ClientScriptsSDKFetchParams.js +1 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/applications/interfaces/IClientScriptsFetchSDK.js +0 -0
- package/es/platform/column-chooser/adapters/controllers/ColumnChooserOpenController.js +14 -6
- package/es/platform/column-chooser/adapters/controllers/ColumnChooserUpdateController.js +22 -0
- package/es/platform/column-chooser/adapters/gateways/Repository.js +12 -1
- package/es/platform/column-chooser/adapters/gateways/Service.js +2 -0
- package/es/platform/column-chooser/applications/interfaces/input/ColumnChooserUpdateInput.js +1 -0
- package/es/platform/column-chooser/applications/usecases/ColumnChooserSaveUseCase.js +8 -1
- package/es/platform/column-chooser/applications/usecases/ColumnChooserUpdateUseCase.js +35 -0
- package/es/platform/column-chooser/domain/entities/ColumnChooserImp.js +6 -0
- package/es/platform/column-chooser/frameworks/EventHandlersFactory.js +6 -4
- package/es/platform/components/index.js +1 -0
- package/es/platform/components/smart-action-band/adapters/presenters/ActionBandTranslator.js +70 -8
- package/es/platform/components/smart-action-band/adapters/presenters/utils/DefaultClientActions.js +32 -0
- package/es/platform/components/smart-action-band/frameworks/EventHandlersFactory.js +42 -1
- package/es/platform/components/smart-action-band/frameworks/SmartActionBandFactory.js +4 -1
- package/es/platform/components/smart-navigation/adapters/controllers/LoadScriptController.js +0 -0
- package/es/platform/components/smart-navigation/adapters/controllers/UiModelInitializeController.js +0 -0
- package/es/platform/components/smart-navigation/adapters/presenters/OneUnifiedNavigationTranslator.js +248 -0
- package/es/platform/components/smart-navigation/adapters/presenters/Present.js +77 -0
- package/es/platform/components/smart-navigation/adapters/presenters/SampleModel.js +356 -0
- package/es/platform/components/smart-navigation/adapters/resources/SmartNavigationResource.js +96 -0
- package/es/platform/components/smart-navigation/applications/usecases/NavigateModuleUseCase.js +0 -0
- package/es/platform/components/smart-navigation/frameworks/CustomElementRenderer.js +22 -0
- package/es/platform/components/smart-navigation/frameworks/SmartNavigation.js +12 -0
- package/es/platform/components/smart-navigation/frameworks/one-unification/OneUnificationEventHandlers.js +156 -0
- package/es/platform/components/smart-navigation/frameworks/one-unification/SmartNavigation.js +83 -0
- package/es/platform/components/smart-navigation/frameworks/one-unification/SmartNavigation.module.css +3 -0
- package/es/platform/components/smart-navigation/frameworks/one-unification/SmartNavigationEventHandlers.js +173 -0
- package/es/platform/components/smart-navigation/frameworks/one-unification/UnifiedNavigation.js +48 -0
- package/es/platform/components/smart-navigation/frameworks/one-unification/UnifiedNavigationActions.js +144 -0
- package/es/platform/components/table-connected/adapters/resources/SmartTableResource.js +52 -0
- package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +1 -7
- package/es/platform/components/table-connected/frameworks/ListSdkFactory.js +4 -2
- package/es/platform/data-source/http-template/fetchLookupFields.js +0 -6
- package/es/platform/data-source/http-template/getPageClientActions.js +23 -0
- package/es/platform/data-source/http-template/getSingleRecord.js +51 -0
- package/es/platform/data-source/index.js +2 -0
- package/es/platform/data-source/utils/validation-rules/FieldConditions.js +1 -1
- package/es/platform/sdk-behaviour/adapters/controllers/InitializeController.js +7 -2
- package/es/platform/sdk-behaviour/applications/usecases/CreateResourceInstanceUseCase.js +10 -1
- package/es/platform/zform/adapters/controllers/GetInitialRecordSuccessController.js +31 -0
- package/es/platform/zform/adapters/gateway/FormRepository.js +10 -2
- package/es/platform/zform/adapters/gateway/Service.js +2 -0
- package/es/platform/zform/adapters/presenter/FormTranslator.js +27 -15
- package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +1 -1
- package/es/platform/zform/adapters/presenter/translators/fields/CurrencyFieldTranslator.js +1 -0
- package/es/platform/zform/adapters/presenter/translators/fields/DecimalFieldTranslator.js +1 -0
- package/es/platform/zform/adapters/presenter/translators/fields/EmailFieldTranslator.js +1 -0
- package/es/platform/zform/adapters/presenter/translators/fields/LookUpFieldTranslator.js +11 -7
- package/es/platform/zform/adapters/presenter/translators/fields/NumberFieldTranslator.js +1 -0
- package/es/platform/zform/adapters/presenter/translators/fields/PhoneFieldTranslator.js +1 -0
- package/es/platform/zform/adapters/presenter/translators/fields/TextAreaFieldTranslator.js +1 -0
- package/es/platform/zform/adapters/presenter/translators/fields/TextFieldTranslator.js +1 -0
- package/es/platform/zform/adapters/presenter/translators/fields/URLFieldTranslator.js +1 -0
- package/es/platform/zform/adapters/presenter/utils/sanitizeHtmlString.js +2 -2
- package/es/platform/zform/applications/interfaces/input/GetInitialRecordSuccessUseCaseInputModel.js +1 -0
- package/es/platform/zform/applications/usecases/GetInitialRecordSuccessUseCase.js +132 -0
- package/es/platform/zform/applications/usecases/InitializeUseCase.js +54 -30
- package/es/platform/zform/applications/usecases/LookupFieldSuccessUseCase.js +5 -0
- package/es/platform/zform/applications/usecases/MyFormSuccessUseCase.js +12 -11
- package/es/platform/zform/applications/usecases/SubmitValidationCompletedUseCase.js +21 -8
- package/es/platform/zform/domain/ZField.js +7 -5
- package/es/platform/zform/domain/ZForm.js +97 -20
- package/es/platform/zform/frameworks/ui/EventHandlerFactory.js +23 -5
- package/es/platform/zform/frameworks/ui/ZFormBehaviourFactory.js +2 -0
- package/es/platform/zlist/adapters/presenters/TableTranslator.js +5 -4
- package/es/platform/zrecord/adapters/controllers/UpdateRecordController.js +30 -0
- package/es/platform/zrecord/adapters/gateways/Service.js +2 -0
- package/es/platform/zrecord/applications/interfaces/input/UpdateRecordInputModel.js +0 -0
- package/es/platform/zrecord/applications/usecases/UpdateRecordUseCase.js +30 -0
- package/es/platform/zrecord/frameworks/ActionsHandlersFactory.js +4 -1
- package/package.json +9 -11
- package/es/platform/components/table-connected/adapters/controllers/ColumnChooserOpenedController.js +0 -28
- package/es/platform/components/table-connected/adapters/controllers/ColumnChooserUpdateController.js +0 -31
|
@@ -12,7 +12,18 @@ function TextView(_ref, ref) {
|
|
|
12
12
|
} = helpers;
|
|
13
13
|
let {
|
|
14
14
|
text,
|
|
15
|
+
size,
|
|
16
|
+
display,
|
|
17
|
+
decoration,
|
|
18
|
+
textAlign,
|
|
19
|
+
lineClamp,
|
|
20
|
+
lineHeight,
|
|
21
|
+
letterSpacing,
|
|
22
|
+
transform,
|
|
23
|
+
whiteSpace,
|
|
24
|
+
wordWrap,
|
|
15
25
|
weight,
|
|
26
|
+
wordBreak,
|
|
16
27
|
tooltip,
|
|
17
28
|
isDotted
|
|
18
29
|
} = state.properties;
|
|
@@ -27,9 +38,19 @@ function TextView(_ref, ref) {
|
|
|
27
38
|
});
|
|
28
39
|
}
|
|
29
40
|
},
|
|
30
|
-
$ui_size:
|
|
41
|
+
$ui_size: size,
|
|
31
42
|
$flag_dotted: isDotted,
|
|
43
|
+
$ui_display: display,
|
|
44
|
+
$ui_decoration: decoration,
|
|
32
45
|
$ui_weight: weight,
|
|
46
|
+
$ui_textAlign: textAlign,
|
|
47
|
+
$ui_wordBreak: wordBreak,
|
|
48
|
+
$ui_lineClamp: lineClamp,
|
|
49
|
+
$ui_letterSpacing: letterSpacing,
|
|
50
|
+
$ui_lineHeight: lineHeight,
|
|
51
|
+
$ui_transform: transform,
|
|
52
|
+
$ui_whiteSpace: whiteSpace,
|
|
53
|
+
$ui_wordWrap: wordWrap,
|
|
33
54
|
$i18n_dataTitle: tooltip || text
|
|
34
55
|
}, text);
|
|
35
56
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import AbstractController from "./AbstractController";
|
|
2
|
+
|
|
3
|
+
class UpdatePropertiesController extends AbstractController {
|
|
4
|
+
handle(event) {
|
|
5
|
+
const {
|
|
6
|
+
updatePropertiesUsecase
|
|
7
|
+
} = this.service;
|
|
8
|
+
const {
|
|
9
|
+
state,
|
|
10
|
+
updateState,
|
|
11
|
+
action
|
|
12
|
+
} = event;
|
|
13
|
+
const {
|
|
14
|
+
currentProperties,
|
|
15
|
+
previousProperties
|
|
16
|
+
} = action.payload;
|
|
17
|
+
const {
|
|
18
|
+
context
|
|
19
|
+
} = previousProperties;
|
|
20
|
+
const {
|
|
21
|
+
context: newContext
|
|
22
|
+
} = currentProperties;
|
|
23
|
+
updatePropertiesUsecase.updateDependencies(state, updateState);
|
|
24
|
+
updatePropertiesUsecase.execute({
|
|
25
|
+
context,
|
|
26
|
+
newContext
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default UpdatePropertiesController;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { platformSDK } from "../../../sdk/frameworks/Sdk";
|
|
2
|
+
import ResourceNamesEnum from "../../../../bc/sdk/ResourceNamesEnum";
|
|
3
|
+
import AppContext from "../../domain/entities/AppContext";
|
|
4
|
+
const EMPTY_OBJ = {};
|
|
5
|
+
export default class Repository {
|
|
6
|
+
init(state) {
|
|
7
|
+
this.state = state;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
getAppContextEntity() {
|
|
11
|
+
const {
|
|
12
|
+
context
|
|
13
|
+
} = this.state.properties;
|
|
14
|
+
const appResource = platformSDK[ResourceNamesEnum.APP];
|
|
15
|
+
const headers = appResource ? appResource.getApiHeader() : EMPTY_OBJ;
|
|
16
|
+
const appContext = appResource ? appResource.getContext() : EMPTY_OBJ;
|
|
17
|
+
return new AppContext({ ...appContext,
|
|
18
|
+
...context
|
|
19
|
+
}, headers);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default class Presenter {
|
|
2
|
+
updateDependencies(state, updateState) {
|
|
3
|
+
this.state = state;
|
|
4
|
+
this.updateState = updateState;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
updateBehaviourState(data) {
|
|
8
|
+
this.state = { ...this.state,
|
|
9
|
+
behaviours: { ...this.state.behaviours,
|
|
10
|
+
appContext: data
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
this.updateState(this.state);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
}
|
|
@@ -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/output/BehaviourOutputModel.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class AbstractUseCase {
|
|
2
|
+
constructor(dependencies) {
|
|
3
|
+
this.dependencies = dependencies;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
updateDependencies(state, updateState) {
|
|
7
|
+
const {
|
|
8
|
+
repository,
|
|
9
|
+
presenter
|
|
10
|
+
} = this.dependencies;
|
|
11
|
+
repository.init(state);
|
|
12
|
+
presenter.updateDependencies(state, updateState);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default AbstractUseCase;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
|
|
3
|
+
class UpdatePropertiesUsecase extends AbstractUseCase {
|
|
4
|
+
execute(input) {
|
|
5
|
+
const {
|
|
6
|
+
repository,
|
|
7
|
+
presenter
|
|
8
|
+
} = this.dependencies;
|
|
9
|
+
const {
|
|
10
|
+
context,
|
|
11
|
+
newContext
|
|
12
|
+
} = input;
|
|
13
|
+
const appContext = repository.getAppContextEntity();
|
|
14
|
+
|
|
15
|
+
if (appContext.isEqualContext(context, newContext)) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
appContext.updateContext(newContext);
|
|
20
|
+
presenter.updateBehaviourState(appContext.toObject());
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default UpdatePropertiesUsecase;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
class AppContext {
|
|
2
|
+
constructor(context, headers) {
|
|
3
|
+
this.context = context;
|
|
4
|
+
this.headers = headers;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
updateContext(context) {
|
|
8
|
+
this.context = { ...this.context,
|
|
9
|
+
...context
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
getContext() {
|
|
14
|
+
return this.context;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
isEqualContext(context1, context2) {
|
|
18
|
+
// shallow comparison
|
|
19
|
+
const keys1 = Object.keys(context1);
|
|
20
|
+
const keys2 = Object.keys(context2);
|
|
21
|
+
|
|
22
|
+
if (keys1.length !== keys2.length) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
for (const key of keys1) {
|
|
27
|
+
if (context1[key] !== context2[key]) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
toObject() {
|
|
36
|
+
return {
|
|
37
|
+
context: this.context,
|
|
38
|
+
headers: this.headers
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default AppContext;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import AppContextProperties from "../../../bc/app-context/Properties";
|
|
2
2
|
import { platformSDK } from "../../sdk/frameworks/Sdk";
|
|
3
3
|
import ResourceNamesEnum from "../../../bc/sdk/ResourceNamesEnum";
|
|
4
|
+
import EventHandlersFactory from "./EventHandlerFactory";
|
|
4
5
|
|
|
5
6
|
class AppContextBehaviourFactory {
|
|
6
7
|
static create() {
|
|
@@ -20,8 +21,7 @@ class AppContextBehaviourFactory {
|
|
|
20
21
|
}
|
|
21
22
|
};
|
|
22
23
|
},
|
|
23
|
-
|
|
24
|
-
eventHandlers: {},
|
|
24
|
+
eventHandlers: EventHandlersFactory.create(),
|
|
25
25
|
properties: AppContextProperties
|
|
26
26
|
};
|
|
27
27
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import LifeCycleAction from "../../../cc/architecture/LifeCycleActionEnum";
|
|
2
|
+
import Repository from "../adapters/gateway/Repository";
|
|
3
|
+
import Service from "../adapters/gateway/Service";
|
|
4
|
+
import Presenter from "../adapters/presenter/Presenter";
|
|
5
|
+
import UpdatePropertiesController from "../adapters/controllers/UpdatePropertiesController";
|
|
6
|
+
|
|
7
|
+
class EventHandlersFactory {
|
|
8
|
+
static create() {
|
|
9
|
+
const presenter = new Presenter();
|
|
10
|
+
const repository = new Repository();
|
|
11
|
+
const service = new Service({
|
|
12
|
+
presenter,
|
|
13
|
+
repository
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
[LifeCycleAction.UPDATE_PROPERTIES]: new UpdatePropertiesController(service).handle
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default EventHandlersFactory;
|
package/es/platform/client-actions/behaviour/zclient-actions/adapters/presenters/FilterUtils.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function validateClientActionLocation(actualLocation, expectedLocation) {
|
|
2
|
+
return actualLocation === expectedLocation || actualLocation.endsWith(`.${expectedLocation}`);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
function validateClientAction(clientAction, location) {
|
|
6
|
+
return clientAction.location && validateClientActionLocation(clientAction.location, location);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function filterClientActionsByLocation(clientActions, location) {
|
|
10
|
+
return clientActions.filter(clientAction => clientAction && validateClientAction(clientAction, location));
|
|
11
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import FetchGateWay from "../../../../../zhttp/adapters/gateway/FetchGateWay";
|
|
2
|
+
import APITemplate from "../../../../../zdata-source/domain/entities/APITemplate";
|
|
3
|
+
import getClientActions from "../../../../../data-source/http-template/getPageClientActions";
|
|
4
|
+
import TemplateHelpers from "../../../../../zdata-source/adapters/gateways/TemplateHelpers";
|
|
5
|
+
|
|
6
|
+
//TODO: Remove this SDK when smart page is ready for production
|
|
7
|
+
// Use this SDK only for fetching client actions at page level in desk_client_app until smart page is ready
|
|
8
|
+
class ClientActionsFetchSDK {
|
|
9
|
+
getClientActionsAPIDetails(args) {
|
|
10
|
+
const apiTemplate = new APITemplate(getClientActions, new TemplateHelpers());
|
|
11
|
+
const apiArgs = { ...args,
|
|
12
|
+
servicePrefix: 'supportapi/zd',
|
|
13
|
+
// @ts-ignore - custom property
|
|
14
|
+
orgName: window.currentOrg.portalName
|
|
15
|
+
};
|
|
16
|
+
const apiDetailsModel = apiTemplate.getApiDetails(apiArgs);
|
|
17
|
+
return { ...apiDetailsModel,
|
|
18
|
+
options: {
|
|
19
|
+
headers: {
|
|
20
|
+
// @ts-ignore - custom property
|
|
21
|
+
orgId: window.currentOrg.id
|
|
22
|
+
},
|
|
23
|
+
method: apiDetailsModel.method
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
mapClientActionsByInstanceLocation(clientActions) {
|
|
29
|
+
const filteredClientActionsMap = new Map();
|
|
30
|
+
|
|
31
|
+
for (const clientAction of clientActions) {
|
|
32
|
+
const {
|
|
33
|
+
location,
|
|
34
|
+
component
|
|
35
|
+
} = clientAction;
|
|
36
|
+
const locationPathArr = location.split('.');
|
|
37
|
+
const instanceName = locationPathArr[1] || component;
|
|
38
|
+
const locationName = locationPathArr[2] || location;
|
|
39
|
+
|
|
40
|
+
if (!instanceName || !locationName) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (!filteredClientActionsMap.has(instanceName)) {
|
|
45
|
+
filteredClientActionsMap.set(instanceName, {});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const instanceActions = filteredClientActionsMap.get(instanceName);
|
|
49
|
+
|
|
50
|
+
if (!instanceActions[locationName]) {
|
|
51
|
+
instanceActions[locationName] = [];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
instanceActions[locationName].push(clientAction);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return filteredClientActionsMap;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async fetchClientActions(params) {
|
|
61
|
+
const apiDetails = this.getClientActionsAPIDetails(params);
|
|
62
|
+
const fetchGateway = new FetchGateWay(window.fetch.bind(window));
|
|
63
|
+
return new Promise((resolve, reject) => {
|
|
64
|
+
fetchGateway.fetch(apiDetails.url, apiDetails.options).then(response => response.json()).then(clientActions => {
|
|
65
|
+
this.clientActions = clientActions;
|
|
66
|
+
const filteredClientActionsMap = this.mapClientActionsByInstanceLocation(this.clientActions);
|
|
67
|
+
return resolve(filteredClientActionsMap);
|
|
68
|
+
}).catch(err => {
|
|
69
|
+
reject(err);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export default ClientActionsFetchSDK;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var ClientActionPage = /*#__PURE__*/function (ClientActionPage) {
|
|
2
|
+
ClientActionPage["LIST"] = "list";
|
|
3
|
+
ClientActionPage["DETAILS"] = "details";
|
|
4
|
+
ClientActionPage["CREATE_PAGE"] = "createPage";
|
|
5
|
+
ClientActionPage["EDIT_PAGE"] = "editPage";
|
|
6
|
+
ClientActionPage["ALL_PAGES"] = "allPages";
|
|
7
|
+
return ClientActionPage;
|
|
8
|
+
}(ClientActionPage || {});
|
|
9
|
+
|
|
10
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import APITemplate from "../../../../../zdata-source/domain/entities/APITemplate";
|
|
2
|
+
import TemplateHelpers from "../../../../../zdata-source/adapters/gateways/TemplateHelpers";
|
|
3
|
+
import FetchGateWay from "../../../../../zhttp/adapters/gateway/FetchGateWay";
|
|
4
|
+
import getClientScripts from "../../../../../data-source/http-template/getClientScripts";
|
|
5
|
+
|
|
6
|
+
//TODO: Remove this SDK when smart page is ready for production
|
|
7
|
+
// Use this SDK only for fetching client actions at page level in desk_client_app until smart page is ready
|
|
8
|
+
class ClientScriptsFetchSDK {
|
|
9
|
+
getClientScriptsAPIDetails(args) {
|
|
10
|
+
const apiTemplate = new APITemplate(getClientScripts, new TemplateHelpers());
|
|
11
|
+
const apiArgs = { ...args,
|
|
12
|
+
servicePrefix: 'supportapi/zd',
|
|
13
|
+
// @ts-ignore - custom property
|
|
14
|
+
orgName: window.currentOrg.portalName
|
|
15
|
+
};
|
|
16
|
+
const apiDetailsModel = apiTemplate.getApiDetails(apiArgs);
|
|
17
|
+
return { ...apiDetailsModel,
|
|
18
|
+
options: {
|
|
19
|
+
headers: {
|
|
20
|
+
// @ts-ignore - custom property
|
|
21
|
+
orgId: window.currentOrg.id
|
|
22
|
+
},
|
|
23
|
+
method: apiDetailsModel.method
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async fetchClientScripts(params) {
|
|
29
|
+
const apiDetails = this.getClientScriptsAPIDetails(params);
|
|
30
|
+
const fetchGateway = new FetchGateWay(window.fetch.bind(window));
|
|
31
|
+
return new Promise((resolve, reject) => {
|
|
32
|
+
fetchGateway.fetch(apiDetails.url, apiDetails.options).then(response => response.json()).then(clientScripts => {
|
|
33
|
+
this.clientScripts = clientScripts;
|
|
34
|
+
return resolve(clientScripts);
|
|
35
|
+
}).catch(err => {
|
|
36
|
+
reject(err);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default ClientScriptsFetchSDK;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
File without changes
|
|
@@ -4,20 +4,28 @@ class ColumnChooserOpenController extends AbstractController {
|
|
|
4
4
|
handle(event) {
|
|
5
5
|
const {
|
|
6
6
|
state,
|
|
7
|
-
action,
|
|
8
7
|
updateState
|
|
9
8
|
} = event;
|
|
10
9
|
const {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
zfield
|
|
11
|
+
} = state.behaviours;
|
|
12
|
+
const {
|
|
13
|
+
fields: availableFields,
|
|
14
|
+
selectedFields
|
|
15
|
+
} = zfield;
|
|
16
|
+
const columnChooserOptionsOrder = [...selectedFields];
|
|
17
|
+
availableFields.forEach(field => {
|
|
18
|
+
if (!selectedFields.includes(field.name)) {
|
|
19
|
+
columnChooserOptionsOrder.push(field.name);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
14
22
|
const {
|
|
15
23
|
columnChooserOpenUseCase
|
|
16
24
|
} = this.service;
|
|
17
25
|
columnChooserOpenUseCase.updateDependencies(state, updateState);
|
|
18
26
|
columnChooserOpenUseCase.execute({
|
|
19
|
-
order,
|
|
20
|
-
selectedArray
|
|
27
|
+
order: columnChooserOptionsOrder,
|
|
28
|
+
selectedArray: selectedFields
|
|
21
29
|
});
|
|
22
30
|
}
|
|
23
31
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import AbstractController from "./AbstractController";
|
|
2
|
+
export default class ColumnChooserUpdateController extends AbstractController {
|
|
3
|
+
handle(event) {
|
|
4
|
+
const {
|
|
5
|
+
state,
|
|
6
|
+
dispatch,
|
|
7
|
+
action
|
|
8
|
+
} = event;
|
|
9
|
+
const {
|
|
10
|
+
selectedArray
|
|
11
|
+
} = action.payload;
|
|
12
|
+
const {
|
|
13
|
+
columnChooserUpdateUseCase
|
|
14
|
+
} = this.service;
|
|
15
|
+
columnChooserUpdateUseCase.updateDependencies(state, dispatch);
|
|
16
|
+
columnChooserUpdateUseCase.execute({
|
|
17
|
+
selectedArray,
|
|
18
|
+
dispatch
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
}
|
|
@@ -13,10 +13,21 @@ class Repository {
|
|
|
13
13
|
const {
|
|
14
14
|
columnChooser
|
|
15
15
|
} = this.state.behaviours;
|
|
16
|
+
const {
|
|
17
|
+
context
|
|
18
|
+
} = this.state.behaviours.appContext;
|
|
19
|
+
const {
|
|
20
|
+
viewId,
|
|
21
|
+
departmentId
|
|
22
|
+
} = this.state.properties;
|
|
16
23
|
const reorderEntity = new ReorderEntityImp(columnChooser.order);
|
|
17
24
|
const searchEntity = this.createSearchEntity();
|
|
18
25
|
const selectEntity = new SelectEntityImp(columnChooser.selected, DEFAULT_COLUMN_CHOOSE_MAX_COUNT);
|
|
19
|
-
return new ColumnChooserImp(columnChooser.isSaved, reorderEntity, searchEntity, selectEntity
|
|
26
|
+
return new ColumnChooserImp(columnChooser.isSaved, reorderEntity, searchEntity, selectEntity, {
|
|
27
|
+
context,
|
|
28
|
+
viewId,
|
|
29
|
+
departmentId
|
|
30
|
+
});
|
|
20
31
|
}
|
|
21
32
|
|
|
22
33
|
createSearchEntity() {
|
|
@@ -4,6 +4,7 @@ import ColumnChooserReorderUseCase from "../../applications/usecases/ColumnChoos
|
|
|
4
4
|
import ColumnChooserSearchUseCase from "../../applications/usecases/ColumnChooserSearchUseCase";
|
|
5
5
|
import ColumnChooserSaveUseCase from "../../applications/usecases/ColumnChooserSaveUseCase";
|
|
6
6
|
import ColumnChooserCloseUseCase from "../../applications/usecases/ColumnChooserCloseUseCase";
|
|
7
|
+
import ColumnChooserUpdateUseCase from "../../applications/usecases/ColumnChooserUpdateUseCase";
|
|
7
8
|
|
|
8
9
|
class Service {
|
|
9
10
|
constructor(dependencies) {
|
|
@@ -13,6 +14,7 @@ class Service {
|
|
|
13
14
|
this.columnChooserSearchUseCase = new ColumnChooserSearchUseCase(dependencies);
|
|
14
15
|
this.columnChooserSaveUseCase = new ColumnChooserSaveUseCase(dependencies);
|
|
15
16
|
this.columnChooserCloseUseCase = new ColumnChooserCloseUseCase(dependencies);
|
|
17
|
+
this.columnChooserUpdateUseCase = new ColumnChooserUpdateUseCase(dependencies);
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { COLUMN_CHOOSER_SAVED } from "../../../../cc/table-column-chooser/Constants";
|
|
1
2
|
import AbstractUseCase from "./AbstractUseCase";
|
|
2
3
|
import { COLUMN_CHOOSER_BEHAVIOUR_UPDATED } from "../../../../bc/column-chooser/Constants";
|
|
3
4
|
|
|
@@ -16,6 +17,7 @@ class ColumnChooserSaveUseCase extends AbstractUseCase {
|
|
|
16
17
|
columnChooser.markAsSaved();
|
|
17
18
|
presenter.updateView(columnChooser.toObject()); // TODO: exposer.columnChooserUpdated({ fields });
|
|
18
19
|
|
|
20
|
+
presenter.updateView(columnChooser.toObject());
|
|
19
21
|
dispatch({
|
|
20
22
|
type: COLUMN_CHOOSER_BEHAVIOUR_UPDATED,
|
|
21
23
|
payload: {
|
|
@@ -23,7 +25,12 @@ class ColumnChooserSaveUseCase extends AbstractUseCase {
|
|
|
23
25
|
order
|
|
24
26
|
}
|
|
25
27
|
});
|
|
26
|
-
|
|
28
|
+
dispatch({
|
|
29
|
+
type: COLUMN_CHOOSER_SAVED,
|
|
30
|
+
payload: {
|
|
31
|
+
selectedArray
|
|
32
|
+
}
|
|
33
|
+
});
|
|
27
34
|
}
|
|
28
35
|
|
|
29
36
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { FIELD_EXECUTE } from "../../../../bc/zfield/Constants";
|
|
2
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
3
|
+
|
|
4
|
+
class ColumnChooserUpdateUseCase extends AbstractUseCase {
|
|
5
|
+
execute(_ref) {
|
|
6
|
+
let {
|
|
7
|
+
selectedArray,
|
|
8
|
+
dispatch
|
|
9
|
+
} = _ref;
|
|
10
|
+
const {
|
|
11
|
+
repository
|
|
12
|
+
} = this.dependencies;
|
|
13
|
+
const columnChooser = repository.getColumnChooser();
|
|
14
|
+
const {
|
|
15
|
+
context,
|
|
16
|
+
viewId,
|
|
17
|
+
departmentId
|
|
18
|
+
} = columnChooser.getContexts();
|
|
19
|
+
dispatch({
|
|
20
|
+
type: FIELD_EXECUTE,
|
|
21
|
+
payload: {
|
|
22
|
+
actionName: 'updateSelectedFields',
|
|
23
|
+
props: { ...context,
|
|
24
|
+
fields: selectedArray,
|
|
25
|
+
viewId,
|
|
26
|
+
departmentId
|
|
27
|
+
},
|
|
28
|
+
apiName: 'updateSelectedFields'
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default ColumnChooserUpdateUseCase;
|
|
@@ -4,10 +4,16 @@ export default class ColumnChooserImp {
|
|
|
4
4
|
let reorderEntity = arguments.length > 1 ? arguments[1] : undefined;
|
|
5
5
|
let searchEntity = arguments.length > 2 ? arguments[2] : undefined;
|
|
6
6
|
let selectEntity = arguments.length > 3 ? arguments[3] : undefined;
|
|
7
|
+
let contexts = arguments.length > 4 ? arguments[4] : undefined;
|
|
7
8
|
this.isSaved = isSaved;
|
|
8
9
|
this.reorderEntity = reorderEntity;
|
|
9
10
|
this.searchEntity = searchEntity;
|
|
10
11
|
this.selectEntity = selectEntity;
|
|
12
|
+
this.contexts = contexts;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
getContexts() {
|
|
16
|
+
return this.contexts;
|
|
11
17
|
}
|
|
12
18
|
|
|
13
19
|
markAsSaved() {
|