@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
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ npm install @zohodesk/library-platform
|
|
|
17
17
|
To create a Table Connected component, you can use the `TableConnectedFactory`. Here is a simple example:
|
|
18
18
|
|
|
19
19
|
```javascript
|
|
20
|
-
import TableConnectedFactory from '@zohodesk/library-platform
|
|
20
|
+
import {TableConnectedFactory} from '@zohodesk/library-platform';
|
|
21
21
|
|
|
22
22
|
const myTableComponent = TableConnectedFactory.create({
|
|
23
23
|
name: 'MyTableComponent',
|
|
@@ -37,7 +37,7 @@ You can create custom components using the `createCustomComponent` function. Thi
|
|
|
37
37
|
#### Example
|
|
38
38
|
|
|
39
39
|
```javascript
|
|
40
|
-
import createCustomComponent from '@zohodesk/library-platform
|
|
40
|
+
import {createCustomComponent} from '@zohodesk/library-platform';
|
|
41
41
|
|
|
42
42
|
const MyCustomComponent = createCustomComponent({
|
|
43
43
|
name: 'MyCustomComponent',
|
|
@@ -55,7 +55,7 @@ The `ComponentRegistry` class is a singleton that allows you to register and ret
|
|
|
55
55
|
#### Example
|
|
56
56
|
|
|
57
57
|
```javascript
|
|
58
|
-
import ComponentRegistry from '@zohodesk/library-platform
|
|
58
|
+
import {ComponentRegistry} from '@zohodesk/library-platform';
|
|
59
59
|
|
|
60
60
|
// Register a component
|
|
61
61
|
ComponentRegistry.register('MyComponent', myComponentInstance);
|
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;
|
|
@@ -308,6 +308,22 @@ const TableListProperties = {
|
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
},
|
|
311
|
+
reOrderConfig: {
|
|
312
|
+
required: false,
|
|
313
|
+
defaultValue: {
|
|
314
|
+
isEnabled: false
|
|
315
|
+
},
|
|
316
|
+
typeMetadata: {
|
|
317
|
+
schema: {
|
|
318
|
+
type: 'object',
|
|
319
|
+
properties: {
|
|
320
|
+
isEnabled: {
|
|
321
|
+
type: 'boolean'
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
},
|
|
311
327
|
...SelectionConfigProperties
|
|
312
328
|
};
|
|
313
329
|
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,32 @@ 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
|
+
}
|
|
122
157
|
}
|
|
123
158
|
};
|
|
124
159
|
export default TableRowProperties;
|
package/es/index.js
CHANGED
|
@@ -2,10 +2,11 @@ import * as _CC from "./cc";
|
|
|
2
2
|
export { _CC as CC };
|
|
3
3
|
import * as _BC from "./bc";
|
|
4
4
|
export { _BC as BC };
|
|
5
|
-
export { TableConnectedFactory } from "./
|
|
5
|
+
export { TableConnectedFactory, FormConnectedFactory } from "./platform/components";
|
|
6
6
|
export { ComponentRegistry, createCustomComponent } from "./library";
|
|
7
7
|
export { default as TableFieldComponents } from "./library/dot/legacy-to-new-arch/table-field-components";
|
|
8
8
|
import * as _Components from "./library/dot/legacy-to-new-arch";
|
|
9
9
|
export { _Components as Components };
|
|
10
|
-
export {
|
|
11
|
-
export { sdkRegistry } from "./platform/sdk/frameworks/SdkRegistry";
|
|
10
|
+
export { platformSDK } from "./platform/sdk/frameworks/Sdk";
|
|
11
|
+
export { sdkRegistry } from "./platform/sdk/frameworks/SdkRegistry";
|
|
12
|
+
export { validations as defaultFieldValidations } from "./library/behaviours/field-validation/frameworks/utils/FormBasicValidationAdaptor";
|
|
@@ -0,0 +1,93 @@
|
|
|
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,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,9 @@ 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'; // @ts-ignore
|
|
11
13
|
|
|
12
14
|
import style from "./css/TableList.module.css";
|
|
13
15
|
|
|
@@ -16,6 +18,7 @@ function TableListView(_ref2, _ref) {
|
|
|
16
18
|
state,
|
|
17
19
|
helpers
|
|
18
20
|
} = _ref2;
|
|
21
|
+
const TableRef = useRef(null);
|
|
19
22
|
const {
|
|
20
23
|
dispatch
|
|
21
24
|
} = helpers;
|
|
@@ -23,6 +26,7 @@ function TableListView(_ref2, _ref) {
|
|
|
23
26
|
data,
|
|
24
27
|
isLoading,
|
|
25
28
|
resizerState,
|
|
29
|
+
reOrderConfig,
|
|
26
30
|
selectionConfig,
|
|
27
31
|
isFlexibleColumns,
|
|
28
32
|
rowCursor,
|
|
@@ -45,16 +49,23 @@ function TableListView(_ref2, _ref) {
|
|
|
45
49
|
const isDataEmpty = !hasRows && !isLoading && !isError; // TODO: derive from state.properties
|
|
46
50
|
|
|
47
51
|
const isKeyboardControlsEnabled = keyboardControlsConfig.isEnabled;
|
|
52
|
+
|
|
53
|
+
const getTableRef = ref => {
|
|
54
|
+
TableRef.current = ref;
|
|
55
|
+
};
|
|
56
|
+
|
|
48
57
|
return /*#__PURE__*/React.createElement("div", {
|
|
49
58
|
className: style.wrapper,
|
|
50
59
|
ref: _ref
|
|
51
60
|
}, /*#__PURE__*/React.createElement(Table, {
|
|
61
|
+
ref: getTableRef,
|
|
52
62
|
$event_onScroll: e => handleScroll(dispatch, {
|
|
53
63
|
scrollEvent: e
|
|
54
64
|
})
|
|
55
65
|
}, renderHeader({
|
|
56
66
|
headers,
|
|
57
67
|
resizerState,
|
|
68
|
+
reOrderConfig,
|
|
58
69
|
selectionConfig,
|
|
59
70
|
selection,
|
|
60
71
|
isKeyboardControlsEnabled,
|
|
@@ -63,9 +74,12 @@ function TableListView(_ref2, _ref) {
|
|
|
63
74
|
rowActionsColumnWidth,
|
|
64
75
|
dispatch
|
|
65
76
|
}), renderBody({
|
|
77
|
+
TableRef,
|
|
78
|
+
dispatch,
|
|
66
79
|
headers,
|
|
67
80
|
rows,
|
|
68
81
|
isFlexibleColumns,
|
|
82
|
+
reOrderConfig,
|
|
69
83
|
selectionConfig,
|
|
70
84
|
isKeyboardControlsEnabled,
|
|
71
85
|
rowCursor,
|
|
@@ -87,6 +101,7 @@ function renderHeader(_ref3) {
|
|
|
87
101
|
let {
|
|
88
102
|
headers,
|
|
89
103
|
resizerState,
|
|
104
|
+
reOrderConfig,
|
|
90
105
|
selectionConfig,
|
|
91
106
|
selection,
|
|
92
107
|
isKeyboardControlsEnabled,
|
|
@@ -96,6 +111,7 @@ function renderHeader(_ref3) {
|
|
|
96
111
|
dispatch
|
|
97
112
|
} = _ref3;
|
|
98
113
|
return /*#__PURE__*/React.createElement(Header, {
|
|
114
|
+
isReorderEnabled: reOrderConfig.isEnabled,
|
|
99
115
|
isSelectionEnabled: selectionConfig.isEnabled,
|
|
100
116
|
isResizerEnabled: resizerState.isEnabled,
|
|
101
117
|
isKeyboardControlsEnabled: isKeyboardControlsEnabled,
|
|
@@ -111,11 +127,26 @@ function renderHeader(_ref3) {
|
|
|
111
127
|
});
|
|
112
128
|
}
|
|
113
129
|
|
|
130
|
+
const SortableTableContainer = SortableContainer(props => {
|
|
131
|
+
const {
|
|
132
|
+
hasRows,
|
|
133
|
+
isFlexibleColumns,
|
|
134
|
+
children
|
|
135
|
+
} = props;
|
|
136
|
+
return /*#__PURE__*/React.createElement(Body, {
|
|
137
|
+
hasRows: hasRows,
|
|
138
|
+
isFlexibleColumns: isFlexibleColumns
|
|
139
|
+
}, children);
|
|
140
|
+
});
|
|
141
|
+
|
|
114
142
|
function renderBody(_ref4) {
|
|
115
143
|
let {
|
|
144
|
+
TableRef,
|
|
145
|
+
dispatch,
|
|
116
146
|
headers,
|
|
117
147
|
rows,
|
|
118
148
|
isFlexibleColumns,
|
|
149
|
+
reOrderConfig,
|
|
119
150
|
selectionConfig,
|
|
120
151
|
isKeyboardControlsEnabled,
|
|
121
152
|
rowCursor,
|
|
@@ -123,18 +154,48 @@ function renderBody(_ref4) {
|
|
|
123
154
|
rowActionsColumnWidth,
|
|
124
155
|
hasRows
|
|
125
156
|
} = _ref4;
|
|
126
|
-
|
|
157
|
+
const {
|
|
158
|
+
rowData,
|
|
159
|
+
dropIndicator,
|
|
160
|
+
handleSortStart,
|
|
161
|
+
handleSortEnd,
|
|
162
|
+
handleSortOver,
|
|
163
|
+
getHelperDimensions
|
|
164
|
+
} = useTableRowReorder({
|
|
165
|
+
rows,
|
|
166
|
+
TableRef,
|
|
167
|
+
dispatch
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
if (!hasRows) {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return /*#__PURE__*/React.createElement(SortableTableContainer, {
|
|
127
175
|
hasRows: hasRows,
|
|
128
|
-
isFlexibleColumns: isFlexibleColumns
|
|
176
|
+
isFlexibleColumns: isFlexibleColumns,
|
|
177
|
+
helperClass: `${style.dragging}`,
|
|
178
|
+
useDragHandle: true,
|
|
179
|
+
helperContainer: () => TableRef.current,
|
|
180
|
+
onSortStart: handleSortStart,
|
|
181
|
+
onSortEnd: handleSortEnd,
|
|
182
|
+
onSortOver: handleSortOver,
|
|
183
|
+
getHelperDimensions: getHelperDimensions,
|
|
184
|
+
axis: "y",
|
|
185
|
+
lockAxis: "y",
|
|
186
|
+
lockToContainerEdges: true,
|
|
187
|
+
distance: 1
|
|
129
188
|
}, /*#__PURE__*/React.createElement(Rows, {
|
|
130
189
|
headers: headers,
|
|
131
|
-
rows:
|
|
190
|
+
rows: rowData,
|
|
132
191
|
isFlexibleColumns: isFlexibleColumns,
|
|
192
|
+
isReorderEnabled: reOrderConfig.isEnabled,
|
|
133
193
|
isSelectionEnabled: selectionConfig.isEnabled,
|
|
134
194
|
rowCursor: rowCursor,
|
|
135
195
|
hasRowActions: hasRowActions,
|
|
136
196
|
rowActionsColumnWidth: rowActionsColumnWidth,
|
|
137
|
-
isKeyboardControlsEnabled: isKeyboardControlsEnabled
|
|
197
|
+
isKeyboardControlsEnabled: isKeyboardControlsEnabled,
|
|
198
|
+
dropIndicator: dropIndicator
|
|
138
199
|
}));
|
|
139
200
|
}
|
|
140
201
|
|
|
@@ -1,36 +1,47 @@
|
|
|
1
1
|
.loader {
|
|
2
2
|
padding: var(--zd_size40) 0
|
|
3
3
|
}
|
|
4
|
+
|
|
4
5
|
.wrapper {
|
|
5
6
|
height: 100% ;
|
|
6
7
|
width: 100% ;
|
|
7
8
|
position: relative
|
|
8
9
|
}
|
|
10
|
+
|
|
9
11
|
.resizerSpace {
|
|
10
12
|
width: calc(var(--local_table_resizer_extra_space, 0) * var(--zd_size1));
|
|
11
13
|
flex-shrink: 0
|
|
12
14
|
}
|
|
15
|
+
|
|
13
16
|
.contentWrapper {
|
|
14
17
|
composes: sticky from '~@zohodesk/components/es/common/common.module.css';
|
|
15
18
|
}
|
|
19
|
+
|
|
16
20
|
[dir=ltr] .contentWrapper {
|
|
17
21
|
left: 0 ;
|
|
18
22
|
}
|
|
23
|
+
|
|
19
24
|
[dir=rtl] .contentWrapper {
|
|
20
25
|
right: 0 ;
|
|
21
26
|
}
|
|
27
|
+
|
|
22
28
|
.initialLoading {
|
|
23
29
|
height: calc(100% - (var(--zd_size100)))
|
|
24
30
|
}
|
|
31
|
+
|
|
25
32
|
.emptyContent {
|
|
26
33
|
padding: var(--zd_size160) 0 var(--zd_size60)
|
|
27
34
|
}
|
|
35
|
+
|
|
28
36
|
.errorContent {
|
|
29
37
|
padding: var(--zd_size60) 0
|
|
30
38
|
}
|
|
31
|
-
|
|
39
|
+
|
|
40
|
+
.headerWithActions,
|
|
41
|
+
.fieldWithActions {
|
|
32
42
|
gap: var(--zd_size6)
|
|
33
43
|
}
|
|
44
|
+
|
|
34
45
|
.actions {
|
|
35
46
|
gap: var(--zd_size8)
|
|
36
47
|
}
|
|
@@ -38,9 +49,141 @@
|
|
|
38
49
|
.rowCursor_default {
|
|
39
50
|
cursor: default
|
|
40
51
|
}
|
|
52
|
+
|
|
41
53
|
.rowCursor_pointer {
|
|
42
54
|
cursor: pointer
|
|
43
55
|
}
|
|
56
|
+
|
|
44
57
|
.rowCursor_not-allowed {
|
|
45
58
|
cursor: not-allowed
|
|
46
|
-
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.dragging {
|
|
62
|
+
overflow: hidden;
|
|
63
|
+
box-shadow: var(--local_tablelist_box_shadow);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
:global(.GLOBAL_ZDDC_tableList).dragging .dragHandleContainer {
|
|
67
|
+
/* css:theme-validation:ignore */
|
|
68
|
+
color: var(--local_drag_handle_hover_color);
|
|
69
|
+
background-color: var(--local_drag_handle_dragging_bg);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:global(.GLOBAL_ZDDC_tableList).dragging .dragHandleContainer,
|
|
73
|
+
:global(.GLOBAL_ZDDC_tableList:hover) .dragHandleContainer,
|
|
74
|
+
:global(.GLOBAL_ZDDC_tableList:focus-within) .dragHandleContainer {
|
|
75
|
+
visibility: visible;
|
|
76
|
+
opacity: 1;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.dragHandleContainer {
|
|
80
|
+
opacity: 0;
|
|
81
|
+
visibility: hidden;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.dragHandleWrapper {
|
|
85
|
+
align-self: stretch;
|
|
86
|
+
composes: sticky from '~@zohodesk/components/es/common/common.module.css';
|
|
87
|
+
z-index: 1;
|
|
88
|
+
/* css:theme-validation:ignore */
|
|
89
|
+
padding: 0 ;
|
|
90
|
+
background-color: var(--local_tablelist_bg);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
[dir=ltr] .dragHandleWrapper {
|
|
94
|
+
left: 0 ;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
[dir=rtl] .dragHandleWrapper {
|
|
98
|
+
right: 0 ;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.rowDropIndicator {
|
|
102
|
+
width: 100% ;
|
|
103
|
+
height: var(--zd_size2) ;
|
|
104
|
+
/* css:theme-validation:ignore */
|
|
105
|
+
position: absolute;
|
|
106
|
+
z-index: 2;
|
|
107
|
+
background-color: var(--local_tablelist_drop_highlight_bg);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.dropIndicatorTop {
|
|
111
|
+
top: 0 ;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.dropIndicatorBottom {
|
|
115
|
+
bottom: calc( var(--zd_size3) * -1 ) ;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
[dir=ltr] .offsetLeft0 {
|
|
119
|
+
left: 0 !important;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
[dir=rtl] .offsetLeft0 {
|
|
123
|
+
right: 0 !important;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
[dir=ltr] .offsetLeft8 {
|
|
127
|
+
left: var(--zd_size8) !important;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
[dir=rtl] .offsetLeft8 {
|
|
131
|
+
right: var(--zd_size8) !important;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
[dir=ltr] .offsetLeft24 {
|
|
135
|
+
left: var(--zd_size24) !important;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
[dir=rtl] .offsetLeft24 {
|
|
139
|
+
right: var(--zd_size24) !important;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
[dir=ltr] .paddingLeft0 {
|
|
143
|
+
padding-left: 0 ;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
[dir=rtl] .paddingLeft0 {
|
|
147
|
+
padding-right: 0 ;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
[dir=ltr] .paddingLeft8 {
|
|
151
|
+
padding-left: var(--zd_size8) !important;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
[dir=rtl] .paddingLeft8 {
|
|
155
|
+
padding-right: var(--zd_size8) !important;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
[dir=ltr] .paddingLeft16 {
|
|
159
|
+
padding-left: var(--zd_size16) !important;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
[dir=rtl] .paddingLeft16 {
|
|
163
|
+
padding-right: var(--zd_size16) !important;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
[dir=ltr] .paddingRight8 {
|
|
167
|
+
padding-right: var(--zd_size8) !important;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
[dir=rtl] .paddingRight8 {
|
|
171
|
+
padding-left: var(--zd_size8) !important;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
[dir=ltr] .paddingRight16 {
|
|
175
|
+
padding-right: var(--zd_size16) !important;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
[dir=rtl] .paddingRight16 {
|
|
179
|
+
padding-left: var(--zd_size16) !important;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
[dir=ltr] .paddingRight24 {
|
|
183
|
+
padding-right: var(--zd_size24) !important;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
[dir=rtl] .paddingRight24 {
|
|
187
|
+
padding-left: var(--zd_size24) !important;
|
|
188
|
+
}
|
|
189
|
+
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import TableHeader from '@zohodesk-private/desk-components/es/table/TableHeader/TableHeader';
|
|
2
|
+
import TableHeader from '@zohodesk-private/desk-components/es/table/TableHeader/TableHeader';
|
|
3
|
+
import TableHeadFirstNode from '@zohodesk-private/desk-components/es/table/TableHeadFirstNode/TableHeadFirstNode'; // import TableHeaderRow from '@zohodesk-private/desk-components/es/table/TableHeader/TableHeaderRow';
|
|
3
4
|
|
|
4
5
|
const TableHeaderRow = _ref => {
|
|
5
6
|
let {
|
|
@@ -12,9 +13,11 @@ import MassAction from "./header/MassAction";
|
|
|
12
13
|
import Headers from "./header/Headers";
|
|
13
14
|
import ActionColumn from "./header/ActionColumn";
|
|
14
15
|
import ResizerExtraSpace from "./header/ResizerExtraSpace";
|
|
16
|
+
import style from "./../../ui/css/TableList.module.css";
|
|
15
17
|
|
|
16
18
|
function Header(_ref2) {
|
|
17
19
|
let {
|
|
20
|
+
isReorderEnabled,
|
|
18
21
|
isSelectionEnabled,
|
|
19
22
|
actions,
|
|
20
23
|
isKeyboardControlsEnabled,
|
|
@@ -35,18 +38,33 @@ function Header(_ref2) {
|
|
|
35
38
|
|
|
36
39
|
return /*#__PURE__*/React.createElement(TableHeader, {
|
|
37
40
|
$flag_isColumnsFlexible: isFlexibleColumns,
|
|
38
|
-
$flag_padding: !isSelectionEnabled,
|
|
41
|
+
$flag_padding: !isSelectionEnabled && !isReorderEnabled,
|
|
39
42
|
$flag_hasHighlighter: isKeyboardControlsEnabled
|
|
40
|
-
}, /*#__PURE__*/React.createElement(TableHeaderRow, null, rendermassAction(isSelectionEnabled, actions), renderHeaders(headers, currentlyResizingColumn, isResizerEnabled, isFlexibleColumns, dispatch), renderActionColumn(hasRowActions, rowActionsColumnWidth), renderResizerExtraSpace(isCurrentlyResizing, resizerExtraWidth)));
|
|
43
|
+
}, /*#__PURE__*/React.createElement(TableHeaderRow, null, renderReOrderColumn(isSelectionEnabled, isReorderEnabled, isKeyboardControlsEnabled), rendermassAction(isSelectionEnabled, isReorderEnabled, isKeyboardControlsEnabled, actions), renderHeaders(headers, currentlyResizingColumn, isResizerEnabled, isFlexibleColumns, dispatch), renderActionColumn(hasRowActions, rowActionsColumnWidth), renderResizerExtraSpace(isCurrentlyResizing, resizerExtraWidth)));
|
|
41
44
|
}
|
|
42
45
|
|
|
43
|
-
function rendermassAction(isSelectionEnabled, actions) {
|
|
46
|
+
function rendermassAction(isSelectionEnabled, isReorderEnabled, isKeyboardControlsEnabled, actions) {
|
|
44
47
|
return /*#__PURE__*/React.createElement(MassAction, {
|
|
45
48
|
isSelectionEnabled: isSelectionEnabled,
|
|
49
|
+
isReorderEnabled: isReorderEnabled,
|
|
50
|
+
isKeyboardControlsEnabled: isKeyboardControlsEnabled,
|
|
46
51
|
actions: actions
|
|
47
52
|
});
|
|
48
53
|
}
|
|
49
54
|
|
|
55
|
+
function renderReOrderColumn(isSelectionEnabled, isReorderEnabled, isKeyboardControlsEnabled) {
|
|
56
|
+
if (isReorderEnabled) {
|
|
57
|
+
return /*#__PURE__*/React.createElement(TableHeadFirstNode, {
|
|
58
|
+
customStyle: {
|
|
59
|
+
container: isKeyboardControlsEnabled && isSelectionEnabled ? style.paddingRight16 : isKeyboardControlsEnabled ? `${style.offsetLeft8} ${style.paddingRight8}` : style.offsetLeft0
|
|
60
|
+
},
|
|
61
|
+
$customProps_container: {
|
|
62
|
+
$data_width: 24
|
|
63
|
+
}
|
|
64
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
50
68
|
function renderHeaders(headers, currentlyResizingColumn, isResizerEnabled, isFlexibleColumns, dispatch) {
|
|
51
69
|
return /*#__PURE__*/React.createElement(Headers, {
|
|
52
70
|
headers: headers,
|