@zohodesk/library-platform 1.1.3-exp.3 → 1.1.3-exp.4
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/zhttp/Errors.js +14 -0
- package/es/bc/zhttp/index.js +3 -1
- package/es/bc/zlist/Constants.js +8 -1
- package/es/bc/zlist/Events.js +140 -0
- package/es/bc/zlist/index.js +2 -1
- package/es/bc/zrecord/Constants.js +3 -1
- package/es/cc/component/FallbackView.js +1 -0
- package/es/cc/fields/currency/Model.js +2 -0
- package/es/cc/fields/field/Properties.js +1 -1
- package/es/cc/fields/formula/Model.js +5 -0
- package/es/cc/index.js +1 -0
- package/es/cc/link/Properties.js +0 -1
- package/es/cc/table-connected/ErrorEventType.js +32 -0
- package/es/cc/table-connected/Events.js +96 -0
- package/es/cc/table-connected/Properties.js +16 -0
- package/es/cc/table-connected/SdkContract.js +120 -0
- package/es/cc/table-connected/constants/Events.js +2 -0
- package/es/cc/table-connected/index.js +3 -1
- package/es/cc/table-list/Constants.js +4 -0
- package/es/cc/table-list/Properties.js +25 -0
- package/es/cc/table-list/row/Properties.js +44 -0
- package/es/index.js +2 -1
- package/es/library/custom-component/adapters/gateways/event-manager/EventManager.js +116 -4
- package/es/library/custom-component/applications/interfaces/gateways/ISchemaValidator.js +1 -0
- package/es/library/custom-component/applications/usecases/InitializeUseCase.js +3 -2
- package/es/library/custom-component/applications/usecases/UpdatePropertyUseCase.js +3 -2
- package/es/library/custom-component/domain/entities/Component.js +16 -3
- package/es/library/custom-component/domain/entities/Properties.js +19 -1
- package/es/library/custom-component/frameworks/json-schema-validator/Validator.js +36 -1
- package/es/library/custom-component/frameworks/ui/CreateCustomComponent.js +23 -11
- package/es/library/custom-component/frameworks/ui/DependencyFactory.js +4 -3
- package/es/library/dot/components/table-list/frameworks/hooks/useDropIndicator.js +8 -0
- package/es/library/dot/components/table-list/frameworks/hooks/useRowData.js +15 -0
- package/es/library/dot/components/table-list/frameworks/hooks/useTableRowReorder.js +105 -0
- package/es/library/dot/components/table-list/frameworks/ui/TableListView.js +85 -15
- package/es/library/dot/components/table-list/frameworks/ui/css/TableList.module.css +240 -1
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/Header.js +28 -4
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/Rows.js +25 -9
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/MassAction.js +11 -2
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/Row.js +50 -8
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/RowSelection.js +6 -1
- package/es/library/dot/components/table-list/frameworks/utils/getHeaderClasses.js +37 -0
- package/es/library/dot/components/table-list/frameworks/utils/getTableListClassName.js +37 -0
- package/es/library/dot/components/table-list/frameworks/utils/reOrder.js +90 -0
- package/es/library/dot/legacy-to-new-arch/text-area/frameworks/ui/TextAreaView.js +1 -1
- package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/ClientActionsAdapter.js +96 -0
- package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/EventHandlersFactory.js +11 -3
- package/es/platform/client-actions/template-resolver/index.js +1 -0
- package/es/platform/client-actions/translators/context-resolver/index.js +6 -6
- package/es/platform/components/table-connected/adapters/controllers/ColumnChooserOpenedController.js +1 -1
- package/es/platform/components/table-connected/adapters/controllers/ReOrderFinishController.js +21 -0
- package/es/platform/components/table-connected/adapters/resources/ErrorPrinter.js +20 -0
- package/es/platform/components/table-connected/adapters/resources/SmartTableResource.js +85 -0
- package/es/platform/components/table-connected/frameworks/ErrorEventHandlersFactory.js +126 -0
- package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +39 -3
- package/es/platform/components/table-connected/frameworks/ListSdkFactory.js +4 -2
- package/es/platform/components/table-connected/frameworks/TableConnectedFactory.js +2 -0
- package/es/platform/components/table-connected/frameworks/TableConnectedView.js +8 -2
- package/es/platform/data-source/http-template/reOrderRecord.js +44 -0
- package/es/platform/data-source/index.js +2 -0
- package/es/platform/sdk/application/interfaces/gateways/AbstractResource.js +1 -2
- package/es/platform/sdk/domain/entities/ResourceManager.js +1 -1
- package/es/platform/zdata-source/domain/entities/DataSource.js +18 -12
- package/es/platform/zfield/domain/entities/fields-manager/FieldsManager.js +7 -1
- package/es/platform/zform/adapters/presenter/FormTranslator.js +6 -127
- package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +32 -0
- package/es/platform/zform/adapters/presenter/translators/fields/BooleanFieldTranslator.js +20 -0
- package/es/platform/zform/adapters/presenter/translators/fields/CurrencyFieldTranslator.js +29 -0
- package/es/platform/zform/adapters/presenter/translators/fields/DateFieldTranslator.js +20 -0
- package/es/platform/zform/adapters/presenter/translators/fields/DateTimeFieldTranslator.js +21 -0
- package/es/platform/zform/adapters/presenter/translators/fields/DecimalFieldTranslator.js +29 -0
- package/es/platform/zform/adapters/presenter/translators/fields/EmailFieldTranslator.js +30 -0
- package/es/platform/zform/adapters/presenter/translators/fields/LookUpFieldTranslator.js +30 -0
- package/es/platform/zform/adapters/presenter/translators/fields/MultiselectFieldTranslator.js +29 -0
- package/es/platform/zform/adapters/presenter/translators/fields/NumberFieldTranslator.js +30 -0
- package/es/platform/zform/adapters/presenter/translators/fields/PercentageFieldTranslator.js +30 -0
- package/es/platform/zform/adapters/presenter/translators/fields/PhoneFieldTranslator.js +29 -0
- package/es/platform/zform/adapters/presenter/translators/fields/PicklistFieldTranslator.js +29 -0
- package/es/platform/zform/adapters/presenter/translators/fields/TextAreaFieldTranslator.js +30 -0
- package/es/platform/zform/adapters/presenter/translators/fields/TextFieldTranslator.js +27 -0
- package/es/platform/zform/adapters/presenter/translators/fields/URLFieldTranslator.js +30 -0
- package/es/platform/zform/adapters/presenter/translators/fields/index.js +15 -0
- package/es/platform/zform/applications/usecases/MyFormSuccessUseCase.js +3 -1
- package/es/platform/zform/domain/ZField.js +61 -16
- package/es/platform/zform/domain/ZSection.js +20 -7
- package/es/platform/zhttp/applications/usecases/FetchUseCase.js +111 -66
- package/es/platform/zlist/adapters/controllers/FieldExecuteFailedController.js +25 -0
- package/es/platform/zlist/adapters/controllers/ReOrderController.js +25 -0
- package/es/platform/zlist/adapters/controllers/ReOrderFailedController.js +26 -0
- package/es/platform/zlist/adapters/gateways/Repository.js +12 -2
- package/es/platform/zlist/adapters/gateways/Service.js +8 -0
- package/es/platform/zlist/adapters/presenters/TableTranslator.js +15 -4
- package/es/platform/zlist/adapters/presenters/translators/ColumnTranslator.js +11 -12
- package/es/platform/zlist/adapters/presenters/translators/EmptyViewModel.js +2 -1
- package/es/platform/zlist/adapters/presenters/translators/Header.js +3 -2
- package/es/platform/zlist/adapters/presenters/translators/HeadersTranslator.js +3 -2
- package/es/platform/zlist/adapters/presenters/translators/fields/CurrencyFieldTranslator.js +1 -0
- package/es/platform/zlist/adapters/presenters/translators/fields/FormulaFieldTranslator.js +3 -0
- package/es/platform/zlist/adapters/presenters/utils/DefaultClientActions.js +1 -1
- package/es/platform/zlist/applications/entities-factory/ListFactory.js +3 -2
- package/es/platform/zlist/applications/interfaces/input/ReOrderRecordUseCaseInput.js +1 -0
- package/es/platform/zlist/applications/usecases/FetchMoreUseCase.js +1 -1
- package/es/platform/zlist/applications/usecases/ReOrderFailedUseCase.js +22 -0
- package/es/platform/zlist/applications/usecases/ReOrderUseCase.js +25 -0
- package/es/platform/zlist/applications/usecases/RecordExecuteFailedUseCase.js +3 -2
- package/es/platform/zlist/applications/usecases/RecordSuccessCallbackUsecase.js +24 -3
- package/es/platform/zlist/domain/entities/List.js +61 -48
- package/es/platform/zlist/domain/entities/ListErrorState.js +167 -0
- package/es/platform/zlist/frameworks/EventHandlersFactory.js +13 -3
- package/es/platform/zlist/frameworks/ZListBehaviourFactory.js +6 -0
- package/es/platform/zrecord/domain/entities/GetReOrderRecordsStrategy.js +40 -0
- package/es/platform/zrecord/domain/entities/RecordsManager.js +3 -1
- package/package.json +6 -3
|
@@ -18,8 +18,11 @@ export default class ZField {
|
|
|
18
18
|
isMandatory,
|
|
19
19
|
value,
|
|
20
20
|
errorMessage,
|
|
21
|
-
|
|
21
|
+
isVisible = true,
|
|
22
22
|
pickListValues,
|
|
23
|
+
toolTip,
|
|
24
|
+
toolTipType,
|
|
25
|
+
defaultValue,
|
|
23
26
|
subType
|
|
24
27
|
} = _ref;
|
|
25
28
|
|
|
@@ -53,7 +56,7 @@ export default class ZField {
|
|
|
53
56
|
|
|
54
57
|
_defineProperty(this, "errorMessage", void 0);
|
|
55
58
|
|
|
56
|
-
_defineProperty(this, "
|
|
59
|
+
_defineProperty(this, "isVisible", void 0);
|
|
57
60
|
|
|
58
61
|
_defineProperty(this, "pickListValues", void 0);
|
|
59
62
|
|
|
@@ -61,6 +64,12 @@ export default class ZField {
|
|
|
61
64
|
|
|
62
65
|
_defineProperty(this, "subType", void 0);
|
|
63
66
|
|
|
67
|
+
_defineProperty(this, "toolTip", void 0);
|
|
68
|
+
|
|
69
|
+
_defineProperty(this, "toolTipType", void 0);
|
|
70
|
+
|
|
71
|
+
_defineProperty(this, "defaultValue", void 0);
|
|
72
|
+
|
|
64
73
|
this.displayLabel = displayLabel;
|
|
65
74
|
this.apiName = apiName;
|
|
66
75
|
this.isCustomField = isCustomField;
|
|
@@ -76,23 +85,53 @@ export default class ZField {
|
|
|
76
85
|
this.isMandatory = isMandatory;
|
|
77
86
|
this.value = value;
|
|
78
87
|
this.errorMessage = errorMessage;
|
|
79
|
-
this.
|
|
88
|
+
this.isVisible = isVisible;
|
|
80
89
|
this.defaultPickListValues = pickListValues;
|
|
81
90
|
this.pickListValues = pickListValues;
|
|
82
91
|
this.subType = subType;
|
|
92
|
+
this.toolTip = toolTip;
|
|
93
|
+
this.toolTipType = toolTipType;
|
|
94
|
+
this.defaultValue = defaultValue; // if(value===undefined){
|
|
95
|
+
// this.setDefaultValue()
|
|
96
|
+
// }
|
|
97
|
+
}
|
|
83
98
|
|
|
84
|
-
|
|
85
|
-
|
|
99
|
+
decideValueForBoolean(defaultValue) {
|
|
100
|
+
if (defaultValue === undefined || defaultValue === null) {
|
|
101
|
+
return false;
|
|
86
102
|
}
|
|
103
|
+
|
|
104
|
+
if (typeof defaultValue === "string") {
|
|
105
|
+
return defaultValue === "true" ? true : false;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return defaultValue;
|
|
87
109
|
}
|
|
88
110
|
|
|
89
|
-
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
111
|
+
decideValueForMultiselect(defaultValue) {
|
|
112
|
+
if (defaultValue === undefined || defaultValue === null) {
|
|
113
|
+
return [];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (typeof defaultValue === "string") {
|
|
117
|
+
return defaultValue.split(";");
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return defaultValue;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
decideDefaultValue() {
|
|
124
|
+
switch (this.type) {
|
|
125
|
+
case 'Boolean':
|
|
126
|
+
this.value = this.decideValueForBoolean(this.defaultValue);
|
|
127
|
+
break;
|
|
128
|
+
|
|
129
|
+
case 'Multiselect':
|
|
130
|
+
this.value = this.decideValueForMultiselect(this.defaultValue);
|
|
131
|
+
break;
|
|
132
|
+
|
|
133
|
+
default:
|
|
134
|
+
this.value = this.defaultValue === undefined ? '' : this.defaultValue;
|
|
96
135
|
}
|
|
97
136
|
}
|
|
98
137
|
|
|
@@ -125,15 +164,16 @@ export default class ZField {
|
|
|
125
164
|
}
|
|
126
165
|
|
|
127
166
|
toggleVisibility() {
|
|
128
|
-
this.
|
|
167
|
+
this.isVisible = !this.isVisible;
|
|
129
168
|
}
|
|
130
169
|
|
|
131
170
|
setVisibility(visibility) {
|
|
132
|
-
this.
|
|
171
|
+
this.isVisible = visibility;
|
|
133
172
|
}
|
|
134
173
|
|
|
135
174
|
isVisibile() {
|
|
136
|
-
return this.visibility;
|
|
175
|
+
// return this.visibility;
|
|
176
|
+
return this.isVisible;
|
|
137
177
|
}
|
|
138
178
|
|
|
139
179
|
setMandatory(isMandatory) {
|
|
@@ -161,8 +201,13 @@ export default class ZField {
|
|
|
161
201
|
isMandatory: this.isMandatory,
|
|
162
202
|
value: this.value,
|
|
163
203
|
errorMessage: this.errorMessage,
|
|
164
|
-
|
|
204
|
+
// NOTE: visibility is now isVisible, visibility is deprecated, only for backward compatibility of layout rules
|
|
205
|
+
visibility: this.isVisible,
|
|
206
|
+
isVisible: this.isVisible,
|
|
165
207
|
pickListValues: this.pickListValues,
|
|
208
|
+
toolTip: this.toolTip,
|
|
209
|
+
toolTipType: this.toolTipType,
|
|
210
|
+
defaultValue: this.defaultValue,
|
|
166
211
|
subType: this.subType
|
|
167
212
|
};
|
|
168
213
|
}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
|
|
3
3
|
export default class ZSection {
|
|
4
|
+
// Optional field for description
|
|
5
|
+
// private visibility:boolean;
|
|
4
6
|
constructor(_ref) {
|
|
5
7
|
let {
|
|
6
8
|
name,
|
|
7
9
|
i18NLabel,
|
|
8
10
|
isCustomSection,
|
|
11
|
+
description,
|
|
9
12
|
id,
|
|
10
13
|
fields,
|
|
11
|
-
visibility
|
|
14
|
+
// visibility
|
|
15
|
+
isVisible
|
|
12
16
|
} = _ref;
|
|
13
17
|
|
|
14
18
|
_defineProperty(this, "name", void 0);
|
|
@@ -17,18 +21,23 @@ export default class ZSection {
|
|
|
17
21
|
|
|
18
22
|
_defineProperty(this, "isCustomSection", void 0);
|
|
19
23
|
|
|
24
|
+
_defineProperty(this, "description", void 0);
|
|
25
|
+
|
|
20
26
|
_defineProperty(this, "id", void 0);
|
|
21
27
|
|
|
22
28
|
_defineProperty(this, "fields", void 0);
|
|
23
29
|
|
|
24
|
-
_defineProperty(this, "
|
|
30
|
+
_defineProperty(this, "isVisible", void 0);
|
|
25
31
|
|
|
26
32
|
this.name = name;
|
|
27
33
|
this.i18NLabel = i18NLabel;
|
|
28
34
|
this.isCustomSection = isCustomSection;
|
|
35
|
+
this.description = description || ''; // Default to empty string if not provided
|
|
36
|
+
|
|
29
37
|
this.id = id;
|
|
30
|
-
this.fields = fields;
|
|
31
|
-
|
|
38
|
+
this.fields = fields; // this.visibility=visibility;
|
|
39
|
+
|
|
40
|
+
this.isVisible = isVisible;
|
|
32
41
|
}
|
|
33
42
|
|
|
34
43
|
getName() {
|
|
@@ -40,7 +49,8 @@ export default class ZSection {
|
|
|
40
49
|
}
|
|
41
50
|
|
|
42
51
|
toggleVisibility() {
|
|
43
|
-
this.visibility
|
|
52
|
+
// this.visibility=!this.visibility
|
|
53
|
+
this.isVisible = !this.isVisible;
|
|
44
54
|
}
|
|
45
55
|
|
|
46
56
|
appendField(field) {
|
|
@@ -74,7 +84,8 @@ export default class ZSection {
|
|
|
74
84
|
}
|
|
75
85
|
|
|
76
86
|
setVisibility(visibility) {
|
|
77
|
-
this.visibility
|
|
87
|
+
// this.visibility=visibility;
|
|
88
|
+
this.isVisible = visibility;
|
|
78
89
|
}
|
|
79
90
|
|
|
80
91
|
setFieldErrorMessage(fieldApiName, errorMessage) {
|
|
@@ -102,11 +113,13 @@ export default class ZSection {
|
|
|
102
113
|
name: this.name,
|
|
103
114
|
i18NLabel: this.i18NLabel,
|
|
104
115
|
isCustomSection: this.isCustomSection,
|
|
116
|
+
description: this.description,
|
|
105
117
|
id: this.id,
|
|
106
118
|
fields: this.fields.map(field => {
|
|
107
119
|
return field.toObject();
|
|
108
120
|
}),
|
|
109
|
-
visibility:
|
|
121
|
+
// visibility:this.visibility
|
|
122
|
+
isVisible: this.isVisible
|
|
110
123
|
};
|
|
111
124
|
}
|
|
112
125
|
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
/* eslint-disable @zohodesk/architecturerules/
|
|
2
|
-
|
|
3
|
-
/* eslint-disable max-lines-per-function */
|
|
1
|
+
/* eslint-disable @zohodesk/architecturerules/define-property-schema */
|
|
4
2
|
import { FETCH_FAILED, FETCH_SUCCESS_NO_CONTENT, FETCH_REQUESTED, FETCH_SUCCESS } from "../../../../bc/zhttp/Constants";
|
|
5
3
|
import AbstractUseCase from "./AbstractUseCase";
|
|
4
|
+
import { ZHttpErrorSource, ZHttpErrorCode } from "../../../../bc/zhttp/Errors";
|
|
6
5
|
|
|
7
6
|
class FetchUseCase extends AbstractUseCase {
|
|
8
7
|
async execute(inputModel) {
|
|
9
|
-
const {
|
|
10
|
-
fetchGateWay
|
|
11
|
-
} = this.dependencies;
|
|
12
8
|
const {
|
|
13
9
|
url,
|
|
14
10
|
method = 'GET',
|
|
@@ -17,7 +13,6 @@ class FetchUseCase extends AbstractUseCase {
|
|
|
17
13
|
const {
|
|
18
14
|
metaData,
|
|
19
15
|
dispatch,
|
|
20
|
-
payload,
|
|
21
16
|
headers
|
|
22
17
|
} = inputModel;
|
|
23
18
|
dispatch({
|
|
@@ -28,80 +23,130 @@ class FetchUseCase extends AbstractUseCase {
|
|
|
28
23
|
headers,
|
|
29
24
|
metaData
|
|
30
25
|
}
|
|
31
|
-
});
|
|
26
|
+
}); // NOTE: getResponse is hacky solution to get the data using function call instead of fetch, So any handling added to here needs to be added to fetch and vise versa
|
|
27
|
+
|
|
28
|
+
if (typeof getResponse === 'function') {
|
|
29
|
+
await this.handleGetResponseAsFunction(inputModel);
|
|
30
|
+
} else {
|
|
31
|
+
await this.handleFetchResponse(inputModel);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async handleGetResponseAsFunction(inputModel) {
|
|
36
|
+
const {
|
|
37
|
+
getResponse,
|
|
38
|
+
headers,
|
|
39
|
+
dispatch,
|
|
40
|
+
metaData
|
|
41
|
+
} = inputModel;
|
|
32
42
|
|
|
33
43
|
try {
|
|
34
|
-
|
|
35
|
-
if (typeof getResponse === 'function') {
|
|
36
|
-
const data = await getResponse(headers);
|
|
44
|
+
const data = await getResponse(headers);
|
|
37
45
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
} else {
|
|
45
|
-
dispatch({
|
|
46
|
-
type: FETCH_SUCCESS,
|
|
47
|
-
payload: {
|
|
48
|
-
response: data
|
|
49
|
-
},
|
|
50
|
-
metaData
|
|
51
|
-
});
|
|
52
|
-
}
|
|
46
|
+
if (data === undefined) {
|
|
47
|
+
dispatch({
|
|
48
|
+
type: FETCH_SUCCESS_NO_CONTENT,
|
|
49
|
+
payload: {},
|
|
50
|
+
metaData
|
|
51
|
+
});
|
|
53
52
|
} else {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
dispatch({
|
|
54
|
+
type: FETCH_SUCCESS,
|
|
55
|
+
payload: {
|
|
56
|
+
response: data
|
|
57
|
+
},
|
|
58
|
+
metaData
|
|
58
59
|
});
|
|
60
|
+
}
|
|
61
|
+
} catch (errorObj) {
|
|
62
|
+
this.dispatchException(inputModel, errorObj, ZHttpErrorSource.GetResponse, ZHttpErrorCode.UnknownError);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async handleFetchResponse(inputModel) {
|
|
67
|
+
const {
|
|
68
|
+
fetchGateWay
|
|
69
|
+
} = this.dependencies;
|
|
70
|
+
const {
|
|
71
|
+
url,
|
|
72
|
+
method = 'GET',
|
|
73
|
+
headers,
|
|
74
|
+
payload
|
|
75
|
+
} = inputModel;
|
|
76
|
+
|
|
77
|
+
try {
|
|
78
|
+
const response = await fetchGateWay.fetch(url, {
|
|
79
|
+
headers,
|
|
80
|
+
method,
|
|
81
|
+
body: method === 'GET' ? null : payload
|
|
82
|
+
});
|
|
59
83
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
dispatch({
|
|
69
|
-
type: FETCH_SUCCESS,
|
|
70
|
-
payload: {},
|
|
71
|
-
metaData
|
|
72
|
-
});
|
|
73
|
-
} else {
|
|
74
|
-
const data = await response.json();
|
|
75
|
-
dispatch({
|
|
76
|
-
type: FETCH_SUCCESS,
|
|
77
|
-
payload: {
|
|
78
|
-
response: data
|
|
79
|
-
},
|
|
80
|
-
metaData
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
} else {
|
|
84
|
-
const data = await response.json();
|
|
85
|
-
dispatch({
|
|
86
|
-
type: FETCH_FAILED,
|
|
87
|
-
payload: {
|
|
88
|
-
error: data
|
|
89
|
-
},
|
|
90
|
-
metaData
|
|
91
|
-
});
|
|
92
|
-
}
|
|
84
|
+
if (response.ok) {
|
|
85
|
+
await this.handleSuccessResponse(response, inputModel);
|
|
86
|
+
} else {
|
|
87
|
+
const data = await response.json();
|
|
88
|
+
const errorObj = { ...data,
|
|
89
|
+
statusCode: response.status
|
|
90
|
+
};
|
|
91
|
+
this.dispatchException(inputModel, errorObj, ZHttpErrorSource.Fetch, ZHttpErrorCode.ApiError);
|
|
93
92
|
}
|
|
94
|
-
} catch (
|
|
93
|
+
} catch (errorObj) {
|
|
94
|
+
this.dispatchException(inputModel, errorObj, ZHttpErrorSource.Fetch, ZHttpErrorCode.UnknownError);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async handleSuccessResponse(response, inputModel) {
|
|
99
|
+
const {
|
|
100
|
+
method = 'GET',
|
|
101
|
+
dispatch,
|
|
102
|
+
metaData
|
|
103
|
+
} = inputModel;
|
|
104
|
+
const statusCode = response.status;
|
|
105
|
+
|
|
106
|
+
if (statusCode === 204) {
|
|
107
|
+
dispatch({
|
|
108
|
+
type: FETCH_SUCCESS_NO_CONTENT,
|
|
109
|
+
payload: {},
|
|
110
|
+
metaData
|
|
111
|
+
});
|
|
112
|
+
} else if (statusCode === 200 && method === 'DELETE') {
|
|
95
113
|
dispatch({
|
|
96
|
-
type:
|
|
114
|
+
type: FETCH_SUCCESS,
|
|
115
|
+
payload: {},
|
|
116
|
+
metaData
|
|
117
|
+
});
|
|
118
|
+
} else {
|
|
119
|
+
const data = await response.json();
|
|
120
|
+
dispatch({
|
|
121
|
+
type: FETCH_SUCCESS,
|
|
97
122
|
payload: {
|
|
98
|
-
|
|
123
|
+
response: data
|
|
99
124
|
},
|
|
100
125
|
metaData
|
|
101
126
|
});
|
|
102
127
|
}
|
|
103
128
|
}
|
|
104
129
|
|
|
130
|
+
dispatchException(inputModel, errorObj, source, code) {
|
|
131
|
+
const {
|
|
132
|
+
dispatch,
|
|
133
|
+
metaData
|
|
134
|
+
} = inputModel;
|
|
135
|
+
const error = {
|
|
136
|
+
code,
|
|
137
|
+
message: errorObj.message,
|
|
138
|
+
source,
|
|
139
|
+
info: errorObj
|
|
140
|
+
};
|
|
141
|
+
dispatch({
|
|
142
|
+
type: FETCH_FAILED,
|
|
143
|
+
payload: {
|
|
144
|
+
error
|
|
145
|
+
},
|
|
146
|
+
metaData
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
105
150
|
}
|
|
106
151
|
|
|
107
152
|
export default FetchUseCase;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import AbstractController from "./AbstractController";
|
|
2
|
+
export default class FieldExecuteFailedController extends AbstractController {
|
|
3
|
+
handle(event) {
|
|
4
|
+
const {
|
|
5
|
+
state,
|
|
6
|
+
updateState,
|
|
7
|
+
dispatch,
|
|
8
|
+
action
|
|
9
|
+
} = event;
|
|
10
|
+
const {
|
|
11
|
+
payload,
|
|
12
|
+
metaData
|
|
13
|
+
} = action;
|
|
14
|
+
const {
|
|
15
|
+
recordExecuteFailedUseCase
|
|
16
|
+
} = this.service;
|
|
17
|
+
recordExecuteFailedUseCase.updateDependency(state, updateState);
|
|
18
|
+
recordExecuteFailedUseCase.execute({
|
|
19
|
+
dispatch,
|
|
20
|
+
payload,
|
|
21
|
+
metaData
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import AbstractController from "./AbstractController";
|
|
2
|
+
export default class ReOrderController extends AbstractController {
|
|
3
|
+
handle(event) {
|
|
4
|
+
const {
|
|
5
|
+
state,
|
|
6
|
+
updateState,
|
|
7
|
+
dispatch,
|
|
8
|
+
action
|
|
9
|
+
} = event;
|
|
10
|
+
const {
|
|
11
|
+
newIndex,
|
|
12
|
+
oldIndex
|
|
13
|
+
} = action.payload;
|
|
14
|
+
const {
|
|
15
|
+
reOrderUseCase
|
|
16
|
+
} = this.service;
|
|
17
|
+
reOrderUseCase.updateDependency(state, updateState);
|
|
18
|
+
reOrderUseCase.execute({
|
|
19
|
+
dispatch,
|
|
20
|
+
newIndex,
|
|
21
|
+
oldIndex
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import AbstractController from "./AbstractController";
|
|
2
|
+
export default class ReOrderController extends AbstractController {
|
|
3
|
+
handle(event) {
|
|
4
|
+
const {
|
|
5
|
+
state,
|
|
6
|
+
updateState,
|
|
7
|
+
dispatch,
|
|
8
|
+
action
|
|
9
|
+
} = event;
|
|
10
|
+
const {
|
|
11
|
+
newIndex,
|
|
12
|
+
oldIndex
|
|
13
|
+
} = action.payload;
|
|
14
|
+
const {
|
|
15
|
+
reOrderFailedUseCase
|
|
16
|
+
} = this.service;
|
|
17
|
+
reOrderFailedUseCase.updateDependency(state, updateState);
|
|
18
|
+
reOrderFailedUseCase.execute({
|
|
19
|
+
dispatch,
|
|
20
|
+
newIndex,
|
|
21
|
+
oldIndex,
|
|
22
|
+
metaData: action.metaData
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
|
|
3
|
+
import ListErrorState from "../../domain/entities/ListErrorState";
|
|
3
4
|
import ListFactory from "../../applications/entities-factory/ListFactory";
|
|
4
5
|
import SortBy from "../../domain/entities/SortBy";
|
|
5
6
|
|
|
@@ -22,7 +23,8 @@ class Repository {
|
|
|
22
23
|
} = this.state.properties;
|
|
23
24
|
const {
|
|
24
25
|
sortBy,
|
|
25
|
-
|
|
26
|
+
errorState,
|
|
27
|
+
isReOrderLoading
|
|
26
28
|
} = this.getZListState();
|
|
27
29
|
const list = ListFactory.createList({
|
|
28
30
|
context,
|
|
@@ -34,11 +36,19 @@ class Repository {
|
|
|
34
36
|
},
|
|
35
37
|
sortBy: new SortBy(sortBy.id, sortBy.name, sortBy.order),
|
|
36
38
|
limit: 50,
|
|
37
|
-
|
|
39
|
+
isReOrderLoading,
|
|
40
|
+
errorState: new ListErrorState(errorState)
|
|
38
41
|
});
|
|
39
42
|
return list;
|
|
40
43
|
}
|
|
41
44
|
|
|
45
|
+
getRecords() {
|
|
46
|
+
const {
|
|
47
|
+
zrecord
|
|
48
|
+
} = this.state.behaviours;
|
|
49
|
+
return zrecord.records;
|
|
50
|
+
}
|
|
51
|
+
|
|
42
52
|
getZListState() {
|
|
43
53
|
const {
|
|
44
54
|
zlist
|
|
@@ -13,6 +13,8 @@ import RecordExecuteFailedUseCase from "../../applications/usecases/RecordExecut
|
|
|
13
13
|
import UpdateSuccessUseCase from "../../applications/usecases/UpdateSuccessUseCase";
|
|
14
14
|
import DeleteSuccessUseCase from "../../applications/usecases/DeleteSuccessUseCase";
|
|
15
15
|
import RecordSuccessCallbackUsecase from "../../applications/usecases/RecordSuccessCallbackUsecase";
|
|
16
|
+
import ReOrderUseCase from "../../applications/usecases/ReOrderUseCase";
|
|
17
|
+
import ReOrderFailedUseCase from "../../applications/usecases/ReOrderFailedUseCase";
|
|
16
18
|
|
|
17
19
|
class Service {
|
|
18
20
|
constructor(dependencies) {
|
|
@@ -44,6 +46,10 @@ class Service {
|
|
|
44
46
|
|
|
45
47
|
_defineProperty(this, "deleteSuccessUseCase", void 0);
|
|
46
48
|
|
|
49
|
+
_defineProperty(this, "reOrderUseCase", void 0);
|
|
50
|
+
|
|
51
|
+
_defineProperty(this, "reOrderFailedUseCase", void 0);
|
|
52
|
+
|
|
47
53
|
this.initializeUseCase = new InitializeUseCase(this.dependencies);
|
|
48
54
|
this.propertiesChangeUseCase = new PropertiesChangeUseCase(this.dependencies);
|
|
49
55
|
this.fetchMoreUseCase = new FetchMoreUseCase(this.dependencies);
|
|
@@ -57,6 +63,8 @@ class Service {
|
|
|
57
63
|
this.recordUpdateUseCase = new RecordUpdateUseCase(this.dependencies);
|
|
58
64
|
this.updateSuccessUseCase = new UpdateSuccessUseCase(this.dependencies);
|
|
59
65
|
this.deleteSuccessUseCase = new DeleteSuccessUseCase(this.dependencies);
|
|
66
|
+
this.reOrderUseCase = new ReOrderUseCase(this.dependencies);
|
|
67
|
+
this.reOrderFailedUseCase = new ReOrderFailedUseCase(this.dependencies);
|
|
60
68
|
}
|
|
61
69
|
|
|
62
70
|
}
|
|
@@ -26,7 +26,8 @@ export default class TableTranslator {
|
|
|
26
26
|
} = state;
|
|
27
27
|
const {
|
|
28
28
|
componentMapping,
|
|
29
|
-
context
|
|
29
|
+
context,
|
|
30
|
+
reOrderConfig
|
|
30
31
|
} = properties;
|
|
31
32
|
const {
|
|
32
33
|
localStorage: localStorageBehaviour,
|
|
@@ -48,7 +49,9 @@ export default class TableTranslator {
|
|
|
48
49
|
} = fallbackToDefault(behaviours, {}); // FIX: behaviours should be available by default
|
|
49
50
|
|
|
50
51
|
const {
|
|
51
|
-
sortBy
|
|
52
|
+
sortBy,
|
|
53
|
+
errorState,
|
|
54
|
+
isReOrderLoading
|
|
52
55
|
} = fallbackToDefault(zlist, {}); // FIX: zlist should be available by default
|
|
53
56
|
|
|
54
57
|
const {
|
|
@@ -67,6 +70,10 @@ export default class TableTranslator {
|
|
|
67
70
|
|
|
68
71
|
const fieldComponentMapping = fallbackToDefault(componentMapping.fields, {});
|
|
69
72
|
const rowActionsUiType = componentMapping.rowActionsComponentName;
|
|
73
|
+
const {
|
|
74
|
+
shouldClearRecords: isRecordsShouldBeEmptied,
|
|
75
|
+
canErrorPage: isError
|
|
76
|
+
} = errorState;
|
|
70
77
|
const {
|
|
71
78
|
fields: availableFields,
|
|
72
79
|
selectedFields,
|
|
@@ -92,8 +99,9 @@ export default class TableTranslator {
|
|
|
92
99
|
|
|
93
100
|
const localStorageFieldWidths = fallbackToDefault(localStorageBehaviour === null || localStorageBehaviour === void 0 ? void 0 : (_localStorageBehaviou = localStorageBehaviour[moduleName]) === null || _localStorageBehaviou === void 0 ? void 0 : (_localStorageBehaviou2 = _localStorageBehaviou[viewId]) === null || _localStorageBehaviou2 === void 0 ? void 0 : _localStorageBehaviou2.modifiedWidths, EMPTY_OBJECT);
|
|
94
101
|
const modifiedWidths = calculateFieldWidths(fields, localStorageFieldWidths, preferences);
|
|
95
|
-
const
|
|
96
|
-
const
|
|
102
|
+
const recordsForDisplay = isRecordsShouldBeEmptied ? EMPTY_ARRAY : records;
|
|
103
|
+
const headersTranslator = new HeadersTranslator(fields, headerActions, context, modifiedWidths, sortBy, records);
|
|
104
|
+
const rowsTranslator = new RowsTranslator(recordsForDisplay, fields, rowActions, context, fieldComponentMapping, rowActionsUiType, fieldActions); // const actionTranslator = new ClientActionsTranslator(clientActions, records, fields, pageContext);
|
|
97
105
|
// const translators = [headersTranslator.getTranslator(), rowsTranslator.getTranslator(), actionTranslator.getTranslator()];
|
|
98
106
|
|
|
99
107
|
const translators = [headersTranslator.getTranslator(), rowsTranslator.getTranslator()];
|
|
@@ -103,6 +111,8 @@ export default class TableTranslator {
|
|
|
103
111
|
properties,
|
|
104
112
|
behaviours,
|
|
105
113
|
viewModel: {
|
|
114
|
+
reOrderConfig,
|
|
115
|
+
isError,
|
|
106
116
|
selection: SelectionTranslator(state),
|
|
107
117
|
focussedRow: focussedIndex,
|
|
108
118
|
sortBy,
|
|
@@ -120,6 +130,7 @@ export default class TableTranslator {
|
|
|
120
130
|
},
|
|
121
131
|
keyboardControlsConfig,
|
|
122
132
|
isLoading,
|
|
133
|
+
isReOrderLoading,
|
|
123
134
|
emptyStateUiType: componentMapping.emptyState || '',
|
|
124
135
|
data: fields.length ? data : {
|
|
125
136
|
headers: EMPTY_ARRAY,
|
|
@@ -34,14 +34,15 @@ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, co
|
|
|
34
34
|
console.warn(`The string format for componentMapping will soon be deprecated. Please update to the new JSON format. REF : ${JSON.stringify(fieldEntry)}`);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
let tempValue = undefined;
|
|
38
|
+
let value = isCustomField ? (_record$cf = record.cf) === null || _record$cf === void 0 ? void 0 : _record$cf[name] : record[name];
|
|
38
39
|
const actions = ClientActionsTranslator.transform(fieldActions, {
|
|
39
40
|
field,
|
|
40
41
|
record
|
|
41
42
|
});
|
|
42
43
|
|
|
43
44
|
if (!value && value !== false) {
|
|
44
|
-
return EmptyViewModel();
|
|
45
|
+
return EmptyViewModel(name);
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
if (fieldComponentMapping[name]) {
|
|
@@ -52,11 +53,16 @@ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, co
|
|
|
52
53
|
|
|
53
54
|
if (!fieldTranslator) {
|
|
54
55
|
console.error(`Field type ${type} not supported`);
|
|
55
|
-
return EmptyViewModel();
|
|
56
|
+
return EmptyViewModel(name);
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
if (field.type == "LookUp") {
|
|
59
|
-
value
|
|
60
|
+
// temp fix for when lookup field don't have value !object
|
|
61
|
+
tempValue = typeof value !== 'object' ? {
|
|
62
|
+
name: value,
|
|
63
|
+
id: value
|
|
64
|
+
} : value;
|
|
65
|
+
tempValue.url = getLookupUrlConstructions({
|
|
60
66
|
field,
|
|
61
67
|
value,
|
|
62
68
|
context
|
|
@@ -72,7 +78,7 @@ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, co
|
|
|
72
78
|
if (fieldEntry && typeof fieldEntry === 'object') {
|
|
73
79
|
let data = {
|
|
74
80
|
actions,
|
|
75
|
-
...fieldTranslator(field, finalValue, {
|
|
81
|
+
...fieldTranslator(field, tempValue ? tempValue : finalValue, {
|
|
76
82
|
recordId: record.id
|
|
77
83
|
})
|
|
78
84
|
};
|
|
@@ -82,16 +88,9 @@ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, co
|
|
|
82
88
|
context
|
|
83
89
|
});
|
|
84
90
|
data.type = fieldEntry.UIComponentName;
|
|
85
|
-
console.log(data, "====>>> custom field modal");
|
|
86
91
|
return data;
|
|
87
92
|
}
|
|
88
93
|
|
|
89
|
-
console.log({
|
|
90
|
-
actions,
|
|
91
|
-
...fieldTranslator(field, finalValue, {
|
|
92
|
-
recordId: record.id
|
|
93
|
-
})
|
|
94
|
-
}, "====>>> normal pre-defined field modal");
|
|
95
94
|
return {
|
|
96
95
|
actions,
|
|
97
96
|
...fieldTranslator(field, finalValue, {
|