@zohodesk/library-platform 1.0.0-exp.4 → 1.0.0-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.
@@ -1,6 +1,7 @@
1
1
  var Types = /*#__PURE__*/function (Types) {
2
2
  Types["CheckboxField"] = "CheckboxField";
3
3
  Types["SwitchField"] = "SwitchField";
4
+ Types["AvatarLookupField"] = "AvatarLookupField";
4
5
  Types["SingleLineField"] = "SingleLineField";
5
6
  Types["MultiLineField"] = "MultiLineField";
6
7
  Types["EmailField"] = "EmailField";
@@ -10,6 +10,15 @@ export default { ...ZListProperties,
10
10
  }
11
11
  }
12
12
  },
13
+ isFlexibleColumns: {
14
+ required: false,
15
+ defaultValue: false,
16
+ typeMetadata: {
17
+ schema: {
18
+ type: 'boolean'
19
+ }
20
+ }
21
+ },
13
22
  selectionConfig: {
14
23
  required: false,
15
24
  defaultValue: {
@@ -22,6 +22,7 @@ function View(_ref, ref) {
22
22
  }, /*#__PURE__*/React.createElement(TableList, {
23
23
  data: data,
24
24
  hasRowActions: hasRowActions,
25
+ isFlexibleColumns: properties.isFlexibleColumns,
25
26
  isLoading: isLoading,
26
27
  emptyStateUiType: emptyStateUiType,
27
28
  selectionConfig: properties.selectionConfig
@@ -0,0 +1,12 @@
1
+ import { createCustomComponent } from "../../../../../../custom-component";
2
+ import LookupProperties from "../../../../../../../cc/fields/lookup/Properties";
3
+ import LookupEvents from "../../../../../../../cc/fields/lookup/Events";
4
+ import { AvatarLookupFieldView } from "./AvatarLookupFieldView";
5
+ const AvatarLookupField = createCustomComponent({
6
+ name: 'AvatarLookupField',
7
+ View: AvatarLookupFieldView,
8
+ properties: LookupProperties,
9
+ events: LookupEvents,
10
+ eventHandlers: {}
11
+ });
12
+ export default AvatarLookupField;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { Avatar } from "../../../..";
3
+ export function AvatarLookupFieldView(_ref, ref) {
4
+ let {
5
+ state
6
+ } = _ref;
7
+ const {
8
+ name,
9
+ photoURL
10
+ } = state.properties.value;
11
+ return /*#__PURE__*/React.createElement(Avatar, {
12
+ getRef: ref,
13
+ name: name,
14
+ label: name,
15
+ imageSrc: photoURL,
16
+ tooltip: ""
17
+ });
18
+ }
@@ -0,0 +1,12 @@
1
+ import { createCustomComponent } from "../../../../../../custom-component";
2
+ import LookupProperties from "../../../../../../../cc/fields/lookup/Properties";
3
+ import LookupEvents from "../../../../../../../cc/fields/lookup/Events";
4
+ import { LookupFieldView } from "./LookupFieldView";
5
+ const LookupField = createCustomComponent({
6
+ name: 'LookupField',
7
+ View: LookupFieldView,
8
+ properties: LookupProperties,
9
+ events: LookupEvents,
10
+ eventHandlers: {}
11
+ });
12
+ export default LookupField;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { Avatar } from "../../../..";
3
+ export function LookupFieldView(_ref, ref) {
4
+ let {
5
+ state
6
+ } = _ref;
7
+ const {
8
+ name,
9
+ photoURL
10
+ } = state.properties.value;
11
+ return /*#__PURE__*/React.createElement(Avatar, {
12
+ getRef: ref,
13
+ name: name,
14
+ label: name,
15
+ imageSrc: photoURL,
16
+ tooltip: ""
17
+ });
18
+ }
@@ -0,0 +1,12 @@
1
+ import { createCustomComponent } from "../../../../../../custom-component";
2
+ import LookupProperties from "../../../../../../../cc/fields/lookup/Properties";
3
+ import LookupEvents from "../../../../../../../cc/fields/lookup/Events";
4
+ import { LookupFieldView } from "./LookupFieldView";
5
+ const LookupField = createCustomComponent({
6
+ name: 'LookupField',
7
+ View: LookupFieldView,
8
+ properties: LookupProperties,
9
+ events: LookupEvents,
10
+ eventHandlers: {}
11
+ });
12
+ export default LookupField;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { Avatar } from "../../../..";
3
+ export function LookupFieldView(_ref, ref) {
4
+ let {
5
+ state
6
+ } = _ref;
7
+ const {
8
+ name,
9
+ photoURL
10
+ } = state.properties.value;
11
+ return /*#__PURE__*/React.createElement(Avatar, {
12
+ getRef: ref,
13
+ name: name,
14
+ label: name,
15
+ imageSrc: photoURL,
16
+ tooltip: ""
17
+ });
18
+ }
@@ -4,7 +4,7 @@ const deleteRecord = {
4
4
  parameters: `{}`,
5
5
  type: 'POST',
6
6
  transformer: data => data,
7
- requestBody: '{ "entityIds": ["{{recordId}}"] }',
7
+ requestBody: '{ "recordIds": ["{{recordId}}"] }',
8
8
  properties: {
9
9
  moduleName: {
10
10
  required: true,
@@ -4,7 +4,7 @@ const deleteRecords = {
4
4
  parameters: `{}`,
5
5
  type: 'POST',
6
6
  transformer: data => data,
7
- requestBody: '{ "entityIds": {{recordIds}} }',
7
+ requestBody: '{ "recordIds": {{recordIds}} }',
8
8
  // REVIEW: Is `entityIds` applicable to all modules? To be confirmed with backend team
9
9
  properties: {
10
10
  moduleName: {
@@ -33,7 +33,7 @@ class APITemplate {
33
33
 
34
34
  getPayload(obj) {
35
35
  if (this.payload) {
36
- return JSON.parse(this.helper.replaceTemplateVariables(this.payload, obj));
36
+ return this.helper.replaceTemplateVariables(this.payload, obj);
37
37
  } else {
38
38
  return `{}`;
39
39
  }
@@ -50,6 +50,11 @@ class APITemplate {
50
50
  constructURL(obj) {
51
51
  const queryObj = JSON.parse(this.getParameter(obj));
52
52
  const query = this.helper.objectToQueryString(queryObj);
53
+
54
+ if (query === '') {
55
+ return this.getApi(obj);
56
+ }
57
+
53
58
  return `${this.getApi(obj)}?${query}`;
54
59
  } // eslint-disable-next-line max-lines-per-function
55
60
 
@@ -58,12 +63,13 @@ class APITemplate {
58
63
  const apiDetails = {
59
64
  url: this.constructURL(obj),
60
65
  type: this.type,
66
+ method: this.type,
61
67
  payload: this.getPayload(obj)
62
68
  };
63
69
 
64
70
  if (this.getResponseInTemplate) {
65
71
  apiDetails.getResponse = () => {
66
- const payload = this.getPayload(obj);
72
+ const payload = JSON.parse(this.getPayload(obj));
67
73
  const params = JSON.parse(this.getParameter(obj));
68
74
  return this.getResponseInTemplate({
69
75
  payload,
@@ -36,7 +36,7 @@ class APITemplate {
36
36
 
37
37
  getPayload(obj) {
38
38
  if (this.payload) {
39
- return JSON.parse(this.helper.replaceTemplateVariables(this.payload, obj));
39
+ return this.helper.replaceTemplateVariables(this.payload, obj);
40
40
  } else {
41
41
  return `{}`;
42
42
  }
@@ -53,6 +53,11 @@ class APITemplate {
53
53
  constructURL(obj) {
54
54
  const queryObj = JSON.parse(this.getParameter(obj));
55
55
  const query = this.helper.objectToQueryString(queryObj);
56
+
57
+ if (query === '') {
58
+ return this.getApi(obj);
59
+ }
60
+
56
61
  return `${this.getApi(obj)}?${query}`;
57
62
  } // eslint-disable-next-line max-lines-per-function
58
63
 
@@ -61,12 +66,13 @@ class APITemplate {
61
66
  const apiDetails = {
62
67
  url: this.constructURL(obj),
63
68
  type: this.type,
69
+ method: this.type,
64
70
  payload: this.getPayload(obj)
65
71
  };
66
72
 
67
73
  if (this.getResponseInTemplate) {
68
74
  apiDetails.getResponse = () => {
69
- const payload = this.getPayload(obj);
75
+ const payload = JSON.parse(this.getPayload(obj));
70
76
  const params = JSON.parse(this.getParameter(obj));
71
77
  return this.getResponseInTemplate({
72
78
  payload,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/library-platform",
3
- "version": "1.0.0-exp.4",
3
+ "version": "1.0.0-exp.6",
4
4
  "description": "",
5
5
  "main": "es/index.js",
6
6
  "files": [