@zohodesk/library-platform 1.2.2-exp.2 → 1.2.2-exp.6
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/cc/action-status/Constants.js +5 -0
- package/es/cc/action-status/Events.js +6 -0
- package/es/cc/action-status/Properties.js +29 -0
- package/es/cc/action-status/index.js +3 -0
- package/es/cc/button/Properties.js +28 -0
- package/es/cc/date/Properties.js +15 -0
- package/es/cc/fields/field/Events.js +8 -0
- package/es/cc/fields/field/Properties.js +8 -1
- package/es/cc/form/Properties.js +8 -0
- package/es/cc/highlighted-value/Properties.js +28 -0
- package/es/cc/index.js +1 -0
- package/es/cc/label/Properties.js +12 -5
- package/es/cc/multi-select/Properties.js +8 -1
- package/es/cc/radio-dropdown/Events.js +16 -0
- package/es/cc/section/Properties.js +8 -1
- package/es/cc/select/Properties.js +8 -1
- package/es/cc/table-column-filter/Properties.js +9 -0
- package/es/cc/table-list/Events.js +8 -0
- package/es/cc/textarea/Properties.js +15 -0
- package/es/cc/textbox/Properties.js +8 -1
- package/es/index.js +4 -6
- package/es/library/dot/components/action-location/frameworks/ui/ActionComponentMapping.js +3 -1
- package/es/library/dot/components/action-status/frameworks/ui/ActionStatus.js +12 -0
- package/es/library/dot/components/action-status/frameworks/ui/ActionStatusView.js +57 -0
- package/es/library/dot/components/action-status/frameworks/ui/css/ActionStatus.module.css +61 -0
- package/es/library/dot/components/form/adapters/presenter/TransformState.js +3 -1
- package/es/library/dot/components/form/frameworks/ui/FormView.js +6 -3
- package/es/library/dot/components/form/frameworks/ui/css/Form.module.css +13 -13
- package/es/library/dot/components/form/frameworks/ui/sub-components/Footer.js +16 -7
- package/es/library/dot/components/form/frameworks/ui/sub-components/Header.js +16 -7
- package/es/library/dot/components/form/frameworks/ui/sub-components/Sections.js +4 -2
- package/es/library/dot/components/form-fields/checkbox/frameworks/ui/CheckboxView.js +6 -3
- package/es/library/dot/components/form-fields/currency/frameworks/ui/CurrencyView.js +6 -3
- package/es/library/dot/components/form-fields/date/frameworks/ui/DateView.js +6 -3
- package/es/library/dot/components/form-fields/datetime/frameworks/ui/DateTimeView.js +6 -3
- package/es/library/dot/components/form-fields/decimal/frameworks/ui/DecimalView.js +6 -3
- package/es/library/dot/components/form-fields/email/frameworks/ui/EmailView.js +6 -3
- package/es/library/dot/components/form-fields/field/FieldItem.js +4 -2
- package/es/library/dot/components/form-fields/field/css/FieldItem.module.css +2 -2
- package/es/library/dot/components/form-fields/lookup/frameworks/ui/LookupView.js +6 -3
- package/es/library/dot/components/form-fields/multi-select/frameworks/ui/MultiSelectView.js +7 -4
- package/es/library/dot/components/form-fields/number/frameworks/ui/NumberView.js +6 -3
- package/es/library/dot/components/form-fields/percentage/frameworks/ui/PercentageView.js +7 -4
- package/es/library/dot/components/form-fields/phone/frameworks/ui/PhoneView.js +6 -3
- package/es/library/dot/components/form-fields/pick-list/frameworks/ui/PickListView.js +7 -4
- package/es/library/dot/components/form-fields/textarea/frameworks/ui/TextAreaView.js +6 -3
- package/es/library/dot/components/form-fields/textbox/frameworks/ui/TextBoxView.js +6 -3
- package/es/library/dot/components/form-fields/url/frameworks/ui/UrlView.js +6 -3
- package/es/library/dot/components/section/frameworks/ui/RenderField.js +3 -1
- package/es/library/dot/components/section/frameworks/ui/SectionView.js +11 -6
- package/es/library/dot/components/section/frameworks/ui/css/Section.module.css +3 -3
- package/es/library/dot/components/table-list/adapters/controllers/FieldChangeController.js +4 -2
- package/es/library/dot/components/table-list/frameworks/ui/TableListView.js +8 -4
- package/es/library/dot/components/table-list/frameworks/ui/css/TableList.module.css +25 -25
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/Header.js +6 -4
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/HeaderData.js +11 -6
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/MassAction.js +11 -5
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/Row.js +8 -4
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/RowActions.js +12 -5
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/RowData.js +12 -4
- package/es/library/dot/legacy-to-new-arch/breadcrumb/frameworks/ui/css/Breadcrumb.module.css +4 -4
- package/es/library/dot/legacy-to-new-arch/button/frameworks/ui/ButtonView.js +17 -2
- package/es/library/dot/legacy-to-new-arch/date/frameworks/ui/DateView.js +10 -4
- package/es/library/dot/legacy-to-new-arch/date/frameworks/ui/css/DateView.module.css +1 -1
- package/es/library/dot/legacy-to-new-arch/highlighted-value/frameworks/ui/HighlightedValueView.js +13 -2
- package/es/library/dot/legacy-to-new-arch/highlighted-value/frameworks/ui/css/HighlightedValue.module.css +4 -0
- package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/LabelView.js +11 -5
- package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/css/Label.module.css +4 -4
- package/es/library/dot/legacy-to-new-arch/multi-select/frameworks/ui/MultiSelectView.js +21 -8
- package/es/library/dot/legacy-to-new-arch/multi-select/frameworks/ui/css/MultiSelectView.module.css +7 -7
- package/es/library/dot/legacy-to-new-arch/radio-dropdown/frameworks/ui/RadioDropdownView.js +3 -1
- package/es/library/dot/legacy-to-new-arch/radio-dropdown/frameworks/ui/css/RadioDropdown.module.css +4 -4
- package/es/library/dot/legacy-to-new-arch/select/frameworks/ui/SelectView.js +18 -8
- package/es/library/dot/legacy-to-new-arch/select/frameworks/ui/css/Select.module.css +2 -2
- package/es/library/dot/legacy-to-new-arch/table-column-chooser/frameworks/ui/css/TableColumnChooserView.module.css +1 -1
- package/es/library/dot/legacy-to-new-arch/table-column-filter/frameworks/ui/EventHandlersFactory.js +26 -0
- package/es/library/dot/legacy-to-new-arch/table-column-filter/frameworks/ui/TableColumnFilter.js +19 -1
- package/es/library/dot/legacy-to-new-arch/table-column-filter/frameworks/ui/TableColumnFilterView.js +3 -1
- package/es/library/dot/legacy-to-new-arch/table-field-components/checkbox-field/frameworks/ui/EventHandlersFactory.js +2 -1
- package/es/library/dot/legacy-to-new-arch/table-field-components/highlighted-value-field/frameworks/ui/HighlightedValueFieldView.js +8 -2
- package/es/library/dot/legacy-to-new-arch/table-field-components/radio-dropdown-field/frameworks/ui/EventHandlersFactory.js +4 -2
- package/es/library/dot/legacy-to-new-arch/table-field-components/radio-dropdown-field/frameworks/ui/css/RadioDropdownField.module.css +1 -1
- package/es/library/dot/legacy-to-new-arch/table-field-components/switch-field/frameworks/ui/EventHandlersFactory.js +2 -1
- package/es/library/dot/legacy-to-new-arch/text-area/frameworks/ui/TextAreaView.js +10 -4
- package/es/library/dot/legacy-to-new-arch/text-area/frameworks/ui/css/TextAreaView.module.css +3 -3
- package/es/library/dot/legacy-to-new-arch/textbox/frameworks/ui/TextBoxView.js +11 -5
- package/es/platform/client-actions/behaviour/zclient-actions/adapters/resources/__test__/ClientActionsFetchSDK.test.js +183 -0
- package/es/platform/client-actions/cc/action-event-mediator/Properties.js +0 -43
- package/es/platform/client-actions/cc/client-actions-renderer/Properties.js +58 -0
- package/es/platform/client-actions/cc/client-actions-renderer/ViewMetaSchema.js +17 -0
- package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/ClientActionsAdapter.js +1 -2
- package/es/platform/client-actions/components/client-actions-renderer/adapters/presenters/ClientActionsRendererTranslator.js +24 -0
- package/es/platform/client-actions/components/client-actions-renderer/domain/entities/ClientActionsRendererViewProps.js +1 -0
- package/es/platform/client-actions/components/client-actions-renderer/domain/entities/Context.js +1 -0
- package/es/platform/client-actions/components/client-actions-renderer/domain/entities/State.js +1 -0
- package/es/platform/client-actions/components/client-actions-renderer/frameworks/ui/client-actions-renderer/ClientActionsRenderer.js +11 -0
- package/es/platform/client-actions/components/client-actions-renderer/frameworks/ui/client-actions-renderer/ClientActionsRenderer.module.css +23 -0
- package/es/platform/client-actions/components/client-actions-renderer/frameworks/ui/client-actions-renderer/ClientActionsRendererView.js +25 -0
- package/es/platform/client-actions/components/client-actions-renderer/frameworks/ui/client-actions-renderer/views/DefaultActionsRendererView.js +66 -0
- package/es/platform/client-actions/components/{row-actions-renderer/frameworks/ui/MoreActions → client-actions-renderer/frameworks/ui/more-actions-renderer}/MoreActionsRenderer.js +3 -4
- package/es/platform/client-actions/components/{row-actions-renderer/frameworks/ui/MoreActions → client-actions-renderer/frameworks/ui/more-actions-renderer}/MoreActionsRendererView.js +32 -30
- package/es/platform/client-actions/components/interfaces/ActionViewModel.js +7 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/adapters/resources/__test__/ClientScriptsFetchSDK.test.js +163 -0
- package/es/platform/client-scripts/cc/zclient-scripts-execution/clientScriptsSchema.js +4 -1
- package/es/platform/components/form-connected/frameworks/FormConnectedView.js +2 -0
- package/es/platform/components/smart-action-band/adapters/presenters/ActionBandTranslator.js +7 -10
- package/es/platform/components/smart-action-band/frameworks/SmartActionBandView.js +17 -5
- package/es/platform/data-source/http-template/getAvailableFields.js +4 -2
- package/es/platform/zform/adapters/presenter/FormTranslator.js +8 -12
- package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +10 -14
- package/es/platform/zform/adapters/presenter/translators/fields/BooleanFieldTranslator.js +4 -2
- package/es/platform/zform/adapters/presenter/translators/fields/CurrencyFieldTranslator.js +2 -1
- package/es/platform/zform/adapters/presenter/translators/fields/DateFieldTranslator.js +4 -2
- package/es/platform/zform/adapters/presenter/translators/fields/DateTimeFieldTranslator.js +4 -2
- package/es/platform/zform/adapters/presenter/translators/fields/DecimalFieldTranslator.js +4 -2
- package/es/platform/zform/adapters/presenter/translators/fields/EmailFieldTranslator.js +4 -2
- package/es/platform/zform/adapters/presenter/translators/fields/LookUpFieldTranslator.js +4 -2
- package/es/platform/zform/adapters/presenter/translators/fields/MultiselectFieldTranslator.js +13 -8
- package/es/platform/zform/adapters/presenter/translators/fields/NumberFieldTranslator.js +4 -2
- package/es/platform/zform/adapters/presenter/translators/fields/PercentageFieldTranslator.js +4 -2
- package/es/platform/zform/adapters/presenter/translators/fields/PhoneFieldTranslator.js +4 -2
- package/es/platform/zform/adapters/presenter/translators/fields/PicklistFieldTranslator.js +15 -12
- package/es/platform/zform/adapters/presenter/translators/fields/TextAreaFieldTranslator.js +4 -2
- package/es/platform/zform/adapters/presenter/translators/fields/TextFieldTranslator.js +4 -2
- package/es/platform/zform/adapters/presenter/translators/fields/URLFieldTranslator.js +4 -2
- package/es/platform/zform/domain/interfaces/IZForm.js +2 -5
- package/es/platform/zform/domain/interfaces/ValidationEvents.js +4 -0
- package/es/platform/zlist/adapters/presenters/SelectionTranslator.js +2 -4
- package/es/platform/zlist/adapters/presenters/TableTranslator.js +6 -1
- package/es/platform/zlist/adapters/presenters/translators/ColumnTranslator.js +7 -1
- package/es/platform/zlist/adapters/presenters/translators/Header.js +7 -6
- package/es/platform/zlist/adapters/presenters/translators/Row.js +6 -5
- package/es/platform/zlist/adapters/presenters/translators/fields/DateFieldTranslator.js +7 -3
- package/es/platform/zlist/adapters/presenters/translators/fields/DateTimeFieldTranslator.js +7 -3
- package/package.json +19 -6
- package/es/.DS_Store +0 -0
- package/es/library/custom-component/frameworks/json-schema-validator/Validator.js +0 -1
- package/es/platform/.DS_Store +0 -0
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/AdaptiveRowActions/AdaptiveRowActionsRenderer.js +0 -12
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/AdaptiveRowActions/AdaptiveRowActionsRendererView.js +0 -42
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActions/RowActionsRenderer.js +0 -12
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActions/RowActionsRenderer.module.css +0 -23
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActions/RowActionsRendererView.js +0 -37
- /package/es/platform/client-actions/components/{row-actions-renderer/domain/entities/interfaces/IState.js → client-actions-renderer/domain/entities/ClientActionsRendererDatatype.js} +0 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import ClientScriptsFetchSDK from "../ClientScriptsFetchSDK";
|
|
2
|
+
const getApiDetailsMock = jest.fn();
|
|
3
|
+
jest.mock("../../../../../../zdata-source/domain/entities/APITemplate", () => ({
|
|
4
|
+
__esModule: true,
|
|
5
|
+
default: jest.fn().mockImplementation(() => ({
|
|
6
|
+
getApiDetails: getApiDetailsMock
|
|
7
|
+
}))
|
|
8
|
+
}));
|
|
9
|
+
|
|
10
|
+
const createScript = function () {
|
|
11
|
+
let overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
12
|
+
return {
|
|
13
|
+
id: 'script-1',
|
|
14
|
+
name: 'sample-script',
|
|
15
|
+
...overrides
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
describe('ClientScriptsFetchSDK', () => {
|
|
20
|
+
let sdk;
|
|
21
|
+
const originalWindow = global.window;
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
getApiDetailsMock.mockReturnValue({
|
|
24
|
+
url: '/supportapi/zd/acme/api/v1/clientScripts?from=0&limit=50',
|
|
25
|
+
method: 'GET',
|
|
26
|
+
options: {
|
|
27
|
+
method: 'GET'
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
global.window = {
|
|
31
|
+
currentOrg: {
|
|
32
|
+
portalName: 'acme',
|
|
33
|
+
id: '1001'
|
|
34
|
+
},
|
|
35
|
+
fetch: jest.fn()
|
|
36
|
+
};
|
|
37
|
+
sdk = new ClientScriptsFetchSDK();
|
|
38
|
+
});
|
|
39
|
+
afterEach(() => {
|
|
40
|
+
jest.clearAllMocks();
|
|
41
|
+
global.window = originalWindow;
|
|
42
|
+
});
|
|
43
|
+
describe('getClientScriptsAPIDetails', () => {
|
|
44
|
+
test('builds API details with org context and headers', () => {
|
|
45
|
+
const details = sdk.getClientScriptsAPIDetails({
|
|
46
|
+
from: 0,
|
|
47
|
+
limit: 50
|
|
48
|
+
});
|
|
49
|
+
expect(getApiDetailsMock).toHaveBeenCalledWith(expect.objectContaining({
|
|
50
|
+
from: 0,
|
|
51
|
+
limit: 50,
|
|
52
|
+
servicePrefix: 'supportapi/zd',
|
|
53
|
+
orgName: 'acme'
|
|
54
|
+
}));
|
|
55
|
+
expect(details.url).toContain('/supportapi/zd/acme/api/v1/clientScripts');
|
|
56
|
+
expect(details.method).toBe('GET');
|
|
57
|
+
expect(details.options.method).toBe('GET');
|
|
58
|
+
expect(details.options.headers.orgId).toBe('1001');
|
|
59
|
+
});
|
|
60
|
+
test('handles boundary pagination values without failing', () => {
|
|
61
|
+
const details = sdk.getClientScriptsAPIDetails({
|
|
62
|
+
from: 0,
|
|
63
|
+
limit: 0
|
|
64
|
+
});
|
|
65
|
+
expect(details.url).toContain('/supportapi/zd/acme/api/v1/clientScripts');
|
|
66
|
+
expect(details.options.method).toBe(details.method);
|
|
67
|
+
});
|
|
68
|
+
test('handles large pagination values without failing', () => {
|
|
69
|
+
const details = sdk.getClientScriptsAPIDetails({
|
|
70
|
+
from: 999999,
|
|
71
|
+
limit: 100000
|
|
72
|
+
});
|
|
73
|
+
expect(details.method).toBe('GET');
|
|
74
|
+
expect(details.options.headers.orgId).toBe('1001');
|
|
75
|
+
});
|
|
76
|
+
test('throws when currentOrg is missing', () => {
|
|
77
|
+
delete global.window.currentOrg;
|
|
78
|
+
expect(() => sdk.getClientScriptsAPIDetails({
|
|
79
|
+
from: 0,
|
|
80
|
+
limit: 50
|
|
81
|
+
})).toThrow();
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
describe('fetchClientScripts', () => {
|
|
85
|
+
const validParams = {
|
|
86
|
+
from: 0,
|
|
87
|
+
limit: 50,
|
|
88
|
+
components: 'smartTable',
|
|
89
|
+
modules: 'tickets'
|
|
90
|
+
};
|
|
91
|
+
test('resolves scripts array on successful fetch/json', async () => {
|
|
92
|
+
const payload = [createScript(), createScript({
|
|
93
|
+
id: 'script-2'
|
|
94
|
+
})];
|
|
95
|
+
global.window.fetch.mockResolvedValue({
|
|
96
|
+
json: jest.fn().mockResolvedValue(payload)
|
|
97
|
+
});
|
|
98
|
+
const result = await sdk.fetchClientScripts(validParams);
|
|
99
|
+
expect(global.window.fetch).toHaveBeenCalledTimes(1);
|
|
100
|
+
const [url, options] = global.window.fetch.mock.calls[0];
|
|
101
|
+
expect(url).toContain('/supportapi/zd/acme/api/v1/clientScripts');
|
|
102
|
+
expect(options.headers.orgId).toBe('1001');
|
|
103
|
+
expect(result).toEqual(payload);
|
|
104
|
+
});
|
|
105
|
+
test('passes through API details returned by getClientScriptsAPIDetails', async () => {
|
|
106
|
+
const detailsSpy = jest.spyOn(sdk, 'getClientScriptsAPIDetails').mockReturnValue({
|
|
107
|
+
url: '/custom-client-scripts-url',
|
|
108
|
+
method: 'POST',
|
|
109
|
+
options: {
|
|
110
|
+
method: 'POST',
|
|
111
|
+
headers: {
|
|
112
|
+
orgId: 'custom-org'
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
global.window.fetch.mockResolvedValue({
|
|
117
|
+
json: jest.fn().mockResolvedValue([])
|
|
118
|
+
});
|
|
119
|
+
await sdk.fetchClientScripts(validParams);
|
|
120
|
+
expect(detailsSpy).toHaveBeenCalledWith(validParams);
|
|
121
|
+
expect(global.window.fetch).toHaveBeenCalledWith('/custom-client-scripts-url', expect.objectContaining({
|
|
122
|
+
method: 'POST'
|
|
123
|
+
}));
|
|
124
|
+
});
|
|
125
|
+
test('resolves empty array for empty payload', async () => {
|
|
126
|
+
global.window.fetch.mockResolvedValue({
|
|
127
|
+
json: jest.fn().mockResolvedValue([])
|
|
128
|
+
});
|
|
129
|
+
const result = await sdk.fetchClientScripts(validParams);
|
|
130
|
+
expect(result).toEqual([]);
|
|
131
|
+
});
|
|
132
|
+
test('rejects when fetch fails', async () => {
|
|
133
|
+
const error = new Error('Network down');
|
|
134
|
+
global.window.fetch.mockRejectedValue(error);
|
|
135
|
+
await expect(sdk.fetchClientScripts(validParams)).rejects.toThrow('Network down');
|
|
136
|
+
});
|
|
137
|
+
test('rejects when response json parsing fails', async () => {
|
|
138
|
+
global.window.fetch.mockResolvedValue({
|
|
139
|
+
json: jest.fn().mockRejectedValue(new Error('Invalid JSON'))
|
|
140
|
+
});
|
|
141
|
+
await expect(sdk.fetchClientScripts(validParams)).rejects.toThrow('Invalid JSON');
|
|
142
|
+
});
|
|
143
|
+
test('resolves non-array payload as-is (current behavior)', async () => {
|
|
144
|
+
const payload = {
|
|
145
|
+
unsupported: true
|
|
146
|
+
};
|
|
147
|
+
global.window.fetch.mockResolvedValue({
|
|
148
|
+
json: jest.fn().mockResolvedValue(payload)
|
|
149
|
+
});
|
|
150
|
+
const result = await sdk.fetchClientScripts(validParams);
|
|
151
|
+
expect(result).toEqual(payload);
|
|
152
|
+
});
|
|
153
|
+
test('throws when window.fetch is missing', async () => {
|
|
154
|
+
delete global.window.fetch;
|
|
155
|
+
await expect(sdk.fetchClientScripts(validParams)).rejects.toThrow();
|
|
156
|
+
});
|
|
157
|
+
test('rejects when getClientScriptsAPIDetails throws', async () => {
|
|
158
|
+
delete global.window.currentOrg;
|
|
159
|
+
await expect(sdk.fetchClientScripts(validParams)).rejects.toThrow();
|
|
160
|
+
expect(global.window.fetch).not.toHaveBeenCalled();
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
});
|
|
@@ -16,6 +16,7 @@ function View(_ref, ref) {
|
|
|
16
16
|
headerRightActions,
|
|
17
17
|
footerLeftActions,
|
|
18
18
|
footerRightActions,
|
|
19
|
+
context,
|
|
19
20
|
clientScripts
|
|
20
21
|
} = state.viewModel;
|
|
21
22
|
return /*#__PURE__*/React.createElement(Form, {
|
|
@@ -28,6 +29,7 @@ function View(_ref, ref) {
|
|
|
28
29
|
headerRightActions: headerRightActions,
|
|
29
30
|
footerLeftActions: footerLeftActions,
|
|
30
31
|
footerRightActions: footerRightActions,
|
|
32
|
+
context: context,
|
|
31
33
|
rightPanel: rightPanel,
|
|
32
34
|
clientScripts: clientScripts
|
|
33
35
|
});
|
package/es/platform/components/smart-action-band/adapters/presenters/ActionBandTranslator.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import ClientActionsTranslator from "../../../../client-actions/translators/client-actions-translator";
|
|
2
1
|
import DefaultClientActions from "./utils/DefaultClientActions";
|
|
3
2
|
import { ActionBandLocations } from "../../../../../bc/action-band/Constants";
|
|
4
3
|
import { i18NProviderUtils } from '@zohodesk/i18n';
|
|
@@ -56,14 +55,11 @@ export default class ActionBandTranslator {
|
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
const mappedClientActions = mapper(combinedClientActions || []);
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
65
|
-
transformedClientActions[key] = bandActions;
|
|
66
|
-
});
|
|
58
|
+
const clientActionsContext = { ...context,
|
|
59
|
+
defaultSortField: sortConfig.defaultSortField,
|
|
60
|
+
instanceName,
|
|
61
|
+
moduleName
|
|
62
|
+
};
|
|
67
63
|
const {
|
|
68
64
|
clientScripts,
|
|
69
65
|
isFetching: isClientScriptsFetching
|
|
@@ -71,9 +67,10 @@ export default class ActionBandTranslator {
|
|
|
71
67
|
const {
|
|
72
68
|
actionBandLeftActions,
|
|
73
69
|
actionBandRightActions
|
|
74
|
-
} =
|
|
70
|
+
} = mappedClientActions;
|
|
75
71
|
return { ...state,
|
|
76
72
|
...zclientAction,
|
|
73
|
+
context: clientActionsContext,
|
|
77
74
|
viewModel: {
|
|
78
75
|
actionBandLeftActions,
|
|
79
76
|
actionBandRightActions,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import ActionBand from '@zohodesk-private/desk-components/es/ActionBand/ActionBand';
|
|
4
|
-
import
|
|
4
|
+
import ClientActionsRenderer from "../../../client-actions/components/client-actions-renderer/frameworks/ui/client-actions-renderer/ClientActionsRenderer";
|
|
5
|
+
import { ActionViewGap, Layout } from "../../../client-actions/components/interfaces/ActionViewModel";
|
|
5
6
|
|
|
6
7
|
function View(_ref, ref) {
|
|
7
8
|
let {
|
|
@@ -12,20 +13,31 @@ function View(_ref, ref) {
|
|
|
12
13
|
actionBandRightActions,
|
|
13
14
|
clientScripts
|
|
14
15
|
} = state.viewModel;
|
|
16
|
+
const {
|
|
17
|
+
context
|
|
18
|
+
} = state;
|
|
15
19
|
|
|
16
20
|
const renderLeftActions = () => {
|
|
17
|
-
return /*#__PURE__*/React.createElement(
|
|
21
|
+
return /*#__PURE__*/React.createElement(ClientActionsRenderer, {
|
|
18
22
|
actions: actionBandLeftActions,
|
|
19
23
|
clientScripts: clientScripts,
|
|
20
|
-
|
|
24
|
+
context: context,
|
|
25
|
+
viewMeta: {
|
|
26
|
+
layout: Layout.HORIZONTAL,
|
|
27
|
+
gap: ActionViewGap.XLARGE
|
|
28
|
+
}
|
|
21
29
|
});
|
|
22
30
|
};
|
|
23
31
|
|
|
24
32
|
const renderRightActions = () => {
|
|
25
|
-
return /*#__PURE__*/React.createElement(
|
|
33
|
+
return /*#__PURE__*/React.createElement(ClientActionsRenderer, {
|
|
26
34
|
actions: actionBandRightActions,
|
|
27
35
|
clientScripts: clientScripts,
|
|
28
|
-
|
|
36
|
+
context: context,
|
|
37
|
+
viewMeta: {
|
|
38
|
+
layout: Layout.HORIZONTAL,
|
|
39
|
+
gap: ActionViewGap.XLARGE
|
|
40
|
+
}
|
|
29
41
|
});
|
|
30
42
|
};
|
|
31
43
|
|
|
@@ -39,13 +39,15 @@ let getAvailableFields = {
|
|
|
39
39
|
const res = await fetch(availableFieldsUrl, {
|
|
40
40
|
method: 'GET',
|
|
41
41
|
headers
|
|
42
|
-
});
|
|
42
|
+
}); // fetch-ignore
|
|
43
|
+
|
|
43
44
|
const availableFields = await getValidJsonResArray(res, 'fields');
|
|
44
45
|
const organizationFieldsUrl = `/${servicePrefix}/${orgName}/api/v1/organizationFields?departmentId=${departmentId}&module=${module}`;
|
|
45
46
|
const ores = await fetch(organizationFieldsUrl, {
|
|
46
47
|
method: 'GET',
|
|
47
48
|
headers
|
|
48
|
-
});
|
|
49
|
+
}); // fetch-ignore
|
|
50
|
+
|
|
49
51
|
const organizationFields = await getValidJsonResArray(ores, 'data');
|
|
50
52
|
return {
|
|
51
53
|
fields: availableFields.map(field => {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import ClientActionsTranslator from "../../../client-actions/translators/client-actions-translator";
|
|
2
1
|
import SectionTranslator from "./translators/SectionTranslator";
|
|
3
2
|
import DefaultFormClientActions from "./utils/DefaultClientActions";
|
|
4
3
|
import { filterClientActionsByLocation } from "../../../client-actions/behaviour/zclient-actions/adapters/presenters/FilterUtils";
|
|
@@ -19,7 +18,7 @@ export default class FormTranslator {
|
|
|
19
18
|
zclientAction,
|
|
20
19
|
zclientScriptsEventMapping
|
|
21
20
|
} = state.behaviours;
|
|
22
|
-
|
|
21
|
+
let {
|
|
23
22
|
context
|
|
24
23
|
} = state.behaviours.appContext;
|
|
25
24
|
const {
|
|
@@ -46,6 +45,11 @@ export default class FormTranslator {
|
|
|
46
45
|
};
|
|
47
46
|
const initialRecordData = zform.initialRecordData ? zform.initialRecordData : {
|
|
48
47
|
cf: {}
|
|
48
|
+
}; // @ts-ignore
|
|
49
|
+
|
|
50
|
+
context = { ...context,
|
|
51
|
+
instanceName,
|
|
52
|
+
moduleName
|
|
49
53
|
};
|
|
50
54
|
const actionContext = { ...context,
|
|
51
55
|
mode: zform.mode,
|
|
@@ -56,16 +60,7 @@ export default class FormTranslator {
|
|
|
56
60
|
};
|
|
57
61
|
Object.entries(mappedClientActions).forEach(_ref => {
|
|
58
62
|
let [key, value] = _ref;
|
|
59
|
-
|
|
60
|
-
if (isFooterEnabled && (key === 'footerLeftActions' || key === 'footerRightActions')) {
|
|
61
|
-
let footerActions = ClientActionsTranslator.transform(value, instanceName, moduleName, actionContext);
|
|
62
|
-
transformedClientActions[key] = footerActions;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (isHeaderEnabled && (key === 'headerLeftActions' || key === 'headerRightActions')) {
|
|
66
|
-
let headerActions = ClientActionsTranslator.transform(value, instanceName, moduleName, actionContext);
|
|
67
|
-
transformedClientActions[key] = headerActions;
|
|
68
|
-
}
|
|
63
|
+
transformedClientActions[key] = value;
|
|
69
64
|
});
|
|
70
65
|
const {
|
|
71
66
|
clientScripts,
|
|
@@ -143,6 +138,7 @@ export default class FormTranslator {
|
|
|
143
138
|
headerRightActions,
|
|
144
139
|
footerLeftActions,
|
|
145
140
|
footerRightActions,
|
|
141
|
+
context: actionContext,
|
|
146
142
|
isLoading: false,
|
|
147
143
|
rightPanel,
|
|
148
144
|
clientScripts
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { DefaultFormSectionUIType, fieldTypeToUIType } from "../../../../../cc/fields/field/FormDefaultUIType";
|
|
2
2
|
import * as FieldTranslators from "./fields";
|
|
3
|
-
import ClientActionsTranslator from "../../../../client-actions/translators/client-actions-translator";
|
|
4
3
|
import { getDefaultFieldEphiActionTemplate, getDefaultFieldInfoActionTemplate } from "../utils/DefaultClientActions";
|
|
5
4
|
import sanitizeHtmlString from "../utils/sanitizeHtmlString";
|
|
6
5
|
|
|
@@ -30,10 +29,7 @@ function SectionTranslator(_ref) {
|
|
|
30
29
|
const transformedClientActions = {};
|
|
31
30
|
Object.entries(sectionFieldOptionActions).forEach(_ref2 => {
|
|
32
31
|
let [key, value] = _ref2;
|
|
33
|
-
|
|
34
|
-
...section
|
|
35
|
-
});
|
|
36
|
-
transformedClientActions[key] = headerActions;
|
|
32
|
+
transformedClientActions[key] = value;
|
|
37
33
|
});
|
|
38
34
|
const defaultViewModel = {
|
|
39
35
|
type: mapping?.UIComponentName ? mapping.UIComponentName : DefaultFormSectionUIType,
|
|
@@ -45,6 +41,9 @@ function SectionTranslator(_ref) {
|
|
|
45
41
|
}),
|
|
46
42
|
headerActions: transformedClientActions.sectionHeaderRightActions,
|
|
47
43
|
titleActions: transformedClientActions.sectionTitleRightActions,
|
|
44
|
+
context: { ...context,
|
|
45
|
+
...section
|
|
46
|
+
},
|
|
48
47
|
// headerLeftActions: sectionFieldOptionActions.sectionHeaderLeftActions,
|
|
49
48
|
// headerRightActions: sectionFieldOptionActions.sectionHeaderRightActions,
|
|
50
49
|
// titleLeftActions: sectionFieldOptionActions.sectionTitleLeftActions,
|
|
@@ -89,19 +88,14 @@ function SectionTranslator(_ref) {
|
|
|
89
88
|
const transformedDefaultActions = createEmptyActions();
|
|
90
89
|
Object.entries(defaultActions).forEach(_ref3 => {
|
|
91
90
|
let [key, value] = _ref3;
|
|
92
|
-
|
|
93
|
-
...field
|
|
94
|
-
});
|
|
95
|
-
transformedDefaultActions[key] = transformedDefaultAction;
|
|
91
|
+
transformedDefaultActions[key] = value;
|
|
96
92
|
}); // Transform client actions
|
|
97
93
|
|
|
98
94
|
const transformedActions = createEmptyActions();
|
|
99
95
|
Object.entries(fieldLevelActions).forEach(_ref4 => {
|
|
100
96
|
let [key, value] = _ref4;
|
|
101
|
-
let transformedAction = ClientActionsTranslator.transform(value, instanceName, moduleName, { ...context,
|
|
102
|
-
|
|
103
|
-
});
|
|
104
|
-
transformedActions[key] = transformedAction;
|
|
97
|
+
// let transformedAction = ClientActionsTranslator.transform(value, instanceName, moduleName, { ...context, ...field });
|
|
98
|
+
transformedActions[key] = value;
|
|
105
99
|
}); // Initialize fieldPreModified
|
|
106
100
|
|
|
107
101
|
const fieldPreModified = {};
|
|
@@ -123,7 +117,9 @@ function SectionTranslator(_ref) {
|
|
|
123
117
|
type,
|
|
124
118
|
fieldPreModified,
|
|
125
119
|
uiConfig,
|
|
126
|
-
context,
|
|
120
|
+
context: { ...context,
|
|
121
|
+
...field
|
|
122
|
+
},
|
|
127
123
|
preferences,
|
|
128
124
|
fieldOptionActions,
|
|
129
125
|
instanceName,
|
|
@@ -3,7 +3,8 @@ const BooleanFieldTranslator = _ref => {
|
|
|
3
3
|
field,
|
|
4
4
|
type,
|
|
5
5
|
uiConfig,
|
|
6
|
-
fieldPreModified
|
|
6
|
+
fieldPreModified,
|
|
7
|
+
context
|
|
7
8
|
} = _ref;
|
|
8
9
|
const fieldModified = { ...fieldPreModified,
|
|
9
10
|
id: field.id,
|
|
@@ -16,7 +17,8 @@ const BooleanFieldTranslator = _ref => {
|
|
|
16
17
|
required: field.isMandatory,
|
|
17
18
|
readonly: field.isReadOnly,
|
|
18
19
|
// visibility: field.isVisible
|
|
19
|
-
isVisible: field.isVisible
|
|
20
|
+
isVisible: field.isVisible,
|
|
21
|
+
context
|
|
20
22
|
};
|
|
21
23
|
return fieldModified;
|
|
22
24
|
};
|
|
@@ -26,7 +26,8 @@ const CurrencyFieldTranslator = _ref => {
|
|
|
26
26
|
isVisible: field.isVisible,
|
|
27
27
|
currencyLocale: prefCurrencyLocale || contextCurrencyLocale,
|
|
28
28
|
currencySymbol: prefCurrencySymbol || contextCurrencySymbol,
|
|
29
|
-
errorMessage: field.errorMessage || ''
|
|
29
|
+
errorMessage: field.errorMessage || '',
|
|
30
|
+
context
|
|
30
31
|
};
|
|
31
32
|
return fieldModified;
|
|
32
33
|
};
|
|
@@ -3,7 +3,8 @@ const DateFieldTranslator = _ref => {
|
|
|
3
3
|
field,
|
|
4
4
|
type,
|
|
5
5
|
uiConfig,
|
|
6
|
-
fieldPreModified
|
|
6
|
+
fieldPreModified,
|
|
7
|
+
context
|
|
7
8
|
} = _ref;
|
|
8
9
|
const fieldModified = { ...fieldPreModified,
|
|
9
10
|
id: field.id,
|
|
@@ -16,7 +17,8 @@ const DateFieldTranslator = _ref => {
|
|
|
16
17
|
errorMessage: field.errorMessage || '',
|
|
17
18
|
required: field.isMandatory,
|
|
18
19
|
readonly: field.isReadOnly,
|
|
19
|
-
isVisible: field.isVisible
|
|
20
|
+
isVisible: field.isVisible,
|
|
21
|
+
context
|
|
20
22
|
};
|
|
21
23
|
return fieldModified;
|
|
22
24
|
};
|
|
@@ -3,7 +3,8 @@ const DateTimeFieldTranslator = _ref => {
|
|
|
3
3
|
field,
|
|
4
4
|
type,
|
|
5
5
|
uiConfig,
|
|
6
|
-
fieldPreModified
|
|
6
|
+
fieldPreModified,
|
|
7
|
+
context
|
|
7
8
|
} = _ref;
|
|
8
9
|
const fieldModified = { ...fieldPreModified,
|
|
9
10
|
id: field.id,
|
|
@@ -17,7 +18,8 @@ const DateTimeFieldTranslator = _ref => {
|
|
|
17
18
|
required: field.isMandatory,
|
|
18
19
|
readonly: field.isReadOnly,
|
|
19
20
|
// visibility: field.isVisible
|
|
20
|
-
isVisible: field.isVisible
|
|
21
|
+
isVisible: field.isVisible,
|
|
22
|
+
context
|
|
21
23
|
};
|
|
22
24
|
return fieldModified;
|
|
23
25
|
};
|
|
@@ -3,7 +3,8 @@ const DecimalFieldTranslator = _ref => {
|
|
|
3
3
|
field,
|
|
4
4
|
type,
|
|
5
5
|
fieldPreModified,
|
|
6
|
-
uiConfig
|
|
6
|
+
uiConfig,
|
|
7
|
+
context
|
|
7
8
|
} = _ref;
|
|
8
9
|
const fieldModified = {
|
|
9
10
|
type,
|
|
@@ -19,7 +20,8 @@ const DecimalFieldTranslator = _ref => {
|
|
|
19
20
|
maxLength: field.maxLength,
|
|
20
21
|
readonly: field.isReadOnly,
|
|
21
22
|
isVisible: field.isVisible,
|
|
22
|
-
errorMessage: field.errorMessage || ''
|
|
23
|
+
errorMessage: field.errorMessage || '',
|
|
24
|
+
context
|
|
23
25
|
};
|
|
24
26
|
return fieldModified;
|
|
25
27
|
};
|
|
@@ -3,7 +3,8 @@ const EmailFieldTranslator = _ref => {
|
|
|
3
3
|
field,
|
|
4
4
|
type,
|
|
5
5
|
fieldPreModified,
|
|
6
|
-
uiConfig
|
|
6
|
+
uiConfig,
|
|
7
|
+
context
|
|
7
8
|
} = _ref;
|
|
8
9
|
const fieldModified = {
|
|
9
10
|
type,
|
|
@@ -20,7 +21,8 @@ const EmailFieldTranslator = _ref => {
|
|
|
20
21
|
readonly: field.isReadOnly,
|
|
21
22
|
// visibility: field.isVisible,
|
|
22
23
|
isVisible: field.isVisible,
|
|
23
|
-
errorMessage: field.errorMessage || ''
|
|
24
|
+
errorMessage: field.errorMessage || '',
|
|
25
|
+
context
|
|
24
26
|
};
|
|
25
27
|
return fieldModified;
|
|
26
28
|
};
|
|
@@ -3,7 +3,8 @@ const LookUpFieldTranslator = _ref => {
|
|
|
3
3
|
field,
|
|
4
4
|
type,
|
|
5
5
|
fieldPreModified,
|
|
6
|
-
uiConfig
|
|
6
|
+
uiConfig,
|
|
7
|
+
context
|
|
7
8
|
} = _ref;
|
|
8
9
|
const fieldModified = {
|
|
9
10
|
// Need to check if value is an object or string (ID)
|
|
@@ -23,7 +24,8 @@ const LookUpFieldTranslator = _ref => {
|
|
|
23
24
|
required: field.isMandatory,
|
|
24
25
|
isCustomField: field.isCustomField,
|
|
25
26
|
maxLength: field.maxLength,
|
|
26
|
-
lookup: field.lookup
|
|
27
|
+
lookup: field.lookup,
|
|
28
|
+
context
|
|
27
29
|
};
|
|
28
30
|
return fieldModified;
|
|
29
31
|
};
|
package/es/platform/zform/adapters/presenter/translators/fields/MultiselectFieldTranslator.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import ClientActionsTranslator from "../../../../../client-actions/translators/client-actions-translator";
|
|
2
|
-
|
|
3
1
|
const MultiSelectFieldTranslator = _ref => {
|
|
4
2
|
let {
|
|
5
3
|
field,
|
|
@@ -8,27 +6,33 @@ const MultiSelectFieldTranslator = _ref => {
|
|
|
8
6
|
fieldPreModified,
|
|
9
7
|
fieldOptionActions,
|
|
10
8
|
instanceName,
|
|
11
|
-
moduleName
|
|
9
|
+
moduleName,
|
|
10
|
+
context
|
|
12
11
|
} = _ref;
|
|
13
12
|
const fieldModified = { ...fieldPreModified,
|
|
14
13
|
id: field.id,
|
|
15
14
|
label: field.i18NLabel,
|
|
16
15
|
options: field.pickListValues ? field.pickListValues.map(picklistValue => {
|
|
17
16
|
const optionActions = {};
|
|
17
|
+
let fieldOptionsContext = {};
|
|
18
18
|
Object.entries(fieldOptionActions).forEach(_ref2 => {
|
|
19
19
|
let [key, value] = _ref2;
|
|
20
20
|
const {
|
|
21
21
|
value: _omit,
|
|
22
22
|
...fieldWithoutValue
|
|
23
23
|
} = field;
|
|
24
|
-
optionActions[key] =
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
optionActions[key] = value;
|
|
25
|
+
fieldOptionsContext = { ...picklistValue,
|
|
26
|
+
...fieldWithoutValue,
|
|
27
|
+
instanceName,
|
|
28
|
+
moduleName
|
|
29
|
+
};
|
|
27
30
|
});
|
|
28
31
|
return {
|
|
29
32
|
optionActions: optionActions.fieldOptionRightActions,
|
|
30
33
|
value: picklistValue.value,
|
|
31
|
-
label: picklistValue.value
|
|
34
|
+
label: picklistValue.value,
|
|
35
|
+
context: fieldOptionsContext
|
|
32
36
|
};
|
|
33
37
|
}) : [],
|
|
34
38
|
type,
|
|
@@ -41,7 +45,8 @@ const MultiSelectFieldTranslator = _ref => {
|
|
|
41
45
|
readonly: field.isReadOnly,
|
|
42
46
|
// visibility: field.isVisible,
|
|
43
47
|
isVisible: field.isVisible,
|
|
44
|
-
errorMessage: field.errorMessage || ''
|
|
48
|
+
errorMessage: field.errorMessage || '',
|
|
49
|
+
context
|
|
45
50
|
};
|
|
46
51
|
return fieldModified;
|
|
47
52
|
};
|
|
@@ -3,7 +3,8 @@ const NumberFieldTranslator = _ref => {
|
|
|
3
3
|
field,
|
|
4
4
|
type,
|
|
5
5
|
fieldPreModified,
|
|
6
|
-
uiConfig
|
|
6
|
+
uiConfig,
|
|
7
|
+
context
|
|
7
8
|
} = _ref;
|
|
8
9
|
const fieldModified = {
|
|
9
10
|
type,
|
|
@@ -20,7 +21,8 @@ const NumberFieldTranslator = _ref => {
|
|
|
20
21
|
readonly: field.isReadOnly,
|
|
21
22
|
// visibility: field.isVisible,
|
|
22
23
|
isVisible: field.isVisible,
|
|
23
|
-
errorMessage: field.errorMessage || ''
|
|
24
|
+
errorMessage: field.errorMessage || '',
|
|
25
|
+
context
|
|
24
26
|
};
|
|
25
27
|
return fieldModified;
|
|
26
28
|
};
|
package/es/platform/zform/adapters/presenter/translators/fields/PercentageFieldTranslator.js
CHANGED
|
@@ -3,7 +3,8 @@ const PercentageFieldTranslator = _ref => {
|
|
|
3
3
|
field,
|
|
4
4
|
type,
|
|
5
5
|
fieldPreModified,
|
|
6
|
-
uiConfig
|
|
6
|
+
uiConfig,
|
|
7
|
+
context
|
|
7
8
|
} = _ref;
|
|
8
9
|
const fieldModified = {
|
|
9
10
|
type,
|
|
@@ -19,7 +20,8 @@ const PercentageFieldTranslator = _ref => {
|
|
|
19
20
|
readonly: field.isReadOnly,
|
|
20
21
|
// visibility: field.isVisible,
|
|
21
22
|
isVisible: field.isVisible,
|
|
22
|
-
errorMessage: field.errorMessage || ''
|
|
23
|
+
errorMessage: field.errorMessage || '',
|
|
24
|
+
context
|
|
23
25
|
};
|
|
24
26
|
return fieldModified;
|
|
25
27
|
};
|
|
@@ -3,7 +3,8 @@ const PhoneFieldTranslator = _ref => {
|
|
|
3
3
|
field,
|
|
4
4
|
type,
|
|
5
5
|
fieldPreModified,
|
|
6
|
-
uiConfig
|
|
6
|
+
uiConfig,
|
|
7
|
+
context
|
|
7
8
|
} = _ref;
|
|
8
9
|
const fieldModified = {
|
|
9
10
|
type,
|
|
@@ -19,7 +20,8 @@ const PhoneFieldTranslator = _ref => {
|
|
|
19
20
|
maxLength: field.maxLength,
|
|
20
21
|
readonly: field.isReadOnly,
|
|
21
22
|
isVisible: field.isVisible,
|
|
22
|
-
errorMessage: field.errorMessage || ''
|
|
23
|
+
errorMessage: field.errorMessage || '',
|
|
24
|
+
context
|
|
23
25
|
};
|
|
24
26
|
return fieldModified;
|
|
25
27
|
};
|