@zohodesk/library-platform 1.1.3-exp.1 → 1.1.3-exp.2
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 +3 -3
- package/es/bc/zlist/Constants.js +3 -1
- package/es/bc/zrecord/Constants.js +3 -1
- package/es/cc/table-connected/Properties.js +16 -0
- package/es/cc/table-list/Constants.js +4 -0
- package/es/cc/table-list/Properties.js +16 -0
- package/es/cc/table-list/row/Properties.js +35 -0
- package/es/index.js +4 -3
- package/es/library/dot/components/table-list/frameworks/hooks/useDropIndicator.js +8 -0
- package/es/library/dot/components/table-list/frameworks/hooks/useRowData.js +8 -0
- package/es/library/dot/components/table-list/frameworks/hooks/useTableRowReorder.js +93 -0
- package/es/library/dot/components/table-list/frameworks/ui/TableListView.js +67 -6
- package/es/library/dot/components/table-list/frameworks/ui/css/TableList.module.css +145 -2
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/Header.js +22 -4
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/Rows.js +22 -9
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/MassAction.js +19 -2
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/Row.js +55 -10
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/RowSelection.js +10 -0
- package/es/library/dot/components/table-list/frameworks/utils/reOrder.js +76 -0
- package/es/platform/client-actions/translators/client-actions-translator/index.js +5 -2
- package/es/platform/client-actions/translators/condition-resolver/field-evaluators/GetResolvedContextFieldValue.js +3 -2
- package/es/platform/client-actions/translators/context-resolver/index.js +1 -4
- package/es/platform/components/form-connected/frameworks/FormConnectedFactory.js +33 -0
- package/es/{desk-frameworks → platform/components}/form-connected/frameworks/FormConnectedView.js +1 -1
- package/es/{desk-frameworks → platform/components}/form-connected/frameworks/FormSdkFactory.js +3 -14
- package/es/platform/components/table-connected/adapters/controllers/ColumnChooserOpenedController.js +28 -0
- package/es/{desk-frameworks → platform/components}/table-connected/adapters/controllers/ColumnChooserUpdateController.js +5 -5
- package/es/platform/components/table-connected/adapters/controllers/ReOrderFinishController.js +21 -0
- package/es/{desk-frameworks → platform/components}/table-connected/adapters/controllers/ResizeByMouseController.js +1 -1
- package/es/{desk-frameworks → platform/components}/table-connected/adapters/controllers/ResizeEndController.js +1 -1
- package/es/{desk-frameworks → platform/components}/table-connected/adapters/controllers/ResizeFinishController.js +1 -1
- package/es/{desk-frameworks → platform/components}/table-connected/adapters/controllers/ResizeStartController.js +2 -2
- package/es/{desk-frameworks → platform/components}/table-connected/adapters/controllers/ScrollController.js +1 -1
- package/es/{desk-frameworks/table-connected/frameworks → platform/components/table-connected/adapters}/resources/SmartTableResource.js +35 -17
- package/es/{desk-frameworks → platform/components}/table-connected/frameworks/EventHandlersFactory.js +20 -17
- package/es/platform/components/table-connected/frameworks/ListSdkFactory.js +57 -0
- package/es/platform/components/table-connected/frameworks/TableConnectedFactory.js +76 -0
- package/es/{desk-frameworks → platform/components}/table-connected/frameworks/TableConnectedView.js +5 -3
- package/es/platform/data-source/http-template/reOrderRecord.js +44 -0
- package/es/platform/data-source/index.js +2 -0
- package/es/platform/sdk/{frameworks → application/interfaces/gateways}/AbstractResource.js +1 -4
- package/es/platform/sdk/domain/entities/ResourceManager.js +1 -1
- package/es/platform/sdk/frameworks/Sdk.js +1 -1
- package/es/platform/zlist/adapters/controllers/ReOrderController.js +25 -0
- package/es/platform/zlist/adapters/controllers/ReOrderFailedController.js +26 -0
- package/es/platform/zlist/adapters/gateways/Repository.js +7 -0
- package/es/platform/zlist/adapters/gateways/Service.js +8 -0
- package/es/platform/zlist/adapters/presenters/TableTranslator.js +5 -1
- package/es/platform/zlist/adapters/presenters/translators/ColumnTranslator.js +9 -10
- package/es/platform/zlist/adapters/presenters/utils/DefaultClientActions.js +1 -1
- package/es/platform/zlist/applications/interfaces/input/ReOrderRecordUseCaseInput.js +1 -0
- package/es/platform/zlist/applications/usecases/ReOrderFailedUseCase.js +22 -0
- package/es/platform/zlist/applications/usecases/ReOrderUseCase.js +25 -0
- package/es/platform/zlist/applications/usecases/RecordSuccessCallbackUsecase.js +24 -3
- package/es/platform/zlist/domain/entities/List.js +66 -2
- package/es/platform/zlist/frameworks/EventHandlersFactory.js +7 -3
- package/es/platform/zlist/frameworks/ZListBehaviourFactory.js +2 -1
- package/es/platform/zrecord/domain/entities/GetReOrderRecordsStrategy.js +40 -0
- package/es/platform/zrecord/domain/entities/RecordsManager.js +3 -1
- package/package.json +6 -4
- package/es/desk-frameworks/form-connected/frameworks/FormConnectedFactory.js +0 -33
- package/es/desk-frameworks/table-connected/adapters/controllers/ColumnChooserOpenedController.js +0 -36
- package/es/desk-frameworks/table-connected/frameworks/ListSdkFactory.js +0 -57
- package/es/desk-frameworks/table-connected/frameworks/TableConnectedFactory.js +0 -64
- /package/es/{desk-frameworks → platform/components}/form-connected/frameworks/EventHandlersFactory.js +0 -0
- /package/es/{desk-frameworks → platform/components}/form-connected/frameworks/FormConnected.js +0 -0
- /package/es/{desk-frameworks → platform/components}/index.js +0 -0
- /package/es/{desk-frameworks → platform/components}/table-connected/adapters/controllers/AbstractController.js +0 -0
- /package/es/{desk-frameworks/table-connected/frameworks/resources → platform/components/table-connected/application/interfaces}/ISmartTableResource.js +0 -0
- /package/es/{desk-frameworks → platform/components}/table-connected/frameworks/TableConnected.js +0 -0
|
@@ -1,18 +1,39 @@
|
|
|
1
|
+
import { SET_RECORDS } from "../../../../bc/zrecord/Constants";
|
|
1
2
|
import AbstractUseCase from "./AbstractUseCase";
|
|
2
3
|
|
|
3
4
|
class RecordSuccessCallbackUsecase extends AbstractUseCase {
|
|
4
|
-
execute(
|
|
5
|
-
|
|
5
|
+
execute(_ref) {
|
|
6
|
+
var _metaData$sourceMetaD;
|
|
7
|
+
|
|
8
|
+
let {
|
|
6
9
|
dispatch,
|
|
7
10
|
payload,
|
|
8
11
|
metaData
|
|
9
|
-
} =
|
|
12
|
+
} = _ref;
|
|
10
13
|
const {
|
|
11
14
|
repository,
|
|
12
15
|
presenter
|
|
13
16
|
} = this.dependencies;
|
|
14
17
|
const list = repository.getList();
|
|
15
18
|
|
|
19
|
+
if ((_metaData$sourceMetaD = metaData.sourceMetaData) !== null && _metaData$sourceMetaD !== void 0 && _metaData$sourceMetaD.isReOrder) {
|
|
20
|
+
list.reOrderEnded();
|
|
21
|
+
presenter.updateView(list.toObject()); // convert to separate use-case
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
oldIndex,
|
|
25
|
+
newIndex
|
|
26
|
+
} = payload.response;
|
|
27
|
+
const records = repository.getRecords();
|
|
28
|
+
const reordered = oldIndex === newIndex ? records : list.arrayMoveImmutable(records, oldIndex, newIndex);
|
|
29
|
+
dispatch({
|
|
30
|
+
type: SET_RECORDS,
|
|
31
|
+
payload: {
|
|
32
|
+
records: reordered
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
16
37
|
if (list.isAcknowledgeBySortBy(metaData)) {
|
|
17
38
|
list.setSortBy(metaData);
|
|
18
39
|
presenter.updateView(list.toObject());
|
|
@@ -1,26 +1,36 @@
|
|
|
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 } from "../../../../bc/zlist/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";
|
|
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, errorRecordFailed) {
|
|
9
|
+
constructor(limit, sortBy, query, context, isReOrderLoading, errorRecordFailed) {
|
|
10
10
|
this.limit = limit;
|
|
11
11
|
this.sortBy = sortBy;
|
|
12
12
|
this.query = query;
|
|
13
13
|
this.context = context;
|
|
14
|
+
this.isReOrderLoading = isReOrderLoading;
|
|
14
15
|
this.errorRecordFailed = errorRecordFailed;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
toObject() {
|
|
18
19
|
return {
|
|
19
20
|
sortBy: this.sortBy.toObject(),
|
|
21
|
+
isReOrderLoading: this.isReOrderLoading,
|
|
20
22
|
errorRecordFailed: this.errorRecordFailed
|
|
21
23
|
};
|
|
22
24
|
}
|
|
23
25
|
|
|
26
|
+
reOrderStarted() {
|
|
27
|
+
this.isReOrderLoading = true;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
reOrderEnded() {
|
|
31
|
+
this.isReOrderLoading = false;
|
|
32
|
+
}
|
|
33
|
+
|
|
24
34
|
setSortBy(sortBy) {
|
|
25
35
|
this.sortBy = new SortBy(sortBy.id, sortBy.name, sortBy.order);
|
|
26
36
|
}
|
|
@@ -265,6 +275,21 @@ class List {
|
|
|
265
275
|
});
|
|
266
276
|
}
|
|
267
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
|
+
}
|
|
292
|
+
|
|
268
293
|
return actions;
|
|
269
294
|
}
|
|
270
295
|
|
|
@@ -282,6 +307,28 @@ class List {
|
|
|
282
307
|
};
|
|
283
308
|
}
|
|
284
309
|
|
|
310
|
+
getReOrderRecordAction(_ref2) {
|
|
311
|
+
let {
|
|
312
|
+
newIndex,
|
|
313
|
+
oldIndex
|
|
314
|
+
} = _ref2;
|
|
315
|
+
const props = this.createApiProps();
|
|
316
|
+
return {
|
|
317
|
+
type: RECORD_EXECUTE,
|
|
318
|
+
metaData: {
|
|
319
|
+
isReOrder: true
|
|
320
|
+
},
|
|
321
|
+
payload: {
|
|
322
|
+
actionName: RecordApiActionName.GET_REORDERRECORD,
|
|
323
|
+
props: { ...props,
|
|
324
|
+
newIndex,
|
|
325
|
+
oldIndex
|
|
326
|
+
},
|
|
327
|
+
apiName: 'records'
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
|
|
285
332
|
createMoreRecordFetchAction() {
|
|
286
333
|
const props = this.createApiProps();
|
|
287
334
|
return {
|
|
@@ -348,6 +395,23 @@ class List {
|
|
|
348
395
|
};
|
|
349
396
|
}
|
|
350
397
|
|
|
398
|
+
arrayMoveImmutable(data, fromIndex, toIndex) {
|
|
399
|
+
if (fromIndex === toIndex) {
|
|
400
|
+
return [...data];
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
const newOrder = [...data];
|
|
404
|
+
const startIndex = fromIndex < 0 ? newOrder.length + fromIndex : fromIndex;
|
|
405
|
+
const endIndex = toIndex < 0 ? newOrder.length + toIndex : toIndex;
|
|
406
|
+
|
|
407
|
+
if (startIndex >= 0 && startIndex < newOrder.length) {
|
|
408
|
+
const [item] = newOrder.splice(startIndex, 1);
|
|
409
|
+
newOrder.splice(endIndex, 0, item);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
return newOrder;
|
|
413
|
+
}
|
|
414
|
+
|
|
351
415
|
createAvailableFieldsRefetchAction() {
|
|
352
416
|
const props = this.createApiProps();
|
|
353
417
|
return {
|
|
@@ -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_RECORD_DELETE_SUCCEEDED, ZLIST_RECORD_UPDATE, ZLIST_RECORD_UPDATE_SUCCEEDED, ZLIST_SORT } from "../../../bc/zlist/Constants";
|
|
7
|
+
import { ZLIST_DELETE_RECORD, ZLIST_DELETE_RECORDS, ZLIST_FETCH_MORE, ZLIST_RECORD_DELETE_SUCCEEDED, ZLIST_RECORD_UPDATE, ZLIST_RECORD_UPDATE_SUCCEEDED, ZLIST_SORT, ZLIST_RECORD_REORDER, ZLIST_RECORD_REORDER_FAILED } 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";
|
|
@@ -20,6 +20,8 @@ import UpdateSuccessController from "../adapters/controllers/UpdateSuccessContro
|
|
|
20
20
|
import DeleteSuccessController from "../adapters/controllers/DeleteSuccessController";
|
|
21
21
|
import Presenter from "../adapters/presenters/Presenters";
|
|
22
22
|
import RecordSuccessCallbackController from "../adapters/controllers/RecordSuccessCallbackController";
|
|
23
|
+
import ReOrderController from "../adapters/controllers/ReOrderController";
|
|
24
|
+
import ReOrderFailedController from "../adapters/controllers/ReOrderFailedController";
|
|
23
25
|
export default class ActionHandlersFactory {
|
|
24
26
|
static create() {
|
|
25
27
|
const repository = new Repository();
|
|
@@ -44,8 +46,10 @@ export default class ActionHandlersFactory {
|
|
|
44
46
|
[RECORD_EXECUTE_SUCCESS_CALLBACK]: new RecordSuccessCallbackController(service).handle,
|
|
45
47
|
[ZLIST_RECORD_UPDATE_SUCCEEDED]: new UpdateSuccessController(service).handle,
|
|
46
48
|
// ({ dispatch, action }) => dispatch({ type: 'SMART_TABLE#RECORD_UPDATED', payload: action.payload }),
|
|
47
|
-
[ZLIST_RECORD_DELETE_SUCCEEDED]: new DeleteSuccessController(service).handle
|
|
48
|
-
|
|
49
|
+
[ZLIST_RECORD_DELETE_SUCCEEDED]: new DeleteSuccessController(service).handle,
|
|
50
|
+
// ({ dispatch, action }) => dispatch({ type: 'SMART_TABLE#RECORD_DELETED', payload: { id: action.payload.id } })
|
|
51
|
+
[ZLIST_RECORD_REORDER]: new ReOrderController(service).handle,
|
|
52
|
+
[ZLIST_RECORD_REORDER_FAILED]: new ReOrderFailedController(service).handle
|
|
49
53
|
};
|
|
50
54
|
}
|
|
51
55
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { RECORD_EXECUTE_FAILED, RECORD_EXECUTE_SUCCEEDED, RECORD_EXECUTE_SUCCEEDED_NO_CONTENT } from "../../../../bc/zrecord/Constants";
|
|
2
|
+
export default class ReOrderRecordStrategy {
|
|
3
|
+
createSuccessEvents(response, metaData) {
|
|
4
|
+
const events = [];
|
|
5
|
+
let {
|
|
6
|
+
oldIndex,
|
|
7
|
+
newIndex
|
|
8
|
+
} = metaData.props;
|
|
9
|
+
events.push({
|
|
10
|
+
type: RECORD_EXECUTE_SUCCEEDED,
|
|
11
|
+
payload: {
|
|
12
|
+
oldIndex,
|
|
13
|
+
newIndex
|
|
14
|
+
},
|
|
15
|
+
metaData
|
|
16
|
+
});
|
|
17
|
+
return events;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
createNoContentEvents(metaData) {
|
|
21
|
+
const events = [];
|
|
22
|
+
events.push({
|
|
23
|
+
type: RECORD_EXECUTE_SUCCEEDED_NO_CONTENT,
|
|
24
|
+
payload: {},
|
|
25
|
+
metaData
|
|
26
|
+
});
|
|
27
|
+
return events;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
createFailureEvents(error, metaData) {
|
|
31
|
+
const events = [];
|
|
32
|
+
events.push({
|
|
33
|
+
type: RECORD_EXECUTE_FAILED,
|
|
34
|
+
payload: {},
|
|
35
|
+
metaData
|
|
36
|
+
});
|
|
37
|
+
return events;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
}
|
|
@@ -5,11 +5,13 @@ import UpdateRecordStrategy from "./UpdateRecordStrategy";
|
|
|
5
5
|
import DeleteRecordStrategy from "./DeleteRecordStrategy";
|
|
6
6
|
import DeleteMultipleRecordStrategy from "./DeleteMultipleRecordStrategy";
|
|
7
7
|
import GetRecordsStrategy from "./GetRecordsStrategy";
|
|
8
|
+
import GetReOrderRecordsStrategy from "./GetReOrderRecordsStrategy";
|
|
8
9
|
const recordExecuteStrategiesMap = {
|
|
9
10
|
[RecordApiActionName.UPDATE_RECORD]: new UpdateRecordStrategy(),
|
|
10
11
|
[RecordApiActionName.DELETE_RECORD]: new DeleteRecordStrategy(),
|
|
11
12
|
[RecordApiActionName.DELETE_RECORDS]: new DeleteMultipleRecordStrategy(),
|
|
12
|
-
[RecordApiActionName.GET_RECORDS]: new GetRecordsStrategy()
|
|
13
|
+
[RecordApiActionName.GET_RECORDS]: new GetRecordsStrategy(),
|
|
14
|
+
[RecordApiActionName.GET_REORDERRECORD]: new GetReOrderRecordsStrategy()
|
|
13
15
|
};
|
|
14
16
|
export default class RecordsManager {
|
|
15
17
|
constructor(records) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/library-platform",
|
|
3
|
-
"version": "1.1.3-exp.
|
|
3
|
+
"version": "1.1.3-exp.2",
|
|
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.
|
|
47
|
+
"@zohodesk-private/desk-components": "1.0.0-temp-53",
|
|
48
48
|
"@zohodesk-private/node-plugins": "1.1.9",
|
|
49
49
|
"@zohodesk/a11y": "2.2.6",
|
|
50
50
|
"@zohodesk/codestandard-analytics": "0.0.2",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@zohodesk/components": "1.2.62",
|
|
53
53
|
"@zohodesk/dot": "1.7.8",
|
|
54
54
|
"@zohodesk/eslint-plugin-architecturerules": "0.0.5-exp-3",
|
|
55
|
-
"@zohodesk/eslint-plugin-no-hardcoding": "
|
|
55
|
+
"@zohodesk/eslint-plugin-no-hardcoding": "1.0.6",
|
|
56
56
|
"@zohodesk/hooks": "2.0.5",
|
|
57
57
|
"@zohodesk/icons": "1.0.72",
|
|
58
58
|
"@zohodesk/layout": "3.1.0",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"typescript": "4.9.5"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"@zohodesk-private/desk-components": "1.
|
|
79
|
+
"@zohodesk-private/desk-components": "1.0.0-temp-53",
|
|
80
80
|
"@zohodesk/a11y": "2.2.6",
|
|
81
81
|
"@zohodesk/components": "1.2.62",
|
|
82
82
|
"@zohodesk/dot": "1.7.8",
|
|
@@ -90,7 +90,9 @@
|
|
|
90
90
|
"react-sortable-hoc": "1.11.0"
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
|
+
"@zohodesk/i18n": "^1.0.0-beta.33",
|
|
93
94
|
"ajv": "6.12.6",
|
|
95
|
+
"array-move": "^4.0.0",
|
|
94
96
|
"jsep": "0.3.5",
|
|
95
97
|
"object-path-immutable": "4.1.2"
|
|
96
98
|
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import Properties from "../../../cc/form-connected/Properties";
|
|
2
|
-
import { createCustomComponent } from "../../../library/custom-component";
|
|
3
|
-
import ZHttpBehaviourFactory from "../../../platform/zhttp/frameworks/ZHttpBehaviourFactory";
|
|
4
|
-
import RecordBehaviourFactory from "../../../platform/zrecord/frameworks/RecordBehaviourFactory";
|
|
5
|
-
import FormConnectedView from "./FormConnectedView";
|
|
6
|
-
import defaultDataBroker from "../../../platform/data-source";
|
|
7
|
-
import DataBrokerBehaviourFactory from "../../../platform/zdata-source/frameworks/DataBrokerBehaviourFactory";
|
|
8
|
-
import FormTranslator from "../../../platform/zform/adapters/presenter/FormTranslator";
|
|
9
|
-
import ZFormBehaviourFactory from "../../../platform/zform/frameworks/ui/ZFormBehaviourFactory";
|
|
10
|
-
import FieldValidationBehaviourFactory from "../../../library/behaviours/field-validation/frameworks/ui/FieldValidationBehaviourFactory";
|
|
11
|
-
import EventHandlersfactory from "./EventHandlersFactory";
|
|
12
|
-
export default class FormConnectedFactory {
|
|
13
|
-
static create(_ref) {
|
|
14
|
-
let {
|
|
15
|
-
name,
|
|
16
|
-
customValidators,
|
|
17
|
-
dataBroker = defaultDataBroker,
|
|
18
|
-
eventHandlers = {},
|
|
19
|
-
View = FormConnectedView
|
|
20
|
-
} = _ref;
|
|
21
|
-
return createCustomComponent({
|
|
22
|
-
name: name,
|
|
23
|
-
View: View,
|
|
24
|
-
properties: Properties,
|
|
25
|
-
eventHandlers: EventHandlersfactory.create(eventHandlers),
|
|
26
|
-
transformState: FormTranslator.transformState,
|
|
27
|
-
behaviours: [ZHttpBehaviourFactory.create(), DataBrokerBehaviourFactory.create(), RecordBehaviourFactory.create(dataBroker.httpTemplates), FieldValidationBehaviourFactory.create(), ZFormBehaviourFactory.create({
|
|
28
|
-
customValidators
|
|
29
|
-
})]
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
}
|
package/es/desk-frameworks/table-connected/adapters/controllers/ColumnChooserOpenedController.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import AbstractController from "./AbstractController";
|
|
2
|
-
import { COLUMN_CHOOSER_BEHAVIOUR_OPENED } from "../../../../bc/column-chooser/Constants";
|
|
3
|
-
export default class ColumnChooserOpenedController extends AbstractController {
|
|
4
|
-
handle(event) {
|
|
5
|
-
const state = event.state;
|
|
6
|
-
const {
|
|
7
|
-
zfield
|
|
8
|
-
} = state.behaviours;
|
|
9
|
-
const {
|
|
10
|
-
fields: availableFields,
|
|
11
|
-
selectedFields
|
|
12
|
-
} = zfield;
|
|
13
|
-
const columnChooserOptionsOrder = this.getColumnChooserOptionsOrder(availableFields, selectedFields);
|
|
14
|
-
event.dispatch({
|
|
15
|
-
type: COLUMN_CHOOSER_BEHAVIOUR_OPENED,
|
|
16
|
-
payload: {
|
|
17
|
-
order: columnChooserOptionsOrder,
|
|
18
|
-
selectedArray: selectedFields
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
getColumnChooserOptionsOrder() {
|
|
24
|
-
let availableFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
25
|
-
let selectedFields = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
26
|
-
let searchStr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
27
|
-
|
|
28
|
-
if (availableFields.length === 0 || selectedFields.length === 0) {
|
|
29
|
-
return [];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const columnChooserOptions = selectedFields.concat(availableFields.filter(field => !selectedFields.includes(field.name)).map(field => field.name));
|
|
33
|
-
return columnChooserOptions;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import ResourceNamesEnum from "../../../bc/sdk/ResourceNamesEnum";
|
|
2
|
-
import { sdk } from "../../../platform/sdk/frameworks/Sdk";
|
|
3
|
-
export default class ListSdkFactory {
|
|
4
|
-
static create(_ref) {
|
|
5
|
-
let {
|
|
6
|
-
instanceName
|
|
7
|
-
} = _ref;
|
|
8
|
-
const smartTable = sdk[ResourceNamesEnum.SMART_TABLE](instanceName);
|
|
9
|
-
return {
|
|
10
|
-
zlist: {
|
|
11
|
-
getRecords() {
|
|
12
|
-
return smartTable.getRecords();
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
getRecord(recordId) {
|
|
16
|
-
return smartTable.getRecord(recordId);
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
getContext(variableName) {
|
|
20
|
-
return smartTable.getContext(variableName);
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
deleteRecord(recordId) {
|
|
24
|
-
return smartTable.deleteRecord(recordId);
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
deleteRecords(recordIds) {
|
|
28
|
-
let shouldFetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
29
|
-
return smartTable.deleteRecords(recordIds, shouldFetch);
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
updateRecord(recordId, record) {
|
|
33
|
-
return smartTable.updateRecord(recordId, record);
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
updateRecords(recordsMap) {
|
|
37
|
-
let shouldFetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
38
|
-
return smartTable.updateRecords(recordsMap, shouldFetch);
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
selectRecords: ids => {
|
|
42
|
-
smartTable.selectRecords(ids);
|
|
43
|
-
},
|
|
44
|
-
deselectRecords: ids => {
|
|
45
|
-
smartTable.deselectRecords(ids);
|
|
46
|
-
},
|
|
47
|
-
selectAllRecords: () => {
|
|
48
|
-
smartTable.selectAllRecords();
|
|
49
|
-
},
|
|
50
|
-
deselectAllRecords: () => {
|
|
51
|
-
smartTable.deselectAllRecords();
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import Properties from "../../../cc/table-connected/Properties";
|
|
2
|
-
import { createCustomComponent } from "../../../library/custom-component";
|
|
3
|
-
import ZFieldBehaviourFactory from "../../../platform/zfield/frameworks/ZFieldBehaviourFactory";
|
|
4
|
-
import ZHttpBehaviourFactory from "../../../platform/zhttp/frameworks/ZHttpBehaviourFactory";
|
|
5
|
-
import TableTranslator from "../../../platform/zlist/adapters/presenters/TableTranslator";
|
|
6
|
-
import ZListBehaviourFactory from "../../../platform/zlist/frameworks/ZListBehaviourFactory";
|
|
7
|
-
import RecordBehaviourFactory from "../../../platform/zrecord/frameworks/RecordBehaviourFactory";
|
|
8
|
-
import EventHandlersFactory from "./EventHandlersFactory";
|
|
9
|
-
import TableConnectedView from "./TableConnectedView";
|
|
10
|
-
import defaultDataSource from "../../../platform/data-source";
|
|
11
|
-
import DataSourceBehaviourFactory from "../../../platform/zdata-source/frameworks/DataBrokerBehaviourFactory";
|
|
12
|
-
import ClientActionsBehaviourFactory from "../../../platform/client-actions/behaviour/zclient-actions/frameworks/ClientActionsBehaviourFactory";
|
|
13
|
-
import LocalStorageBehaviourFactory from "../../../library/behaviours/local-storage/frameworks/LocalStorageBehaviourFactory";
|
|
14
|
-
import TableColumnResizerBehaviorFactory from "../../../library/behaviours/table-column-resizer/frameworks/TableColumnResizerBehaviorFactory";
|
|
15
|
-
import ListItemSelectionBehaviourFactory from "../../../library/behaviours/list-selection/frameworks/ListItemSelectionBehaviourFactory";
|
|
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
|
-
});
|
|
25
|
-
import KeyboardControlBehaviourFactory from "../../../library/behaviours/keyboard-controls/frameworks/KeyboardControlBehaviourFactory";
|
|
26
|
-
export default class TableConnectedFactory {
|
|
27
|
-
static create(_ref) {
|
|
28
|
-
var _dataSource2;
|
|
29
|
-
|
|
30
|
-
let {
|
|
31
|
-
name,
|
|
32
|
-
dataBroker,
|
|
33
|
-
dataSource,
|
|
34
|
-
eventHandlers = {},
|
|
35
|
-
View = TableConnectedView
|
|
36
|
-
} = _ref;
|
|
37
|
-
|
|
38
|
-
if (dataBroker) {
|
|
39
|
-
console.warn('Desk Platform Warning: dataBroker is deprecated, use dataSource instead');
|
|
40
|
-
dataSource = dataBroker;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const _dataSource = { ...dataSource,
|
|
44
|
-
httpTemplates: { ...defaultDataSource.httpTemplates,
|
|
45
|
-
...((_dataSource2 = dataSource) === null || _dataSource2 === void 0 ? void 0 : _dataSource2.httpTemplates)
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
return createCustomComponent({
|
|
49
|
-
name: name,
|
|
50
|
-
View: View,
|
|
51
|
-
properties: Properties,
|
|
52
|
-
eventHandlers: EventHandlersFactory.create(eventHandlers),
|
|
53
|
-
transformState: TableTranslator.transformState,
|
|
54
|
-
behaviours: [SdkBehaviourFactory.create([ResourceNamesEnum.SMART_TABLE]), TableColumnResizerBehaviorFactory.create(), KeyboardControlBehaviourFactory.create(), LocalStorageBehaviourFactory.create(), ZHttpBehaviourFactory.create(), DataSourceBehaviourFactory.create(), RecordBehaviourFactory.create(_dataSource.httpTemplates), ClientActionsBehaviourFactory.create({
|
|
55
|
-
getClientActions: _dataSource.httpTemplates.getClientActions
|
|
56
|
-
}), ZFieldBehaviourFactory.create({
|
|
57
|
-
availableFields: _dataSource.httpTemplates.getAvailableFields,
|
|
58
|
-
updateSelectedFields: _dataSource.httpTemplates.updateSelectedFields,
|
|
59
|
-
selectedFields: _dataSource.httpTemplates.getSelectedFields
|
|
60
|
-
}), ZListBehaviourFactory.create(), ColumnChooserBehaviourFactory.create(), ListItemSelectionBehaviourFactory.create()]
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
}
|
|
File without changes
|
/package/es/{desk-frameworks → platform/components}/form-connected/frameworks/FormConnected.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/es/{desk-frameworks → platform/components}/table-connected/frameworks/TableConnected.js
RENAMED
|
File without changes
|