@zohodesk/library-platform 1.0.2-exp.1.1 → 1.0.2-exp.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/zlist/Constants.js +1 -0
- package/es/cc/action-icon/Properties.js +6 -46
- package/es/cc/component/properties/slotName.js +1 -0
- package/es/cc/fields/coloured-multi-select/Events.js +3 -0
- package/es/cc/fields/coloured-multi-select/Model.js +18 -0
- package/es/cc/fields/coloured-multi-select/Properties.js +37 -0
- package/es/cc/fields/coloured-pick-list/Events.js +3 -0
- package/es/cc/fields/coloured-pick-list/Model.js +16 -0
- package/es/cc/fields/coloured-pick-list/Properties.js +37 -0
- package/es/cc/fields/field/Types.js +2 -0
- package/es/cc/fields/index.js +2 -0
- package/es/cc/fields/multi-select/Model.js +2 -0
- package/es/cc/fields/multi-select/Properties.js +2 -4
- package/es/cc/fields/pick-list/Model.js +1 -3
- package/es/cc/fields/pick-list/Properties.js +1 -3
- package/es/cc/table-column-sort/Constants.js +1 -0
- package/es/cc/table-column-sort/Properties.js +30 -0
- package/es/cc/table-column-sort/index.js +3 -0
- package/es/cc/table-connected/constants/Events.js +2 -0
- package/es/cc/table-list/Properties.js +38 -27
- package/es/desk-frameworks/table-connected/frameworks/EventHandlersFactory.js +17 -6
- package/es/desk-frameworks/table-connected/frameworks/TableConnectedView.js +2 -0
- package/es/library/behaviours/table-column-resizer/domain/entities/Constants.js +1 -1
- package/es/library/custom-component/domain/entities/DefaultSlotNameAppend.js +10 -0
- package/es/library/custom-component/domain/entities/Properties.js +2 -0
- package/es/library/custom-component/frameworks/ui/CreateCustomComponent.js +15 -6
- package/es/library/custom-component/frameworks/ui/CreateSlotComponent.js +77 -22
- package/es/library/custom-component/frameworks/ui/__testcases__/CreateSlotComponent.spec.js +211 -0
- package/es/library/dot/components/action-location/frameworks/ui/ActionComponentMapping.js +4 -4
- package/es/library/dot/components/table-list/adapters/presenters/TableTranslator.js +4 -9
- package/es/library/dot/components/table-list/frameworks/ui/EventHandlersFactory.js +1 -3
- package/es/library/dot/components/table-list/frameworks/ui/TableList.js +1 -2
- package/es/library/dot/components/table-list/frameworks/ui/TableListView.js +6 -2
- 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/ErrorState.js +28 -0
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/HeaderData.js +3 -10
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/Headers.js +1 -3
- package/es/library/dot/legacy-to-new-arch/action-icon/frameworks/ui/ActionIcon.js +4 -20
- package/es/library/dot/legacy-to-new-arch/action-icon/frameworks/ui/ActionIconView.js +4 -84
- package/es/library/dot/legacy-to-new-arch/table-column-sort/frameworks/ui/TableColumnSort.js +11 -0
- package/es/library/dot/legacy-to-new-arch/table-column-sort/frameworks/ui/TableColumnSortView.js +44 -0
- package/es/library/dot/legacy-to-new-arch/table-column-sort/frameworks/ui/css/TableColumnSort.module.css +10 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/coloured-multiselect-field/frameworks/ui/ColouredMultiSelectField.js +12 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/coloured-multiselect-field/frameworks/ui/ColouredMultiSelectFieldView.js +23 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/coloured-picklist-field/frameworks/ui/ColouredPickListField.js +14 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/coloured-picklist-field/frameworks/ui/ColouredPickListFieldView.js +33 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/index.js +4 -0
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActionsRenderer.module.css +2 -2
- package/es/platform/data-source/http-template/getAvailableFields.js +62 -0
- package/es/platform/zdata-source/domain/entities/APITemplate.js +3 -2
- package/es/platform/zhttp/applications/usecases/FetchUseCase.js +1 -1
- package/es/platform/zlist/adapters/controllers/RecordSuccessCallbackController.js +28 -0
- package/es/platform/zlist/adapters/controllers/SortController.js +1 -3
- package/es/platform/zlist/adapters/gateways/Repository.js +12 -2
- package/es/platform/zlist/adapters/gateways/Service.js +4 -0
- package/es/platform/zlist/adapters/presenters/Presenters.js +26 -0
- package/es/platform/zlist/adapters/presenters/TableTranslator.js +11 -2
- package/es/platform/zlist/adapters/presenters/translators/Header.js +28 -3
- package/es/platform/zlist/adapters/presenters/translators/HeadersTranslator.js +3 -2
- package/es/platform/zlist/adapters/presenters/translators/fields/MultiSelectFieldTranslator.js +28 -8
- package/es/platform/zlist/adapters/presenters/translators/fields/PickListFieldTranslator.js +28 -2
- package/es/platform/zlist/adapters/presenters/utils/DefaultClientActions.js +54 -0
- package/es/platform/zlist/applications/interfaces/output/IPresenter.js +1 -0
- package/es/platform/zlist/applications/usecases/AbstractUseCase.js +4 -2
- package/es/platform/zlist/applications/usecases/RecordSuccessCallbackUsecase.js +24 -0
- package/es/platform/zlist/applications/usecases/SortUseCase.js +9 -3
- package/es/platform/zlist/domain/entities/List.js +32 -8
- package/es/platform/zlist/domain/entities/SortBy.js +58 -0
- package/es/platform/zlist/domain/entities/interfaces/ISortBy.js +1 -0
- package/es/platform/zlist/domain/entities/interfaces/ListModel.js +1 -0
- package/es/platform/zlist/domain/entities/interfaces/Properties.js +6 -1
- package/es/platform/zlist/frameworks/EventHandlersFactory.js +9 -4
- package/es/platform/zlist/frameworks/ZListBehaviourFactory.js +7 -1
- package/es/platform/zrecord/adapters/controllers/ActionExecutorController.js +2 -1
- package/es/platform/zrecord/adapters/controllers/RefetchController.js +2 -1
- package/es/platform/zrecord/applications/usecases/ExecuteActionUseCase.js +3 -2
- package/es/platform/zrecord/applications/usecases/RefetchUseCase.js +3 -2
- package/es/platform/zrecord/domain/entities/RecordsManager.js +4 -3
- package/package.json +11 -11
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/HeaderText.js +0 -34
- package/es/library/dot/legacy-to-new-arch/action-icon/frameworks/ui/css/ActionIcon.module.css +0 -3
|
@@ -1,26 +1,81 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { Children } from "react";
|
|
2
2
|
import ComponentRegistry from "./ComponentRegistry";
|
|
3
|
-
export
|
|
4
|
-
let
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
slots: slots
|
|
20
|
-
});
|
|
3
|
+
export function generateSlotChildren() {
|
|
4
|
+
let slots = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
5
|
+
let children = arguments.length > 1 ? arguments[1] : undefined;
|
|
6
|
+
let slotChildren = {},
|
|
7
|
+
slotChildrenMap = {};
|
|
8
|
+
Children.forEach(children, child => {
|
|
9
|
+
if (typeof child.type === "function" && child.props && child.props.slotName) {
|
|
10
|
+
const {
|
|
11
|
+
slotName
|
|
12
|
+
} = child.props;
|
|
13
|
+
const displayName = child.type.displayName;
|
|
14
|
+
slotChildrenMap[slotName] = slotChildrenMap[slotName] || {};
|
|
15
|
+
slotChildrenMap[slotName][displayName] = {
|
|
16
|
+
props: child.props,
|
|
17
|
+
type: child.type
|
|
18
|
+
};
|
|
21
19
|
}
|
|
20
|
+
});
|
|
21
|
+
slots.map(slot => {
|
|
22
|
+
const {
|
|
23
|
+
name,
|
|
24
|
+
elements
|
|
25
|
+
} = slot;
|
|
26
|
+
slotChildren[name] = [];
|
|
27
|
+
elements.map((element, index) => {
|
|
28
|
+
const {
|
|
29
|
+
type,
|
|
30
|
+
name: elementName,
|
|
31
|
+
styles,
|
|
32
|
+
slots,
|
|
33
|
+
properties = {}
|
|
34
|
+
} = element;
|
|
35
|
+
const {
|
|
36
|
+
props: childProps = {},
|
|
37
|
+
type: ChildType
|
|
38
|
+
} = (slotChildrenMap[name] || {})[`Custom(${elementName})`] || {};
|
|
39
|
+
let View = ComponentRegistry.get(type) || ChildType;
|
|
40
|
+
let finalisedProps = { ...properties,
|
|
41
|
+
...childProps
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
if (styles) {
|
|
45
|
+
finalisedProps.styles = styles;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (slots) {
|
|
49
|
+
finalisedProps.slots = slots;
|
|
50
|
+
}
|
|
22
51
|
|
|
23
|
-
|
|
52
|
+
if (View) {
|
|
53
|
+
slotChildren[name].push( /*#__PURE__*/React.createElement(View, { ...finalisedProps,
|
|
54
|
+
key: `${name}_${elementName}_${index}`
|
|
55
|
+
}, childProps.children));
|
|
56
|
+
}
|
|
57
|
+
});
|
|
24
58
|
});
|
|
25
|
-
return
|
|
26
|
-
}
|
|
59
|
+
return slotChildren;
|
|
60
|
+
}
|
|
61
|
+
/*export default function createSlotComponent(slotShape: Slot, children: any): any {
|
|
62
|
+
let {elements} = slotShape;
|
|
63
|
+
let finalElements = elements.map((element) => {
|
|
64
|
+
let {
|
|
65
|
+
type,
|
|
66
|
+
styles = {},
|
|
67
|
+
slots = [],
|
|
68
|
+
properties={}
|
|
69
|
+
} = element;
|
|
70
|
+
let View = ComponentRegistry.get(type);
|
|
71
|
+
if(View) {
|
|
72
|
+
return (<View
|
|
73
|
+
{...properties}
|
|
74
|
+
styles={styles}
|
|
75
|
+
slots={slots}
|
|
76
|
+
/>)
|
|
77
|
+
}
|
|
78
|
+
return null
|
|
79
|
+
});
|
|
80
|
+
return finalElements
|
|
81
|
+
}*/
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
import React, { Component } from "react";
|
|
3
|
+
import createCustomComponent from "../CreateCustomComponent.tsx";
|
|
4
|
+
import ComponentRegistry from "../ComponentRegistry";
|
|
5
|
+
import { render, cleanup } from '@testing-library/react';
|
|
6
|
+
import '@testing-library/jest-dom';
|
|
7
|
+
const Parent = createCustomComponent({
|
|
8
|
+
name: "parent",
|
|
9
|
+
View: (_ref, ref) => {
|
|
10
|
+
let {
|
|
11
|
+
slotChildren
|
|
12
|
+
} = _ref;
|
|
13
|
+
const {
|
|
14
|
+
child = null,
|
|
15
|
+
siblingChild = null
|
|
16
|
+
} = slotChildren;
|
|
17
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
18
|
+
ref: ref
|
|
19
|
+
}, "Hi, I am the Parent.", /*#__PURE__*/React.createElement("div", null, child), /*#__PURE__*/React.createElement("div", null, siblingChild));
|
|
20
|
+
},
|
|
21
|
+
properties: {
|
|
22
|
+
slots: {
|
|
23
|
+
required: false,
|
|
24
|
+
typeMetadata: {
|
|
25
|
+
schema: {
|
|
26
|
+
type: "array"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
eventHandlers: {}
|
|
32
|
+
});
|
|
33
|
+
const Child = createCustomComponent({
|
|
34
|
+
name: "child",
|
|
35
|
+
View: (_ref2, ref) => {
|
|
36
|
+
let {
|
|
37
|
+
slotChildren
|
|
38
|
+
} = _ref2;
|
|
39
|
+
const {
|
|
40
|
+
nestedChildren = null
|
|
41
|
+
} = slotChildren;
|
|
42
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
ref: ref
|
|
44
|
+
}, "Hi, I am the Child.", /*#__PURE__*/React.createElement("div", null, nestedChildren));
|
|
45
|
+
},
|
|
46
|
+
eventHandlers: {},
|
|
47
|
+
properties: {
|
|
48
|
+
slots: {
|
|
49
|
+
required: false,
|
|
50
|
+
typeMetadata: {
|
|
51
|
+
schema: {
|
|
52
|
+
type: "array"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const SiblingChild = createCustomComponent({
|
|
59
|
+
name: "siblingChild",
|
|
60
|
+
View: (props, ref) => {
|
|
61
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
62
|
+
ref: ref
|
|
63
|
+
}, "Hi, I am the sibling Child.");
|
|
64
|
+
},
|
|
65
|
+
eventHandlers: {},
|
|
66
|
+
properties: {}
|
|
67
|
+
});
|
|
68
|
+
const NestedChild = createCustomComponent({
|
|
69
|
+
name: "nestedChild",
|
|
70
|
+
View: (_, ref) => {
|
|
71
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
72
|
+
ref: ref
|
|
73
|
+
}, "Hi, I am the nested Child.");
|
|
74
|
+
},
|
|
75
|
+
eventHandlers: {},
|
|
76
|
+
properties: {}
|
|
77
|
+
});
|
|
78
|
+
const NoSlotName = createCustomComponent({
|
|
79
|
+
name: "noSlotName",
|
|
80
|
+
View: (_, ref) => {
|
|
81
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
82
|
+
ref: ref
|
|
83
|
+
}, "Hi, It should not be rendered.");
|
|
84
|
+
},
|
|
85
|
+
eventHandlers: {},
|
|
86
|
+
properties: {}
|
|
87
|
+
});
|
|
88
|
+
ComponentRegistry.register("Parent", Parent);
|
|
89
|
+
ComponentRegistry.register("Child", Child);
|
|
90
|
+
ComponentRegistry.register("SiblingChild", SiblingChild);
|
|
91
|
+
describe("Slot Integration test suite", () => {
|
|
92
|
+
beforeEach(() => {
|
|
93
|
+
jest.clearAllMocks();
|
|
94
|
+
cleanup();
|
|
95
|
+
});
|
|
96
|
+
it("slot Information passed to parent and check children rendering", () => {
|
|
97
|
+
const slots = [{
|
|
98
|
+
name: "child",
|
|
99
|
+
elements: [{
|
|
100
|
+
name: "child",
|
|
101
|
+
type: "Child"
|
|
102
|
+
}]
|
|
103
|
+
}];
|
|
104
|
+
const {
|
|
105
|
+
getByText
|
|
106
|
+
} = render( /*#__PURE__*/React.createElement(Parent, {
|
|
107
|
+
slots: slots
|
|
108
|
+
}, /*#__PURE__*/React.createElement(Child, {
|
|
109
|
+
slotName: "child"
|
|
110
|
+
})));
|
|
111
|
+
const component = getByText("Hi, I am the Child.");
|
|
112
|
+
expect(component).toBeInTheDocument();
|
|
113
|
+
});
|
|
114
|
+
it("slots with nested child and check nested child rendering", () => {
|
|
115
|
+
const slots = [{
|
|
116
|
+
name: "child",
|
|
117
|
+
elements: [{
|
|
118
|
+
name: "child",
|
|
119
|
+
type: "Child",
|
|
120
|
+
slots: [{
|
|
121
|
+
name: "nestedChildren",
|
|
122
|
+
elements: [{
|
|
123
|
+
name: "nestedChild",
|
|
124
|
+
type: "NestedChild"
|
|
125
|
+
}]
|
|
126
|
+
}]
|
|
127
|
+
}]
|
|
128
|
+
}];
|
|
129
|
+
const {
|
|
130
|
+
getByText
|
|
131
|
+
} = render( /*#__PURE__*/React.createElement(Parent, {
|
|
132
|
+
slots: slots
|
|
133
|
+
}, /*#__PURE__*/React.createElement(Child, {
|
|
134
|
+
slotName: "child"
|
|
135
|
+
}, /*#__PURE__*/React.createElement(NestedChild, {
|
|
136
|
+
slotName: "nestedChildren"
|
|
137
|
+
}))));
|
|
138
|
+
const component = getByText("Hi, I am the nested Child.");
|
|
139
|
+
expect(component).toBeInTheDocument();
|
|
140
|
+
});
|
|
141
|
+
it("slots with sibling child and check sibling child rendering", () => {
|
|
142
|
+
const slots = [{
|
|
143
|
+
name: "child",
|
|
144
|
+
elements: [{
|
|
145
|
+
name: "child",
|
|
146
|
+
type: "Child",
|
|
147
|
+
slots: [{
|
|
148
|
+
name: "nestedChildren",
|
|
149
|
+
elements: [{
|
|
150
|
+
name: "nestedChild",
|
|
151
|
+
type: "NestedChild"
|
|
152
|
+
}]
|
|
153
|
+
}]
|
|
154
|
+
}]
|
|
155
|
+
}, {
|
|
156
|
+
name: "siblingChild",
|
|
157
|
+
elements: [{
|
|
158
|
+
name: "siblingChild",
|
|
159
|
+
type: "SiblingChild"
|
|
160
|
+
}]
|
|
161
|
+
}];
|
|
162
|
+
const {
|
|
163
|
+
getByText
|
|
164
|
+
} = render( /*#__PURE__*/React.createElement(Parent, {
|
|
165
|
+
slots: slots
|
|
166
|
+
}, /*#__PURE__*/React.createElement(Child, {
|
|
167
|
+
slotName: "child"
|
|
168
|
+
}, /*#__PURE__*/React.createElement(NestedChild, {
|
|
169
|
+
slotName: "nestedChildren"
|
|
170
|
+
})), /*#__PURE__*/React.createElement(SiblingChild, null)));
|
|
171
|
+
const component = getByText("Hi, I am the sibling Child.");
|
|
172
|
+
expect(component).toBeInTheDocument();
|
|
173
|
+
});
|
|
174
|
+
it("children with no slot support should not be rendered", () => {
|
|
175
|
+
const slots = [{
|
|
176
|
+
name: "child",
|
|
177
|
+
elements: [{
|
|
178
|
+
name: "child",
|
|
179
|
+
type: "Child",
|
|
180
|
+
slots: [{
|
|
181
|
+
name: "nestedChildren",
|
|
182
|
+
elements: [{
|
|
183
|
+
name: "nestedChild",
|
|
184
|
+
type: "NestedChild"
|
|
185
|
+
}]
|
|
186
|
+
}]
|
|
187
|
+
}]
|
|
188
|
+
}, {
|
|
189
|
+
name: "siblingChild",
|
|
190
|
+
elements: [{
|
|
191
|
+
name: "siblingChild",
|
|
192
|
+
type: "SiblingChild"
|
|
193
|
+
}]
|
|
194
|
+
}];
|
|
195
|
+
const {
|
|
196
|
+
queryByText
|
|
197
|
+
} = render( /*#__PURE__*/React.createElement(Parent, {
|
|
198
|
+
slots: slots
|
|
199
|
+
}, /*#__PURE__*/React.createElement(Child, {
|
|
200
|
+
slotName: "child"
|
|
201
|
+
}, /*#__PURE__*/React.createElement(NestedChild, {
|
|
202
|
+
slotName: "nestedChildren"
|
|
203
|
+
})), /*#__PURE__*/React.createElement(SiblingChild, {
|
|
204
|
+
slotName: "siblingChild"
|
|
205
|
+
}), /*#__PURE__*/React.createElement(NoSlotName, {
|
|
206
|
+
slotName: "noslotname"
|
|
207
|
+
})));
|
|
208
|
+
const component = queryByText("Hi, It should not be rendered.");
|
|
209
|
+
expect(component).toBeNull();
|
|
210
|
+
});
|
|
211
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import ActionIcon
|
|
1
|
+
import ActionIcon from "../../../../legacy-to-new-arch/action-icon/frameworks/ui/ActionIcon";
|
|
2
|
+
import TableColumnSort from "../../../../legacy-to-new-arch/table-column-sort/frameworks/ui/TableColumnSort";
|
|
2
3
|
const ActionComponentMapping = {
|
|
3
|
-
'ActionIcon': ActionIcon,
|
|
4
|
-
'
|
|
5
|
-
'TableFilterDropdown': FilterDropdown
|
|
4
|
+
['ActionIcon']: ActionIcon,
|
|
5
|
+
['TableColumnSort']: TableColumnSort
|
|
6
6
|
};
|
|
7
7
|
export default ActionComponentMapping;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
class TableTranslator {
|
|
2
2
|
static translate(state) {
|
|
3
|
-
var _state;
|
|
4
|
-
|
|
5
3
|
const {
|
|
6
4
|
data,
|
|
7
5
|
selectionConfig,
|
|
8
|
-
selection
|
|
9
|
-
} = state.properties;
|
|
10
|
-
const {
|
|
6
|
+
selection,
|
|
11
7
|
sortBy
|
|
12
|
-
} =
|
|
8
|
+
} = state.properties;
|
|
13
9
|
const headers = TableTranslator.translateHeaders(data.headers, sortBy);
|
|
14
10
|
const rows = TableTranslator.translateRows(data.rows, selection, selectionConfig);
|
|
15
11
|
state = { ...state,
|
|
@@ -25,10 +21,9 @@ class TableTranslator {
|
|
|
25
21
|
|
|
26
22
|
static translateHeaders(headers, sortBy) {
|
|
27
23
|
return headers.map(header => {
|
|
28
|
-
const sortOrder = (sortBy === null || sortBy === void 0 ? void 0 : sortBy.
|
|
24
|
+
const sortOrder = (sortBy === null || sortBy === void 0 ? void 0 : sortBy.name) === header.name ? sortBy === null || sortBy === void 0 ? void 0 : sortBy.order : 'none';
|
|
29
25
|
return { ...header,
|
|
30
|
-
sortOrder
|
|
31
|
-
sortTooltip: sortOrder === 'none' ? '' : sortOrder === 'ascending' ? 'Click to Sort Descending' : 'Click to Sort Ascending'
|
|
26
|
+
sortOrder
|
|
32
27
|
};
|
|
33
28
|
});
|
|
34
29
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { TableListConstants } from "../../../../../../cc/table-list";
|
|
2
|
-
import { SelectItemController, SelectAllController, ScrollController, FieldChangeController, FieldClickController, SortByController
|
|
2
|
+
import { SelectItemController, SelectAllController, ScrollController, FieldChangeController, FieldClickController, SortByController } from "../../adapters/controllers";
|
|
3
3
|
import TableRowConstants from "../../../../../../cc/table-list/row/Constants";
|
|
4
|
-
import { SORTBY_SORTED } from "../../../../../../bc/sort-by/Constants";
|
|
5
4
|
import RowClickController from "../../adapters/controllers/RowClickController";
|
|
6
5
|
|
|
7
6
|
class EventHandlersFactory {
|
|
@@ -12,7 +11,6 @@ class EventHandlersFactory {
|
|
|
12
11
|
[TableListConstants.TABLE_LIST_TOGGLE_ALL_SELECTION]: new SelectAllController().handle,
|
|
13
12
|
[TableListConstants.TABLE_LIST_SCROLLED]: new ScrollController().handle,
|
|
14
13
|
[TableListConstants.TABLE_LIST_SORTED]: new SortByController().handle,
|
|
15
|
-
[SORTBY_SORTED]: new SortedController().handle,
|
|
16
14
|
[TableRowConstants.TABLE_ROW_FIELD_CHANGED]: new FieldChangeController().handle,
|
|
17
15
|
[TableRowConstants.TABLE_ROW_FIELD_CLICKED]: new FieldClickController().handle
|
|
18
16
|
};
|
|
@@ -3,7 +3,6 @@ import { createCustomComponent } from "../../../../../custom-component";
|
|
|
3
3
|
import TableTranslator from "../../adapters/presenters/TableTranslator";
|
|
4
4
|
import TableListView from "./TableListView";
|
|
5
5
|
import EventHandlersFactory from "./EventHandlersFactory";
|
|
6
|
-
import SortByBehaviourFactory from "../../../../../behaviours/sort-by/frameworks/ui/SortByBehaviourFactory";
|
|
7
6
|
const TableList = createCustomComponent({
|
|
8
7
|
name: 'TableList',
|
|
9
8
|
View: TableListView,
|
|
@@ -11,6 +10,6 @@ const TableList = createCustomComponent({
|
|
|
11
10
|
setInitialState: () => ({}),
|
|
12
11
|
transformState: TableTranslator.translate,
|
|
13
12
|
eventHandlers: EventHandlersFactory.create(),
|
|
14
|
-
behaviours: [
|
|
13
|
+
behaviours: []
|
|
15
14
|
});
|
|
16
15
|
export default TableList;
|
|
@@ -4,6 +4,7 @@ import Header from "./sub-components/Header";
|
|
|
4
4
|
import Body from "./sub-components/Body";
|
|
5
5
|
import Rows from "./sub-components/Rows";
|
|
6
6
|
import NoData from "./sub-components/NoData";
|
|
7
|
+
import ErrorState from "./sub-components/ErrorState";
|
|
7
8
|
import Loading from "./sub-components/Loading";
|
|
8
9
|
import ColumnResizingLine from "./sub-components/ColumnResizingLine";
|
|
9
10
|
import handleScroll from "./handlers/HandleScroll"; // @ts-ignore
|
|
@@ -27,7 +28,8 @@ function TableListView(_ref2, _ref) {
|
|
|
27
28
|
rowCursor,
|
|
28
29
|
rowActionsConfig,
|
|
29
30
|
selection,
|
|
30
|
-
emptyStateUiType
|
|
31
|
+
emptyStateUiType,
|
|
32
|
+
isError
|
|
31
33
|
} = state.properties;
|
|
32
34
|
const {
|
|
33
35
|
headers,
|
|
@@ -39,7 +41,7 @@ function TableListView(_ref2, _ref) {
|
|
|
39
41
|
} = rowActionsConfig;
|
|
40
42
|
const hasRows = rows.length > 0; // TODO: derive from state.properties
|
|
41
43
|
|
|
42
|
-
const isDataEmpty = !hasRows && !isLoading; // TODO: derive from state.properties
|
|
44
|
+
const isDataEmpty = !hasRows && !isLoading && !isError; // TODO: derive from state.properties
|
|
43
45
|
|
|
44
46
|
return /*#__PURE__*/React.createElement("div", {
|
|
45
47
|
className: style.wrapper,
|
|
@@ -69,6 +71,8 @@ function TableListView(_ref2, _ref) {
|
|
|
69
71
|
}), /*#__PURE__*/React.createElement(NoData, {
|
|
70
72
|
isDataEmpty: isDataEmpty,
|
|
71
73
|
emptyStateUiType: emptyStateUiType
|
|
74
|
+
}), /*#__PURE__*/React.createElement(ErrorState, {
|
|
75
|
+
isError: isError
|
|
72
76
|
}), /*#__PURE__*/React.createElement(Loading, {
|
|
73
77
|
isLoading: isLoading,
|
|
74
78
|
hasRows: hasRows
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Flex from '@zohodesk/layout/es/Flex/Flex';
|
|
3
|
+
import ErrorOopsSomethingMiss from '@zohodesk/dot/lib/version2/errorstate/OopsSomethingMiss/OopsSomethingMiss'; // import RequestUrlNotFound from '@zohodesk/dot/lib/version2/errorstate/UrlNotFound/UrlNotFound';
|
|
4
|
+
// import UnableToProcess from '@zohodesk/dot/lib/version2/errorstate/UnableToProcessRequest/UnableToProcessRequest';
|
|
5
|
+
// import Inconvenience from '@zohodesk/dot/lib/version2/errorstate/Inconvenience/Inconvenience';
|
|
6
|
+
|
|
7
|
+
/* @ts-ignore */
|
|
8
|
+
|
|
9
|
+
import style from "../css/TableList.module.css";
|
|
10
|
+
export default function ErrorState(_ref) {
|
|
11
|
+
let {
|
|
12
|
+
isError
|
|
13
|
+
} = _ref;
|
|
14
|
+
|
|
15
|
+
if (isError) {
|
|
16
|
+
return /*#__PURE__*/React.createElement(Flex, {
|
|
17
|
+
$ui_displayMode: "flex",
|
|
18
|
+
$ui_alignItems: "center",
|
|
19
|
+
$ui_justifyContent: "center",
|
|
20
|
+
$ui_className: `${style.contentWrapper} ${style.errorContent}`
|
|
21
|
+
}, /*#__PURE__*/React.createElement(ErrorOopsSomethingMiss, {
|
|
22
|
+
title: "Oops! Something is missing",
|
|
23
|
+
description: "We are unable to process your request. Please try again later."
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return null;
|
|
28
|
+
}
|
package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/HeaderData.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import TableHead from '@zohodesk-private/desk-components/es/table/TableHead/TableHead';
|
|
3
|
+
import TableHeading from '@zohodesk-private/desk-components/es/table/TableHeading/TableHeading';
|
|
3
4
|
import { AlignmentOfFlex } from "../../../../../../../../cc/table-list/data-types/Header";
|
|
4
5
|
import ActionEventMediator from "../../../../../../../../platform/client-actions/components/action-event-mediator/frameworks/ui/ActionEventMediator";
|
|
5
6
|
import { ActionViewGap } from "../../../../../../../../platform/client-actions/components/interfaces/ActionViewModel";
|
|
6
|
-
import HeaderText from "./HeaderText";
|
|
7
7
|
import ColumnResizer from "./ColumnResizer";
|
|
8
8
|
|
|
9
9
|
function HeaderData(_ref) {
|
|
10
10
|
let {
|
|
11
11
|
header,
|
|
12
12
|
sortedBy,
|
|
13
|
-
sortTooltip,
|
|
14
13
|
isResizing,
|
|
15
14
|
isResizerEnabled,
|
|
16
15
|
isFlexibleColumns,
|
|
@@ -41,14 +40,8 @@ function HeaderData(_ref) {
|
|
|
41
40
|
$ui_alignItems: 'center',
|
|
42
41
|
$ui_justifyContent: AlignmentOfFlex[alignment]
|
|
43
42
|
} : null
|
|
44
|
-
}, /*#__PURE__*/React.createElement(
|
|
45
|
-
|
|
46
|
-
name: name,
|
|
47
|
-
text: text,
|
|
48
|
-
sortable: sortable,
|
|
49
|
-
sortedBy: sortedBy,
|
|
50
|
-
sortTooltip: sortTooltip,
|
|
51
|
-
dispatch: dispatch
|
|
43
|
+
}, /*#__PURE__*/React.createElement(TableHeading, {
|
|
44
|
+
$i18n_text: text
|
|
52
45
|
}), hasActions ? /*#__PURE__*/React.createElement(ActionEventMediator, {
|
|
53
46
|
actions: actions,
|
|
54
47
|
gap: ActionViewGap.SMALL
|
|
@@ -11,8 +11,7 @@ function Headers(_ref) {
|
|
|
11
11
|
} = _ref;
|
|
12
12
|
return headers.map((header, index) => {
|
|
13
13
|
const {
|
|
14
|
-
sortOrder
|
|
15
|
-
sortTooltip
|
|
14
|
+
sortOrder
|
|
16
15
|
} = header;
|
|
17
16
|
let isResizing = currentlyResizingColumn === header.id; // TODO: To be adopted with properties
|
|
18
17
|
|
|
@@ -20,7 +19,6 @@ function Headers(_ref) {
|
|
|
20
19
|
key: index,
|
|
21
20
|
header: header,
|
|
22
21
|
sortedBy: sortOrder,
|
|
23
|
-
sortTooltip: sortTooltip,
|
|
24
22
|
isResizing: isResizing,
|
|
25
23
|
isResizerEnabled: isResizerEnabled,
|
|
26
24
|
isFlexibleColumns: isFlexibleColumns,
|
|
@@ -1,27 +1,11 @@
|
|
|
1
1
|
import { createCustomComponent } from "../../../../../custom-component";
|
|
2
|
-
import
|
|
3
|
-
import ActionIconView
|
|
2
|
+
import { ActionIconProperties } from "../../../../../../cc/action-icon";
|
|
3
|
+
import ActionIconView from "./ActionIconView";
|
|
4
4
|
const ActionIcon = createCustomComponent({
|
|
5
5
|
name: 'ActionIcon',
|
|
6
6
|
View: ActionIconView,
|
|
7
|
-
properties:
|
|
7
|
+
properties: ActionIconProperties,
|
|
8
8
|
events: [],
|
|
9
9
|
eventHandlers: {}
|
|
10
10
|
});
|
|
11
|
-
export default ActionIcon;
|
|
12
|
-
|
|
13
|
-
export const Button = createCustomComponent({
|
|
14
|
-
name: 'Button',
|
|
15
|
-
View: ButtonView,
|
|
16
|
-
properties: Properties,
|
|
17
|
-
events: [],
|
|
18
|
-
eventHandlers: {}
|
|
19
|
-
}); // NOTE: This is a sample of FilterDropdown action component
|
|
20
|
-
|
|
21
|
-
export const FilterDropdown = createCustomComponent({
|
|
22
|
-
name: 'FilterDropdown',
|
|
23
|
-
View: FilterDropdownView,
|
|
24
|
-
properties: Properties,
|
|
25
|
-
events: [],
|
|
26
|
-
eventHandlers: {}
|
|
27
|
-
});
|
|
11
|
+
export default ActionIcon;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ActionIcon from '@zohodesk-private/desk-components/es/ActionIcon/ActionIcon';
|
|
3
|
-
import Constants from "../../../../../../cc/action-icon/Constants";
|
|
4
|
-
|
|
5
|
-
import style from "./css/ActionIcon.module.css";
|
|
3
|
+
import Constants from "../../../../../../cc/action-icon/Constants";
|
|
6
4
|
export default function ActionIconView(_ref, ref) {
|
|
7
5
|
let {
|
|
8
6
|
state,
|
|
@@ -12,16 +10,13 @@ export default function ActionIconView(_ref, ref) {
|
|
|
12
10
|
icon,
|
|
13
11
|
label,
|
|
14
12
|
hoverVariant,
|
|
15
|
-
isDisabled
|
|
16
|
-
isVisible
|
|
13
|
+
isDisabled
|
|
17
14
|
} = state.properties;
|
|
18
15
|
const {
|
|
19
16
|
dispatch
|
|
20
17
|
} = helpers;
|
|
21
|
-
return /*#__PURE__*/React.createElement(
|
|
18
|
+
return /*#__PURE__*/React.createElement(ActionIcon, {
|
|
22
19
|
ref: ref,
|
|
23
|
-
className: isVisible ? '' : style.hide
|
|
24
|
-
}, /*#__PURE__*/React.createElement(ActionIcon, {
|
|
25
20
|
$ui_iconName: icon,
|
|
26
21
|
$ui_hoverVariant: hoverVariant,
|
|
27
22
|
$flag_disabled: isDisabled,
|
|
@@ -31,80 +26,5 @@ export default function ActionIconView(_ref, ref) {
|
|
|
31
26
|
type: Constants.ACTION_ICON_CLICKED
|
|
32
27
|
});
|
|
33
28
|
} : null
|
|
34
|
-
})
|
|
35
|
-
} // NOTE: This is a sample of Button action component
|
|
36
|
-
|
|
37
|
-
export function ButtonView(_ref2, ref) {
|
|
38
|
-
let {
|
|
39
|
-
state,
|
|
40
|
-
helpers
|
|
41
|
-
} = _ref2;
|
|
42
|
-
const {
|
|
43
|
-
dispatch
|
|
44
|
-
} = helpers;
|
|
45
|
-
const {
|
|
46
|
-
sourceEvent,
|
|
47
|
-
payload
|
|
48
|
-
} = state.properties.appendToActionPayload.eventMappings[0];
|
|
49
|
-
const {
|
|
50
|
-
value
|
|
51
|
-
} = payload;
|
|
52
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
53
|
-
"data-title": value,
|
|
54
|
-
onClick: () => dispatch({
|
|
55
|
-
type: sourceEvent
|
|
56
|
-
}),
|
|
57
|
-
ref: ref
|
|
58
|
-
}, value);
|
|
59
|
-
return /*#__PURE__*/React.createElement("button", {
|
|
60
|
-
ref: ref,
|
|
61
|
-
onClick: () => {
|
|
62
|
-
dispatch({
|
|
63
|
-
type: sourceEvent
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}, value);
|
|
67
|
-
} // NOTE: This is a sample of FilterDropdown action component
|
|
68
|
-
|
|
69
|
-
export function FilterDropdownView(_ref3, ref) {
|
|
70
|
-
let {
|
|
71
|
-
state,
|
|
72
|
-
helpers
|
|
73
|
-
} = _ref3;
|
|
74
|
-
const {
|
|
75
|
-
dispatch
|
|
76
|
-
} = helpers;
|
|
77
|
-
const {
|
|
78
|
-
options,
|
|
79
|
-
isMultiselectable
|
|
80
|
-
} = state.properties;
|
|
81
|
-
const {
|
|
82
|
-
sourceEvent,
|
|
83
|
-
payload
|
|
84
|
-
} = state.properties.appendToActionPayload.eventMappings[0];
|
|
85
|
-
const {
|
|
86
|
-
fieldName: value
|
|
87
|
-
} = payload;
|
|
88
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
89
|
-
"data-title": value,
|
|
90
|
-
onClick: () => dispatch({
|
|
91
|
-
type: sourceEvent
|
|
92
|
-
}),
|
|
93
|
-
ref: ref
|
|
94
|
-
}, value);
|
|
95
|
-
return /*#__PURE__*/React.createElement("select", {
|
|
96
|
-
"data-title": '',
|
|
97
|
-
ref: ref,
|
|
98
|
-
onChange: e => dispatch({
|
|
99
|
-
type: sourceEvent,
|
|
100
|
-
payload: {
|
|
101
|
-
sourcePayload: {
|
|
102
|
-
selectedValue: e.target.value
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
})
|
|
106
|
-
}, options.map((option, index) => /*#__PURE__*/React.createElement("option", {
|
|
107
|
-
key: index,
|
|
108
|
-
value: option.value
|
|
109
|
-
}, option.label)));
|
|
29
|
+
});
|
|
110
30
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createCustomComponent } from "../../../../../custom-component";
|
|
2
|
+
import { TableColumnSortProperties } from "../../../../../../cc/table-column-sort";
|
|
3
|
+
import TableColumnSortView from "./TableColumnSortView";
|
|
4
|
+
const TableColumnSort = createCustomComponent({
|
|
5
|
+
name: 'TableColumnSort',
|
|
6
|
+
View: TableColumnSortView,
|
|
7
|
+
properties: TableColumnSortProperties,
|
|
8
|
+
events: [],
|
|
9
|
+
eventHandlers: {}
|
|
10
|
+
});
|
|
11
|
+
export default TableColumnSort;
|