@zohodesk/library-platform 1.2.0-exp.4 → 1.2.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.
Files changed (75) hide show
  1. package/es/cc/date/Properties.js +0 -15
  2. package/es/cc/fields/field/Properties.js +1 -8
  3. package/es/cc/form/Properties.js +0 -8
  4. package/es/cc/label/Properties.js +5 -12
  5. package/es/cc/multi-select/Properties.js +1 -8
  6. package/es/cc/section/Properties.js +1 -8
  7. package/es/cc/select/Properties.js +1 -8
  8. package/es/cc/textarea/Properties.js +0 -15
  9. package/es/cc/textbox/Properties.js +1 -8
  10. package/es/index.js +6 -4
  11. package/es/library/dot/components/form/adapters/presenter/TransformState.js +1 -3
  12. package/es/library/dot/components/form/frameworks/ui/FormView.js +3 -6
  13. package/es/library/dot/components/form/frameworks/ui/sub-components/Footer.js +6 -16
  14. package/es/library/dot/components/form/frameworks/ui/sub-components/Header.js +6 -16
  15. package/es/library/dot/components/form/frameworks/ui/sub-components/Sections.js +2 -4
  16. package/es/library/dot/components/form-fields/checkbox/frameworks/ui/CheckboxView.js +3 -6
  17. package/es/library/dot/components/form-fields/currency/frameworks/ui/CurrencyView.js +3 -6
  18. package/es/library/dot/components/form-fields/date/frameworks/ui/DateView.js +3 -6
  19. package/es/library/dot/components/form-fields/datetime/frameworks/ui/DateTimeView.js +3 -6
  20. package/es/library/dot/components/form-fields/decimal/frameworks/ui/DecimalView.js +3 -6
  21. package/es/library/dot/components/form-fields/email/frameworks/ui/EmailView.js +3 -6
  22. package/es/library/dot/components/form-fields/field/FieldItem.js +2 -4
  23. package/es/library/dot/components/form-fields/lookup/frameworks/ui/LookupView.js +3 -6
  24. package/es/library/dot/components/form-fields/multi-select/frameworks/ui/MultiSelectView.js +4 -7
  25. package/es/library/dot/components/form-fields/number/frameworks/ui/NumberView.js +3 -6
  26. package/es/library/dot/components/form-fields/percentage/frameworks/ui/PercentageView.js +4 -7
  27. package/es/library/dot/components/form-fields/phone/frameworks/ui/PhoneView.js +3 -6
  28. package/es/library/dot/components/form-fields/pick-list/frameworks/ui/PickListView.js +4 -7
  29. package/es/library/dot/components/form-fields/textarea/frameworks/ui/TextAreaView.js +3 -6
  30. package/es/library/dot/components/form-fields/textbox/frameworks/ui/TextBoxView.js +3 -6
  31. package/es/library/dot/components/form-fields/url/frameworks/ui/UrlView.js +3 -6
  32. package/es/library/dot/components/section/frameworks/ui/RenderField.js +1 -3
  33. package/es/library/dot/components/section/frameworks/ui/SectionView.js +8 -14
  34. package/es/library/dot/components/table-list/frameworks/ui/TableListView.js +4 -8
  35. package/es/library/dot/components/table-list/frameworks/ui/sub-components/Header.js +4 -6
  36. package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/HeaderData.js +5 -11
  37. package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/MassAction.js +5 -11
  38. package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/Row.js +4 -8
  39. package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/RowActions.js +5 -12
  40. package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/RowData.js +4 -12
  41. package/es/library/dot/legacy-to-new-arch/date/frameworks/ui/DateView.js +4 -10
  42. package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/LabelView.js +5 -11
  43. package/es/library/dot/legacy-to-new-arch/multi-select/frameworks/ui/MultiSelectView.js +8 -21
  44. package/es/library/dot/legacy-to-new-arch/select/frameworks/ui/SelectView.js +8 -18
  45. package/es/library/dot/legacy-to-new-arch/text-area/frameworks/ui/TextAreaView.js +4 -10
  46. package/es/library/dot/legacy-to-new-arch/textbox/frameworks/ui/TextBoxView.js +4 -10
  47. package/es/platform/client-actions/cc/action-event-mediator/Properties.js +43 -0
  48. package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/ClientActionsAdapter.js +2 -1
  49. package/es/platform/client-scripts/cc/zclient-scripts-execution/clientScriptsSchema.js +1 -4
  50. package/es/platform/components/form-connected/frameworks/FormConnectedView.js +0 -2
  51. package/es/platform/components/smart-action-band/adapters/presenters/ActionBandTranslator.js +10 -7
  52. package/es/platform/components/smart-action-band/frameworks/SmartActionBandView.js +5 -18
  53. package/es/platform/zform/adapters/presenter/FormTranslator.js +12 -8
  54. package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +14 -10
  55. package/es/platform/zform/adapters/presenter/translators/fields/BooleanFieldTranslator.js +2 -4
  56. package/es/platform/zform/adapters/presenter/translators/fields/CurrencyFieldTranslator.js +1 -2
  57. package/es/platform/zform/adapters/presenter/translators/fields/DateFieldTranslator.js +2 -4
  58. package/es/platform/zform/adapters/presenter/translators/fields/DateTimeFieldTranslator.js +2 -4
  59. package/es/platform/zform/adapters/presenter/translators/fields/DecimalFieldTranslator.js +2 -4
  60. package/es/platform/zform/adapters/presenter/translators/fields/EmailFieldTranslator.js +2 -4
  61. package/es/platform/zform/adapters/presenter/translators/fields/LookUpFieldTranslator.js +2 -4
  62. package/es/platform/zform/adapters/presenter/translators/fields/MultiselectFieldTranslator.js +8 -13
  63. package/es/platform/zform/adapters/presenter/translators/fields/NumberFieldTranslator.js +2 -4
  64. package/es/platform/zform/adapters/presenter/translators/fields/PercentageFieldTranslator.js +2 -4
  65. package/es/platform/zform/adapters/presenter/translators/fields/PhoneFieldTranslator.js +2 -4
  66. package/es/platform/zform/adapters/presenter/translators/fields/PicklistFieldTranslator.js +12 -11
  67. package/es/platform/zform/adapters/presenter/translators/fields/TextAreaFieldTranslator.js +2 -4
  68. package/es/platform/zform/adapters/presenter/translators/fields/TextFieldTranslator.js +2 -4
  69. package/es/platform/zform/adapters/presenter/translators/fields/URLFieldTranslator.js +2 -4
  70. package/es/platform/zlist/adapters/presenters/SelectionTranslator.js +4 -2
  71. package/es/platform/zlist/adapters/presenters/TableTranslator.js +1 -6
  72. package/es/platform/zlist/adapters/presenters/translators/ColumnTranslator.js +1 -7
  73. package/es/platform/zlist/adapters/presenters/translators/Header.js +6 -7
  74. package/es/platform/zlist/adapters/presenters/translators/Row.js +5 -6
  75. package/package.json +1 -1
@@ -1,3 +1,5 @@
1
+ import ClientActionsTranslator from "../../../../../client-actions/translators/client-actions-translator";
2
+
1
3
  const MultiSelectFieldTranslator = _ref => {
2
4
  let {
3
5
  field,
@@ -6,33 +8,27 @@ const MultiSelectFieldTranslator = _ref => {
6
8
  fieldPreModified,
7
9
  fieldOptionActions,
8
10
  instanceName,
9
- moduleName,
10
- context
11
+ moduleName
11
12
  } = _ref;
12
13
  const fieldModified = { ...fieldPreModified,
13
14
  id: field.id,
14
15
  label: field.i18NLabel,
15
16
  options: field.pickListValues ? field.pickListValues.map(picklistValue => {
16
17
  const optionActions = {};
17
- let fieldOptionsContext = {};
18
18
  Object.entries(fieldOptionActions).forEach(_ref2 => {
19
19
  let [key, value] = _ref2;
20
20
  const {
21
21
  value: _omit,
22
22
  ...fieldWithoutValue
23
23
  } = field;
24
- optionActions[key] = value;
25
- fieldOptionsContext = { ...picklistValue,
26
- ...fieldWithoutValue,
27
- instanceName,
28
- moduleName
29
- };
24
+ optionActions[key] = ClientActionsTranslator.transform(value, instanceName, moduleName, { ...picklistValue,
25
+ ...fieldWithoutValue
26
+ });
30
27
  });
31
28
  return {
32
29
  optionActions: optionActions.fieldOptionRightActions,
33
30
  value: picklistValue.value,
34
- label: picklistValue.value,
35
- context: fieldOptionsContext
31
+ label: picklistValue.value
36
32
  };
37
33
  }) : [],
38
34
  type,
@@ -45,8 +41,7 @@ const MultiSelectFieldTranslator = _ref => {
45
41
  readonly: field.isReadOnly,
46
42
  // visibility: field.isVisible,
47
43
  isVisible: field.isVisible,
48
- errorMessage: field.errorMessage || '',
49
- context
44
+ errorMessage: field.errorMessage || ''
50
45
  };
51
46
  return fieldModified;
52
47
  };
@@ -3,8 +3,7 @@ const NumberFieldTranslator = _ref => {
3
3
  field,
4
4
  type,
5
5
  fieldPreModified,
6
- uiConfig,
7
- context
6
+ uiConfig
8
7
  } = _ref;
9
8
  const fieldModified = {
10
9
  type,
@@ -21,8 +20,7 @@ const NumberFieldTranslator = _ref => {
21
20
  readonly: field.isReadOnly,
22
21
  // visibility: field.isVisible,
23
22
  isVisible: field.isVisible,
24
- errorMessage: field.errorMessage || '',
25
- context
23
+ errorMessage: field.errorMessage || ''
26
24
  };
27
25
  return fieldModified;
28
26
  };
@@ -3,8 +3,7 @@ const PercentageFieldTranslator = _ref => {
3
3
  field,
4
4
  type,
5
5
  fieldPreModified,
6
- uiConfig,
7
- context
6
+ uiConfig
8
7
  } = _ref;
9
8
  const fieldModified = {
10
9
  type,
@@ -20,8 +19,7 @@ const PercentageFieldTranslator = _ref => {
20
19
  readonly: field.isReadOnly,
21
20
  // visibility: field.isVisible,
22
21
  isVisible: field.isVisible,
23
- errorMessage: field.errorMessage || '',
24
- context
22
+ errorMessage: field.errorMessage || ''
25
23
  };
26
24
  return fieldModified;
27
25
  };
@@ -3,8 +3,7 @@ const PhoneFieldTranslator = _ref => {
3
3
  field,
4
4
  type,
5
5
  fieldPreModified,
6
- uiConfig,
7
- context
6
+ uiConfig
8
7
  } = _ref;
9
8
  const fieldModified = {
10
9
  type,
@@ -20,8 +19,7 @@ const PhoneFieldTranslator = _ref => {
20
19
  maxLength: field.maxLength,
21
20
  readonly: field.isReadOnly,
22
21
  isVisible: field.isVisible,
23
- errorMessage: field.errorMessage || '',
24
- context
22
+ errorMessage: field.errorMessage || ''
25
23
  };
26
24
  return fieldModified;
27
25
  };
@@ -1,3 +1,5 @@
1
+ import ClientActionsTranslator from "../../../../../client-actions/translators/client-actions-translator";
2
+
1
3
  const PickListFieldTranslator = _ref => {
2
4
  let {
3
5
  field,
@@ -6,27 +8,27 @@ const PickListFieldTranslator = _ref => {
6
8
  fieldPreModified,
7
9
  fieldOptionActions,
8
10
  instanceName,
9
- moduleName,
10
- context
11
+ moduleName
11
12
  } = _ref;
12
13
  const fieldModified = { ...fieldPreModified,
13
14
  id: field.id,
14
15
  label: field.i18NLabel,
15
16
  options: field.pickListValues.map(picklistValue => {
16
17
  const optionActions = {};
17
- const context = { ...picklistValue,
18
- ...field
19
- };
20
18
  Object.entries(fieldOptionActions).forEach(_ref2 => {
21
19
  let [key, value] = _ref2;
22
- // const { value: _omit, ...fieldWithoutValue } = field;
23
- optionActions[key] = value; // optionActions[key] = ClientActionsTranslator.transform(value, instanceName, moduleName, { ...picklistValue, ...fieldWithoutValue });
20
+ const {
21
+ value: _omit,
22
+ ...fieldWithoutValue
23
+ } = field;
24
+ optionActions[key] = ClientActionsTranslator.transform(value, instanceName, moduleName, { ...picklistValue,
25
+ ...fieldWithoutValue
26
+ });
24
27
  });
25
28
  return {
26
29
  optionActions: optionActions.fieldOptionRightActions,
27
30
  value: picklistValue.value,
28
- label: picklistValue.value,
29
- context
31
+ label: picklistValue.value
30
32
  };
31
33
  }),
32
34
  type,
@@ -39,8 +41,7 @@ const PickListFieldTranslator = _ref => {
39
41
  readonly: field.isReadOnly,
40
42
  // visibility: field.isVisible,
41
43
  isVisible: field.isVisible,
42
- errorMessage: field.errorMessage || '',
43
- context
44
+ errorMessage: field.errorMessage || ''
44
45
  };
45
46
  return fieldModified;
46
47
  };
@@ -3,8 +3,7 @@ const TextAreaFieldTranslator = _ref => {
3
3
  field,
4
4
  type,
5
5
  fieldPreModified,
6
- uiConfig,
7
- context
6
+ uiConfig
8
7
  } = _ref;
9
8
  const fieldModified = {
10
9
  type,
@@ -20,8 +19,7 @@ const TextAreaFieldTranslator = _ref => {
20
19
  maxLength: field.maxLength,
21
20
  // visibility: field.isVisible,
22
21
  isVisible: field.isVisible,
23
- errorMessage: field.errorMessage || '',
24
- context
22
+ errorMessage: field.errorMessage || ''
25
23
  };
26
24
  return fieldModified;
27
25
  };
@@ -3,8 +3,7 @@ const TextFieldTranslator = _ref => {
3
3
  field,
4
4
  type,
5
5
  fieldPreModified,
6
- uiConfig,
7
- context
6
+ uiConfig
8
7
  } = _ref;
9
8
  const fieldModified = {
10
9
  type,
@@ -21,8 +20,7 @@ const TextFieldTranslator = _ref => {
21
20
  maxLength: field.maxLength,
22
21
  // visibility: field.isVisible,
23
22
  isVisible: field.isVisible,
24
- errorMessage: field.errorMessage || '',
25
- context
23
+ errorMessage: field.errorMessage || ''
26
24
  };
27
25
  return fieldModified;
28
26
  };
@@ -3,8 +3,7 @@ const URLFieldTranslator = _ref => {
3
3
  field,
4
4
  type,
5
5
  fieldPreModified,
6
- uiConfig,
7
- context
6
+ uiConfig
8
7
  } = _ref;
9
8
  const fieldModified = {
10
9
  type,
@@ -21,8 +20,7 @@ const URLFieldTranslator = _ref => {
21
20
  readonly: field.isReadOnly,
22
21
  // visibility: field.isVisible,
23
22
  isVisible: field.isVisible,
24
- errorMessage: field.errorMessage || '',
25
- context
23
+ errorMessage: field.errorMessage || ''
26
24
  };
27
25
  return fieldModified;
28
26
  };
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable @zohodesk/architecturerules/define-property-schema */
2
2
 
3
3
  /* eslint-disable max-lines-per-function */
4
+ import ClientActionsTranslator from "../../../client-actions/translators/client-actions-translator";
4
5
  import DefaultClientActions from "./utils/DefaultClientActions";
5
6
  import { i18NProviderUtils } from '@zohodesk/i18n';
6
7
  export default function SelectionTranslator(state) {
@@ -12,6 +13,7 @@ export default function SelectionTranslator(state) {
12
13
  columnChooserConfig,
13
14
  selectionConfig,
14
15
  moduleName,
16
+ instanceName,
15
17
  textOverflowConfig
16
18
  } = properties;
17
19
  const {
@@ -33,11 +35,11 @@ export default function SelectionTranslator(state) {
33
35
  isEnabled: textOverflowConfig.isEnabled,
34
36
  mode: textOverflow.mode
35
37
  });
38
+ const contextAppliedActions = ClientActionsTranslator.transform(clientActions, instanceName, moduleName, context);
36
39
  return {
37
40
  selected,
38
41
  hasAllSelected,
39
- actions: clientActions,
40
- context
42
+ actions: contextAppliedActions
41
43
  };
42
44
  }
43
45
 
@@ -157,18 +157,13 @@ export default class TableTranslator {
157
157
  field.uiType = uiType;
158
158
  }
159
159
  });
160
- const massActionsContext = {
161
- instanceName,
162
- moduleName
163
- };
164
160
  const headersTranslator = new HeadersTranslator(fields, headerActions, context, modifiedWidths, sortConfig, records, instanceName, moduleName);
165
161
  const rowsTranslator = new RowsTranslator(isLocalSearchEnabled ? localRecords : 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);
166
162
  // const translators = [headersTranslator.getTranslator(), rowsTranslator.getTranslator(), actionTranslator.getTranslator()];
167
163
 
168
164
  const translators = [headersTranslator.getTranslator(), rowsTranslator.getTranslator()];
169
165
  let data = Pipeline.run(translators, {});
170
- data.clientScripts = clientScripts;
171
- data.massActionsContext = massActionsContext; // TODO: Implement ModuleTableModel, and move data and isLoading to tableViewModel Object
166
+ data.clientScripts = clientScripts; // TODO: Implement ModuleTableModel, and move data and isLoading to tableViewModel Object
172
167
 
173
168
  return {
174
169
  properties,
@@ -82,13 +82,7 @@ function ColumnTranslator(_ref) {
82
82
  }
83
83
 
84
84
  const viewModel = {
85
- actions: fieldActions,
86
- context: {
87
- field,
88
- record,
89
- instanceName,
90
- moduleName
91
- },
85
+ actions,
92
86
  ...fieldTranslator(translatorArgs)
93
87
  };
94
88
 
@@ -1,4 +1,5 @@
1
1
  import { Alignment } from "../../../../../cc/table-list/data-types/Header";
2
+ import ClientActionsTranslator from "../../../../client-actions/translators/client-actions-translator";
2
3
  import { SortModelOrder } from "../../../../zlist/domain/entities/interfaces/Properties";
3
4
  import { i18NProviderUtils } from '@zohodesk/i18n';
4
5
  import { SortOrder } from "../../../../../bc/zlist/Types";
@@ -13,6 +14,10 @@ function HeaderTranslator(field, actions, context, modifiedWidths, sortConfig, r
13
14
  const newField = { ...field,
14
15
  sort: translateSortBy(field.name, sortConfig)
15
16
  };
17
+ const transformedActions = ClientActionsTranslator.transform(actions, instanceName, moduleName, { ...context,
18
+ field: newField,
19
+ recordsLength: records.length.toString()
20
+ });
16
21
  const width = modifiedWidths[name];
17
22
  return {
18
23
  id: id,
@@ -21,13 +26,7 @@ function HeaderTranslator(field, actions, context, modifiedWidths, sortConfig, r
21
26
  sortable: isSortable,
22
27
  alignment: Alignment.Left,
23
28
  width,
24
- actions,
25
- context: { ...context,
26
- field: newField,
27
- recordsLength: records.length.toString(),
28
- instanceName,
29
- moduleName
30
- }
29
+ actions: transformedActions
31
30
  };
32
31
  }
33
32
 
@@ -1,4 +1,5 @@
1
1
  import ColumnTranslator from "./ColumnTranslator";
2
+ import ClientActionsTranslator from "../../../../client-actions/translators/client-actions-translator";
2
3
  export default function RowTranslator(_ref) {
3
4
  let {
4
5
  record,
@@ -16,6 +17,9 @@ export default function RowTranslator(_ref) {
16
17
  recordReadStatusConfig,
17
18
  componentMapping
18
19
  } = _ref;
20
+ const actions = ClientActionsTranslator.transform(rowActions, instanceName, moduleName, { ...context,
21
+ record
22
+ });
19
23
  return {
20
24
  id: record.id,
21
25
  columns: fields.map(field => ColumnTranslator({
@@ -34,12 +38,7 @@ export default function RowTranslator(_ref) {
34
38
  })),
35
39
  rowActionLocation: {
36
40
  type: rowActionsUiType,
37
- actions: rowActions,
38
- context: { ...context,
39
- record,
40
- instanceName,
41
- moduleName
42
- }
41
+ actions
43
42
  }
44
43
  };
45
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/library-platform",
3
- "version": "1.2.0-exp.4",
3
+ "version": "1.2.2",
4
4
  "description": "",
5
5
  "main": "es/index.js",
6
6
  "files": [