@zohodesk/library-platform 1.1.10-exp.4 → 1.1.10-exp.6

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 (60) hide show
  1. package/es/cc/fields/field/Types.js +1 -0
  2. package/es/cc/fields/name/Events.js +3 -0
  3. package/es/cc/fields/name/Model.js +14 -0
  4. package/es/cc/fields/name/Properties.js +27 -0
  5. package/es/cc/table-connected/Properties.js +13 -0
  6. package/es/cc/table-connected/constants/ExternalConstants.js +1 -0
  7. package/es/cc/table-list/Constants.js +1 -0
  8. package/es/cc/table-list/Events.js +20 -0
  9. package/es/cc/table-list/Properties.js +2 -1
  10. package/es/library/analytics/Analytics.js +1 -1
  11. package/es/library/custom-component/adapters/gateways/event-manager/EventManager.js +23 -20
  12. package/es/library/custom-component/applications/usecases/UpdateStateUseCase.js +2 -4
  13. package/es/library/custom-component/domain/entities/ComponentProperties.js +0 -1
  14. package/es/library/custom-component/domain/entities/Logger.js +43 -37
  15. package/es/library/custom-component/frameworks/ui/ComponentRegistry.js +2 -2
  16. package/es/library/custom-component/frameworks/ui/CreateCustomComponent.js +1 -1
  17. package/es/library/dot/components/form/frameworks/ui/FormView.js +0 -1
  18. package/es/library/dot/components/section/frameworks/ui/RenderField.js +1 -1
  19. package/es/library/dot/components/table-list/frameworks/ui/sub-components/field/FieldComponent.js +1 -1
  20. package/es/library/dot/legacy-to-new-arch/table-field-components/index.js +2 -0
  21. package/es/library/dot/legacy-to-new-arch/table-field-components/primary-field/frameworks/ui/PrimaryField.js +12 -0
  22. package/es/library/dot/legacy-to-new-arch/table-field-components/primary-field/frameworks/ui/PrimaryFieldView.js +46 -0
  23. package/es/platform/components/table-connected/adapters/resources/ErrorPrinter.js +14 -11
  24. package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +14 -3
  25. package/es/platform/components/table-connected/frameworks/TableConnectedFactory.js +1 -1
  26. package/es/platform/data-source/http-template/fetchDependencyMappings.js +18 -0
  27. package/es/platform/data-source/http-template/fetchLayoutRules.js +29 -0
  28. package/es/platform/data-source/http-template/fetchMyForm.js +19 -0
  29. package/es/platform/data-source/http-template/fetchMyFormLayout.js +43 -0
  30. package/es/platform/data-source/http-template/fetchValidationRules.js +30 -0
  31. package/es/platform/data-source/utils/validation-rules/TransFormValidationRules.js +0 -1
  32. package/es/platform/sdk/domain/entities/ResourceManager.js +3 -3
  33. package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +1 -2
  34. package/es/platform/zform/domain/ZForm.js +2 -6
  35. package/es/platform/zform/frameworks/validation-rules/Validator.js +1 -1
  36. package/es/platform/zlist/adapters/presenters/TableTranslator.js +7 -3
  37. package/es/platform/zlist/adapters/presenters/translators/ColumnAlignmentTranslator.js +11 -0
  38. package/es/platform/zlist/adapters/presenters/translators/ColumnTranslator.js +23 -15
  39. package/es/platform/zlist/adapters/presenters/translators/FieldVariations.js +25 -0
  40. package/es/platform/zlist/adapters/presenters/translators/Row.js +3 -2
  41. package/es/platform/zlist/adapters/presenters/translators/RowsTranslator.js +4 -2
  42. package/es/platform/zlist/adapters/presenters/translators/fields/BooleanFieldTranslator.js +7 -1
  43. package/es/platform/zlist/adapters/presenters/translators/fields/CurrencyFieldTranslator.js +8 -1
  44. package/es/platform/zlist/adapters/presenters/translators/fields/DateFieldTranslator.js +7 -1
  45. package/es/platform/zlist/adapters/presenters/translators/fields/DateTimeFieldTranslator.js +7 -1
  46. package/es/platform/zlist/adapters/presenters/translators/fields/DecimalFieldTranslator.js +7 -1
  47. package/es/platform/zlist/adapters/presenters/translators/fields/EmailFieldTranslator.js +6 -1
  48. package/es/platform/zlist/adapters/presenters/translators/fields/FormulaFieldTranslator.js +8 -1
  49. package/es/platform/zlist/adapters/presenters/translators/fields/LookUpFieldTranslator.js +6 -1
  50. package/es/platform/zlist/adapters/presenters/translators/fields/MultiLineFieldTranslator.js +7 -1
  51. package/es/platform/zlist/adapters/presenters/translators/fields/MultiSelectFieldTranslator.js +7 -1
  52. package/es/platform/zlist/adapters/presenters/translators/fields/NameFieldTranslator.js +54 -0
  53. package/es/platform/zlist/adapters/presenters/translators/fields/NumberFieldTranslator.js +7 -1
  54. package/es/platform/zlist/adapters/presenters/translators/fields/PercentageFieldTranslator.js +7 -1
  55. package/es/platform/zlist/adapters/presenters/translators/fields/PhoneFieldTranslator.js +7 -1
  56. package/es/platform/zlist/adapters/presenters/translators/fields/PickListFieldTranslator.js +7 -1
  57. package/es/platform/zlist/adapters/presenters/translators/fields/SingleLineFieldTranslator.js +7 -1
  58. package/es/platform/zlist/adapters/presenters/translators/fields/URLFieldTranslator.js +7 -1
  59. package/es/platform/zlist/adapters/presenters/translators/fields/index.js +3 -1
  60. package/package.json +1 -2
@@ -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";
@@ -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: {
@@ -19,7 +19,7 @@ class Analytics {
19
19
  push(metric) {
20
20
  if (typeof this.pushCallback !== 'function') {
21
21
  if (!this.warningShown) {
22
- console.warn('Push callback is not initialized. Please call init() first.');
22
+ __DEVELOPMENT__ && console.warn('Push callback is not initialized. Please call init() first.');
23
23
  this.warningShown = true; // ✅ Set flag after logging once
24
24
  }
25
25
 
@@ -55,10 +55,10 @@ class EventManager {
55
55
  metaData,
56
56
  type
57
57
  } = event;
58
- this.log(type, payload, metaData);
58
+ __DEVELOPMENT__ && this.log(type, payload, metaData);
59
59
 
60
60
  if (!this._element) {
61
- console.error('Error: Element `ref` not found!', this._element, type, {
61
+ __DEVELOPMENT__ && console.error('Error: Element `ref` not found!', this._element, type, {
62
62
  payload,
63
63
  metaData
64
64
  });
@@ -110,25 +110,28 @@ class EventManager {
110
110
 
111
111
  printEventPayloadSchemaInvalidError(eventName, error) {
112
112
  let dataName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '(root)';
113
- const {
114
- msg,
115
- styles: nameStyles
116
- } = this.eventNameConsoleStyle(eventName);
117
- console.group(`${msg}%c's ${dataName} Validation Errors:`, ...nameStyles, 'color: initial; font-weight: initial');
118
-
119
- if (error.code === ErrorCode.InvalidSchema) {
120
- console.error(`%cInvalid Schema:`, 'color: #FF6F61; font-weight: bold;', error.error);
121
- } else if (error.code === ErrorCode.InvalidData) {
122
- error.errors.forEach((_ref, i) => {
123
- let {
124
- dataPath,
125
- message
126
- } = _ref;
127
- console.error(`%c${i + 1}. %c${dataName + dataPath}%c → ${message}`, 'color: initial;', 'color: #FF6F61; font-weight: bold;', 'color: #FFA500;');
128
- });
129
- }
130
113
 
131
- console.groupEnd(); // }
114
+ if (__DEVELOPMENT__) {
115
+ const {
116
+ msg,
117
+ styles: nameStyles
118
+ } = this.eventNameConsoleStyle(eventName);
119
+ console.group(`${msg}%c's ${dataName} Validation Errors:`, ...nameStyles, 'color: initial; font-weight: initial');
120
+
121
+ if (error.code === ErrorCode.InvalidSchema) {
122
+ console.error(`%cInvalid Schema:`, 'color: #FF6F61; font-weight: bold;', error.error);
123
+ } else if (error.code === ErrorCode.InvalidData) {
124
+ error.errors.forEach((_ref, i) => {
125
+ let {
126
+ dataPath,
127
+ message
128
+ } = _ref;
129
+ console.error(`%c${i + 1}. %c${dataName + dataPath}%c → ${message}`, 'color: initial;', 'color: #FF6F61; font-weight: bold;', 'color: #FFA500;');
130
+ });
131
+ }
132
+
133
+ console.groupEnd();
134
+ }
132
135
  }
133
136
 
134
137
  verifyEventPayload(event) {
@@ -8,11 +8,9 @@ class UpdateStateUseCase extends AbstractUseCase {
8
8
  eventManager
9
9
  } = this.dependencies;
10
10
  let component = repository.getComponent();
11
- let preState = component.getState(); // console.log(`preState ${component.getName()}`,preState)
12
-
11
+ let preState = component.getState();
13
12
  component.updateState(newState);
14
- let state = component.getState(); // console.log(`newState ${component.getName()}`,state)
15
-
13
+ let state = component.getState();
16
14
  presenter.render(state);
17
15
  eventManager.dispatch(component.getStateUpdatedAction({
18
16
  state,
@@ -43,7 +43,6 @@ export default class ComponentProperties {
43
43
  } = this.validateProperties(jsonValidator, newProps);
44
44
 
45
45
  if (!isValid) {
46
- // console.log({ isValid, componentName: this.componentName, validationResults });
47
46
  throw {
48
47
  code: ErrorCodes.PROPERTY_VALIDATION_FAILED,
49
48
  message: `Properties validation failed for component ${this.componentName}`,
@@ -12,55 +12,61 @@ export default class Logger {
12
12
 
13
13
 
14
14
  logPropertiesValidation(validationResults) {
15
- console.group(`%cProperties Validation: %c${this.componentName}`, ERROR_PRIMARY, ERROR_SECONDARY, validationResults);
16
- validationResults.forEach(_ref => {
17
- let {
18
- key,
19
- errors,
20
- warnings,
21
- value
22
- } = _ref;
23
- errors?.forEach(error => {
24
- this.printResult(key, error, 'error');
15
+ if (__DEVELOPMENT__) {
16
+ console.group(`%cProperties Validation: %c${this.componentName}`, ERROR_PRIMARY, ERROR_SECONDARY, validationResults);
17
+ validationResults.forEach(_ref => {
18
+ let {
19
+ key,
20
+ errors,
21
+ warnings,
22
+ value
23
+ } = _ref;
24
+ errors?.forEach(error => {
25
+ this.printResult(key, error, 'error');
26
+ });
27
+ warnings?.forEach(warning => {
28
+ this.printResult(key, warning, 'warning');
29
+ });
30
+ console.log('%cBut, Given is:', 'color: white;font-weight: bold;', {
31
+ [key]: value
32
+ });
25
33
  });
26
- warnings?.forEach(warning => {
27
- this.printResult(key, warning, 'warning');
28
- });
29
- console.log('%cBut, Given is:', 'color: white;font-weight: bold;', {
30
- [key]: value
31
- });
32
- });
33
- console.groupEnd();
34
+ console.groupEnd();
35
+ }
34
36
  }
35
37
 
36
38
  logError(error) {
37
- console.log('Logging Error in ComponentProperties - logError');
39
+ if (__DEVELOPMENT__) {
40
+ console.log('Logging Error in ComponentProperties - logError');
38
41
 
39
- if (error.code === ErrorCodes.PROPERTY_VALIDATION_FAILED) {
40
- this.logPropertiesValidation(error.errorDetails?.validationResults);
41
- return;
42
- }
42
+ if (error.code === ErrorCodes.PROPERTY_VALIDATION_FAILED) {
43
+ this.logPropertiesValidation(error.errorDetails?.validationResults);
44
+ return;
45
+ }
43
46
 
44
- console.group(`%cError Occurred: %c${this.componentName}`, ERROR_PRIMARY, ERROR_SECONDARY, error);
45
- console.error(`%cError Code: %c${error.code}`, ERROR_PRIMARY, ERROR_SECONDARY);
46
- console.error(`%cError Message: %c${error.message}`, ERROR_PRIMARY, ERROR_SECONDARY);
47
+ console.group(`%cError Occurred: %c${this.componentName}`, ERROR_PRIMARY, ERROR_SECONDARY, error);
48
+ console.error(`%cError Code: %c${error.code}`, ERROR_PRIMARY, ERROR_SECONDARY);
49
+ console.error(`%cError Message: %c${error.message}`, ERROR_PRIMARY, ERROR_SECONDARY);
47
50
 
48
- if (error.errorDetails?.originalError) {
49
- console.error(error.errorDetails.originalError);
50
- }
51
+ if (error.errorDetails?.originalError) {
52
+ console.error(error.errorDetails.originalError);
53
+ }
51
54
 
52
- console.groupEnd();
55
+ console.groupEnd();
56
+ }
53
57
  }
54
58
 
55
59
  printResult(key, errorOrWarning, type) {
56
- const log = type === 'error' ? console.error : console.warn;
60
+ if (__DEVELOPMENT__) {
61
+ const log = type === 'error' ? console.error : console.warn;
57
62
 
58
- if (errorOrWarning.dataPath) {
59
- log(`Invalid Property %c${key}%c${errorOrWarning.dataPath} %c${errorOrWarning.message}`, ERROR_PRIMARY, ERROR_SECONDARY, 'color: white;');
60
- return;
61
- }
63
+ if (errorOrWarning.dataPath) {
64
+ log(`Invalid Property %c${key}%c${errorOrWarning.dataPath} %c${errorOrWarning.message}`, ERROR_PRIMARY, ERROR_SECONDARY, 'color: white;');
65
+ return;
66
+ }
62
67
 
63
- log(`Invalid Property %c${key} : %c${errorOrWarning.message}`, ERROR_PRIMARY, 'color: white;');
68
+ log(`Invalid Property %c${key} : %c${errorOrWarning.message}`, ERROR_PRIMARY, 'color: white;');
69
+ }
64
70
  }
65
71
 
66
72
  eventNameConsoleStyle(type) {
@@ -81,7 +87,7 @@ export default class Logger {
81
87
  }
82
88
 
83
89
  logEvent(type, data) {
84
- if (this.isLoggingEnabledAndTypePresent(type)) {
90
+ if (__DEVELOPMENT__ && this.isLoggingEnabledAndTypePresent(type)) {
85
91
  const {
86
92
  msg,
87
93
  styles: nameStyles
@@ -13,11 +13,11 @@ class ComponentRegistry {
13
13
 
14
14
  register(name, component) {
15
15
  if (this.components.has(name)) {
16
- console.warn(`Component with name "${name}" is already registered. Overwriting the existing component.`);
16
+ __DEVELOPMENT__ && console.warn(`Component with name "${name}" is already registered. Overwriting the existing component.`);
17
17
  }
18
18
 
19
19
  if (this.components.has(name) && this.get(name) !== component) {
20
- console.warn(`Component with name "${name}" is already registered with a different instance. Overwriting the existing component.`);
20
+ __DEVELOPMENT__ && console.warn(`Component with name "${name}" is already registered with a different instance. Overwriting the existing component.`);
21
21
  }
22
22
 
23
23
  this.components.set(name, component);
@@ -77,7 +77,7 @@ const createCustomComponent = input => {
77
77
  }
78
78
 
79
79
  componentDidCatch(error, errorInfo) {
80
- console.log('Error', error, errorInfo, errorInfo.componentStack);
80
+ __DEVELOPMENT__ && console.log('Error', error, errorInfo, errorInfo.componentStack);
81
81
  }
82
82
 
83
83
  componentWillReceiveProps(nextProps, nextContext) {
@@ -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,
@@ -10,7 +10,7 @@ export function renderField(field, key) {
10
10
  const Component = ComponentRegistry.get(type);
11
11
 
12
12
  if (!Component) {
13
- console.warn(`Component for type "${type}" not found.`);
13
+ __DEVELOPMENT__ && console.warn(`Component for type "${type}" not found.`);
14
14
  return null;
15
15
  }
16
16
 
@@ -12,7 +12,7 @@ const FieldComponent = props => {
12
12
  const Component = FieldComponents[type] || ComponentRegistry.get(type);
13
13
 
14
14
  if (!Component) {
15
- console.error(`Field Component type ${type} not found`);
15
+ __DEVELOPMENT__ && console.error(`Field Component type ${type} not found`);
16
16
  return null;
17
17
  }
18
18
 
@@ -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
+ }
@@ -1,20 +1,23 @@
1
1
  export default class ErrorPrinter {
2
2
  static printError(error) {
3
- console.error('Error occurred:', error);
3
+ __DEVELOPMENT__ && console.error('Error occurred:', error);
4
4
  }
5
5
 
6
6
  static displaySchemaErrors(title, errors) {
7
7
  let dataName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '(root)';
8
- console.group(title.msg, ...title.styles);
9
- errors.forEach((_ref, i) => {
10
- let {
11
- dataPath,
12
- keyword,
13
- message
14
- } = _ref;
15
- console.error(`%c${i + 1}. %c${dataName + dataPath}%c → ${keyword} ${message}`, 'color: initial;', 'color: #FF6F61; font-weight: bold;', 'color: #FFA500;');
16
- });
17
- console.groupEnd();
8
+
9
+ if (__DEVELOPMENT__) {
10
+ console.group(title.msg, ...title.styles);
11
+ errors.forEach((_ref, i) => {
12
+ let {
13
+ dataPath,
14
+ keyword,
15
+ message
16
+ } = _ref;
17
+ console.error(`%c${i + 1}. %c${dataName + dataPath}%c → ${keyword} ${message}`, 'color: initial;', 'color: #FF6F61; font-weight: bold;', 'color: #FFA500;');
18
+ });
19
+ console.groupEnd();
20
+ }
18
21
  }
19
22
 
20
23
  }
@@ -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) {
@@ -53,7 +54,6 @@ export default class EventHandlersFactory {
53
54
  const wrapped = EventHandlersFactory.getSdkWrappedEventHandler(eventHandlers); // Generic addMetrics handler
54
55
 
55
56
  const addMetrics = args => {
56
- // console.log({ ...args }, "Arguments update Here");
57
57
  const {
58
58
  action
59
59
  } = args;
@@ -256,14 +256,25 @@ export default class EventHandlersFactory {
256
256
 
257
257
  const metrics = [smartTableRendered, smartTableFeatures, smartTableCustomComponents, smartTableSortApplied, ...smartTableColumnResized, smartTableRowsSelected, ...smartTableColumnVisibilityToggled, ...smartTableColumnReordered];
258
258
  metrics.forEach(metric => {
259
- // console.log("Pushing metric:", metric);
260
259
  Analytics.push(metric);
261
260
  });
262
261
  };
263
262
 
263
+ const navigationHandler = args => {
264
+ const {
265
+ action,
266
+ dispatch
267
+ } = args;
268
+ dispatch({
269
+ type: SmartTableConstants.ExternalConstants.SMART_TABLE_NAME_FIELD_CLICKED,
270
+ payload: action.payload
271
+ });
272
+ };
273
+
264
274
  const defaultEventHandlers = {
265
275
  NAVIGATION: NavigationHandler,
266
276
  // [`${name}#${LifeCycleEvents.MOUNT}`]: smartTableRenderedMetrics,
277
+ [TABLE_LIST_NAME_FIELD_CLICKED]: navigationHandler,
267
278
  [`${name}#${LifeCycleEvents.STATE_UPDATED}`]: addMetrics,
268
279
  [RESIZE_FINISHED]: new ResizeFinishController().handle,
269
280
  [TABLE_LIST_RESIZE_START_REQUESTED]: new ResizeStartController().handle,
@@ -52,7 +52,7 @@ export default class TableConnectedFactory {
52
52
  } = _ref;
53
53
 
54
54
  if (dataBroker) {
55
- console.warn('Desk Platform Warning: dataBroker is deprecated, use dataSource instead');
55
+ __DEVELOPMENT__ && console.warn('Desk Platform Warning: dataBroker is deprecated, use dataSource instead');
56
56
  }
57
57
 
58
58
  const _dataSource = combineDataSourceWithDefault(dataBroker ? dataBroker : dataSource);
@@ -0,0 +1,18 @@
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;
@@ -0,0 +1,29 @@
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;
@@ -0,0 +1,19 @@
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;