@zohodesk/library-platform 1.1.5 → 1.1.6-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 (50) hide show
  1. package/es/bc/zform/Properties.js +3 -26
  2. package/es/cc/action-icon/Properties.js +19 -1
  3. package/es/cc/button/Constants.js +7 -0
  4. package/es/cc/button/Events.js +5 -0
  5. package/es/cc/button/Properties.js +77 -0
  6. package/es/cc/button/index.js +3 -0
  7. package/es/cc/fields/field/FormDefaultUIType.js +37 -0
  8. package/es/cc/form-connected/Properties.js +43 -1
  9. package/es/cc/index.js +3 -0
  10. package/es/cc/list-item/Constants.js +7 -0
  11. package/es/cc/list-item/Events.js +14 -0
  12. package/es/cc/list-item/Properties.js +131 -0
  13. package/es/cc/list-item/index.js +3 -0
  14. package/es/cc/more-dropdown/Constants.js +7 -0
  15. package/es/cc/more-dropdown/Events.js +14 -0
  16. package/es/cc/more-dropdown/Properties.js +66 -0
  17. package/es/cc/more-dropdown/index.js +3 -0
  18. package/es/cc/section/Properties.js +16 -0
  19. package/es/cc/switch/Properties.js +2 -2
  20. package/es/index.js +6 -1
  21. package/es/library/dot/components/action-location/frameworks/ui/ActionComponentMapping.js +6 -0
  22. package/es/library/dot/components/form/adapters/presenter/TransformState.js +25 -1
  23. package/es/library/dot/components/form/frameworks/ui/DefaultComponentRegister.js +28 -0
  24. package/es/library/dot/components/form/frameworks/ui/Form.js +2 -0
  25. package/es/library/dot/components/form/frameworks/ui/FormView.js +41 -26
  26. package/es/library/dot/components/form/frameworks/ui/css/Form.module.css +8 -4
  27. package/es/library/dot/components/form/frameworks/ui/sub-components/Sections.js +7 -9
  28. package/es/library/dot/components/section/frameworks/ui/RenderField.js +19 -0
  29. package/es/library/dot/components/section/frameworks/ui/Section.js +13 -4
  30. package/es/library/dot/components/section/frameworks/ui/SectionView.js +7 -26
  31. package/es/library/dot/components/table-list/frameworks/ui/sub-components/Header.js +6 -12
  32. package/es/library/dot/legacy-to-new-arch/action-icon/frameworks/ui/ActionIconView.js +10 -1
  33. package/es/library/dot/legacy-to-new-arch/action-icon/frameworks/ui/css/ActionIconView.module.css +3 -0
  34. package/es/library/dot/legacy-to-new-arch/button/frameworks/ui/Button.js +12 -0
  35. package/es/library/dot/legacy-to-new-arch/button/frameworks/ui/ButtonView.js +41 -0
  36. package/es/library/dot/legacy-to-new-arch/list-item/frameworks/ui/ListItem.js +12 -0
  37. package/es/library/dot/legacy-to-new-arch/list-item/frameworks/ui/ListItemView.js +122 -0
  38. package/es/library/dot/legacy-to-new-arch/more-dropdown/frameworks/ui/MoreDropdown.js +12 -0
  39. package/es/library/dot/legacy-to-new-arch/more-dropdown/frameworks/ui/MoreDropdownView.js +43 -0
  40. package/es/library/dot/legacy-to-new-arch/switch/frameworks/ui/SwitchView.js +5 -5
  41. package/es/library/dot/legacy-to-new-arch/table-field-components/switch-field/frameworks/ui/SwitchFieldView.js +0 -1
  42. package/es/platform/zform/adapters/presenter/FormTranslator.js +32 -45
  43. package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +35 -26
  44. package/es/platform/zform/adapters/presenter/translators/interfaces/ComponentMapping.js +1 -0
  45. package/es/platform/zform/adapters/presenter/translators/interfaces/FieldContract.js +1 -0
  46. package/es/platform/zform/adapters/presenter/translators/interfaces/FormTranslatorState.js +1 -0
  47. package/es/platform/zform/adapters/presenter/translators/interfaces/SectionContract.js +1 -0
  48. package/es/platform/zform/domain/ZSection.js +6 -0
  49. package/package.json +18 -16
  50. package/es/library/dot/components/section/adapters/presenter/TransFormState.js +0 -26
@@ -1,60 +1,47 @@
1
1
  import SectionTranslator from "./translators/SectionTranslator";
2
- let fieldTypeToUIType = {
3
- Text: 'TextBox',
4
- Textarea: 'TextArea',
5
- Boolean: 'Checkbox',
6
- URL: 'Url',
7
- Picklist: 'PickList',
8
- AutoNumber: 'TextBox',
9
- Number: 'Number',
10
- Decimal: 'Decimal',
11
- Email: 'Email',
12
- Phone: 'Phone',
13
- Currency: 'Currency',
14
- Percent: 'Percentage',
15
- Date: 'Date',
16
- DateTime: 'DateTime',
17
- Multiselect: 'MultiSelect',
18
- LookUp: 'TextBox'
19
- };
20
- const ePHIFields = {
21
- Text: true,
22
- Textarea: true,
23
- URL: true,
24
- Picklist: true,
25
- Number: true,
26
- Decimal: true,
27
- Email: false,
28
- Phone: true,
29
- Currency: false,
30
- Percent: true,
31
- AutoNumber: false,
32
- Date: false,
33
- DateTime: false,
34
- Multiselect: false,
35
- Boolean: false,
36
- LookUp: false
37
- };
38
2
  export default class FormTranslator {
39
3
  static transformState(state) {
40
- let uiMapping = state.properties.uiMapping;
4
+ const {
5
+ componentMapping,
6
+ context
7
+ } = state.properties;
8
+ const {
9
+ zform
10
+ } = state.behaviours;
11
+ const {
12
+ isMyFormFetching,
13
+ isDependencyFetching,
14
+ isLayoutRulesFetching,
15
+ isValidationRulesFetching,
16
+ sections
17
+ } = zform;
18
+ const isLoading = isMyFormFetching || isDependencyFetching || isLayoutRulesFetching || isValidationRulesFetching;
41
19
 
42
- if (state.behaviours.zform.isMyFormFetching || state.behaviours.zform.isDependencyFetching || state.behaviours.zform.isLayoutRulesFetching || state.behaviours.zform.isValidationRulesFetching) {
20
+ if (isLoading) {
21
+ return { ...state,
22
+ viewModel: {
23
+ isLoading: true
24
+ }
25
+ };
26
+ }
27
+
28
+ if (isLoading) {
43
29
  return { ...state,
44
30
  viewModel: {
45
31
  isLoading: true
46
32
  }
47
33
  };
48
34
  } else {
49
- let sections = SectionTranslator({
50
- state,
51
- fieldTypeToUIType,
52
- ePHIFields,
53
- uiMapping
54
- });
55
35
  return { ...state,
56
36
  viewModel: {
57
- sections,
37
+ sections: sections.map(section => {
38
+ const sectionViewModel = SectionTranslator({
39
+ section,
40
+ componentMapping,
41
+ context
42
+ });
43
+ return sectionViewModel;
44
+ }),
58
45
  isLoading: false
59
46
  }
60
47
  };
@@ -1,32 +1,41 @@
1
+ import { DefaultFormSectionUIType, fieldTypeToUIType } from "../../../../../cc/fields/field/FormDefaultUIType";
1
2
  import * as FieldTranslators from "./fields";
2
3
 
3
- const SectionTranslator = _ref => {
4
+ function SectionTranslator(_ref) {
4
5
  let {
5
- state,
6
- fieldTypeToUIType,
7
- ePHIFields,
8
- uiMapping
6
+ section,
7
+ componentMapping,
8
+ context
9
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
- };
10
+ const mapping = componentMapping.sections[section.name];
11
+ const defaultViewModel = {
12
+ type: mapping !== null && mapping !== void 0 && mapping.UIComponentName ? mapping.UIComponentName : DefaultFormSectionUIType,
13
+ id: section.id + '',
14
+ name: section.name,
15
+ title: section.i18NLabel,
16
+ description: section.description,
17
+ isCollapsed: section.isCollapsed,
18
+ isVisible: section.isVisible,
19
+ fields: section.fields.map(field => {
20
+ var _componentMapping$fie;
21
+
22
+ const fieldTranslator = FieldTranslators[field.type];
23
+ const type = (componentMapping === null || componentMapping === void 0 ? void 0 : (_componentMapping$fie = componentMapping.fields) === null || _componentMapping$fie === void 0 ? void 0 : _componentMapping$fie[field.apiName]) || fieldTypeToUIType[field.type];
24
+ return fieldTranslator({
25
+ field,
26
+ type
27
+ });
28
+ })
29
+ };
30
+
31
+ if (mapping !== null && mapping !== void 0 && mapping.translator) {
32
+ return mapping.translator({
33
+ section: defaultViewModel,
34
+ context
35
+ });
36
+ }
37
+
38
+ return defaultViewModel;
39
+ }
31
40
 
32
41
  export default SectionTranslator;
@@ -9,6 +9,7 @@ export default class ZSection {
9
9
  i18NLabel,
10
10
  isCustomSection,
11
11
  description,
12
+ isCollapsed,
12
13
  id,
13
14
  fields,
14
15
  // visibility
@@ -23,6 +24,8 @@ export default class ZSection {
23
24
 
24
25
  _defineProperty(this, "description", void 0);
25
26
 
27
+ _defineProperty(this, "isCollapsed", void 0);
28
+
26
29
  _defineProperty(this, "id", void 0);
27
30
 
28
31
  _defineProperty(this, "fields", void 0);
@@ -34,6 +37,8 @@ export default class ZSection {
34
37
  this.isCustomSection = isCustomSection;
35
38
  this.description = description || ''; // Default to empty string if not provided
36
39
 
40
+ this.isCollapsed = isCollapsed || false; // Default to false if not provided
41
+
37
42
  this.id = id;
38
43
  this.fields = fields; // this.visibility=visibility;
39
44
 
@@ -114,6 +119,7 @@ export default class ZSection {
114
119
  i18NLabel: this.i18NLabel,
115
120
  isCustomSection: this.isCustomSection,
116
121
  description: this.description,
122
+ isCollapsed: this.isCollapsed,
117
123
  id: this.id,
118
124
  fields: this.fields.map(field => {
119
125
  return field.toObject();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/library-platform",
3
- "version": "1.1.5",
3
+ "version": "1.1.6-temp-1",
4
4
  "description": "",
5
5
  "main": "es/index.js",
6
6
  "files": [
@@ -44,19 +44,20 @@
44
44
  "@typescript-eslint/parser": "^7.11.0",
45
45
  "@zoho/SecurityJS": "5.0.2",
46
46
  "@zohodesk-private/css-variable-migrator": "^1.0.7",
47
- "@zohodesk-private/desk-components": "1.0.0-temp-53.3",
47
+ "@zohodesk-private/desk-components": "1.3.9",
48
+ "@zohodesk-private/dot-registry": "0.0.1",
48
49
  "@zohodesk-private/node-plugins": "1.1.9",
49
- "@zohodesk/a11y": "2.2.6",
50
+ "@zohodesk/a11y": "2.3.4",
50
51
  "@zohodesk/codestandard-analytics": "0.0.2",
51
52
  "@zohodesk/codestandard-validator": "0.0.4",
52
- "@zohodesk/components": "1.2.62",
53
- "@zohodesk/dot": "1.7.8",
54
- "@zohodesk/eslint-plugin-architecturerules": "0.0.5-exp-3",
55
- "@zohodesk/eslint-plugin-no-hardcoding": "1.0.6",
53
+ "@zohodesk/components": "1.4.2",
54
+ "@zohodesk/dot": "1.7.16",
55
+ "@zohodesk/eslint-plugin-architecturerules": "0.0.6-exp-1",
56
+ "@zohodesk/eslint-plugin-no-hardcoding": "^1.0.6-platform-1",
56
57
  "@zohodesk/hooks": "2.0.5",
57
- "@zohodesk/icons": "1.0.72",
58
+ "@zohodesk/icons": "1.0.79",
58
59
  "@zohodesk/layout": "3.1.0",
59
- "@zohodesk/svg": "1.1.27",
60
+ "@zohodesk/svg": "1.1.30",
60
61
  "@zohodesk/utils": "1.3.14",
61
62
  "@zohodesk/variables": "1.0.0",
62
63
  "@zohodesk/virtualizer": "1.0.13",
@@ -76,15 +77,16 @@
76
77
  "typescript": "4.9.5"
77
78
  },
78
79
  "peerDependencies": {
79
- "@zohodesk-private/desk-components": "1.0.0-temp-53.3",
80
- "@zohodesk/a11y": "2.2.6",
81
- "@zohodesk/components": "1.2.62",
82
- "@zohodesk/dot": "1.7.8",
80
+ "@zohodesk-private/desk-components": "1.3.9",
81
+ "@zohodesk-private/dot-registry": "0.0.1",
82
+ "@zohodesk/a11y": "2.3.4",
83
+ "@zohodesk/components": "1.4.2",
84
+ "@zohodesk/dot": "1.7.16",
83
85
  "@zohodesk/hooks": "2.0.5",
84
86
  "@zohodesk/i18n": "1.0.0-beta.31",
85
- "@zohodesk/icons": "1.0.72",
87
+ "@zohodesk/icons": "1.0.79",
86
88
  "@zohodesk/layout": "3.1.0",
87
- "@zohodesk/svg": "1.1.27",
89
+ "@zohodesk/svg": "1.1.30",
88
90
  "@zohodesk/utils": "1.3.14",
89
91
  "color": "4.2.3",
90
92
  "react-sortable-hoc": "1.11.0"
@@ -96,4 +98,4 @@
96
98
  "jsep": "0.3.5",
97
99
  "object-path-immutable": "4.1.2"
98
100
  }
99
- }
101
+ }
@@ -1,26 +0,0 @@
1
- /* eslint-disable @zohodesk/architecturerules/return-void */
2
- export default function TransFormState(state) {
3
- const {
4
- fields
5
- } = state.properties;
6
-
7
- if (Array.isArray(fields) === false) {
8
- return state;
9
- }
10
-
11
- const slotContract = fields.filter(field => field.isVisible).map(field => {
12
- const {
13
- type,
14
- ...properties
15
- } = field;
16
- return {
17
- type,
18
- properties
19
- };
20
- });
21
- return { ...state,
22
- properties: { ...state.properties,
23
- fields: slotContract
24
- }
25
- };
26
- }