@zohodesk/library-platform 1.1.12-exp.2 → 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 (187) 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/search/Constants.js +3 -0
  7. package/es/bc/search/EventHandlers.js +1 -0
  8. package/es/bc/search/Properties.js +11 -0
  9. package/es/bc/search/index.js +2 -0
  10. package/es/cc/action-icon/Properties.js +20 -1
  11. package/es/cc/checkbox/Properties.js +2 -1
  12. package/es/cc/email/Properties.js +8 -0
  13. package/es/cc/fields/field/Types.js +31 -23
  14. package/es/cc/fields/lookup/Properties.js +26 -10
  15. package/es/cc/floating-pagination/Constants.js +6 -0
  16. package/es/cc/floating-pagination/Events.js +8 -0
  17. package/es/cc/floating-pagination/Properties.js +56 -0
  18. package/es/cc/floating-pagination/index.js +3 -0
  19. package/es/cc/highlighted-value/Properties.js +18 -0
  20. package/es/cc/link/Properties.js +13 -3
  21. package/es/cc/ribbon/Properties.js +59 -0
  22. package/es/cc/ribbon/index.js +1 -0
  23. package/es/cc/switch/Properties.js +2 -2
  24. package/es/cc/table-connected/Properties.js +16 -0
  25. package/es/cc/table-list/Constants.js +1 -0
  26. package/es/cc/table-list/Properties.js +35 -35
  27. package/es/cc/tags/Data.js +0 -6
  28. package/es/cc/tags/model/index.js +1 -1
  29. package/es/library/behaviours/float-pagination/adapters/controllers/DestructController.js +18 -0
  30. package/es/library/behaviours/float-pagination/adapters/controllers/FloatPaginationController.js +25 -0
  31. package/es/library/behaviours/float-pagination/adapters/controllers/InitializeController.js +18 -0
  32. package/es/library/behaviours/float-pagination/adapters/controllers/ScrollBottomController.js +23 -0
  33. package/es/library/behaviours/float-pagination/adapters/controllers/ScrollTopController.js +23 -0
  34. package/es/library/behaviours/float-pagination/adapters/controllers/UpdateIndexController.js +30 -0
  35. package/es/library/behaviours/float-pagination/adapters/gateway/Repository.js +27 -0
  36. package/es/library/behaviours/float-pagination/adapters/gateway/Service.js +20 -0
  37. package/es/library/behaviours/float-pagination/adapters/presenter/Presenter.js +16 -0
  38. package/es/library/behaviours/float-pagination/applications/interfaces/input/ScrollTopInputModel.js +1 -0
  39. package/es/library/behaviours/float-pagination/applications/interfaces/input/ScrollbottomInputModel.js +1 -0
  40. package/es/library/behaviours/float-pagination/applications/interfaces/input/UpdateIndexInputModel.js +1 -0
  41. package/es/library/behaviours/float-pagination/applications/interfaces/output/FloatPaginationOutputModel.js +1 -0
  42. package/es/library/behaviours/float-pagination/applications/interfaces/output/IPresenter.js +1 -0
  43. package/es/library/behaviours/float-pagination/applications/usecases/DestructUsecase.js +15 -0
  44. package/es/library/behaviours/float-pagination/applications/usecases/FloatPaginationUseCase.js +31 -0
  45. package/es/library/behaviours/float-pagination/applications/usecases/InitializeUsecase.js +16 -0
  46. package/es/library/behaviours/float-pagination/applications/usecases/ScrollBottomUseCase.js +23 -0
  47. package/es/library/behaviours/float-pagination/applications/usecases/ScrollTopUseCase.js +23 -0
  48. package/es/library/behaviours/float-pagination/applications/usecases/UpdateIndexUseCase.js +28 -0
  49. package/es/library/behaviours/float-pagination/domain/entities/FloatPagination.js +28 -0
  50. package/es/library/behaviours/float-pagination/domain/entities/interfaces/IFloatPagination.js +1 -0
  51. package/es/library/behaviours/float-pagination/frameworks/ui/ActionsHandlerFactory.js +37 -0
  52. package/es/library/behaviours/float-pagination/frameworks/ui/FloatPaginationBehaviourFactory.js +21 -0
  53. package/es/library/behaviours/float-pagination/frameworks/utils.js +70 -0
  54. package/es/library/behaviours/keyboard-controls/adapters/gateways/Repository.js +2 -1
  55. package/es/library/behaviours/keyboard-controls/applications/usecases/SpacePress.js +1 -1
  56. package/es/library/behaviours/keyboard-controls/domain/entities/KeyboardControls.js +6 -1
  57. package/es/library/behaviours/list-selection/domain/entities/ListItemSelection.js +21 -18
  58. package/es/library/behaviours/search/adapters/controllers/AbstractController.js +9 -0
  59. package/es/library/behaviours/search/adapters/controllers/SearchController.js +26 -0
  60. package/es/library/behaviours/search/adapters/controllers/UpdatePropertiesController.js +27 -0
  61. package/es/library/behaviours/search/adapters/gateway/Repository.js +20 -0
  62. package/es/library/behaviours/search/adapters/gateway/Service.js +12 -0
  63. package/es/library/behaviours/{sort-by → search}/adapters/presenter/Presenter.js +2 -2
  64. package/es/library/behaviours/search/adapters/presenter/SearchTranslator.js +6 -0
  65. package/es/library/behaviours/search/applications/interfaces/UseCaseDependencies.js +1 -0
  66. package/es/library/behaviours/search/applications/interfaces/gateways/IRepository.js +1 -0
  67. package/es/library/behaviours/search/applications/interfaces/gateways/IService.js +1 -0
  68. package/es/library/behaviours/search/applications/interfaces/input/SearchInputModel.js +1 -0
  69. package/es/library/behaviours/search/applications/interfaces/input/UpdatePropertiesInputModel.js +1 -0
  70. package/es/library/behaviours/search/applications/interfaces/output/IPresenter.js +1 -0
  71. package/es/library/behaviours/search/applications/interfaces/output/SearchOutputModel.js +1 -0
  72. package/es/library/behaviours/search/applications/usecases/AbstractUseCase.js +17 -0
  73. package/es/library/behaviours/search/applications/usecases/SearchUseCase.js +28 -0
  74. package/es/library/behaviours/search/applications/usecases/UpdatePropertiesUsecase.js +25 -0
  75. package/es/library/behaviours/search/domain/entities/Search.js +23 -0
  76. package/es/library/behaviours/search/domain/entities/interfaces/ISearch.js +1 -0
  77. package/es/library/behaviours/search/frameworks/ui/EventHandlerFactory.js +25 -0
  78. package/es/library/behaviours/search/frameworks/ui/SearchStringStoreBehaviourFactory.js +26 -0
  79. package/es/library/custom-component/adapters/gateways/event-manager/EventManager.js +5 -0
  80. package/es/library/custom-component/domain/entities/ComponentProperties.js +1 -1
  81. package/es/library/custom-component/domain/entities/Logger.js +3 -3
  82. package/es/library/dot/components/action-location/frameworks/ui/ActionComponentMapping.js +3 -1
  83. package/es/library/dot/components/table-list/adapters/controllers/ScrollController.js +2 -2
  84. package/es/library/dot/components/table-list/frameworks/ui/TableListView.js +24 -1
  85. package/es/library/dot/components/table-list/frameworks/ui/css/TableList.module.css +19 -2
  86. package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/Row.js +4 -6
  87. package/es/library/dot/legacy-to-new-arch/action-icon/frameworks/ui/ActionIconView.js +5 -1
  88. package/es/library/dot/legacy-to-new-arch/email/frameworks/ui/EmailView.js +4 -2
  89. package/es/library/dot/legacy-to-new-arch/floating-pagination/frameworks/ui/FloatingPagination.js +10 -0
  90. package/es/library/dot/legacy-to-new-arch/floating-pagination/frameworks/ui/FloatingPaginationView.js +47 -0
  91. package/es/library/dot/legacy-to-new-arch/highlighted-value/frameworks/ui/HighlightedValueView.js +6 -1
  92. package/es/library/dot/legacy-to-new-arch/index.js +1 -0
  93. package/es/library/dot/legacy-to-new-arch/link/frameworks/ui/LinkView.js +4 -2
  94. package/es/library/dot/legacy-to-new-arch/radio-dropdown/frameworks/ui/RadioDropdownView.js +1 -0
  95. package/es/library/dot/legacy-to-new-arch/ribbon/frameworks/ui/Ribbon.js +10 -0
  96. package/es/library/dot/legacy-to-new-arch/ribbon/frameworks/ui/RibbonView.js +37 -0
  97. package/es/library/dot/legacy-to-new-arch/table-field-components/checkbox-field/frameworks/ui/CheckboxField.js +12 -2
  98. package/es/library/dot/legacy-to-new-arch/table-field-components/checkbox-field/frameworks/ui/CheckboxFieldView.js +8 -5
  99. package/es/library/dot/legacy-to-new-arch/table-field-components/checkbox-field/frameworks/ui/EventHandlersFactory.js +3 -3
  100. package/es/library/dot/legacy-to-new-arch/table-field-components/email-field/frameworks/ui/EmailField.js +3 -3
  101. package/es/library/dot/legacy-to-new-arch/table-field-components/email-field/frameworks/ui/EmailFieldView.js +8 -6
  102. package/es/library/dot/legacy-to-new-arch/table-field-components/index.js +22 -5
  103. package/es/library/dot/legacy-to-new-arch/table-field-components/lookup-field/frameworks/ui/LookupFieldView.js +1 -1
  104. package/es/library/dot/legacy-to-new-arch/table-field-components/phone-field/frameworks/ui/PhoneFieldView.js +1 -1
  105. package/es/library/dot/legacy-to-new-arch/table-field-components/radio-dropdown-field/frameworks/ui/EventHandlersFactory.js +14 -0
  106. package/es/library/dot/legacy-to-new-arch/table-field-components/radio-dropdown-field/frameworks/ui/RadioDropdownField.js +17 -0
  107. package/es/library/dot/legacy-to-new-arch/table-field-components/radio-dropdown-field/frameworks/ui/RadioDropdownFieldView.js +1 -1
  108. package/es/library/dot/legacy-to-new-arch/table-field-components/switch-field/frameworks/ui/EventHandlersFactory.js +3 -3
  109. package/es/library/dot/legacy-to-new-arch/table-field-components/switch-field/frameworks/ui/SwitchField.js +14 -4
  110. package/es/library/dot/legacy-to-new-arch/table-field-components/switch-field/frameworks/ui/SwitchFieldView.js +8 -4
  111. package/es/library/dot/legacy-to-new-arch/table-field-components/tags-list-dropdown-field/frameworks/ui/TagsListDropdownField.js +33 -1
  112. package/es/library/dot/legacy-to-new-arch/table-field-components/tags-list-dropdown-field/frameworks/ui/TagsListDropdownFieldView.js +1 -1
  113. package/es/library/dot/legacy-to-new-arch/table-field-components/url-field/frameworks/ui/UrlFieldView.js +1 -1
  114. package/es/platform/components/table-connected/adapters/controllers/ScrollController.js +29 -8
  115. package/es/platform/components/table-connected/adapters/controllers/ScrollEndReachedController.js +23 -0
  116. package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +26 -4
  117. package/es/platform/components/table-connected/frameworks/TableConnectedFactory.js +2 -1
  118. package/es/platform/components/table-connected/frameworks/TableConnectedView.js +2 -0
  119. package/es/platform/data-source/http-template/fetchLookupFields.js +6 -0
  120. package/es/platform/data-source/http-template/getComponentMapping.js +1 -1
  121. package/es/platform/data-source/http-template/getSingleRecord.js +51 -0
  122. package/es/platform/data-source/index.js +3 -1
  123. package/es/platform/zfield/applications/usecases/FetchSuccessUseCase.js +33 -0
  124. package/es/platform/zfield/domain/entities/fields-manager/FieldsManager.js +5 -0
  125. package/es/platform/zform/adapters/controllers/GetInitialRecordSuccessController.js +31 -0
  126. package/es/platform/zform/adapters/gateway/FormRepository.js +1 -3
  127. package/es/platform/zform/adapters/presenter/translators/fields/LookUpFieldTranslator.js +11 -12
  128. package/es/platform/zform/applications/interfaces/input/GetInitialRecordSuccessUseCaseInputModel.js +1 -0
  129. package/es/platform/zform/applications/usecases/GetInitialRecordSuccessUseCase.js +132 -0
  130. package/es/platform/zform/applications/usecases/MyFormSuccessUseCase.js +10 -9
  131. package/es/platform/zform/domain/ZForm.js +0 -2
  132. package/es/platform/zlist/adapters/presenters/TableTranslator.js +44 -6
  133. package/es/platform/zlist/adapters/presenters/translators/ColumnTranslator.js +57 -49
  134. package/es/platform/zlist/adapters/presenters/translators/Row.js +16 -2
  135. package/es/platform/zlist/adapters/presenters/translators/RowsTranslator.js +3 -1
  136. package/es/platform/zlist/adapters/presenters/translators/fields/BooleanFieldTranslator.js +87 -12
  137. package/es/platform/zlist/adapters/presenters/translators/fields/CurrencyFieldTranslator.js +66 -11
  138. package/es/platform/zlist/adapters/presenters/translators/fields/DateFieldTranslator.js +33 -8
  139. package/es/platform/zlist/adapters/presenters/translators/fields/DateTimeFieldTranslator.js +33 -8
  140. package/es/platform/zlist/adapters/presenters/translators/fields/DecimalFieldTranslator.js +16 -9
  141. package/es/platform/zlist/adapters/presenters/translators/fields/EmailFieldTranslator.js +29 -9
  142. package/es/platform/zlist/adapters/presenters/translators/fields/FormulaFieldTranslator.js +23 -27
  143. package/es/platform/zlist/adapters/presenters/translators/fields/LookUpFieldTranslator.js +106 -17
  144. package/es/platform/zlist/adapters/presenters/translators/fields/MultiLineFieldTranslator.js +16 -9
  145. package/es/platform/zlist/adapters/presenters/translators/fields/MultiSelectFieldTranslator.js +100 -26
  146. package/es/platform/zlist/adapters/presenters/translators/fields/NumberFieldTranslator.js +16 -9
  147. package/es/platform/zlist/adapters/presenters/translators/fields/PercentageFieldTranslator.js +16 -9
  148. package/es/platform/zlist/adapters/presenters/translators/fields/PhoneFieldTranslator.js +32 -9
  149. package/es/platform/zlist/adapters/presenters/translators/fields/PickListFieldTranslator.js +167 -26
  150. package/es/platform/zlist/adapters/presenters/translators/fields/SingleLineFieldTranslator.js +16 -9
  151. package/es/platform/zlist/adapters/presenters/translators/fields/URLFieldTranslator.js +32 -9
  152. package/es/platform/zlist/adapters/presenters/utils/DateAndTimeFormat.js +25 -0
  153. package/es/platform/zrecord/adapters/controllers/UpdateRecordController.js +30 -0
  154. package/es/platform/zrecord/applications/interfaces/input/UpdateRecordInputModel.js +0 -0
  155. package/es/platform/zrecord/applications/usecases/UpdateRecordUseCase.js +30 -0
  156. package/package.json +20 -20
  157. package/es/bc/sort-by/ActionHandlers.js +0 -1
  158. package/es/bc/sort-by/Constants.js +0 -2
  159. package/es/bc/sort-by/Properties.js +0 -26
  160. package/es/bc/sort-by/SortOrderEnum.js +0 -8
  161. package/es/bc/sort-by/index.js +0 -2
  162. package/es/cc/tags/model/TagModel.js +0 -26
  163. package/es/library/behaviours/sort-by/adapters/controllers/SortBy.js +0 -28
  164. package/es/library/behaviours/sort-by/adapters/gateway/Repository.js +0 -19
  165. package/es/library/behaviours/sort-by/adapters/gateway/Service.js +0 -10
  166. package/es/library/behaviours/sort-by/applications/usecases/SortBy.js +0 -28
  167. package/es/library/behaviours/sort-by/domain/entities/SortBy.js +0 -42
  168. package/es/library/behaviours/sort-by/frameworks/ui/ActionsHandlerFactory.js +0 -23
  169. package/es/library/behaviours/sort-by/frameworks/ui/DemoBehaviour.js +0 -20
  170. package/es/library/behaviours/sort-by/frameworks/ui/SortByBehaviourFactory.js +0 -24
  171. package/es/library/custom-component/frameworks/ui/CustomComponentFactory.js +0 -56
  172. package/es/library/dot/components/table-list/adapters/controllers/SortByController.js +0 -25
  173. package/es/library/dot/components/table-list/adapters/controllers/SortedController.js +0 -18
  174. package/es/library/dot/components/table-list/frameworks/ui/handlers/HandleSortClick.js +0 -12
  175. package/es/platform/zlist/adapters/gateways/SortBy.js +0 -38
  176. package/es/platform/zlist/domain/entities/SortBy.js +0 -58
  177. /package/es/{library/behaviours/sort-by/applications/interfaces/UseCaseDependencies.js → bc/float-pagination/types/FloatPaginationBehaviourState.js} +0 -0
  178. /package/es/{library/behaviours/sort-by/applications/interfaces/gateways/IRepository.js → bc/list-selection/Types.js} +0 -0
  179. /package/es/{library/behaviours/sort-by/applications/interfaces/gateways/IService.js → cc/table-list/data-types/FloatPaginationConfig.js} +0 -0
  180. /package/es/library/behaviours/{sort-by → float-pagination}/adapters/controllers/AbstractController.js +0 -0
  181. /package/es/library/behaviours/{sort-by/applications/interfaces/input/SortByInputModel.js → float-pagination/applications/interfaces/UseCaseDependencies.js} +0 -0
  182. /package/es/library/behaviours/{sort-by/applications/interfaces/output/IPresenter.js → float-pagination/applications/interfaces/gateways/IRepository.js} +0 -0
  183. /package/es/library/behaviours/{sort-by/applications/interfaces/output/SortByOutputModel.js → float-pagination/applications/interfaces/gateways/IService.js} +0 -0
  184. /package/es/library/behaviours/{sort-by/domain/entities/interfaces/ISortBy.js → float-pagination/applications/interfaces/input/DestructInputModel.js} +0 -0
  185. /package/es/{platform/zlist/applications/interfaces/gateways/ISortBy.js → library/behaviours/float-pagination/applications/interfaces/input/FloatPaginationInputModel.js} +0 -0
  186. /package/es/{platform/zlist/domain/entities/interfaces/ISortBy.js → library/behaviours/float-pagination/applications/interfaces/input/InitializeInputModel.js} +0 -0
  187. /package/es/library/behaviours/{sort-by → float-pagination}/applications/usecases/AbstractUseCase.js +0 -0
@@ -14,14 +14,28 @@ export default function RowTranslator(_ref) {
14
14
  textOverflowConfig,
15
15
  moduleName,
16
16
  nameFieldsConfig,
17
- recordReadStatusConfig
17
+ recordReadStatusConfig,
18
+ componentMapping
18
19
  } = _ref;
19
20
  const actions = ClientActionsTranslator.transform(rowActions, instanceName, moduleName, { ...context,
20
21
  record
21
22
  });
22
23
  return {
23
24
  id: record.id,
24
- columns: fields.map(field => ColumnTranslator(field, record, fieldComponentMapping, fieldActions, context, preferences, instanceName, textOverflowConfig, moduleName, nameFieldsConfig, recordReadStatusConfig)),
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
+ })),
25
39
  rowActionLocation: {
26
40
  type: rowActionsUiType,
27
41
  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, componentMapping) {
4
4
  this.records = records;
5
5
  this.fields = fields;
6
6
  this.rowActions = rowActions;
@@ -14,6 +14,7 @@ export default class RowsTranslator {
14
14
  this.moduleName = moduleName;
15
15
  this.nameFieldsConfig = nameFieldsConfig;
16
16
  this.recordReadStatusConfig = recordReadStatusConfig;
17
+ this.componentMapping = componentMapping;
17
18
  this.pipe = this.pipe.bind(this);
18
19
  }
19
20
 
@@ -23,6 +24,7 @@ export default class RowsTranslator {
23
24
  }
24
25
 
25
26
  return this.records.map(record => RowTranslator({
27
+ componentMapping: this.componentMapping,
26
28
  record,
27
29
  fields: this.fields,
28
30
  fieldComponentMapping: this.fieldComponentMapping,
@@ -1,6 +1,5 @@
1
1
  // import FieldModel from '@platform/zfield/entities/interfaces/FieldModel';
2
2
  import FieldTypes from "../../../../../../cc/fields/field/Types";
3
- import BooleanFieldModel from "../../../../../../cc/fields/boolean/Model";
4
3
 
5
4
  const BooleanFieldTranslator = _ref => {
6
5
  let {
@@ -12,23 +11,99 @@ const BooleanFieldTranslator = _ref => {
12
11
  } = _ref;
13
12
  const {
14
13
  uiType,
15
- name
14
+ name,
15
+ displayLabel
16
16
  } = field;
17
+ let newValue = value;
17
18
 
18
19
  if (value === 'true') {
19
- value = true;
20
+ newValue = true;
20
21
  } else if (value === 'false') {
21
- value = false;
22
+ newValue = false;
22
23
  }
23
24
 
24
- return BooleanFieldModel({
25
- uiType: uiType || FieldTypes.CheckboxField,
26
- name,
27
- appendToActionPayload,
28
- isRead,
29
- value,
30
- textOverflowMode
31
- });
25
+ switch (uiType) {
26
+ case FieldTypes.TextField:
27
+ return {
28
+ type: FieldTypes.TextField,
29
+ fieldName: name,
30
+ text: value,
31
+ isDotted: textOverflowMode === 'clip',
32
+ weight: isRead ? undefined : 'bold',
33
+ tooltip: value,
34
+ appendToActionPayload,
35
+ isRead,
36
+ textOverflowMode
37
+ };
38
+
39
+ case FieldTypes.HighlightedValueField:
40
+ return {
41
+ type: FieldTypes.HighlightedValueField,
42
+ fieldName: name,
43
+ text: value,
44
+ color: newValue ? 'green' : 'red',
45
+ tooltip: value,
46
+ cursor: 'default',
47
+ appendToActionPayload,
48
+ isRead,
49
+ textOverflowMode
50
+ };
51
+
52
+ case FieldTypes.RadioDropdownField:
53
+ {
54
+ const options = [{
55
+ id: 'true',
56
+ value: 'true',
57
+ secondaryValue: ''
58
+ }, {
59
+ id: 'false',
60
+ value: 'false',
61
+ secondaryValue: ''
62
+ }];
63
+ const highlightedValueColor = newValue ? 'green' : 'red';
64
+ return {
65
+ type: FieldTypes.RadioDropdownField,
66
+ fieldName: name,
67
+ fieldType: 'boolean',
68
+ options,
69
+ color: highlightedValueColor,
70
+ selectedId: value,
71
+ selectedValue: value,
72
+ dropdownHeading: displayLabel,
73
+ isDotted: textOverflowMode === 'clip',
74
+ weight: isRead ? undefined : 'bold',
75
+ hasSearch: false,
76
+ isDisabled: false,
77
+ isReadOnly: false,
78
+ appendToActionPayload,
79
+ isRead,
80
+ textOverflowMode
81
+ };
82
+ }
83
+
84
+ case FieldTypes.SwitchField:
85
+ return {
86
+ type: FieldTypes.SwitchField,
87
+ fieldName: name,
88
+ checked: newValue,
89
+ disabled: false,
90
+ tooltip: '',
91
+ appendToActionPayload,
92
+ isRead,
93
+ textOverflowMode
94
+ };
95
+
96
+ case FieldTypes.CheckboxField:
97
+ default:
98
+ return {
99
+ type: FieldTypes.CheckboxField,
100
+ fieldName: name,
101
+ checked: newValue,
102
+ appendToActionPayload,
103
+ isRead,
104
+ textOverflowMode
105
+ };
106
+ }
32
107
  };
33
108
 
34
109
  export default BooleanFieldTranslator;
@@ -1,7 +1,49 @@
1
1
  import FieldTypes from "../../../../../../cc/fields/field/Types";
2
- import CurrencyFieldModel from "../../../../../../cc/fields/currency/Model";
3
2
 
4
- const CurrencyFieldTranslator = _ref => {
3
+ function isValidNumber() {
4
+ let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
5
+ const rejexPattern = new RegExp('^(\\d+\\.?\\d*|\\.\\d+)$');
6
+ const isValidInt = rejexPattern.test(value);
7
+ return isValidInt;
8
+ }
9
+
10
+ function formatCurrency(_ref) {
11
+ let {
12
+ value,
13
+ locale = 'IN',
14
+ symbol = 'Rs.'
15
+ } = _ref;
16
+ const isValidInt = isValidNumber(value);
17
+
18
+ if (isValidInt && symbol) {
19
+ const currencyArr = new Intl.NumberFormat(`en-${locale}`).formatToParts(value);
20
+ let currencyVal = '';
21
+ currencyArr.map(val => {
22
+ if (val.type == 'group') {
23
+ currencyVal += ',';
24
+ } else if (val.type == 'integer') {
25
+ currencyVal += val.value;
26
+ }
27
+ });
28
+
29
+ if (value.indexOf('.') != -1) {
30
+ const fractionVal = value.split(".")[1];
31
+
32
+ for (let i = fractionVal.length - 1; i >= 0; i--) {
33
+ if (fractionVal[i] != 0) {
34
+ currencyVal += `.${fractionVal.slice(0, i + 1)}`;
35
+ break;
36
+ }
37
+ }
38
+ }
39
+
40
+ return `${symbol}${currencyVal}`;
41
+ }
42
+
43
+ return value;
44
+ }
45
+
46
+ const CurrencyFieldTranslator = _ref2 => {
5
47
  let {
6
48
  field,
7
49
  value,
@@ -10,7 +52,7 @@ const CurrencyFieldTranslator = _ref => {
10
52
  preferences,
11
53
  textOverflowMode,
12
54
  isRead
13
- } = _ref;
55
+ } = _ref2;
14
56
  const {
15
57
  uiType,
16
58
  name
@@ -19,16 +61,29 @@ const CurrencyFieldTranslator = _ref => {
19
61
  let contextCurrencyLocale = context?.currencyLocale;
20
62
  let prefCurrencySymbol = preferences?.fields?.[field.apiName]?.currencySymbol;
21
63
  let contextCurrencySymbol = context?.currencySymbol;
22
- return CurrencyFieldModel({
23
- uiType: uiType || FieldTypes.CurrencyField,
24
- appendToActionPayload,
25
- name,
26
- currencyLocale: prefCurrencyLocale || contextCurrencyLocale,
27
- currencySymbol: prefCurrencySymbol || contextCurrencySymbol,
28
- isRead,
64
+ let locale = prefCurrencyLocale || contextCurrencyLocale;
65
+ let symbol = prefCurrencySymbol || contextCurrencySymbol;
66
+ let formatedValue = formatCurrency({
29
67
  value,
30
- textOverflowMode
68
+ locale,
69
+ symbol
31
70
  });
71
+
72
+ switch (uiType) {
73
+ case FieldTypes.TextField:
74
+ default:
75
+ return {
76
+ type: FieldTypes.TextField,
77
+ fieldName: name,
78
+ text: formatedValue,
79
+ isDotted: textOverflowMode === 'clip',
80
+ weight: isRead ? undefined : 'bold',
81
+ tooltip: formatedValue,
82
+ appendToActionPayload,
83
+ isRead,
84
+ textOverflowMode
85
+ };
86
+ }
32
87
  };
33
88
 
34
89
  export default CurrencyFieldTranslator;
@@ -1,6 +1,6 @@
1
1
  // import FieldModel from '@platform/zfield/entities/interfaces/FieldModel';
2
2
  import FieldTypes from "../../../../../../cc/fields/field/Types";
3
- import DateFieldModel from "../../../../../../cc/fields/date/Model";
3
+ import { DateAndTimeFormat } from "../../utils/DateAndTimeFormat";
4
4
 
5
5
  const DateFieldTranslator = _ref => {
6
6
  let {
@@ -8,20 +8,45 @@ const DateFieldTranslator = _ref => {
8
8
  value,
9
9
  appendToActionPayload,
10
10
  textOverflowMode,
11
- isRead
11
+ isRead,
12
+ context
12
13
  } = _ref;
13
14
  const {
14
15
  uiType,
15
16
  name
16
17
  } = field;
17
- return DateFieldModel({
18
- uiType: uiType || FieldTypes.DateField,
19
- appendToActionPayload,
20
- name,
21
- isRead,
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,
22
30
  value,
23
- textOverflowMode
31
+ isDateTimeField: false,
32
+ isShortenDateTimeInfo
24
33
  });
34
+
35
+ switch (uiType) {
36
+ case FieldTypes.TextField:
37
+ default:
38
+ return {
39
+ type: FieldTypes.TextField,
40
+ fieldName: name,
41
+ text: newDateValue,
42
+ isDotted: textOverflowMode === 'clip',
43
+ weight: isRead ? undefined : 'bold',
44
+ tooltip: newDateValue,
45
+ appendToActionPayload,
46
+ isRead,
47
+ textOverflowMode
48
+ };
49
+ }
25
50
  };
26
51
 
27
52
  export default DateFieldTranslator;
@@ -1,6 +1,6 @@
1
1
  // import FieldModel from '@platform/zfield/entities/interfaces/FieldModel';
2
2
  import FieldTypes from "../../../../../../cc/fields/field/Types";
3
- import DateTimeFieldModel from "../../../../../../cc/fields/datetime/Model";
3
+ import { DateAndTimeFormat } from "../../utils/DateAndTimeFormat";
4
4
 
5
5
  const DateTimeFieldTranslator = _ref => {
6
6
  let {
@@ -8,20 +8,45 @@ const DateTimeFieldTranslator = _ref => {
8
8
  value,
9
9
  appendToActionPayload,
10
10
  textOverflowMode,
11
- isRead
11
+ isRead,
12
+ context
12
13
  } = _ref;
13
14
  const {
14
15
  uiType,
15
16
  name
16
17
  } = field;
17
- return DateTimeFieldModel({
18
- uiType: uiType || FieldTypes.DateTimeField,
19
- appendToActionPayload,
20
- name,
21
- isRead,
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,
22
30
  value,
23
- textOverflowMode
31
+ isDateTimeField: true,
32
+ isShortenDateTimeInfo
24
33
  });
34
+
35
+ switch (uiType) {
36
+ case FieldTypes.TextField:
37
+ default:
38
+ return {
39
+ type: FieldTypes.TextField,
40
+ fieldName: name,
41
+ text: newDateValue,
42
+ isDotted: textOverflowMode === 'clip',
43
+ weight: isRead ? undefined : 'bold',
44
+ tooltip: newDateValue,
45
+ appendToActionPayload,
46
+ isRead,
47
+ textOverflowMode
48
+ };
49
+ }
25
50
  };
26
51
 
27
52
  export default DateTimeFieldTranslator;
@@ -1,6 +1,5 @@
1
1
  // import FieldModel from '@platform/zfield/entities/interfaces/FieldModel';
2
2
  import FieldTypes from "../../../../../../cc/fields/field/Types";
3
- import DecimalFieldModel from "../../../../../../cc/fields/decimal/Model";
4
3
 
5
4
  const DecimalFieldTranslator = _ref => {
6
5
  let {
@@ -14,14 +13,22 @@ const DecimalFieldTranslator = _ref => {
14
13
  uiType,
15
14
  name
16
15
  } = field;
17
- return DecimalFieldModel({
18
- uiType: uiType || FieldTypes.DecimalField,
19
- appendToActionPayload,
20
- name,
21
- isRead,
22
- value,
23
- textOverflowMode
24
- });
16
+
17
+ switch (uiType) {
18
+ case FieldTypes.TextField:
19
+ default:
20
+ return {
21
+ type: FieldTypes.TextField,
22
+ fieldName: name,
23
+ text: value,
24
+ isDotted: textOverflowMode === 'clip',
25
+ weight: isRead ? undefined : 'bold',
26
+ tooltip: value,
27
+ appendToActionPayload,
28
+ isRead,
29
+ textOverflowMode
30
+ };
31
+ }
25
32
  };
26
33
 
27
34
  export default DecimalFieldTranslator;
@@ -1,5 +1,4 @@
1
1
  import FieldTypes from "../../../../../../cc/fields/field/Types";
2
- import EmailFieldModel from "../../../../../../cc/fields/email/Model";
3
2
 
4
3
  const EmailFieldTranslator = _ref => {
5
4
  let {
@@ -13,14 +12,35 @@ const EmailFieldTranslator = _ref => {
13
12
  uiType,
14
13
  name
15
14
  } = field;
16
- return EmailFieldModel({
17
- uiType: uiType || FieldTypes.EmailField,
18
- appendToActionPayload,
19
- name,
20
- isRead,
21
- value,
22
- textOverflowMode
23
- });
15
+
16
+ switch (uiType) {
17
+ case FieldTypes.TextField:
18
+ return {
19
+ type: FieldTypes.TextField,
20
+ fieldName: name,
21
+ text: value,
22
+ isDotted: textOverflowMode === 'clip',
23
+ weight: isRead ? undefined : 'bold',
24
+ tooltip: value,
25
+ appendToActionPayload,
26
+ isRead,
27
+ textOverflowMode
28
+ };
29
+
30
+ case FieldTypes.EmailField:
31
+ default:
32
+ return {
33
+ type: FieldTypes.EmailField,
34
+ fieldName: name,
35
+ email: value,
36
+ isDotted: textOverflowMode === 'clip',
37
+ weight: isRead ? undefined : 'bold',
38
+ tooltip: value,
39
+ appendToActionPayload,
40
+ isRead,
41
+ textOverflowMode
42
+ };
43
+ }
24
44
  };
25
45
 
26
46
  export default EmailFieldTranslator;
@@ -1,5 +1,17 @@
1
- import FieldTypes from "../../../../../../cc/fields/field/Types";
2
- import FormulaFieldModel from "../../../../../../cc/fields/formula/Model";
1
+ import SingleLineFieldTranslator from "./SingleLineFieldTranslator";
2
+ import BooleanFieldTranslator from "./BooleanFieldTranslator";
3
+ import DecimalFieldTranslator from "./DecimalFieldTranslator";
4
+ import CurrencyFieldTranslator from "./CurrencyFieldTranslator";
5
+ import DateFieldTranslator from "./DateFieldTranslator";
6
+ import DateTimeFieldTranslator from "./DateTimeFieldTranslator";
7
+ const fieldTypeFactory = {
8
+ STRING: SingleLineFieldTranslator,
9
+ BOOLEAN: BooleanFieldTranslator,
10
+ DECIMAL: DecimalFieldTranslator,
11
+ CURRENCY: CurrencyFieldTranslator,
12
+ DATE: DateFieldTranslator,
13
+ DATETIME: DateTimeFieldTranslator
14
+ };
3
15
 
4
16
  const FormulaFieldTranslator = _ref => {
5
17
  let {
@@ -12,33 +24,17 @@ const FormulaFieldTranslator = _ref => {
12
24
  isRead
13
25
  } = _ref;
14
26
  const {
15
- uiType,
16
- name
27
+ returnType
17
28
  } = field;
18
- let prefCurrencyLocale = preferences?.fields?.[field.apiName]?.currencyLocale;
19
- let contextCurrencyLocale = context?.currencyLocale;
20
- let prefCurrencySymbol = preferences?.fields?.[field.apiName]?.currencySymbol;
21
- let contextCurrencySymbol = context?.currencySymbol;
22
- const fieldTypeFactory = {
23
- STRING: FieldTypes.SingleLineField,
24
- BOOLEAN: FieldTypes.CheckboxField,
25
- DECIMAL: FieldTypes.DecimalField,
26
- CURRENCY: FieldTypes.CurrencyField,
27
- DATE: FieldTypes.DateField,
28
- DATETIME: FieldTypes.DateTimeField
29
- };
30
- const setFieldType = fieldTypeFactory[field.returnType] || FieldTypes.SingleLineField;
31
- return FormulaFieldModel({
32
- uiType: uiType || setFieldType,
33
- appendToActionPayload,
34
- name,
35
- ...(setFieldType === FieldTypes.CurrencyField && {
36
- currencyLocale: prefCurrencyLocale || contextCurrencyLocale,
37
- currencySymbol: prefCurrencySymbol || contextCurrencySymbol
38
- }),
39
- isRead,
29
+ const fieldTranslator = fieldTypeFactory[returnType];
30
+ return fieldTranslator({
31
+ field,
40
32
  value,
41
- textOverflowMode
33
+ appendToActionPayload,
34
+ context,
35
+ preferences,
36
+ textOverflowMode,
37
+ isRead
42
38
  });
43
39
  };
44
40
 
@@ -1,37 +1,126 @@
1
1
  import FieldTypes from "../../../../../../cc/fields/field/Types";
2
- import LookupFieldModel from "../../../../../../cc/fields/lookup/Model";
3
2
 
4
- const LookUpFieldTranslator = _ref => {
3
+ //hacking temp url construction for lookup
4
+ function getLookupUrlConstructions(_ref) {
5
+ let {
6
+ field,
7
+ value,
8
+ context
9
+ } = _ref;
10
+ let {
11
+ orgName,
12
+ departmentName
13
+ } = context;
14
+ let lookupModuleName = field?.lookup?.module?.apiName;
15
+ return `/agent/${orgName}/${departmentName}/${lookupModuleName}/details/${value.id}`;
16
+ }
17
+
18
+ function processLookupValue(value, url) {
19
+ if (typeof value === 'string' || typeof value === 'number') {
20
+ return {
21
+ id: value,
22
+ name: value
23
+ };
24
+ } else if (typeof value === 'object' && value !== null) {
25
+ return {
26
+ id: value.id || '',
27
+ name: value.name || '',
28
+ photoURL: value.photoURL || '',
29
+ url: value.url || url
30
+ };
31
+ } else {
32
+ return {
33
+ id: '',
34
+ name: '',
35
+ url
36
+ };
37
+ }
38
+ }
39
+
40
+ const LookUpFieldTranslator = _ref2 => {
5
41
  let {
6
42
  field,
7
43
  value,
8
44
  appendToActionPayload,
45
+ context,
9
46
  textOverflowMode,
10
47
  isRead
11
- } = _ref;
48
+ } = _ref2;
12
49
  const {
13
50
  uiType,
14
51
  name
15
52
  } = field;
53
+ const constructedUrl = getLookupUrlConstructions({
54
+ field,
55
+ value,
56
+ context
57
+ });
16
58
  const {
17
59
  id,
18
60
  name: nameValue,
19
61
  photoURL,
20
62
  url
21
- } = value;
22
- return LookupFieldModel({
23
- uiType: uiType || FieldTypes.LookUpField,
24
- appendToActionPayload,
25
- name,
26
- isRead,
27
- value: {
28
- id,
29
- name: nameValue,
30
- photoURL,
31
- url
32
- },
33
- textOverflowMode
34
- });
63
+ } = processLookupValue(value, constructedUrl);
64
+
65
+ switch (uiType) {
66
+ case FieldTypes.TextField:
67
+ return {
68
+ type: FieldTypes.TextField,
69
+ fieldName: name,
70
+ text: nameValue,
71
+ isDotted: textOverflowMode === 'clip',
72
+ weight: isRead ? undefined : 'bold',
73
+ tooltip: nameValue,
74
+ appendToActionPayload,
75
+ isRead,
76
+ textOverflowMode
77
+ };
78
+
79
+ case FieldTypes.TagField:
80
+ return {
81
+ type: FieldTypes.TagField,
82
+ fieldName: name,
83
+ label: nameValue,
84
+ imageAltText: nameValue,
85
+ imageSrc: photoURL,
86
+ isRemovable: false,
87
+ cursor: 'default',
88
+ tooltip: nameValue,
89
+ appendToActionPayload,
90
+ isRead,
91
+ textOverflowMode
92
+ };
93
+
94
+ case FieldTypes.LabeledAvatarField:
95
+ return {
96
+ type: FieldTypes.LabeledAvatarField,
97
+ fieldName: name,
98
+ name: nameValue,
99
+ imageSrc: photoURL,
100
+ label: nameValue,
101
+ tooltip: nameValue,
102
+ appendToActionPayload,
103
+ isRead,
104
+ textOverflowMode
105
+ };
106
+
107
+ case FieldTypes.LinkField:
108
+ default:
109
+ return {
110
+ type: FieldTypes.LinkField,
111
+ fieldName: name,
112
+ text: nameValue,
113
+ variant: 'secondary',
114
+ href: url,
115
+ opensNewTab: false,
116
+ isDotted: textOverflowMode === 'clip',
117
+ weight: isRead ? undefined : 'bold',
118
+ tooltip: nameValue,
119
+ appendToActionPayload,
120
+ isRead,
121
+ textOverflowMode
122
+ };
123
+ }
35
124
  };
36
125
 
37
126
  export default LookUpFieldTranslator;