@zohodesk/library-platform 1.1.3-exp.2 → 1.1.3-exp.3
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/zlist/Constants.js +1 -3
- package/es/bc/zrecord/Constants.js +1 -3
- package/es/cc/table-connected/Properties.js +0 -16
- package/es/cc/table-list/Constants.js +0 -4
- package/es/cc/table-list/Properties.js +0 -16
- package/es/cc/table-list/row/Properties.js +0 -35
- package/es/library/dot/components/table-list/frameworks/ui/TableListView.js +6 -67
- package/es/library/dot/components/table-list/frameworks/ui/css/TableList.module.css +2 -145
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/Header.js +4 -22
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/Rows.js +9 -22
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/MassAction.js +2 -19
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/Row.js +10 -55
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/RowSelection.js +0 -10
- package/es/platform/components/table-connected/adapters/resources/SmartTableResource.js +0 -14
- package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +2 -5
- package/es/platform/components/table-connected/frameworks/ListSdkFactory.js +2 -4
- package/es/platform/components/table-connected/frameworks/TableConnectedView.js +1 -3
- package/es/platform/data-source/index.js +0 -2
- package/es/platform/sdk/application/interfaces/gateways/AbstractResource.js +2 -1
- package/es/platform/sdk/domain/entities/ResourceManager.js +1 -1
- package/es/platform/zlist/adapters/gateways/Repository.js +0 -7
- package/es/platform/zlist/adapters/gateways/Service.js +0 -8
- package/es/platform/zlist/adapters/presenters/TableTranslator.js +1 -5
- package/es/platform/zlist/adapters/presenters/translators/ColumnTranslator.js +10 -9
- package/es/platform/zlist/adapters/presenters/utils/DefaultClientActions.js +1 -1
- package/es/platform/zlist/applications/usecases/RecordSuccessCallbackUsecase.js +3 -24
- package/es/platform/zlist/domain/entities/List.js +2 -66
- package/es/platform/zlist/frameworks/EventHandlersFactory.js +3 -7
- package/es/platform/zlist/frameworks/ZListBehaviourFactory.js +1 -2
- package/es/platform/zrecord/domain/entities/RecordsManager.js +1 -3
- package/package.json +3 -6
- package/es/library/dot/components/table-list/frameworks/hooks/useDropIndicator.js +0 -8
- package/es/library/dot/components/table-list/frameworks/hooks/useRowData.js +0 -8
- package/es/library/dot/components/table-list/frameworks/hooks/useTableRowReorder.js +0 -93
- package/es/library/dot/components/table-list/frameworks/utils/reOrder.js +0 -76
- package/es/platform/components/table-connected/adapters/controllers/ReOrderFinishController.js +0 -21
- package/es/platform/data-source/http-template/reOrderRecord.js +0 -44
- package/es/platform/zlist/adapters/controllers/ReOrderController.js +0 -25
- package/es/platform/zlist/adapters/controllers/ReOrderFailedController.js +0 -26
- package/es/platform/zlist/applications/interfaces/input/ReOrderRecordUseCaseInput.js +0 -1
- package/es/platform/zlist/applications/usecases/ReOrderFailedUseCase.js +0 -22
- package/es/platform/zlist/applications/usecases/ReOrderUseCase.js +0 -25
- package/es/platform/zrecord/domain/entities/GetReOrderRecordsStrategy.js +0 -40
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.3",
|
|
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.3.7",
|
|
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,6 @@
|
|
|
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": "1.0.6",
|
|
56
55
|
"@zohodesk/hooks": "2.0.5",
|
|
57
56
|
"@zohodesk/icons": "1.0.72",
|
|
58
57
|
"@zohodesk/layout": "3.1.0",
|
|
@@ -76,7 +75,7 @@
|
|
|
76
75
|
"typescript": "4.9.5"
|
|
77
76
|
},
|
|
78
77
|
"peerDependencies": {
|
|
79
|
-
"@zohodesk-private/desk-components": "1.
|
|
78
|
+
"@zohodesk-private/desk-components": "1.3.7",
|
|
80
79
|
"@zohodesk/a11y": "2.2.6",
|
|
81
80
|
"@zohodesk/components": "1.2.62",
|
|
82
81
|
"@zohodesk/dot": "1.7.8",
|
|
@@ -90,9 +89,7 @@
|
|
|
90
89
|
"react-sortable-hoc": "1.11.0"
|
|
91
90
|
},
|
|
92
91
|
"dependencies": {
|
|
93
|
-
"@zohodesk/i18n": "^1.0.0-beta.33",
|
|
94
92
|
"ajv": "6.12.6",
|
|
95
|
-
"array-move": "^4.0.0",
|
|
96
93
|
"jsep": "0.3.5",
|
|
97
94
|
"object-path-immutable": "4.1.2"
|
|
98
95
|
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
2
|
-
import TableListEventConstants from "../../../../../../cc/table-list/Constants";
|
|
3
|
-
import { useRowData } from "./useRowData";
|
|
4
|
-
import { useDropIndicator } from "./useDropIndicator";
|
|
5
|
-
import { reorderArray, setTableUserSelect, adjustHelperElementPosition, getDropIndicator } from "../utils/reOrder"; // @ts-ignore
|
|
6
|
-
|
|
7
|
-
import style from "./../ui/css/TableList.module.css";
|
|
8
|
-
export function useTableRowReorder(_ref) {
|
|
9
|
-
let {
|
|
10
|
-
rows,
|
|
11
|
-
TableRef,
|
|
12
|
-
dispatch
|
|
13
|
-
} = _ref;
|
|
14
|
-
const [rowData, setRowData] = useRowData(rows);
|
|
15
|
-
const [dropIndicator, setDropIndicator] = useDropIndicator();
|
|
16
|
-
const {
|
|
17
|
-
TABLE_LIST_ROW_DRAG_START,
|
|
18
|
-
TABLE_LIST_ROW_DRAG_END
|
|
19
|
-
} = TableListEventConstants;
|
|
20
|
-
|
|
21
|
-
const handleSortStart = _ref2 => {
|
|
22
|
-
let {
|
|
23
|
-
index
|
|
24
|
-
} = _ref2;
|
|
25
|
-
setTableUserSelect(TableRef, 'none');
|
|
26
|
-
adjustHelperElementPosition(TableRef, style.dragging);
|
|
27
|
-
dispatch({
|
|
28
|
-
type: TABLE_LIST_ROW_DRAG_START,
|
|
29
|
-
payload: {
|
|
30
|
-
index
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const handleSortEnd = _ref3 => {
|
|
36
|
-
let {
|
|
37
|
-
oldIndex,
|
|
38
|
-
newIndex
|
|
39
|
-
} = _ref3;
|
|
40
|
-
setTableUserSelect(TableRef, '');
|
|
41
|
-
let arr = reorderArray(rowData, oldIndex, newIndex);
|
|
42
|
-
setRowData(arr);
|
|
43
|
-
setDropIndicator({
|
|
44
|
-
index: null,
|
|
45
|
-
position: ''
|
|
46
|
-
});
|
|
47
|
-
dispatch({
|
|
48
|
-
type: TABLE_LIST_ROW_DRAG_END,
|
|
49
|
-
payload: {
|
|
50
|
-
oldIndex,
|
|
51
|
-
newIndex
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const handleSortOver = _ref4 => {
|
|
57
|
-
let {
|
|
58
|
-
index,
|
|
59
|
-
oldIndex,
|
|
60
|
-
newIndex
|
|
61
|
-
} = _ref4;
|
|
62
|
-
const dropIndicatorData = getDropIndicator({
|
|
63
|
-
index,
|
|
64
|
-
oldIndex,
|
|
65
|
-
newIndex,
|
|
66
|
-
rowsLength: rows.length
|
|
67
|
-
});
|
|
68
|
-
setDropIndicator({
|
|
69
|
-
index: dropIndicatorData.index,
|
|
70
|
-
position: dropIndicatorData.position
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const getHelperDimensions = useCallback(_ref5 => {
|
|
75
|
-
let {
|
|
76
|
-
node
|
|
77
|
-
} = _ref5;
|
|
78
|
-
return {
|
|
79
|
-
height: node.offsetHeight,
|
|
80
|
-
width: TableRef.current.offsetWidth
|
|
81
|
-
};
|
|
82
|
-
}, [TableRef]);
|
|
83
|
-
return {
|
|
84
|
-
rowData,
|
|
85
|
-
dropIndicator,
|
|
86
|
-
handleSortStart,
|
|
87
|
-
handleSortEnd,
|
|
88
|
-
handleSortOver,
|
|
89
|
-
getHelperDimensions,
|
|
90
|
-
setRowData,
|
|
91
|
-
setDropIndicator
|
|
92
|
-
};
|
|
93
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
function reorderImmutableArray(arr, fromIndex, toIndex) {
|
|
2
|
-
const start = fromIndex < 0 ? arr.length + fromIndex : fromIndex;
|
|
3
|
-
|
|
4
|
-
if (start >= 0 && start < arr.length) {
|
|
5
|
-
const end = toIndex < 0 ? arr.length + toIndex : toIndex;
|
|
6
|
-
const [item] = arr.splice(start, 1);
|
|
7
|
-
arr.splice(end, 0, item);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function reorderArray(arr, fromIndex, toIndex) {
|
|
12
|
-
const copy = [...arr];
|
|
13
|
-
reorderImmutableArray(copy, fromIndex, toIndex);
|
|
14
|
-
return copy;
|
|
15
|
-
}
|
|
16
|
-
export function parseCssNumberWithUnit(value) {
|
|
17
|
-
if (typeof value !== "string") return null;
|
|
18
|
-
const regex = /^(-?\d+(\.\d+)?)([a-z%]*)$/i;
|
|
19
|
-
const match = value.trim().match(regex);
|
|
20
|
-
if (!match) return null;
|
|
21
|
-
return {
|
|
22
|
-
number: parseFloat(match[1]),
|
|
23
|
-
unit: match[3] || ""
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export function setTableUserSelect(ref, value) {
|
|
27
|
-
if (ref.current) {
|
|
28
|
-
ref.current.style.userSelect = value;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
export function adjustHelperElementPosition(ref, draggingClass) {
|
|
32
|
-
if (ref.current) {
|
|
33
|
-
const TableScrollLeft = ref.current.scrollLeft;
|
|
34
|
-
const helperElement = ref.current.querySelector(`.${draggingClass}`);
|
|
35
|
-
|
|
36
|
-
if (helperElement) {
|
|
37
|
-
const helperLeft = parseCssNumberWithUnit(helperElement.style.left);
|
|
38
|
-
|
|
39
|
-
if (helperLeft && helperLeft.unit === 'px') {
|
|
40
|
-
helperElement.style.left = `${helperLeft.number + TableScrollLeft}px`;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
export function getDropIndicator(_ref) {
|
|
46
|
-
let {
|
|
47
|
-
index,
|
|
48
|
-
oldIndex,
|
|
49
|
-
newIndex,
|
|
50
|
-
rowsLength
|
|
51
|
-
} = _ref;
|
|
52
|
-
const isMovingDown = newIndex > oldIndex;
|
|
53
|
-
let dropIndex, normalizedDropIndex, dropPosition;
|
|
54
|
-
|
|
55
|
-
if (isMovingDown) {
|
|
56
|
-
dropIndex = newIndex < index ? newIndex : newIndex + 1;
|
|
57
|
-
} else {
|
|
58
|
-
dropIndex = newIndex <= index ? newIndex - 1 : newIndex;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
normalizedDropIndex = dropIndex;
|
|
62
|
-
dropPosition = isMovingDown ? 'downward' : 'upward';
|
|
63
|
-
|
|
64
|
-
if (dropIndex < 0) {
|
|
65
|
-
normalizedDropIndex = 0;
|
|
66
|
-
dropPosition = 'downward';
|
|
67
|
-
} else if (dropIndex >= rowsLength) {
|
|
68
|
-
normalizedDropIndex = rowsLength - 1;
|
|
69
|
-
dropPosition = 'upward';
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return {
|
|
73
|
-
index: normalizedDropIndex,
|
|
74
|
-
position: dropPosition
|
|
75
|
-
};
|
|
76
|
-
}
|
package/es/platform/components/table-connected/adapters/controllers/ReOrderFinishController.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import AbstractController from "./AbstractController";
|
|
2
|
-
import { ZLIST_RECORD_REORDER } from "../../../../../bc/zlist/Constants";
|
|
3
|
-
export class ReOrderFinishController extends AbstractController {
|
|
4
|
-
handle(event) {
|
|
5
|
-
const {
|
|
6
|
-
dispatch
|
|
7
|
-
} = event;
|
|
8
|
-
const {
|
|
9
|
-
oldIndex,
|
|
10
|
-
newIndex
|
|
11
|
-
} = event.action.payload;
|
|
12
|
-
dispatch({
|
|
13
|
-
type: ZLIST_RECORD_REORDER,
|
|
14
|
-
payload: {
|
|
15
|
-
oldIndex,
|
|
16
|
-
newIndex
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
const reOrderRecord = {
|
|
2
|
-
name: 'records',
|
|
3
|
-
api: '/{{servicePrefix}}/{{orgName}}/api/v1/{{moduleName}}/reorder',
|
|
4
|
-
parameters: `{}`,
|
|
5
|
-
type: 'POST',
|
|
6
|
-
transformer: data => data,
|
|
7
|
-
getResponse: _ref => {
|
|
8
|
-
let {
|
|
9
|
-
payload
|
|
10
|
-
} = _ref;
|
|
11
|
-
let {
|
|
12
|
-
oldIndex,
|
|
13
|
-
newIndex
|
|
14
|
-
} = payload;
|
|
15
|
-
return {
|
|
16
|
-
oldIndex,
|
|
17
|
-
newIndex,
|
|
18
|
-
status: 'success'
|
|
19
|
-
}; // return Promise.reject({
|
|
20
|
-
// status: 500,
|
|
21
|
-
// error: "Something went wrong",
|
|
22
|
-
// });
|
|
23
|
-
},
|
|
24
|
-
requestBody: '{ "oldIndex": {{oldIndex}}, "newIndex": {{newIndex}} }',
|
|
25
|
-
properties: {
|
|
26
|
-
moduleName: {
|
|
27
|
-
required: true,
|
|
28
|
-
typeMetadata: {
|
|
29
|
-
schema: {
|
|
30
|
-
type: 'string'
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
recordId: {
|
|
35
|
-
required: true,
|
|
36
|
-
typeMetadata: {
|
|
37
|
-
schema: {
|
|
38
|
-
type: 'string'
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
export default reOrderRecord;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import AbstractController from "./AbstractController";
|
|
2
|
-
export default class ReOrderController extends AbstractController {
|
|
3
|
-
handle(event) {
|
|
4
|
-
const {
|
|
5
|
-
state,
|
|
6
|
-
updateState,
|
|
7
|
-
dispatch,
|
|
8
|
-
action
|
|
9
|
-
} = event;
|
|
10
|
-
const {
|
|
11
|
-
newIndex,
|
|
12
|
-
oldIndex
|
|
13
|
-
} = action.payload;
|
|
14
|
-
const {
|
|
15
|
-
reOrderUseCase
|
|
16
|
-
} = this.service;
|
|
17
|
-
reOrderUseCase.updateDependency(state, updateState);
|
|
18
|
-
reOrderUseCase.execute({
|
|
19
|
-
dispatch,
|
|
20
|
-
newIndex,
|
|
21
|
-
oldIndex
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import AbstractController from "./AbstractController";
|
|
2
|
-
export default class ReOrderController extends AbstractController {
|
|
3
|
-
handle(event) {
|
|
4
|
-
const {
|
|
5
|
-
state,
|
|
6
|
-
updateState,
|
|
7
|
-
dispatch,
|
|
8
|
-
action
|
|
9
|
-
} = event;
|
|
10
|
-
const {
|
|
11
|
-
newIndex,
|
|
12
|
-
oldIndex
|
|
13
|
-
} = action.payload;
|
|
14
|
-
const {
|
|
15
|
-
reOrderFailedUseCase
|
|
16
|
-
} = this.service;
|
|
17
|
-
reOrderFailedUseCase.updateDependency(state, updateState);
|
|
18
|
-
reOrderFailedUseCase.execute({
|
|
19
|
-
dispatch,
|
|
20
|
-
newIndex,
|
|
21
|
-
oldIndex,
|
|
22
|
-
metaData: action.metaData
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
-
|
|
3
|
-
class ReOrderFailedUseCase extends AbstractUseCase {
|
|
4
|
-
execute(input) {
|
|
5
|
-
const {
|
|
6
|
-
metaData
|
|
7
|
-
} = input;
|
|
8
|
-
const {
|
|
9
|
-
repository,
|
|
10
|
-
presenter
|
|
11
|
-
} = this.dependencies;
|
|
12
|
-
const list = repository.getList();
|
|
13
|
-
|
|
14
|
-
if (metaData.isReOrder) {
|
|
15
|
-
list.reOrderEnded();
|
|
16
|
-
presenter.updateView(list.toObject());
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export default ReOrderFailedUseCase;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
-
|
|
3
|
-
class ReOrderUseCase extends AbstractUseCase {
|
|
4
|
-
execute(input) {
|
|
5
|
-
const {
|
|
6
|
-
dispatch,
|
|
7
|
-
newIndex,
|
|
8
|
-
oldIndex
|
|
9
|
-
} = input;
|
|
10
|
-
const {
|
|
11
|
-
repository,
|
|
12
|
-
presenter
|
|
13
|
-
} = this.dependencies;
|
|
14
|
-
const list = repository.getList();
|
|
15
|
-
list.reOrderStarted();
|
|
16
|
-
presenter.updateView(list.toObject());
|
|
17
|
-
dispatch(list.getReOrderRecordAction({
|
|
18
|
-
newIndex,
|
|
19
|
-
oldIndex
|
|
20
|
-
}));
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default ReOrderUseCase;
|
|
@@ -1,40 +0,0 @@
|
|
|
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
|
-
}
|