@zohodesk/library-platform 1.1.2-exp.1 → 1.1.3-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.
- package/es/bc/sdk/EventHandlers.js +1 -0
- package/es/bc/sdk/Properties.js +10 -0
- package/es/bc/sdk/ResourceNamesEnum.js +6 -0
- package/es/cc/action-location/Constants.js +5 -3
- package/es/cc/architecture/LifeCycleActionEnum.js +2 -8
- package/es/cc/component/LifeCycleEventsEnum.js +9 -0
- package/es/desk-frameworks/table-connected/frameworks/EventHandlersFactory.js +10 -5
- package/es/desk-frameworks/table-connected/frameworks/ListSdkFactory.js +15 -130
- package/es/desk-frameworks/table-connected/frameworks/TableConnectedFactory.js +9 -1
- package/es/desk-frameworks/table-connected/frameworks/resources/ISmartTableResource.js +1 -0
- package/es/desk-frameworks/table-connected/frameworks/resources/SmartTableResource.js +233 -0
- package/es/index.js +3 -1
- package/es/library/behaviours/keyboard-controls/applications/usecases/DestructUsecase.js +5 -2
- package/es/library/behaviours/list-selection/frameworks/ActionHandlerFactory.js +4 -3
- package/es/library/custom-component/applications/entities-factory/BehavioursFactory.js +18 -16
- package/es/library/custom-component/applications/usecases/UpdatePropertyUseCase.js +3 -0
- package/es/library/custom-component/applications/usecases/UpdateStateUseCase.js +5 -1
- package/es/library/custom-component/domain/entities/Component.js +4 -0
- package/es/library/custom-component/domain/entities/LifeCycleAction.js +14 -3
- package/es/library/dot/components/action-location/frameworks/ui/EventHandlersFactory.js +1 -1
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/RowSelection.js +1 -0
- package/es/library/dot/legacy-to-new-arch/table-column-filter/frameworks/ui/TableColumnFilterView.js +8 -4
- package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/EventHandlersFactory.js +4 -3
- package/es/platform/sdk/adapters/gateways/Repository.js +31 -0
- package/es/platform/sdk/adapters/gateways/Service.js +27 -0
- package/es/platform/sdk/adapters/presenters/Presenter.js +16 -0
- package/es/platform/sdk/application/interfaces/UsecaseDependencies.js +1 -0
- package/es/platform/sdk/application/interfaces/gateways/IRepository.js +1 -0
- package/es/platform/sdk/application/interfaces/gateways/ISdkManager.js +1 -0
- package/es/platform/sdk/application/interfaces/gateways/IService.js +1 -0
- package/es/platform/sdk/application/interfaces/input/CreateResourceInstanceUseCaseInputModel.js +1 -0
- package/es/platform/sdk/application/interfaces/input/DestructResourceInstanceUseCaseInputModel.js +1 -0
- package/es/platform/sdk/application/interfaces/input/GetResourceInstanceUseCaseInputModel.js +1 -0
- package/es/platform/sdk/application/interfaces/input/RegisterResourceInputModel.js +1 -0
- package/es/platform/sdk/application/interfaces/input/SyncStateWithResourceInputModel.js +1 -0
- package/es/platform/sdk/application/interfaces/output/ISdkPresenter.js +3 -0
- package/es/platform/sdk/application/usecases/AbstractUseCase.js +16 -0
- package/es/platform/sdk/application/usecases/CreateResourceInstanceUseCase.js +16 -0
- package/es/platform/sdk/application/usecases/DestructResourceInstanceUseCase.js +16 -0
- package/es/platform/sdk/application/usecases/GetResourceInstanceUseCase.js +17 -0
- package/es/platform/sdk/application/usecases/RegisterResourceUseCase.js +16 -0
- package/es/platform/sdk/application/usecases/SyncStateWithResourceUseCase.js +25 -0
- package/es/platform/sdk/domain/entities/ResourceManager.js +95 -0
- package/es/platform/sdk/domain/entities/interfaces/IResourceManager.js +1 -0
- package/es/platform/sdk/domain/entities/interfaces/ResourceManagerRestoreModel.js +1 -0
- package/es/platform/sdk/domain/entities/interfaces/SdkResource.js +1 -0
- package/es/platform/sdk/domain/entities/interfaces/SdkResourceDependencies.js +1 -0
- package/es/platform/sdk/domain/entities/interfaces/StateInterface.js +1 -0
- package/es/platform/sdk/frameworks/AbstractResource.js +16 -0
- package/es/platform/sdk/frameworks/Sdk.js +11 -0
- package/es/platform/sdk/frameworks/SdkRegistry.js +72 -0
- package/es/platform/sdk-behaviour/adapters/controllers/AbstractController.js +11 -0
- package/es/platform/sdk-behaviour/adapters/controllers/DestructController.js +19 -0
- package/es/platform/sdk-behaviour/adapters/controllers/InitializeController.js +19 -0
- package/es/platform/sdk-behaviour/adapters/controllers/SyncStateWithResourceController.js +24 -0
- package/es/platform/sdk-behaviour/adapters/gateways/Repository.js +25 -0
- package/es/platform/sdk-behaviour/adapters/gateways/ResourceManagerGateWay.js +43 -0
- package/es/platform/sdk-behaviour/adapters/gateways/Service.js +19 -0
- package/es/platform/sdk-behaviour/applications/AbstractUseCase.js +6 -0
- package/es/platform/sdk-behaviour/applications/interfaces/UsecaseDependencies.js +1 -0
- package/es/platform/sdk-behaviour/applications/interfaces/gateways/IRepository.js +1 -0
- package/es/platform/sdk-behaviour/applications/interfaces/gateways/IResourceManagerGateWay.js +3 -0
- package/es/platform/sdk-behaviour/applications/interfaces/gateways/IService.js +1 -0
- package/es/platform/sdk-behaviour/applications/interfaces/input/CreateResourceInstanceUseCaseInputModel.js +1 -0
- package/es/platform/sdk-behaviour/applications/interfaces/input/DestructResourceInstanceUseCaseInputModel.js +1 -0
- package/es/platform/sdk-behaviour/applications/interfaces/input/SyncStateWithResourceUseCaseInputModel.js +1 -0
- package/es/platform/sdk-behaviour/applications/usecases/CreateResourceInstanceUseCase.js +14 -0
- package/es/platform/sdk-behaviour/applications/usecases/DestructResourceInstanceUseCase.js +14 -0
- package/es/platform/sdk-behaviour/applications/usecases/SyncStateWithResourceUseCase.js +22 -0
- package/es/platform/sdk-behaviour/domain/entities/BehaviourResourceConnector.js +49 -0
- package/es/platform/sdk-behaviour/domain/entities/interfaces/IBehaviourResourceConnector.js +1 -0
- package/es/platform/sdk-behaviour/domain/entities/interfaces/IResourceManagerProxy.js +2 -0
- package/es/platform/sdk-behaviour/frameworks/EventHandlerFactory.js +29 -0
- package/es/platform/sdk-behaviour/frameworks/SdkBehaviourFactory.js +16 -0
- package/es/platform/zform/frameworks/ui/EventHandlerFactory.js +2 -2
- package/es/platform/zlist/adapters/gateways/Repository.js +4 -2
- package/es/platform/zlist/adapters/presenters/SelectionTranslator.js +3 -1
- package/es/platform/zlist/adapters/presenters/TableTranslator.js +4 -1
- package/es/platform/zlist/adapters/presenters/translators/Header.js +5 -2
- package/es/platform/zlist/adapters/presenters/translators/ResizerStateTranslator.js +7 -3
- package/es/platform/zlist/applications/entities-factory/ListFactory.js +3 -2
- package/es/platform/zlist/applications/interfaces/input/GetContextUseCaseInput.js +1 -0
- package/es/platform/zlist/applications/interfaces/input/UpdateMultipleRecordUseCaseInput.js +1 -0
- package/es/platform/zlist/applications/usecases/DeleteMultipleRecordUseCase.js +23 -2
- package/es/platform/zlist/applications/usecases/DeleteSingleRecordUseCase.js +9 -0
- package/es/platform/zlist/applications/usecases/FetchMoreUseCase.js +4 -1
- package/es/platform/zlist/applications/usecases/GetContextUseCase.js +18 -0
- package/es/platform/zlist/applications/usecases/RecordExecuteFailedUseCase.js +3 -1
- package/es/platform/zlist/applications/usecases/RecordUpdateUseCase.js +9 -0
- package/es/platform/zlist/applications/usecases/UpdateMultipleRecordUseCase.js +34 -0
- package/es/platform/zlist/domain/entities/List.js +26 -2
- package/es/platform/zlist/frameworks/EventHandlersFactory.js +3 -3
- package/es/platform/zrecord/applications/interfaces/input/GetMultipleRecordUsecaseInputModel.js +1 -0
- package/es/platform/zrecord/applications/interfaces/input/GetSingleRecordUseCaseInputModel.js +1 -0
- package/es/platform/zrecord/applications/usecases/GetMultipleRecordUseCase.js +16 -0
- package/es/platform/zrecord/applications/usecases/GetSingleRecordUseCase.js +17 -0
- package/es/platform/zrecord/domain/entities/Records.js +9 -4
- package/es/platform/zrecord/domain/entities/RecordsManager.js +8 -0
- package/package.json +7 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import LifeCycleEvents from "../../cc/component/LifeCycleEventsEnum";
|
|
@@ -1,11 +1,13 @@
|
|
|
1
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
2
|
|
|
3
|
+
import LifeCycleEvents from "../component/LifeCycleEventsEnum";
|
|
4
|
+
|
|
3
5
|
class ActionLocationConstants {}
|
|
4
6
|
|
|
5
|
-
_defineProperty(ActionLocationConstants, "MOUNT",
|
|
7
|
+
_defineProperty(ActionLocationConstants, "MOUNT", `ActionLocation#${LifeCycleEvents.MOUNT}`);
|
|
6
8
|
|
|
7
|
-
_defineProperty(ActionLocationConstants, "UPDATE_PROPERTIES",
|
|
9
|
+
_defineProperty(ActionLocationConstants, "UPDATE_PROPERTIES", `ActionLocation#${LifeCycleEvents.UPDATE_PROPERTIES}`);
|
|
8
10
|
|
|
9
|
-
_defineProperty(ActionLocationConstants, "
|
|
11
|
+
_defineProperty(ActionLocationConstants, "UN_MOUNT", `ActionLocation#${LifeCycleEvents.UN_MOUNT}`);
|
|
10
12
|
|
|
11
13
|
export default ActionLocationConstants;
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
LifeCycleAction["UN_MOUNT"] = "UN_MOUNT";
|
|
4
|
-
LifeCycleAction["UPDATE_PROPERTIES"] = "UPDATE_PROPERTIES";
|
|
5
|
-
return LifeCycleAction;
|
|
6
|
-
}(LifeCycleAction || {});
|
|
7
|
-
|
|
8
|
-
export default LifeCycleAction;
|
|
1
|
+
import LifeCycleEvents from "../component/LifeCycleEventsEnum";
|
|
2
|
+
export default LifeCycleEvents;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var LifeCycleEvents = /*#__PURE__*/function (LifeCycleEvents) {
|
|
2
|
+
LifeCycleEvents["MOUNT"] = "MOUNT";
|
|
3
|
+
LifeCycleEvents["STATE_UPDATED"] = "STATE_UPDATED";
|
|
4
|
+
LifeCycleEvents["UN_MOUNT"] = "UN_MOUNT";
|
|
5
|
+
LifeCycleEvents["UPDATE_PROPERTIES"] = "UPDATE_PROPERTIES";
|
|
6
|
+
return LifeCycleEvents;
|
|
7
|
+
}(LifeCycleEvents || {});
|
|
8
|
+
|
|
9
|
+
export default LifeCycleEvents;
|
|
@@ -13,6 +13,10 @@ import { ResizeFinishController } from "../adapters/controllers/ResizeFinishCont
|
|
|
13
13
|
import ScrollController from "../adapters/controllers/ScrollController";
|
|
14
14
|
import ColumnChooserUpdateController from "../adapters/controllers/ColumnChooserUpdateController";
|
|
15
15
|
import ColumnChooserOpenedController from "../adapters/controllers/ColumnChooserOpenedController";
|
|
16
|
+
import { sdkRegistry } from "../../../platform/sdk/frameworks/SdkRegistry";
|
|
17
|
+
import { sdk } from "../../../platform/sdk/frameworks/Sdk";
|
|
18
|
+
window.sdkRegistry = sdkRegistry;
|
|
19
|
+
window.sdk = sdk;
|
|
16
20
|
const {
|
|
17
21
|
TABLE_LIST_RESIZE_START_REQUESTED,
|
|
18
22
|
TABLE_LIST_RESIZE_MOVE_REQUESTED,
|
|
@@ -23,12 +27,13 @@ const {
|
|
|
23
27
|
function createHandlerWithSdk(handler) {
|
|
24
28
|
return input => {
|
|
25
29
|
const {
|
|
26
|
-
state
|
|
27
|
-
dispatch
|
|
30
|
+
state
|
|
28
31
|
} = input;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
const instanceName = state.properties.instanceName;
|
|
33
|
+
handler({ ...input,
|
|
34
|
+
sdk
|
|
35
|
+
}, ListSdkFactory.create({
|
|
36
|
+
instanceName
|
|
32
37
|
}));
|
|
33
38
|
};
|
|
34
39
|
}
|
|
@@ -1,169 +1,54 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { RECORD_LOCAL_MULTIPLE_DELETE, RECORD_LOCAL_UPDATE } from "../../../bc/zrecord/Constants";
|
|
4
|
-
/* eslint-disable max-lines-per-function */
|
|
5
|
-
|
|
1
|
+
import ResourceNamesEnum from "../../../bc/sdk/ResourceNamesEnum";
|
|
2
|
+
import { sdk } from "../../../platform/sdk/frameworks/Sdk";
|
|
6
3
|
export default class ListSdkFactory {
|
|
7
4
|
static create(_ref) {
|
|
8
5
|
let {
|
|
9
|
-
|
|
10
|
-
dispatch
|
|
6
|
+
instanceName
|
|
11
7
|
} = _ref;
|
|
8
|
+
const smartTable = sdk[ResourceNamesEnum.SMART_TABLE](instanceName);
|
|
12
9
|
return {
|
|
13
10
|
zlist: {
|
|
14
11
|
getRecords() {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return (_state$behaviours = state.behaviours) === null || _state$behaviours === void 0 ? void 0 : _state$behaviours.zrecord.records;
|
|
12
|
+
return smartTable.getRecords();
|
|
18
13
|
},
|
|
19
14
|
|
|
20
15
|
getRecord(recordId) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return (_state$behaviours2 = state.behaviours) === null || _state$behaviours2 === void 0 ? void 0 : (_state$behaviours2$zr = _state$behaviours2.zrecord.records) === null || _state$behaviours2$zr === void 0 ? void 0 : _state$behaviours2$zr.find(r => r.id === recordId);
|
|
16
|
+
return smartTable.getRecord(recordId);
|
|
24
17
|
},
|
|
25
18
|
|
|
26
19
|
getContext(variableName) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const {
|
|
30
|
-
departmentId,
|
|
31
|
-
viewId,
|
|
32
|
-
moduleName
|
|
33
|
-
} = state.properties;
|
|
34
|
-
const {
|
|
35
|
-
servicePrefix,
|
|
36
|
-
...context
|
|
37
|
-
} = (_state$properties = state.properties) === null || _state$properties === void 0 ? void 0 : _state$properties.context;
|
|
38
|
-
const updatedContext = { ...context,
|
|
39
|
-
departmentId,
|
|
40
|
-
viewId,
|
|
41
|
-
moduleName
|
|
42
|
-
};
|
|
43
|
-
return variableName ? context === null || context === void 0 ? void 0 : context[variableName] : updatedContext;
|
|
20
|
+
return smartTable.getContext(variableName);
|
|
44
21
|
},
|
|
45
22
|
|
|
46
23
|
deleteRecord(recordId) {
|
|
47
|
-
|
|
48
|
-
data: [{
|
|
49
|
-
id: recordId,
|
|
50
|
-
Success: true,
|
|
51
|
-
error: null
|
|
52
|
-
}]
|
|
53
|
-
};
|
|
54
|
-
dispatch({
|
|
55
|
-
type: ZLIST_DELETE_RECORD,
|
|
56
|
-
payload: {
|
|
57
|
-
recordId
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
return output;
|
|
24
|
+
return smartTable.deleteRecord(recordId);
|
|
61
25
|
},
|
|
62
26
|
|
|
63
|
-
// deleteRecords(recordIds) {
|
|
64
|
-
// dispatch({
|
|
65
|
-
// type: ZLIST_DELETE_RECORDS,
|
|
66
|
-
// payload: {
|
|
67
|
-
// recordIds
|
|
68
|
-
// }
|
|
69
|
-
// });
|
|
70
|
-
// },
|
|
71
27
|
deleteRecords(recordIds) {
|
|
72
28
|
let shouldFetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
73
|
-
|
|
74
|
-
data: []
|
|
75
|
-
};
|
|
76
|
-
let DELETE_ACTION = shouldFetch ? ZLIST_DELETE_RECORDS : RECORD_LOCAL_MULTIPLE_DELETE;
|
|
77
|
-
dispatch({
|
|
78
|
-
type: DELETE_ACTION,
|
|
79
|
-
payload: {
|
|
80
|
-
recordIds
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
for (let recordId of recordIds) {
|
|
85
|
-
let recordUpdateDetail = {
|
|
86
|
-
id: recordId,
|
|
87
|
-
Success: true,
|
|
88
|
-
error: null
|
|
89
|
-
};
|
|
90
|
-
output.data.push(recordUpdateDetail);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return output;
|
|
29
|
+
return smartTable.deleteRecords(recordIds, shouldFetch);
|
|
94
30
|
},
|
|
95
31
|
|
|
96
32
|
updateRecord(recordId, record) {
|
|
97
|
-
|
|
98
|
-
results: [{
|
|
99
|
-
id: recordId,
|
|
100
|
-
Success: true,
|
|
101
|
-
error: null
|
|
102
|
-
}]
|
|
103
|
-
};
|
|
104
|
-
dispatch({
|
|
105
|
-
type: ZLIST_RECORD_UPDATE,
|
|
106
|
-
payload: {
|
|
107
|
-
recordId,
|
|
108
|
-
record
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
return output;
|
|
33
|
+
return smartTable.updateRecord(recordId, record);
|
|
112
34
|
},
|
|
113
35
|
|
|
114
36
|
updateRecords(recordsMap) {
|
|
115
37
|
let shouldFetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
116
|
-
|
|
117
|
-
results: []
|
|
118
|
-
};
|
|
119
|
-
let UPDATE_ACTION = shouldFetch ? ZLIST_RECORD_UPDATE : RECORD_LOCAL_UPDATE;
|
|
120
|
-
|
|
121
|
-
for (let record of recordsMap) {
|
|
122
|
-
dispatch({
|
|
123
|
-
type: UPDATE_ACTION,
|
|
124
|
-
payload: {
|
|
125
|
-
recordId: record.id,
|
|
126
|
-
record: record
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
let recordUpdateDetail = {
|
|
130
|
-
id: record.id,
|
|
131
|
-
Success: true,
|
|
132
|
-
error: null
|
|
133
|
-
};
|
|
134
|
-
output.results.push(recordUpdateDetail);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return output;
|
|
38
|
+
return smartTable.updateRecords(recordsMap, shouldFetch);
|
|
138
39
|
},
|
|
139
40
|
|
|
140
41
|
selectRecords: ids => {
|
|
141
|
-
|
|
142
|
-
type: LIST_SELECTION_SELECT_ITEM,
|
|
143
|
-
payload: {
|
|
144
|
-
ids
|
|
145
|
-
}
|
|
146
|
-
});
|
|
42
|
+
smartTable.selectRecords(ids);
|
|
147
43
|
},
|
|
148
44
|
deselectRecords: ids => {
|
|
149
|
-
|
|
150
|
-
type: LIST_SELECTION_DESELECT_ITEM,
|
|
151
|
-
payload: {
|
|
152
|
-
ids
|
|
153
|
-
}
|
|
154
|
-
});
|
|
45
|
+
smartTable.deselectRecords(ids);
|
|
155
46
|
},
|
|
156
47
|
selectAllRecords: () => {
|
|
157
|
-
|
|
158
|
-
type: LIST_SELECTION_SELECT_ITEM,
|
|
159
|
-
payload: {}
|
|
160
|
-
});
|
|
48
|
+
smartTable.selectAllRecords();
|
|
161
49
|
},
|
|
162
50
|
deselectAllRecords: () => {
|
|
163
|
-
|
|
164
|
-
type: LIST_SELECTION_DESELECT_ITEM,
|
|
165
|
-
payload: {}
|
|
166
|
-
});
|
|
51
|
+
smartTable.deselectAllRecords();
|
|
167
52
|
}
|
|
168
53
|
}
|
|
169
54
|
};
|
|
@@ -14,6 +14,14 @@ import LocalStorageBehaviourFactory from "../../../library/behaviours/local-stor
|
|
|
14
14
|
import TableColumnResizerBehaviorFactory from "../../../library/behaviours/table-column-resizer/frameworks/TableColumnResizerBehaviorFactory";
|
|
15
15
|
import ListItemSelectionBehaviourFactory from "../../../library/behaviours/list-selection/frameworks/ListItemSelectionBehaviourFactory";
|
|
16
16
|
import ColumnChooserBehaviourFactory from "../../../platform/column-chooser/frameworks/ColumnChooserBehaviourFactory";
|
|
17
|
+
import SdkBehaviourFactory from "../../../platform/sdk-behaviour/frameworks/SdkBehaviourFactory";
|
|
18
|
+
import ResourceNamesEnum from "../../../bc/sdk/ResourceNamesEnum";
|
|
19
|
+
import { sdkRegistry } from "../../../platform/sdk/frameworks/SdkRegistry";
|
|
20
|
+
import { SmartTableResource } from "./resources/SmartTableResource";
|
|
21
|
+
sdkRegistry.registerResource({
|
|
22
|
+
resourceName: ResourceNamesEnum.SMART_TABLE,
|
|
23
|
+
resource: SmartTableResource
|
|
24
|
+
});
|
|
17
25
|
import KeyboardControlBehaviourFactory from "../../../library/behaviours/keyboard-controls/frameworks/KeyboardControlBehaviourFactory";
|
|
18
26
|
export default class TableConnectedFactory {
|
|
19
27
|
static create(_ref) {
|
|
@@ -43,7 +51,7 @@ export default class TableConnectedFactory {
|
|
|
43
51
|
properties: Properties,
|
|
44
52
|
eventHandlers: EventHandlersFactory.create(eventHandlers),
|
|
45
53
|
transformState: TableTranslator.transformState,
|
|
46
|
-
behaviours: [TableColumnResizerBehaviorFactory.create(), KeyboardControlBehaviourFactory.create(), LocalStorageBehaviourFactory.create(), ZHttpBehaviourFactory.create(), DataSourceBehaviourFactory.create(), RecordBehaviourFactory.create(_dataSource.httpTemplates), ClientActionsBehaviourFactory.create({
|
|
54
|
+
behaviours: [SdkBehaviourFactory.create([ResourceNamesEnum.SMART_TABLE]), TableColumnResizerBehaviorFactory.create(), KeyboardControlBehaviourFactory.create(), LocalStorageBehaviourFactory.create(), ZHttpBehaviourFactory.create(), DataSourceBehaviourFactory.create(), RecordBehaviourFactory.create(_dataSource.httpTemplates), ClientActionsBehaviourFactory.create({
|
|
47
55
|
getClientActions: _dataSource.httpTemplates.getClientActions
|
|
48
56
|
}), ZFieldBehaviourFactory.create({
|
|
49
57
|
availableFields: _dataSource.httpTemplates.getAvailableFields,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { AbstractResource } from "../../../../platform/sdk/frameworks/AbstractResource";
|
|
2
|
+
import ZListRepository from "../../../../platform/zlist/adapters/gateways/Repository";
|
|
3
|
+
import ZListSortBy from "../../../../platform/zlist/adapters/gateways/SortBy";
|
|
4
|
+
import ZListPresenters from "../../../../platform/zlist/adapters/presenters/Presenters";
|
|
5
|
+
import ZRecordRepository from "../../../../platform/zrecord/adapters/gateways/Repository";
|
|
6
|
+
import ZRecordPresenter from "../../../../platform/zrecord/adapters/presenters/Presenter";
|
|
7
|
+
import ListSelectRepository from "../../../../library/behaviours/list-selection/adapters/gateways/Repository";
|
|
8
|
+
import ListSelectPresenter from "../../../../library/behaviours/list-selection/adapters/presenters/Presenter";
|
|
9
|
+
import ListSelectSelectUsecase from "../../../../library/behaviours/list-selection/applications/usecases/Select";
|
|
10
|
+
import ListSelectDeselectUsecase from "../../../../library/behaviours/list-selection/applications/usecases/Deselect";
|
|
11
|
+
import GetMultipleRecordUseCase from "../../../../platform/zrecord/applications/usecases/GetMultipleRecordUseCase";
|
|
12
|
+
import GetSingleRecordUseCase from "../../../../platform/zrecord/applications/usecases/GetSingleRecordUseCase";
|
|
13
|
+
import DeleteSingleRecordUseCase from "../../../../platform/zlist/applications/usecases/DeleteSingleRecordUseCase";
|
|
14
|
+
import DeleteMultipleRecordUseCase from "../../../../platform/zlist/applications/usecases/DeleteMultipleRecordUseCase";
|
|
15
|
+
import RecordUpdateUseCase from "../../../../platform/zlist/applications/usecases/RecordUpdateUseCase";
|
|
16
|
+
import UpdateMultipleRecordUseCase from "../../../../platform/zlist/applications/usecases/UpdateMultipleRecordUseCase";
|
|
17
|
+
import GetContextUseCase from "../../../../platform/zlist/applications/usecases/GetContextUseCase";
|
|
18
|
+
export class SmartTableResource extends AbstractResource {
|
|
19
|
+
getRecordDependencies() {
|
|
20
|
+
const dependencies = {
|
|
21
|
+
repository: new ZRecordRepository(),
|
|
22
|
+
presenter: new ZRecordPresenter()
|
|
23
|
+
};
|
|
24
|
+
return dependencies;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
getListDependencies() {
|
|
28
|
+
const dependencies = {
|
|
29
|
+
repository: new ZListRepository(),
|
|
30
|
+
presenter: new ZListPresenters(),
|
|
31
|
+
sortBy: new ZListSortBy()
|
|
32
|
+
};
|
|
33
|
+
return dependencies;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
getListSelectDependencies() {
|
|
37
|
+
const dependencies = {
|
|
38
|
+
repository: new ListSelectRepository(),
|
|
39
|
+
presenter: new ListSelectPresenter()
|
|
40
|
+
};
|
|
41
|
+
return dependencies;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
createUseCase(dependencies, UseCaseClass) {
|
|
45
|
+
var _usecase$updateDepend, _usecase$updateDepend2;
|
|
46
|
+
|
|
47
|
+
const {
|
|
48
|
+
state,
|
|
49
|
+
updateState
|
|
50
|
+
} = this.dependencies;
|
|
51
|
+
const usecase = new UseCaseClass(dependencies);
|
|
52
|
+
(_usecase$updateDepend = usecase.updateDependency) === null || _usecase$updateDepend === void 0 ? void 0 : _usecase$updateDepend.call(usecase, state, updateState);
|
|
53
|
+
(_usecase$updateDepend2 = usecase.updateDependencies) === null || _usecase$updateDepend2 === void 0 ? void 0 : _usecase$updateDepend2.call(usecase, state, updateState);
|
|
54
|
+
return usecase;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
createCallback() {
|
|
58
|
+
let temp = null;
|
|
59
|
+
return {
|
|
60
|
+
setData: data => {
|
|
61
|
+
temp = data;
|
|
62
|
+
},
|
|
63
|
+
getData: () => temp
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
getRecords() {
|
|
68
|
+
const {
|
|
69
|
+
getData,
|
|
70
|
+
setData
|
|
71
|
+
} = this.createCallback();
|
|
72
|
+
const dependencies = this.getRecordDependencies();
|
|
73
|
+
const usecase = this.createUseCase(dependencies, GetMultipleRecordUseCase);
|
|
74
|
+
usecase.execute({
|
|
75
|
+
callback: setData
|
|
76
|
+
});
|
|
77
|
+
return getData();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
getRecord(recordId) {
|
|
81
|
+
const {
|
|
82
|
+
getData,
|
|
83
|
+
setData
|
|
84
|
+
} = this.createCallback();
|
|
85
|
+
const dependencies = this.getRecordDependencies();
|
|
86
|
+
const usecase = this.createUseCase(dependencies, GetSingleRecordUseCase);
|
|
87
|
+
usecase.execute({
|
|
88
|
+
recordId,
|
|
89
|
+
callback: setData
|
|
90
|
+
});
|
|
91
|
+
return getData();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
getContext(variableName) {
|
|
95
|
+
const {
|
|
96
|
+
getData,
|
|
97
|
+
setData
|
|
98
|
+
} = this.createCallback();
|
|
99
|
+
const dependencies = this.getListDependencies();
|
|
100
|
+
const usecase = this.createUseCase(dependencies, GetContextUseCase);
|
|
101
|
+
usecase.execute({
|
|
102
|
+
variableName,
|
|
103
|
+
callback: setData
|
|
104
|
+
});
|
|
105
|
+
return getData();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
deleteRecord(recordId) {
|
|
109
|
+
const {
|
|
110
|
+
dispatch
|
|
111
|
+
} = this.dependencies;
|
|
112
|
+
const {
|
|
113
|
+
getData,
|
|
114
|
+
setData
|
|
115
|
+
} = this.createCallback();
|
|
116
|
+
const dependencies = this.getListDependencies();
|
|
117
|
+
const usecase = this.createUseCase(dependencies, DeleteSingleRecordUseCase);
|
|
118
|
+
usecase.execute({
|
|
119
|
+
recordId,
|
|
120
|
+
dispatch,
|
|
121
|
+
callback: setData
|
|
122
|
+
});
|
|
123
|
+
return getData();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
deleteRecords(recordIds) {
|
|
127
|
+
let shouldFetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
128
|
+
const {
|
|
129
|
+
dispatch
|
|
130
|
+
} = this.dependencies;
|
|
131
|
+
const {
|
|
132
|
+
getData,
|
|
133
|
+
setData
|
|
134
|
+
} = this.createCallback();
|
|
135
|
+
const dependencies = this.getListDependencies();
|
|
136
|
+
const usecase = this.createUseCase(dependencies, DeleteMultipleRecordUseCase);
|
|
137
|
+
usecase.execute({
|
|
138
|
+
recordIds,
|
|
139
|
+
dispatch,
|
|
140
|
+
callback: setData,
|
|
141
|
+
shouldFetch
|
|
142
|
+
});
|
|
143
|
+
return getData();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
updateRecord(recordId, record) {
|
|
147
|
+
let shouldFetch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
148
|
+
const {
|
|
149
|
+
dispatch
|
|
150
|
+
} = this.dependencies;
|
|
151
|
+
const {
|
|
152
|
+
getData,
|
|
153
|
+
setData
|
|
154
|
+
} = this.createCallback();
|
|
155
|
+
const dependencies = this.getListDependencies();
|
|
156
|
+
const usecase = this.createUseCase(dependencies, RecordUpdateUseCase);
|
|
157
|
+
usecase.execute({
|
|
158
|
+
recordId,
|
|
159
|
+
dispatch,
|
|
160
|
+
callback: setData,
|
|
161
|
+
record,
|
|
162
|
+
shouldFetch
|
|
163
|
+
});
|
|
164
|
+
return getData();
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
updateRecords(recordsMap) {
|
|
168
|
+
let shouldFetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
169
|
+
const {
|
|
170
|
+
dispatch
|
|
171
|
+
} = this.dependencies;
|
|
172
|
+
const {
|
|
173
|
+
getData,
|
|
174
|
+
setData
|
|
175
|
+
} = this.createCallback();
|
|
176
|
+
const dependencies = this.getListDependencies();
|
|
177
|
+
const usecase = this.createUseCase(dependencies, UpdateMultipleRecordUseCase);
|
|
178
|
+
usecase.execute({
|
|
179
|
+
recordsMap,
|
|
180
|
+
dispatch,
|
|
181
|
+
callback: setData,
|
|
182
|
+
shouldFetch
|
|
183
|
+
});
|
|
184
|
+
return getData();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
selectRecords(ids) {
|
|
188
|
+
const {
|
|
189
|
+
dispatch
|
|
190
|
+
} = this.dependencies;
|
|
191
|
+
const dependencies = this.getListSelectDependencies();
|
|
192
|
+
const usecase = this.createUseCase(dependencies, ListSelectSelectUsecase);
|
|
193
|
+
usecase.execute({
|
|
194
|
+
ids,
|
|
195
|
+
dispatch
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
deselectRecords(ids) {
|
|
200
|
+
const {
|
|
201
|
+
dispatch
|
|
202
|
+
} = this.dependencies;
|
|
203
|
+
const dependencies = this.getListSelectDependencies();
|
|
204
|
+
const usecase = this.createUseCase(dependencies, ListSelectDeselectUsecase);
|
|
205
|
+
usecase.execute({
|
|
206
|
+
ids,
|
|
207
|
+
dispatch
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
selectAllRecords() {
|
|
212
|
+
const {
|
|
213
|
+
dispatch
|
|
214
|
+
} = this.dependencies;
|
|
215
|
+
const dependencies = this.getListSelectDependencies();
|
|
216
|
+
const usecase = this.createUseCase(dependencies, ListSelectSelectUsecase);
|
|
217
|
+
usecase.execute({
|
|
218
|
+
dispatch
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
deselectAllRecords() {
|
|
223
|
+
const {
|
|
224
|
+
dispatch
|
|
225
|
+
} = this.dependencies;
|
|
226
|
+
const dependencies = this.getListSelectDependencies();
|
|
227
|
+
const usecase = this.createUseCase(dependencies, ListSelectDeselectUsecase);
|
|
228
|
+
usecase.execute({
|
|
229
|
+
dispatch
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
}
|
package/es/index.js
CHANGED
|
@@ -6,4 +6,6 @@ export { TableConnectedFactory } from "./desk-frameworks";
|
|
|
6
6
|
export { ComponentRegistry, createCustomComponent } from "./library";
|
|
7
7
|
export { default as TableFieldComponents } from "./library/dot/legacy-to-new-arch/table-field-components";
|
|
8
8
|
import * as _Components from "./library/dot/legacy-to-new-arch";
|
|
9
|
-
export { _Components as Components };
|
|
9
|
+
export { _Components as Components };
|
|
10
|
+
export { sdk } from "./platform/sdk/frameworks/Sdk";
|
|
11
|
+
export { sdkRegistry } from "./platform/sdk/frameworks/SdkRegistry";
|
|
@@ -8,8 +8,11 @@ class DestructUsecase extends AbstractUseCase {
|
|
|
8
8
|
keyboardHandler
|
|
9
9
|
} = this.dependencies;
|
|
10
10
|
const keyboardControls = repository.getKeyboardControls();
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
|
|
12
|
+
if (keyboardControls !== null) {
|
|
13
|
+
keyboardHandler.destruct(host);
|
|
14
|
+
presenter.updateKeyboardControls(keyboardControls.toObject());
|
|
15
|
+
}
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
}
|
|
@@ -10,6 +10,7 @@ import UpdateController from "../adapters/controllers/UpdateController";
|
|
|
10
10
|
import DestructController from "../adapters/controllers/DestructController";
|
|
11
11
|
import SelectController from "../adapters/controllers/SelectController";
|
|
12
12
|
import DeselectController from "../adapters/controllers/DeselectController";
|
|
13
|
+
import LifeCycleEvents from "../../../../cc/component/LifeCycleEventsEnum";
|
|
13
14
|
|
|
14
15
|
class ActionHandlerFactory {
|
|
15
16
|
static create() {
|
|
@@ -28,9 +29,9 @@ class ActionHandlerFactory {
|
|
|
28
29
|
|
|
29
30
|
static createHandlers(service) {
|
|
30
31
|
return {
|
|
31
|
-
[
|
|
32
|
-
[
|
|
33
|
-
[
|
|
32
|
+
[LifeCycleEvents.MOUNT]: new InitializeController(service).handle,
|
|
33
|
+
[LifeCycleEvents.UPDATE_PROPERTIES]: new UpdateController(service).handle,
|
|
34
|
+
[LifeCycleEvents.UN_MOUNT]: new DestructController(service).handle,
|
|
34
35
|
[LIST_SELECTION_SELECT_ITEM]: new SelectController(service).handle,
|
|
35
36
|
[LIST_SELECTION_DESELECT_ITEM]: new DeselectController(service).handle,
|
|
36
37
|
[LIST_SELECTION_TOGGLE_ITEMS]: new SelectionController(service).handle,
|
|
@@ -1,31 +1,18 @@
|
|
|
1
|
+
import LifeCycleEvents from "../../../../cc/component/LifeCycleEventsEnum";
|
|
1
2
|
import Behaviour from "../../domain/entities/Behaviour";
|
|
2
3
|
import EventHandlersFactory from "./EventHandlersFactory";
|
|
3
4
|
import PropertiesFactory from "./PropertiesFactory";
|
|
4
|
-
/* eslint-disable max-lines-per-function, @zohodesk/architecturerules/no-returnStatement-rule */
|
|
5
5
|
|
|
6
6
|
class BehavioursFactory {
|
|
7
7
|
static create(input) {
|
|
8
|
-
|
|
9
|
-
let behaviours = input.behaviours || [];
|
|
8
|
+
const behaviours = input.behaviours ? input.behaviours : [];
|
|
10
9
|
return behaviours.map(behaviour => {
|
|
11
10
|
// DEPRECATED: Remove while refactoring actionHandlers
|
|
12
11
|
if (behaviour.actionHandlers) {
|
|
13
12
|
behaviour.eventHandlers = behaviour.actionHandlers;
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
const
|
|
17
|
-
eventHandlers
|
|
18
|
-
} = behaviour;
|
|
19
|
-
let newEventHandlers = Object.keys(eventHandlers).reduce((res, next) => {
|
|
20
|
-
let key = next;
|
|
21
|
-
|
|
22
|
-
if (['MOUNT', 'UN_MOUNT', 'UPDATE_PROPERTIES'].includes(next)) {
|
|
23
|
-
key = input.name + '#' + next;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
res[key] = eventHandlers[next];
|
|
27
|
-
return res;
|
|
28
|
-
}, {});
|
|
15
|
+
const newEventHandlers = BehavioursFactory.createNamedEventHandlers(behaviour.eventHandlers, input);
|
|
29
16
|
return new Behaviour({
|
|
30
17
|
name: behaviour.name,
|
|
31
18
|
eventHandlers: EventHandlersFactory(newEventHandlers),
|
|
@@ -38,6 +25,21 @@ class BehavioursFactory {
|
|
|
38
25
|
});
|
|
39
26
|
}
|
|
40
27
|
|
|
28
|
+
static createNamedEventHandlers(eventHandlers, input) {
|
|
29
|
+
return Object.keys(eventHandlers).reduce((res, key) => {
|
|
30
|
+
// if (['MOUNT', 'UN_MOUNT', 'UPDATE_PROPERTIES'].includes(eventName)) {
|
|
31
|
+
// if ('MOUNT', LifeCycleEvents.UN_MOUNT, LifeCycleEvents.UPDATE_PROPERTIES, LifeCycleEvents.STATE_UPDATED].includes(eventName)) {
|
|
32
|
+
let eventName = key;
|
|
33
|
+
|
|
34
|
+
if (LifeCycleEvents[key]) {
|
|
35
|
+
eventName = `${input.name}#${key}`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
res[eventName] = eventHandlers[key];
|
|
39
|
+
return res;
|
|
40
|
+
}, {});
|
|
41
|
+
}
|
|
42
|
+
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
export default BehavioursFactory;
|
|
@@ -4,7 +4,8 @@ class UpdateStateUseCase extends AbstractUseCase {
|
|
|
4
4
|
execute(newState) {
|
|
5
5
|
let {
|
|
6
6
|
repository,
|
|
7
|
-
presenter
|
|
7
|
+
presenter,
|
|
8
|
+
eventManager
|
|
8
9
|
} = this.dependencies;
|
|
9
10
|
let component = repository.getComponent(); // let preState=component.getState();
|
|
10
11
|
// console.log(`preState ${component.getName()}`,preState)
|
|
@@ -13,6 +14,9 @@ class UpdateStateUseCase extends AbstractUseCase {
|
|
|
13
14
|
let state = component.getState(); // console.log(`newState ${component.getName()}`,state)
|
|
14
15
|
|
|
15
16
|
presenter.render(state);
|
|
17
|
+
eventManager.dispatch(component.getStateUpdatedAction({
|
|
18
|
+
state
|
|
19
|
+
}));
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
}
|