@zohodesk/library-platform 1.1.10-exp.3 → 1.1.10-exp.5

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 (55) hide show
  1. package/es/cc/fields/field/Types.js +1 -0
  2. package/es/cc/fields/lookup/Properties.js +2 -1
  3. package/es/cc/fields/name/Events.js +3 -0
  4. package/es/cc/fields/name/Model.js +14 -0
  5. package/es/cc/fields/name/Properties.js +27 -0
  6. package/es/cc/table-connected/Properties.js +13 -0
  7. package/es/cc/table-connected/constants/ExternalConstants.js +1 -0
  8. package/es/cc/table-list/Constants.js +1 -0
  9. package/es/cc/table-list/Events.js +20 -0
  10. package/es/cc/table-list/Properties.js +2 -1
  11. package/es/library/dot/components/form/frameworks/ui/FormView.js +0 -1
  12. package/es/library/dot/legacy-to-new-arch/table-field-components/index.js +2 -0
  13. package/es/library/dot/legacy-to-new-arch/table-field-components/primary-field/frameworks/ui/PrimaryField.js +12 -0
  14. package/es/library/dot/legacy-to-new-arch/table-field-components/primary-field/frameworks/ui/PrimaryFieldView.js +46 -0
  15. package/es/platform/app-context-behaviour/frameworks/AppContextBehaviourFactory.js +2 -2
  16. package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +14 -1
  17. package/es/platform/zlist/adapters/presenters/TableTranslator.js +6 -2
  18. package/es/platform/zlist/adapters/presenters/translators/ColumnTranslator.js +21 -13
  19. package/es/platform/zlist/adapters/presenters/translators/Row.js +3 -2
  20. package/es/platform/zlist/adapters/presenters/translators/RowsTranslator.js +4 -2
  21. package/es/platform/zlist/adapters/presenters/translators/fields/BooleanFieldTranslator.js +7 -1
  22. package/es/platform/zlist/adapters/presenters/translators/fields/CurrencyFieldTranslator.js +8 -1
  23. package/es/platform/zlist/adapters/presenters/translators/fields/DateFieldTranslator.js +7 -1
  24. package/es/platform/zlist/adapters/presenters/translators/fields/DateTimeFieldTranslator.js +7 -1
  25. package/es/platform/zlist/adapters/presenters/translators/fields/DecimalFieldTranslator.js +7 -1
  26. package/es/platform/zlist/adapters/presenters/translators/fields/EmailFieldTranslator.js +6 -1
  27. package/es/platform/zlist/adapters/presenters/translators/fields/FormulaFieldTranslator.js +8 -1
  28. package/es/platform/zlist/adapters/presenters/translators/fields/LookUpFieldTranslator.js +6 -1
  29. package/es/platform/zlist/adapters/presenters/translators/fields/MultiLineFieldTranslator.js +7 -1
  30. package/es/platform/zlist/adapters/presenters/translators/fields/MultiSelectFieldTranslator.js +7 -1
  31. package/es/platform/zlist/adapters/presenters/translators/fields/NameFieldTranslator.js +54 -0
  32. package/es/platform/zlist/adapters/presenters/translators/fields/NumberFieldTranslator.js +7 -1
  33. package/es/platform/zlist/adapters/presenters/translators/fields/PercentageFieldTranslator.js +7 -1
  34. package/es/platform/zlist/adapters/presenters/translators/fields/PhoneFieldTranslator.js +7 -1
  35. package/es/platform/zlist/adapters/presenters/translators/fields/PickListFieldTranslator.js +7 -1
  36. package/es/platform/zlist/adapters/presenters/translators/fields/SingleLineFieldTranslator.js +7 -1
  37. package/es/platform/zlist/adapters/presenters/translators/fields/URLFieldTranslator.js +7 -1
  38. package/es/platform/zlist/adapters/presenters/translators/fields/index.js +3 -1
  39. package/package.json +2 -2
  40. package/es/.DS_Store +0 -0
  41. package/es/cc/form-connected/Constants.js +0 -12
  42. package/es/platform/.DS_Store +0 -0
  43. package/es/platform/client-actions/cc/dynamic-action-component/Properties.js +0 -51
  44. package/es/platform/client-actions/components/dynamic-component/domain/entities/interfaces/IState.js +0 -1
  45. package/es/platform/client-actions/components/dynamic-component/frameworks/ui/DynamicActionComponent.js +0 -9
  46. package/es/platform/client-actions/components/dynamic-component/frameworks/ui/DynamicActionComponentView.js +0 -38
  47. package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActionsRenderer.js +0 -12
  48. package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActionsRenderer.module.css +0 -19
  49. package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActionsRendererView.js +0 -33
  50. package/es/platform/data-source/http-template/fetchDependencyMappings.js +0 -18
  51. package/es/platform/data-source/http-template/fetchLayoutRules.js +0 -29
  52. package/es/platform/data-source/http-template/fetchMyForm.js +0 -19
  53. package/es/platform/data-source/http-template/fetchMyFormLayout.js +0 -43
  54. package/es/platform/data-source/http-template/fetchValidationRules.js +0 -30
  55. package/es/platform/zlist/adapters/presenters/translators/ColumnAlignmentTranslator.js +0 -11
@@ -1,4 +1,5 @@
1
1
  var Types = /*#__PURE__*/function (Types) {
2
+ Types["PrimaryField"] = "Primary";
2
3
  Types["CheckboxField"] = "Checkbox";
3
4
  Types["SwitchField"] = "Switch";
4
5
  Types["SingleLineField"] = "SingleLine";
@@ -32,7 +32,8 @@ export default { ...FieldProperties,
32
32
  type: ['string', 'null']
33
33
  }
34
34
  },
35
- required: ['id', 'name']
35
+ required: ['id', 'name'],
36
+ additionalProperties: true
36
37
  }, {
37
38
  // NOTE: string type is used in Form Lookup field translator
38
39
  type: 'string' // Allowing string type for backward compatibility or alternative usage
@@ -0,0 +1,3 @@
1
+ import FieldEvents from "../field/Events";
2
+ const Events = FieldEvents;
3
+ export default Events;
@@ -0,0 +1,14 @@
1
+ export default function NameFieldModel(_ref) {
2
+ let {
3
+ name,
4
+ value,
5
+ uiType,
6
+ appendToActionPayload
7
+ } = _ref;
8
+ return {
9
+ name,
10
+ appendToActionPayload,
11
+ type: uiType,
12
+ value
13
+ };
14
+ }
@@ -0,0 +1,27 @@
1
+ import FieldProperties from "../field/Properties";
2
+ export default { ...FieldProperties,
3
+ value: {
4
+ required: true,
5
+ defaultValue: {},
6
+ typeMetadata: {
7
+ schema: {
8
+ type: 'object',
9
+ properties: {
10
+ id: {
11
+ type: 'string'
12
+ },
13
+ value: {
14
+ type: 'string'
15
+ },
16
+ url: {
17
+ type: 'string'
18
+ },
19
+ isPreventDefault: {
20
+ type: 'boolean'
21
+ }
22
+ },
23
+ required: ['value', 'url']
24
+ }
25
+ }
26
+ }
27
+ };
@@ -59,6 +59,19 @@ export default {
59
59
  }
60
60
  }
61
61
  },
62
+ nameFieldsConfig: {
63
+ required: false,
64
+ defaultValue: {
65
+ isEnabled: true,
66
+ isPreventDefault: false,
67
+ constructUrl: null
68
+ },
69
+ typeMetadata: {
70
+ schema: {
71
+ type: 'object'
72
+ }
73
+ }
74
+ },
62
75
  reOrderConfig: {
63
76
  required: false,
64
77
  defaultValue: {
@@ -5,5 +5,6 @@ export default {
5
5
  RECORDS_SELECTED: 'SMART_TABLE#RECORDS_SELECTED',
6
6
  RECORDS_DESELECTED: 'SMART_TABLE#RECORDS_DESELECTED',
7
7
  SMART_TABLE_ROW_ACTION_TRIGGERED: 'SMART_TABLE#ROW_ACTION_TRIGGERED',
8
+ SMART_TABLE_NAME_FIELD_CLICKED: 'SMART_TABLE#NAME_FIELD_CLICKED',
8
9
  SELECTION_LIMIT_EXCEEDED: 'SMART_TABLE#SELECTION_LIMIT_EXCEEDED'
9
10
  };
@@ -11,6 +11,7 @@ class Constants {
11
11
  static TABLE_LIST_ROW_CLICKED = 'TABLE_LIST#ROW_CLICKED';
12
12
  static TABLE_LIST_ROW_DRAG_START = 'TABLE_LIST#ROW_DRAG_START';
13
13
  static TABLE_LIST_ROW_DRAG_END = 'TABLE_LIST#ROW_DRAG_END';
14
+ static TABLE_LIST_NAME_FIELD_CLICKED = 'TABLE_LIST#NAME_FIELD_CLICKED';
14
15
  }
15
16
 
16
17
  export default Constants;
@@ -55,5 +55,25 @@ const Events = [{
55
55
  }
56
56
  }
57
57
  }
58
+ }, {
59
+ type: Constants.TABLE_LIST_NAME_FIELD_CLICKED,
60
+ payload: {
61
+ fieldName: {
62
+ name: 'fieldName',
63
+ typeMetadata: {
64
+ schema: {
65
+ type: 'string'
66
+ }
67
+ }
68
+ },
69
+ url: {
70
+ name: 'url',
71
+ typeMetadata: {
72
+ schema: {
73
+ type: 'string'
74
+ }
75
+ }
76
+ }
77
+ }
58
78
  }];
59
79
  export default Events;
@@ -17,6 +17,7 @@ import PhoneProperties from "../fields/phone/Properties";
17
17
  import PickListProperties from "../fields/pick-list/Properties";
18
18
  import TextProperties from "../fields/text/Properties";
19
19
  import UrlProperties from "../fields/url/Properties";
20
+ import NameFieldProperties from "../fields/name/Properties";
20
21
  const TableListProperties = {
21
22
  isReOrderLoading: {
22
23
  required: false,
@@ -203,7 +204,7 @@ const TableListProperties = {
203
204
  required: ['id', 'name', 'text']
204
205
  },
205
206
  Column: {
206
- anyOf: [PropertiesConverter.toJsonSchema(BooleanProperties), PropertiesConverter.toJsonSchema(CurrencyProperties), PropertiesConverter.toJsonSchema(DateProperties), PropertiesConverter.toJsonSchema(DatetimeProperties), PropertiesConverter.toJsonSchema(DecimalProperties), PropertiesConverter.toJsonSchema(EmailProperties), PropertiesConverter.toJsonSchema(LookupProperties), PropertiesConverter.toJsonSchema(MultiSelectProperties), PropertiesConverter.toJsonSchema(NumberProperties), PropertiesConverter.toJsonSchema(PercentProperties), PropertiesConverter.toJsonSchema(PhoneProperties), PropertiesConverter.toJsonSchema(PickListProperties), PropertiesConverter.toJsonSchema(TextProperties), PropertiesConverter.toJsonSchema(UrlProperties), // Below field is for the empty cell
207
+ anyOf: [PropertiesConverter.toJsonSchema(BooleanProperties), PropertiesConverter.toJsonSchema(CurrencyProperties), PropertiesConverter.toJsonSchema(DateProperties), PropertiesConverter.toJsonSchema(DatetimeProperties), PropertiesConverter.toJsonSchema(DecimalProperties), PropertiesConverter.toJsonSchema(EmailProperties), PropertiesConverter.toJsonSchema(LookupProperties), PropertiesConverter.toJsonSchema(MultiSelectProperties), PropertiesConverter.toJsonSchema(NumberProperties), PropertiesConverter.toJsonSchema(PercentProperties), PropertiesConverter.toJsonSchema(PhoneProperties), PropertiesConverter.toJsonSchema(PickListProperties), PropertiesConverter.toJsonSchema(TextProperties), PropertiesConverter.toJsonSchema(UrlProperties), PropertiesConverter.toJsonSchema(NameFieldProperties), // Below field is for the empty cell
207
208
  {
208
209
  type: 'object',
209
210
  properties: {
@@ -21,7 +21,6 @@ function FormView(_ref, ref) {
21
21
  clientScripts
22
22
  } = state.viewModel;
23
23
  return /*#__PURE__*/React.createElement(Flex, {
24
- $ui_tagName: "form",
25
24
  $ui_displayMode: "flex",
26
25
  $ui_direction: "column",
27
26
  $flag_fullsize: true,
@@ -1,4 +1,5 @@
1
1
  import FieldTypes from "../../../../cc/fields/field/Types";
2
+ import PrimaryField from "./primary-field/frameworks/ui/PrimaryField";
2
3
  import CheckboxField from "./checkbox-field/frameworks/ui/CheckboxField";
3
4
  import SwitchField from "./switch-field/frameworks/ui/SwitchField";
4
5
  import SingleLineField from "./singleline-field/frameworks/ui/SingleLineField";
@@ -17,6 +18,7 @@ import NumberField from "./number-field/frameworks/ui/NumberField";
17
18
  import DecimalField from "./decimal-field/frameworks/ui/DecimalField";
18
19
  import MultiSelectField from "./multiselect-field/frameworks/ui/MultiSelectField";
19
20
  const FieldComponents = {
21
+ [FieldTypes.PrimaryField]: PrimaryField,
20
22
  [FieldTypes.CheckboxField]: CheckboxField,
21
23
  [FieldTypes.SwitchField]: SwitchField,
22
24
  // TODO: Need to register SwitchField
@@ -0,0 +1,12 @@
1
+ import { createCustomComponent } from "../../../../../../custom-component";
2
+ import NameFieldProperties from "../../../../../../../cc/fields/name/Properties";
3
+ import NameFieldEvents from "../../../../../../../cc/fields/name/Events";
4
+ import PrimaryFieldView from "./PrimaryFieldView";
5
+ const PrimaryField = createCustomComponent({
6
+ name: 'PrimaryField',
7
+ View: PrimaryFieldView,
8
+ properties: NameFieldProperties,
9
+ events: NameFieldEvents,
10
+ eventHandlers: {}
11
+ });
12
+ export default PrimaryField;
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ import TableLink from "@zohodesk-private/desk-components/es/table/TableLink/TableLink";
3
+ import { TableListConstants } from "../../../../../../../cc/table-list";
4
+ export default function PrimaryFieldView(_ref, ref) {
5
+ let {
6
+ state,
7
+ helpers
8
+ } = _ref;
9
+ let {
10
+ dispatch
11
+ } = helpers;
12
+ let {
13
+ value: propValue,
14
+ name: fieldName
15
+ } = state.properties;
16
+ let {
17
+ value,
18
+ url,
19
+ isPreventDefault
20
+ } = propValue;
21
+
22
+ function handleClick(event) {
23
+ if (isPreventDefault) {
24
+ event && event.preventDefault();
25
+ }
26
+
27
+ dispatch({
28
+ type: TableListConstants.TABLE_LIST_NAME_FIELD_CLICKED,
29
+ payload: {
30
+ fieldName,
31
+ url
32
+ }
33
+ });
34
+ }
35
+
36
+ return /*#__PURE__*/React.createElement(TableLink, {
37
+ $customProps_link: {
38
+ ref,
39
+ onClick: handleClick
40
+ },
41
+ $data_text: value,
42
+ $data_url: url,
43
+ $data_target: "_self",
44
+ $flag_hoverableFromList: true
45
+ });
46
+ }
@@ -14,8 +14,8 @@ class AppContextBehaviourFactory {
14
14
  } = _ref;
15
15
  const appResource = platformSDK[ResourceNamesEnum.APP];
16
16
  return {
17
- headers: appResource.getApiHeader(),
18
- context: { ...appResource.getContext(),
17
+ headers: appResource && appResource.getApiHeader(),
18
+ context: { ...(appResource && appResource.getContext()),
19
19
  ...context
20
20
  }
21
21
  };
@@ -24,7 +24,8 @@ const {
24
24
  TABLE_LIST_RESIZE_MOVE_REQUESTED,
25
25
  TABLE_LIST_RESIZE_END_REQUESTED,
26
26
  TABLE_LIST_SCROLLED,
27
- TABLE_LIST_ROW_DRAG_END
27
+ TABLE_LIST_ROW_DRAG_END,
28
+ TABLE_LIST_NAME_FIELD_CLICKED
28
29
  } = TableListEventConstants;
29
30
 
30
31
  function createHandlerWithSdk(handler) {
@@ -261,9 +262,21 @@ export default class EventHandlersFactory {
261
262
  });
262
263
  };
263
264
 
265
+ const navigationHandler = args => {
266
+ const {
267
+ action,
268
+ dispatch
269
+ } = args;
270
+ dispatch({
271
+ type: SmartTableConstants.ExternalConstants.SMART_TABLE_NAME_FIELD_CLICKED,
272
+ payload: action.payload
273
+ });
274
+ };
275
+
264
276
  const defaultEventHandlers = {
265
277
  NAVIGATION: NavigationHandler,
266
278
  // [`${name}#${LifeCycleEvents.MOUNT}`]: smartTableRenderedMetrics,
279
+ [TABLE_LIST_NAME_FIELD_CLICKED]: navigationHandler,
267
280
  [`${name}#${LifeCycleEvents.STATE_UPDATED}`]: addMetrics,
268
281
  [RESIZE_FINISHED]: new ResizeFinishController().handle,
269
282
  [TABLE_LIST_RESIZE_START_REQUESTED]: new ResizeStartController().handle,
@@ -38,8 +38,12 @@ export default class TableTranslator {
38
38
  const {
39
39
  resizeConfig,
40
40
  preferences,
41
- keyboardControlsConfig
41
+ keyboardControlsConfig,
42
+ nameFieldsConfig
42
43
  } = properties;
44
+ const {
45
+ modules
46
+ } = context;
43
47
  context['servicePrefix'] = 'supportapi/zd'; // FIX: servicePrefix defaultValue should be available from properties
44
48
 
45
49
  const {
@@ -108,7 +112,7 @@ export default class TableTranslator {
108
112
  const modifiedWidths = calculateFieldWidths(fields, localStorageFieldWidths, preferences);
109
113
  const recordsForDisplay = isRecordsShouldBeEmptied ? EMPTY_ARRAY : records;
110
114
  const headersTranslator = new HeadersTranslator(fields, headerActions, context, modifiedWidths, sortBy, records, instanceName, moduleName);
111
- const rowsTranslator = new RowsTranslator(recordsForDisplay, fields, rowActions, context, preferences, fieldComponentMapping, rowActionsUiType, fieldActions, instanceName, moduleName); // const actionTranslator = new ClientActionsTranslator(clientActions, records, fields, pageContext);
115
+ const rowsTranslator = new RowsTranslator(recordsForDisplay, fields, rowActions, context, preferences, fieldComponentMapping, rowActionsUiType, fieldActions, instanceName, moduleName, nameFieldsConfig); // const actionTranslator = new ClientActionsTranslator(clientActions, records, fields, pageContext);
112
116
  // const translators = [headersTranslator.getTranslator(), rowsTranslator.getTranslator(), actionTranslator.getTranslator()];
113
117
 
114
118
  const translators = [headersTranslator.getTranslator(), rowsTranslator.getTranslator()];
@@ -17,13 +17,15 @@ function getLookupUrlConstructions(_ref) {
17
17
  return `/agent/${orgName}/${departmentName}/${lookupModuleName}/details/${value.id}`;
18
18
  }
19
19
 
20
- function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, context, preferences, instanceName, moduleName) {
20
+ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, context, preferences, instanceName, moduleName, nameFieldsConfig) {
21
21
  const {
22
22
  isCustomField,
23
23
  name,
24
24
  type
25
25
  } = field;
26
- let fieldToUiValue;
26
+ const {
27
+ modules
28
+ } = context;
27
29
  const fieldEntry = fieldComponentMapping[name];
28
30
 
29
31
  if (typeof fieldEntry == 'string') {
@@ -45,7 +47,11 @@ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, co
45
47
  field.uiType = fieldComponentMapping[name];
46
48
  }
47
49
 
48
- const fieldTranslator = FieldTranslators[type];
50
+ let nameFieldTypes = ['Text'];
51
+ let moduleApiKeyCheck = modules && modules.some(m => {
52
+ return m.apiKey === field.name;
53
+ });
54
+ const fieldTranslator = nameFieldsConfig.isEnabled && nameFieldTypes.includes(field.type) && moduleApiKeyCheck ? FieldTranslators['NameField'] : FieldTranslators[type];
49
55
 
50
56
  if (!fieldTranslator) {
51
57
  console.error(`Field type ${type} not supported`);
@@ -65,18 +71,20 @@ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, co
65
71
  });
66
72
  }
67
73
 
68
- let finalValue = value;
69
-
70
- if (fieldToUiValue !== undefined) {
71
- finalValue = fieldToUiValue;
72
- }
73
-
74
- finalValue = tempValue ? tempValue : finalValue;
75
74
  const viewModel = {
76
75
  actions,
77
- ...fieldTranslator(field, finalValue, {
78
- recordId: record.id
79
- }, context, preferences)
76
+ ...fieldTranslator({
77
+ field,
78
+ value: tempValue ? tempValue : value,
79
+ appendToActionPayload: {
80
+ recordId: record.id
81
+ },
82
+ context,
83
+ preferences,
84
+ moduleName,
85
+ constructUrl: nameFieldsConfig.constructUrl,
86
+ isPreventDefault: nameFieldsConfig.isPreventDefault || false
87
+ })
80
88
  };
81
89
 
82
90
  if (fieldEntry && typeof fieldEntry === 'object') {
@@ -11,14 +11,15 @@ export default function RowTranslator(_ref) {
11
11
  context,
12
12
  preferences,
13
13
  instanceName,
14
- moduleName
14
+ moduleName,
15
+ nameFieldsConfig
15
16
  } = _ref;
16
17
  const actions = ClientActionsTranslator.transform(rowActions, instanceName, moduleName, { ...context,
17
18
  record
18
19
  });
19
20
  return {
20
21
  id: record.id,
21
- columns: fields.map(field => ColumnTranslator(field, record, fieldComponentMapping, fieldActions, context, preferences, instanceName, moduleName)),
22
+ columns: fields.map(field => ColumnTranslator(field, record, fieldComponentMapping, fieldActions, context, preferences, instanceName, moduleName, nameFieldsConfig)),
22
23
  rowActionLocation: {
23
24
  type: rowActionsUiType,
24
25
  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, moduleName) {
3
+ constructor(records, fields, rowActions, context, preferences, fieldComponentMapping, rowActionsUiType, fieldActions, instanceName, moduleName, nameFieldsConfig) {
4
4
  this.records = records;
5
5
  this.fields = fields;
6
6
  this.rowActions = rowActions;
@@ -11,6 +11,7 @@ export default class RowsTranslator {
11
11
  this.fieldActions = fieldActions;
12
12
  this.instanceName = instanceName;
13
13
  this.moduleName = moduleName;
14
+ this.nameFieldsConfig = nameFieldsConfig;
14
15
  this.pipe = this.pipe.bind(this);
15
16
  }
16
17
 
@@ -29,7 +30,8 @@ export default class RowsTranslator {
29
30
  context: this.context,
30
31
  preferences: this.preferences,
31
32
  instanceName: this.instanceName,
32
- moduleName: this.moduleName
33
+ moduleName: this.moduleName,
34
+ nameFieldsConfig: this.nameFieldsConfig
33
35
  }));
34
36
  }
35
37
 
@@ -1,7 +1,13 @@
1
+ // import FieldModel from '@platform/zfield/entities/interfaces/FieldModel';
1
2
  import FieldTypes from "../../../../../../cc/fields/field/Types";
2
3
  import BooleanFieldModel from "../../../../../../cc/fields/boolean/Model";
3
4
 
4
- const BooleanFieldTranslator = (field, value, appendToActionPayload) => {
5
+ const BooleanFieldTranslator = _ref => {
6
+ let {
7
+ field,
8
+ value,
9
+ appendToActionPayload
10
+ } = _ref;
5
11
  const {
6
12
  uiType,
7
13
  name
@@ -1,7 +1,14 @@
1
1
  import FieldTypes from "../../../../../../cc/fields/field/Types";
2
2
  import CurrencyFieldModel from "../../../../../../cc/fields/currency/Model";
3
3
 
4
- const CurrencyFieldTranslator = (field, value, appendToActionPayload, context, preferences) => {
4
+ const CurrencyFieldTranslator = _ref => {
5
+ let {
6
+ field,
7
+ value,
8
+ appendToActionPayload,
9
+ context,
10
+ preferences
11
+ } = _ref;
5
12
  const {
6
13
  uiType,
7
14
  name
@@ -1,7 +1,13 @@
1
+ // import FieldModel from '@platform/zfield/entities/interfaces/FieldModel';
1
2
  import FieldTypes from "../../../../../../cc/fields/field/Types";
2
3
  import DateFieldModel from "../../../../../../cc/fields/date/Model";
3
4
 
4
- const DateFieldTranslator = (field, value, appendToActionPayload) => {
5
+ const DateFieldTranslator = _ref => {
6
+ let {
7
+ field,
8
+ value,
9
+ appendToActionPayload
10
+ } = _ref;
5
11
  const {
6
12
  uiType,
7
13
  name
@@ -1,7 +1,13 @@
1
+ // import FieldModel from '@platform/zfield/entities/interfaces/FieldModel';
1
2
  import FieldTypes from "../../../../../../cc/fields/field/Types";
2
3
  import DateTimeFieldModel from "../../../../../../cc/fields/datetime/Model";
3
4
 
4
- const DateTimeFieldTranslator = (field, value, appendToActionPayload) => {
5
+ const DateTimeFieldTranslator = _ref => {
6
+ let {
7
+ field,
8
+ value,
9
+ appendToActionPayload
10
+ } = _ref;
5
11
  const {
6
12
  uiType,
7
13
  name
@@ -1,7 +1,13 @@
1
+ // import FieldModel from '@platform/zfield/entities/interfaces/FieldModel';
1
2
  import FieldTypes from "../../../../../../cc/fields/field/Types";
2
3
  import DecimalFieldModel from "../../../../../../cc/fields/decimal/Model";
3
4
 
4
- const DecimalFieldTranslator = (field, value, appendToActionPayload) => {
5
+ const DecimalFieldTranslator = _ref => {
6
+ let {
7
+ field,
8
+ value,
9
+ appendToActionPayload
10
+ } = _ref;
5
11
  const {
6
12
  uiType,
7
13
  name
@@ -1,7 +1,12 @@
1
1
  import FieldTypes from "../../../../../../cc/fields/field/Types";
2
2
  import EmailFieldModel from "../../../../../../cc/fields/email/Model";
3
3
 
4
- const EmailFieldTranslator = (field, value, appendToActionPayload) => {
4
+ const EmailFieldTranslator = _ref => {
5
+ let {
6
+ field,
7
+ value,
8
+ appendToActionPayload
9
+ } = _ref;
5
10
  const {
6
11
  uiType,
7
12
  name
@@ -1,7 +1,14 @@
1
1
  import FieldTypes from "../../../../../../cc/fields/field/Types";
2
2
  import FormulaFieldModel from "../../../../../../cc/fields/formula/Model";
3
3
 
4
- const FormulaFieldTranslator = (field, value, appendToActionPayload, context, preferences) => {
4
+ const FormulaFieldTranslator = _ref => {
5
+ let {
6
+ field,
7
+ value,
8
+ appendToActionPayload,
9
+ context,
10
+ preferences
11
+ } = _ref;
5
12
  const {
6
13
  uiType,
7
14
  name
@@ -1,7 +1,12 @@
1
1
  import FieldTypes from "../../../../../../cc/fields/field/Types";
2
2
  import LookupFieldModel from "../../../../../../cc/fields/lookup/Model";
3
3
 
4
- const LookUpFieldTranslator = (field, value, appendToActionPayload) => {
4
+ const LookUpFieldTranslator = _ref => {
5
+ let {
6
+ field,
7
+ value,
8
+ appendToActionPayload
9
+ } = _ref;
5
10
  const {
6
11
  uiType,
7
12
  name
@@ -1,7 +1,13 @@
1
+ // import FieldModel from '@platform/zfield/entities/interfaces/FieldModel';
1
2
  import FieldTypes from "../../../../../../cc/fields/field/Types";
2
3
  import MultiLineFieldModel from "../../../../../../cc/fields/multi-select/Model";
3
4
 
4
- const MultiLineFieldTranslator = (field, value, appendToActionPayload) => {
5
+ const MultiLineFieldTranslator = _ref => {
6
+ let {
7
+ field,
8
+ value,
9
+ appendToActionPayload
10
+ } = _ref;
5
11
  const {
6
12
  uiType,
7
13
  name
@@ -1,8 +1,14 @@
1
+ // import FieldModel from '@platform/zfield/entities/interfaces/FieldModel';
1
2
  import FieldTypes from "../../../../../../cc/fields/field/Types";
2
3
  import MultiListFieldModel from "../../../../../../cc/fields/multi-select/Model";
3
4
  import ColouredMultiListFieldModel from "../../../../../../cc/fields/coloured-multi-select/Model";
4
5
 
5
- const MultiSelectFieldTranslator = (field, value, appendToActionPayload) => {
6
+ const MultiSelectFieldTranslator = _ref => {
7
+ let {
8
+ field,
9
+ value,
10
+ appendToActionPayload
11
+ } = _ref;
6
12
  const {
7
13
  uiType,
8
14
  name,
@@ -0,0 +1,54 @@
1
+ import FieldTypes from "../../../../../../cc/fields/field/Types";
2
+ import NameFieldModel from "../../../../../../cc/fields/name/Model";
3
+
4
+ function getNameFieldUrlConstructions(_ref) {
5
+ let {
6
+ record,
7
+ context,
8
+ moduleName
9
+ } = _ref;
10
+ let {
11
+ orgName,
12
+ departmentName
13
+ } = context;
14
+ return `/agent/${orgName}/${departmentName}/${moduleName}/details/${record.recordId}`;
15
+ }
16
+
17
+ const NameFieldTranslator = _ref2 => {
18
+ let {
19
+ field,
20
+ value,
21
+ appendToActionPayload,
22
+ context,
23
+ moduleName,
24
+ constructUrl,
25
+ isPreventDefault
26
+ } = _ref2;
27
+ const {
28
+ uiType,
29
+ name
30
+ } = field;
31
+ let nameFieldValue = undefined;
32
+ nameFieldValue = typeof value !== 'object' ? {
33
+ value,
34
+ isPreventDefault,
35
+ id: appendToActionPayload.recordId
36
+ } : value;
37
+ nameFieldValue.url = constructUrl ? constructUrl({
38
+ record: appendToActionPayload,
39
+ context,
40
+ moduleName
41
+ }) : getNameFieldUrlConstructions({
42
+ record: appendToActionPayload,
43
+ context,
44
+ moduleName
45
+ });
46
+ return NameFieldModel({
47
+ uiType: FieldTypes.PrimaryField,
48
+ appendToActionPayload,
49
+ name,
50
+ value: nameFieldValue
51
+ });
52
+ };
53
+
54
+ export default NameFieldTranslator;
@@ -1,7 +1,13 @@
1
+ // import FieldModel from '@platform/zfield/entities/interfaces/FieldModel';
1
2
  import FieldTypes from "../../../../../../cc/fields/field/Types";
2
3
  import NumberFieldModel from "../../../../../../cc/fields/number/Model";
3
4
 
4
- const NumberLineFieldTranslator = (field, value, appendToActionPayload) => {
5
+ const NumberLineFieldTranslator = _ref => {
6
+ let {
7
+ field,
8
+ value,
9
+ appendToActionPayload
10
+ } = _ref;
5
11
  const {
6
12
  uiType,
7
13
  name
@@ -1,7 +1,13 @@
1
+ // import FieldModel from '@platform/zfield/entities/interfaces/FieldModel';
1
2
  import FieldTypes from "../../../../../../cc/fields/field/Types";
2
3
  import PercentFieldModel from "../../../../../../cc/fields/percent/Model";
3
4
 
4
- const PercentageFieldTranslator = (field, value, appendToActionPayload) => {
5
+ const PercentageFieldTranslator = _ref => {
6
+ let {
7
+ field,
8
+ value,
9
+ appendToActionPayload
10
+ } = _ref;
5
11
  const {
6
12
  uiType,
7
13
  name
@@ -1,7 +1,13 @@
1
+ // import FieldModel from '@platform/zfield/entities/interfaces/FieldModel';
1
2
  import FieldTypes from "../../../../../../cc/fields/field/Types";
2
3
  import PhoneFieldModel from "../../../../../../cc/fields/phone/Model";
3
4
 
4
- const PhoneFieldTranslator = (field, value, appendToActionPayload) => {
5
+ const PhoneFieldTranslator = _ref => {
6
+ let {
7
+ field,
8
+ value,
9
+ appendToActionPayload
10
+ } = _ref;
5
11
  const {
6
12
  uiType,
7
13
  name
@@ -1,8 +1,14 @@
1
+ // import FieldModel from '@platform/zfield/entities/interfaces/FieldModel';
1
2
  import FieldTypes from "../../../../../../cc/fields/field/Types";
2
3
  import PickListFieldModel from "../../../../../../cc/fields/pick-list/Model";
3
4
  import ColouredPickListFieldModel from "../../../../../../cc/fields/coloured-pick-list/Model";
4
5
 
5
- const PickListFieldTranslator = (field, value, appendToActionPayload) => {
6
+ const PickListFieldTranslator = _ref => {
7
+ let {
8
+ field,
9
+ value,
10
+ appendToActionPayload
11
+ } = _ref;
6
12
  const {
7
13
  uiType,
8
14
  name,
@@ -1,7 +1,13 @@
1
+ // import FieldModel from '@platform/zfield/entities/interfaces/FieldModel';
1
2
  import FieldTypes from "../../../../../../cc/fields/field/Types";
2
3
  import TextFieldModel from "../../../../../../cc/fields/text/Model";
3
4
 
4
- const SingleLineFieldTranslator = (field, value, appendToActionPayload) => {
5
+ const SingleLineFieldTranslator = _ref => {
6
+ let {
7
+ field,
8
+ value,
9
+ appendToActionPayload
10
+ } = _ref;
5
11
  const {
6
12
  uiType,
7
13
  name
@@ -1,7 +1,13 @@
1
+ // import FieldModel from '@platform/zfield/entities/interfaces/FieldModel';
1
2
  import FieldTypes from "../../../../../../cc/fields/field/Types";
2
3
  import UrlFieldModel from "../../../../../../cc/fields/url/Model";
3
4
 
4
- const URLFieldTranslator = (field, value, appendToActionPayload) => {
5
+ const URLFieldTranslator = _ref => {
6
+ let {
7
+ field,
8
+ value,
9
+ appendToActionPayload
10
+ } = _ref;
5
11
  const {
6
12
  uiType,
7
13
  name
@@ -14,7 +14,9 @@ export { default as DateTime } from "./DateTimeFieldTranslator";
14
14
  export { default as Picklist } from "./PickListFieldTranslator";
15
15
  export { default as Multiselect } from "./MultiSelectFieldTranslator";
16
16
  export { default as LookUp } from "./LookUpFieldTranslator";
17
- export { default as Formula } from "./FormulaFieldTranslator"; // // Field Name is to be similar to the API response
17
+ export { default as Formula } from "./FormulaFieldTranslator"; // Special Field Type
18
+
19
+ export { default as NameField } from "./NameFieldTranslator"; // // Field Name is to be similar to the API response
18
20
  // class FieldTranslator {
19
21
  // static translate(field, value) {
20
22
  // const { type } = field;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/library-platform",
3
- "version": "1.1.10-exp.3",
3
+ "version": "1.1.10-exp.5",
4
4
  "description": "",
5
5
  "main": "es/index.js",
6
6
  "files": [
@@ -97,4 +97,4 @@
97
97
  "jsep": "0.3.5",
98
98
  "object-path-immutable": "4.1.2"
99
99
  }
100
- }
100
+ }
package/es/.DS_Store DELETED
Binary file
@@ -1,12 +0,0 @@
1
- class SmartFormConstants {
2
- static SMART_FORM_FIELD_FOCUSED = 'SMART_FORM#FIELD_FOCUSED';
3
- static SMART_FORM_FIELD_BLURRED = 'SMART_FORM#FIELD_BLURRED';
4
- static SMART_FORM_FIELD_VALUE_CHANGED = 'SMART_FORM#FIELD_VALUE_CHANGED';
5
- static SMART_FORM_SUBMIT = 'SMART_FORM#SUBMIT';
6
- static SMART_FORM_SUBMIT_CLICKED = 'SMART_FORM#SUBMIT_CLICKED';
7
- static SMART_FORM_CANCEL_CLICKED = 'SMART_FORM#CANCEL_CLICKED';
8
- static SMART_FORM_SUBMIT_SUCCESS = 'SMART_FORM#SUBMIT_SUCCESS';
9
- static SMART_FORM_SUBMIT_FAILURE = 'SMART_FORM#SUBMIT_FAILED';
10
- }
11
-
12
- export default SmartFormConstants;
Binary file
@@ -1,51 +0,0 @@
1
- export const actionSchema = {
2
- type: 'object',
3
- properties: {
4
- component: {
5
- type: 'string'
6
- },
7
- id: {
8
- type: 'string'
9
- },
10
- properties: {
11
- type: 'object'
12
- },
13
- eventMappings: {
14
- type: 'array',
15
- minItems: 0,
16
- items: {
17
- type: 'object',
18
- properties: {
19
- action: {
20
- type: 'object',
21
- properties: {
22
- event: {
23
- type: 'string'
24
- },
25
- payload: {
26
- type: 'object'
27
- }
28
- },
29
- required: ['event', 'payload']
30
- },
31
- id: {
32
- type: 'string'
33
- },
34
- sourceEvent: {
35
- type: 'string'
36
- }
37
- },
38
- required: ['id']
39
- }
40
- }
41
- },
42
- required: ['component', 'properties']
43
- };
44
- export default {
45
- action: {
46
- required: true,
47
- typeMetadata: {
48
- schema: actionSchema
49
- }
50
- }
51
- };
@@ -1,9 +0,0 @@
1
- import { createCustomComponent } from "../../../../../../library/custom-component";
2
- import DynamicActionComponentProperties from "../../../../cc/dynamic-action-component/Properties";
3
- import DynamicActionComponentView from "./DynamicActionComponentView";
4
- export default createCustomComponent({
5
- name: 'DynamicActionComponent',
6
- properties: DynamicActionComponentProperties,
7
- eventHandlers: {},
8
- View: DynamicActionComponentView
9
- });
@@ -1,38 +0,0 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
- import React from 'react';
4
- import ComponentRegistry from "../../../../../../library/custom-component/frameworks/ui/ComponentRegistry";
5
- import ActionComponentMapping from "../../../../../../library/dot/components/action-location/frameworks/ui/ActionComponentMapping";
6
-
7
- function DynamicComponentView(_ref, ref) {
8
- let {
9
- state
10
- } = _ref;
11
- const {
12
- action
13
- } = state.properties;
14
- const {
15
- component,
16
- properties,
17
- eventMappings,
18
- id: actionId
19
- } = action;
20
- const Component = ComponentRegistry.get(component) || ActionComponentMapping[component];
21
-
22
- if (!Component) {
23
- return /*#__PURE__*/React.createElement("div", {
24
- ref: ref
25
- }, "Error");
26
- }
27
-
28
- return /*#__PURE__*/React.createElement(Component, _extends({
29
- getRef: ref
30
- }, properties, {
31
- appendToActionPayload: {
32
- eventMappings,
33
- actionId
34
- }
35
- }));
36
- }
37
-
38
- export default DynamicComponentView;
@@ -1,12 +0,0 @@
1
- import { createCustomComponent } from "../../../../../../library/custom-component";
2
- import RowActionsRendererProperties from "../../../../cc/action-event-mediator/Properties";
3
- import RowActionsRendererView from "./RowActionsRendererView";
4
- import { ComponentRegistry } from "../../../../../../library";
5
- const RowActionsRendererComponent = createCustomComponent({
6
- name: 'RowActionsRenderer',
7
- properties: RowActionsRendererProperties,
8
- eventHandlers: {},
9
- View: RowActionsRendererView
10
- });
11
- ComponentRegistry.register("RowActionsRenderer", RowActionsRendererComponent);
12
- export default RowActionsRendererComponent;
@@ -1,19 +0,0 @@
1
- .wrapper {
2
- max-width: 100%
3
- }
4
-
5
- .gap_small {
6
- gap: var(--zd_size4)
7
- }
8
-
9
- .gap_xmedium {
10
- gap: var(--zd_size6)
11
- }
12
-
13
- .gap_medium {
14
- gap: var(--zd_size8)
15
- }
16
-
17
- .gap_large {
18
- gap: var(--zd_size10)
19
- }
@@ -1,33 +0,0 @@
1
- import React from 'react';
2
- import Flex from '@zohodesk/layout/es/Flex/Flex';
3
- import DynamicActionComponent from "../../../dynamic-component/frameworks/ui/DynamicActionComponent";
4
- import { ActionViewGap } from "../../../interfaces/ActionViewModel";
5
- // @ts-ignore
6
- import style from "./RowActionsRenderer.module.css";
7
-
8
- function RowActionsRendererView(_ref, ref) {
9
- let {
10
- state
11
- } = _ref;
12
- const {
13
- actions,
14
- gap,
15
- testId
16
- } = state.properties;
17
- return /*#__PURE__*/React.createElement(Flex, {
18
- ref: ref,
19
- testId: testId,
20
- customId: testId,
21
- $ui_displayMode: "inline",
22
- $ui_alignItems: "center",
23
- $ui_className: `${style.wrapper} ${gap !== ActionViewGap.NONE ? style[`gap_${gap}`] : ''}`
24
- }, actions.map((action, index) => {
25
- return /*#__PURE__*/React.createElement(DynamicActionComponent, {
26
- action: action,
27
- key: index
28
- });
29
- }));
30
- }
31
-
32
- ;
33
- export default RowActionsRendererView;
@@ -1,18 +0,0 @@
1
- const fetchDependencyMappings = {
2
- name: 'fetchDependencyMappings',
3
- api: '/{{servicePrefix}}/{{orgName}}/api/v1/dependencyMappings',
4
- parameters: `{"layoutId":"{{layoutId}}"}`,
5
- type: 'GET',
6
- transformer: data => data,
7
- properties: {
8
- layoutId: {
9
- required: true,
10
- typeMetadata: {
11
- schema: {
12
- type: 'string'
13
- }
14
- }
15
- }
16
- }
17
- };
18
- export default fetchDependencyMappings;
@@ -1,29 +0,0 @@
1
- // Assuming GetTemplate interface is defined
2
- const fetchLayoutRules = {
3
- name: 'fetchLayoutRules',
4
- api: '/{{servicePrefix}}/{{orgName}}/api/v1/layouts/{{layoutId}}/layoutRules',
5
- parameters: `{"activeRulesOnly":{{activeRulesOnly}}}`,
6
- type: 'GET',
7
- transformer: data => data,
8
- properties: {
9
- layoutId: {
10
- required: true,
11
- typeMetadata: {
12
- schema: {
13
- type: 'string'
14
- }
15
- }
16
- },
17
- activeRulesOnly: {
18
- required: true,
19
- typeMetadata: {
20
- schema: {
21
- type: 'boolean'
22
- }
23
- },
24
- defaultValue: true // Assuming true as a default if parameter is optional
25
-
26
- }
27
- }
28
- };
29
- export default fetchLayoutRules;
@@ -1,19 +0,0 @@
1
- // Assuming similar structure to PatchTemplate
2
- const fetchMyForm = {
3
- name: 'myFormFetch',
4
- api: '/{{servicePrefix}}/{{orgName}}/api/v1/myForm',
5
- parameters: `{"layoutId":"{{layoutId}}"}`,
6
- type: 'GET',
7
- transformer: data => data,
8
- properties: {
9
- layoutId: {
10
- required: true,
11
- typeMetadata: {
12
- schema: {
13
- type: 'string'
14
- }
15
- }
16
- }
17
- }
18
- };
19
- export default fetchMyForm;
@@ -1,43 +0,0 @@
1
- // Assumed you have a GetTemplate interface similar to PatchTemplate
2
- const fetchMyLayouts = {
3
- name: 'myLayoutsFetch',
4
- api: '/{{servicePrefix}}/{{orgName}}/api/v1/myLayouts',
5
- parameters: `{"module":"{{module}}","departmentId":"{{departmentId}}","from":"{{from}}","limit":"{{limit}}"}`,
6
- type: 'GET',
7
- transformer: data => data,
8
- properties: {
9
- module: {
10
- required: true,
11
- typeMetadata: {
12
- schema: {
13
- type: 'string'
14
- }
15
- }
16
- },
17
- departmentId: {
18
- required: true,
19
- typeMetadata: {
20
- schema: {
21
- type: 'string'
22
- }
23
- }
24
- },
25
- from: {
26
- required: true,
27
- typeMetadata: {
28
- schema: {
29
- type: 'string'
30
- }
31
- }
32
- },
33
- limit: {
34
- required: true,
35
- typeMetadata: {
36
- schema: {
37
- type: 'string'
38
- }
39
- }
40
- }
41
- }
42
- };
43
- export default fetchMyLayouts;
@@ -1,30 +0,0 @@
1
- // Assuming GetTemplate interface is similar to PatchTemplate
2
- import { transFormValidationRules } from "../utils/validation-rules/TransFormValidationRules";
3
- const fetchValidationRules = {
4
- name: 'fetchValidationRules',
5
- api: '/{{servicePrefix}}/{{orgName}}/api/v1/layouts/{{layoutId}}/validationRules',
6
- parameters: `{"activeRulesOnly":{{activeRulesOnly}}}`,
7
- type: 'GET',
8
- transformer: transFormValidationRules,
9
- properties: {
10
- layoutId: {
11
- required: true,
12
- typeMetadata: {
13
- schema: {
14
- type: 'string'
15
- }
16
- }
17
- },
18
- activeRulesOnly: {
19
- required: true,
20
- typeMetadata: {
21
- schema: {
22
- type: 'boolean'
23
- }
24
- },
25
- defaultValue: true // Assuming default behavior if not provided
26
-
27
- }
28
- }
29
- };
30
- export default fetchValidationRules;
@@ -1,11 +0,0 @@
1
- import { Alignment } from "../../../../../cc/table-list/data-types/Header";
2
-
3
- function ColumnAlignmentTranslator(type) {
4
- if (type === 'Boolean') {
5
- return Alignment.Center;
6
- } else {
7
- return Alignment.Left;
8
- }
9
- }
10
-
11
- export default ColumnAlignmentTranslator;