@zohodesk/library-platform 1.1.3-exp.3 → 1.1.3-temp-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/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 +25 -0
- package/es/cc/table-list/row/Properties.js +44 -0
- package/es/index.js +2 -1
- 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 +105 -0
- package/es/library/dot/components/table-list/frameworks/ui/TableListView.js +85 -15
- package/es/library/dot/components/table-list/frameworks/ui/css/TableList.module.css +241 -1
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/Header.js +28 -4
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/Rows.js +25 -9
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/MassAction.js +11 -2
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/Row.js +50 -8
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/RowSelection.js +6 -1
- package/es/library/dot/components/table-list/frameworks/utils/getHeaderClasses.js +37 -0
- package/es/library/dot/components/table-list/frameworks/utils/getTableListClassName.js +37 -0
- package/es/library/dot/components/table-list/frameworks/utils/reOrder.js +90 -0
- package/es/library/dot/legacy-to-new-arch/text-area/frameworks/ui/TextAreaView.js +1 -1
- package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/ClientActionsAdapter.js +96 -0
- package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/EventHandlersFactory.js +11 -3
- package/es/platform/client-actions/template-resolver/index.js +1 -0
- package/es/platform/client-actions/translators/context-resolver/index.js +6 -6
- package/es/platform/components/table-connected/adapters/controllers/ReOrderFinishController.js +21 -0
- package/es/platform/components/table-connected/adapters/resources/SmartTableResource.js +14 -0
- package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +5 -2
- package/es/platform/components/table-connected/frameworks/ListSdkFactory.js +4 -2
- package/es/platform/components/table-connected/frameworks/TableConnectedView.js +5 -1
- package/es/platform/data-source/http-template/reOrderRecord.js +44 -0
- package/es/platform/data-source/index.js +2 -0
- package/es/platform/sdk/application/interfaces/gateways/AbstractResource.js +1 -2
- package/es/platform/sdk/domain/entities/ResourceManager.js +1 -1
- package/es/platform/zform/adapters/presenter/FormTranslator.js +6 -127
- package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +32 -0
- package/es/platform/zform/adapters/presenter/translators/fields/BooleanFieldTranslator.js +20 -0
- package/es/platform/zform/adapters/presenter/translators/fields/CurrencyFieldTranslator.js +30 -0
- package/es/platform/zform/adapters/presenter/translators/fields/DateFieldTranslator.js +21 -0
- package/es/platform/zform/adapters/presenter/translators/fields/DateTimeFieldTranslator.js +21 -0
- package/es/platform/zform/adapters/presenter/translators/fields/DecimalFieldTranslator.js +30 -0
- package/es/platform/zform/adapters/presenter/translators/fields/EmailFieldTranslator.js +30 -0
- package/es/platform/zform/adapters/presenter/translators/fields/LookUpFieldTranslator.js +30 -0
- package/es/platform/zform/adapters/presenter/translators/fields/MultiselectFieldTranslator.js +29 -0
- package/es/platform/zform/adapters/presenter/translators/fields/NumberFieldTranslator.js +30 -0
- package/es/platform/zform/adapters/presenter/translators/fields/PercentageFieldTranslator.js +30 -0
- package/es/platform/zform/adapters/presenter/translators/fields/PhoneFieldTranslator.js +30 -0
- package/es/platform/zform/adapters/presenter/translators/fields/PicklistFieldTranslator.js +29 -0
- package/es/platform/zform/adapters/presenter/translators/fields/TextAreaFieldTranslator.js +30 -0
- package/es/platform/zform/adapters/presenter/translators/fields/TextFieldTranslator.js +27 -0
- package/es/platform/zform/adapters/presenter/translators/fields/URLFieldTranslator.js +30 -0
- package/es/platform/zform/adapters/presenter/translators/fields/index.js +15 -0
- package/es/platform/zform/applications/usecases/MyFormSuccessUseCase.js +3 -1
- package/es/platform/zform/domain/ZField.js +66 -17
- package/es/platform/zform/domain/ZSection.js +20 -7
- 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 +6 -2
- 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 -3
package/es/bc/zlist/Constants.js
CHANGED
|
@@ -7,4 +7,6 @@ export const ZLIST_FETCH_SORTED = 'ZLIST#FETCH_SORTED';
|
|
|
7
7
|
export const ZLIST_RECORD_UPDATE_SUCCEEDED = 'ZLIST#RECORD_UPDATE_SUCCEEDED';
|
|
8
8
|
export const ZLIST_RECORD_UPDATE_FAILED = 'ZLIST#RECORD_UPDATE_FAILED';
|
|
9
9
|
export const ZLIST_RECORD_DELETE_SUCCEEDED = 'ZLIST#RECORD_DELETE_SUCCEEDED';
|
|
10
|
-
export const ZLIST_RECORD_DELETE_FAILED = 'ZLIST#RECORD_DELETE_FAILED';
|
|
10
|
+
export const ZLIST_RECORD_DELETE_FAILED = 'ZLIST#RECORD_DELETE_FAILED';
|
|
11
|
+
export const ZLIST_RECORD_REORDER = 'ZLIST#RECORD_REORDER';
|
|
12
|
+
export const ZLIST_RECORD_REORDER_FAILED = 'ZLIST#RECORD_REORDER_FAILED';
|
|
@@ -27,4 +27,6 @@ _defineProperty(RecordApiActionName, "UPDATE_RECORD", 'updateRecord');
|
|
|
27
27
|
|
|
28
28
|
_defineProperty(RecordApiActionName, "GET_CLIENTACTIONS", 'getClientActions');
|
|
29
29
|
|
|
30
|
-
_defineProperty(RecordApiActionName, "CREATE_RECORD", 'createRecord');
|
|
30
|
+
_defineProperty(RecordApiActionName, "CREATE_RECORD", 'createRecord');
|
|
31
|
+
|
|
32
|
+
_defineProperty(RecordApiActionName, "GET_REORDERRECORD", 'reorderRecord');
|
|
@@ -45,6 +45,22 @@ export default {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
|
+
reOrderConfig: {
|
|
49
|
+
required: false,
|
|
50
|
+
defaultValue: {
|
|
51
|
+
isEnabled: false
|
|
52
|
+
},
|
|
53
|
+
typeMetadata: {
|
|
54
|
+
schema: {
|
|
55
|
+
type: 'object',
|
|
56
|
+
properties: {
|
|
57
|
+
isEnabled: {
|
|
58
|
+
type: 'boolean'
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
48
64
|
componentMapping: {
|
|
49
65
|
required: false,
|
|
50
66
|
defaultValue: {
|
|
@@ -22,4 +22,8 @@ _defineProperty(Constants, "TABLE_LIST_FIELD_CHANGED", 'TABLE_LIST#FIELD_CHANGED
|
|
|
22
22
|
|
|
23
23
|
_defineProperty(Constants, "TABLE_LIST_ROW_CLICKED", 'TABLE_LIST#ROW_CLICKED');
|
|
24
24
|
|
|
25
|
+
_defineProperty(Constants, "TABLE_LIST_ROW_DRAG_START", 'TABLE_LIST#ROW_DRAG_START');
|
|
26
|
+
|
|
27
|
+
_defineProperty(Constants, "TABLE_LIST_ROW_DRAG_END", 'TABLE_LIST#ROW_DRAG_END');
|
|
28
|
+
|
|
25
29
|
export default Constants;
|
|
@@ -18,6 +18,15 @@ import PickListProperties from "../fields/pick-list/Properties";
|
|
|
18
18
|
import TextProperties from "../fields/text/Properties";
|
|
19
19
|
import UrlProperties from "../fields/url/Properties";
|
|
20
20
|
const TableListProperties = {
|
|
21
|
+
isReOrderLoading: {
|
|
22
|
+
required: false,
|
|
23
|
+
typeMetadata: {
|
|
24
|
+
schema: {
|
|
25
|
+
type: 'boolean'
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
defaultValue: false
|
|
29
|
+
},
|
|
21
30
|
isLoading: {
|
|
22
31
|
required: false,
|
|
23
32
|
typeMetadata: {
|
|
@@ -308,6 +317,22 @@ const TableListProperties = {
|
|
|
308
317
|
}
|
|
309
318
|
}
|
|
310
319
|
},
|
|
320
|
+
reOrderConfig: {
|
|
321
|
+
required: false,
|
|
322
|
+
defaultValue: {
|
|
323
|
+
isEnabled: false
|
|
324
|
+
},
|
|
325
|
+
typeMetadata: {
|
|
326
|
+
schema: {
|
|
327
|
+
type: 'object',
|
|
328
|
+
properties: {
|
|
329
|
+
isEnabled: {
|
|
330
|
+
type: 'boolean'
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
},
|
|
311
336
|
...SelectionConfigProperties
|
|
312
337
|
};
|
|
313
338
|
export default TableListProperties;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { Width } from "../data-types/Header";
|
|
2
2
|
import RowCursor from "../data-types/RowCursor";
|
|
3
3
|
const TableRowProperties = {
|
|
4
|
+
isReorderEnabled: {
|
|
5
|
+
required: false,
|
|
6
|
+
defaultValue: false,
|
|
7
|
+
typeMetadata: {
|
|
8
|
+
schema: {
|
|
9
|
+
type: 'boolean'
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
},
|
|
4
13
|
isSelectionEnabled: {
|
|
5
14
|
required: false,
|
|
6
15
|
defaultValue: false,
|
|
@@ -119,6 +128,41 @@ const TableRowProperties = {
|
|
|
119
128
|
type: 'boolean'
|
|
120
129
|
}
|
|
121
130
|
}
|
|
131
|
+
},
|
|
132
|
+
isSorting: {
|
|
133
|
+
required: false,
|
|
134
|
+
defaultValue: false,
|
|
135
|
+
typeMetadata: {
|
|
136
|
+
schema: {
|
|
137
|
+
type: 'boolean'
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
isDroppable: {
|
|
142
|
+
required: false,
|
|
143
|
+
defaultValue: false,
|
|
144
|
+
typeMetadata: {
|
|
145
|
+
schema: {
|
|
146
|
+
type: 'boolean'
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
dropPosition: {
|
|
151
|
+
required: false,
|
|
152
|
+
typeMetadata: {
|
|
153
|
+
schema: {
|
|
154
|
+
type: "string"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
isReOrderLoading: {
|
|
159
|
+
required: false,
|
|
160
|
+
defaultValue: false,
|
|
161
|
+
typeMetadata: {
|
|
162
|
+
schema: {
|
|
163
|
+
type: 'boolean'
|
|
164
|
+
}
|
|
165
|
+
}
|
|
122
166
|
}
|
|
123
167
|
};
|
|
124
168
|
export default TableRowProperties;
|
package/es/index.js
CHANGED
|
@@ -9,4 +9,5 @@ import * as _Components from "./library/dot/legacy-to-new-arch";
|
|
|
9
9
|
export { _Components as Components };
|
|
10
10
|
export { platformSDK } from "./platform/sdk/frameworks/Sdk";
|
|
11
11
|
export { sdkRegistry } from "./platform/sdk/frameworks/SdkRegistry";
|
|
12
|
-
export { validations as defaultFieldValidations } from "./library/behaviours/field-validation/frameworks/utils/FormBasicValidationAdaptor";
|
|
12
|
+
export { validations as defaultFieldValidations } from "./library/behaviours/field-validation/frameworks/utils/FormBasicValidationAdaptor";
|
|
13
|
+
export { getClientActionsAdapter, fetchClientActions } from "./platform/client-actions/components/action-event-mediator/frameworks/ui/ClientActionsAdapter";
|
|
@@ -0,0 +1,105 @@
|
|
|
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, setTableInteractionClass, 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
|
+
setTableInteractionClass(TableRef, style.preventTextSelection, true);
|
|
26
|
+
setTableInteractionClass(TableRef, style.preventPointerEvents, true);
|
|
27
|
+
adjustHelperElementPosition(TableRef, getHelperClass());
|
|
28
|
+
dispatch({
|
|
29
|
+
type: TABLE_LIST_ROW_DRAG_START,
|
|
30
|
+
payload: {
|
|
31
|
+
index
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const handleSortEnd = _ref3 => {
|
|
37
|
+
let {
|
|
38
|
+
oldIndex,
|
|
39
|
+
newIndex
|
|
40
|
+
} = _ref3;
|
|
41
|
+
setTableInteractionClass(TableRef, style.preventTextSelection, false);
|
|
42
|
+
setTableInteractionClass(TableRef, style.preventPointerEvents, false);
|
|
43
|
+
let arr = reorderArray(rowData, oldIndex, newIndex);
|
|
44
|
+
setRowData(arr);
|
|
45
|
+
setDropIndicator({
|
|
46
|
+
index: null,
|
|
47
|
+
position: ''
|
|
48
|
+
});
|
|
49
|
+
dispatch({
|
|
50
|
+
type: TABLE_LIST_ROW_DRAG_END,
|
|
51
|
+
payload: {
|
|
52
|
+
oldIndex,
|
|
53
|
+
newIndex
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const handleSortOver = _ref4 => {
|
|
59
|
+
let {
|
|
60
|
+
index,
|
|
61
|
+
oldIndex,
|
|
62
|
+
newIndex
|
|
63
|
+
} = _ref4;
|
|
64
|
+
const dropIndicatorData = getDropIndicator({
|
|
65
|
+
index,
|
|
66
|
+
oldIndex,
|
|
67
|
+
newIndex,
|
|
68
|
+
rowsLength: rows.length
|
|
69
|
+
});
|
|
70
|
+
setDropIndicator({
|
|
71
|
+
index: dropIndicatorData.index,
|
|
72
|
+
position: dropIndicatorData.position
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const getHelperDimensions = useCallback(_ref5 => {
|
|
77
|
+
let {
|
|
78
|
+
node
|
|
79
|
+
} = _ref5;
|
|
80
|
+
return {
|
|
81
|
+
height: node.offsetHeight,
|
|
82
|
+
width: TableRef.current.offsetWidth
|
|
83
|
+
};
|
|
84
|
+
}, [TableRef]);
|
|
85
|
+
const getHelperContainer = useCallback(() => {
|
|
86
|
+
return TableRef.current;
|
|
87
|
+
}, [TableRef]);
|
|
88
|
+
|
|
89
|
+
const getHelperClass = () => {
|
|
90
|
+
return style.dragging;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
rowData,
|
|
95
|
+
dropIndicator,
|
|
96
|
+
handleSortStart,
|
|
97
|
+
handleSortEnd,
|
|
98
|
+
handleSortOver,
|
|
99
|
+
getHelperDimensions,
|
|
100
|
+
setRowData,
|
|
101
|
+
setDropIndicator,
|
|
102
|
+
getHelperContainer,
|
|
103
|
+
getHelperClass
|
|
104
|
+
};
|
|
105
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
2
|
import Table from '@zohodesk-private/desk-components/es/table/Table/Table';
|
|
3
3
|
import Header from "./sub-components/Header";
|
|
4
4
|
import Body from "./sub-components/Body";
|
|
@@ -7,7 +7,10 @@ import NoData from "./sub-components/NoData";
|
|
|
7
7
|
import ErrorState from "./sub-components/ErrorState";
|
|
8
8
|
import Loading from "./sub-components/Loading";
|
|
9
9
|
import ColumnResizingLine from "./sub-components/ColumnResizingLine";
|
|
10
|
-
import handleScroll from "./handlers/HandleScroll";
|
|
10
|
+
import handleScroll from "./handlers/HandleScroll";
|
|
11
|
+
import { useTableRowReorder } from "../hooks/useTableRowReorder";
|
|
12
|
+
import { SortableContainer } from 'react-sortable-hoc';
|
|
13
|
+
import getTableListClassName from "../utils/getTableListClassName"; // @ts-ignore
|
|
11
14
|
|
|
12
15
|
import style from "./css/TableList.module.css";
|
|
13
16
|
|
|
@@ -16,13 +19,16 @@ function TableListView(_ref2, _ref) {
|
|
|
16
19
|
state,
|
|
17
20
|
helpers
|
|
18
21
|
} = _ref2;
|
|
22
|
+
const TableRef = useRef(null);
|
|
19
23
|
const {
|
|
20
24
|
dispatch
|
|
21
25
|
} = helpers;
|
|
22
26
|
const {
|
|
23
27
|
data,
|
|
24
28
|
isLoading,
|
|
29
|
+
isReOrderLoading,
|
|
25
30
|
resizerState,
|
|
31
|
+
reOrderConfig,
|
|
26
32
|
selectionConfig,
|
|
27
33
|
isFlexibleColumns,
|
|
28
34
|
rowCursor,
|
|
@@ -45,17 +51,26 @@ function TableListView(_ref2, _ref) {
|
|
|
45
51
|
const isDataEmpty = !hasRows && !isLoading && !isError; // TODO: derive from state.properties
|
|
46
52
|
|
|
47
53
|
const isKeyboardControlsEnabled = keyboardControlsConfig.isEnabled;
|
|
54
|
+
const isReorderEnabled = reOrderConfig.isEnabled;
|
|
55
|
+
const isSelectionEnabled = selectionConfig.isEnabled;
|
|
56
|
+
const className = getTableListClassName({
|
|
57
|
+
isKeyboardControlsEnabled,
|
|
58
|
+
isReorderEnabled,
|
|
59
|
+
isSelectionEnabled
|
|
60
|
+
});
|
|
48
61
|
return /*#__PURE__*/React.createElement("div", {
|
|
49
|
-
className: style.wrapper
|
|
62
|
+
className: `${style.wrapper} ${style[className]}`,
|
|
50
63
|
ref: _ref
|
|
51
64
|
}, /*#__PURE__*/React.createElement(Table, {
|
|
65
|
+
ref: TableRef,
|
|
52
66
|
$event_onScroll: e => handleScroll(dispatch, {
|
|
53
67
|
scrollEvent: e
|
|
54
68
|
})
|
|
55
69
|
}, renderHeader({
|
|
56
70
|
headers,
|
|
57
71
|
resizerState,
|
|
58
|
-
|
|
72
|
+
isReorderEnabled,
|
|
73
|
+
isSelectionEnabled,
|
|
59
74
|
selection,
|
|
60
75
|
isKeyboardControlsEnabled,
|
|
61
76
|
isFlexibleColumns,
|
|
@@ -63,15 +78,19 @@ function TableListView(_ref2, _ref) {
|
|
|
63
78
|
rowActionsColumnWidth,
|
|
64
79
|
dispatch
|
|
65
80
|
}), renderBody({
|
|
81
|
+
TableRef,
|
|
82
|
+
dispatch,
|
|
66
83
|
headers,
|
|
67
84
|
rows,
|
|
68
85
|
isFlexibleColumns,
|
|
69
|
-
|
|
86
|
+
isReorderEnabled,
|
|
87
|
+
isSelectionEnabled,
|
|
70
88
|
isKeyboardControlsEnabled,
|
|
71
89
|
rowCursor,
|
|
72
90
|
hasRowActions,
|
|
73
91
|
rowActionsColumnWidth,
|
|
74
|
-
hasRows
|
|
92
|
+
hasRows,
|
|
93
|
+
isReOrderLoading
|
|
75
94
|
}), /*#__PURE__*/React.createElement(NoData, {
|
|
76
95
|
isDataEmpty: isDataEmpty,
|
|
77
96
|
emptyStateUiType: emptyStateUiType
|
|
@@ -87,7 +106,8 @@ function renderHeader(_ref3) {
|
|
|
87
106
|
let {
|
|
88
107
|
headers,
|
|
89
108
|
resizerState,
|
|
90
|
-
|
|
109
|
+
isReorderEnabled,
|
|
110
|
+
isSelectionEnabled,
|
|
91
111
|
selection,
|
|
92
112
|
isKeyboardControlsEnabled,
|
|
93
113
|
isFlexibleColumns,
|
|
@@ -96,7 +116,8 @@ function renderHeader(_ref3) {
|
|
|
96
116
|
dispatch
|
|
97
117
|
} = _ref3;
|
|
98
118
|
return /*#__PURE__*/React.createElement(Header, {
|
|
99
|
-
|
|
119
|
+
isReorderEnabled: isReorderEnabled,
|
|
120
|
+
isSelectionEnabled: isSelectionEnabled,
|
|
100
121
|
isResizerEnabled: resizerState.isEnabled,
|
|
101
122
|
isKeyboardControlsEnabled: isKeyboardControlsEnabled,
|
|
102
123
|
currentlyResizingColumn: resizerState.currentlyResizingColumn,
|
|
@@ -111,30 +132,79 @@ function renderHeader(_ref3) {
|
|
|
111
132
|
});
|
|
112
133
|
}
|
|
113
134
|
|
|
135
|
+
const SortableTableContainer = SortableContainer(props => {
|
|
136
|
+
const {
|
|
137
|
+
hasRows,
|
|
138
|
+
isFlexibleColumns,
|
|
139
|
+
children
|
|
140
|
+
} = props;
|
|
141
|
+
return /*#__PURE__*/React.createElement(Body, {
|
|
142
|
+
hasRows: hasRows,
|
|
143
|
+
isFlexibleColumns: isFlexibleColumns
|
|
144
|
+
}, children);
|
|
145
|
+
});
|
|
146
|
+
|
|
114
147
|
function renderBody(_ref4) {
|
|
115
148
|
let {
|
|
149
|
+
TableRef,
|
|
150
|
+
dispatch,
|
|
116
151
|
headers,
|
|
117
152
|
rows,
|
|
118
153
|
isFlexibleColumns,
|
|
119
|
-
|
|
154
|
+
isReorderEnabled,
|
|
155
|
+
isSelectionEnabled,
|
|
120
156
|
isKeyboardControlsEnabled,
|
|
121
157
|
rowCursor,
|
|
122
158
|
hasRowActions,
|
|
123
159
|
rowActionsColumnWidth,
|
|
124
|
-
hasRows
|
|
160
|
+
hasRows,
|
|
161
|
+
isReOrderLoading
|
|
125
162
|
} = _ref4;
|
|
126
|
-
|
|
163
|
+
const {
|
|
164
|
+
rowData,
|
|
165
|
+
dropIndicator,
|
|
166
|
+
handleSortStart,
|
|
167
|
+
handleSortEnd,
|
|
168
|
+
handleSortOver,
|
|
169
|
+
getHelperDimensions,
|
|
170
|
+
getHelperContainer,
|
|
171
|
+
getHelperClass
|
|
172
|
+
} = useTableRowReorder({
|
|
173
|
+
rows,
|
|
174
|
+
TableRef,
|
|
175
|
+
dispatch
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
if (!hasRows) {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return /*#__PURE__*/React.createElement(SortableTableContainer, {
|
|
127
183
|
hasRows: hasRows,
|
|
128
|
-
isFlexibleColumns: isFlexibleColumns
|
|
184
|
+
isFlexibleColumns: isFlexibleColumns,
|
|
185
|
+
helperClass: getHelperClass(),
|
|
186
|
+
useDragHandle: true,
|
|
187
|
+
helperContainer: getHelperContainer,
|
|
188
|
+
onSortStart: handleSortStart,
|
|
189
|
+
onSortEnd: handleSortEnd,
|
|
190
|
+
onSortOver: handleSortOver,
|
|
191
|
+
getHelperDimensions: getHelperDimensions,
|
|
192
|
+
axis: "y",
|
|
193
|
+
lockAxis: "y",
|
|
194
|
+
lockToContainerEdges: true,
|
|
195
|
+
distance: 1
|
|
129
196
|
}, /*#__PURE__*/React.createElement(Rows, {
|
|
130
197
|
headers: headers,
|
|
131
|
-
rows:
|
|
198
|
+
rows: rowData,
|
|
132
199
|
isFlexibleColumns: isFlexibleColumns,
|
|
133
|
-
|
|
200
|
+
isReorderEnabled: isReorderEnabled,
|
|
201
|
+
isSelectionEnabled: isSelectionEnabled,
|
|
134
202
|
rowCursor: rowCursor,
|
|
135
203
|
hasRowActions: hasRowActions,
|
|
136
204
|
rowActionsColumnWidth: rowActionsColumnWidth,
|
|
137
|
-
isKeyboardControlsEnabled: isKeyboardControlsEnabled
|
|
205
|
+
isKeyboardControlsEnabled: isKeyboardControlsEnabled,
|
|
206
|
+
dropIndicator: dropIndicator,
|
|
207
|
+
isReOrderLoading: isReOrderLoading
|
|
138
208
|
}));
|
|
139
209
|
}
|
|
140
210
|
|