@zohodesk/library-platform 1.1.12-exp.1 → 1.1.12-exp.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/es/bc/app-context/Properties.js +19 -0
  2. package/es/bc/float-pagination/ActionHandlers.js +1 -0
  3. package/es/bc/float-pagination/Constants.js +4 -0
  4. package/es/bc/float-pagination/Properties.js +18 -0
  5. package/es/bc/float-pagination/index.js +2 -0
  6. package/es/bc/index.js +0 -1
  7. package/es/bc/search/Constants.js +3 -0
  8. package/es/bc/search/EventHandlers.js +1 -0
  9. package/es/bc/search/Properties.js +11 -0
  10. package/es/bc/search/index.js +2 -0
  11. package/es/bc/zlist/Constants.js +0 -1
  12. package/es/bc/zlist/Types.js +10 -0
  13. package/es/bc/zrecord/Constants.js +1 -0
  14. package/es/bc/zrecord/Schemas.js +29 -0
  15. package/es/bc/zrecord/Types.js +45 -0
  16. package/es/cc/action-icon/Properties.js +20 -1
  17. package/es/cc/floating-pagination/Constants.js +6 -0
  18. package/es/cc/floating-pagination/Events.js +8 -0
  19. package/es/cc/floating-pagination/Properties.js +56 -0
  20. package/es/cc/floating-pagination/index.js +3 -0
  21. package/es/cc/ribbon/Properties.js +59 -0
  22. package/es/cc/ribbon/index.js +1 -0
  23. package/es/cc/table-connected/Properties.js +16 -0
  24. package/es/cc/table-connected/SdkContract.js +21 -0
  25. package/es/cc/table-connected/constants/Events.js +2 -0
  26. package/es/cc/table-list/Actions.js +0 -2
  27. package/es/cc/table-list/Constants.js +1 -1
  28. package/es/cc/table-list/Events.js +0 -2
  29. package/es/cc/table-list/Properties.js +34 -3
  30. package/es/library/behaviours/float-pagination/adapters/controllers/DestructController.js +18 -0
  31. package/es/library/behaviours/float-pagination/adapters/controllers/FloatPaginationController.js +25 -0
  32. package/es/library/behaviours/float-pagination/adapters/controllers/InitializeController.js +18 -0
  33. package/es/library/behaviours/float-pagination/adapters/controllers/ScrollBottomController.js +23 -0
  34. package/es/library/behaviours/float-pagination/adapters/controllers/ScrollTopController.js +23 -0
  35. package/es/library/behaviours/float-pagination/adapters/controllers/UpdateIndexController.js +30 -0
  36. package/es/library/behaviours/float-pagination/adapters/gateway/Repository.js +27 -0
  37. package/es/library/behaviours/float-pagination/adapters/gateway/Service.js +20 -0
  38. package/es/library/behaviours/float-pagination/adapters/presenter/Presenter.js +16 -0
  39. package/es/library/behaviours/float-pagination/applications/interfaces/input/ScrollTopInputModel.js +1 -0
  40. package/es/library/behaviours/float-pagination/applications/interfaces/input/ScrollbottomInputModel.js +1 -0
  41. package/es/library/behaviours/float-pagination/applications/interfaces/input/UpdateIndexInputModel.js +1 -0
  42. package/es/library/behaviours/float-pagination/applications/interfaces/output/FloatPaginationOutputModel.js +1 -0
  43. package/es/library/behaviours/float-pagination/applications/interfaces/output/IPresenter.js +1 -0
  44. package/es/library/behaviours/float-pagination/applications/usecases/DestructUsecase.js +15 -0
  45. package/es/library/behaviours/float-pagination/applications/usecases/FloatPaginationUseCase.js +31 -0
  46. package/es/library/behaviours/float-pagination/applications/usecases/InitializeUsecase.js +16 -0
  47. package/es/library/behaviours/float-pagination/applications/usecases/ScrollBottomUseCase.js +23 -0
  48. package/es/library/behaviours/float-pagination/applications/usecases/ScrollTopUseCase.js +23 -0
  49. package/es/library/behaviours/float-pagination/applications/usecases/UpdateIndexUseCase.js +28 -0
  50. package/es/library/behaviours/float-pagination/domain/entities/FloatPagination.js +28 -0
  51. package/es/library/behaviours/float-pagination/domain/entities/interfaces/IFloatPagination.js +1 -0
  52. package/es/library/behaviours/float-pagination/frameworks/ui/ActionsHandlerFactory.js +37 -0
  53. package/es/library/behaviours/float-pagination/frameworks/ui/FloatPaginationBehaviourFactory.js +21 -0
  54. package/es/library/behaviours/float-pagination/frameworks/utils.js +70 -0
  55. package/es/library/behaviours/keyboard-controls/adapters/gateways/Repository.js +2 -1
  56. package/es/library/behaviours/keyboard-controls/applications/usecases/SpacePress.js +1 -1
  57. package/es/library/behaviours/keyboard-controls/domain/entities/KeyboardControls.js +6 -1
  58. package/es/library/behaviours/list-selection/domain/entities/ListItemSelection.js +21 -18
  59. package/es/library/behaviours/search/adapters/controllers/AbstractController.js +9 -0
  60. package/es/library/behaviours/search/adapters/controllers/SearchController.js +26 -0
  61. package/es/library/behaviours/search/adapters/controllers/UpdatePropertiesController.js +27 -0
  62. package/es/library/behaviours/search/adapters/gateway/Repository.js +20 -0
  63. package/es/library/behaviours/search/adapters/gateway/Service.js +12 -0
  64. package/es/library/behaviours/{sort-by → search}/adapters/presenter/Presenter.js +2 -2
  65. package/es/library/behaviours/search/adapters/presenter/SearchTranslator.js +6 -0
  66. package/es/library/behaviours/search/applications/interfaces/UseCaseDependencies.js +1 -0
  67. package/es/library/behaviours/search/applications/interfaces/gateways/IRepository.js +1 -0
  68. package/es/library/behaviours/search/applications/interfaces/gateways/IService.js +1 -0
  69. package/es/library/behaviours/search/applications/interfaces/input/SearchInputModel.js +1 -0
  70. package/es/library/behaviours/search/applications/interfaces/input/UpdatePropertiesInputModel.js +1 -0
  71. package/es/library/behaviours/search/applications/interfaces/output/IPresenter.js +1 -0
  72. package/es/library/behaviours/search/applications/interfaces/output/SearchOutputModel.js +1 -0
  73. package/es/library/behaviours/search/applications/usecases/AbstractUseCase.js +17 -0
  74. package/es/library/behaviours/search/applications/usecases/SearchUseCase.js +28 -0
  75. package/es/library/behaviours/search/applications/usecases/UpdatePropertiesUsecase.js +25 -0
  76. package/es/library/behaviours/search/domain/entities/Search.js +23 -0
  77. package/es/library/behaviours/search/domain/entities/interfaces/ISearch.js +1 -0
  78. package/es/library/behaviours/search/frameworks/ui/EventHandlerFactory.js +25 -0
  79. package/es/library/behaviours/search/frameworks/ui/SearchStringStoreBehaviourFactory.js +26 -0
  80. package/es/library/custom-component/adapters/gateways/event-manager/EventManager.js +5 -0
  81. package/es/library/custom-component/domain/entities/ComponentProperties.js +1 -1
  82. package/es/library/custom-component/domain/entities/Logger.js +3 -3
  83. package/es/library/dot/components/action-location/frameworks/ui/ActionComponentMapping.js +3 -1
  84. package/es/library/dot/components/table-list/adapters/controllers/ScrollController.js +2 -2
  85. package/es/library/dot/components/table-list/adapters/controllers/index.js +0 -2
  86. package/es/library/dot/components/table-list/frameworks/ui/EventHandlersFactory.js +1 -2
  87. package/es/library/dot/components/table-list/frameworks/ui/TableListView.js +24 -1
  88. package/es/library/dot/components/table-list/frameworks/ui/css/TableList.module.css +19 -2
  89. package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/Row.js +1 -5
  90. package/es/library/dot/legacy-to-new-arch/action-icon/frameworks/ui/ActionIconView.js +5 -1
  91. package/es/library/dot/legacy-to-new-arch/floating-pagination/frameworks/ui/FloatingPagination.js +10 -0
  92. package/es/library/dot/legacy-to-new-arch/floating-pagination/frameworks/ui/FloatingPaginationView.js +47 -0
  93. package/es/library/dot/legacy-to-new-arch/radio-dropdown/frameworks/ui/RadioDropdownView.js +1 -0
  94. package/es/library/dot/legacy-to-new-arch/ribbon/frameworks/ui/Ribbon.js +10 -0
  95. package/es/library/dot/legacy-to-new-arch/ribbon/frameworks/ui/RibbonView.js +37 -0
  96. package/es/library/dot/legacy-to-new-arch/table-field-components/radio-dropdown-field/frameworks/ui/EventHandlersFactory.js +14 -0
  97. package/es/library/dot/legacy-to-new-arch/table-field-components/radio-dropdown-field/frameworks/ui/RadioDropdownField.js +17 -0
  98. package/es/library/dot/legacy-to-new-arch/table-field-components/radio-dropdown-field/frameworks/ui/RadioDropdownFieldView.js +1 -1
  99. package/es/library/dot/legacy-to-new-arch/table-field-components/tags-list-dropdown-field/frameworks/ui/TagsListDropdownField.js +33 -1
  100. package/es/library/dot/legacy-to-new-arch/table-field-components/tags-list-dropdown-field/frameworks/ui/TagsListDropdownFieldView.js +1 -1
  101. package/es/platform/components/table-connected/adapters/controllers/ScrollController.js +29 -8
  102. package/es/platform/components/table-connected/adapters/controllers/ScrollEndReachedController.js +23 -0
  103. package/es/platform/components/table-connected/adapters/resources/SmartTableResource.js +169 -8
  104. package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +37 -6
  105. package/es/platform/components/table-connected/frameworks/TableConnectedFactory.js +2 -1
  106. package/es/platform/components/table-connected/frameworks/TableConnectedView.js +2 -0
  107. package/es/platform/data-source/http-template/getComponentMapping.js +1 -1
  108. package/es/platform/data-source/http-template/getRecords.js +1 -0
  109. package/es/platform/data-source/http-template/getSingleRecord.js +51 -0
  110. package/es/platform/zform/adapters/controllers/GetInitialRecordSuccessController.js +31 -0
  111. package/es/platform/zform/applications/interfaces/input/GetInitialRecordSuccessUseCaseInputModel.js +1 -0
  112. package/es/platform/zform/applications/usecases/GetInitialRecordSuccessUseCase.js +132 -0
  113. package/es/platform/zlist/adapters/controllers/RefreshRecordsRequestedController.js +21 -0
  114. package/es/platform/zlist/adapters/controllers/SortController.js +2 -2
  115. package/es/platform/zlist/adapters/gateways/Repository.js +6 -11
  116. package/es/platform/zlist/adapters/gateways/Service.js +2 -0
  117. package/es/platform/zlist/adapters/presenters/TableTranslator.js +41 -13
  118. package/es/platform/zlist/adapters/presenters/translators/ColumnTranslator.js +15 -3
  119. package/es/platform/zlist/adapters/presenters/translators/Header.js +29 -21
  120. package/es/platform/zlist/adapters/presenters/translators/HeadersTranslator.js +3 -3
  121. package/es/platform/zlist/adapters/presenters/translators/Row.js +14 -1
  122. package/es/platform/zlist/adapters/presenters/translators/fields/DateFieldTranslator.js +21 -3
  123. package/es/platform/zlist/adapters/presenters/translators/fields/DateTimeFieldTranslator.js +21 -3
  124. package/es/platform/zlist/adapters/presenters/translators/fields/PhoneFieldTranslator.js +17 -1
  125. package/es/platform/zlist/adapters/presenters/utils/DateAndTimeFormat.js +25 -0
  126. package/es/platform/zlist/adapters/presenters/utils/DefaultClientActions.js +7 -4
  127. package/es/platform/zlist/applications/entities-factory/ListFactory.js +2 -2
  128. package/es/platform/zlist/applications/interfaces/input/GetSortConfigUseCaseInputModel.js +1 -0
  129. package/es/platform/zlist/applications/interfaces/input/RefreshRecordsRequestedUseCaseInputModel.js +1 -0
  130. package/es/platform/zlist/applications/interfaces/input/SetSortConfigUseCaseInputModel.js +1 -0
  131. package/es/platform/zlist/applications/usecases/GetSortConfigUseCase.js +17 -0
  132. package/es/platform/zlist/applications/usecases/RecordSuccessCallbackUsecase.js +1 -1
  133. package/es/platform/zlist/applications/usecases/RefreshRecordsRequestedUseCase.js +17 -0
  134. package/es/platform/zlist/applications/usecases/SetSortConfigUseCase.js +26 -0
  135. package/es/platform/zlist/applications/usecases/SortUseCase.js +6 -6
  136. package/es/platform/zlist/domain/entities/List.js +27 -15
  137. package/es/platform/zlist/domain/entities/interfaces/Properties.js +5 -5
  138. package/es/platform/zlist/frameworks/EventHandlersFactory.js +3 -4
  139. package/es/platform/zlist/frameworks/ZListBehaviourFactory.js +2 -5
  140. package/es/platform/zrecord/adapters/controllers/UpdateRecordController.js +30 -0
  141. package/es/platform/zrecord/adapters/gateways/Repository.js +5 -2
  142. package/es/platform/zrecord/applications/entities-factory/RecordsManagerFactory.js +2 -2
  143. package/es/platform/zrecord/applications/interfaces/input/ClearAllFiltersUseCaseInputModel.js +1 -0
  144. package/es/platform/zrecord/applications/interfaces/input/GetFilterConditionUseCaseInputModel.js +1 -0
  145. package/es/platform/zrecord/applications/interfaces/input/GetFilterConfigUseCaseInputModel.js +1 -0
  146. package/es/platform/zrecord/applications/interfaces/input/RefreshRecordsUseCaseInputModel.js +1 -0
  147. package/es/platform/zrecord/applications/interfaces/input/SetFilterUseCaseInputModel.js +1 -0
  148. package/es/platform/zrecord/applications/interfaces/input/UpdateRecordInputModel.js +0 -0
  149. package/es/platform/zrecord/applications/usecases/ClearAllFiltersUseCase.js +24 -0
  150. package/es/platform/zrecord/applications/usecases/GetFilterConditionUseCase.js +15 -0
  151. package/es/platform/zrecord/applications/usecases/GetFilterConfigUseCase.js +15 -0
  152. package/es/platform/zrecord/applications/usecases/RefreshRecordsUseCase.js +14 -0
  153. package/es/platform/zrecord/applications/usecases/SetFilterUseCase.js +24 -0
  154. package/es/platform/zrecord/applications/usecases/UpdateRecordUseCase.js +30 -0
  155. package/es/platform/zrecord/domain/entities/Filter.js +247 -0
  156. package/es/platform/zrecord/domain/entities/RecordsManager.js +19 -1
  157. package/es/platform/zrecord/domain/entities/interfaces/IFilter.js +1 -0
  158. package/es/platform/zrecord/frameworks/RecordBehaviourFactory.js +11 -1
  159. package/package.json +20 -20
  160. package/es/bc/sort-by/ActionHandlers.js +0 -1
  161. package/es/bc/sort-by/Constants.js +0 -2
  162. package/es/bc/sort-by/Properties.js +0 -26
  163. package/es/bc/sort-by/SortOrderEnum.js +0 -8
  164. package/es/bc/sort-by/index.js +0 -2
  165. package/es/library/behaviours/sort-by/adapters/controllers/SortBy.js +0 -28
  166. package/es/library/behaviours/sort-by/adapters/gateway/Repository.js +0 -19
  167. package/es/library/behaviours/sort-by/adapters/gateway/Service.js +0 -10
  168. package/es/library/behaviours/sort-by/applications/usecases/SortBy.js +0 -28
  169. package/es/library/behaviours/sort-by/domain/entities/SortBy.js +0 -42
  170. package/es/library/behaviours/sort-by/frameworks/ui/ActionsHandlerFactory.js +0 -23
  171. package/es/library/behaviours/sort-by/frameworks/ui/DemoBehaviour.js +0 -20
  172. package/es/library/behaviours/sort-by/frameworks/ui/SortByBehaviourFactory.js +0 -24
  173. package/es/library/dot/components/table-list/adapters/controllers/SortByController.js +0 -25
  174. package/es/library/dot/components/table-list/adapters/controllers/SortedController.js +0 -18
  175. package/es/library/dot/components/table-list/frameworks/ui/handlers/HandleSortClick.js +0 -12
  176. package/es/platform/zlist/adapters/gateways/SortBy.js +0 -38
  177. package/es/platform/zlist/domain/entities/SortBy.js +0 -58
  178. /package/es/{library/behaviours/sort-by/applications/interfaces/UseCaseDependencies.js → bc/float-pagination/types/FloatPaginationBehaviourState.js} +0 -0
  179. /package/es/{library/behaviours/sort-by/applications/interfaces/gateways/IRepository.js → bc/list-selection/Types.js} +0 -0
  180. /package/es/{library/behaviours/sort-by/applications/interfaces/gateways/IService.js → cc/table-list/data-types/FloatPaginationConfig.js} +0 -0
  181. /package/es/library/behaviours/{sort-by → float-pagination}/adapters/controllers/AbstractController.js +0 -0
  182. /package/es/library/behaviours/{sort-by/applications/interfaces/input/SortByInputModel.js → float-pagination/applications/interfaces/UseCaseDependencies.js} +0 -0
  183. /package/es/library/behaviours/{sort-by/applications/interfaces/output/IPresenter.js → float-pagination/applications/interfaces/gateways/IRepository.js} +0 -0
  184. /package/es/library/behaviours/{sort-by/applications/interfaces/output/SortByOutputModel.js → float-pagination/applications/interfaces/gateways/IService.js} +0 -0
  185. /package/es/library/behaviours/{sort-by/domain/entities/interfaces/ISortBy.js → float-pagination/applications/interfaces/input/DestructInputModel.js} +0 -0
  186. /package/es/{platform/zlist/applications/interfaces/gateways/ISortBy.js → library/behaviours/float-pagination/applications/interfaces/input/FloatPaginationInputModel.js} +0 -0
  187. /package/es/{platform/zlist/domain/entities/interfaces/ISortBy.js → library/behaviours/float-pagination/applications/interfaces/input/InitializeInputModel.js} +0 -0
  188. /package/es/library/behaviours/{sort-by → float-pagination}/applications/usecases/AbstractUseCase.js +0 -0
@@ -11,10 +11,10 @@ class SortController extends AbstractController {
11
11
  action,
12
12
  dispatch
13
13
  } = event;
14
- const sortBy = action.payload;
14
+ const sortConfig = action.payload;
15
15
  sortUseCase.updateDependency(state, updateState);
16
16
  sortUseCase.execute({
17
- sortBy,
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
- sortBy,
20
+ zlist
21
+ } = this.state.behaviours;
22
+ const {
23
+ sortConfig,
22
24
  errorState,
23
25
  isReOrderLoading,
24
26
  limit
25
- } = this.getZListState();
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
- sortBy: new SortBy(sortBy.id, sortBy.name, sortBy.order),
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
 
@@ -34,7 +35,8 @@ export default class TableTranslator {
34
35
  localStorage: localStorageBehaviour,
35
36
  columnResizer,
36
37
  keyboardControls,
37
- textOverflow
38
+ textOverflow,
39
+ floatPagination
38
40
  } = behaviours;
39
41
  const {
40
42
  resizeConfig,
@@ -42,7 +44,8 @@ export default class TableTranslator {
42
44
  keyboardControlsConfig,
43
45
  nameFieldsConfig,
44
46
  textOverflowConfig,
45
- recordReadStatusConfig
47
+ recordReadStatusConfig,
48
+ floatPaginationConfig
46
49
  } = properties;
47
50
  const {
48
51
  modules
@@ -58,11 +61,10 @@ export default class TableTranslator {
58
61
  } = fallbackToDefault(behaviours, {}); // FIX: behaviours should be available by default
59
62
 
60
63
  const {
61
- sortBy,
64
+ sortConfig,
62
65
  errorState,
63
66
  isReOrderLoading
64
- } = fallbackToDefault(zlist, {}); // FIX: zlist should be available by default
65
-
67
+ } = zlist;
66
68
  const {
67
69
  focussedIndex
68
70
  } = fallbackToDefault(keyboardControls, {}); // FIX: KeyboardControls should be available by default
@@ -82,7 +84,6 @@ export default class TableTranslator {
82
84
  isFetching: isClientScriptsFetching
83
85
  } = fallbackToDefault(zclientScriptsEventMapping, {});
84
86
  const fieldComponentMapping = fallbackToDefault(componentMapping.fields, {});
85
- const rowActionsUiType = componentMapping.rowActionsComponentName;
86
87
  const {
87
88
  shouldClearRecords: isRecordsShouldBeEmptied,
88
89
  canErrorPage: isError
@@ -125,20 +126,35 @@ export default class TableTranslator {
125
126
  mode: textOverflow.mode
126
127
  }; // ComponentMapping support
127
128
 
128
- zfield.componentMapping && zfield.componentMapping.length && zfield.componentMapping.forEach(fieldVariation => {
129
+ const componentMappingFromApi = Array.isArray(zfield.componentMapping) ? zfield.componentMapping : [];
130
+ let emptyStateUiType = componentMapping.emptyState || '';
131
+ let rowActionsUiType = componentMapping.rowActionsComponentName;
132
+ componentMappingFromApi.forEach(fieldVariation => {
129
133
  const {
130
134
  fieldName,
131
135
  uiType,
132
- translator
136
+ translator,
137
+ contractType
133
138
  } = fieldVariation;
139
+
140
+ if (contractType === 'EmptyState') {
141
+ emptyStateUiType = uiType;
142
+ return;
143
+ }
144
+
145
+ if (contractType === 'RowActionsMenu') {
146
+ rowActionsUiType = uiType;
147
+ return;
148
+ }
149
+
134
150
  const field = fields.find(f => f.name === fieldName);
135
151
 
136
152
  if (field) {
137
153
  field.uiType = uiType;
138
154
  }
139
155
  });
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);
156
+ const headersTranslator = new HeadersTranslator(fields, headerActions, context, modifiedWidths, sortConfig, records, instanceName, moduleName);
157
+ const rowsTranslator = new RowsTranslator(recordsForDisplay, fields, rowActions, context, preferences, fieldComponentMapping, rowActionsUiType, fieldActions, instanceName, textOverflowData, moduleName, nameFieldsConfig, recordReadStatusConfig, Array.isArray(zfield.componentMapping) ? [...zfield.componentMapping] : []); // const actionTranslator = new ClientActionsTranslator(clientActions, records, fields, pageContext);
142
158
  // const translators = [headersTranslator.getTranslator(), rowsTranslator.getTranslator(), actionTranslator.getTranslator()];
143
159
 
144
160
  const translators = [headersTranslator.getTranslator(), rowsTranslator.getTranslator()];
@@ -153,7 +169,10 @@ export default class TableTranslator {
153
169
  isError,
154
170
  selection: SelectionTranslator(state),
155
171
  focussedRow: focussedIndex,
156
- sortBy,
172
+ sortBy: sortConfig ? {
173
+ name: sortConfig.fieldName,
174
+ order: sortConfig.order === SortModelOrder.ASC ? SortedBy.Ascending : sortConfig.order === SortModelOrder.DES ? SortedBy.Descending : SortedBy.None
175
+ } : {},
157
176
  rowCursor,
158
177
  resizerState: ResizerStateTranslator({
159
178
  columnResizer: columnResizer,
@@ -168,9 +187,18 @@ export default class TableTranslator {
168
187
  },
169
188
  keyboardControlsConfig,
170
189
  textOverflowConfig: textOverflowData,
190
+ floatPaginationConfig: { ...floatPaginationConfig,
191
+ scrollCount: floatPagination.currentRecord,
192
+ totalCount: records?.length !== undefined ? records.length : 0,
193
+ scrollToUpTooltip: floatPagination.scrollToUpTooltip,
194
+ scrollToDownTooltip: floatPagination.scrollToDownTooltip,
195
+ isTopReached: false,
196
+ isBottomReached: floatPagination.currentRecord === records?.length,
197
+ isVisible: floatPagination.isVisible
198
+ },
171
199
  isLoading,
172
200
  isReOrderLoading,
173
- emptyStateUiType: componentMapping.emptyState || '',
201
+ emptyStateUiType,
174
202
  data: fields.length ? data : {
175
203
  headers: EMPTY_ARRAY,
176
204
  rows: EMPTY_ARRAY
@@ -3,7 +3,21 @@ import * as FieldTranslators from "./fields";
3
3
  import ClientActionsTranslator from "../../../../client-actions/translators/client-actions-translator";
4
4
  import { isValidFieldVariation } from "./FieldVariations";
5
5
 
6
- function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, context, preferences, instanceName, moduleName, textOverflowConfig, nameFieldsConfig, recordReadStatusConfig, componentMapping) {
6
+ function ColumnTranslator(_ref) {
7
+ let {
8
+ field,
9
+ record,
10
+ fieldComponentMapping,
11
+ fieldActions,
12
+ context,
13
+ preferences,
14
+ instanceName,
15
+ moduleName,
16
+ textOverflowConfig,
17
+ nameFieldsConfig,
18
+ recordReadStatusConfig,
19
+ componentMapping
20
+ } = _ref;
7
21
  const {
8
22
  isCustomField,
9
23
  name,
@@ -111,8 +125,6 @@ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, co
111
125
  }
112
126
  };
113
127
  }
114
-
115
- ;
116
128
  }
117
129
 
118
130
  return viewModel;
@@ -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 { SortOrder } from "../../../../zlist/domain/entities/interfaces/Properties";
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, sortBy, records, instanceName, moduleName) {
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.id, sortBy)
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(id, sortBy) {
35
- const newSortBy = { ...sortBy,
36
- tooltip: ''
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 (sortBy.id === id) {
40
- if (sortBy.order === SortOrder.ASC) {
41
- // newSortBy.tooltip = 'Click to Sort Descending';
42
- newSortBy.tooltip = i18NProviderUtils.getI18NValue("support.localization.tooltip.descending");
43
- } else if (newSortBy.order === SortOrder.DES) {
44
- // newSortBy.tooltip = 'Click to Sort Ascending';
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 newSortBy;
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, sortBy, records, instanceName, moduleName) {
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.sortBy = sortBy;
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.sortBy, this.records, this.instanceName, this.moduleName));
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) {
@@ -22,7 +22,20 @@ export default function RowTranslator(_ref) {
22
22
  });
23
23
  return {
24
24
  id: record.id,
25
- columns: fields.map(field => ColumnTranslator(field, record, fieldComponentMapping, fieldActions, context, preferences, instanceName, textOverflowConfig, moduleName, nameFieldsConfig, recordReadStatusConfig, componentMapping.find(item => item.fieldName === field.name))),
25
+ columns: fields.map(field => ColumnTranslator({
26
+ field,
27
+ record,
28
+ fieldComponentMapping,
29
+ fieldActions,
30
+ context,
31
+ preferences,
32
+ instanceName,
33
+ moduleName,
34
+ textOverflowConfig,
35
+ nameFieldsConfig,
36
+ recordReadStatusConfig,
37
+ componentMapping: componentMapping.find(item => item.fieldName === field.name)
38
+ })),
26
39
  rowActionLocation: {
27
40
  type: rowActionsUiType,
28
41
  actions
@@ -1,5 +1,6 @@
1
1
  // import FieldModel from '@platform/zfield/entities/interfaces/FieldModel';
2
2
  import FieldTypes from "../../../../../../cc/fields/field/Types";
3
+ import { DateAndTimeFormat } from "../../utils/DateAndTimeFormat";
3
4
 
4
5
  const DateFieldTranslator = _ref => {
5
6
  let {
@@ -7,12 +8,29 @@ const DateFieldTranslator = _ref => {
7
8
  value,
8
9
  appendToActionPayload,
9
10
  textOverflowMode,
10
- isRead
11
+ isRead,
12
+ context
11
13
  } = _ref;
12
14
  const {
13
15
  uiType,
14
16
  name
15
17
  } = field;
18
+ const {
19
+ dateFormat,
20
+ timeFormat,
21
+ delimiter,
22
+ isShortenDateTimeInfo
23
+ } = context.dateTimeFormat; // const appContext = platformSDK.app.getContext();
24
+ // const { dateFormat, timeFormat, delimiter } = appContext.dateTimeFormat;
25
+
26
+ const newDateValue = DateAndTimeFormat({
27
+ dateFormatType: dateFormat,
28
+ timeFormatType: timeFormat,
29
+ delimiter: delimiter,
30
+ value,
31
+ isDateTimeField: false,
32
+ isShortenDateTimeInfo
33
+ });
16
34
 
17
35
  switch (uiType) {
18
36
  case FieldTypes.TextField:
@@ -20,10 +38,10 @@ const DateFieldTranslator = _ref => {
20
38
  return {
21
39
  type: FieldTypes.TextField,
22
40
  fieldName: name,
23
- text: value,
41
+ text: newDateValue,
24
42
  isDotted: textOverflowMode === 'clip',
25
43
  weight: isRead ? undefined : 'bold',
26
- tooltip: value,
44
+ tooltip: newDateValue,
27
45
  appendToActionPayload,
28
46
  isRead,
29
47
  textOverflowMode
@@ -1,5 +1,6 @@
1
1
  // import FieldModel from '@platform/zfield/entities/interfaces/FieldModel';
2
2
  import FieldTypes from "../../../../../../cc/fields/field/Types";
3
+ import { DateAndTimeFormat } from "../../utils/DateAndTimeFormat";
3
4
 
4
5
  const DateTimeFieldTranslator = _ref => {
5
6
  let {
@@ -7,12 +8,29 @@ const DateTimeFieldTranslator = _ref => {
7
8
  value,
8
9
  appendToActionPayload,
9
10
  textOverflowMode,
10
- isRead
11
+ isRead,
12
+ context
11
13
  } = _ref;
12
14
  const {
13
15
  uiType,
14
16
  name
15
17
  } = field;
18
+ const {
19
+ dateFormat,
20
+ timeFormat,
21
+ delimiter,
22
+ isShortenDateTimeInfo
23
+ } = context.dateTimeFormat; // const appContext = platformSDK.app.getContext();
24
+ // const { dateFormat, timeFormat, delimiter } = appContext.dateTimeFormat;
25
+
26
+ const newDateValue = DateAndTimeFormat({
27
+ dateFormatType: dateFormat,
28
+ timeFormatType: timeFormat,
29
+ delimiter: delimiter,
30
+ value,
31
+ isDateTimeField: true,
32
+ isShortenDateTimeInfo
33
+ });
16
34
 
17
35
  switch (uiType) {
18
36
  case FieldTypes.TextField:
@@ -20,10 +38,10 @@ const DateTimeFieldTranslator = _ref => {
20
38
  return {
21
39
  type: FieldTypes.TextField,
22
40
  fieldName: name,
23
- text: value,
41
+ text: newDateValue,
24
42
  isDotted: textOverflowMode === 'clip',
25
43
  weight: isRead ? undefined : 'bold',
26
- tooltip: value,
44
+ tooltip: newDateValue,
27
45
  appendToActionPayload,
28
46
  isRead,
29
47
  textOverflowMode
@@ -16,7 +16,6 @@ const PhoneFieldTranslator = _ref => {
16
16
 
17
17
  switch (uiType) {
18
18
  case FieldTypes.TextField:
19
- default:
20
19
  return {
21
20
  type: FieldTypes.TextField,
22
21
  fieldName: name,
@@ -28,6 +27,23 @@ const PhoneFieldTranslator = _ref => {
28
27
  isRead,
29
28
  textOverflowMode
30
29
  };
30
+
31
+ case FieldTypes.LinkField:
32
+ default:
33
+ return {
34
+ type: FieldTypes.LinkField,
35
+ fieldName: name,
36
+ text: value,
37
+ variant: 'secondary',
38
+ href: `tel:${value}`,
39
+ opensNewTab: true,
40
+ isDotted: textOverflowMode === 'clip',
41
+ weight: isRead ? undefined : 'bold',
42
+ tooltip: value,
43
+ appendToActionPayload,
44
+ isRead,
45
+ textOverflowMode
46
+ };
31
47
  }
32
48
  };
33
49
 
@@ -0,0 +1,25 @@
1
+ import { i18NProviderUtils } from '@zohodesk/i18n';
2
+ export function DateAndTimeFormat(_ref) {
3
+ let {
4
+ value,
5
+ isDateTimeField,
6
+ isShortenDateTimeInfo
7
+ } = _ref;
8
+ const date = value instanceof Date ? value : new Date(value);
9
+ if (isNaN(date.getTime())) return '';
10
+ const formattedDate = i18NProviderUtils.userDateFormat(date, {}, '', '', false, _ref2 => {
11
+ let {
12
+ dateFormat,
13
+ dateTimeFormat,
14
+ timeFormat
15
+ } = _ref2;
16
+ const isCurrentDate = date.toDateString() === new Date().toDateString();
17
+
18
+ if (isDateTimeField && isShortenDateTimeInfo && isCurrentDate) {
19
+ return timeFormat;
20
+ }
21
+
22
+ return isDateTimeField ? dateTimeFormat : dateFormat;
23
+ });
24
+ return formattedDate;
25
+ }
@@ -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: 'Ascending',
26
- descendingLabel: 'Descending'
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: 'SORT#CLICKED',
35
- targetEvent: 'SMART_TABLE#SORT',
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
- sortBy,
7
+ sortConfig,
8
8
  query,
9
9
  context,
10
10
  errorState,
11
11
  isReOrderLoading
12
12
  } = input;
13
- return new List(limit, sortBy, query, context, isReOrderLoading, errorState);
13
+ return new List(limit, sortConfig, query, context, isReOrderLoading, errorState);
14
14
  }
15
15
 
16
16
  }
@@ -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;
@@ -36,7 +36,7 @@ class RecordSuccessCallbackUsecase extends AbstractUseCase {
36
36
  }
37
37
 
38
38
  if (list.isAcknowledgeBySortBy(metaData)) {
39
- list.setSortBy(metaData);
39
+ list.setSortConfig(metaData);
40
40
  presenter.updateView(list.toObject());
41
41
  }
42
42
  }
@@ -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;