@zohodesk/library-platform 1.1.1-exp.6 → 1.1.2
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/component/Slot.js +1 -0
- package/es/cc/component/SlotComponent.js +1 -0
- package/es/cc/component/properties/slotName.js +1 -0
- 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/library/custom-component/domain/entities/DefaultSlotNameAppend.js +10 -0
- package/es/library/custom-component/domain/entities/Properties.js +2 -0
- package/es/library/custom-component/frameworks/ui/CreateCustomComponent.js +18 -4
- package/es/library/custom-component/frameworks/ui/CreateSlotComponent.js +89 -0
- package/es/library/custom-component/frameworks/ui/__testcases__/CreateSlotComponent.spec.js +211 -0
- package/es/library/dot/legacy-to-new-arch/table-column-filter/frameworks/ui/TableColumnFilterView.js +5 -0
- package/es/library/dot/legacy-to-new-arch/table-column-filter/frameworks/ui/css/TableColumnFilter.module.css +5 -1
- package/es/library/dot/legacy-to-new-arch/table-column-sort/frameworks/ui/TableColumnSortView.js +7 -0
- package/es/library/dot/legacy-to-new-arch/table-column-sort/frameworks/ui/css/TableColumnSort.module.css +5 -1
- package/es/platform/data-source/http-template/getAvailableFields.js +1 -0
- package/es/platform/data-source/http-template/getClientActions.js +1 -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/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
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";
|
|
@@ -3,6 +3,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
3
3
|
import Property from "./Property";
|
|
4
4
|
import defaultAppendToActionPayload from "./DefaultAppendToActionPayload";
|
|
5
5
|
import getRefPropertySchema from "../../../../cc/component/properties/getRefPropertySchema";
|
|
6
|
+
import defaultSlotNameAppend from "./DefaultSlotNameAppend";
|
|
6
7
|
export default class Properties {
|
|
7
8
|
constructor(properties, componentName) {
|
|
8
9
|
this.componentName = componentName;
|
|
@@ -12,6 +13,7 @@ export default class Properties {
|
|
|
12
13
|
this.data = properties;
|
|
13
14
|
this.data.set('appendToActionPayload', new Property(defaultAppendToActionPayload));
|
|
14
15
|
this.data.set('getRef', new Property(getRefPropertySchema));
|
|
16
|
+
typeof properties.get("slotName") === "undefined" && this.data.set('slotName', new Property(defaultSlotNameAppend));
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
getAllPropertiesValue() {
|
|
@@ -3,9 +3,18 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
3
3
|
import React, { forwardRef } from 'react';
|
|
4
4
|
import DependencyFactory from "./DependencyFactory";
|
|
5
5
|
import Compare from "./Compare";
|
|
6
|
+
import { generateSlotChildren } from "./CreateSlotComponent";
|
|
7
|
+
|
|
8
|
+
function discardChildren(props) {
|
|
9
|
+
const newObject = { ...props
|
|
10
|
+
};
|
|
11
|
+
delete newObject.children;
|
|
12
|
+
return newObject;
|
|
13
|
+
}
|
|
6
14
|
/* eslint-disable max-lines-per-function */
|
|
7
15
|
// TODO: Refactor this function to reduce the number of lines
|
|
8
16
|
|
|
17
|
+
|
|
9
18
|
const createCustomComponent = input => {
|
|
10
19
|
class Component extends React.Component {
|
|
11
20
|
constructor(props) {
|
|
@@ -55,7 +64,7 @@ const createCustomComponent = input => {
|
|
|
55
64
|
dispatch: dispatch.bind(controller)
|
|
56
65
|
};
|
|
57
66
|
this.controller.initialize({ ...input,
|
|
58
|
-
newProps: props,
|
|
67
|
+
newProps: discardChildren(props),
|
|
59
68
|
helpers: this.helpers
|
|
60
69
|
});
|
|
61
70
|
let proptypes = input.View.propTypes;
|
|
@@ -70,7 +79,7 @@ const createCustomComponent = input => {
|
|
|
70
79
|
}
|
|
71
80
|
|
|
72
81
|
shouldComponentUpdate(nextProps, nextState) {
|
|
73
|
-
return !Compare.deepEqual(this.props, nextProps) || !Compare.deepEqual(this.state, nextState); // return true;
|
|
82
|
+
return !Compare.deepEqual(discardChildren(this.props), discardChildren(nextProps)) || !Compare.deepEqual(this.state, nextState); // return true;
|
|
74
83
|
}
|
|
75
84
|
|
|
76
85
|
componentWillUnmount() {
|
|
@@ -82,7 +91,7 @@ const createCustomComponent = input => {
|
|
|
82
91
|
}
|
|
83
92
|
|
|
84
93
|
componentWillReceiveProps(nextProps, nextContext) {
|
|
85
|
-
this.controller.updateProperties(nextProps);
|
|
94
|
+
this.controller.updateProperties(discardChildren(nextProps));
|
|
86
95
|
}
|
|
87
96
|
|
|
88
97
|
componentDidUpdate() {// this.controller.updateProperties(this.props);
|
|
@@ -90,6 +99,10 @@ const createCustomComponent = input => {
|
|
|
90
99
|
|
|
91
100
|
render() {
|
|
92
101
|
let View = this.View;
|
|
102
|
+
let {
|
|
103
|
+
slots,
|
|
104
|
+
children
|
|
105
|
+
} = this.props;
|
|
93
106
|
|
|
94
107
|
if (this.state.error) {
|
|
95
108
|
if (__TEST__) {
|
|
@@ -113,7 +126,8 @@ const createCustomComponent = input => {
|
|
|
113
126
|
this.props.getRef && this.props.getRef(element);
|
|
114
127
|
},
|
|
115
128
|
helpers: this.helpers,
|
|
116
|
-
state: this.state
|
|
129
|
+
state: this.state,
|
|
130
|
+
slotChildren: generateSlotChildren(slots, children)
|
|
117
131
|
});
|
|
118
132
|
}
|
|
119
133
|
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React, { Children } from "react";
|
|
2
|
+
import ComponentRegistry from "./ComponentRegistry";
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
Enhancements
|
|
6
|
+
1.Without named slot handling
|
|
7
|
+
2.Warning error for component name wrong
|
|
8
|
+
3.Change createSlotComponent with react-dep and add into domatin,entities,usecases way of impl
|
|
9
|
+
4.UAT
|
|
10
|
+
*/
|
|
11
|
+
export function generateSlotChildren() {
|
|
12
|
+
let slots = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
13
|
+
let children = arguments.length > 1 ? arguments[1] : undefined;
|
|
14
|
+
let slotChildren = {},
|
|
15
|
+
slotChildrenMap = {};
|
|
16
|
+
Children.forEach(children, child => {
|
|
17
|
+
if (typeof child.type === "function" && child.props && child.props.slotName) {
|
|
18
|
+
const {
|
|
19
|
+
slotName
|
|
20
|
+
} = child.props;
|
|
21
|
+
const displayName = child.type.displayName;
|
|
22
|
+
slotChildrenMap[slotName] = slotChildrenMap[slotName] || {};
|
|
23
|
+
slotChildrenMap[slotName][displayName] = {
|
|
24
|
+
props: child.props,
|
|
25
|
+
type: child.type
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
slots.map(slot => {
|
|
30
|
+
const {
|
|
31
|
+
name,
|
|
32
|
+
elements
|
|
33
|
+
} = slot;
|
|
34
|
+
slotChildren[name] = [];
|
|
35
|
+
elements.map((element, index) => {
|
|
36
|
+
const {
|
|
37
|
+
type,
|
|
38
|
+
name: elementName,
|
|
39
|
+
styles,
|
|
40
|
+
slots,
|
|
41
|
+
properties = {}
|
|
42
|
+
} = element;
|
|
43
|
+
const {
|
|
44
|
+
props: childProps = {},
|
|
45
|
+
type: ChildType
|
|
46
|
+
} = (slotChildrenMap[name] || {})[`Custom(${elementName})`] || {};
|
|
47
|
+
let View = ComponentRegistry.get(type) || ChildType;
|
|
48
|
+
let finalisedProps = { ...properties,
|
|
49
|
+
...childProps
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
if (styles) {
|
|
53
|
+
finalisedProps.styles = styles;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (slots) {
|
|
57
|
+
finalisedProps.slots = slots;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (View) {
|
|
61
|
+
slotChildren[name].push( /*#__PURE__*/React.createElement(View, { ...finalisedProps,
|
|
62
|
+
key: `${name}_${elementName}_${index}`
|
|
63
|
+
}, childProps.children));
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
return slotChildren;
|
|
68
|
+
}
|
|
69
|
+
/*export default function createSlotComponent(slotShape: Slot, children: any): any {
|
|
70
|
+
let {elements} = slotShape;
|
|
71
|
+
let finalElements = elements.map((element) => {
|
|
72
|
+
let {
|
|
73
|
+
type,
|
|
74
|
+
styles = {},
|
|
75
|
+
slots = [],
|
|
76
|
+
properties={}
|
|
77
|
+
} = element;
|
|
78
|
+
let View = ComponentRegistry.get(type);
|
|
79
|
+
if(View) {
|
|
80
|
+
return (<View
|
|
81
|
+
{...properties}
|
|
82
|
+
styles={styles}
|
|
83
|
+
slots={slots}
|
|
84
|
+
/>)
|
|
85
|
+
}
|
|
86
|
+
return null
|
|
87
|
+
});
|
|
88
|
+
return finalElements
|
|
89
|
+
}*/
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
import React, { Component } from "react";
|
|
3
|
+
import createCustomComponent from "../CreateCustomComponent.tsx";
|
|
4
|
+
import ComponentRegistry from "../ComponentRegistry";
|
|
5
|
+
import { render, cleanup } from '@testing-library/react';
|
|
6
|
+
import '@testing-library/jest-dom';
|
|
7
|
+
const Parent = createCustomComponent({
|
|
8
|
+
name: "parent",
|
|
9
|
+
View: (_ref, ref) => {
|
|
10
|
+
let {
|
|
11
|
+
slotChildren
|
|
12
|
+
} = _ref;
|
|
13
|
+
const {
|
|
14
|
+
child = null,
|
|
15
|
+
siblingChild = null
|
|
16
|
+
} = slotChildren;
|
|
17
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
18
|
+
ref: ref
|
|
19
|
+
}, "Hi, I am the Parent.", /*#__PURE__*/React.createElement("div", null, child), /*#__PURE__*/React.createElement("div", null, siblingChild));
|
|
20
|
+
},
|
|
21
|
+
properties: {
|
|
22
|
+
slots: {
|
|
23
|
+
required: false,
|
|
24
|
+
typeMetadata: {
|
|
25
|
+
schema: {
|
|
26
|
+
type: "array"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
eventHandlers: {}
|
|
32
|
+
});
|
|
33
|
+
const Child = createCustomComponent({
|
|
34
|
+
name: "child",
|
|
35
|
+
View: (_ref2, ref) => {
|
|
36
|
+
let {
|
|
37
|
+
slotChildren
|
|
38
|
+
} = _ref2;
|
|
39
|
+
const {
|
|
40
|
+
nestedChildren = null
|
|
41
|
+
} = slotChildren;
|
|
42
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
ref: ref
|
|
44
|
+
}, "Hi, I am the Child.", /*#__PURE__*/React.createElement("div", null, nestedChildren));
|
|
45
|
+
},
|
|
46
|
+
eventHandlers: {},
|
|
47
|
+
properties: {
|
|
48
|
+
slots: {
|
|
49
|
+
required: false,
|
|
50
|
+
typeMetadata: {
|
|
51
|
+
schema: {
|
|
52
|
+
type: "array"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const SiblingChild = createCustomComponent({
|
|
59
|
+
name: "siblingChild",
|
|
60
|
+
View: (props, ref) => {
|
|
61
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
62
|
+
ref: ref
|
|
63
|
+
}, "Hi, I am the sibling Child.");
|
|
64
|
+
},
|
|
65
|
+
eventHandlers: {},
|
|
66
|
+
properties: {}
|
|
67
|
+
});
|
|
68
|
+
const NestedChild = createCustomComponent({
|
|
69
|
+
name: "nestedChild",
|
|
70
|
+
View: (_, ref) => {
|
|
71
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
72
|
+
ref: ref
|
|
73
|
+
}, "Hi, I am the nested Child.");
|
|
74
|
+
},
|
|
75
|
+
eventHandlers: {},
|
|
76
|
+
properties: {}
|
|
77
|
+
});
|
|
78
|
+
const NoSlotName = createCustomComponent({
|
|
79
|
+
name: "noSlotName",
|
|
80
|
+
View: (_, ref) => {
|
|
81
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
82
|
+
ref: ref
|
|
83
|
+
}, "Hi, It should not be rendered.");
|
|
84
|
+
},
|
|
85
|
+
eventHandlers: {},
|
|
86
|
+
properties: {}
|
|
87
|
+
});
|
|
88
|
+
ComponentRegistry.register("Parent", Parent);
|
|
89
|
+
ComponentRegistry.register("Child", Child);
|
|
90
|
+
ComponentRegistry.register("SiblingChild", SiblingChild);
|
|
91
|
+
describe("Slot Integration test suite", () => {
|
|
92
|
+
beforeEach(() => {
|
|
93
|
+
jest.clearAllMocks();
|
|
94
|
+
cleanup();
|
|
95
|
+
});
|
|
96
|
+
it("slot Information passed to parent and check children rendering", () => {
|
|
97
|
+
const slots = [{
|
|
98
|
+
name: "child",
|
|
99
|
+
elements: [{
|
|
100
|
+
name: "child",
|
|
101
|
+
type: "Child"
|
|
102
|
+
}]
|
|
103
|
+
}];
|
|
104
|
+
const {
|
|
105
|
+
getByText
|
|
106
|
+
} = render( /*#__PURE__*/React.createElement(Parent, {
|
|
107
|
+
slots: slots
|
|
108
|
+
}, /*#__PURE__*/React.createElement(Child, {
|
|
109
|
+
slotName: "child"
|
|
110
|
+
})));
|
|
111
|
+
const component = getByText("Hi, I am the Child.");
|
|
112
|
+
expect(component).toBeInTheDocument();
|
|
113
|
+
});
|
|
114
|
+
it("slots with nested child and check nested child rendering", () => {
|
|
115
|
+
const slots = [{
|
|
116
|
+
name: "child",
|
|
117
|
+
elements: [{
|
|
118
|
+
name: "child",
|
|
119
|
+
type: "Child",
|
|
120
|
+
slots: [{
|
|
121
|
+
name: "nestedChildren",
|
|
122
|
+
elements: [{
|
|
123
|
+
name: "nestedChild",
|
|
124
|
+
type: "NestedChild"
|
|
125
|
+
}]
|
|
126
|
+
}]
|
|
127
|
+
}]
|
|
128
|
+
}];
|
|
129
|
+
const {
|
|
130
|
+
getByText
|
|
131
|
+
} = render( /*#__PURE__*/React.createElement(Parent, {
|
|
132
|
+
slots: slots
|
|
133
|
+
}, /*#__PURE__*/React.createElement(Child, {
|
|
134
|
+
slotName: "child"
|
|
135
|
+
}, /*#__PURE__*/React.createElement(NestedChild, {
|
|
136
|
+
slotName: "nestedChildren"
|
|
137
|
+
}))));
|
|
138
|
+
const component = getByText("Hi, I am the nested Child.");
|
|
139
|
+
expect(component).toBeInTheDocument();
|
|
140
|
+
});
|
|
141
|
+
it("slots with sibling child and check sibling child rendering", () => {
|
|
142
|
+
const slots = [{
|
|
143
|
+
name: "child",
|
|
144
|
+
elements: [{
|
|
145
|
+
name: "child",
|
|
146
|
+
type: "Child",
|
|
147
|
+
slots: [{
|
|
148
|
+
name: "nestedChildren",
|
|
149
|
+
elements: [{
|
|
150
|
+
name: "nestedChild",
|
|
151
|
+
type: "NestedChild"
|
|
152
|
+
}]
|
|
153
|
+
}]
|
|
154
|
+
}]
|
|
155
|
+
}, {
|
|
156
|
+
name: "siblingChild",
|
|
157
|
+
elements: [{
|
|
158
|
+
name: "siblingChild",
|
|
159
|
+
type: "SiblingChild"
|
|
160
|
+
}]
|
|
161
|
+
}];
|
|
162
|
+
const {
|
|
163
|
+
getByText
|
|
164
|
+
} = render( /*#__PURE__*/React.createElement(Parent, {
|
|
165
|
+
slots: slots
|
|
166
|
+
}, /*#__PURE__*/React.createElement(Child, {
|
|
167
|
+
slotName: "child"
|
|
168
|
+
}, /*#__PURE__*/React.createElement(NestedChild, {
|
|
169
|
+
slotName: "nestedChildren"
|
|
170
|
+
})), /*#__PURE__*/React.createElement(SiblingChild, null)));
|
|
171
|
+
const component = getByText("Hi, I am the sibling Child.");
|
|
172
|
+
expect(component).toBeInTheDocument();
|
|
173
|
+
});
|
|
174
|
+
it("children with no slot support should not be rendered", () => {
|
|
175
|
+
const slots = [{
|
|
176
|
+
name: "child",
|
|
177
|
+
elements: [{
|
|
178
|
+
name: "child",
|
|
179
|
+
type: "Child",
|
|
180
|
+
slots: [{
|
|
181
|
+
name: "nestedChildren",
|
|
182
|
+
elements: [{
|
|
183
|
+
name: "nestedChild",
|
|
184
|
+
type: "NestedChild"
|
|
185
|
+
}]
|
|
186
|
+
}]
|
|
187
|
+
}]
|
|
188
|
+
}, {
|
|
189
|
+
name: "siblingChild",
|
|
190
|
+
elements: [{
|
|
191
|
+
name: "siblingChild",
|
|
192
|
+
type: "SiblingChild"
|
|
193
|
+
}]
|
|
194
|
+
}];
|
|
195
|
+
const {
|
|
196
|
+
queryByText
|
|
197
|
+
} = render( /*#__PURE__*/React.createElement(Parent, {
|
|
198
|
+
slots: slots
|
|
199
|
+
}, /*#__PURE__*/React.createElement(Child, {
|
|
200
|
+
slotName: "child"
|
|
201
|
+
}, /*#__PURE__*/React.createElement(NestedChild, {
|
|
202
|
+
slotName: "nestedChildren"
|
|
203
|
+
})), /*#__PURE__*/React.createElement(SiblingChild, {
|
|
204
|
+
slotName: "siblingChild"
|
|
205
|
+
}), /*#__PURE__*/React.createElement(NoSlotName, {
|
|
206
|
+
slotName: "noslotname"
|
|
207
|
+
})));
|
|
208
|
+
const component = queryByText("Hi, It should not be rendered.");
|
|
209
|
+
expect(component).toBeNull();
|
|
210
|
+
});
|
|
211
|
+
});
|
package/es/library/dot/legacy-to-new-arch/table-column-filter/frameworks/ui/TableColumnFilterView.js
CHANGED
|
@@ -66,6 +66,11 @@ function TableColumnFilterView(_ref, ref) {
|
|
|
66
66
|
$tagAttributes_container: {
|
|
67
67
|
ref: ref
|
|
68
68
|
},
|
|
69
|
+
$customProps_dropbox: {
|
|
70
|
+
customClass: {
|
|
71
|
+
customDropBoxWrap: style.filterDropbox
|
|
72
|
+
}
|
|
73
|
+
},
|
|
69
74
|
customStyle: {
|
|
70
75
|
container: `${style.container} ${(isMultiSelect ? Array.isArray(selectedOptions) && selectedOptions.length > 0 : selectedOptions && Object.keys(selectedOptions).length > 0) ? style.active : ''}`
|
|
71
76
|
}
|
|
@@ -4,8 +4,12 @@
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
:global(.GLOBAL_ZDDC_tableHead:hover) .container,
|
|
7
|
-
:global(.GLOBAL_ZDDC_tableHead:has(
|
|
7
|
+
:global(.GLOBAL_ZDDC_tableHead):has(.filterDropbox) .container,
|
|
8
8
|
.active {
|
|
9
9
|
visibility: visible;
|
|
10
10
|
opacity: 1;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.filterDropbox {
|
|
14
|
+
/* ** */
|
|
11
15
|
}
|
|
@@ -4,8 +4,12 @@
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
:global(.GLOBAL_ZDDC_tableHead:hover) .parentContainer,
|
|
7
|
-
:global(.GLOBAL_ZDDC_tableHead:has(
|
|
7
|
+
:global(.GLOBAL_ZDDC_tableHead):has(.sortDropbox) .parentContainer,
|
|
8
8
|
.active {
|
|
9
9
|
visibility: visible;
|
|
10
10
|
opacity: 1;
|
|
11
11
|
}
|
|
12
|
+
|
|
13
|
+
.sortDropbox {
|
|
14
|
+
/** **/
|
|
15
|
+
}
|
|
@@ -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;
|