@zohodesk/library-platform 1.1.11 → 1.1.12-exp.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/bc/index.js +0 -1
- package/es/bc/zlist/Constants.js +0 -1
- package/es/bc/zlist/Types.js +10 -0
- package/es/bc/zrecord/Constants.js +1 -0
- package/es/bc/zrecord/Schemas.js +29 -0
- package/es/bc/zrecord/Types.js +45 -0
- package/es/cc/fields/lookup/Properties.js +10 -26
- package/es/cc/radio-dropdown/Constants.js +6 -0
- package/es/cc/radio-dropdown/Data.js +1 -0
- package/es/cc/radio-dropdown/Events.js +42 -0
- package/es/cc/radio-dropdown/Properties.js +142 -0
- package/es/cc/radio-dropdown/index.js +4 -0
- package/es/cc/table-column-filter/Properties.js +9 -0
- package/es/cc/table-connected/SdkContract.js +21 -0
- package/es/cc/table-connected/constants/Events.js +2 -0
- package/es/cc/table-list/Actions.js +0 -2
- package/es/cc/table-list/Constants.js +0 -1
- package/es/cc/table-list/Events.js +0 -2
- package/es/cc/table-list/Properties.js +0 -3
- package/es/cc/tag/Constants.js +6 -0
- package/es/cc/tag/Data.js +14 -0
- package/es/cc/tag/EventHandlers.js +1 -0
- package/es/cc/tag/Events.js +26 -0
- package/es/cc/tag/Model.js +30 -0
- package/es/cc/tag/Properties.js +104 -0
- package/es/cc/tag/index.js +6 -0
- package/es/cc/tags-list-dropdown/Constants.js +5 -0
- package/es/cc/tags-list-dropdown/Data.js +1 -0
- package/es/cc/tags-list-dropdown/Events.js +14 -0
- package/es/cc/tags-list-dropdown/Properties.js +96 -0
- package/es/cc/tags-list-dropdown/index.js +4 -0
- package/es/library/custom-component/frameworks/ui/CustomComponentFactory.js +56 -0
- package/es/library/dot/components/form/frameworks/ui/css/Form.module.css +13 -13
- package/es/library/dot/components/form-fields/field/css/FieldItem.module.css +2 -2
- package/es/library/dot/components/section/frameworks/ui/css/Section.module.css +3 -3
- package/es/library/dot/components/table-list/adapters/controllers/index.js +0 -2
- package/es/library/dot/components/table-list/frameworks/ui/EventHandlersFactory.js +1 -2
- package/es/library/dot/components/table-list/frameworks/ui/css/TableList.module.css +21 -21
- package/es/library/dot/legacy-to-new-arch/breadcrumb/frameworks/ui/css/Breadcrumb.module.css +4 -4
- package/es/library/dot/legacy-to-new-arch/date/frameworks/ui/css/DateView.module.css +1 -1
- package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/css/Label.module.css +4 -4
- package/es/library/dot/legacy-to-new-arch/multi-select/frameworks/ui/css/MultiSelectView.module.css +7 -7
- package/es/library/dot/legacy-to-new-arch/radio-dropdown/frameworks/ui/RadioDropdown.js +12 -0
- package/es/library/dot/legacy-to-new-arch/radio-dropdown/frameworks/ui/RadioDropdownView.js +124 -0
- package/es/library/dot/legacy-to-new-arch/radio-dropdown/frameworks/ui/css/RadioDropdown.module.css +23 -0
- package/es/library/dot/legacy-to-new-arch/select/frameworks/ui/css/Select.module.css +2 -2
- package/es/library/dot/legacy-to-new-arch/table-column-chooser/frameworks/ui/css/TableColumnChooserView.module.css +1 -1
- package/es/library/dot/legacy-to-new-arch/table-column-filter/frameworks/ui/TableColumnFilterView.js +2 -1
- package/es/library/dot/legacy-to-new-arch/table-field-components/highlighted-value-field/frameworks/ui/EventHandlersFactory.js +26 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/highlighted-value-field/frameworks/ui/HighlightedValueField.js +23 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/highlighted-value-field/frameworks/ui/HighlightedValueFieldView.js +24 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/labeled-avatar-field/frameworks/ui/EventHandlersFactory.js +26 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/labeled-avatar-field/frameworks/ui/LabeledAvatarField.js +23 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/labeled-avatar-field/frameworks/ui/LabeledAvatarFieldView.js +22 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/link-field/frameworks/ui/EventHandlersFactory.js +26 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/link-field/frameworks/ui/LinkField.js +23 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/link-field/frameworks/ui/LinkFieldView.js +26 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/radio-dropdown-field/frameworks/ui/EventHandlersFactory.js +32 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/radio-dropdown-field/frameworks/ui/RadioDropdownField.js +32 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/radio-dropdown-field/frameworks/ui/RadioDropdownFieldView.js +43 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/radio-dropdown-field/frameworks/ui/css/RadioDropdownField.module.css +3 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/tag-field/frameworks/ui/EventHandlersFactory.js +26 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/tag-field/frameworks/ui/TagField.js +23 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/tag-field/frameworks/ui/TagFieldView.js +34 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/tags-field/frameworks/ui/EventHandlersFactory.js +26 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/tags-field/frameworks/ui/TagsField.js +23 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/tags-field/frameworks/ui/TagsFieldView.js +18 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/tags-list-dropdown-field/frameworks/ui/TagsListDropdownField.js +12 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/tags-list-dropdown-field/frameworks/ui/TagsListDropdownFieldView.js +24 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/text-field/frameworks/ui/EventHandlersFactory.js +26 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/text-field/frameworks/ui/TextField.js +23 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/text-field/frameworks/ui/TextFieldView.js +20 -0
- package/es/library/dot/legacy-to-new-arch/tag/frameworks/ui/Tag.js +11 -0
- package/es/library/dot/legacy-to-new-arch/tag/frameworks/ui/Tag.module.css +8 -0
- package/es/library/dot/legacy-to-new-arch/tag/frameworks/ui/TagView.js +96 -0
- package/es/library/dot/legacy-to-new-arch/tags-list-dropdown/frameworks/ui/TagContractAdapter.js +24 -0
- package/es/library/dot/legacy-to-new-arch/tags-list-dropdown/frameworks/ui/TagsListDropdown.js +12 -0
- package/es/library/dot/legacy-to-new-arch/tags-list-dropdown/frameworks/ui/TagsListDropdownView.js +42 -0
- package/es/library/dot/legacy-to-new-arch/text-area/frameworks/ui/css/TextAreaView.module.css +3 -3
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActions/RowActionsRenderer.module.css +5 -5
- package/es/platform/components/table-connected/adapters/resources/SmartTableResource.js +169 -8
- package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +11 -2
- package/es/platform/data-source/http-template/fetchLookupFields.js +0 -6
- package/es/platform/data-source/http-template/getComponentMapping.js +17 -0
- package/es/platform/data-source/http-template/getRecords.js +1 -0
- package/es/platform/zform/adapters/gateway/FormRepository.js +3 -1
- package/es/platform/zform/adapters/presenter/translators/fields/LookUpFieldTranslator.js +12 -11
- package/es/platform/zform/applications/usecases/MyFormSuccessUseCase.js +9 -10
- package/es/platform/zform/domain/ZForm.js +2 -0
- package/es/platform/zlist/adapters/controllers/RefreshRecordsRequestedController.js +21 -0
- package/es/platform/zlist/adapters/controllers/SortController.js +2 -2
- package/es/platform/zlist/adapters/gateways/Repository.js +6 -11
- package/es/platform/zlist/adapters/gateways/Service.js +2 -0
- package/es/platform/zlist/adapters/presenters/TableTranslator.js +9 -6
- package/es/platform/zlist/adapters/presenters/translators/FieldVariations.js +25 -0
- package/es/platform/zlist/adapters/presenters/translators/Header.js +29 -21
- package/es/platform/zlist/adapters/presenters/translators/HeadersTranslator.js +3 -3
- package/es/platform/zlist/adapters/presenters/utils/DefaultClientActions.js +7 -4
- package/es/platform/zlist/applications/entities-factory/ListFactory.js +2 -2
- package/es/platform/zlist/applications/interfaces/input/GetSortConfigUseCaseInputModel.js +1 -0
- package/es/platform/zlist/applications/interfaces/input/RefreshRecordsRequestedUseCaseInputModel.js +1 -0
- package/es/platform/zlist/applications/interfaces/input/SetSortConfigUseCaseInputModel.js +1 -0
- package/es/platform/zlist/applications/usecases/GetSortConfigUseCase.js +17 -0
- package/es/platform/zlist/applications/usecases/RecordSuccessCallbackUsecase.js +1 -1
- package/es/platform/zlist/applications/usecases/RefreshRecordsRequestedUseCase.js +17 -0
- package/es/platform/zlist/applications/usecases/SetSortConfigUseCase.js +26 -0
- package/es/platform/zlist/applications/usecases/SortUseCase.js +6 -6
- package/es/platform/zlist/domain/entities/List.js +27 -15
- package/es/platform/zlist/domain/entities/interfaces/Properties.js +5 -5
- package/es/platform/zlist/frameworks/EventHandlersFactory.js +3 -4
- package/es/platform/zlist/frameworks/ZListBehaviourFactory.js +2 -5
- package/es/platform/zrecord/adapters/gateways/Repository.js +5 -2
- package/es/platform/zrecord/applications/entities-factory/RecordsManagerFactory.js +2 -2
- package/es/platform/zrecord/applications/interfaces/input/ClearAllFiltersUseCaseInputModel.js +1 -0
- package/es/platform/zrecord/applications/interfaces/input/GetFilterConditionUseCaseInputModel.js +1 -0
- package/es/platform/zrecord/applications/interfaces/input/GetFilterConfigUseCaseInputModel.js +1 -0
- package/es/platform/zrecord/applications/interfaces/input/RefreshRecordsUseCaseInputModel.js +1 -0
- package/es/platform/zrecord/applications/interfaces/input/SetFilterUseCaseInputModel.js +1 -0
- package/es/platform/zrecord/applications/usecases/ClearAllFiltersUseCase.js +24 -0
- package/es/platform/zrecord/applications/usecases/GetFilterConditionUseCase.js +15 -0
- package/es/platform/zrecord/applications/usecases/GetFilterConfigUseCase.js +15 -0
- package/es/platform/zrecord/applications/usecases/RefreshRecordsUseCase.js +14 -0
- package/es/platform/zrecord/applications/usecases/SetFilterUseCase.js +24 -0
- package/es/platform/zrecord/domain/entities/Filter.js +247 -0
- package/es/platform/zrecord/domain/entities/RecordsManager.js +19 -1
- package/es/platform/zrecord/domain/entities/interfaces/IFilter.js +1 -0
- package/es/platform/zrecord/frameworks/RecordBehaviourFactory.js +11 -1
- package/package.json +2 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import ListErrorState from "../../domain/entities/ListErrorState";
|
|
2
2
|
import ListFactory from "../../applications/entities-factory/ListFactory";
|
|
3
|
-
import SortBy from "../../domain/entities/SortBy";
|
|
4
3
|
|
|
5
4
|
class Repository {
|
|
6
5
|
init(state) {
|
|
@@ -18,11 +17,14 @@ class Repository {
|
|
|
18
17
|
context
|
|
19
18
|
} = this.state.behaviours.appContext;
|
|
20
19
|
const {
|
|
21
|
-
|
|
20
|
+
zlist
|
|
21
|
+
} = this.state.behaviours;
|
|
22
|
+
const {
|
|
23
|
+
sortConfig,
|
|
22
24
|
errorState,
|
|
23
25
|
isReOrderLoading,
|
|
24
26
|
limit
|
|
25
|
-
} =
|
|
27
|
+
} = zlist;
|
|
26
28
|
const list = ListFactory.createList({
|
|
27
29
|
context,
|
|
28
30
|
query: {
|
|
@@ -31,7 +33,7 @@ class Repository {
|
|
|
31
33
|
moduleName,
|
|
32
34
|
...query
|
|
33
35
|
},
|
|
34
|
-
|
|
36
|
+
sortConfig,
|
|
35
37
|
limit: limit,
|
|
36
38
|
isReOrderLoading,
|
|
37
39
|
errorState: new ListErrorState(errorState)
|
|
@@ -46,13 +48,6 @@ class Repository {
|
|
|
46
48
|
return zrecord.records;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
getZListState() {
|
|
50
|
-
const {
|
|
51
|
-
zlist
|
|
52
|
-
} = this.state.behaviours;
|
|
53
|
-
return zlist;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
51
|
}
|
|
57
52
|
|
|
58
53
|
export default Repository;
|
|
@@ -14,6 +14,7 @@ import RecordSuccessCallbackUsecase from "../../applications/usecases/RecordSucc
|
|
|
14
14
|
import ReOrderUseCase from "../../applications/usecases/ReOrderUseCase";
|
|
15
15
|
import ReOrderFailedUseCase from "../../applications/usecases/ReOrderFailedUseCase";
|
|
16
16
|
import ResolutionBasedLimitUseCase from "../../applications/usecases/ResolutionBasedLimitUseCase";
|
|
17
|
+
import RefreshRecordsRequestedUseCase from "../../applications/usecases/RefreshRecordsRequestedUseCase";
|
|
17
18
|
|
|
18
19
|
class Service {
|
|
19
20
|
constructor(dependencies) {
|
|
@@ -34,6 +35,7 @@ class Service {
|
|
|
34
35
|
this.deleteSuccessUseCase = new DeleteSuccessUseCase(this.dependencies);
|
|
35
36
|
this.reOrderUseCase = new ReOrderUseCase(this.dependencies);
|
|
36
37
|
this.reOrderFailedUseCase = new ReOrderFailedUseCase(this.dependencies);
|
|
38
|
+
this.refreshRecordsRequestedUseCase = new RefreshRecordsRequestedUseCase(this.dependencies);
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @zohodesk/architecturerules/define-property-schema */
|
|
2
2
|
|
|
3
3
|
/* eslint-disable max-lines-per-function */
|
|
4
|
-
import { Width as ColumnWidth } from "../../../../cc/table-list/data-types/Header";
|
|
4
|
+
import { Width as ColumnWidth, SortedBy } from "../../../../cc/table-list/data-types/Header";
|
|
5
5
|
import HeadersTranslator from "./translators/HeadersTranslator";
|
|
6
6
|
import RowsTranslator from "./translators/RowsTranslator";
|
|
7
7
|
import Pipeline from "./utils/Pipeline";
|
|
@@ -11,6 +11,7 @@ import { ResizerStateTranslator } from "./translators/ResizerStateTranslator";
|
|
|
11
11
|
import { calculateFieldWidths } from "./utils/calculateFieldWidths";
|
|
12
12
|
import DefaultClientActions from "./utils/DefaultClientActions";
|
|
13
13
|
import SelectionTranslator from "./SelectionTranslator";
|
|
14
|
+
import { SortModelOrder } from "../../domain/entities/interfaces/Properties";
|
|
14
15
|
const EMPTY_OBJECT = {};
|
|
15
16
|
const EMPTY_ARRAY = [];
|
|
16
17
|
|
|
@@ -58,11 +59,10 @@ export default class TableTranslator {
|
|
|
58
59
|
} = fallbackToDefault(behaviours, {}); // FIX: behaviours should be available by default
|
|
59
60
|
|
|
60
61
|
const {
|
|
61
|
-
|
|
62
|
+
sortConfig,
|
|
62
63
|
errorState,
|
|
63
64
|
isReOrderLoading
|
|
64
|
-
} =
|
|
65
|
-
|
|
65
|
+
} = zlist;
|
|
66
66
|
const {
|
|
67
67
|
focussedIndex
|
|
68
68
|
} = fallbackToDefault(keyboardControls, {}); // FIX: KeyboardControls should be available by default
|
|
@@ -124,7 +124,7 @@ export default class TableTranslator {
|
|
|
124
124
|
isEnabled: textOverflowConfig.isEnabled,
|
|
125
125
|
mode: textOverflow.mode
|
|
126
126
|
};
|
|
127
|
-
const headersTranslator = new HeadersTranslator(fields, headerActions, context, modifiedWidths,
|
|
127
|
+
const headersTranslator = new HeadersTranslator(fields, headerActions, context, modifiedWidths, sortConfig, records, instanceName, moduleName);
|
|
128
128
|
const rowsTranslator = new RowsTranslator(recordsForDisplay, fields, rowActions, context, preferences, fieldComponentMapping, rowActionsUiType, fieldActions, instanceName, textOverflowData, moduleName, nameFieldsConfig, recordReadStatusConfig); // const actionTranslator = new ClientActionsTranslator(clientActions, records, fields, pageContext);
|
|
129
129
|
// const translators = [headersTranslator.getTranslator(), rowsTranslator.getTranslator(), actionTranslator.getTranslator()];
|
|
130
130
|
|
|
@@ -140,7 +140,10 @@ export default class TableTranslator {
|
|
|
140
140
|
isError,
|
|
141
141
|
selection: SelectionTranslator(state),
|
|
142
142
|
focussedRow: focussedIndex,
|
|
143
|
-
sortBy
|
|
143
|
+
sortBy: sortConfig ? {
|
|
144
|
+
name: sortConfig.fieldName,
|
|
145
|
+
order: sortConfig.order === SortModelOrder.ASC ? SortedBy.Ascending : sortConfig.order === SortModelOrder.DES ? SortedBy.Descending : SortedBy.None
|
|
146
|
+
} : {},
|
|
144
147
|
rowCursor,
|
|
145
148
|
resizerState: ResizerStateTranslator({
|
|
146
149
|
columnResizer: columnResizer,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import FieldTypes from "../../../../../cc/fields/field/Types";
|
|
2
|
+
const variationsMap = {
|
|
3
|
+
'Boolean': [FieldTypes.CheckboxField, FieldTypes.SwitchField] // 'Date': ['DatePicker', 'DateTimePicker'],
|
|
4
|
+
// 'Text': ['SingleLineText', 'MultiLineText', 'RichText'],
|
|
5
|
+
// Add more field types and their variations as needed
|
|
6
|
+
|
|
7
|
+
};
|
|
8
|
+
export const isValidFieldVariation = (fieldType, uiType) => {
|
|
9
|
+
const validVariations = variationsMap[fieldType];
|
|
10
|
+
return validVariations ? validVariations.includes(uiType) : false;
|
|
11
|
+
};
|
|
12
|
+
/*
|
|
13
|
+
|
|
14
|
+
Smart Table Field UI Variants:
|
|
15
|
+
• Boolean - CheckBox, Switch, Text
|
|
16
|
+
• Lookup - Link, Tag (Chip), LabeledAvatar
|
|
17
|
+
• SingleLine - Text, Link (Name field)
|
|
18
|
+
• MultiPicklist - TagsList, TagsDropdown
|
|
19
|
+
• ColoredMultiPicklist - TagsList
|
|
20
|
+
• ColoredPicklist - ColoredTag
|
|
21
|
+
• URL - Link, Text
|
|
22
|
+
• Email - Email
|
|
23
|
+
• Date, DateTime, Picklist, Currency, Integer, Decimal, Phone, Percentage - Text
|
|
24
|
+
|
|
25
|
+
*/
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Alignment } from "../../../../../cc/table-list/data-types/Header";
|
|
2
2
|
import ClientActionsTranslator from "../../../../client-actions/translators/client-actions-translator";
|
|
3
|
-
import {
|
|
3
|
+
import { SortModelOrder } from "../../../../zlist/domain/entities/interfaces/Properties";
|
|
4
4
|
import { i18NProviderUtils } from '@zohodesk/i18n';
|
|
5
|
+
import { SortOrder } from "../../../../../bc/zlist/Types";
|
|
5
6
|
|
|
6
|
-
function HeaderTranslator(field, actions, context, modifiedWidths,
|
|
7
|
+
function HeaderTranslator(field, actions, context, modifiedWidths, sortConfig, records, instanceName, moduleName) {
|
|
7
8
|
const {
|
|
8
9
|
id,
|
|
9
10
|
name,
|
|
@@ -11,7 +12,7 @@ function HeaderTranslator(field, actions, context, modifiedWidths, sortBy, recor
|
|
|
11
12
|
isSortable
|
|
12
13
|
} = field;
|
|
13
14
|
const newField = { ...field,
|
|
14
|
-
sort: translateSortBy(field.
|
|
15
|
+
sort: translateSortBy(field.name, sortConfig)
|
|
15
16
|
};
|
|
16
17
|
const transformedActions = ClientActionsTranslator.transform(actions, instanceName, moduleName, { ...context,
|
|
17
18
|
field: newField,
|
|
@@ -30,26 +31,33 @@ function HeaderTranslator(field, actions, context, modifiedWidths, sortBy, recor
|
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
export default HeaderTranslator;
|
|
34
|
+
const defaultSortBy = {
|
|
35
|
+
name: '',
|
|
36
|
+
order: SortModelOrder.NONE,
|
|
37
|
+
// FIX: i18n key
|
|
38
|
+
tooltip: 'Click to Sort'
|
|
39
|
+
};
|
|
33
40
|
|
|
34
|
-
function translateSortBy(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
41
|
+
function translateSortBy(name, sortConfig) {
|
|
42
|
+
if (!sortConfig || !name || !sortConfig.fieldName) {
|
|
43
|
+
return defaultSortBy;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (sortConfig.order === SortOrder.ASC) {
|
|
47
|
+
return {
|
|
48
|
+
name: sortConfig.fieldName,
|
|
49
|
+
order: SortModelOrder.ASC,
|
|
50
|
+
tooltip: i18NProviderUtils.getI18NValue('support.localization.tooltip.descending')
|
|
51
|
+
};
|
|
52
|
+
}
|
|
38
53
|
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
newSortBy.tooltip = i18NProviderUtils.getI18NValue("support.localization.tooltip.ascending");
|
|
46
|
-
} else if (newSortBy.order === SortOrder.NONE) {
|
|
47
|
-
newSortBy.tooltip = 'Click to Sort';
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
newSortBy.order = SortOrder.NONE;
|
|
51
|
-
newSortBy.tooltip = 'Click to Sort';
|
|
54
|
+
if (sortConfig.order === SortOrder.DES) {
|
|
55
|
+
return {
|
|
56
|
+
name: sortConfig.fieldName,
|
|
57
|
+
order: SortModelOrder.DES,
|
|
58
|
+
tooltip: i18NProviderUtils.getI18NValue('support.localization.tooltip.ascending')
|
|
59
|
+
};
|
|
52
60
|
}
|
|
53
61
|
|
|
54
|
-
return
|
|
62
|
+
return defaultSortBy;
|
|
55
63
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import HeaderTranslator from "./Header";
|
|
2
2
|
export default class HeadersTranslator {
|
|
3
|
-
constructor(fields, actions, context, modifiedWidths,
|
|
3
|
+
constructor(fields, actions, context, modifiedWidths, sortConfig, records, instanceName, moduleName) {
|
|
4
4
|
this.fields = fields;
|
|
5
5
|
this.actions = actions;
|
|
6
6
|
this.context = context;
|
|
7
7
|
this.modifiedWidths = modifiedWidths;
|
|
8
|
-
this.
|
|
8
|
+
this.sortConfig = sortConfig;
|
|
9
9
|
this.records = records;
|
|
10
10
|
this.instanceName = instanceName;
|
|
11
11
|
this.moduleName = moduleName;
|
|
@@ -17,7 +17,7 @@ export default class HeadersTranslator {
|
|
|
17
17
|
return [];
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
return this.fields.map(field => HeaderTranslator(field, this.actions, this.context, this.modifiedWidths, this.
|
|
20
|
+
return this.fields.map(field => HeaderTranslator(field, this.actions, this.context, this.modifiedWidths, this.sortConfig, this.records, this.instanceName, this.moduleName));
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
pipe(viewModel) {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/* eslint-disable max-lines-per-function */
|
|
2
|
+
import { i18NProviderUtils } from '@zohodesk/i18n';
|
|
2
3
|
import { TableListConstants } from "../../../../../cc/table-list";
|
|
3
4
|
import { CheckboxConstants } from "../../../../../cc/checkbox";
|
|
4
5
|
import ClientAction from "../../../../client-actions/behaviour/zclient-actions/domain/entities/ClientAction";
|
|
6
|
+
import { SORT_CLICKED } from "../../../../../cc/table-column-sort/Constants";
|
|
7
|
+
import { SMART_TABLE_SORT_BY_REQUESTED } from "../../../../../cc/table-connected/constants/Events";
|
|
5
8
|
const CHECKBOX_TOGGLED = CheckboxConstants.CHECKBOX_TOGGLED;
|
|
6
9
|
const TABLE_LIST_TOGGLE_ALL_SELECTION = TableListConstants.TABLE_LIST_TOGGLE_ALL_SELECTION;
|
|
7
10
|
|
|
@@ -22,8 +25,8 @@ class DefaultClientActions {
|
|
|
22
25
|
name: 'SortBy',
|
|
23
26
|
propertiesValueMapping: {
|
|
24
27
|
value: '{{@context.field.sort.order}}',
|
|
25
|
-
ascendingLabel: '
|
|
26
|
-
descendingLabel: '
|
|
28
|
+
ascendingLabel: i18NProviderUtils.getI18NValue('crm.report.wizard.groupings.asc'),
|
|
29
|
+
descendingLabel: i18NProviderUtils.getI18NValue('crm.report.wizard.groupings.desc')
|
|
27
30
|
},
|
|
28
31
|
eventMappings: [{
|
|
29
32
|
payloadValueMapping: {
|
|
@@ -31,8 +34,8 @@ class DefaultClientActions {
|
|
|
31
34
|
name: '{{@context.field.name}}',
|
|
32
35
|
order: `{{@payload.value}}`
|
|
33
36
|
},
|
|
34
|
-
sourceEvent:
|
|
35
|
-
targetEvent:
|
|
37
|
+
sourceEvent: SORT_CLICKED,
|
|
38
|
+
targetEvent: SMART_TABLE_SORT_BY_REQUESTED,
|
|
36
39
|
id: '4000000080005'
|
|
37
40
|
}],
|
|
38
41
|
id: '4000000080003'
|
|
@@ -4,13 +4,13 @@ class ListFactory {
|
|
|
4
4
|
static createList(input) {
|
|
5
5
|
const {
|
|
6
6
|
limit,
|
|
7
|
-
|
|
7
|
+
sortConfig,
|
|
8
8
|
query,
|
|
9
9
|
context,
|
|
10
10
|
errorState,
|
|
11
11
|
isReOrderLoading
|
|
12
12
|
} = input;
|
|
13
|
-
return new List(limit,
|
|
13
|
+
return new List(limit, sortConfig, query, context, isReOrderLoading, errorState);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/platform/zlist/applications/interfaces/input/RefreshRecordsRequestedUseCaseInputModel.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
|
|
3
|
+
class GetSortConfigUseCase extends AbstractUseCase {
|
|
4
|
+
execute(input) {
|
|
5
|
+
const {
|
|
6
|
+
callback
|
|
7
|
+
} = input;
|
|
8
|
+
const {
|
|
9
|
+
repository
|
|
10
|
+
} = this.dependencies;
|
|
11
|
+
const list = repository.getList();
|
|
12
|
+
callback?.(list.getSortConfig());
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default GetSortConfigUseCase;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
|
|
3
|
+
class RefreshRecordsRequestedUseCase extends AbstractUseCase {
|
|
4
|
+
execute(input) {
|
|
5
|
+
const {
|
|
6
|
+
dispatch
|
|
7
|
+
} = input;
|
|
8
|
+
const {
|
|
9
|
+
repository
|
|
10
|
+
} = this.dependencies;
|
|
11
|
+
const list = repository.getList();
|
|
12
|
+
dispatch(list.createRecordsRefetchAction());
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default RefreshRecordsRequestedUseCase;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
import { SMART_TABLE_SORTED } from "../../../../cc/table-connected/constants/Events";
|
|
3
|
+
|
|
4
|
+
class SetSortConfigUseCase extends AbstractUseCase {
|
|
5
|
+
execute(input) {
|
|
6
|
+
const {
|
|
7
|
+
sortConfig,
|
|
8
|
+
dispatch
|
|
9
|
+
} = input;
|
|
10
|
+
const {
|
|
11
|
+
repository,
|
|
12
|
+
presenter
|
|
13
|
+
} = this.dependencies;
|
|
14
|
+
const list = repository.getList();
|
|
15
|
+
list.setSortConfig(sortConfig);
|
|
16
|
+
presenter.updateView(list.toObject());
|
|
17
|
+
dispatch(list.createRecordsRefetchAction());
|
|
18
|
+
dispatch({
|
|
19
|
+
type: SMART_TABLE_SORTED,
|
|
20
|
+
payload: sortConfig
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default SetSortConfigUseCase;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { SmartTableConstants } from "../../../../cc/table-connected";
|
|
2
1
|
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
import { SMART_TABLE_SORTED } from "../../../../cc/table-connected/constants/Events";
|
|
3
3
|
|
|
4
4
|
class SortUseCase extends AbstractUseCase {
|
|
5
5
|
execute(input) {
|
|
6
6
|
const {
|
|
7
|
-
|
|
7
|
+
sortConfig,
|
|
8
8
|
dispatch
|
|
9
9
|
} = input;
|
|
10
10
|
const {
|
|
@@ -12,13 +12,13 @@ class SortUseCase extends AbstractUseCase {
|
|
|
12
12
|
presenter
|
|
13
13
|
} = this.dependencies;
|
|
14
14
|
const list = repository.getList();
|
|
15
|
-
list.
|
|
15
|
+
list.setSortConfig(sortConfig);
|
|
16
|
+
presenter.updateView(list.toObject());
|
|
16
17
|
dispatch(list.createRecordsRefetchAction());
|
|
17
18
|
dispatch({
|
|
18
|
-
type:
|
|
19
|
-
payload:
|
|
19
|
+
type: SMART_TABLE_SORTED,
|
|
20
|
+
payload: sortConfig
|
|
20
21
|
});
|
|
21
|
-
presenter.updateView(list.toObject());
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
}
|
|
@@ -3,13 +3,13 @@ import { FIELD_EXECUTE, FIELD_REFETCH } from "../../../../bc/zfield/Constants";
|
|
|
3
3
|
import { CLIENTACTION_BEHAVIOUR_EXECUTE } from "../../../client-actions/bc/zclient-actions/Constants";
|
|
4
4
|
import { CLIENT_ACTION_TABLE_LIST_COMPONENT_NAME, ZLIST_RECORD_DELETE_SUCCEEDED, ZLIST_RECORD_UPDATE_SUCCEEDED } from "../../../../bc/zlist/Constants";
|
|
5
5
|
import { SmartTableConstants } from "../../../../cc/table-connected";
|
|
6
|
-
import SortBy from "./SortBy";
|
|
7
6
|
import { CLIENTSCRIPT_FETCH } from "../../../client-scripts/bc/zclient-scripts-fetch/Constants";
|
|
7
|
+
import { SortOrder } from "../../../../bc/zlist/Types";
|
|
8
8
|
|
|
9
9
|
class List {
|
|
10
|
-
constructor(limit,
|
|
10
|
+
constructor(limit, sortConfig, query, context, isReOrderLoading, errorState) {
|
|
11
11
|
this.limit = limit;
|
|
12
|
-
this.
|
|
12
|
+
this.sortConfig = sortConfig;
|
|
13
13
|
this.query = query;
|
|
14
14
|
this.context = context;
|
|
15
15
|
this.isReOrderLoading = isReOrderLoading;
|
|
@@ -19,7 +19,7 @@ class List {
|
|
|
19
19
|
toObject() {
|
|
20
20
|
return {
|
|
21
21
|
limit: this.limit,
|
|
22
|
-
|
|
22
|
+
sortConfig: this.sortConfig,
|
|
23
23
|
isReOrderLoading: this.isReOrderLoading,
|
|
24
24
|
errorState: this.errorState.toObject()
|
|
25
25
|
};
|
|
@@ -37,16 +37,12 @@ class List {
|
|
|
37
37
|
this.isReOrderLoading = false;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
this.
|
|
40
|
+
getSortConfig() {
|
|
41
|
+
return this.sortConfig;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
id,
|
|
47
|
-
name
|
|
48
|
-
} = this.sortBy;
|
|
49
|
-
this.sortBy.doSorting(id, name);
|
|
44
|
+
setSortConfig(sortConfig) {
|
|
45
|
+
this.sortConfig = sortConfig;
|
|
50
46
|
}
|
|
51
47
|
|
|
52
48
|
isAcknowledgeBySortBy(metaData) {
|
|
@@ -65,16 +61,32 @@ class List {
|
|
|
65
61
|
return variableName ? computedContext?.[variableName] : computedContext;
|
|
66
62
|
}
|
|
67
63
|
|
|
64
|
+
getSortByQueryString() {
|
|
65
|
+
const {
|
|
66
|
+
fieldName,
|
|
67
|
+
order
|
|
68
|
+
} = this.sortConfig;
|
|
69
|
+
|
|
70
|
+
if (order === SortOrder.DES) {
|
|
71
|
+
return `-${fieldName}`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (order === SortOrder.ASC) {
|
|
75
|
+
return fieldName;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return '';
|
|
79
|
+
}
|
|
80
|
+
|
|
68
81
|
createApiProps() {
|
|
69
82
|
const {
|
|
70
83
|
query,
|
|
71
84
|
limit,
|
|
72
|
-
sortBy,
|
|
73
85
|
context
|
|
74
86
|
} = this;
|
|
75
87
|
return {
|
|
76
88
|
limit,
|
|
77
|
-
sortBy:
|
|
89
|
+
sortBy: this.getSortByQueryString(),
|
|
78
90
|
...query,
|
|
79
91
|
...context
|
|
80
92
|
};
|
|
@@ -357,7 +369,7 @@ class List {
|
|
|
357
369
|
const props = this.createApiProps();
|
|
358
370
|
const metaData = triggerer === 'sortBy' && {
|
|
359
371
|
['SMART_TABLE#SORTED']: {
|
|
360
|
-
sortBy: this.
|
|
372
|
+
sortBy: this.sortConfig
|
|
361
373
|
}
|
|
362
374
|
};
|
|
363
375
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export let
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return
|
|
1
|
+
export let SortModelOrder = /*#__PURE__*/function (SortModelOrder) {
|
|
2
|
+
SortModelOrder["NONE"] = "none";
|
|
3
|
+
SortModelOrder["ASC"] = "ascending";
|
|
4
|
+
SortModelOrder["DES"] = "descending";
|
|
5
|
+
return SortModelOrder;
|
|
6
6
|
}({});
|
|
@@ -9,13 +9,12 @@ import FetchMoreController from "../adapters/controllers/FetchMoreController";
|
|
|
9
9
|
import SortController from "../adapters/controllers/SortController";
|
|
10
10
|
import FieldChangeController from "../adapters/controllers/FieldChangeController";
|
|
11
11
|
import LifeCycleEvents from "../../../cc/component/LifeCycleEventsEnum";
|
|
12
|
-
import SortBy from "../adapters/gateways/SortBy";
|
|
13
12
|
import DeleteMultipleRecordController from "../adapters/controllers/DeleteMultipleRecordController";
|
|
14
13
|
import RecordUpdateController from "../adapters/controllers/RecordUpdateController";
|
|
15
14
|
import DeleteSingleRecordController from "../adapters/controllers/DeleteSingleRecordController";
|
|
16
15
|
import RecordExecuteFailedController from "../adapters/controllers/RecordExecuteFailedController";
|
|
17
16
|
import RecordExecuteSucceededController from "../adapters/controllers/RecordExecuteSucceededController";
|
|
18
|
-
import { RECORD_EXECUTE_FAILED, RECORD_EXECUTE_SUCCEEDED, RECORD_EXECUTE_SUCCESS_CALLBACK } from "../../../bc/zrecord/Constants";
|
|
17
|
+
import { RECORD_EXECUTE_FAILED, RECORD_EXECUTE_SUCCEEDED, RECORD_EXECUTE_SUCCESS_CALLBACK, REFRESH_RECORDS_REQUESTED } from "../../../bc/zrecord/Constants";
|
|
19
18
|
import UpdateSuccessController from "../adapters/controllers/UpdateSuccessController";
|
|
20
19
|
import DeleteSuccessController from "../adapters/controllers/DeleteSuccessController";
|
|
21
20
|
import Presenter from "../adapters/presenters/Presenters";
|
|
@@ -26,14 +25,13 @@ import { FIELD_FETCH_FAILURE } from "../../../bc/zfield/Constants";
|
|
|
26
25
|
import FieldExecuteFailedController from "../adapters/controllers/FieldExecuteFailedController";
|
|
27
26
|
import { CLIENTACTION_EXECUTE_FAILED } from "../../client-actions/bc/zclient-actions/Constants";
|
|
28
27
|
import ResolutionBasedLimitController from "../adapters/controllers/ResolutionBasedLimitController";
|
|
28
|
+
import RefreshRecordsRequestedController from "../adapters/controllers/RefreshRecordsRequestedController";
|
|
29
29
|
export default class ActionHandlersFactory {
|
|
30
30
|
static create() {
|
|
31
31
|
const repository = new Repository();
|
|
32
32
|
const presenter = new Presenter();
|
|
33
|
-
const sortByGateway = new SortBy();
|
|
34
33
|
const service = new Service({
|
|
35
34
|
repository,
|
|
36
|
-
sortBy: sortByGateway,
|
|
37
35
|
presenter
|
|
38
36
|
});
|
|
39
37
|
return {
|
|
@@ -57,6 +55,7 @@ export default class ActionHandlersFactory {
|
|
|
57
55
|
[ZLIST_RECORD_DELETE_SUCCEEDED]: new DeleteSuccessController(service).handle,
|
|
58
56
|
// ({ dispatch, action }) => dispatch({ type: 'SMART_TABLE#RECORD_DELETED', payload: { id: action.payload.id } })
|
|
59
57
|
[ZLIST_RECORD_REORDER]: new ReOrderController(service).handle,
|
|
58
|
+
[REFRESH_RECORDS_REQUESTED]: new RefreshRecordsRequestedController(service).handle,
|
|
60
59
|
[ZLIST_RECORD_REORDER_FAILED]: new ReOrderFailedController(service).handle
|
|
61
60
|
};
|
|
62
61
|
}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import Properties from "../../../bc/zlist/Properties";
|
|
2
2
|
import EventHandlersFactory from "./EventHandlersFactory";
|
|
3
|
+
import { initialSortConfig } from "../../../bc/zlist/Types";
|
|
3
4
|
export default class ZListBehaviourFactory {
|
|
4
5
|
static create() {
|
|
5
6
|
return {
|
|
6
7
|
name: 'zlist',
|
|
7
8
|
setInitialState: () => ({
|
|
8
|
-
|
|
9
|
-
id: '',
|
|
10
|
-
name: '',
|
|
11
|
-
order: 'none'
|
|
12
|
-
},
|
|
9
|
+
sortConfig: initialSortConfig,
|
|
13
10
|
isReOrderLoading: false,
|
|
14
11
|
errorState: {
|
|
15
12
|
canErrorPage: false,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import RecordsManagerFactory from "../../applications/entities-factory/RecordsManagerFactory";
|
|
2
|
+
import { Filter } from "../../domain/entities/Filter";
|
|
2
3
|
export default class Repository {
|
|
3
4
|
init(state) {
|
|
4
5
|
this.state = state;
|
|
@@ -11,13 +12,15 @@ export default class Repository {
|
|
|
11
12
|
const {
|
|
12
13
|
records = [],
|
|
13
14
|
hasMore,
|
|
14
|
-
isFetching
|
|
15
|
+
isFetching,
|
|
16
|
+
filter
|
|
15
17
|
} = zrecord;
|
|
18
|
+
const filterEntity = new Filter(filter.config, filter.condition, filter.queryString);
|
|
16
19
|
const recordManager = RecordsManagerFactory.create({
|
|
17
20
|
data: records,
|
|
18
21
|
hasMore,
|
|
19
22
|
isFetching
|
|
20
|
-
});
|
|
23
|
+
}, filterEntity);
|
|
21
24
|
return recordManager;
|
|
22
25
|
}
|
|
23
26
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import RecordsManager from "../../domain/entities/RecordsManager";
|
|
2
2
|
import Records from "../../domain/entities/Records";
|
|
3
3
|
export default class RecordsManagerFactory {
|
|
4
|
-
static create(recordsModel) {
|
|
4
|
+
static create(recordsModel, filter) {
|
|
5
5
|
const records = new Records(recordsModel);
|
|
6
|
-
const recordManager = new RecordsManager(records);
|
|
6
|
+
const recordManager = new RecordsManager(records, filter);
|
|
7
7
|
return recordManager;
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/platform/zrecord/applications/interfaces/input/GetFilterConditionUseCaseInputModel.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
import { REFRESH_RECORDS_REQUESTED } from "../../../../bc/zrecord/Constants";
|
|
3
|
+
import { initialFilterConfig } from "../../../../bc/zrecord/Types";
|
|
4
|
+
export default class ClearAllFiltersUseCase extends AbstractUseCase {
|
|
5
|
+
execute(_ref) {
|
|
6
|
+
let {
|
|
7
|
+
dispatch
|
|
8
|
+
} = _ref;
|
|
9
|
+
const {
|
|
10
|
+
repository,
|
|
11
|
+
presenter
|
|
12
|
+
} = this.dependencies;
|
|
13
|
+
const recordManager = repository.getRecordsManagerEntity();
|
|
14
|
+
recordManager.setFilterConfig(initialFilterConfig);
|
|
15
|
+
presenter.updateRecord(recordManager.toObject());
|
|
16
|
+
dispatch({
|
|
17
|
+
type: REFRESH_RECORDS_REQUESTED,
|
|
18
|
+
metaData: {
|
|
19
|
+
filterConfig: initialFilterConfig
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|