@zohodesk/library-platform 1.1.3-exp.2 → 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.
Files changed (93) hide show
  1. package/es/bc/zhttp/Errors.js +14 -0
  2. package/es/bc/zhttp/index.js +3 -1
  3. package/es/bc/zlist/Constants.js +6 -1
  4. package/es/bc/zlist/Events.js +140 -0
  5. package/es/bc/zlist/index.js +2 -1
  6. package/es/cc/component/FallbackView.js +1 -0
  7. package/es/cc/fields/currency/Model.js +2 -0
  8. package/es/cc/fields/field/Properties.js +1 -1
  9. package/es/cc/fields/formula/Model.js +5 -0
  10. package/es/cc/index.js +1 -0
  11. package/es/cc/link/Properties.js +0 -1
  12. package/es/cc/table-connected/ErrorEventType.js +32 -0
  13. package/es/cc/table-connected/Events.js +96 -0
  14. package/es/cc/table-connected/SdkContract.js +120 -0
  15. package/es/cc/table-connected/constants/Events.js +2 -0
  16. package/es/cc/table-connected/index.js +3 -1
  17. package/es/cc/table-list/Properties.js +9 -0
  18. package/es/cc/table-list/row/Properties.js +9 -0
  19. package/es/index.js +2 -1
  20. package/es/library/custom-component/adapters/gateways/event-manager/EventManager.js +116 -4
  21. package/es/library/custom-component/applications/interfaces/gateways/ISchemaValidator.js +1 -0
  22. package/es/library/custom-component/applications/usecases/InitializeUseCase.js +3 -2
  23. package/es/library/custom-component/applications/usecases/UpdatePropertyUseCase.js +3 -2
  24. package/es/library/custom-component/domain/entities/Component.js +16 -3
  25. package/es/library/custom-component/domain/entities/Properties.js +19 -1
  26. package/es/library/custom-component/frameworks/json-schema-validator/Validator.js +36 -1
  27. package/es/library/custom-component/frameworks/ui/CreateCustomComponent.js +23 -11
  28. package/es/library/custom-component/frameworks/ui/DependencyFactory.js +4 -3
  29. package/es/library/dot/components/table-list/frameworks/hooks/useRowData.js +12 -5
  30. package/es/library/dot/components/table-list/frameworks/hooks/useTableRowReorder.js +17 -5
  31. package/es/library/dot/components/table-list/frameworks/ui/TableListView.js +35 -26
  32. package/es/library/dot/components/table-list/frameworks/ui/css/TableList.module.css +152 -56
  33. package/es/library/dot/components/table-list/frameworks/ui/sub-components/Header.js +22 -16
  34. package/es/library/dot/components/table-list/frameworks/ui/sub-components/Rows.js +7 -4
  35. package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/MassAction.js +5 -13
  36. package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/Row.js +31 -34
  37. package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/RowSelection.js +3 -8
  38. package/es/library/dot/components/table-list/frameworks/utils/getHeaderClasses.js +37 -0
  39. package/es/library/dot/components/table-list/frameworks/utils/getTableListClassName.js +37 -0
  40. package/es/library/dot/components/table-list/frameworks/utils/reOrder.js +28 -14
  41. package/es/library/dot/legacy-to-new-arch/text-area/frameworks/ui/TextAreaView.js +1 -1
  42. package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/ClientActionsAdapter.js +96 -0
  43. package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/EventHandlersFactory.js +11 -3
  44. package/es/platform/client-actions/template-resolver/index.js +1 -0
  45. package/es/platform/client-actions/translators/context-resolver/index.js +6 -6
  46. package/es/platform/components/table-connected/adapters/controllers/ColumnChooserOpenedController.js +1 -1
  47. package/es/platform/components/table-connected/adapters/resources/ErrorPrinter.js +20 -0
  48. package/es/platform/components/table-connected/adapters/resources/SmartTableResource.js +71 -0
  49. package/es/platform/components/table-connected/frameworks/ErrorEventHandlersFactory.js +126 -0
  50. package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +34 -1
  51. package/es/platform/components/table-connected/frameworks/TableConnectedFactory.js +2 -0
  52. package/es/platform/components/table-connected/frameworks/TableConnectedView.js +5 -1
  53. package/es/platform/zdata-source/domain/entities/DataSource.js +18 -12
  54. package/es/platform/zfield/domain/entities/fields-manager/FieldsManager.js +7 -1
  55. package/es/platform/zform/adapters/presenter/FormTranslator.js +6 -127
  56. package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +32 -0
  57. package/es/platform/zform/adapters/presenter/translators/fields/BooleanFieldTranslator.js +20 -0
  58. package/es/platform/zform/adapters/presenter/translators/fields/CurrencyFieldTranslator.js +29 -0
  59. package/es/platform/zform/adapters/presenter/translators/fields/DateFieldTranslator.js +20 -0
  60. package/es/platform/zform/adapters/presenter/translators/fields/DateTimeFieldTranslator.js +21 -0
  61. package/es/platform/zform/adapters/presenter/translators/fields/DecimalFieldTranslator.js +29 -0
  62. package/es/platform/zform/adapters/presenter/translators/fields/EmailFieldTranslator.js +30 -0
  63. package/es/platform/zform/adapters/presenter/translators/fields/LookUpFieldTranslator.js +30 -0
  64. package/es/platform/zform/adapters/presenter/translators/fields/MultiselectFieldTranslator.js +29 -0
  65. package/es/platform/zform/adapters/presenter/translators/fields/NumberFieldTranslator.js +30 -0
  66. package/es/platform/zform/adapters/presenter/translators/fields/PercentageFieldTranslator.js +30 -0
  67. package/es/platform/zform/adapters/presenter/translators/fields/PhoneFieldTranslator.js +29 -0
  68. package/es/platform/zform/adapters/presenter/translators/fields/PicklistFieldTranslator.js +29 -0
  69. package/es/platform/zform/adapters/presenter/translators/fields/TextAreaFieldTranslator.js +30 -0
  70. package/es/platform/zform/adapters/presenter/translators/fields/TextFieldTranslator.js +27 -0
  71. package/es/platform/zform/adapters/presenter/translators/fields/URLFieldTranslator.js +30 -0
  72. package/es/platform/zform/adapters/presenter/translators/fields/index.js +15 -0
  73. package/es/platform/zform/applications/usecases/MyFormSuccessUseCase.js +3 -1
  74. package/es/platform/zform/domain/ZField.js +61 -16
  75. package/es/platform/zform/domain/ZSection.js +20 -7
  76. package/es/platform/zhttp/applications/usecases/FetchUseCase.js +111 -66
  77. package/es/platform/zlist/adapters/controllers/FieldExecuteFailedController.js +25 -0
  78. package/es/platform/zlist/adapters/gateways/Repository.js +5 -2
  79. package/es/platform/zlist/adapters/presenters/TableTranslator.js +12 -5
  80. package/es/platform/zlist/adapters/presenters/translators/ColumnTranslator.js +2 -2
  81. package/es/platform/zlist/adapters/presenters/translators/EmptyViewModel.js +2 -1
  82. package/es/platform/zlist/adapters/presenters/translators/Header.js +3 -2
  83. package/es/platform/zlist/adapters/presenters/translators/HeadersTranslator.js +3 -2
  84. package/es/platform/zlist/adapters/presenters/translators/fields/CurrencyFieldTranslator.js +1 -0
  85. package/es/platform/zlist/adapters/presenters/translators/fields/FormulaFieldTranslator.js +3 -0
  86. package/es/platform/zlist/applications/entities-factory/ListFactory.js +3 -2
  87. package/es/platform/zlist/applications/usecases/FetchMoreUseCase.js +1 -1
  88. package/es/platform/zlist/applications/usecases/RecordExecuteFailedUseCase.js +3 -2
  89. package/es/platform/zlist/domain/entities/List.js +12 -63
  90. package/es/platform/zlist/domain/entities/ListErrorState.js +167 -0
  91. package/es/platform/zlist/frameworks/EventHandlersFactory.js +6 -0
  92. package/es/platform/zlist/frameworks/ZListBehaviourFactory.js +6 -1
  93. package/package.json +3 -3
@@ -1,25 +1,25 @@
1
1
  import { RECORD_EXECUTE, RECORD_FETCH_MORE, RECORD_REFETCH, RecordApiActionName } from "../../../../bc/zrecord/Constants";
2
2
  import { FIELD_EXECUTE, FIELD_REFETCH } from "../../../../bc/zfield/Constants";
3
- import { ZLIST_RECORD_DELETE_FAILED, ZLIST_RECORD_DELETE_SUCCEEDED, ZLIST_RECORD_UPDATE_FAILED, ZLIST_RECORD_UPDATE_SUCCEEDED, ZLIST_RECORD_REORDER_FAILED } from "../../../../bc/zlist/Constants";
3
+ import { ZLIST_RECORD_DELETE_SUCCEEDED, ZLIST_RECORD_UPDATE_SUCCEEDED } from "../../../../bc/zlist/Constants";
4
4
  import { CLIENTACTION_BEHAVIOUR_EXECUTE } from "../../../client-actions/bc/zclient-actions/Constants";
5
5
  import { SmartTableConstants } from "../../../../cc/table-connected";
6
6
  import SortBy from "./SortBy";
7
7
 
8
8
  class List {
9
- constructor(limit, sortBy, query, context, isReOrderLoading, errorRecordFailed) {
9
+ constructor(limit, sortBy, query, context, isReOrderLoading, errorState) {
10
10
  this.limit = limit;
11
11
  this.sortBy = sortBy;
12
12
  this.query = query;
13
13
  this.context = context;
14
14
  this.isReOrderLoading = isReOrderLoading;
15
- this.errorRecordFailed = errorRecordFailed;
15
+ this.errorState = errorState;
16
16
  }
17
17
 
18
18
  toObject() {
19
19
  return {
20
20
  sortBy: this.sortBy.toObject(),
21
21
  isReOrderLoading: this.isReOrderLoading,
22
- errorRecordFailed: this.errorRecordFailed
22
+ errorState: this.errorState.toObject()
23
23
  };
24
24
  }
25
25
 
@@ -117,9 +117,8 @@ class List {
117
117
  }
118
118
 
119
119
  if (this.shallowDiff(preQuery, curQuery)) {
120
- return [this.createRecordsRefetchAction(), this.createAvailableFieldsFetchAction(), this.createSelectedFieldsFetchAction() // TODO: this.createAvailableFieldsRefetchAction(),
120
+ return [this.createRecordsRefetchAction(), this.createAvailableFieldsFetchAction(), this.createSelectedFieldsFetchAction()]; // TODO: this.createAvailableFieldsRefetchAction(),
121
121
  // TODO: this.createSelectedFieldsRefetchAction()
122
- ];
123
122
  }
124
123
 
125
124
  return [];
@@ -231,66 +230,16 @@ class List {
231
230
  return actions;
232
231
  }
233
232
 
234
- getErrorRecordFailed() {
235
- return this.errorRecordFailed;
233
+ hasFetchingFailedInMoreRecords() {
234
+ return this.errorState.hasFetchingFailedInMoreRecords();
236
235
  }
237
236
 
238
- getRecordExecuteFailedActions(payload, metaData) {
239
- const {
240
- actionName
241
- } = metaData;
242
- const actions = [];
243
-
244
- if (actionName === RecordApiActionName.GET_RECORDS) {
245
- if (metaData.isAppend) {
246
- this.errorRecordFailed = true;
247
- }
248
- }
249
-
250
- if (actionName === RecordApiActionName.DELETE_RECORD) {
251
- const {
252
- recordId,
253
- error
254
- } = payload;
255
- actions.push({
256
- type: ZLIST_RECORD_DELETE_FAILED,
257
- payload: {
258
- recordId,
259
- error
260
- }
261
- });
262
- }
263
-
264
- if (actionName === RecordApiActionName.UPDATE_RECORD) {
265
- const {
266
- recordId,
267
- error
268
- } = payload;
269
- actions.push({
270
- type: ZLIST_RECORD_UPDATE_FAILED,
271
- payload: {
272
- recordId,
273
- error
274
- }
275
- });
276
- }
277
-
278
- if (actionName === RecordApiActionName.GET_REORDERRECORD) {
279
- const {
280
- error
281
- } = payload;
282
- actions.push({
283
- type: ZLIST_RECORD_REORDER_FAILED,
284
- payload: {
285
- error
286
- },
287
- metaData: {
288
- isReOrder: true
289
- }
290
- });
291
- }
237
+ processApiError(payload, metaData) {
238
+ return this.errorState.processApiError(payload, metaData);
239
+ }
292
240
 
293
- return actions;
241
+ generateApiErrorEvent(payload, metaData) {
242
+ return this.errorState.generateApiErrorEvent(payload, metaData);
294
243
  }
295
244
 
296
245
  getDeleteMultipleRecordAction(recordIds) {
@@ -0,0 +1,167 @@
1
+ import { RecordApiActionName } from "../../../../bc/zrecord/Constants";
2
+ import { ZLIST_FETCH_MORE_RECORDS_FAILED, ZLIST_INITIAL_AVAILABLE_FIELDS_FETCH_FAILED, ZLIST_INITIAL_CLIENT_ACTIONS_FETCH_FAILED, ZLIST_INITIAL_RECORDS_FETCH_FAILED, ZLIST_INITIAL_SELECTED_FIELDS_FETCH_FAILED, ZLIST_RECORD_DELETE_FAILED, ZLIST_RECORD_UPDATE_FAILED } from "../../../../bc/zlist/Constants";
3
+ import { ClientActionApiActionName } from "../../../client-actions/bc/zclient-actions/Constants";
4
+ import FieldApiName from "../../../zfield/domain/entities/interfaces/FieldApiName";
5
+
6
+ class ListErrorState {
7
+ constructor(errorState) {
8
+ this.errorState = errorState;
9
+ }
10
+
11
+ toObject() {
12
+ return this.errorState;
13
+ }
14
+
15
+ hasFetchingFailedInMoreRecords() {
16
+ return this.errorState.hasFetchingFailedInMoreRecords;
17
+ }
18
+
19
+ processApiError(payload, metaData) {
20
+ const {
21
+ actionName
22
+ } = metaData;
23
+
24
+ if (FieldApiName.AVAILABLE_FIELDS === actionName || FieldApiName.SELECTED_FIELDS === actionName) {
25
+ this.errorState = { ...this.errorState,
26
+ canErrorPage: true,
27
+ shouldClearRecords: true
28
+ };
29
+ } else if (RecordApiActionName.GET_RECORDS === actionName) {
30
+ if (metaData.isAppend !== true) {
31
+ this.errorState = { ...this.errorState,
32
+ canErrorPage: true,
33
+ shouldClearRecords: true
34
+ };
35
+ } else {
36
+ this.errorState = { ...this.errorState,
37
+ hasFetchingFailedInMoreRecords: true
38
+ };
39
+ }
40
+ }
41
+ }
42
+
43
+ generateApiErrorEvent(payload, metaData) {
44
+ const {
45
+ actionName
46
+ } = metaData;
47
+ const actions = [];
48
+
49
+ function push(action) {
50
+ if (action) {
51
+ actions.push(action);
52
+ }
53
+ }
54
+
55
+ push(this.getAvailableFieldsFailedAction(payload, actionName));
56
+ push(this.getSelectedFieldsFailedAction(payload, actionName));
57
+ push(this.getClientActionsFailedAction(payload, actionName));
58
+ push(this.getGetRecordsFailedAction(payload, metaData, actionName));
59
+ push(this.getDeleteRecordFailedAction(payload, actionName));
60
+ push(this.getUpdateRecordFailedAction(payload, actionName));
61
+ return actions;
62
+ }
63
+
64
+ getAvailableFieldsFailedAction(payload, actionName) {
65
+ if (FieldApiName.AVAILABLE_FIELDS === actionName) {
66
+ //TOTO return { type: ZLIST_INITIAL_AVAILABLE_FIELDS_FETCH_FAILED, payload, metaData };
67
+ return {
68
+ type: ZLIST_INITIAL_AVAILABLE_FIELDS_FETCH_FAILED,
69
+ payload
70
+ };
71
+ }
72
+
73
+ return null;
74
+ }
75
+
76
+ getSelectedFieldsFailedAction(payload, actionName) {
77
+ if (FieldApiName.SELECTED_FIELDS === actionName) {
78
+ //TOTO return { type: ZLIST_INITIAL_SELECTED_FIELDS_FETCH_FAILED, payload, metaData };
79
+ return {
80
+ type: ZLIST_INITIAL_SELECTED_FIELDS_FETCH_FAILED,
81
+ payload
82
+ };
83
+ }
84
+
85
+ return null;
86
+ }
87
+
88
+ getClientActionsFailedAction(payload, actionName) {
89
+ if (ClientActionApiActionName.GET_CLIENTACTIONS === actionName) {
90
+ //TOTO return { type: ZLIST_INITIAL_CLIENT_ACTIONS_FETCH_FAILED, payload, metaData };
91
+ return {
92
+ type: ZLIST_INITIAL_CLIENT_ACTIONS_FETCH_FAILED,
93
+ payload
94
+ };
95
+ }
96
+
97
+ return null;
98
+ }
99
+
100
+ getGetRecordsFailedAction(payload, metaData, actionName) {
101
+ if (RecordApiActionName.GET_RECORDS === actionName) {
102
+ if (metaData.isAppend !== true) {
103
+ return {
104
+ type: ZLIST_INITIAL_RECORDS_FETCH_FAILED,
105
+ payload,
106
+ metaData
107
+ };
108
+ } else {
109
+ const {
110
+ from,
111
+ limit
112
+ } = metaData.props;
113
+ return {
114
+ type: ZLIST_FETCH_MORE_RECORDS_FAILED,
115
+ payload: { ...payload,
116
+ from,
117
+ limit
118
+ },
119
+ metaData
120
+ };
121
+ }
122
+ }
123
+
124
+ return null;
125
+ }
126
+
127
+ getDeleteRecordFailedAction(payload, actionName) {
128
+ if (actionName === RecordApiActionName.DELETE_RECORD) {
129
+ const {
130
+ recordId,
131
+ error
132
+ } = payload;
133
+ return {
134
+ type: ZLIST_RECORD_DELETE_FAILED,
135
+ payload: {
136
+ recordId,
137
+ error
138
+ }
139
+ };
140
+ }
141
+
142
+ return null;
143
+ }
144
+
145
+ getUpdateRecordFailedAction(payload, actionName) {
146
+ if (actionName === RecordApiActionName.UPDATE_RECORD) {
147
+ const {
148
+ recordId,
149
+ error,
150
+ record
151
+ } = payload;
152
+ return {
153
+ type: ZLIST_RECORD_UPDATE_FAILED,
154
+ payload: {
155
+ recordId,
156
+ error,
157
+ record
158
+ }
159
+ };
160
+ }
161
+
162
+ return null;
163
+ }
164
+
165
+ }
166
+
167
+ export default ListErrorState;
@@ -22,6 +22,9 @@ import Presenter from "../adapters/presenters/Presenters";
22
22
  import RecordSuccessCallbackController from "../adapters/controllers/RecordSuccessCallbackController";
23
23
  import ReOrderController from "../adapters/controllers/ReOrderController";
24
24
  import ReOrderFailedController from "../adapters/controllers/ReOrderFailedController";
25
+ import { FIELD_FETCH_FAILURE } from "../../../bc/zfield/Constants";
26
+ import FieldExecuteFailedController from "../adapters/controllers/FieldExecuteFailedController";
27
+ import { CLIENTACTION_EXECUTE_FAILED } from "../../client-actions/bc/zclient-actions/Constants";
25
28
  export default class ActionHandlersFactory {
26
29
  static create() {
27
30
  const repository = new Repository();
@@ -39,9 +42,12 @@ export default class ActionHandlersFactory {
39
42
  [ZLIST_RECORD_UPDATE]: new RecordUpdateController(service).handle,
40
43
  [ZLIST_DELETE_RECORD]: new DeleteSingleRecordController(service).handle,
41
44
  [ZLIST_DELETE_RECORDS]: new DeleteMultipleRecordController(service).handle,
45
+ [FIELD_FETCH_FAILURE]: new FieldExecuteFailedController(service).handle,
46
+ // ({ dispatch, action }) => dispatch({ type: 'SMART_TABLE#RECORD_EXECUTE_FAILED', payload: action.payload }),
42
47
  [TableListConstants.TABLE_LIST_FIELD_CHANGED]: new FieldChangeController(service).handle,
43
48
  [RECORD_EXECUTE_SUCCEEDED]: new RecordExecuteSucceededController(service).handle,
44
49
  [RECORD_EXECUTE_FAILED]: new RecordExecuteFailedController(service).handle,
50
+ [CLIENTACTION_EXECUTE_FAILED]: new RecordExecuteFailedController(service).handle,
45
51
  [ZLIST_SORT]: new SortController(service).handle,
46
52
  [RECORD_EXECUTE_SUCCESS_CALLBACK]: new RecordSuccessCallbackController(service).handle,
47
53
  [ZLIST_RECORD_UPDATE_SUCCEEDED]: new UpdateSuccessController(service).handle,
@@ -10,7 +10,12 @@ export default class ZListBehaviourFactory {
10
10
  name: '',
11
11
  order: 'none'
12
12
  },
13
- isReOrderLoading: false
13
+ isReOrderLoading: false,
14
+ errorState: {
15
+ canErrorPage: false,
16
+ shouldClearRecords: false,
17
+ hasFetchingFailedInMoreRecords: false
18
+ }
14
19
  }),
15
20
  eventHandlers: EventHandlersFactory.create(),
16
21
  properties: Properties
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/library-platform",
3
- "version": "1.1.3-exp.2",
3
+ "version": "1.1.3-exp.4",
4
4
  "description": "",
5
5
  "main": "es/index.js",
6
6
  "files": [
@@ -44,7 +44,7 @@
44
44
  "@typescript-eslint/parser": "^7.11.0",
45
45
  "@zoho/SecurityJS": "5.0.2",
46
46
  "@zohodesk-private/css-variable-migrator": "^1.0.7",
47
- "@zohodesk-private/desk-components": "1.0.0-temp-53",
47
+ "@zohodesk-private/desk-components": "1.0.0-temp-53.3",
48
48
  "@zohodesk-private/node-plugins": "1.1.9",
49
49
  "@zohodesk/a11y": "2.2.6",
50
50
  "@zohodesk/codestandard-analytics": "0.0.2",
@@ -76,7 +76,7 @@
76
76
  "typescript": "4.9.5"
77
77
  },
78
78
  "peerDependencies": {
79
- "@zohodesk-private/desk-components": "1.0.0-temp-53",
79
+ "@zohodesk-private/desk-components": "1.0.0-temp-53.3",
80
80
  "@zohodesk/a11y": "2.2.6",
81
81
  "@zohodesk/components": "1.2.62",
82
82
  "@zohodesk/dot": "1.7.8",