@zohodesk/library-platform 1.0.2-exp.3 → 1.0.2-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.
- package/README.md +2 -2
- package/es/bc/{zdata-broker → zdata-source}/Actions.js +6 -6
- package/es/bc/{zdata-broker → zdata-source}/Constants.js +6 -5
- package/es/bc/zdata-source/EventHandlers.js +2 -0
- package/es/bc/zdata-source/Symbols.js +5 -0
- package/es/bc/zfield/ActionHandlers.js +1 -1
- package/es/bc/zlist/EventHandlers.js +1 -1
- package/es/bc/zlist/Properties.js +16 -32
- package/es/cc/action-icon/Properties.js +31 -0
- package/es/cc/action-location/Properties.js +9 -24
- package/es/cc/table-connected/Constants.js +4 -0
- package/es/cc/table-connected/Properties.js +11 -57
- package/es/cc/table-list/Properties.js +2 -2
- package/es/cc/table-list/data-types/Header.js +6 -0
- package/es/desk-frameworks/table-connected/frameworks/ListSdkFactory.js +88 -1
- package/es/desk-frameworks/table-connected/frameworks/TableConnectedFactory.js +21 -7
- package/es/desk-frameworks/table-connected/frameworks/TableConnectedView.js +5 -2
- package/es/library/dot/components/action-location/frameworks/ui/ActionComponentMapping.js +4 -2
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/HeaderData.js +16 -3
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/RowActions.js +6 -4
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/RowData.js +16 -3
- package/es/library/dot/legacy-to-new-arch/action-icon/frameworks/ui/ActionIcon.js +18 -2
- package/es/library/dot/legacy-to-new-arch/action-icon/frameworks/ui/ActionIconView.js +75 -1
- package/es/platform/client-actions/behaviour/zclient-actions/Readme.md +14 -21
- package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/ExecuteActionBehaviourUseCase.js +1 -1
- package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/InitializeUseCase.js +2 -2
- package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/ClientActionManager.js +9 -9
- package/es/platform/client-actions/cc/action-event-mediator/Properties.js +11 -0
- package/es/platform/client-actions/cc/dynamic-action-component/Properties.js +1 -1
- package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/ActionEventMediatorView.js +3 -1
- package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/EventHandlersFactory.js +3 -3
- package/es/platform/client-actions/components/dynamic-component/frameworks/ui/DynamicActionComponentView.js +2 -2
- package/es/platform/client-actions/components/interfaces/ActionViewModel.js +7 -0
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActionsRenderer.module.css +17 -0
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActionsRendererView.js +7 -2
- package/es/platform/{data-broker → data-source}/http-template/getAvailableFields.js +5 -5
- package/es/platform/{data-broker → data-source}/http-template/getClientActions.js +4 -4
- package/es/platform/{data-broker → data-source}/http-template/getSelectedFields.js +5 -5
- package/es/platform/{data-broker → data-source}/index.js +2 -2
- package/es/platform/{data-broker → data-source}/utils/transformer/CreateCf.js +1 -1
- package/es/platform/{zdata-broker/adapters/controllers/DataBrokerExecutorController.js → zdata-source/adapters/controllers/DataSourceExecutorController.js} +1 -1
- package/es/platform/{zdata-broker → zdata-source}/adapters/gateways/Repository.js +5 -5
- package/es/platform/{zdata-broker → zdata-source}/adapters/presenters/Presenter.js +4 -4
- package/es/platform/{zdata-broker/applications/entities-factory/DataBrokerFactory.js → zdata-source/applications/entities-factory/DataSourceFactory.js} +3 -4
- package/es/platform/{zdata-broker → zdata-source}/applications/usecases/ExecuteActionUseCase.js +3 -3
- package/es/platform/{zdata-broker → zdata-source}/applications/usecases/FailureUseCase.js +3 -3
- package/es/platform/{zdata-broker → zdata-source}/applications/usecases/NoContentUseCase.js +3 -3
- package/es/platform/{zdata-broker → zdata-source}/applications/usecases/SuccessUseCase.js +4 -4
- package/es/platform/{zdata-broker/domain/entities/DataBroker.js → zdata-source/domain/entities/DataSource.js} +12 -12
- package/es/platform/zdata-source/domain/entities/interfaces/MetaData.js +1 -0
- package/es/platform/{zdata-broker → zdata-source}/frameworks/DataBrokerBehaviourFactory.js +2 -2
- package/es/platform/{zdata-broker → zdata-source}/frameworks/EventHandlersFactory.js +7 -12
- package/es/platform/zfield/applications/usecases/ExecuteActionUseCase.js +1 -1
- package/es/platform/zfield/applications/usecases/InitializeUseCase.js +2 -2
- package/es/platform/zfield/applications/usecases/RefetchUseCase.js +1 -1
- package/es/platform/zfield/domain/entities/fields-manager/FieldsManager.js +5 -5
- package/es/platform/zfield/frameworks/ActionHandlerFactory.js +4 -4
- package/es/platform/zlist/adapters/controllers/DeleteSuccessController.js +25 -0
- package/es/platform/zlist/adapters/controllers/UpdateSuccessController.js +25 -0
- package/es/platform/zlist/adapters/gateways/Repository.js +8 -9
- package/es/platform/zlist/adapters/gateways/Service.js +8 -0
- package/es/platform/zlist/adapters/presenters/TableTranslator.js +46 -34
- package/es/platform/zlist/adapters/presenters/translators/ColumnTranslator.js +16 -8
- package/es/platform/zlist/adapters/presenters/translators/Header.js +7 -2
- package/es/platform/zlist/adapters/presenters/translators/HeadersTranslator.js +4 -2
- package/es/platform/zlist/adapters/presenters/translators/Row.js +10 -6
- package/es/platform/zlist/adapters/presenters/translators/RowActionTranslator.js +6 -6
- package/es/platform/zlist/adapters/presenters/translators/RowsTranslator.js +7 -5
- package/es/platform/zlist/adapters/presenters/translators/actions/ActionsTranslator.js +89 -0
- package/es/platform/zlist/applications/entities-factory/ListFactory.js +2 -2
- package/es/platform/zlist/applications/usecases/DeleteSuccessUseCase.js +19 -0
- package/es/platform/zlist/applications/usecases/UpdateSuccessUseCase.js +19 -0
- package/es/platform/zlist/domain/entities/List.js +38 -10
- package/es/platform/zlist/frameworks/EventHandlersFactory.js +17 -23
- package/es/platform/zrecord/applications/usecases/ExecuteActionUseCase.js +1 -1
- package/es/platform/zrecord/applications/usecases/FetchMoreUseCase.js +1 -1
- package/es/platform/zrecord/applications/usecases/InitializeUseCase.js +2 -2
- package/es/platform/zrecord/applications/usecases/RefetchUseCase.js +1 -1
- package/es/platform/zrecord/domain/entities/RecordsManager.js +10 -10
- package/package.json +4 -4
- package/es/bc/zdata-broker/EventHandlers.js +0 -2
- package/es/bc/zdata-broker/Symbols.js +0 -5
- package/es/desk-frameworks/table-connected/frameworks/__tests__/TableConnectedFactory.spec.js +0 -453
- package/es/desk-frameworks/table-connected/frameworks/__tests__/mock/data-broker/http-template/getAvailableFields.js +0 -86
- package/es/desk-frameworks/table-connected/frameworks/__tests__/mock/data-broker/http-template/getRecords.js +0 -81
- package/es/desk-frameworks/table-connected/frameworks/__tests__/mock/data-broker/http-template/getSelectedFields.js +0 -32
- package/es/desk-frameworks/table-connected/frameworks/__tests__/mock/data-broker/index.js +0 -11
- package/es/platform/zdata-broker/domain/entities/interfaces/MetaData.js +0 -1
- /package/es/bc/{zdata-broker → zdata-source}/Properties.js +0 -0
- /package/es/platform/{data-broker → data-source}/dbc/index.js +0 -0
- /package/es/platform/{data-broker → data-source}/http-template/deleteRecord.js +0 -0
- /package/es/platform/{data-broker → data-source}/http-template/deleteRecords.js +0 -0
- /package/es/platform/{data-broker → data-source}/http-template/getRecords.js +0 -0
- /package/es/platform/{data-broker → data-source}/http-template/updateRecord.js +0 -0
- /package/es/platform/{data-broker → data-source}/utils/transformer/Transformer.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/adapters/controllers/AbstractController.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/adapters/controllers/FailureController.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/adapters/controllers/NoContentController.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/adapters/controllers/RegisterController.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/adapters/controllers/SuccessController.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/adapters/gateways/Service.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/adapters/gateways/TemplateHelpers.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/entities-factory/APITemplatesFactory.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/interfaces/InputDependencies.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/interfaces/gateways/IRepository.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/interfaces/gateways/IService.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/interfaces/gateways/ITemplateHelpers.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/interfaces/gateways/State.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/interfaces/input/ExecuteActionInputModel.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/interfaces/input/FailureInputModel.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/interfaces/input/NoContentInputModel.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/interfaces/input/RegisterInputModel.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/interfaces/input/SuccessInputModel.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/interfaces/output/IPresenter.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/usecases/AbstractUseCase.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/applications/usecases/RegisterUseCase.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/domain/entities/APITemplate.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/domain/entities/APITemplates.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/domain/entities/interfaces/APIDetailsModel.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/domain/entities/interfaces/APITemplateModel.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/domain/entities/interfaces/APITemplatesModel.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/domain/entities/interfaces/ApiEnum.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/domain/entities/interfaces/BehaviourState.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/domain/entities/interfaces/EventModel.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/domain/entities/interfaces/IAPITemplate.js +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/domain/entities/interfaces/IAPITemplates.js +0 -0
- /package/es/platform/{zdata-broker/domain/entities/interfaces/IDataBroker.js → zdata-source/domain/entities/interfaces/IDataSource.js} +0 -0
- /package/es/platform/{zdata-broker → zdata-source}/domain/entities/interfaces/ITemplateHelpers.js +0 -0
- /package/es/platform/zlist/adapters/presenters/translators/interfaces/{FieldUiMapping.js → Context.js} +0 -0
- /package/es/platform/zlist/adapters/presenters/translators/interfaces/{PageContext.js → FieldComponentMapping.js} +0 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
import ClientActionsTranslator from "../../../../../client-actions/translators/client-actions-translator";
|
|
4
|
+
|
|
5
|
+
class ActionsTranslator {
|
|
6
|
+
constructor() {
|
|
7
|
+
let actions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
8
|
+
let records = arguments.length > 1 ? arguments[1] : undefined;
|
|
9
|
+
let fields = arguments.length > 2 ? arguments[2] : undefined;
|
|
10
|
+
let context = arguments.length > 3 ? arguments[3] : undefined;
|
|
11
|
+
this.records = records;
|
|
12
|
+
this.fields = fields;
|
|
13
|
+
this.context = context;
|
|
14
|
+
|
|
15
|
+
_defineProperty(this, "headerActions", void 0);
|
|
16
|
+
|
|
17
|
+
_defineProperty(this, "fieldActions", void 0);
|
|
18
|
+
|
|
19
|
+
_defineProperty(this, "rowActions", void 0);
|
|
20
|
+
|
|
21
|
+
_defineProperty(this, "noLocation", void 0);
|
|
22
|
+
|
|
23
|
+
this.pipe = this.pipe.bind(this);
|
|
24
|
+
this.headerActions = actions.filter(action => (action === null || action === void 0 ? void 0 : action.location) === 'header_actions');
|
|
25
|
+
this.fieldActions = actions.filter(action => (action === null || action === void 0 ? void 0 : action.location) === 'field_actions');
|
|
26
|
+
this.rowActions = actions.filter(action => (action === null || action === void 0 ? void 0 : action.location) === 'row_actions');
|
|
27
|
+
this.noLocation = actions.filter(action => !(action !== null && action !== void 0 && action.location));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
getTranslator() {
|
|
31
|
+
return {
|
|
32
|
+
name: 'actionsTranslator',
|
|
33
|
+
mapping: this.pipe
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
getField(field_name) {
|
|
38
|
+
return this.fields.find(field => field.name === field_name);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
getRecord(record_id) {
|
|
42
|
+
return this.records.find(record => record.id === record_id);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
translateHeadersActions(headers) {
|
|
46
|
+
return headers.map(header => {
|
|
47
|
+
return { ...header,
|
|
48
|
+
actions: ClientActionsTranslator.transform(this.headerActions, { ...this.context,
|
|
49
|
+
field: this.getField(header.name)
|
|
50
|
+
})
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
translateFieldActions(row) {
|
|
56
|
+
return row.columns.map(column => {
|
|
57
|
+
return { ...column,
|
|
58
|
+
actions: ClientActionsTranslator.transform(this.fieldActions, { ...this.context,
|
|
59
|
+
record: this.getRecord(row.id),
|
|
60
|
+
field: this.getField(column.name)
|
|
61
|
+
})
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
translateRowsActions(data) {
|
|
67
|
+
return data.rows.map(row => {
|
|
68
|
+
return { ...row,
|
|
69
|
+
columns: this.translateFieldActions(row),
|
|
70
|
+
rowActionLocation: {
|
|
71
|
+
actions: ClientActionsTranslator.transform(this.rowActions, { ...this.context,
|
|
72
|
+
record: this.getRecord(row.id)
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
pipe(data) {
|
|
80
|
+
const newModel = { ...data,
|
|
81
|
+
headers: this.translateHeadersActions(data.headers),
|
|
82
|
+
rows: this.translateRowsActions(data)
|
|
83
|
+
};
|
|
84
|
+
return newModel;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export default ActionsTranslator;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
|
|
3
|
+
class DeleteSuccessUseCase extends AbstractUseCase {
|
|
4
|
+
execute(input) {
|
|
5
|
+
const {
|
|
6
|
+
dispatch,
|
|
7
|
+
recordId
|
|
8
|
+
} = input;
|
|
9
|
+
const {
|
|
10
|
+
repository
|
|
11
|
+
} = this.dependencies;
|
|
12
|
+
const list = repository.getList();
|
|
13
|
+
const action = list.getDeleteSuccessAction(recordId);
|
|
14
|
+
dispatch(action);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default DeleteSuccessUseCase;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
|
|
3
|
+
class UpdateSuccessUseCase extends AbstractUseCase {
|
|
4
|
+
execute(input) {
|
|
5
|
+
const {
|
|
6
|
+
dispatch,
|
|
7
|
+
recordId
|
|
8
|
+
} = input;
|
|
9
|
+
const {
|
|
10
|
+
repository
|
|
11
|
+
} = this.dependencies;
|
|
12
|
+
const list = repository.getList();
|
|
13
|
+
const action = list.getUpdateSuccessAction(recordId);
|
|
14
|
+
dispatch(action);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default UpdateSuccessUseCase;
|
|
@@ -2,13 +2,14 @@ import { RECORD_EXECUTE, RECORD_FETCH_MORE, RECORD_REFETCH, RecordApiActionName
|
|
|
2
2
|
import { FIELD_EXECUTE, FIELD_REFETCH } from "../../../../bc/zfield/Constants";
|
|
3
3
|
import { ZLIST_RECORD_DELETE_FAILED, ZLIST_RECORD_DELETE_SUCCEEDED, ZLIST_RECORD_UPDATE_FAILED, ZLIST_RECORD_UPDATE_SUCCEEDED } from "../../../../bc/zlist/Constants";
|
|
4
4
|
import { CLIENTACTION_BEHAVIOUR_EXECUTE } from "../../../client-actions/bc/zclient-actions/Constants";
|
|
5
|
+
import { SMART_TABLE_EVENTS } from "../../../../cc/table-connected/Constants";
|
|
5
6
|
|
|
6
7
|
class List {
|
|
7
|
-
constructor(limit, sortBy, filter,
|
|
8
|
+
constructor(limit, sortBy, filter, context) {
|
|
8
9
|
this.limit = limit;
|
|
9
10
|
this.sortBy = sortBy;
|
|
10
11
|
this.filter = filter;
|
|
11
|
-
this.
|
|
12
|
+
this.context = context;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
createApiProps() {
|
|
@@ -16,13 +17,13 @@ class List {
|
|
|
16
17
|
filter,
|
|
17
18
|
limit,
|
|
18
19
|
sortBy,
|
|
19
|
-
|
|
20
|
+
context
|
|
20
21
|
} = this;
|
|
21
22
|
return {
|
|
22
23
|
limit,
|
|
23
24
|
sortBy,
|
|
24
25
|
...filter,
|
|
25
|
-
...
|
|
26
|
+
...context
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
29
|
|
|
@@ -50,23 +51,36 @@ class List {
|
|
|
50
51
|
getPropertiesChangeRefetchActions(previousProperties, currentProperties) {
|
|
51
52
|
const {
|
|
52
53
|
sortBy: prevSortBy,
|
|
53
|
-
|
|
54
|
+
departmentId: preDepartmentId,
|
|
55
|
+
viewId: preViewId
|
|
54
56
|
} = previousProperties;
|
|
55
57
|
const {
|
|
56
58
|
sortBy: sortBy,
|
|
57
|
-
|
|
59
|
+
departmentId: currentDepartmentId,
|
|
60
|
+
viewId: currentViewId
|
|
58
61
|
} = currentProperties;
|
|
59
62
|
|
|
60
63
|
if (prevSortBy !== sortBy) {
|
|
61
64
|
return [this.createRecordsRefetchAction()];
|
|
62
65
|
}
|
|
63
66
|
|
|
64
|
-
if (
|
|
65
|
-
return [this.createRecordsRefetchAction(), this.createAvailableFieldsFetchAction(), this.createSelectedFieldsFetchAction()
|
|
66
|
-
// TODO: this.createSelectedFieldsRefetchAction()
|
|
67
|
-
];
|
|
67
|
+
if (preDepartmentId !== currentDepartmentId) {
|
|
68
|
+
return [this.createRecordsRefetchAction(), this.createAvailableFieldsFetchAction(), this.createSelectedFieldsFetchAction()];
|
|
68
69
|
}
|
|
69
70
|
|
|
71
|
+
if (preViewId !== currentViewId) {
|
|
72
|
+
return [this.createRecordsRefetchAction(), this.createSelectedFieldsFetchAction()];
|
|
73
|
+
} // if (this.shallowDiff(prevFilter, currentFilter)) {
|
|
74
|
+
// return [
|
|
75
|
+
// this.createRecordsRefetchAction(),
|
|
76
|
+
// this.createAvailableFieldsFetchAction(),
|
|
77
|
+
// this.createSelectedFieldsFetchAction()
|
|
78
|
+
// // TODO: this.createAvailableFieldsRefetchAction(),
|
|
79
|
+
// // TODO: this.createSelectedFieldsRefetchAction()
|
|
80
|
+
// ];
|
|
81
|
+
// }
|
|
82
|
+
|
|
83
|
+
|
|
70
84
|
return [];
|
|
71
85
|
}
|
|
72
86
|
|
|
@@ -127,6 +141,20 @@ class List {
|
|
|
127
141
|
};
|
|
128
142
|
}
|
|
129
143
|
|
|
144
|
+
getDeleteSuccessAction(recordIds) {
|
|
145
|
+
return {
|
|
146
|
+
type: SMART_TABLE_EVENTS.DELETE_RECORDS_SUCCESS,
|
|
147
|
+
payload: recordIds
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
getUpdateSuccessAction(recordId) {
|
|
152
|
+
return {
|
|
153
|
+
type: SMART_TABLE_EVENTS.UPDATE_RECORDS_SUCCESS,
|
|
154
|
+
payload: recordId
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
130
158
|
getRecordExecuteSucceededActions(payload, metaData) {
|
|
131
159
|
const {
|
|
132
160
|
actionName
|
|
@@ -4,7 +4,7 @@ import Service from "../adapters/gateways/Service";
|
|
|
4
4
|
import Repository from "../adapters/gateways/Repository";
|
|
5
5
|
import MountController from "../adapters/controllers/MountController";
|
|
6
6
|
import PropertiesChangeController from "../adapters/controllers/PropertiesChangeController";
|
|
7
|
-
import { ZLIST_DELETE_RECORD, ZLIST_DELETE_RECORDS, ZLIST_FETCH_MORE, ZLIST_FETCH_SORTED, ZLIST_RECORD_UPDATE } from "../../../bc/zlist/Constants";
|
|
7
|
+
import { ZLIST_DELETE_RECORD, ZLIST_DELETE_RECORDS, ZLIST_FETCH_MORE, ZLIST_FETCH_SORTED, ZLIST_RECORD_DELETE_SUCCEEDED, ZLIST_RECORD_UPDATE, ZLIST_RECORD_UPDATE_SUCCEEDED } from "../../../bc/zlist/Constants";
|
|
8
8
|
import FetchMoreController from "../adapters/controllers/FetchMoreController";
|
|
9
9
|
import SortController from "../adapters/controllers/SortController";
|
|
10
10
|
import FieldChangeController from "../adapters/controllers/FieldChangeController";
|
|
@@ -16,6 +16,8 @@ import DeleteSingleRecordController from "../adapters/controllers/DeleteSingleRe
|
|
|
16
16
|
import RecordExecuteFailedController from "../adapters/controllers/RecordExecuteFailedController";
|
|
17
17
|
import RecordExecuteSucceededController from "../adapters/controllers/RecordExecuteSucceededController";
|
|
18
18
|
import { RECORD_EXECUTE_FAILED, RECORD_EXECUTE_SUCCEEDED } from "../../../bc/zrecord/Constants";
|
|
19
|
+
import UpdateSuccessController from "../adapters/controllers/UpdateSuccessController";
|
|
20
|
+
import DeleteSuccessController from "../adapters/controllers/DeleteSuccessController";
|
|
19
21
|
export default class ActionHandlersFactory {
|
|
20
22
|
static create() {
|
|
21
23
|
const repository = new Repository();
|
|
@@ -24,29 +26,21 @@ export default class ActionHandlersFactory {
|
|
|
24
26
|
repository,
|
|
25
27
|
sortBy: sortByGateway
|
|
26
28
|
});
|
|
27
|
-
const controller = {
|
|
28
|
-
mount: new MountController(service).handle,
|
|
29
|
-
update: new PropertiesChangeController(service).handle,
|
|
30
|
-
fetchMore: new FetchMoreController(service).handle,
|
|
31
|
-
fieldChange: new FieldChangeController(service).handle,
|
|
32
|
-
recordUpdate: new RecordUpdateController(service).handle,
|
|
33
|
-
deleteMultipleRecord: new DeleteMultipleRecordController(service).handle,
|
|
34
|
-
deleteRecord: new DeleteSingleRecordController(service).handle,
|
|
35
|
-
recordExecuteSucceeded: new RecordExecuteSucceededController(service).handle,
|
|
36
|
-
recordExecuteFailed: new RecordExecuteFailedController(service).handle,
|
|
37
|
-
sort: new SortController(service).handle
|
|
38
|
-
};
|
|
39
29
|
return {
|
|
40
|
-
[LifeCycleAction.MOUNT]:
|
|
41
|
-
[LifeCycleAction.UPDATE_PROPERTIES]:
|
|
42
|
-
[
|
|
43
|
-
[
|
|
44
|
-
[
|
|
45
|
-
[
|
|
46
|
-
[
|
|
47
|
-
[RECORD_EXECUTE_SUCCEEDED]:
|
|
48
|
-
[RECORD_EXECUTE_FAILED]:
|
|
49
|
-
[ZLIST_FETCH_SORTED]:
|
|
30
|
+
[LifeCycleAction.MOUNT]: new MountController(service).handle,
|
|
31
|
+
[LifeCycleAction.UPDATE_PROPERTIES]: new PropertiesChangeController(service).handle,
|
|
32
|
+
[ZLIST_FETCH_MORE]: new FetchMoreController(service).handle,
|
|
33
|
+
[ZLIST_RECORD_UPDATE]: new RecordUpdateController(service).handle,
|
|
34
|
+
[ZLIST_DELETE_RECORD]: new DeleteSingleRecordController(service).handle,
|
|
35
|
+
[ZLIST_DELETE_RECORDS]: new DeleteMultipleRecordController(service).handle,
|
|
36
|
+
[TableListConstants.TABLE_LIST_FIELD_CHANGED]: new FieldChangeController(service).handle,
|
|
37
|
+
[RECORD_EXECUTE_SUCCEEDED]: new RecordExecuteSucceededController(service).handle,
|
|
38
|
+
[RECORD_EXECUTE_FAILED]: new RecordExecuteFailedController(service).handle,
|
|
39
|
+
[ZLIST_FETCH_SORTED]: new SortController(service).handle,
|
|
40
|
+
[ZLIST_RECORD_UPDATE_SUCCEEDED]: new UpdateSuccessController(service).handle,
|
|
41
|
+
// ({ dispatch, action }) => dispatch({ type: 'SMART_TABLE#RECORD_UPDATED', payload: action.payload }),
|
|
42
|
+
[ZLIST_RECORD_DELETE_SUCCEEDED]: new DeleteSuccessController(service).handle // ({ dispatch, action }) => dispatch({ type: 'SMART_TABLE#RECORD_DELETED', payload: { id: action.payload.id } })
|
|
43
|
+
|
|
50
44
|
};
|
|
51
45
|
}
|
|
52
46
|
|
|
@@ -25,7 +25,7 @@ class ExecuteActionUseCase extends AbstractUseCase {
|
|
|
25
25
|
presenter.updateRecord(recordManager.toObject());
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
dispatch(recordManager.
|
|
28
|
+
dispatch(recordManager.createDataSourceExecuteEvent(props, actionName, metaData));
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
}
|
|
@@ -21,7 +21,7 @@ class FetchMoreUseCase extends AbstractUseCase {
|
|
|
21
21
|
const metaData = recordManager.createFetchMoreRecordMeta(actionName, apiName, props);
|
|
22
22
|
recordManager.fetchingStarted();
|
|
23
23
|
presenter.updateRecord(recordManager.toObject());
|
|
24
|
-
dispatch(recordManager.
|
|
24
|
+
dispatch(recordManager.createDataSourceExecuteEvent(props, actionName, metaData));
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
-
import {
|
|
2
|
+
import { DATA_SOURCE_REGISTER } from "../../../../bc/zdata-source/Constants";
|
|
3
3
|
export default class InitializeUseCase extends AbstractUseCase {
|
|
4
4
|
execute(input) {
|
|
5
5
|
const {
|
|
@@ -7,7 +7,7 @@ export default class InitializeUseCase extends AbstractUseCase {
|
|
|
7
7
|
dispatch
|
|
8
8
|
} = input;
|
|
9
9
|
dispatch({
|
|
10
|
-
type:
|
|
10
|
+
type: DATA_SOURCE_REGISTER,
|
|
11
11
|
payload: {
|
|
12
12
|
apiTemplates
|
|
13
13
|
}
|
|
@@ -21,7 +21,7 @@ export default class RefetchUseCase extends AbstractUseCase {
|
|
|
21
21
|
const metaData = recordManager.createFetchRecordMeta(actionName, apiName, props);
|
|
22
22
|
recordManager.fetchingStarted();
|
|
23
23
|
presenter.updateRecord(recordManager.toObject());
|
|
24
|
-
dispatch(recordManager.
|
|
24
|
+
dispatch(recordManager.createDataSourceExecuteEvent(props, actionName, metaData));
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RecordApiActionName, RECORD_EXECUTE_SUCCESS_CALLBACK, RECORD_EXECUTE_SUCCESS_NO_CONTENT_CALLBACK, RECORD_EXECUTE_FAIL_CALLBACK } from "../../../../bc/zrecord/Constants";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { DATA_SOURCE_FAILURE, DATA_SOURCE_NO_CONTENT, DATA_SOURCE_SUCCESS } from "../../../../bc/zdata-source/Symbols";
|
|
3
|
+
import { DATA_SOURCE_EXECUTE } from "../../../../bc/zdata-source/Constants";
|
|
4
4
|
import UpdateRecordStrategy from "./UpdateRecordStrategy";
|
|
5
5
|
import DeleteRecordStrategy from "./DeleteRecordStrategy";
|
|
6
6
|
import DeleteMultipleRecordStrategy from "./DeleteMultipleRecordStrategy";
|
|
@@ -16,9 +16,9 @@ export default class RecordsManager {
|
|
|
16
16
|
this.records = records;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
createDataSourceExecuteEvent(props, actionName, metaData) {
|
|
20
20
|
return {
|
|
21
|
-
type:
|
|
21
|
+
type: DATA_SOURCE_EXECUTE,
|
|
22
22
|
payload: {
|
|
23
23
|
props,
|
|
24
24
|
actionName
|
|
@@ -27,7 +27,7 @@ export default class RecordsManager {
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
createDataSourceMeta(_ref) {
|
|
31
31
|
let {
|
|
32
32
|
actionName,
|
|
33
33
|
successMeta,
|
|
@@ -36,9 +36,9 @@ export default class RecordsManager {
|
|
|
36
36
|
} = _ref;
|
|
37
37
|
return {
|
|
38
38
|
actionName,
|
|
39
|
-
[
|
|
40
|
-
[
|
|
41
|
-
[
|
|
39
|
+
[DATA_SOURCE_NO_CONTENT]: successNoContentMeta,
|
|
40
|
+
[DATA_SOURCE_FAILURE]: failureMeta,
|
|
41
|
+
[DATA_SOURCE_SUCCESS]: successMeta
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -69,7 +69,7 @@ export default class RecordsManager {
|
|
|
69
69
|
type: RECORD_EXECUTE_FAIL_CALLBACK,
|
|
70
70
|
metaData: recordExecuteStrategyMeta
|
|
71
71
|
};
|
|
72
|
-
return this.
|
|
72
|
+
return this.createDataSourceMeta({
|
|
73
73
|
actionName,
|
|
74
74
|
successNoContentMeta,
|
|
75
75
|
failureMeta,
|
|
@@ -101,7 +101,7 @@ export default class RecordsManager {
|
|
|
101
101
|
type: RECORD_EXECUTE_FAIL_CALLBACK,
|
|
102
102
|
metaData: fetchMoreStrategyMeta
|
|
103
103
|
};
|
|
104
|
-
return this.
|
|
104
|
+
return this.createDataSourceMeta({
|
|
105
105
|
actionName,
|
|
106
106
|
successNoContentMeta,
|
|
107
107
|
failureMeta,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/library-platform",
|
|
3
|
-
"version": "1.0.2-exp.
|
|
3
|
+
"version": "1.0.2-exp.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "es/index.js",
|
|
6
6
|
"files": [
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@zohodesk/codestandard-validator": "0.0.4",
|
|
47
47
|
"@zohodesk/components": "1.2.46",
|
|
48
48
|
"@zohodesk/dot": "1.7.0",
|
|
49
|
-
"@zohodesk/eslint-plugin-architecturerules": "0.0.4",
|
|
49
|
+
"@zohodesk/eslint-plugin-architecturerules": "0.0.4-exp-18",
|
|
50
50
|
"@zohodesk/hooks": "2.0.5",
|
|
51
51
|
"@zohodesk/i18n": "1.0.0-beta.26",
|
|
52
52
|
"@zohodesk/icons": "1.0.61",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"ajv": "6.12.6",
|
|
80
|
-
"
|
|
81
|
-
"
|
|
80
|
+
"object-path-immutable": "4.1.2",
|
|
81
|
+
"jsep": "1.4.0"
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// Note: We need to properly handle uniqueness, because it is not api response
|
|
2
|
-
export const DATA_BROKER_SIGNATURE = 'DATA_BROKER#SIGNATURE';
|
|
3
|
-
export const DATA_BROKER_FAILURE = 'DATA_BROKER#FAILURE';
|
|
4
|
-
export const DATA_BROKER_SUCCESS = 'DATA_BROKER#SUCCESS';
|
|
5
|
-
export const DATA_BROKER_NO_CONTENT = 'DATA_BROKER#NO_CONTENT';
|