@zohodesk/library-platform 1.0.2-exp.1.3 → 1.0.2-exp.1.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/cc/fields/formula/Events.js +3 -0
- package/es/cc/fields/formula/Model.js +14 -0
- package/es/cc/fields/formula/Properties.js +3 -0
- package/es/cc/fields/index.js +1 -0
- package/es/platform/data-source/http-template/getAvailableFields.js +4 -3
- package/es/platform/data-source/http-template/getClientActions.js +1 -1
- package/es/platform/zlist/adapters/presenters/TableTranslator.js +1 -1
- package/es/platform/zlist/adapters/presenters/translators/ColumnTranslator.js +3 -1
- package/es/platform/zlist/adapters/presenters/translators/fields/FormulaFieldTranslator.js +26 -0
- package/es/platform/zlist/adapters/presenters/translators/fields/index.js +2 -1
- package/es/platform/zlist/adapters/presenters/utils/calculateFieldWidths.js +2 -2
- package/package.json +1 -1
package/es/cc/fields/index.js
CHANGED
|
@@ -16,4 +16,5 @@ export { default as ColouredMultiSelectFieldProperties } from "./coloured-multi-
|
|
|
16
16
|
export { default as ColouredPickListFieldProperties } from "./coloured-pick-list/Properties";
|
|
17
17
|
export { default as TextFieldProperties } from "./text/Properties";
|
|
18
18
|
export { default as UrlFieldProperties } from "./url/Properties";
|
|
19
|
+
export { default as FormulaFieldProperties } from "./formula/Properties";
|
|
19
20
|
export { default as FieldTypes } from "./field/Types";
|
|
@@ -33,15 +33,15 @@ let getAvailableFields = {
|
|
|
33
33
|
servicePrefix,
|
|
34
34
|
orgName,
|
|
35
35
|
departmentId,
|
|
36
|
-
|
|
36
|
+
module
|
|
37
37
|
} = params;
|
|
38
|
-
const availableFieldsUrl = `/${servicePrefix}/${orgName}/api/v1/views/availableFields?departmentId=${departmentId}&module=${
|
|
38
|
+
const availableFieldsUrl = `/${servicePrefix}/${orgName}/api/v1/views/availableFields?departmentId=${departmentId}&module=${module}`;
|
|
39
39
|
const res = await fetch(availableFieldsUrl, {
|
|
40
40
|
method: 'GET',
|
|
41
41
|
headers
|
|
42
42
|
});
|
|
43
43
|
const availableFields = await getValidJsonResArray(res, 'fields');
|
|
44
|
-
const organizationFieldsUrl = `/${servicePrefix}/${orgName}/api/v1/organizationFields?departmentId=${departmentId}&module=${
|
|
44
|
+
const organizationFieldsUrl = `/${servicePrefix}/${orgName}/api/v1/organizationFields?departmentId=${departmentId}&module=${module}`;
|
|
45
45
|
const ores = await fetch(organizationFieldsUrl, {
|
|
46
46
|
method: 'GET',
|
|
47
47
|
headers
|
|
@@ -57,6 +57,7 @@ let getAvailableFields = {
|
|
|
57
57
|
|
|
58
58
|
return { ...field,
|
|
59
59
|
pickListValues: organizationField.pickListValues,
|
|
60
|
+
returnType: organizationField.returnType,
|
|
60
61
|
subType: organizationField.subType
|
|
61
62
|
};
|
|
62
63
|
})
|
|
@@ -56,7 +56,7 @@ export default class TableTranslator {
|
|
|
56
56
|
isFetching: isClientActionsFetching
|
|
57
57
|
} = fallbackToDefault(zclientAction, {}); // FIX: zclientAction should be available by defaultlt
|
|
58
58
|
|
|
59
|
-
const fieldComponentMapping = componentMapping.fields;
|
|
59
|
+
const fieldComponentMapping = fallbackToDefault(componentMapping.fields, {});
|
|
60
60
|
const rowActionsUiType = componentMapping.rowActionsComponentName;
|
|
61
61
|
const {
|
|
62
62
|
fields: availableFields,
|
|
@@ -2,9 +2,11 @@ import EmptyViewModel from "./EmptyViewModel";
|
|
|
2
2
|
import * as FieldTranslators from "./fields";
|
|
3
3
|
import ClientActionsTranslator from "../../../../client-actions/translators/client-actions-translator";
|
|
4
4
|
|
|
5
|
-
function ColumnTranslator(
|
|
5
|
+
function ColumnTranslator(fieldModel, record, fieldComponentMapping, fieldActions) {
|
|
6
6
|
var _record$cf;
|
|
7
7
|
|
|
8
|
+
const field = { ...fieldModel
|
|
9
|
+
};
|
|
8
10
|
const {
|
|
9
11
|
isCustomField,
|
|
10
12
|
name,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import FieldTypes from "../../../../../../cc/fields/field/Types";
|
|
2
|
+
import FormulaFieldModel from "../../../../../../cc/fields/formula/Model";
|
|
3
|
+
|
|
4
|
+
const FormulaFieldTranslator = (field, value, appendToActionPayload) => {
|
|
5
|
+
const {
|
|
6
|
+
uiType,
|
|
7
|
+
name
|
|
8
|
+
} = field;
|
|
9
|
+
const fieldTypeFactory = {
|
|
10
|
+
STRING: FieldTypes.SingleLineField,
|
|
11
|
+
BOOLEAN: FieldTypes.CheckboxField,
|
|
12
|
+
DECIMAL: FieldTypes.DecimalField,
|
|
13
|
+
CURRENCY: FieldTypes.CurrencyField,
|
|
14
|
+
DATE: FieldTypes.DateField,
|
|
15
|
+
DATETIME: FieldTypes.DateTimeField
|
|
16
|
+
};
|
|
17
|
+
const setFieldType = fieldTypeFactory[field.returnType] || FieldTypes.SingleLineField;
|
|
18
|
+
return FormulaFieldModel({
|
|
19
|
+
uiType: uiType || setFieldType,
|
|
20
|
+
appendToActionPayload,
|
|
21
|
+
name,
|
|
22
|
+
value
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default FormulaFieldTranslator;
|
|
@@ -13,7 +13,8 @@ export { default as Date } from "./DateFieldTranslator";
|
|
|
13
13
|
export { default as DateTime } from "./DateTimeFieldTranslator";
|
|
14
14
|
export { default as Picklist } from "./PickListFieldTranslator";
|
|
15
15
|
export { default as Multiselect } from "./MultiSelectFieldTranslator";
|
|
16
|
-
export { default as LookUp } from "./LookUpFieldTranslator";
|
|
16
|
+
export { default as LookUp } from "./LookUpFieldTranslator";
|
|
17
|
+
export { default as Formula } from "./FormulaFieldTranslator"; // // Field Name is to be similar to the API response
|
|
17
18
|
// class FieldTranslator {
|
|
18
19
|
// static translate(field, value) {
|
|
19
20
|
// const { type } = field;
|
|
@@ -7,13 +7,13 @@ export function calculateFieldWidths(fields, modifiedFieldWidths, preferences) {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
function decideWidth(width, fieldName, type) {
|
|
10
|
-
var _preferences$fields$f;
|
|
10
|
+
var _preferences$fields, _preferences$fields$f;
|
|
11
11
|
|
|
12
12
|
if (width !== undefined && width !== null) {
|
|
13
13
|
return width;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
const initialWidth = (_preferences$fields
|
|
16
|
+
const initialWidth = (_preferences$fields = preferences.fields) === null || _preferences$fields === void 0 ? void 0 : (_preferences$fields$f = _preferences$fields[fieldName]) === null || _preferences$fields$f === void 0 ? void 0 : _preferences$fields$f.initialWidth;
|
|
17
17
|
|
|
18
18
|
if (initialWidth !== undefined && initialWidth !== null) {
|
|
19
19
|
return initialWidth;
|