@zohodesk/library-platform 1.1.12-exp.1 → 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/checkbox/Properties.js +1 -2
- package/es/cc/email/Properties.js +0 -8
- package/es/cc/fields/field/Types.js +23 -31
- package/es/cc/fields/lookup/Properties.js +10 -26
- package/es/cc/highlighted-value/Properties.js +0 -18
- package/es/cc/link/Properties.js +3 -13
- package/es/cc/switch/Properties.js +2 -2
- 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 +35 -4
- package/es/cc/tags/Data.js +6 -0
- package/es/cc/tags/model/TagModel.js +26 -0
- package/es/cc/tags/model/index.js +1 -1
- package/es/library/custom-component/frameworks/ui/CustomComponentFactory.js +56 -0
- 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/sub-components/row/Row.js +1 -3
- package/es/library/dot/legacy-to-new-arch/email/frameworks/ui/EmailView.js +2 -4
- package/es/library/dot/legacy-to-new-arch/highlighted-value/frameworks/ui/HighlightedValueView.js +1 -6
- package/es/library/dot/legacy-to-new-arch/index.js +0 -1
- package/es/library/dot/legacy-to-new-arch/link/frameworks/ui/LinkView.js +2 -4
- package/es/library/dot/legacy-to-new-arch/table-field-components/checkbox-field/frameworks/ui/CheckboxField.js +2 -12
- package/es/library/dot/legacy-to-new-arch/table-field-components/checkbox-field/frameworks/ui/CheckboxFieldView.js +5 -8
- package/es/library/dot/legacy-to-new-arch/table-field-components/checkbox-field/frameworks/ui/EventHandlersFactory.js +3 -3
- package/es/library/dot/legacy-to-new-arch/table-field-components/email-field/frameworks/ui/EmailField.js +3 -3
- package/es/library/dot/legacy-to-new-arch/table-field-components/email-field/frameworks/ui/EmailFieldView.js +6 -8
- package/es/library/dot/legacy-to-new-arch/table-field-components/index.js +5 -22
- package/es/library/dot/legacy-to-new-arch/table-field-components/lookup-field/frameworks/ui/LookupFieldView.js +1 -1
- package/es/library/dot/legacy-to-new-arch/table-field-components/phone-field/frameworks/ui/PhoneFieldView.js +1 -1
- package/es/library/dot/legacy-to-new-arch/table-field-components/switch-field/frameworks/ui/EventHandlersFactory.js +3 -3
- package/es/library/dot/legacy-to-new-arch/table-field-components/switch-field/frameworks/ui/SwitchField.js +4 -14
- package/es/library/dot/legacy-to-new-arch/table-field-components/switch-field/frameworks/ui/SwitchFieldView.js +4 -8
- package/es/library/dot/legacy-to-new-arch/table-field-components/url-field/frameworks/ui/UrlFieldView.js +1 -1
- 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/getRecords.js +1 -0
- package/es/platform/data-source/index.js +1 -3
- package/es/platform/zfield/applications/usecases/FetchSuccessUseCase.js +0 -33
- package/es/platform/zfield/domain/entities/fields-manager/FieldsManager.js +0 -5
- 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 +11 -21
- package/es/platform/zlist/adapters/presenters/translators/ColumnTranslator.js +52 -48
- 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/translators/Row.js +2 -3
- package/es/platform/zlist/adapters/presenters/translators/RowsTranslator.js +1 -3
- package/es/platform/zlist/adapters/presenters/translators/fields/BooleanFieldTranslator.js +12 -87
- package/es/platform/zlist/adapters/presenters/translators/fields/CurrencyFieldTranslator.js +11 -66
- package/es/platform/zlist/adapters/presenters/translators/fields/DateFieldTranslator.js +9 -16
- package/es/platform/zlist/adapters/presenters/translators/fields/DateTimeFieldTranslator.js +9 -16
- package/es/platform/zlist/adapters/presenters/translators/fields/DecimalFieldTranslator.js +9 -16
- package/es/platform/zlist/adapters/presenters/translators/fields/EmailFieldTranslator.js +9 -29
- package/es/platform/zlist/adapters/presenters/translators/fields/FormulaFieldTranslator.js +27 -23
- package/es/platform/zlist/adapters/presenters/translators/fields/LookUpFieldTranslator.js +17 -106
- package/es/platform/zlist/adapters/presenters/translators/fields/MultiLineFieldTranslator.js +9 -16
- package/es/platform/zlist/adapters/presenters/translators/fields/MultiSelectFieldTranslator.js +26 -100
- package/es/platform/zlist/adapters/presenters/translators/fields/NumberFieldTranslator.js +9 -16
- package/es/platform/zlist/adapters/presenters/translators/fields/PercentageFieldTranslator.js +9 -16
- package/es/platform/zlist/adapters/presenters/translators/fields/PhoneFieldTranslator.js +9 -16
- package/es/platform/zlist/adapters/presenters/translators/fields/PickListFieldTranslator.js +26 -167
- package/es/platform/zlist/adapters/presenters/translators/fields/SingleLineFieldTranslator.js +9 -16
- package/es/platform/zlist/adapters/presenters/translators/fields/URLFieldTranslator.js +9 -32
- 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 +7 -7
|
@@ -25,7 +25,8 @@ class FormRepository {
|
|
|
25
25
|
validationRules = [],
|
|
26
26
|
sections = [],
|
|
27
27
|
layoutRules = [],
|
|
28
|
-
dependencyMappings = []
|
|
28
|
+
dependencyMappings = [],
|
|
29
|
+
layoutId
|
|
29
30
|
} = zform;
|
|
30
31
|
let validationRuleEntities = validationRules.map(rule => {
|
|
31
32
|
return new ZValidationRule(rule);
|
|
@@ -59,6 +60,7 @@ class FormRepository {
|
|
|
59
60
|
dependencyMappings: dependencyMappingsEntities,
|
|
60
61
|
layoutRules: layoutRulesEntities,
|
|
61
62
|
context,
|
|
63
|
+
layoutId: layoutId,
|
|
62
64
|
isMyFormFetching: zform.isMyFormFetching,
|
|
63
65
|
isDependencyFetching: zform.isDependencyFetching,
|
|
64
66
|
isLayoutRulesFetching: zform.isLayoutRulesFetching,
|
|
@@ -5,20 +5,21 @@ const LookUpFieldTranslator = _ref => {
|
|
|
5
5
|
fieldPreModified,
|
|
6
6
|
uiConfig
|
|
7
7
|
} = _ref;
|
|
8
|
-
const fieldModified = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
name: field.
|
|
14
|
-
...fieldPreModified,
|
|
8
|
+
const fieldModified = { ...fieldPreModified,
|
|
9
|
+
uiConfig: uiConfig,
|
|
10
|
+
type: type,
|
|
11
|
+
fieldType: field.type,
|
|
12
|
+
value: field.value,
|
|
13
|
+
name: field.name,
|
|
15
14
|
id: field.id,
|
|
16
15
|
label: field.i18NLabel,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// visibility: field.isVisible,
|
|
16
|
+
apiName: field.apiName,
|
|
17
|
+
errorMessage: field.errorMessage,
|
|
20
18
|
isVisible: field.isVisible,
|
|
21
|
-
|
|
19
|
+
readonly: field.isReadOnly,
|
|
20
|
+
required: field.isMandatory,
|
|
21
|
+
isCustomField: field.isCustomField,
|
|
22
|
+
maxLength: field.maxLength,
|
|
22
23
|
lookup: field.lookup
|
|
23
24
|
};
|
|
24
25
|
return fieldModified;
|
|
@@ -21,8 +21,9 @@ class MyFormSuccessUseCase extends AbstractUseCase {
|
|
|
21
21
|
sections
|
|
22
22
|
} = myForm;
|
|
23
23
|
const zFormEntity = repository.getFormEntity();
|
|
24
|
+
const layoutId = zFormEntity.getLayoutId();
|
|
24
25
|
const context = { ...zFormEntity.getContext(),
|
|
25
|
-
layoutId:
|
|
26
|
+
layoutId: layoutId
|
|
26
27
|
};
|
|
27
28
|
const lookupFields = sections.flatMap(section => section.fields.filter(field => field.type === 'LookUp'));
|
|
28
29
|
const sectionEntities = sections.map(section => {
|
|
@@ -63,24 +64,22 @@ class MyFormSuccessUseCase extends AbstractUseCase {
|
|
|
63
64
|
type: DATA_SOURCE_EXECUTE,
|
|
64
65
|
payload: {
|
|
65
66
|
actionName: 'fetchLookupFields',
|
|
66
|
-
props:
|
|
67
|
-
}
|
|
67
|
+
props: context
|
|
68
68
|
},
|
|
69
69
|
metaData: {
|
|
70
70
|
actionName: 'fetchLookupFields',
|
|
71
|
-
//hack
|
|
72
71
|
[DATA_SOURCE_NO_CONTENT]: {
|
|
73
72
|
type: ZFORM_LOOKUP_FIELD_SUCCESS,
|
|
74
73
|
metaData: {
|
|
75
74
|
actionName: 'fetchLookupFields'
|
|
76
75
|
}
|
|
77
76
|
},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
[DATA_SOURCE_FAILURE]: {
|
|
78
|
+
type: ZFORM_API_FAILURE,
|
|
79
|
+
metaData: {
|
|
80
|
+
actionName: 'fetchLookupFields'
|
|
81
|
+
}
|
|
82
|
+
},
|
|
84
83
|
[DATA_SOURCE_SUCCESS]: {
|
|
85
84
|
type: ZFORM_LOOKUP_FIELD_SUCCESS,
|
|
86
85
|
metaData: {
|
|
@@ -21,6 +21,7 @@ export default class ZForm {
|
|
|
21
21
|
dependencyMappings,
|
|
22
22
|
context,
|
|
23
23
|
focusedFieldName,
|
|
24
|
+
layoutId,
|
|
24
25
|
|
|
25
26
|
/*hack*/
|
|
26
27
|
isMyFormFetching,
|
|
@@ -45,6 +46,7 @@ export default class ZForm {
|
|
|
45
46
|
this.dependencyMappings = dependencyMappings;
|
|
46
47
|
this.context = context;
|
|
47
48
|
this.focusedFieldName = focusedFieldName || null;
|
|
49
|
+
this.layoutId = layoutId;
|
|
48
50
|
/*hack*/
|
|
49
51
|
|
|
50
52
|
this.isMyFormFetching = isMyFormFetching;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import AbstractController from "./AbstractController";
|
|
2
|
+
|
|
3
|
+
class RefreshRecordsRequestedController extends AbstractController {
|
|
4
|
+
handle(event) {
|
|
5
|
+
const {
|
|
6
|
+
refreshRecordsRequestedUseCase
|
|
7
|
+
} = this.service;
|
|
8
|
+
const {
|
|
9
|
+
state,
|
|
10
|
+
updateState,
|
|
11
|
+
dispatch
|
|
12
|
+
} = event;
|
|
13
|
+
refreshRecordsRequestedUseCase.updateDependency(state, updateState);
|
|
14
|
+
refreshRecordsRequestedUseCase.execute({
|
|
15
|
+
dispatch
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default RefreshRecordsRequestedController;
|
|
@@ -11,10 +11,10 @@ class SortController extends AbstractController {
|
|
|
11
11
|
action,
|
|
12
12
|
dispatch
|
|
13
13
|
} = event;
|
|
14
|
-
const
|
|
14
|
+
const sortConfig = action.payload;
|
|
15
15
|
sortUseCase.updateDependency(state, updateState);
|
|
16
16
|
sortUseCase.execute({
|
|
17
|
-
|
|
17
|
+
sortConfig,
|
|
18
18
|
dispatch
|
|
19
19
|
});
|
|
20
20
|
}
|
|
@@ -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
|
|
@@ -123,22 +123,9 @@ export default class TableTranslator {
|
|
|
123
123
|
const textOverflowData = {
|
|
124
124
|
isEnabled: textOverflowConfig.isEnabled,
|
|
125
125
|
mode: textOverflow.mode
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
const {
|
|
130
|
-
fieldName,
|
|
131
|
-
uiType,
|
|
132
|
-
translator
|
|
133
|
-
} = fieldVariation;
|
|
134
|
-
const field = fields.find(f => f.name === fieldName);
|
|
135
|
-
|
|
136
|
-
if (field) {
|
|
137
|
-
field.uiType = uiType;
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
const headersTranslator = new HeadersTranslator(fields, headerActions, context, modifiedWidths, sortBy, records, instanceName, moduleName);
|
|
141
|
-
const rowsTranslator = new RowsTranslator(recordsForDisplay, fields, rowActions, context, preferences, fieldComponentMapping, rowActionsUiType, fieldActions, instanceName, textOverflowData, moduleName, nameFieldsConfig, recordReadStatusConfig, zfield.componentMapping && [...zfield.componentMapping] || []); // const actionTranslator = new ClientActionsTranslator(clientActions, records, fields, pageContext);
|
|
126
|
+
};
|
|
127
|
+
const headersTranslator = new HeadersTranslator(fields, headerActions, context, modifiedWidths, sortConfig, records, instanceName, moduleName);
|
|
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);
|
|
142
129
|
// const translators = [headersTranslator.getTranslator(), rowsTranslator.getTranslator(), actionTranslator.getTranslator()];
|
|
143
130
|
|
|
144
131
|
const translators = [headersTranslator.getTranslator(), rowsTranslator.getTranslator()];
|
|
@@ -153,7 +140,10 @@ export default class TableTranslator {
|
|
|
153
140
|
isError,
|
|
154
141
|
selection: SelectionTranslator(state),
|
|
155
142
|
focussedRow: focussedIndex,
|
|
156
|
-
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
|
+
} : {},
|
|
157
147
|
rowCursor,
|
|
158
148
|
resizerState: ResizerStateTranslator({
|
|
159
149
|
columnResizer: columnResizer,
|
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import EmptyViewModel from "./EmptyViewModel";
|
|
2
2
|
import * as FieldTranslators from "./fields";
|
|
3
3
|
import ClientActionsTranslator from "../../../../client-actions/translators/client-actions-translator";
|
|
4
|
-
import { isValidFieldVariation } from "./FieldVariations";
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
//hacking temp url construction for lookup
|
|
6
|
+
function getLookupUrlConstructions(_ref) {
|
|
7
|
+
let {
|
|
8
|
+
field,
|
|
9
|
+
value,
|
|
10
|
+
context
|
|
11
|
+
} = _ref;
|
|
12
|
+
let {
|
|
13
|
+
orgName,
|
|
14
|
+
departmentName
|
|
15
|
+
} = context;
|
|
16
|
+
let lookupModuleName = field?.lookup?.module?.apiName;
|
|
17
|
+
return `/agent/${orgName}/${departmentName}/${lookupModuleName}/details/${value.id}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, context, preferences, instanceName, textOverflowConfig, moduleName, nameFieldsConfig, recordReadStatusConfig) {
|
|
7
21
|
const {
|
|
8
22
|
isCustomField,
|
|
9
23
|
name,
|
|
@@ -18,6 +32,7 @@ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, co
|
|
|
18
32
|
__DEVELOPMENT__ && console.warn(`The string format for componentMapping will soon be deprecated. Please update to the new JSON format. REF : ${JSON.stringify(fieldEntry)}`);
|
|
19
33
|
}
|
|
20
34
|
|
|
35
|
+
let tempValue = undefined;
|
|
21
36
|
let value = isCustomField ? record.cf?.[name] : record[name];
|
|
22
37
|
const actions = ClientActionsTranslator.transform(fieldActions, instanceName, moduleName, {
|
|
23
38
|
field,
|
|
@@ -28,12 +43,8 @@ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, co
|
|
|
28
43
|
return EmptyViewModel(name);
|
|
29
44
|
}
|
|
30
45
|
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (typeof fieldEntry === 'string') {
|
|
36
|
-
field.uiType = fieldEntry;
|
|
46
|
+
if (fieldComponentMapping[name]) {
|
|
47
|
+
field.uiType = fieldComponentMapping[name];
|
|
37
48
|
}
|
|
38
49
|
|
|
39
50
|
let nameFieldTypes = ['Text'];
|
|
@@ -47,9 +58,22 @@ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, co
|
|
|
47
58
|
return EmptyViewModel(name);
|
|
48
59
|
}
|
|
49
60
|
|
|
61
|
+
if (field.type == "LookUp") {
|
|
62
|
+
// temp fix for when lookup field don't have value !object
|
|
63
|
+
tempValue = typeof value !== 'object' ? {
|
|
64
|
+
name: value,
|
|
65
|
+
id: value
|
|
66
|
+
} : value;
|
|
67
|
+
tempValue.url = getLookupUrlConstructions({
|
|
68
|
+
field,
|
|
69
|
+
value,
|
|
70
|
+
context
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
50
74
|
const translatorArgs = {
|
|
51
75
|
field,
|
|
52
|
-
value,
|
|
76
|
+
value: tempValue ? tempValue : value,
|
|
53
77
|
appendToActionPayload: {
|
|
54
78
|
recordId: record.id
|
|
55
79
|
},
|
|
@@ -72,51 +96,31 @@ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, co
|
|
|
72
96
|
...fieldTranslator(translatorArgs)
|
|
73
97
|
};
|
|
74
98
|
|
|
75
|
-
if (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
99
|
+
if (fieldEntry && typeof fieldEntry === 'object') {
|
|
100
|
+
viewModel.type = fieldEntry.UIComponentName;
|
|
101
|
+
|
|
102
|
+
if (fieldEntry.fieldToUIComponentTranslator) {
|
|
103
|
+
viewModel.value = fieldEntry.fieldToUIComponentTranslator({
|
|
79
104
|
field,
|
|
80
105
|
record,
|
|
81
|
-
context
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
record,
|
|
94
|
-
context
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (fieldEntry.translator) {
|
|
99
|
-
const newViewModel = fieldEntry.translator({
|
|
100
|
-
viewModel: viewModel,
|
|
101
|
-
field,
|
|
102
|
-
record,
|
|
103
|
-
context,
|
|
104
|
-
preferences
|
|
105
|
-
});
|
|
106
|
-
return { ...newViewModel,
|
|
107
|
-
type: fieldEntry.UIComponentName ? fieldEntry.UIComponentName : field.uiType,
|
|
108
|
-
appendToActionPayload: {
|
|
109
|
-
recordId: record.id,
|
|
110
|
-
...newViewModel.appendToActionPayload
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
;
|
|
106
|
+
context
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (fieldEntry.translator) {
|
|
111
|
+
const newViewModel = fieldEntry.translator({
|
|
112
|
+
viewModel,
|
|
113
|
+
field,
|
|
114
|
+
context
|
|
115
|
+
});
|
|
116
|
+
newViewModel.type = fieldEntry.UIComponentName;
|
|
117
|
+
return newViewModel;
|
|
116
118
|
}
|
|
117
119
|
|
|
118
120
|
return viewModel;
|
|
119
121
|
}
|
|
122
|
+
|
|
123
|
+
return viewModel;
|
|
120
124
|
}
|
|
121
125
|
|
|
122
126
|
export default ColumnTranslator;
|
|
@@ -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) {
|
|
@@ -14,15 +14,14 @@ export default function RowTranslator(_ref) {
|
|
|
14
14
|
textOverflowConfig,
|
|
15
15
|
moduleName,
|
|
16
16
|
nameFieldsConfig,
|
|
17
|
-
recordReadStatusConfig
|
|
18
|
-
componentMapping
|
|
17
|
+
recordReadStatusConfig
|
|
19
18
|
} = _ref;
|
|
20
19
|
const actions = ClientActionsTranslator.transform(rowActions, instanceName, moduleName, { ...context,
|
|
21
20
|
record
|
|
22
21
|
});
|
|
23
22
|
return {
|
|
24
23
|
id: record.id,
|
|
25
|
-
columns: fields.map(field => ColumnTranslator(field, record, fieldComponentMapping, fieldActions, context, preferences, instanceName, textOverflowConfig, moduleName, nameFieldsConfig, recordReadStatusConfig
|
|
24
|
+
columns: fields.map(field => ColumnTranslator(field, record, fieldComponentMapping, fieldActions, context, preferences, instanceName, textOverflowConfig, moduleName, nameFieldsConfig, recordReadStatusConfig)),
|
|
26
25
|
rowActionLocation: {
|
|
27
26
|
type: rowActionsUiType,
|
|
28
27
|
actions
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import RowTranslator from "./Row";
|
|
2
2
|
export default class RowsTranslator {
|
|
3
|
-
constructor(records, fields, rowActions, context, preferences, fieldComponentMapping, rowActionsUiType, fieldActions, instanceName, textOverflowConfig, moduleName, nameFieldsConfig, recordReadStatusConfig
|
|
3
|
+
constructor(records, fields, rowActions, context, preferences, fieldComponentMapping, rowActionsUiType, fieldActions, instanceName, textOverflowConfig, moduleName, nameFieldsConfig, recordReadStatusConfig) {
|
|
4
4
|
this.records = records;
|
|
5
5
|
this.fields = fields;
|
|
6
6
|
this.rowActions = rowActions;
|
|
@@ -14,7 +14,6 @@ export default class RowsTranslator {
|
|
|
14
14
|
this.moduleName = moduleName;
|
|
15
15
|
this.nameFieldsConfig = nameFieldsConfig;
|
|
16
16
|
this.recordReadStatusConfig = recordReadStatusConfig;
|
|
17
|
-
this.componentMapping = componentMapping;
|
|
18
17
|
this.pipe = this.pipe.bind(this);
|
|
19
18
|
}
|
|
20
19
|
|
|
@@ -24,7 +23,6 @@ export default class RowsTranslator {
|
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
return this.records.map(record => RowTranslator({
|
|
27
|
-
componentMapping: this.componentMapping,
|
|
28
26
|
record,
|
|
29
27
|
fields: this.fields,
|
|
30
28
|
fieldComponentMapping: this.fieldComponentMapping,
|