@zohodesk/library-platform 1.1.2-exp.0 → 1.1.2-exp.1

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.
@@ -3,7 +3,16 @@ export default {
3
3
  required: true,
4
4
  typeMetadata: {
5
5
  schema: {
6
- type: 'string'
6
+ anyOf: [// {
7
+ // type: 'object',
8
+ // properties: {
9
+ // UIComponentName: { type: 'string' },
10
+ // fieldToUIComponentTranslator: {}
11
+ // }
12
+ // },
13
+ {
14
+ type: 'string'
15
+ }]
7
16
  }
8
17
  }
9
18
  },
@@ -4,7 +4,7 @@ export { default as DateFieldProperties } from "./date/Properties";
4
4
  export { default as DecimalFieldProperties } from "./decimal/Properties";
5
5
  export { default as DateTimeFieldProperties } from "./datetime/Properties";
6
6
  export { default as EmailFieldProperties } from "./email/Properties";
7
- export { default as FieldFieldProperties } from "./field/Properties";
7
+ export { default as FieldProperties } from "./field/Properties";
8
8
  export { default as LookupFieldProperties } from "./lookup/Properties";
9
9
  export { default as MultiLineFieldProperties } from "./multi-line/Properties";
10
10
  export { default as MultiSelectFieldProperties } from "./multi-select/Properties";
@@ -14,6 +14,14 @@ class ComponentRegistry {
14
14
  }
15
15
 
16
16
  register(name, component) {
17
+ if (this.components.has(name)) {
18
+ console.warn(`Component with name "${name}" is already registered. Overwriting the existing component.`);
19
+ }
20
+
21
+ if (this.components.has(name) && this.get(name) !== component) {
22
+ console.warn(`Component with name "${name}" is already registered with a different instance. Overwriting the existing component.`);
23
+ }
24
+
17
25
  this.components.set(name, component);
18
26
  }
19
27
 
@@ -21,8 +21,7 @@ class Repository {
21
21
  context
22
22
  } = this.state.properties;
23
23
  const {
24
- sortBy,
25
- errorRecordFailed
24
+ sortBy
26
25
  } = this.getZListState();
27
26
  const list = ListFactory.createList({
28
27
  context,
@@ -33,8 +32,7 @@ class Repository {
33
32
  ...query
34
33
  },
35
34
  sortBy: new SortBy(sortBy.id, sortBy.name, sortBy.order),
36
- limit: 50,
37
- errorRecordFailed
35
+ limit: 50
38
36
  });
39
37
  return list;
40
38
  }
@@ -27,6 +27,13 @@ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, co
27
27
  name,
28
28
  type
29
29
  } = field;
30
+ let fieldToUiValue;
31
+ const fieldEntry = fieldComponentMapping[name];
32
+
33
+ if (typeof fieldEntry == 'string') {
34
+ console.warn(`The string format for componentMapping will soon be deprecated. Please update to the new JSON format. REF : ${JSON.stringify(fieldEntry)}`);
35
+ }
36
+
30
37
  const value = isCustomField ? (_record$cf = record.cf) === null || _record$cf === void 0 ? void 0 : _record$cf[name] : record[name];
31
38
  const actions = ClientActionsTranslator.transform(fieldActions, {
32
39
  field,
@@ -56,9 +63,38 @@ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, co
56
63
  });
57
64
  }
58
65
 
66
+ let finalValue = value;
67
+
68
+ if (fieldToUiValue !== undefined) {
69
+ finalValue = fieldToUiValue;
70
+ }
71
+
72
+ if (fieldEntry && typeof fieldEntry === 'object') {
73
+ let data = {
74
+ actions,
75
+ ...fieldTranslator(field, finalValue, {
76
+ recordId: record.id
77
+ })
78
+ };
79
+ data.value = fieldEntry.fieldToUIComponentTranslator({
80
+ field,
81
+ record,
82
+ context
83
+ });
84
+ data.type = fieldEntry.UIComponentName;
85
+ console.log(data, "====>>> custom field modal");
86
+ return data;
87
+ }
88
+
89
+ console.log({
90
+ actions,
91
+ ...fieldTranslator(field, finalValue, {
92
+ recordId: record.id
93
+ })
94
+ }, "====>>> normal pre-defined field modal");
59
95
  return {
60
96
  actions,
61
- ...fieldTranslator(field, value, {
97
+ ...fieldTranslator(field, finalValue, {
62
98
  recordId: record.id
63
99
  })
64
100
  };
@@ -6,10 +6,9 @@ class ListFactory {
6
6
  limit,
7
7
  sortBy,
8
8
  query,
9
- context,
10
- errorRecordFailed
9
+ context
11
10
  } = input;
12
- return new List(limit, sortBy, query, context, errorRecordFailed);
11
+ return new List(limit, sortBy, query, context);
13
12
  }
14
13
 
15
14
  }
@@ -9,10 +9,7 @@ class FetchMoreUseCase extends AbstractUseCase {
9
9
  repository
10
10
  } = this.dependencies;
11
11
  const list = repository.getList();
12
-
13
- if (!list.getErrorRecordFailed()) {
14
- dispatch(list.createMoreRecordFetchAction());
15
- }
12
+ dispatch(list.createMoreRecordFetchAction());
16
13
  }
17
14
 
18
15
  }
@@ -8,12 +8,10 @@ class RecordExecuteFailedUseCase extends AbstractUseCase {
8
8
  payload
9
9
  } = input;
10
10
  const {
11
- repository,
12
- presenter
11
+ repository
13
12
  } = this.dependencies;
14
13
  const list = repository.getList();
15
14
  const actions = list.getRecordExecuteFailedActions(payload, metaData);
16
- presenter.updateView(list.toObject());
17
15
  actions.forEach(action => {
18
16
  dispatch(action);
19
17
  });
@@ -6,18 +6,16 @@ import { SmartTableConstants } from "../../../../cc/table-connected";
6
6
  import SortBy from "./SortBy";
7
7
 
8
8
  class List {
9
- constructor(limit, sortBy, query, context, errorRecordFailed) {
9
+ constructor(limit, sortBy, query, context) {
10
10
  this.limit = limit;
11
11
  this.sortBy = sortBy;
12
12
  this.query = query;
13
13
  this.context = context;
14
- this.errorRecordFailed = errorRecordFailed;
15
14
  }
16
15
 
17
16
  toObject() {
18
17
  return {
19
- sortBy: this.sortBy.toObject(),
20
- errorRecordFailed: this.errorRecordFailed
18
+ sortBy: this.sortBy.toObject()
21
19
  };
22
20
  }
23
21
 
@@ -209,22 +207,12 @@ class List {
209
207
  return actions;
210
208
  }
211
209
 
212
- getErrorRecordFailed() {
213
- return this.errorRecordFailed;
214
- }
215
-
216
210
  getRecordExecuteFailedActions(payload, metaData) {
217
211
  const {
218
212
  actionName
219
213
  } = metaData;
220
214
  const actions = [];
221
215
 
222
- if (actionName === RecordApiActionName.GET_RECORDS) {
223
- if (metaData.isAppend) {
224
- this.errorRecordFailed = true;
225
- }
226
- }
227
-
228
216
  if (actionName === RecordApiActionName.DELETE_RECORD) {
229
217
  const {
230
218
  recordId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/library-platform",
3
- "version": "1.1.2-exp.0",
3
+ "version": "1.1.2-exp.1",
4
4
  "description": "",
5
5
  "main": "es/index.js",
6
6
  "files": [