@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
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import TableRow from '@zohodesk-private/desk-components/es/table/TableList/TableList';
|
|
3
|
-
import DragHandle from '@zohodesk-private/desk-components/es/DragHandle/DragHandle';
|
|
4
3
|
import RowSelection from "./RowSelection";
|
|
5
4
|
import Columns from "./Columns";
|
|
6
5
|
import RowActions from "./RowActions";
|
|
7
6
|
import { createCustomComponent } from "../../../../../../../custom-component";
|
|
8
7
|
import { RowEventHandlersFactory } from "./RowEventHandlersFactory";
|
|
9
8
|
import TableRowProperties from "../../../../../../../../cc/table-list/row/Properties";
|
|
10
|
-
import TableRowConstants from "../../../../../../../../cc/table-list/row/Constants";
|
|
11
|
-
import { SortableHandle } from 'react-sortable-hoc'; // @ts-ignore
|
|
9
|
+
import TableRowConstants from "../../../../../../../../cc/table-list/row/Constants"; // @ts-ignore
|
|
12
10
|
|
|
13
11
|
import style from "../../css/TableList.module.css";
|
|
14
12
|
|
|
@@ -21,15 +19,12 @@ function RowView(_ref, ref) {
|
|
|
21
19
|
dispatch
|
|
22
20
|
} = helpers;
|
|
23
21
|
const {
|
|
24
|
-
isReorderEnabled,
|
|
25
22
|
isSelectionEnabled,
|
|
26
23
|
isSelected,
|
|
27
24
|
isSelectable,
|
|
28
25
|
isKeyboardControlsEnabled,
|
|
29
26
|
isFocussed,
|
|
30
|
-
selectionTooltip
|
|
31
|
-
isDroppable,
|
|
32
|
-
dropPosition
|
|
27
|
+
selectionTooltip
|
|
33
28
|
} = state.properties;
|
|
34
29
|
const {
|
|
35
30
|
id,
|
|
@@ -44,11 +39,11 @@ function RowView(_ref, ref) {
|
|
|
44
39
|
type,
|
|
45
40
|
actions
|
|
46
41
|
} = rowActionLocation;
|
|
47
|
-
return /*#__PURE__*/React.createElement(
|
|
42
|
+
return /*#__PURE__*/React.createElement(TableRow, {
|
|
48
43
|
key: id,
|
|
49
44
|
ref: ref,
|
|
50
45
|
testId: id,
|
|
51
|
-
$flag_padding: !isSelectionEnabled
|
|
46
|
+
$flag_padding: !isSelectionEnabled,
|
|
52
47
|
$flag_active: isSelected,
|
|
53
48
|
$flag_hasHighlighter: isKeyboardControlsEnabled,
|
|
54
49
|
$flag_isHighlighted: isFocussed,
|
|
@@ -61,14 +56,8 @@ function RowView(_ref, ref) {
|
|
|
61
56
|
customStyle: {
|
|
62
57
|
$pointer: style[`rowCursor_${cursor}`]
|
|
63
58
|
}
|
|
64
|
-
},
|
|
65
|
-
isSelectionEnabled,
|
|
66
|
-
isReorderEnabled,
|
|
67
|
-
isKeyboardControlsEnabled
|
|
68
|
-
}), renderRowSelection({
|
|
59
|
+
}, renderRowSelection({
|
|
69
60
|
isSelectionEnabled,
|
|
70
|
-
isReorderEnabled,
|
|
71
|
-
isKeyboardControlsEnabled,
|
|
72
61
|
id,
|
|
73
62
|
selectionTooltip,
|
|
74
63
|
isSelected,
|
|
@@ -82,16 +71,12 @@ function RowView(_ref, ref) {
|
|
|
82
71
|
columnWidth: rowActionsColumnWidth,
|
|
83
72
|
type,
|
|
84
73
|
actions
|
|
85
|
-
})
|
|
86
|
-
className: `${style.rowDropIndicator} ${dropPosition === 'downward' && style.dropIndicatorTop} ${dropPosition === 'upward' && style.dropIndicatorBottom}`
|
|
87
|
-
})));
|
|
74
|
+
}));
|
|
88
75
|
}
|
|
89
76
|
|
|
90
77
|
function renderRowSelection(_ref2) {
|
|
91
78
|
let {
|
|
92
79
|
isSelectionEnabled,
|
|
93
|
-
isReorderEnabled,
|
|
94
|
-
isKeyboardControlsEnabled,
|
|
95
80
|
id,
|
|
96
81
|
selectionTooltip,
|
|
97
82
|
isSelected,
|
|
@@ -100,8 +85,6 @@ function renderRowSelection(_ref2) {
|
|
|
100
85
|
} = _ref2;
|
|
101
86
|
return /*#__PURE__*/React.createElement(RowSelection, {
|
|
102
87
|
isSelectionEnabled: isSelectionEnabled,
|
|
103
|
-
isReorderEnabled: isReorderEnabled,
|
|
104
|
-
isKeyboardControlsEnabled: isKeyboardControlsEnabled,
|
|
105
88
|
id: id,
|
|
106
89
|
tooltip: selectionTooltip,
|
|
107
90
|
selected: isSelected,
|
|
@@ -110,52 +93,24 @@ function renderRowSelection(_ref2) {
|
|
|
110
93
|
});
|
|
111
94
|
}
|
|
112
95
|
|
|
113
|
-
function
|
|
114
|
-
let {
|
|
115
|
-
isSelectionEnabled,
|
|
116
|
-
isReorderEnabled,
|
|
117
|
-
isKeyboardControlsEnabled
|
|
118
|
-
} = _ref3;
|
|
119
|
-
const DragHandler = SortableHandle(_ref4 => {
|
|
120
|
-
let {
|
|
121
|
-
isSelectionEnabled,
|
|
122
|
-
isReorderEnabled,
|
|
123
|
-
isKeyboardControlsEnabled
|
|
124
|
-
} = _ref4;
|
|
125
|
-
return /*#__PURE__*/React.createElement("td", {
|
|
126
|
-
tabIndex: 0,
|
|
127
|
-
className: `${style.dragHandleWrapper} ${isKeyboardControlsEnabled && isSelectionEnabled && !isReorderEnabled ? style.paddingRight16 : isKeyboardControlsEnabled ? `${style.offsetLeft8} ${style.paddingLeft0} ${style.paddingRight8}` : `${style.offsetLeft0} ${style.paddingLeft8}`}`
|
|
128
|
-
}, /*#__PURE__*/React.createElement(DragHandle, {
|
|
129
|
-
customStyle: {
|
|
130
|
-
container: `${style.dragHandleContainer} `
|
|
131
|
-
}
|
|
132
|
-
}));
|
|
133
|
-
});
|
|
134
|
-
return isReorderEnabled ? /*#__PURE__*/React.createElement(DragHandler, {
|
|
135
|
-
isSelectionEnabled: isSelectionEnabled,
|
|
136
|
-
isReorderEnabled: isReorderEnabled,
|
|
137
|
-
isKeyboardControlsEnabled: isKeyboardControlsEnabled
|
|
138
|
-
}) : null;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function renderColumns(_ref5) {
|
|
96
|
+
function renderColumns(_ref3) {
|
|
142
97
|
let {
|
|
143
98
|
columns,
|
|
144
99
|
isFlexibleColumns
|
|
145
|
-
} =
|
|
100
|
+
} = _ref3;
|
|
146
101
|
return /*#__PURE__*/React.createElement(Columns, {
|
|
147
102
|
data: columns,
|
|
148
103
|
isFlexibleColumns: isFlexibleColumns
|
|
149
104
|
});
|
|
150
105
|
}
|
|
151
106
|
|
|
152
|
-
function renderRowActions(
|
|
107
|
+
function renderRowActions(_ref4) {
|
|
153
108
|
let {
|
|
154
109
|
hasActions,
|
|
155
110
|
columnWidth,
|
|
156
111
|
actions,
|
|
157
112
|
type
|
|
158
|
-
} =
|
|
113
|
+
} = _ref4;
|
|
159
114
|
return /*#__PURE__*/React.createElement(RowActions, {
|
|
160
115
|
hasActions: hasActions,
|
|
161
116
|
columnWidth: columnWidth,
|
package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/RowSelection.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import TableListSelect from '@zohodesk-private/desk-components/es/table/TableListSelect/TableListSelect';
|
|
3
3
|
import { TableListConstants } from "../../../../../../../../cc/table-list";
|
|
4
|
-
import style from "./../../css/TableList.module.css";
|
|
5
4
|
|
|
6
5
|
function RowSelection(_ref) {
|
|
7
6
|
let {
|
|
8
7
|
isSelectionEnabled,
|
|
9
|
-
isReorderEnabled,
|
|
10
|
-
isKeyboardControlsEnabled,
|
|
11
8
|
id,
|
|
12
9
|
tooltip,
|
|
13
10
|
selected,
|
|
@@ -19,17 +16,10 @@ function RowSelection(_ref) {
|
|
|
19
16
|
return null;
|
|
20
17
|
}
|
|
21
18
|
|
|
22
|
-
const customPropsContainer = isReorderEnabled && isSelectionEnabled ? {
|
|
23
|
-
$data_width: 56
|
|
24
|
-
} : {};
|
|
25
19
|
return /*#__PURE__*/React.createElement(TableListSelect, {
|
|
26
20
|
$data_id: id,
|
|
27
21
|
$i18n_tooltip: tooltip,
|
|
28
22
|
$flag_checked: selected,
|
|
29
|
-
customStyle: {
|
|
30
|
-
container: isReorderEnabled && isSelectionEnabled ? `${style.offsetLeft24} ${style.paddingRight24}` : isKeyboardControlsEnabled && isSelectionEnabled ? `${style.paddingRight16} ${style.offsetLeft8}` : isKeyboardControlsEnabled ? style.offsetLeft8 : style.offsetLeft0
|
|
31
|
-
},
|
|
32
|
-
$customProps_container: customPropsContainer,
|
|
33
23
|
$flag_disabled: !selectable,
|
|
34
24
|
$event_onChange: (_, event) => dispatch({
|
|
35
25
|
type: TableListConstants.TABLE_LIST_TOGGLE_ITEM_SELECTION,
|
|
@@ -15,7 +15,6 @@ import DeleteMultipleRecordUseCase from "../../../../zlist/applications/usecases
|
|
|
15
15
|
import RecordUpdateUseCase from "../../../../zlist/applications/usecases/RecordUpdateUseCase";
|
|
16
16
|
import UpdateMultipleRecordUseCase from "../../../../zlist/applications/usecases/UpdateMultipleRecordUseCase";
|
|
17
17
|
import GetContextUseCase from "../../../../zlist/applications/usecases/GetContextUseCase";
|
|
18
|
-
import ReOrderUseCase from "../../../../zlist/applications/usecases/ReOrderUseCase";
|
|
19
18
|
export class SmartTableResource extends AbstractResource {
|
|
20
19
|
initialize() {}
|
|
21
20
|
|
|
@@ -235,17 +234,4 @@ export class SmartTableResource extends AbstractResource {
|
|
|
235
234
|
});
|
|
236
235
|
}
|
|
237
236
|
|
|
238
|
-
reOrderRecord(fromIndex, toIndex) {
|
|
239
|
-
const {
|
|
240
|
-
dispatch
|
|
241
|
-
} = this.dependencies;
|
|
242
|
-
const dependencies = this.getListDependencies();
|
|
243
|
-
const usecase = this.createUseCase(dependencies, ReOrderUseCase);
|
|
244
|
-
usecase.execute({
|
|
245
|
-
newIndex: toIndex,
|
|
246
|
-
oldIndex: fromIndex,
|
|
247
|
-
dispatch
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
|
|
251
237
|
}
|
|
@@ -10,7 +10,6 @@ import ResizeStartController from "../adapters/controllers/ResizeStartController
|
|
|
10
10
|
import ResizeByMouseController from "../adapters/controllers/ResizeByMouseController";
|
|
11
11
|
import ResizeEndController from "../adapters/controllers/ResizeEndController";
|
|
12
12
|
import { ResizeFinishController } from "../adapters/controllers/ResizeFinishController";
|
|
13
|
-
import { ReOrderFinishController } from "../adapters/controllers/ReOrderFinishController";
|
|
14
13
|
import ScrollController from "../adapters/controllers/ScrollController";
|
|
15
14
|
import ColumnChooserUpdateController from "../adapters/controllers/ColumnChooserUpdateController";
|
|
16
15
|
import ColumnChooserOpenedController from "../adapters/controllers/ColumnChooserOpenedController";
|
|
@@ -19,8 +18,7 @@ const {
|
|
|
19
18
|
TABLE_LIST_RESIZE_START_REQUESTED,
|
|
20
19
|
TABLE_LIST_RESIZE_MOVE_REQUESTED,
|
|
21
20
|
TABLE_LIST_RESIZE_END_REQUESTED,
|
|
22
|
-
TABLE_LIST_SCROLLED
|
|
23
|
-
TABLE_LIST_ROW_DRAG_END
|
|
21
|
+
TABLE_LIST_SCROLLED
|
|
24
22
|
} = TableListEventConstants;
|
|
25
23
|
|
|
26
24
|
function createHandlerWithSdk(handler) {
|
|
@@ -94,8 +92,7 @@ export default class EventHandlersFactory {
|
|
|
94
92
|
type: SmartTableConstants.Events.SELECTION_LIMIT_EXCEEDED,
|
|
95
93
|
payload: action.payload
|
|
96
94
|
});
|
|
97
|
-
}
|
|
98
|
-
[TABLE_LIST_ROW_DRAG_END]: new ReOrderFinishController().handle
|
|
95
|
+
}
|
|
99
96
|
};
|
|
100
97
|
}
|
|
101
98
|
|
|
@@ -15,8 +15,7 @@ export default class ListSdkFactory {
|
|
|
15
15
|
updateRecords: function (recordsMap) {
|
|
16
16
|
let shouldFetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
17
17
|
return smartTable.updateRecords(recordsMap, shouldFetch);
|
|
18
|
-
}
|
|
19
|
-
reOrderRecord: (fromIndex, toIndex) => smartTable.reOrderRecord(fromIndex, toIndex)
|
|
18
|
+
}
|
|
20
19
|
};
|
|
21
20
|
}
|
|
22
21
|
|
|
@@ -48,8 +47,7 @@ export default class ListSdkFactory {
|
|
|
48
47
|
selectRecords: selectionSdks.selectRecords,
|
|
49
48
|
deselectRecords: selectionSdks.deselectRecords,
|
|
50
49
|
selectAllRecords: selectionSdks.selectAllRecords,
|
|
51
|
-
deselectAllRecords: selectionSdks.deselectAllRecords
|
|
52
|
-
reOrderRecord: recordSdks.reOrderRecord
|
|
50
|
+
deselectAllRecords: selectionSdks.deselectAllRecords
|
|
53
51
|
}
|
|
54
52
|
};
|
|
55
53
|
}
|
|
@@ -15,8 +15,7 @@ function View(_ref, ref) {
|
|
|
15
15
|
selection,
|
|
16
16
|
emptyStateUiType,
|
|
17
17
|
focussedRow,
|
|
18
|
-
keyboardControlsConfig
|
|
19
|
-
reOrderConfig
|
|
18
|
+
keyboardControlsConfig
|
|
20
19
|
} = state.viewModel;
|
|
21
20
|
const {
|
|
22
21
|
resizerState
|
|
@@ -29,7 +28,6 @@ function View(_ref, ref) {
|
|
|
29
28
|
autoColumnSizing
|
|
30
29
|
} = preferences ? preferences : {};
|
|
31
30
|
return /*#__PURE__*/React.createElement(TableList, {
|
|
32
|
-
reOrderConfig: reOrderConfig,
|
|
33
31
|
data: data,
|
|
34
32
|
rowCursor: rowCursor,
|
|
35
33
|
sortBy: sortBy,
|
|
@@ -5,7 +5,6 @@ import deleteRecords from "./http-template/deleteRecords";
|
|
|
5
5
|
import getAvailableFields from "./http-template/getAvailableFields";
|
|
6
6
|
import getSelectedFields from "./http-template/getSelectedFields";
|
|
7
7
|
import getClientActions from "./http-template/getClientActions";
|
|
8
|
-
import reOrderRecord from "./http-template/reOrderRecord";
|
|
9
8
|
import { RecordApiActionName } from "../../bc/zrecord/Constants";
|
|
10
9
|
import deleteRecord from "./http-template/deleteRecord";
|
|
11
10
|
import fetchMyLayouts from "./http-template/fetchMyFormLayout";
|
|
@@ -23,7 +22,6 @@ let dataSource = {
|
|
|
23
22
|
[RecordApiActionName.DELETE_RECORD]: deleteRecord,
|
|
24
23
|
[RecordApiActionName.CREATE_RECORD]: createRecord,
|
|
25
24
|
[RecordApiActionName.GET_CLIENTACTIONS]: getClientActions,
|
|
26
|
-
[RecordApiActionName.GET_REORDERRECORD]: reOrderRecord,
|
|
27
25
|
getAvailableFields,
|
|
28
26
|
getSelectedFields,
|
|
29
27
|
updateSelectedFields,
|
|
@@ -1,6 +1,7 @@
|
|
|
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
|
-
|
|
3
|
+
import { SdkResourceDependencies } from "../../../domain/entities/interfaces/SdkResourceDependencies";
|
|
4
|
+
export { SdkResourceDependencies };
|
|
4
5
|
export class AbstractResource {
|
|
5
6
|
constructor() {
|
|
6
7
|
_defineProperty(this, "dependencies", void 0);
|
|
@@ -78,7 +78,7 @@ export class ResourceManager {
|
|
|
78
78
|
resourceInstances
|
|
79
79
|
} = this;
|
|
80
80
|
const instance = (_resourceInstances$re3 = resourceInstances[resourceName]) === null || _resourceInstances$re3 === void 0 ? void 0 : _resourceInstances$re3[instanceName];
|
|
81
|
-
instance
|
|
81
|
+
instance.updateDependencies({
|
|
82
82
|
state,
|
|
83
83
|
dispatch,
|
|
84
84
|
updateState
|
|
@@ -13,8 +13,6 @@ import RecordExecuteFailedUseCase from "../../applications/usecases/RecordExecut
|
|
|
13
13
|
import UpdateSuccessUseCase from "../../applications/usecases/UpdateSuccessUseCase";
|
|
14
14
|
import DeleteSuccessUseCase from "../../applications/usecases/DeleteSuccessUseCase";
|
|
15
15
|
import RecordSuccessCallbackUsecase from "../../applications/usecases/RecordSuccessCallbackUsecase";
|
|
16
|
-
import ReOrderUseCase from "../../applications/usecases/ReOrderUseCase";
|
|
17
|
-
import ReOrderFailedUseCase from "../../applications/usecases/ReOrderFailedUseCase";
|
|
18
16
|
|
|
19
17
|
class Service {
|
|
20
18
|
constructor(dependencies) {
|
|
@@ -46,10 +44,6 @@ class Service {
|
|
|
46
44
|
|
|
47
45
|
_defineProperty(this, "deleteSuccessUseCase", void 0);
|
|
48
46
|
|
|
49
|
-
_defineProperty(this, "reOrderUseCase", void 0);
|
|
50
|
-
|
|
51
|
-
_defineProperty(this, "reOrderFailedUseCase", void 0);
|
|
52
|
-
|
|
53
47
|
this.initializeUseCase = new InitializeUseCase(this.dependencies);
|
|
54
48
|
this.propertiesChangeUseCase = new PropertiesChangeUseCase(this.dependencies);
|
|
55
49
|
this.fetchMoreUseCase = new FetchMoreUseCase(this.dependencies);
|
|
@@ -63,8 +57,6 @@ class Service {
|
|
|
63
57
|
this.recordUpdateUseCase = new RecordUpdateUseCase(this.dependencies);
|
|
64
58
|
this.updateSuccessUseCase = new UpdateSuccessUseCase(this.dependencies);
|
|
65
59
|
this.deleteSuccessUseCase = new DeleteSuccessUseCase(this.dependencies);
|
|
66
|
-
this.reOrderUseCase = new ReOrderUseCase(this.dependencies);
|
|
67
|
-
this.reOrderFailedUseCase = new ReOrderFailedUseCase(this.dependencies);
|
|
68
60
|
}
|
|
69
61
|
|
|
70
62
|
}
|
|
@@ -26,8 +26,7 @@ export default class TableTranslator {
|
|
|
26
26
|
} = state;
|
|
27
27
|
const {
|
|
28
28
|
componentMapping,
|
|
29
|
-
context
|
|
30
|
-
reOrderConfig
|
|
29
|
+
context
|
|
31
30
|
} = properties;
|
|
32
31
|
const {
|
|
33
32
|
localStorage: localStorageBehaviour,
|
|
@@ -47,7 +46,6 @@ export default class TableTranslator {
|
|
|
47
46
|
zfield,
|
|
48
47
|
zclientAction
|
|
49
48
|
} = fallbackToDefault(behaviours, {}); // FIX: behaviours should be available by default
|
|
50
|
-
// const { sortBy, isReOrderLoading } = fallbackToDefault(zlist, {}); // FIX: zlist should be available by default
|
|
51
49
|
|
|
52
50
|
const {
|
|
53
51
|
sortBy
|
|
@@ -105,7 +103,6 @@ export default class TableTranslator {
|
|
|
105
103
|
properties,
|
|
106
104
|
behaviours,
|
|
107
105
|
viewModel: {
|
|
108
|
-
reOrderConfig,
|
|
109
106
|
selection: SelectionTranslator(state),
|
|
110
107
|
focussedRow: focussedIndex,
|
|
111
108
|
sortBy,
|
|
@@ -123,7 +120,6 @@ export default class TableTranslator {
|
|
|
123
120
|
},
|
|
124
121
|
keyboardControlsConfig,
|
|
125
122
|
isLoading,
|
|
126
|
-
// isReOrderLoading,
|
|
127
123
|
emptyStateUiType: componentMapping.emptyState || '',
|
|
128
124
|
data: fields.length ? data : {
|
|
129
125
|
headers: EMPTY_ARRAY,
|
|
@@ -34,8 +34,7 @@ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, co
|
|
|
34
34
|
console.warn(`The string format for componentMapping will soon be deprecated. Please update to the new JSON format. REF : ${JSON.stringify(fieldEntry)}`);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
let value = isCustomField ? (_record$cf = record.cf) === null || _record$cf === void 0 ? void 0 : _record$cf[name] : record[name];
|
|
37
|
+
const value = isCustomField ? (_record$cf = record.cf) === null || _record$cf === void 0 ? void 0 : _record$cf[name] : record[name];
|
|
39
38
|
const actions = ClientActionsTranslator.transform(fieldActions, {
|
|
40
39
|
field,
|
|
41
40
|
record
|
|
@@ -57,12 +56,7 @@ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, co
|
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
if (field.type == "LookUp") {
|
|
60
|
-
|
|
61
|
-
tempValue = typeof value !== 'object' ? {
|
|
62
|
-
name: value,
|
|
63
|
-
id: value
|
|
64
|
-
} : value;
|
|
65
|
-
tempValue.url = getLookupUrlConstructions({
|
|
59
|
+
value.url = getLookupUrlConstructions({
|
|
66
60
|
field,
|
|
67
61
|
value,
|
|
68
62
|
context
|
|
@@ -78,7 +72,7 @@ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, co
|
|
|
78
72
|
if (fieldEntry && typeof fieldEntry === 'object') {
|
|
79
73
|
let data = {
|
|
80
74
|
actions,
|
|
81
|
-
...fieldTranslator(field,
|
|
75
|
+
...fieldTranslator(field, finalValue, {
|
|
82
76
|
recordId: record.id
|
|
83
77
|
})
|
|
84
78
|
};
|
|
@@ -88,9 +82,16 @@ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, co
|
|
|
88
82
|
context
|
|
89
83
|
});
|
|
90
84
|
data.type = fieldEntry.UIComponentName;
|
|
85
|
+
console.log(data, "====>>> custom field modal");
|
|
91
86
|
return data;
|
|
92
87
|
}
|
|
93
88
|
|
|
89
|
+
console.log({
|
|
90
|
+
actions,
|
|
91
|
+
...fieldTranslator(field, finalValue, {
|
|
92
|
+
recordId: record.id
|
|
93
|
+
})
|
|
94
|
+
}, "====>>> normal pre-defined field modal");
|
|
94
95
|
return {
|
|
95
96
|
actions,
|
|
96
97
|
...fieldTranslator(field, finalValue, {
|
|
@@ -1,39 +1,18 @@
|
|
|
1
|
-
import { SET_RECORDS } from "../../../../bc/zrecord/Constants";
|
|
2
1
|
import AbstractUseCase from "./AbstractUseCase";
|
|
3
2
|
|
|
4
3
|
class RecordSuccessCallbackUsecase extends AbstractUseCase {
|
|
5
|
-
execute(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
let {
|
|
4
|
+
execute(input) {
|
|
5
|
+
const {
|
|
9
6
|
dispatch,
|
|
10
7
|
payload,
|
|
11
8
|
metaData
|
|
12
|
-
} =
|
|
9
|
+
} = input;
|
|
13
10
|
const {
|
|
14
11
|
repository,
|
|
15
12
|
presenter
|
|
16
13
|
} = this.dependencies;
|
|
17
14
|
const list = repository.getList();
|
|
18
15
|
|
|
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
|
-
|
|
37
16
|
if (list.isAcknowledgeBySortBy(metaData)) {
|
|
38
17
|
list.setSortBy(metaData);
|
|
39
18
|
presenter.updateView(list.toObject());
|
|
@@ -1,36 +1,26 @@
|
|
|
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
|
|
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
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,
|
|
9
|
+
constructor(limit, sortBy, query, context, 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;
|
|
15
14
|
this.errorRecordFailed = errorRecordFailed;
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
toObject() {
|
|
19
18
|
return {
|
|
20
19
|
sortBy: this.sortBy.toObject(),
|
|
21
|
-
isReOrderLoading: this.isReOrderLoading,
|
|
22
20
|
errorRecordFailed: this.errorRecordFailed
|
|
23
21
|
};
|
|
24
22
|
}
|
|
25
23
|
|
|
26
|
-
reOrderStarted() {
|
|
27
|
-
this.isReOrderLoading = true;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
reOrderEnded() {
|
|
31
|
-
this.isReOrderLoading = false;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
24
|
setSortBy(sortBy) {
|
|
35
25
|
this.sortBy = new SortBy(sortBy.id, sortBy.name, sortBy.order);
|
|
36
26
|
}
|
|
@@ -275,21 +265,6 @@ class List {
|
|
|
275
265
|
});
|
|
276
266
|
}
|
|
277
267
|
|
|
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
|
-
|
|
293
268
|
return actions;
|
|
294
269
|
}
|
|
295
270
|
|
|
@@ -307,28 +282,6 @@ class List {
|
|
|
307
282
|
};
|
|
308
283
|
}
|
|
309
284
|
|
|
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
|
-
|
|
332
285
|
createMoreRecordFetchAction() {
|
|
333
286
|
const props = this.createApiProps();
|
|
334
287
|
return {
|
|
@@ -395,23 +348,6 @@ class List {
|
|
|
395
348
|
};
|
|
396
349
|
}
|
|
397
350
|
|
|
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
|
-
|
|
415
351
|
createAvailableFieldsRefetchAction() {
|
|
416
352
|
const props = this.createApiProps();
|
|
417
353
|
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
|
|
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";
|
|
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,8 +20,6 @@ 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";
|
|
25
23
|
export default class ActionHandlersFactory {
|
|
26
24
|
static create() {
|
|
27
25
|
const repository = new Repository();
|
|
@@ -46,10 +44,8 @@ export default class ActionHandlersFactory {
|
|
|
46
44
|
[RECORD_EXECUTE_SUCCESS_CALLBACK]: new RecordSuccessCallbackController(service).handle,
|
|
47
45
|
[ZLIST_RECORD_UPDATE_SUCCEEDED]: new UpdateSuccessController(service).handle,
|
|
48
46
|
// ({ dispatch, action }) => dispatch({ type: 'SMART_TABLE#RECORD_UPDATED', payload: action.payload }),
|
|
49
|
-
[ZLIST_RECORD_DELETE_SUCCEEDED]: new DeleteSuccessController(service).handle,
|
|
50
|
-
|
|
51
|
-
[ZLIST_RECORD_REORDER]: new ReOrderController(service).handle,
|
|
52
|
-
[ZLIST_RECORD_REORDER_FAILED]: new ReOrderFailedController(service).handle
|
|
47
|
+
[ZLIST_RECORD_DELETE_SUCCEEDED]: new DeleteSuccessController(service).handle // ({ dispatch, action }) => dispatch({ type: 'SMART_TABLE#RECORD_DELETED', payload: { id: action.payload.id } })
|
|
48
|
+
|
|
53
49
|
};
|
|
54
50
|
}
|
|
55
51
|
|
|
@@ -5,13 +5,11 @@ 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";
|
|
9
8
|
const recordExecuteStrategiesMap = {
|
|
10
9
|
[RecordApiActionName.UPDATE_RECORD]: new UpdateRecordStrategy(),
|
|
11
10
|
[RecordApiActionName.DELETE_RECORD]: new DeleteRecordStrategy(),
|
|
12
11
|
[RecordApiActionName.DELETE_RECORDS]: new DeleteMultipleRecordStrategy(),
|
|
13
|
-
[RecordApiActionName.GET_RECORDS]: new GetRecordsStrategy()
|
|
14
|
-
[RecordApiActionName.GET_REORDERRECORD]: new GetReOrderRecordsStrategy()
|
|
12
|
+
[RecordApiActionName.GET_RECORDS]: new GetRecordsStrategy()
|
|
15
13
|
};
|
|
16
14
|
export default class RecordsManager {
|
|
17
15
|
constructor(records) {
|