@zohodesk/library-platform 1.1.2 → 1.1.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/column-chooser/Constants.js +4 -0
- package/es/bc/column-chooser/EventHandlers.js +2 -0
- package/es/bc/column-chooser/Events.js +59 -0
- package/es/bc/column-chooser/Properties.js +18 -0
- package/es/bc/keyboard-controls/Constants.js +5 -0
- package/es/bc/keyboard-controls/Events.js +51 -0
- package/es/bc/keyboard-controls/Properties.js +11 -0
- package/es/bc/keyboard-controls/types/KeyboardControlBehaviourState.js +1 -0
- package/es/bc/zlist/Properties.js +15 -0
- package/es/cc/fields/field/Properties.js +10 -1
- package/es/cc/fields/index.js +1 -1
- package/es/cc/table-column-chooser/Constants.js +6 -0
- package/es/cc/table-column-chooser/Events.js +69 -0
- package/es/cc/table-column-chooser/Properties.js +122 -0
- package/es/cc/table-column-chooser/index.js +3 -0
- package/es/cc/table-connected/Properties.js +16 -0
- package/es/cc/table-connected/constants/Events.js +4 -1
- package/es/cc/table-list/Properties.js +27 -1
- package/es/cc/table-list/data-types/KeyboardControlsConfig.js +1 -0
- package/es/cc/table-list/row/Properties.js +18 -0
- package/es/desk-frameworks/table-connected/adapters/controllers/ColumnChooserOpenedController.js +36 -0
- package/es/desk-frameworks/table-connected/adapters/controllers/ColumnChooserUpdateController.js +25 -0
- package/es/desk-frameworks/table-connected/frameworks/EventHandlersFactory.js +8 -2
- package/es/desk-frameworks/table-connected/frameworks/TableConnectedFactory.js +5 -2
- package/es/desk-frameworks/table-connected/frameworks/TableConnectedView.js +9 -6
- package/es/library/behaviours/keyboard-controls/adapters/controllers/AbstractController.js +9 -0
- package/es/library/behaviours/keyboard-controls/adapters/controllers/DestructController.js +20 -0
- package/es/library/behaviours/keyboard-controls/adapters/controllers/DownArrowPressController.js +20 -0
- package/es/library/behaviours/keyboard-controls/adapters/controllers/EnterPressController.js +24 -0
- package/es/library/behaviours/keyboard-controls/adapters/controllers/FocusNextController.js +20 -0
- package/es/library/behaviours/keyboard-controls/adapters/controllers/FocusPreviousController.js +20 -0
- package/es/library/behaviours/keyboard-controls/adapters/controllers/InitializeController.js +20 -0
- package/es/library/behaviours/keyboard-controls/adapters/controllers/SpacePressController.js +24 -0
- package/es/library/behaviours/keyboard-controls/adapters/controllers/UpArrowPressController.js +20 -0
- package/es/library/behaviours/keyboard-controls/adapters/gateways/KeyboardHandler.js +81 -0
- package/es/library/behaviours/keyboard-controls/adapters/gateways/Repository.js +47 -0
- package/es/library/behaviours/keyboard-controls/adapters/gateways/Service.js +40 -0
- package/es/library/behaviours/keyboard-controls/adapters/presenters/Presenter.js +39 -0
- package/es/library/behaviours/keyboard-controls/applications/interfaces/UseCase.js +0 -0
- package/es/library/behaviours/keyboard-controls/applications/interfaces/UseCaseDependencies.js +1 -0
- package/es/library/behaviours/keyboard-controls/applications/interfaces/gateways/IKeyboardHandler.js +1 -0
- package/es/library/behaviours/keyboard-controls/applications/interfaces/gateways/IRepository.js +1 -0
- package/es/library/behaviours/keyboard-controls/applications/interfaces/gateways/IService.js +1 -0
- package/es/library/behaviours/keyboard-controls/applications/interfaces/input/DestructInputModel.js +1 -0
- package/es/library/behaviours/keyboard-controls/applications/interfaces/input/DownArrowPressInputModel.js +1 -0
- package/es/library/behaviours/keyboard-controls/applications/interfaces/input/EnterPressInputModel.js +1 -0
- package/es/library/behaviours/keyboard-controls/applications/interfaces/input/FocusNextInputModel.js +1 -0
- package/es/library/behaviours/keyboard-controls/applications/interfaces/input/FocusPreviousInputModel.js +1 -0
- package/es/library/behaviours/keyboard-controls/applications/interfaces/input/InitializeInputModel.js +1 -0
- package/es/library/behaviours/keyboard-controls/applications/interfaces/input/RowActionInputModel.js +1 -0
- package/es/library/behaviours/keyboard-controls/applications/interfaces/input/SelectionInputModel.js +1 -0
- package/es/library/behaviours/keyboard-controls/applications/interfaces/input/SpacePressInputModel.js +1 -0
- package/es/library/behaviours/keyboard-controls/applications/interfaces/input/UpArrowPressInputModel.js +1 -0
- package/es/library/behaviours/keyboard-controls/applications/interfaces/output/IPresenter.js +1 -0
- package/es/library/behaviours/keyboard-controls/applications/interfaces/output/OutputModel.js +1 -0
- package/es/library/behaviours/keyboard-controls/applications/usecases/AbstractUseCase.js +19 -0
- package/es/library/behaviours/keyboard-controls/applications/usecases/DestructUsecase.js +17 -0
- package/es/library/behaviours/keyboard-controls/applications/usecases/DownArrowPress.js +16 -0
- package/es/library/behaviours/keyboard-controls/applications/usecases/EnterPress.js +19 -0
- package/es/library/behaviours/keyboard-controls/applications/usecases/FocusNextUsecase.js +16 -0
- package/es/library/behaviours/keyboard-controls/applications/usecases/FocusPreviousUsecase.js +16 -0
- package/es/library/behaviours/keyboard-controls/applications/usecases/InitializeUsecase.js +20 -0
- package/es/library/behaviours/keyboard-controls/applications/usecases/SpacePress.js +19 -0
- package/es/library/behaviours/keyboard-controls/applications/usecases/UpArrowPress.js +16 -0
- package/es/library/behaviours/keyboard-controls/domain/entities/KeyboardControls.js +87 -0
- package/es/library/behaviours/keyboard-controls/domain/entities/interface/IKeyboardControls.js +1 -0
- package/es/library/behaviours/keyboard-controls/domain/entities/interface/KeyboardControlModel.js +1 -0
- package/es/library/behaviours/keyboard-controls/frameworks/EventHandlerFactory.js +48 -0
- package/es/library/behaviours/keyboard-controls/frameworks/KeyboardControlBehaviourFactory.js +23 -0
- package/es/library/custom-component/frameworks/ui/ComponentRegistry.js +8 -0
- package/es/library/dot/components/action-location/frameworks/ui/ActionComponentMapping.js +4 -0
- package/es/library/dot/components/table-list/adapters/controllers/KeyboardRowClickController.js +36 -0
- package/es/library/dot/components/table-list/adapters/controllers/KeyboardRowSelectController.js +31 -0
- package/es/library/dot/components/table-list/adapters/controllers/index.js +3 -1
- package/es/library/dot/components/table-list/adapters/presenters/TableTranslator.js +5 -3
- package/es/library/dot/components/table-list/frameworks/ui/EventHandlersFactory.js +4 -1
- package/es/library/dot/components/table-list/frameworks/ui/TableListView.js +10 -3
- package/es/library/dot/components/table-list/frameworks/ui/css/TableList.module.css +3 -0
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/Header.js +9 -10
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/Rows.js +7 -3
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/HeaderData.js +7 -2
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/MassAction.js +28 -0
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/Row.js +5 -0
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/RowData.js +7 -2
- package/es/library/dot/legacy-to-new-arch/table-column-chooser/frameworks/ui/TableColumnChooser.js +11 -0
- package/es/library/dot/legacy-to-new-arch/table-column-chooser/frameworks/ui/TableColumnChooserView.js +79 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/lookup-field/frameworks/ui/LookupFieldView.js +6 -8
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActionsRenderer.module.css +0 -6
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActionsRendererView.js +1 -1
- package/es/platform/column-chooser/adapters/controllers/AbstractController.js +10 -0
- package/es/platform/column-chooser/adapters/controllers/ColumnChooserCloseController.js +21 -0
- package/es/platform/column-chooser/adapters/controllers/ColumnChooserOpenController.js +26 -0
- package/es/platform/column-chooser/adapters/controllers/ColumnChooserReorderController.js +26 -0
- package/es/platform/column-chooser/adapters/controllers/ColumnChooserSaveController.js +21 -0
- package/es/platform/column-chooser/adapters/controllers/ColumnChooserSearchController.js +24 -0
- package/es/platform/column-chooser/adapters/controllers/ColumnChooserSelectController.js +26 -0
- package/es/platform/column-chooser/adapters/gateways/Repository.js +38 -0
- package/es/platform/column-chooser/adapters/gateways/Service.js +34 -0
- package/es/platform/column-chooser/adapters/gateways/State.js +1 -0
- package/es/platform/column-chooser/adapters/presenters/Presenter.js +25 -0
- package/es/platform/column-chooser/applications/interfaces/UsecaseDependencies.js +1 -0
- package/es/platform/column-chooser/applications/interfaces/gateways/IRepository.js +1 -0
- package/es/platform/column-chooser/applications/interfaces/gateways/IService.js +1 -0
- package/es/platform/column-chooser/applications/interfaces/input/ColumnChooserCloseInput.js +1 -0
- package/es/platform/column-chooser/applications/interfaces/input/ColumnChooserOpenInput.js +1 -0
- package/es/platform/column-chooser/applications/interfaces/input/ColumnChooserReorderInput.js +1 -0
- package/es/platform/column-chooser/applications/interfaces/input/ColumnChooserSaveInput.js +1 -0
- package/es/platform/column-chooser/applications/interfaces/input/ColumnChooserSearchInput.js +1 -0
- package/es/platform/column-chooser/applications/interfaces/input/ColumnChooserSelectInput.js +1 -0
- package/es/platform/column-chooser/applications/interfaces/output/BehaviourState.js +1 -0
- package/es/platform/column-chooser/applications/interfaces/output/IPresenter.js +1 -0
- package/es/platform/column-chooser/applications/usecases/AbstractUseCase.js +18 -0
- package/es/platform/column-chooser/applications/usecases/ColumnChooserCloseUseCase.js +34 -0
- package/es/platform/column-chooser/applications/usecases/ColumnChooserOpenUseCase.js +20 -0
- package/es/platform/column-chooser/applications/usecases/ColumnChooserReorderUseCase.js +20 -0
- package/es/platform/column-chooser/applications/usecases/ColumnChooserSaveUseCase.js +31 -0
- package/es/platform/column-chooser/applications/usecases/ColumnChooserSearchUseCase.js +19 -0
- package/es/platform/column-chooser/applications/usecases/ColumnChooserSelectUseCase.js +26 -0
- package/es/platform/column-chooser/domain/entities/ColumnChooserImp.js +95 -0
- package/es/platform/column-chooser/domain/entities/ReorderEntityImp.js +35 -0
- package/es/platform/column-chooser/domain/entities/SearchEntityImp.js +28 -0
- package/es/platform/column-chooser/domain/entities/SelectEntityImp.js +58 -0
- package/es/platform/column-chooser/domain/entities/interfaces/ColumnChooser.js +1 -0
- package/es/platform/column-chooser/domain/entities/interfaces/ReorderEntity.js +1 -0
- package/es/platform/column-chooser/domain/entities/interfaces/SearchEntity.js +1 -0
- package/es/platform/column-chooser/domain/entities/interfaces/SelectEntity.js +1 -0
- package/es/platform/column-chooser/frameworks/ColumnChooserBehaviourFactory.js +19 -0
- package/es/platform/column-chooser/frameworks/EventHandlersFactory.js +30 -0
- package/es/platform/data-source/http-template/updateSelectedFields.js +28 -0
- package/es/platform/data-source/index.js +2 -0
- package/es/platform/zfield/domain/entities/fields-manager/FieldsManager.js +3 -1
- package/es/platform/zfield/domain/entities/interfaces/FieldApiName.js +1 -0
- package/es/platform/zfield/frameworks/ZFieldBehaviourFactory.js +6 -1
- package/es/platform/zlist/adapters/gateways/Repository.js +4 -2
- package/es/platform/zlist/adapters/presenters/SelectionTranslator.js +92 -0
- package/es/platform/zlist/adapters/presenters/TableTranslator.js +32 -19
- package/es/platform/zlist/adapters/presenters/translators/ColumnTranslator.js +63 -4
- package/es/platform/zlist/adapters/presenters/translators/Row.js +1 -1
- package/es/platform/zlist/adapters/presenters/translators/fields/LookUpFieldTranslator.js +6 -6
- package/es/platform/zlist/adapters/presenters/translators/interfaces/State.js +2 -1
- package/es/platform/zlist/adapters/presenters/utils/DefaultClientActions.js +78 -6
- package/es/platform/zlist/applications/entities-factory/ListFactory.js +3 -2
- package/es/platform/zlist/applications/usecases/FetchMoreUseCase.js +4 -1
- package/es/platform/zlist/applications/usecases/RecordExecuteFailedUseCase.js +3 -1
- package/es/platform/zlist/domain/entities/List.js +14 -2
- package/package.json +6 -4
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/SelectAll.js +0 -26
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { SMART_TABLE_ACTION_TRIGGERED, SMART_TABLE_SELECTION_TOGGLED } from "../../../../../cc/table-connected/constants/Events";
|
|
2
|
+
|
|
3
|
+
class KeyboardControls {
|
|
4
|
+
constructor(focussedIndex, totalLists) {
|
|
5
|
+
this.focussedIndex = focussedIndex;
|
|
6
|
+
this.totalLists = totalLists;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
setFocussedIndex(index) {
|
|
10
|
+
this.focussedIndex = index;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
getFocussedIndex() {
|
|
14
|
+
return this.focussedIndex;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
focusPrevious() {
|
|
18
|
+
if (this.focussedIndex > 0) {
|
|
19
|
+
this.focussedIndex -= 1;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
focusNext() {
|
|
24
|
+
if (this.totalLists > 1 && this.focussedIndex < this.totalLists - 1) {
|
|
25
|
+
this.focussedIndex += 1;
|
|
26
|
+
}
|
|
27
|
+
} // focusPrevious(): void {
|
|
28
|
+
// if (this.focussedIndex > 0) {
|
|
29
|
+
// this.focussedIndex -= 1;
|
|
30
|
+
// } else if (this.focussedIndex === 0 && this.totalLists > 1) {
|
|
31
|
+
// this.focussedIndex = this.totalLists - 1;
|
|
32
|
+
// }
|
|
33
|
+
// }
|
|
34
|
+
// focusNext(): void {
|
|
35
|
+
// if ((this.totalLists > 1) && (this.focussedIndex <= this.totalLists - 1)) {
|
|
36
|
+
// if (this.focussedIndex >= this.totalLists - 1) {
|
|
37
|
+
// this.focussedIndex = 0;
|
|
38
|
+
// } else {
|
|
39
|
+
// this.focussedIndex += 1;
|
|
40
|
+
// }
|
|
41
|
+
// }
|
|
42
|
+
// }
|
|
43
|
+
// getPreviousFocusEvent(event: KeyboardEvent): EventModel {
|
|
44
|
+
// return {
|
|
45
|
+
// type: SMART_TABLE_PREVIOUS_FOCUS,
|
|
46
|
+
// payload: {
|
|
47
|
+
// event
|
|
48
|
+
// }
|
|
49
|
+
// }
|
|
50
|
+
// }
|
|
51
|
+
// getNextFocusEvent(event: KeyboardEvent): EventModel {
|
|
52
|
+
// return {
|
|
53
|
+
// type: SMART_TABLE_NEXT_FOCUS,
|
|
54
|
+
// payload: {
|
|
55
|
+
// event
|
|
56
|
+
// }
|
|
57
|
+
// }
|
|
58
|
+
// }
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
getSelectionEvent(event) {
|
|
62
|
+
return {
|
|
63
|
+
type: SMART_TABLE_SELECTION_TOGGLED,
|
|
64
|
+
payload: {
|
|
65
|
+
event
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
getClickActionEvent(event) {
|
|
71
|
+
return {
|
|
72
|
+
type: SMART_TABLE_ACTION_TRIGGERED,
|
|
73
|
+
payload: {
|
|
74
|
+
event
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
toObject() {
|
|
80
|
+
return {
|
|
81
|
+
focussedIndex: this.focussedIndex
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export default KeyboardControls;
|
package/es/library/behaviours/keyboard-controls/domain/entities/interface/IKeyboardControls.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/library/behaviours/keyboard-controls/domain/entities/interface/KeyboardControlModel.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { KEYBOARD_CONTROL_DOWN_ARROW_PRESSED, KEYBOARD_CONTROL_ENTER_PRESSED, KEYBOARD_CONTROL_SPACE_PRESSED, KEYBOARD_CONTROL_UP_ARROW_PRESSED } from "../../../../bc/keyboard-controls/Constants";
|
|
2
|
+
import UpArrowPressController from "../adapters/controllers/UpArrowPressController";
|
|
3
|
+
import DownArrowPressController from "../adapters/controllers/DownArrowPressController";
|
|
4
|
+
import SpacePressController from "../adapters/controllers/SpacePressController";
|
|
5
|
+
import EnterPressController from "../adapters/controllers/EnterPressController";
|
|
6
|
+
import Service from "../adapters/gateways/Service";
|
|
7
|
+
import Repository from "../adapters/gateways/Repository";
|
|
8
|
+
import Presenter from "../adapters/presenters/Presenter";
|
|
9
|
+
import KeyboardHandler from "../adapters/gateways/KeyboardHandler"; // import FocusPreviousController from "../adapters/controllers/FocusPreviousController";
|
|
10
|
+
// import FocusNextController from "../adapters/controllers/FocusNextController";
|
|
11
|
+
|
|
12
|
+
import LifeCycleAction from "../../../../cc/architecture/LifeCycleActionEnum";
|
|
13
|
+
import InitializeController from "../adapters/controllers/InitializeController";
|
|
14
|
+
import DestructController from "../adapters/controllers/DestructController";
|
|
15
|
+
|
|
16
|
+
class EventHandlerFactory {
|
|
17
|
+
static create() {
|
|
18
|
+
const service = this.createService();
|
|
19
|
+
return this.createHandlers(service);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static createService() {
|
|
23
|
+
const repository = new Repository();
|
|
24
|
+
const presenter = new Presenter();
|
|
25
|
+
const keyboardHandler = new KeyboardHandler();
|
|
26
|
+
return new Service({
|
|
27
|
+
repository: repository,
|
|
28
|
+
presenter,
|
|
29
|
+
keyboardHandler
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static createHandlers(service) {
|
|
34
|
+
return {
|
|
35
|
+
[LifeCycleAction.MOUNT]: new InitializeController(service).handle,
|
|
36
|
+
[LifeCycleAction.UN_MOUNT]: new DestructController(service).handle,
|
|
37
|
+
// [SMART_TABLE_PREVIOUS_FOCUS]: new FocusPreviousController(service).handle,
|
|
38
|
+
// [SMART_TABLE_NEXT_FOCUS]: new FocusNextController(service).handle,
|
|
39
|
+
[KEYBOARD_CONTROL_UP_ARROW_PRESSED]: new UpArrowPressController(service).handle,
|
|
40
|
+
[KEYBOARD_CONTROL_DOWN_ARROW_PRESSED]: new DownArrowPressController(service).handle,
|
|
41
|
+
[KEYBOARD_CONTROL_SPACE_PRESSED]: new SpacePressController(service).handle,
|
|
42
|
+
[KEYBOARD_CONTROL_ENTER_PRESSED]: new EnterPressController(service).handle
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default EventHandlerFactory;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import EventHandlerFactory from "./EventHandlerFactory";
|
|
2
|
+
import events from "../../../../bc/keyboard-controls/Events";
|
|
3
|
+
import properties from "../../../../bc/keyboard-controls/Properties";
|
|
4
|
+
|
|
5
|
+
class KeyboardControlBehaviourFactory {
|
|
6
|
+
static create() {
|
|
7
|
+
return {
|
|
8
|
+
name: 'keyboardControls',
|
|
9
|
+
setInitialState: () => {
|
|
10
|
+
return {
|
|
11
|
+
focussedIndex: 0,
|
|
12
|
+
totalLists: 0
|
|
13
|
+
};
|
|
14
|
+
},
|
|
15
|
+
eventHandlers: EventHandlerFactory.create(),
|
|
16
|
+
events,
|
|
17
|
+
properties
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default KeyboardControlBehaviourFactory;
|
|
@@ -14,6 +14,14 @@ class ComponentRegistry {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
register(name, component) {
|
|
17
|
+
if (this.components.has(name)) {
|
|
18
|
+
console.warn(`Component with name "${name}" is already registered. Overwriting the existing component.`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (this.components.has(name) && this.get(name) !== component) {
|
|
22
|
+
console.warn(`Component with name "${name}" is already registered with a different instance. Overwriting the existing component.`);
|
|
23
|
+
}
|
|
24
|
+
|
|
17
25
|
this.components.set(name, component);
|
|
18
26
|
}
|
|
19
27
|
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import ActionIcon from "../../../../legacy-to-new-arch/action-icon/frameworks/ui/ActionIcon";
|
|
2
2
|
import TableColumnSort from "../../../../legacy-to-new-arch/table-column-sort/frameworks/ui/TableColumnSort";
|
|
3
|
+
import TableColumnChooser from "../../../../legacy-to-new-arch/table-column-chooser/frameworks/ui/TableColumnChooser";
|
|
4
|
+
import Checkbox from "../../../../legacy-to-new-arch/checkbox/frameworks/ui/Checkbox";
|
|
3
5
|
import TableColumnFilter from "../../../../legacy-to-new-arch/table-column-filter/frameworks/ui/TableColumnFilter";
|
|
4
6
|
const ActionComponentMapping = {
|
|
5
7
|
['ActionIcon']: ActionIcon,
|
|
6
8
|
['TableColumnSort']: TableColumnSort,
|
|
9
|
+
['TableColumnChooser']: TableColumnChooser,
|
|
10
|
+
['TableSelectAll']: Checkbox,
|
|
7
11
|
['TableColumnFilter']: TableColumnFilter
|
|
8
12
|
};
|
|
9
13
|
export default ActionComponentMapping;
|
package/es/library/dot/components/table-list/adapters/controllers/KeyboardRowClickController.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import SmartTableConstants from "../../../../../../cc/table-connected/constants/Events";
|
|
2
|
+
import AbstractController from "./AbstractController";
|
|
3
|
+
|
|
4
|
+
class KeyboardRowClickController extends AbstractController {
|
|
5
|
+
handle(event) {
|
|
6
|
+
const {
|
|
7
|
+
state,
|
|
8
|
+
dispatch,
|
|
9
|
+
action
|
|
10
|
+
} = event;
|
|
11
|
+
const {
|
|
12
|
+
event: keyboardEvent
|
|
13
|
+
} = action.payload;
|
|
14
|
+
const {
|
|
15
|
+
focussedRow,
|
|
16
|
+
data
|
|
17
|
+
} = state.properties || {};
|
|
18
|
+
const record = data === null || data === void 0 ? void 0 : data.rows[focussedRow];
|
|
19
|
+
|
|
20
|
+
if (!record) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let id = record.id;
|
|
25
|
+
dispatch({
|
|
26
|
+
type: SmartTableConstants.SMART_TABLE_ROW_ACTION_TRIGGERED,
|
|
27
|
+
payload: {
|
|
28
|
+
id,
|
|
29
|
+
event: keyboardEvent
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default KeyboardRowClickController;
|
package/es/library/dot/components/table-list/adapters/controllers/KeyboardRowSelectController.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { LIST_SELECTION_TOGGLE_ITEMS } from "../../../../../../bc/list-selection/Constants";
|
|
2
|
+
import AbstractController from "./AbstractController";
|
|
3
|
+
|
|
4
|
+
class KeyboardRowSelectController extends AbstractController {
|
|
5
|
+
handle(event) {
|
|
6
|
+
const {
|
|
7
|
+
state,
|
|
8
|
+
dispatch
|
|
9
|
+
} = event;
|
|
10
|
+
const {
|
|
11
|
+
focussedRow,
|
|
12
|
+
data
|
|
13
|
+
} = state.properties || {};
|
|
14
|
+
const record = data === null || data === void 0 ? void 0 : data.rows[focussedRow];
|
|
15
|
+
|
|
16
|
+
if (!record) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let id = record.id;
|
|
21
|
+
dispatch({
|
|
22
|
+
type: LIST_SELECTION_TOGGLE_ITEMS,
|
|
23
|
+
payload: {
|
|
24
|
+
selected: [id]
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default KeyboardRowSelectController;
|
|
@@ -4,4 +4,6 @@ export { default as ScrollController } from "./ScrollController";
|
|
|
4
4
|
export { default as SortByController } from "./SortByController";
|
|
5
5
|
export { default as SortedController } from "./SortedController";
|
|
6
6
|
export { default as FieldChangeController } from "./FieldChangeController";
|
|
7
|
-
export { default as FieldClickController } from "./FieldClickController";
|
|
7
|
+
export { default as FieldClickController } from "./FieldClickController";
|
|
8
|
+
export { default as KeyboardRowSelectController } from "./KeyboardRowSelectController";
|
|
9
|
+
export { default as KeyboardRowClickController } from "./KeyboardRowClickController";
|
|
@@ -4,10 +4,11 @@ class TableTranslator {
|
|
|
4
4
|
data,
|
|
5
5
|
selectionConfig,
|
|
6
6
|
selection,
|
|
7
|
-
sortBy
|
|
7
|
+
sortBy,
|
|
8
|
+
focussedRow
|
|
8
9
|
} = state.properties;
|
|
9
10
|
const headers = TableTranslator.translateHeaders(data.headers, sortBy);
|
|
10
|
-
const rows = TableTranslator.translateRows(data.rows, selection, selectionConfig);
|
|
11
|
+
const rows = TableTranslator.translateRows(data.rows, selection, selectionConfig, focussedRow);
|
|
11
12
|
state = { ...state,
|
|
12
13
|
properties: { ...state.properties,
|
|
13
14
|
data: { ...data,
|
|
@@ -28,13 +29,14 @@ class TableTranslator {
|
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
static translateRows(rows, selection, selectionConfig) {
|
|
32
|
+
static translateRows(rows, selection, selectionConfig, focussedRow) {
|
|
32
33
|
const {
|
|
33
34
|
selected,
|
|
34
35
|
hasAllSelected
|
|
35
36
|
} = selection;
|
|
36
37
|
return rows.map((row, index) => {
|
|
37
38
|
return { ...row,
|
|
39
|
+
isFocussed: focussedRow === index,
|
|
38
40
|
isSelected: selected.includes(row.id),
|
|
39
41
|
isSelectable: selected.includes(row.id) || !hasAllSelected,
|
|
40
42
|
selectionTooltip: this.getSelectionTooltip(row.id, index, selected, hasAllSelected, selectionConfig)
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { TableListConstants } from "../../../../../../cc/table-list";
|
|
2
|
-
import { SelectItemController, SelectAllController, ScrollController, FieldChangeController, FieldClickController, SortByController } from "../../adapters/controllers";
|
|
2
|
+
import { SelectItemController, SelectAllController, ScrollController, FieldChangeController, FieldClickController, SortByController, KeyboardRowSelectController, KeyboardRowClickController } from "../../adapters/controllers";
|
|
3
3
|
import TableRowConstants from "../../../../../../cc/table-list/row/Constants";
|
|
4
4
|
import RowClickController from "../../adapters/controllers/RowClickController";
|
|
5
|
+
import { SMART_TABLE_ACTION_TRIGGERED, SMART_TABLE_SELECTION_TOGGLED } from "../../../../../../cc/table-connected/constants/Events";
|
|
5
6
|
|
|
6
7
|
class EventHandlersFactory {
|
|
7
8
|
static create() {
|
|
8
9
|
return {
|
|
10
|
+
[SMART_TABLE_SELECTION_TOGGLED]: new KeyboardRowSelectController().handle,
|
|
11
|
+
[SMART_TABLE_ACTION_TRIGGERED]: new KeyboardRowClickController().handle,
|
|
9
12
|
[TableRowConstants.TABLE_ROW_CLICKED]: new RowClickController().handle,
|
|
10
13
|
[TableListConstants.TABLE_LIST_TOGGLE_ITEM_SELECTION]: new SelectItemController().handle,
|
|
11
14
|
[TableListConstants.TABLE_LIST_TOGGLE_ALL_SELECTION]: new SelectAllController().handle,
|
|
@@ -27,6 +27,7 @@ function TableListView(_ref2, _ref) {
|
|
|
27
27
|
isFlexibleColumns,
|
|
28
28
|
rowCursor,
|
|
29
29
|
rowActionsConfig,
|
|
30
|
+
keyboardControlsConfig,
|
|
30
31
|
selection,
|
|
31
32
|
emptyStateUiType,
|
|
32
33
|
isError
|
|
@@ -43,6 +44,7 @@ function TableListView(_ref2, _ref) {
|
|
|
43
44
|
|
|
44
45
|
const isDataEmpty = !hasRows && !isLoading && !isError; // TODO: derive from state.properties
|
|
45
46
|
|
|
47
|
+
const isKeyboardControlsEnabled = keyboardControlsConfig.isEnabled;
|
|
46
48
|
return /*#__PURE__*/React.createElement("div", {
|
|
47
49
|
className: style.wrapper,
|
|
48
50
|
ref: _ref
|
|
@@ -55,6 +57,7 @@ function TableListView(_ref2, _ref) {
|
|
|
55
57
|
resizerState,
|
|
56
58
|
selectionConfig,
|
|
57
59
|
selection,
|
|
60
|
+
isKeyboardControlsEnabled,
|
|
58
61
|
isFlexibleColumns,
|
|
59
62
|
hasRowActions,
|
|
60
63
|
rowActionsColumnWidth,
|
|
@@ -64,6 +67,7 @@ function TableListView(_ref2, _ref) {
|
|
|
64
67
|
rows,
|
|
65
68
|
isFlexibleColumns,
|
|
66
69
|
selectionConfig,
|
|
70
|
+
isKeyboardControlsEnabled,
|
|
67
71
|
rowCursor,
|
|
68
72
|
hasRowActions,
|
|
69
73
|
rowActionsColumnWidth,
|
|
@@ -85,6 +89,7 @@ function renderHeader(_ref3) {
|
|
|
85
89
|
resizerState,
|
|
86
90
|
selectionConfig,
|
|
87
91
|
selection,
|
|
92
|
+
isKeyboardControlsEnabled,
|
|
88
93
|
isFlexibleColumns,
|
|
89
94
|
hasRowActions,
|
|
90
95
|
rowActionsColumnWidth,
|
|
@@ -92,15 +97,15 @@ function renderHeader(_ref3) {
|
|
|
92
97
|
} = _ref3;
|
|
93
98
|
return /*#__PURE__*/React.createElement(Header, {
|
|
94
99
|
isSelectionEnabled: selectionConfig.isEnabled,
|
|
95
|
-
isSelectAllEnabled: selectionConfig.isSelectAllEnabled,
|
|
96
|
-
hasAllSelected: selection.hasAllSelected,
|
|
97
100
|
isResizerEnabled: resizerState.isEnabled,
|
|
101
|
+
isKeyboardControlsEnabled: isKeyboardControlsEnabled,
|
|
98
102
|
currentlyResizingColumn: resizerState.currentlyResizingColumn,
|
|
99
103
|
isCurrentlyResizing: resizerState.isCurrentlyResizing,
|
|
100
104
|
resizerExtraWidth: resizerState.extraWidth,
|
|
101
105
|
isFlexibleColumns: isFlexibleColumns,
|
|
102
106
|
hasRowActions: hasRowActions,
|
|
103
107
|
rowActionsColumnWidth: rowActionsColumnWidth,
|
|
108
|
+
actions: selection.actions,
|
|
104
109
|
headers: headers,
|
|
105
110
|
dispatch: dispatch
|
|
106
111
|
});
|
|
@@ -112,6 +117,7 @@ function renderBody(_ref4) {
|
|
|
112
117
|
rows,
|
|
113
118
|
isFlexibleColumns,
|
|
114
119
|
selectionConfig,
|
|
120
|
+
isKeyboardControlsEnabled,
|
|
115
121
|
rowCursor,
|
|
116
122
|
hasRowActions,
|
|
117
123
|
rowActionsColumnWidth,
|
|
@@ -127,7 +133,8 @@ function renderBody(_ref4) {
|
|
|
127
133
|
isSelectionEnabled: selectionConfig.isEnabled,
|
|
128
134
|
rowCursor: rowCursor,
|
|
129
135
|
hasRowActions: hasRowActions,
|
|
130
|
-
rowActionsColumnWidth: rowActionsColumnWidth
|
|
136
|
+
rowActionsColumnWidth: rowActionsColumnWidth,
|
|
137
|
+
isKeyboardControlsEnabled: isKeyboardControlsEnabled
|
|
131
138
|
}));
|
|
132
139
|
}
|
|
133
140
|
|
|
@@ -8,7 +8,7 @@ const TableHeaderRow = _ref => {
|
|
|
8
8
|
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
import
|
|
11
|
+
import MassAction from "./header/MassAction";
|
|
12
12
|
import Headers from "./header/Headers";
|
|
13
13
|
import ActionColumn from "./header/ActionColumn";
|
|
14
14
|
import ResizerExtraSpace from "./header/ResizerExtraSpace";
|
|
@@ -16,8 +16,8 @@ import ResizerExtraSpace from "./header/ResizerExtraSpace";
|
|
|
16
16
|
function Header(_ref2) {
|
|
17
17
|
let {
|
|
18
18
|
isSelectionEnabled,
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
actions,
|
|
20
|
+
isKeyboardControlsEnabled,
|
|
21
21
|
isResizerEnabled,
|
|
22
22
|
currentlyResizingColumn,
|
|
23
23
|
isCurrentlyResizing,
|
|
@@ -35,16 +35,15 @@ function Header(_ref2) {
|
|
|
35
35
|
|
|
36
36
|
return /*#__PURE__*/React.createElement(TableHeader, {
|
|
37
37
|
$flag_isColumnsFlexible: isFlexibleColumns,
|
|
38
|
-
$flag_padding: !isSelectionEnabled
|
|
39
|
-
|
|
38
|
+
$flag_padding: !isSelectionEnabled,
|
|
39
|
+
$flag_hasHighlighter: isKeyboardControlsEnabled
|
|
40
|
+
}, /*#__PURE__*/React.createElement(TableHeaderRow, null, rendermassAction(isSelectionEnabled, actions), renderHeaders(headers, currentlyResizingColumn, isResizerEnabled, isFlexibleColumns, dispatch), renderActionColumn(hasRowActions, rowActionsColumnWidth), renderResizerExtraSpace(isCurrentlyResizing, resizerExtraWidth)));
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
function
|
|
43
|
-
return /*#__PURE__*/React.createElement(
|
|
43
|
+
function rendermassAction(isSelectionEnabled, actions) {
|
|
44
|
+
return /*#__PURE__*/React.createElement(MassAction, {
|
|
44
45
|
isSelectionEnabled: isSelectionEnabled,
|
|
45
|
-
|
|
46
|
-
hasAllSelected: hasAllSelected,
|
|
47
|
-
dispatch: dispatch
|
|
46
|
+
actions: actions
|
|
48
47
|
});
|
|
49
48
|
}
|
|
50
49
|
|
|
@@ -9,20 +9,22 @@ function Rows(_ref) {
|
|
|
9
9
|
isSelectionEnabled,
|
|
10
10
|
rowCursor,
|
|
11
11
|
hasRowActions,
|
|
12
|
-
rowActionsColumnWidth
|
|
12
|
+
rowActionsColumnWidth,
|
|
13
|
+
isKeyboardControlsEnabled
|
|
13
14
|
} = _ref;
|
|
14
15
|
return rows.map((row, index) => /*#__PURE__*/React.createElement(Row, {
|
|
15
16
|
key: index,
|
|
16
|
-
...getRowProps(row, headers, isFlexibleColumns, isSelectionEnabled, rowCursor, hasRowActions, rowActionsColumnWidth)
|
|
17
|
+
...getRowProps(row, headers, isFlexibleColumns, isSelectionEnabled, rowCursor, hasRowActions, rowActionsColumnWidth, isKeyboardControlsEnabled)
|
|
17
18
|
}));
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
function getRowProps(row, headers, isFlexibleColumns, isSelectionEnabled, rowCursor, hasRowActions, rowActionsColumnWidth) {
|
|
21
|
+
function getRowProps(row, headers, isFlexibleColumns, isSelectionEnabled, rowCursor, hasRowActions, rowActionsColumnWidth, isKeyboardControlsEnabled) {
|
|
21
22
|
const {
|
|
22
23
|
id,
|
|
23
24
|
columns,
|
|
24
25
|
isSelected,
|
|
25
26
|
isSelectable,
|
|
27
|
+
isFocussed,
|
|
26
28
|
selectionTooltip,
|
|
27
29
|
rowActionLocation
|
|
28
30
|
} = row;
|
|
@@ -33,11 +35,13 @@ function getRowProps(row, headers, isFlexibleColumns, isSelectionEnabled, rowCur
|
|
|
33
35
|
rowActionLocation,
|
|
34
36
|
isSelected,
|
|
35
37
|
isSelectable,
|
|
38
|
+
isFocussed,
|
|
36
39
|
selectionTooltip,
|
|
37
40
|
isFlexibleColumns,
|
|
38
41
|
isSelectionEnabled,
|
|
39
42
|
cursor: rowCursor,
|
|
40
43
|
hasActions: hasRowActions,
|
|
44
|
+
isKeyboardControlsEnabled,
|
|
41
45
|
rowActionsColumnWidth
|
|
42
46
|
};
|
|
43
47
|
}
|
package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/HeaderData.js
CHANGED
|
@@ -4,7 +4,9 @@ import TableHeading from '@zohodesk-private/desk-components/es/table/TableHeadin
|
|
|
4
4
|
import { AlignmentOfFlex } from "../../../../../../../../cc/table-list/data-types/Header";
|
|
5
5
|
import ActionEventMediator from "../../../../../../../../platform/client-actions/components/action-event-mediator/frameworks/ui/ActionEventMediator";
|
|
6
6
|
import { ActionViewGap } from "../../../../../../../../platform/client-actions/components/interfaces/ActionViewModel";
|
|
7
|
-
import ColumnResizer from "./ColumnResizer";
|
|
7
|
+
import ColumnResizer from "./ColumnResizer"; // @ts-ignore
|
|
8
|
+
|
|
9
|
+
import style from "./../../css/TableList.module.css";
|
|
8
10
|
|
|
9
11
|
function HeaderData(_ref) {
|
|
10
12
|
let {
|
|
@@ -39,7 +41,10 @@ function HeaderData(_ref) {
|
|
|
39
41
|
$ui_displayMode: 'flex',
|
|
40
42
|
$ui_alignItems: 'center',
|
|
41
43
|
$ui_justifyContent: AlignmentOfFlex[alignment]
|
|
42
|
-
} : null
|
|
44
|
+
} : null,
|
|
45
|
+
customStyle: hasActions ? {
|
|
46
|
+
tableHead: style.headerWithActions
|
|
47
|
+
} : undefined
|
|
43
48
|
}, /*#__PURE__*/React.createElement(TableHeading, {
|
|
44
49
|
$i18n_text: text
|
|
45
50
|
}), hasActions ? /*#__PURE__*/React.createElement(ActionEventMediator, {
|
package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/MassAction.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import TableHeadFirstNode from '@zohodesk-private/desk-components/es/table/TableHeadFirstNode/TableHeadFirstNode';
|
|
3
|
+
import TableHeading from '@zohodesk-private/desk-components/es/table/TableHeading/TableHeading';
|
|
4
|
+
import ActionEventMediator from "../../../../../../../../platform/client-actions/components/action-event-mediator/frameworks/ui/ActionEventMediator";
|
|
5
|
+
|
|
6
|
+
function MassAction(_ref) {
|
|
7
|
+
let {
|
|
8
|
+
isSelectionEnabled,
|
|
9
|
+
actions
|
|
10
|
+
} = _ref;
|
|
11
|
+
|
|
12
|
+
if (!isSelectionEnabled) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (!actions || actions.length === 0) {
|
|
17
|
+
return /*#__PURE__*/React.createElement(TableHeadFirstNode, null, /*#__PURE__*/React.createElement(TableHeading, {
|
|
18
|
+
$i18n_text: "M/A",
|
|
19
|
+
$i18n_tooltip: "Mass Action"
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return /*#__PURE__*/React.createElement(TableHeadFirstNode, null, /*#__PURE__*/React.createElement(ActionEventMediator, {
|
|
24
|
+
actions: actions
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default MassAction;
|
|
@@ -22,6 +22,8 @@ function RowView(_ref, ref) {
|
|
|
22
22
|
isSelectionEnabled,
|
|
23
23
|
isSelected,
|
|
24
24
|
isSelectable,
|
|
25
|
+
isKeyboardControlsEnabled,
|
|
26
|
+
isFocussed,
|
|
25
27
|
selectionTooltip
|
|
26
28
|
} = state.properties;
|
|
27
29
|
const {
|
|
@@ -42,6 +44,9 @@ function RowView(_ref, ref) {
|
|
|
42
44
|
ref: ref,
|
|
43
45
|
testId: id,
|
|
44
46
|
$flag_padding: !isSelectionEnabled,
|
|
47
|
+
$flag_active: isSelected,
|
|
48
|
+
$flag_hasHighlighter: isKeyboardControlsEnabled,
|
|
49
|
+
$flag_isHighlighted: isFocussed,
|
|
45
50
|
$event_onClick: () => dispatch({
|
|
46
51
|
type: TableRowConstants.TABLE_ROW_CLICKED,
|
|
47
52
|
payload: {
|
|
@@ -3,7 +3,9 @@ import TableData from '@zohodesk-private/desk-components/es/table/TableData/Tabl
|
|
|
3
3
|
import ActionEventMediator from "../../../../../../../../platform/client-actions/components/action-event-mediator/frameworks/ui/ActionEventMediator";
|
|
4
4
|
import { ActionViewGap } from "../../../../../../../../platform/client-actions/components/interfaces/ActionViewModel";
|
|
5
5
|
import { AlignmentOfFlex } from "../../../../../../../../cc/table-list/data-types/Header";
|
|
6
|
-
import FieldComponent from "../field/FieldComponent";
|
|
6
|
+
import FieldComponent from "../field/FieldComponent"; // @ts-ignore
|
|
7
|
+
|
|
8
|
+
import style from "./../../css/TableList.module.css";
|
|
7
9
|
export default function RowData(_ref) {
|
|
8
10
|
let {
|
|
9
11
|
field,
|
|
@@ -25,7 +27,10 @@ export default function RowData(_ref) {
|
|
|
25
27
|
$ui_displayMode: 'flex',
|
|
26
28
|
$ui_alignItems: 'center',
|
|
27
29
|
$ui_justifyContent: AlignmentOfFlex[alignment]
|
|
28
|
-
} : null
|
|
30
|
+
} : null,
|
|
31
|
+
customStyle: hasActions ? {
|
|
32
|
+
tableData: style.fieldWithActions
|
|
33
|
+
} : undefined
|
|
29
34
|
}, /*#__PURE__*/React.createElement(FieldComponent, {
|
|
30
35
|
type: type,
|
|
31
36
|
fieldProps: props
|
package/es/library/dot/legacy-to-new-arch/table-column-chooser/frameworks/ui/TableColumnChooser.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createCustomComponent } from "../../../../../custom-component";
|
|
2
|
+
import { TableColumnChooserProperties } from "../../../../../../cc/table-column-chooser";
|
|
3
|
+
import TableColumnChooserView from "./TableColumnChooserView";
|
|
4
|
+
const TableColumnChooser = createCustomComponent({
|
|
5
|
+
name: 'TableColumnChooser',
|
|
6
|
+
View: TableColumnChooserView,
|
|
7
|
+
properties: TableColumnChooserProperties,
|
|
8
|
+
events: [],
|
|
9
|
+
eventHandlers: {}
|
|
10
|
+
});
|
|
11
|
+
export default TableColumnChooser;
|