@zohodesk/library-platform 1.0.2-exp.1.1 → 1.0.2-exp.1.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/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/frameworks/ui/CreateCustomComponent.js +28 -6
- package/es/library/custom-component/frameworks/ui/CreateSlotComponent.js +77 -22
- 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
|
+
}*/
|
|
@@ -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;
|
package/es/library/dot/legacy-to-new-arch/table-column-sort/frameworks/ui/TableColumnSortView.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import SortDropdown from '@zohodesk-private/desk-components/es/table/SortDropdown/SortDropdown';
|
|
3
|
+
import { TableColumnSortConstants } from "../../../../../../cc/table-column-sort"; // @ts-ignore
|
|
4
|
+
|
|
5
|
+
import style from "./css/TableColumnSort.module.css";
|
|
6
|
+
|
|
7
|
+
function TableColumnSortView(_ref, ref) {
|
|
8
|
+
let {
|
|
9
|
+
state,
|
|
10
|
+
helpers
|
|
11
|
+
} = _ref;
|
|
12
|
+
let {
|
|
13
|
+
dispatch
|
|
14
|
+
} = helpers;
|
|
15
|
+
let {
|
|
16
|
+
value,
|
|
17
|
+
ascendingLabel,
|
|
18
|
+
descendingLabel
|
|
19
|
+
} = state.properties;
|
|
20
|
+
return /*#__PURE__*/React.createElement(SortDropdown, {
|
|
21
|
+
selectedValue: value,
|
|
22
|
+
ascendingLabel: ascendingLabel,
|
|
23
|
+
descendingLabel: descendingLabel,
|
|
24
|
+
onSort: _ref2 => {
|
|
25
|
+
let {
|
|
26
|
+
value
|
|
27
|
+
} = _ref2;
|
|
28
|
+
return dispatch({
|
|
29
|
+
type: TableColumnSortConstants.SORT_CLICKED,
|
|
30
|
+
payload: {
|
|
31
|
+
value
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
customStyle: {
|
|
36
|
+
parentContainer: `${style.parentContainer} ${value !== 'none' ? style.active : ''}`
|
|
37
|
+
},
|
|
38
|
+
customAttributes_container: {
|
|
39
|
+
ref
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default TableColumnSortView;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createCustomComponent } from "../../../../../../custom-component";
|
|
2
|
+
import ColouredMultiSelectProperties from "../../../../../../../cc/fields/coloured-multi-select/Properties";
|
|
3
|
+
import ColouredMultiSelectEvents from "../../../../../../../cc/fields/coloured-multi-select/Events";
|
|
4
|
+
import { ColouredMultiSelectFieldView } from "./ColouredMultiSelectFieldView";
|
|
5
|
+
const ColouredMultiSelectField = createCustomComponent({
|
|
6
|
+
name: 'ColouredMultiSelectField',
|
|
7
|
+
View: ColouredMultiSelectFieldView,
|
|
8
|
+
properties: ColouredMultiSelectProperties,
|
|
9
|
+
events: ColouredMultiSelectEvents,
|
|
10
|
+
eventHandlers: {}
|
|
11
|
+
});
|
|
12
|
+
export default ColouredMultiSelectField;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Tags } from "../../../..";
|
|
3
|
+
export function ColouredMultiSelectFieldView(_ref, ref) {
|
|
4
|
+
let {
|
|
5
|
+
state
|
|
6
|
+
} = _ref;
|
|
7
|
+
const {
|
|
8
|
+
value,
|
|
9
|
+
options
|
|
10
|
+
} = state.properties;
|
|
11
|
+
const selectedOptions = value.map(item => {
|
|
12
|
+
const option = options.find(opt => opt.value === item);
|
|
13
|
+
return {
|
|
14
|
+
id: option.value,
|
|
15
|
+
label: option.value,
|
|
16
|
+
color: option.colorCode
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
return /*#__PURE__*/React.createElement(Tags, {
|
|
20
|
+
getRef: ref,
|
|
21
|
+
tags: selectedOptions
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createCustomComponent } from "../../../../../../custom-component";
|
|
2
|
+
import ColouredPickListProperties from "../../../../../../../cc/fields/coloured-pick-list/Properties";
|
|
3
|
+
import ColouredPickListEvents from "../../../../../../../cc/fields/coloured-pick-list/Events";
|
|
4
|
+
import TextToFieldClickBehaviourFactory from "../../../../../../behaviours/text-to-field-click/frameworks/ui/TextToFieldClickBehaviourFactory";
|
|
5
|
+
import { ColouredPickListFieldView } from "./ColouredPickListFieldView";
|
|
6
|
+
const ColouredPickListField = createCustomComponent({
|
|
7
|
+
name: 'ColouredPickListField',
|
|
8
|
+
View: ColouredPickListFieldView,
|
|
9
|
+
properties: ColouredPickListProperties,
|
|
10
|
+
behaviours: [TextToFieldClickBehaviourFactory.create()],
|
|
11
|
+
events: ColouredPickListEvents,
|
|
12
|
+
eventHandlers: {}
|
|
13
|
+
});
|
|
14
|
+
export default ColouredPickListField;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ColoredTag from '@zohodesk-private/desk-components/es/ColoredTag/ColoredTag';
|
|
3
|
+
import { TagsConstants } from "../../../../../../../cc/tags";
|
|
4
|
+
export function ColouredPickListFieldView(_ref, ref) {
|
|
5
|
+
let {
|
|
6
|
+
state,
|
|
7
|
+
helpers
|
|
8
|
+
} = _ref;
|
|
9
|
+
let {
|
|
10
|
+
dispatch
|
|
11
|
+
} = helpers;
|
|
12
|
+
const {
|
|
13
|
+
value,
|
|
14
|
+
options
|
|
15
|
+
} = state.properties;
|
|
16
|
+
const selectedOption = options.find(option => option.value === value);
|
|
17
|
+
return /*#__PURE__*/React.createElement(ColoredTag, {
|
|
18
|
+
$data_id: value,
|
|
19
|
+
$data_text: value,
|
|
20
|
+
$data_color: selectedOption.colorCode || '',
|
|
21
|
+
$event_onClick: id => {
|
|
22
|
+
dispatch({
|
|
23
|
+
type: TagsConstants.TAG_CLICKED,
|
|
24
|
+
payload: {
|
|
25
|
+
id
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
$customProps_tag: {
|
|
30
|
+
getRef: ref
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -8,6 +8,8 @@ import PhoneField from "./phone-field/frameworks/ui/PhoneField";
|
|
|
8
8
|
import CurrencyField from "./currency-field/frameworks/ui/CurrencyField";
|
|
9
9
|
import LookUpField from "./lookup-field/frameworks/ui/LookupField";
|
|
10
10
|
import PickListField from "./picklist-field/frameworks/ui/PickListField";
|
|
11
|
+
import ColouredPickListField from "./coloured-picklist-field/frameworks/ui/ColouredPickListField";
|
|
12
|
+
import ColouredMultiSelectField from "./coloured-multiselect-field/frameworks/ui/ColouredMultiSelectField";
|
|
11
13
|
import PercentageField from "./percentage-field/frameworks/ui/PercentageField";
|
|
12
14
|
import DateField from "./date-field/frameworks/ui/DateField";
|
|
13
15
|
import DateTimeField from "./datetime-field/frameworks/ui/DateTimeField";
|
|
@@ -24,6 +26,8 @@ const FieldComponents = {
|
|
|
24
26
|
[FieldTypes.CurrencyField]: CurrencyField,
|
|
25
27
|
[FieldTypes.LookUpField]: LookUpField,
|
|
26
28
|
[FieldTypes.PickListField]: PickListField,
|
|
29
|
+
[FieldTypes.ColouredPickListField]: ColouredPickListField,
|
|
30
|
+
[FieldTypes.ColouredMultiSelectField]: ColouredMultiSelectField,
|
|
27
31
|
[FieldTypes.PercentageField]: PercentageField,
|
|
28
32
|
[FieldTypes.DateField]: DateField,
|
|
29
33
|
[FieldTypes.DateTimeField]: DateTimeField,
|