@zohodesk/library-platform 1.1.3-exp.2 → 1.1.3-temp-1

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 (43) hide show
  1. package/es/cc/table-list/Properties.js +9 -0
  2. package/es/cc/table-list/row/Properties.js +9 -0
  3. package/es/index.js +2 -1
  4. package/es/library/dot/components/table-list/frameworks/hooks/useTableRowReorder.js +17 -5
  5. package/es/library/dot/components/table-list/frameworks/ui/TableListView.js +35 -26
  6. package/es/library/dot/components/table-list/frameworks/ui/css/TableList.module.css +153 -56
  7. package/es/library/dot/components/table-list/frameworks/ui/sub-components/Header.js +22 -16
  8. package/es/library/dot/components/table-list/frameworks/ui/sub-components/Rows.js +7 -4
  9. package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/MassAction.js +5 -13
  10. package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/Row.js +31 -34
  11. package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/RowSelection.js +3 -8
  12. package/es/library/dot/components/table-list/frameworks/utils/getHeaderClasses.js +37 -0
  13. package/es/library/dot/components/table-list/frameworks/utils/getTableListClassName.js +37 -0
  14. package/es/library/dot/components/table-list/frameworks/utils/reOrder.js +28 -14
  15. package/es/library/dot/legacy-to-new-arch/text-area/frameworks/ui/TextAreaView.js +1 -1
  16. package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/ClientActionsAdapter.js +96 -0
  17. package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/EventHandlersFactory.js +11 -3
  18. package/es/platform/client-actions/template-resolver/index.js +1 -0
  19. package/es/platform/client-actions/translators/context-resolver/index.js +6 -6
  20. package/es/platform/components/table-connected/frameworks/TableConnectedView.js +2 -0
  21. package/es/platform/zform/adapters/presenter/FormTranslator.js +6 -127
  22. package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +32 -0
  23. package/es/platform/zform/adapters/presenter/translators/fields/BooleanFieldTranslator.js +20 -0
  24. package/es/platform/zform/adapters/presenter/translators/fields/CurrencyFieldTranslator.js +30 -0
  25. package/es/platform/zform/adapters/presenter/translators/fields/DateFieldTranslator.js +21 -0
  26. package/es/platform/zform/adapters/presenter/translators/fields/DateTimeFieldTranslator.js +21 -0
  27. package/es/platform/zform/adapters/presenter/translators/fields/DecimalFieldTranslator.js +30 -0
  28. package/es/platform/zform/adapters/presenter/translators/fields/EmailFieldTranslator.js +30 -0
  29. package/es/platform/zform/adapters/presenter/translators/fields/LookUpFieldTranslator.js +30 -0
  30. package/es/platform/zform/adapters/presenter/translators/fields/MultiselectFieldTranslator.js +29 -0
  31. package/es/platform/zform/adapters/presenter/translators/fields/NumberFieldTranslator.js +30 -0
  32. package/es/platform/zform/adapters/presenter/translators/fields/PercentageFieldTranslator.js +30 -0
  33. package/es/platform/zform/adapters/presenter/translators/fields/PhoneFieldTranslator.js +30 -0
  34. package/es/platform/zform/adapters/presenter/translators/fields/PicklistFieldTranslator.js +29 -0
  35. package/es/platform/zform/adapters/presenter/translators/fields/TextAreaFieldTranslator.js +30 -0
  36. package/es/platform/zform/adapters/presenter/translators/fields/TextFieldTranslator.js +27 -0
  37. package/es/platform/zform/adapters/presenter/translators/fields/URLFieldTranslator.js +30 -0
  38. package/es/platform/zform/adapters/presenter/translators/fields/index.js +15 -0
  39. package/es/platform/zform/applications/usecases/MyFormSuccessUseCase.js +3 -1
  40. package/es/platform/zform/domain/ZField.js +66 -17
  41. package/es/platform/zform/domain/ZSection.js +20 -7
  42. package/es/platform/zlist/adapters/presenters/TableTranslator.js +3 -3
  43. package/package.json +3 -3
@@ -29,7 +29,8 @@ function RowView(_ref, ref) {
29
29
  isFocussed,
30
30
  selectionTooltip,
31
31
  isDroppable,
32
- dropPosition
32
+ dropPosition,
33
+ isReOrderLoading
33
34
  } = state.properties;
34
35
  const {
35
36
  id,
@@ -44,7 +45,7 @@ function RowView(_ref, ref) {
44
45
  type,
45
46
  actions
46
47
  } = rowActionLocation;
47
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TableRow, {
48
+ return /*#__PURE__*/React.createElement(TableRow, {
48
49
  key: id,
49
50
  ref: ref,
50
51
  testId: id,
@@ -59,16 +60,14 @@ function RowView(_ref, ref) {
59
60
  }
60
61
  }),
61
62
  customStyle: {
63
+ tableList: isSelectionEnabled || isReorderEnabled ? style.row : '',
62
64
  $pointer: style[`rowCursor_${cursor}`]
63
65
  }
64
66
  }, renderReorderer({
65
- isSelectionEnabled,
66
67
  isReorderEnabled,
67
- isKeyboardControlsEnabled
68
+ isReOrderLoading
68
69
  }), renderRowSelection({
69
70
  isSelectionEnabled,
70
- isReorderEnabled,
71
- isKeyboardControlsEnabled,
72
71
  id,
73
72
  selectionTooltip,
74
73
  isSelected,
@@ -84,14 +83,12 @@ function RowView(_ref, ref) {
84
83
  actions
85
84
  }), isDroppable && /*#__PURE__*/React.createElement("div", {
86
85
  className: `${style.rowDropIndicator} ${dropPosition === 'downward' && style.dropIndicatorTop} ${dropPosition === 'upward' && style.dropIndicatorBottom}`
87
- })));
86
+ }));
88
87
  }
89
88
 
90
89
  function renderRowSelection(_ref2) {
91
90
  let {
92
91
  isSelectionEnabled,
93
- isReorderEnabled,
94
- isKeyboardControlsEnabled,
95
92
  id,
96
93
  selectionTooltip,
97
94
  isSelected,
@@ -100,8 +97,6 @@ function renderRowSelection(_ref2) {
100
97
  } = _ref2;
101
98
  return /*#__PURE__*/React.createElement(RowSelection, {
102
99
  isSelectionEnabled: isSelectionEnabled,
103
- isReorderEnabled: isReorderEnabled,
104
- isKeyboardControlsEnabled: isKeyboardControlsEnabled,
105
100
  id: id,
106
101
  tooltip: selectionTooltip,
107
102
  selected: isSelected,
@@ -110,32 +105,34 @@ function renderRowSelection(_ref2) {
110
105
  });
111
106
  }
112
107
 
113
- function renderReorderer(_ref3) {
108
+ const DragHandler = SortableHandle(_ref3 => {
114
109
  let {
115
- isSelectionEnabled,
116
- isReorderEnabled,
117
- isKeyboardControlsEnabled
110
+ isDisabled
118
111
  } = _ref3;
119
- const DragHandler = SortableHandle(_ref4 => {
120
- let {
121
- isSelectionEnabled,
122
- isReorderEnabled,
123
- isKeyboardControlsEnabled
124
- } = _ref4;
125
- return /*#__PURE__*/React.createElement("td", {
126
- tabIndex: 0,
127
- className: `${style.dragHandleWrapper} ${isKeyboardControlsEnabled && isSelectionEnabled && !isReorderEnabled ? style.paddingRight16 : isKeyboardControlsEnabled ? `${style.offsetLeft8} ${style.paddingLeft0} ${style.paddingRight8}` : `${style.offsetLeft0} ${style.paddingLeft8}`}`
128
- }, /*#__PURE__*/React.createElement(DragHandle, {
129
- customStyle: {
130
- container: `${style.dragHandleContainer} `
131
- }
132
- }));
112
+ return /*#__PURE__*/React.createElement(DragHandle, {
113
+ isDisabled: isDisabled,
114
+ customStyle: {
115
+ container: style.dragHandleContainer
116
+ }
133
117
  });
134
- return isReorderEnabled ? /*#__PURE__*/React.createElement(DragHandler, {
135
- isSelectionEnabled: isSelectionEnabled,
136
- isReorderEnabled: isReorderEnabled,
137
- isKeyboardControlsEnabled: isKeyboardControlsEnabled
138
- }) : null;
118
+ });
119
+
120
+ function renderReorderer(_ref4) {
121
+ let {
122
+ isReorderEnabled,
123
+ isReOrderLoading
124
+ } = _ref4;
125
+
126
+ if (!isReorderEnabled) {
127
+ return null;
128
+ }
129
+
130
+ return /*#__PURE__*/React.createElement("td", {
131
+ tabIndex: 0,
132
+ className: style.dragHandleWrapper
133
+ }, /*#__PURE__*/React.createElement(DragHandler, {
134
+ isDisabled: isReOrderLoading
135
+ }));
139
136
  }
140
137
 
141
138
  function renderColumns(_ref5) {
@@ -1,13 +1,12 @@
1
1
  import React from 'react';
2
2
  import TableListSelect from '@zohodesk-private/desk-components/es/table/TableListSelect/TableListSelect';
3
- import { TableListConstants } from "../../../../../../../../cc/table-list";
3
+ import { TableListConstants } from "../../../../../../../../cc/table-list"; // @ts-ignore
4
+
4
5
  import style from "./../../css/TableList.module.css";
5
6
 
6
7
  function RowSelection(_ref) {
7
8
  let {
8
9
  isSelectionEnabled,
9
- isReorderEnabled,
10
- isKeyboardControlsEnabled,
11
10
  id,
12
11
  tooltip,
13
12
  selected,
@@ -19,17 +18,13 @@ function RowSelection(_ref) {
19
18
  return null;
20
19
  }
21
20
 
22
- const customPropsContainer = isReorderEnabled && isSelectionEnabled ? {
23
- $data_width: 56
24
- } : {};
25
21
  return /*#__PURE__*/React.createElement(TableListSelect, {
26
22
  $data_id: id,
27
23
  $i18n_tooltip: tooltip,
28
24
  $flag_checked: selected,
29
25
  customStyle: {
30
- container: isReorderEnabled && isSelectionEnabled ? `${style.offsetLeft24} ${style.paddingRight24}` : isKeyboardControlsEnabled && isSelectionEnabled ? `${style.paddingRight16} ${style.offsetLeft8}` : isKeyboardControlsEnabled ? style.offsetLeft8 : style.offsetLeft0
26
+ container: style.tableListSelectContainer
31
27
  },
32
- $customProps_container: customPropsContainer,
33
28
  $flag_disabled: !selectable,
34
29
  $event_onChange: (_, event) => dispatch({
35
30
  type: TableListConstants.TABLE_LIST_TOGGLE_ITEM_SELECTION,
@@ -0,0 +1,37 @@
1
+ export default function getTableListHeaderClassName(_ref) {
2
+ let {
3
+ isKeyboardControlsEnabled,
4
+ isReorderEnabled,
5
+ isSelectionEnabled
6
+ } = _ref;
7
+
8
+ if (isKeyboardControlsEnabled && isReorderEnabled && isSelectionEnabled) {
9
+ return 'tableListHeader-kbdReorderSelection';
10
+ }
11
+
12
+ if (isKeyboardControlsEnabled && isReorderEnabled && !isSelectionEnabled) {
13
+ return 'tableListHeader-kbdReorder';
14
+ }
15
+
16
+ if (isKeyboardControlsEnabled && isSelectionEnabled && !isReorderEnabled) {
17
+ return 'tableListHeader-kbdSelection';
18
+ }
19
+
20
+ if (isKeyboardControlsEnabled && !isReorderEnabled && !isSelectionEnabled) {
21
+ return 'tableListHeader-kbd';
22
+ }
23
+
24
+ if (isReorderEnabled && isSelectionEnabled && !isKeyboardControlsEnabled) {
25
+ return 'tableListHeader-reorderSelection';
26
+ }
27
+
28
+ if (isReorderEnabled && !isSelectionEnabled && !isKeyboardControlsEnabled) {
29
+ return 'tableListHeader-reorder';
30
+ }
31
+
32
+ if (isSelectionEnabled && !isReorderEnabled && !isKeyboardControlsEnabled) {
33
+ return 'tableListHeader-selection';
34
+ }
35
+
36
+ return 'tableListHeader';
37
+ }
@@ -0,0 +1,37 @@
1
+ export default function getTableListClassName(_ref) {
2
+ let {
3
+ isKeyboardControlsEnabled,
4
+ isReorderEnabled,
5
+ isSelectionEnabled
6
+ } = _ref;
7
+
8
+ if (isKeyboardControlsEnabled && isReorderEnabled && isSelectionEnabled) {
9
+ return 'tableListRow-kbdReorderSelection';
10
+ }
11
+
12
+ if (isKeyboardControlsEnabled && isReorderEnabled && !isSelectionEnabled) {
13
+ return 'tableListRow-kbdReorder';
14
+ }
15
+
16
+ if (isKeyboardControlsEnabled && isSelectionEnabled && !isReorderEnabled) {
17
+ return 'tableListRow-kbdSelection';
18
+ }
19
+
20
+ if (isKeyboardControlsEnabled && !isReorderEnabled && !isSelectionEnabled) {
21
+ return 'tableListRow-kbd';
22
+ }
23
+
24
+ if (isReorderEnabled && isSelectionEnabled && !isKeyboardControlsEnabled) {
25
+ return 'tableListRow-reorderSelection';
26
+ }
27
+
28
+ if (isReorderEnabled && !isSelectionEnabled && !isKeyboardControlsEnabled) {
29
+ return 'tableListRow-reorder';
30
+ }
31
+
32
+ if (isSelectionEnabled && !isReorderEnabled && !isKeyboardControlsEnabled) {
33
+ return 'tableListRow-selection';
34
+ }
35
+
36
+ return 'tableListRow';
37
+ }
@@ -23,9 +23,13 @@ export function parseCssNumberWithUnit(value) {
23
23
  unit: match[3] || ""
24
24
  };
25
25
  }
26
- export function setTableUserSelect(ref, value) {
26
+ export function setTableInteractionClass(ref, className, add) {
27
27
  if (ref.current) {
28
- ref.current.style.userSelect = value;
28
+ if (add && !ref.current.classList.contains(className)) {
29
+ ref.current.classList.add(className);
30
+ } else if (!add && ref.current.classList.contains(className)) {
31
+ ref.current.classList.remove(className);
32
+ }
29
33
  }
30
34
  }
31
35
  export function adjustHelperElementPosition(ref, draggingClass) {
@@ -39,6 +43,8 @@ export function adjustHelperElementPosition(ref, draggingClass) {
39
43
  if (helperLeft && helperLeft.unit === 'px') {
40
44
  helperElement.style.left = `${helperLeft.number + TableScrollLeft}px`;
41
45
  }
46
+
47
+ helperElement.scrollLeft = TableScrollLeft;
42
48
  }
43
49
  }
44
50
  }
@@ -52,21 +58,29 @@ export function getDropIndicator(_ref) {
52
58
  const isMovingDown = newIndex > oldIndex;
53
59
  let dropIndex, normalizedDropIndex, dropPosition;
54
60
 
55
- if (isMovingDown) {
56
- dropIndex = newIndex < index ? newIndex : newIndex + 1;
61
+ if (index === newIndex && newIndex === 0) {
62
+ normalizedDropIndex = 1;
63
+ dropPosition = 'downward';
64
+ } else if (index === newIndex && newIndex === rowsLength - 1) {
65
+ normalizedDropIndex = rowsLength - 2;
66
+ dropPosition = 'upward';
57
67
  } else {
58
- dropIndex = newIndex <= index ? newIndex - 1 : newIndex;
59
- }
68
+ if (isMovingDown) {
69
+ dropIndex = newIndex < index ? newIndex : newIndex + 1;
70
+ } else {
71
+ dropIndex = newIndex <= index ? newIndex - 1 : newIndex;
72
+ }
60
73
 
61
- normalizedDropIndex = dropIndex;
62
- dropPosition = isMovingDown ? 'downward' : 'upward';
74
+ normalizedDropIndex = dropIndex;
75
+ dropPosition = isMovingDown ? 'downward' : 'upward';
63
76
 
64
- if (dropIndex < 0) {
65
- normalizedDropIndex = 0;
66
- dropPosition = 'downward';
67
- } else if (dropIndex >= rowsLength) {
68
- normalizedDropIndex = rowsLength - 1;
69
- dropPosition = 'upward';
77
+ if (dropIndex < 0) {
78
+ normalizedDropIndex = 0;
79
+ dropPosition = 'downward';
80
+ } else if (dropIndex >= rowsLength) {
81
+ normalizedDropIndex = rowsLength - 1;
82
+ dropPosition = 'upward';
83
+ }
70
84
  }
71
85
 
72
86
  return {
@@ -27,7 +27,7 @@ function TextAreaView(_ref, ref) {
27
27
  text: value,
28
28
  isReadOnly: readonly,
29
29
  isDisabled: disabled,
30
- animated: true,
30
+ animated: !readonly && !disabled,
31
31
  size: "xsmall",
32
32
  customAttributes: {
33
33
  required
@@ -0,0 +1,96 @@
1
+ import { createCustomComponent } from "../../../../../../library/custom-component";
2
+ import ActionEventMediatorProperties from "../../../../cc/action-event-mediator/Properties";
3
+ import EventHandlersFactory from "./EventHandlersFactory";
4
+ import ActionEventMediatorView from "./ActionEventMediatorView"; // import ClientActionsSDKFactory from '../../../../behaviour/zclient-actions/frameworks/sdk/ClientActionsSDKFactory'; TODO: Add support for returning clientActionsSDK factory when client actions SDK is merged to V2
5
+
6
+ import ClientActionsBehaviourFactory from "../../../../behaviour/zclient-actions/frameworks/ClientActionsBehaviourFactory";
7
+ import getClientActions from "../../../../../data-source/http-template/getClientActions";
8
+ import ClientActionsTranslator from "../../../../translators/client-actions-translator";
9
+ import FetchGateWay from "../../../../../zhttp/adapters/gateway/FetchGateWay";
10
+ import APITemplate from "../../../../../zdata-source/domain/entities/APITemplate";
11
+ import TemplateHelpers from "../../../../../zdata-source/adapters/gateways/TemplateHelpers";
12
+ ;
13
+ const windowWrapper = window;
14
+ const ClientActionsAdapterUtils = {
15
+ getClientActionsAPIDetails(args) {
16
+ const apiTemplate = new APITemplate(getClientActions, new TemplateHelpers());
17
+ args.servicePrefix = 'supportapi/zd';
18
+ args.orgName = windowWrapper.currentOrg.portalName;
19
+ const apiDetails = apiTemplate.getApiDetails(args);
20
+ apiDetails.options = {
21
+ headers: {
22
+ orgId: windowWrapper.currentOrg.id
23
+ },
24
+ method: apiDetails.method
25
+ };
26
+ return apiDetails;
27
+ },
28
+
29
+ transform(input) {
30
+ return ClientActionsTranslator.transform(input, {
31
+ departmentName: windowWrapper.currentDepartment.sanitizedName,
32
+ orgId: windowWrapper.currentOrg.id,
33
+ orgName: windowWrapper.currentOrg.portalName,
34
+ servicePrefix: 'supportapi/zd'
35
+ });
36
+ }
37
+
38
+ };
39
+ const ClientActionsAdapter = {
40
+ createEventHandler(clientScript) {
41
+ return event => {
42
+ let response = {
43
+ event: event,
44
+ sdk: {}
45
+ }; // response.sdks.clientActions = ClientActionsSDKFactory.create({ TODO: Add support for returning clientActionsSDK factory when client actions SDK is merged to V2
46
+ // state: event.state,
47
+ // dispatch: event.dispatch
48
+ // });
49
+
50
+ clientScript(response);
51
+ };
52
+ },
53
+
54
+ createActionToEventHandlers(clientScripts) {
55
+ const actionEventHandlers = {};
56
+ Object.keys(clientScripts).map(targetEvent => {
57
+ const clientScript = clientScripts[targetEvent];
58
+ actionEventHandlers[targetEvent] = ClientActionsAdapter.createEventHandler(clientScript);
59
+ });
60
+ return actionEventHandlers;
61
+ },
62
+
63
+ fetchClientActions(args) {
64
+ const apiDetails = ClientActionsAdapterUtils.getClientActionsAPIDetails(args);
65
+ const fetchGateway = new FetchGateWay(window.fetch.bind(window));
66
+ return fetchGateway.fetch(apiDetails.url, apiDetails.options).then(response => {
67
+ return response.json();
68
+ }).then(response => {
69
+ if (response.errorCode) {
70
+ return Promise.reject(response);
71
+ } else {
72
+ const actions = ClientActionsAdapterUtils.transform(response);
73
+ return Promise.resolve(actions);
74
+ }
75
+ });
76
+ },
77
+
78
+ getClientActionComponent: clientScripts => {
79
+ return createCustomComponent({
80
+ name: 'ClientActionsAdapter',
81
+ properties: ActionEventMediatorProperties,
82
+ setInitialState: () => ({
83
+ handlers: {}
84
+ }),
85
+ eventHandlers: { ...EventHandlersFactory.createClientActionsAdapterEventHandlers(),
86
+ ...ClientActionsAdapter.createActionToEventHandlers(clientScripts)
87
+ },
88
+ behaviours: [ClientActionsBehaviourFactory.create({
89
+ getClientActions: getClientActions
90
+ })],
91
+ View: ActionEventMediatorView
92
+ });
93
+ }
94
+ };
95
+ export const getClientActionsAdapter = ClientActionsAdapter.getClientActionComponent;
96
+ export const fetchClientActions = ClientActionsAdapter.fetchClientActions;
@@ -9,6 +9,14 @@ import PropertiesChangeController from "../../adapters/controllers/PropertiesCha
9
9
  import LifeCycleEvents from "../../../../../../cc/component/LifeCycleEventsEnum";
10
10
  export default class EventHandlersFactory {
11
11
  static create() {
12
+ return EventHandlersFactory.createClientActionsLifeCycleEventHandlers('ActionEventMediator');
13
+ }
14
+
15
+ static createClientActionsAdapterEventHandlers() {
16
+ return EventHandlersFactory.createClientActionsLifeCycleEventHandlers('ClientActionsAdapter');
17
+ }
18
+
19
+ static createClientActionsLifeCycleEventHandlers(componentName) {
12
20
  const repository = new Repository();
13
21
  const presenter = new Presenter();
14
22
  const dependencies = {
@@ -22,9 +30,9 @@ export default class EventHandlersFactory {
22
30
  const unmountController = new UnmountController(destroyUseCase);
23
31
  const propertiesChangeController = new PropertiesChangeController(propertiesChangeUseCase);
24
32
  return {
25
- [`ActionEventMediator#${LifeCycleEvents.MOUNT}`]: initializeController.handle,
26
- [`ActionEventMediator#${LifeCycleEvents.UPDATE_PROPERTIES}`]: propertiesChangeController.handle,
27
- [`ActionEventMediator#${LifeCycleEvents.UN_MOUNT}`]: unmountController.handle
33
+ [`${componentName}#${LifeCycleEvents.MOUNT}`]: initializeController.handle,
34
+ [`${componentName}#${LifeCycleEvents.UPDATE_PROPERTIES}`]: propertiesChangeController.handle,
35
+ [`${componentName}#${LifeCycleEvents.UN_MOUNT}`]: unmountController.handle
28
36
  };
29
37
  }
30
38
 
@@ -22,6 +22,7 @@ export default class TemplateResolver {
22
22
  }
23
23
 
24
24
  static replaceContextVariablesInObject(properties, replacementObj) {
25
+ if (!properties) return {};
25
26
  const replaced = {};
26
27
  Object.entries(properties).forEach(_ref => {
27
28
  let [key, value] = _ref;
@@ -4,7 +4,7 @@ export class ActionContextResolver {
4
4
 
5
5
  static resolveContextInEventMappingPayload(eventMapping, context) {
6
6
  return { ...eventMapping,
7
- payloadValueMapping: TemplateResolver.replaceContextVariablesInObject(eventMapping.payloadValueMappingMeta, context)
7
+ payloadValueMapping: TemplateResolver.replaceContextVariablesInObject(eventMapping.payloadValueMapping, context)
8
8
  };
9
9
  }
10
10
 
@@ -14,9 +14,9 @@ export class ActionContextResolver {
14
14
  pattern
15
15
  } = condition;
16
16
  const resolvedFields = fields.map(field => {
17
- const resolvedValue = TemplateResolver.replaceContextVariables(field.value.join(","), templateContext);
17
+ const resolvedValue = TemplateResolver.replaceContextVariables(field.value.join(','), templateContext);
18
18
  return { ...field,
19
- value: resolvedValue.split(",")
19
+ value: resolvedValue.split(',')
20
20
  };
21
21
  });
22
22
  return { ...condition,
@@ -31,10 +31,10 @@ export class ActionContextResolver {
31
31
 
32
32
  static resolveAction(action, context) {
33
33
  const eventMappings = action.uiComponentMapping.eventMappings;
34
- const conditions = action.conditionsMeta;
34
+ const conditions = action.conditions;
35
35
  const resolvedEventMappings = eventMappings.map(eventMapping => this.resolveContextInEventMappingPayload(eventMapping, context));
36
- const resolvedProperty = this.resolveContextInProperties(action.uiComponentMapping.propertiesValueMappingMeta, context);
37
- const resolveConditionValues = this.resolveConditionValueContext(conditions, context);
36
+ const resolvedProperty = this.resolveContextInProperties(action.uiComponentMapping.propertiesValueMapping, context);
37
+ const resolveConditionValues = conditions ? this.resolveConditionValueContext(conditions, context) : conditions;
38
38
  return { ...action,
39
39
  conditions: resolveConditionValues,
40
40
  uiComponentMapping: { ...action.uiComponentMapping,
@@ -8,6 +8,7 @@ function View(_ref, ref) {
8
8
  } = _ref;
9
9
  const {
10
10
  isLoading,
11
+ isReOrderLoading,
11
12
  data = [],
12
13
  rowActionsConfig,
13
14
  rowCursor,
@@ -30,6 +31,7 @@ function View(_ref, ref) {
30
31
  } = preferences ? preferences : {};
31
32
  return /*#__PURE__*/React.createElement(TableList, {
32
33
  reOrderConfig: reOrderConfig,
34
+ isReOrderLoading: isReOrderLoading,
33
35
  data: data,
34
36
  rowCursor: rowCursor,
35
37
  sortBy: sortBy,
@@ -1,3 +1,4 @@
1
+ import SectionTranslator from "./translators/SectionTranslator";
1
2
  let fieldTypeToUIType = {
2
3
  Text: 'TextBox',
3
4
  Textarea: 'TextArea',
@@ -45,133 +46,11 @@ export default class FormTranslator {
45
46
  }
46
47
  };
47
48
  } else {
48
- let sections = state.behaviours.zform.sections.map(section => {
49
- return {
50
- type: uiMapping.sections[section.id],
51
- id: section.id + '',
52
- title: section.i18NLabel,
53
- description: '',
54
- //section.description,
55
- isVisible: section.visibility,
56
- fields: section.fields.map(field => {
57
- let type = uiMapping.fields[field.apiName] || fieldTypeToUIType[field.type];
58
-
59
- if (field.type == 'DateTime' || field.type == 'Date') {
60
- let value = field.value;
61
- return {
62
- id: field.id,
63
- label: field.i18NLabel,
64
- type,
65
- value: value || '',
66
- //state.behaviours.zform.values[field.apiName],
67
- name: field.apiName,
68
- // placeholder: field.i18NLabel,//field.placeholder,
69
- required: field.isMandatory,
70
- isVisible: field.visibility
71
- };
72
- } else if (field.type == 'Picklist') {
73
- let value = field.value;
74
- let errorMessage = field.errorMessage || '';
75
- return {
76
- id: field.id,
77
- label: field.i18NLabel,
78
- options: field.pickListValues.map(picklistValue => {
79
- return {
80
- value: picklistValue.value,
81
- label: picklistValue.value
82
- };
83
- }),
84
- type,
85
- subType: field.subType.toLowerCase(),
86
- value: value || '',
87
- //state.behaviours.zform.values[field.apiName],
88
- name: field.apiName,
89
- // placeholder: field.i18NLabel,//field.placeholder,
90
- required: field.isMandatory,
91
- isVisible: field.visibility,
92
- errorMessage
93
- };
94
- } else if (field.type == 'Multiselect') {
95
- let value = field.value;
96
- let errorMessage = field.errorMessage || '';
97
- return {
98
- id: field.id,
99
- label: field.i18NLabel,
100
- options: field.pickListValues ? field.pickListValues.map(picklistValue => {
101
- return {
102
- value: picklistValue.value,
103
- label: picklistValue.value
104
- };
105
- }) : [],
106
- type,
107
- subType: field.subType,
108
- value: value || [],
109
- //state.behaviours.zform.values[field.apiName],
110
- name: field.apiName,
111
- // placeholder: field.i18NLabel,//field.placeholder,
112
- required: field.isMandatory,
113
- isVisible: field.visibility,
114
- errorMessage
115
- };
116
- } else if (field.type == 'Boolean') {
117
- let value = field.value;
118
- return {
119
- id: field.id,
120
- label: field.i18NLabel,
121
- type,
122
- value: value || false,
123
- name: field.apiName,
124
- // placeholder: field.i18NLabel,//field.placeholder,
125
- required: field.isMandatory,
126
- isVisible: field.visibility
127
- };
128
- } else if (field.type == 'Text') {
129
- let value = field.value;
130
- let errorMessage = field.errorMessage || '';
131
- return {
132
- type,
133
- value: value || '',
134
- //state.behaviours.zform.values[field.apiName],
135
- name: field.apiName,
136
- id: field.id,
137
- label: field.i18NLabel,
138
- tooltip: '',
139
- //field.tooltip,
140
- ePHI: false,
141
- //field.ePHI,
142
- placeholder: field.i18NLabel,
143
- //field.placeholder,
144
- required: field.isMandatory,
145
- isVisible: field.visibility,
146
- errorMessage
147
- };
148
- } else {
149
- let value = field.value;
150
- let errorMessage = field.errorMessage || '';
151
- const fieldModified = {
152
- type,
153
- value: value || '',
154
- //state.behaviours.zform.values[field.apiName],
155
- name: field.apiName,
156
- id: field.id,
157
- label: field.i18NLabel,
158
- tooltip: '',
159
- //field.tooltip,
160
- placeholder: field.i18NLabel,
161
- //field.placeholder,
162
- required: field.isMandatory,
163
- isVisible: field.visibility,
164
- errorMessage
165
- };
166
-
167
- if (ePHIFields[field.type]) {
168
- fieldModified.ePHI = true;
169
- }
170
-
171
- return fieldModified;
172
- }
173
- })
174
- };
49
+ let sections = SectionTranslator({
50
+ state,
51
+ fieldTypeToUIType,
52
+ ePHIFields,
53
+ uiMapping
175
54
  });
176
55
  return { ...state,
177
56
  viewModel: {
@@ -0,0 +1,32 @@
1
+ import * as FieldTranslators from "./fields";
2
+
3
+ const SectionTranslator = _ref => {
4
+ let {
5
+ state,
6
+ fieldTypeToUIType,
7
+ ePHIFields,
8
+ uiMapping
9
+ } = _ref;
10
+ let sections = state.behaviours.zform.sections.map(section => {
11
+ return {
12
+ type: uiMapping.sections[section.id],
13
+ id: section.id + '',
14
+ title: section.i18NLabel,
15
+ description: section.description,
16
+ //section.description,
17
+ // isVisible: section.visibility,
18
+ isVisible: section.isVisible,
19
+ fields: section.fields.map(field => {
20
+ const fieldTranslator = FieldTranslators[field.type];
21
+ let type = uiMapping.fields[field.apiName] || fieldTypeToUIType[field.type];
22
+ return fieldTranslator({
23
+ field,
24
+ type
25
+ });
26
+ })
27
+ };
28
+ });
29
+ return sections;
30
+ };
31
+
32
+ export default SectionTranslator;