@zohodesk/library-platform 1.2.0-exp.3 → 1.2.0-exp.45

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 (81) hide show
  1. package/es/.DS_Store +0 -0
  2. package/es/bc/sort-by/SortOrderEnum.js +8 -0
  3. package/es/cc/flex-container/Properties.js +79 -0
  4. package/es/cc/flex-container/Types.js +39 -0
  5. package/es/cc/flex-container/index.js +2 -0
  6. package/es/cc/tags/model/TagModel.js +26 -0
  7. package/es/{platform → flex-layout}/.DS_Store +0 -0
  8. package/es/library/behaviours/sort-by/adapters/controllers/SortBy.js +28 -0
  9. package/es/library/behaviours/sort-by/applications/interfaces/output/SortByOutputModel.js +1 -0
  10. package/es/library/behaviours/sort-by/applications/usecases/SortBy.js +28 -0
  11. package/es/library/behaviours/sort-by/frameworks/ui/DemoBehaviour.js +20 -0
  12. package/es/library/custom-component/domain/entities/SlotValidator.js +84 -0
  13. package/es/library/custom-component/frameworks/ui/CustomComponentFactory.js +56 -0
  14. package/es/library/dot/components/part-wrapper/POC_DOCUMENT.md +648 -0
  15. package/es/library/dot/components/part-wrapper/applications/interfaces/State.js +1 -0
  16. package/es/library/dot/components/part-wrapper/domain/entities/interfaces/Properties.js +52 -0
  17. package/es/library/dot/components/part-wrapper/frameworks/ui/PartWrapper.js +24 -0
  18. package/es/library/dot/components/part-wrapper/frameworks/ui/PartWrapperFactory.js +27 -0
  19. package/es/library/dot/components/part-wrapper/frameworks/ui/PartWrapperView.js +45 -0
  20. package/es/library/dot/components/part-wrapper/frameworks/ui/css/PartWrapper.module.css +16 -0
  21. package/es/library/dot/components/part-wrapper/poc/index.js +9 -0
  22. package/es/library/dot/components/part-wrapper/poc/layouts/POCFormLayout.js +130 -0
  23. package/es/library/dot/components/part-wrapper/poc/layouts/POCMixedLayout.js +128 -0
  24. package/es/library/dot/components/part-wrapper/poc/layouts/POCTableCellLayout.js +105 -0
  25. package/es/library/dot/components/part-wrapper/poc/layouts/css/poc-form-layout.module.css +46 -0
  26. package/es/library/dot/components/part-wrapper/poc/layouts/css/poc-mixed-layout.module.css +89 -0
  27. package/es/library/dot/components/part-wrapper/poc/layouts/css/poc-table-cell-layout.module.css +70 -0
  28. package/es/library/dot/components/table-list/adapters/controllers/SortByController.js +25 -0
  29. package/es/library/dot/components/table-list/adapters/controllers/SortedController.js +18 -0
  30. package/es/library/dot/components/table-list/frameworks/ui/handlers/HandleSortClick.js +12 -0
  31. package/es/library/dot/legacy-to-new-arch/flex-container/frameworks/ui/FlexContainer.js +11 -0
  32. package/es/library/dot/legacy-to-new-arch/flex-container/frameworks/ui/FlexContainerView.js +37 -0
  33. package/es/library/poc-slot-usage/employee-card/adapters/presenters/EmployeeCardStateMapper.js +14 -0
  34. package/es/library/poc-slot-usage/employee-card/applications/usecases/BuildEmployeeCardUseCase.js +25 -0
  35. package/es/library/poc-slot-usage/employee-card/domain/entities/EmployeeCardSlots.js +68 -0
  36. package/es/library/poc-slot-usage/employee-card/frameworks/ui/EmployeeCard.js +13 -0
  37. package/es/library/poc-slot-usage/employee-card/frameworks/ui/EmployeeCardView.js +42 -0
  38. package/es/library/poc-slot-usage/flex-container/adapters/presenters/FlexContainerStateMapper.js +8 -0
  39. package/es/library/poc-slot-usage/flex-container/applications/usecases/BuildFlexContainerUseCase.js +44 -0
  40. package/es/library/poc-slot-usage/flex-container/domain/entities/FlexContainerSlots.js +18 -0
  41. package/es/library/poc-slot-usage/flex-container/frameworks/ui/FlexContainer.js +5 -0
  42. package/es/library/poc-slot-usage/flex-container/frameworks/ui/FlexContainerView.js +40 -0
  43. package/es/library/poc-slot-usage/index.js +7 -0
  44. package/es/library/poc-slot-usage/mismatched-card/applications/usecases/BuildMismatchedCardUseCase.js +23 -0
  45. package/es/library/poc-slot-usage/mismatched-card/domain/entities/MismatchedCardSlots.js +39 -0
  46. package/es/library/poc-slot-usage/mismatched-card/frameworks/ui/MismatchedCard.js +9 -0
  47. package/es/library/poc-slot-usage/mismatched-card/frameworks/ui/MismatchedCardView.js +39 -0
  48. package/es/library/poc-slot-usage/product-action/applications/usecases/BuildProductActionUseCase.js +21 -0
  49. package/es/library/poc-slot-usage/product-action/frameworks/ui/ProductAction.js +5 -0
  50. package/es/library/poc-slot-usage/product-action/frameworks/ui/ProductActionView.js +24 -0
  51. package/es/library/poc-slot-usage/product-body/applications/usecases/BuildProductBodyUseCase.js +21 -0
  52. package/es/library/poc-slot-usage/product-body/frameworks/ui/ProductBody.js +5 -0
  53. package/es/library/poc-slot-usage/product-body/frameworks/ui/ProductBodyView.js +20 -0
  54. package/es/library/poc-slot-usage/product-card/adapters/presenters/ProductCardStateMapper.js +8 -0
  55. package/es/library/poc-slot-usage/product-card/applications/usecases/BuildProductCardUseCase.js +34 -0
  56. package/es/library/poc-slot-usage/product-card/domain/entities/ProductCardSlots.js +70 -0
  57. package/es/library/poc-slot-usage/product-card/frameworks/ui/ProductCard.js +5 -0
  58. package/es/library/poc-slot-usage/product-card/frameworks/ui/ProductCardView.js +40 -0
  59. package/es/library/poc-slot-usage/product-title/applications/usecases/BuildProductTitleUseCase.js +21 -0
  60. package/es/library/poc-slot-usage/product-title/frameworks/ui/ProductTitle.js +5 -0
  61. package/es/library/poc-slot-usage/product-title/frameworks/ui/ProductTitleView.js +20 -0
  62. package/es/platform/components/table-connected/adapters/controllers/ColumnChooserOpenedController.js +28 -0
  63. package/es/platform/components/table-connected/adapters/controllers/ColumnChooserUpdateController.js +31 -0
  64. package/es/platform/zlist/adapters/gateways/SortBy.js +38 -0
  65. package/es/platform/zlist/adapters/presenters/translators/fields/DateFieldTranslator.js +3 -7
  66. package/es/platform/zlist/adapters/presenters/translators/fields/DateTimeFieldTranslator.js +3 -7
  67. package/es/platform/zlist/applications/interfaces/gateways/ISortBy.js +1 -0
  68. package/es/platform/zlist/domain/entities/SortBy.js +58 -0
  69. package/es/platform/zlist/domain/entities/interfaces/ISortBy.js +1 -0
  70. package/es/to-do-app/ToDo.js +10 -0
  71. package/es/to-do-app/cc/button/Constants.js +0 -0
  72. package/es/to-do-app/cc/button/Events.js +0 -0
  73. package/es/to-do-app/cc/button/Properties.js +4 -0
  74. package/es/to-do-app/cc/button/index.js +0 -0
  75. package/es/to-do-app/cc/textbox/Constants.js +7 -0
  76. package/es/to-do-app/cc/textbox/Events.js +20 -0
  77. package/es/to-do-app/cc/textbox/Properties.js +51 -0
  78. package/es/to-do-app/cc/textbox/index.js +3 -0
  79. package/es/to-do-app/component/textbox/framework/TextBox.js +30 -0
  80. package/es/to-do-app/component/textbox/framework/TextBoxView.js +42 -0
  81. package/package.json +3 -3
package/es/.DS_Store CHANGED
Binary file
@@ -0,0 +1,8 @@
1
+ var SortOrder = /*#__PURE__*/function (SortOrder) {
2
+ SortOrder["NONE"] = "none";
3
+ SortOrder["ASC"] = "ascending";
4
+ SortOrder["DES"] = "descending";
5
+ return SortOrder;
6
+ }(SortOrder || {});
7
+
8
+ export default SortOrder;
@@ -0,0 +1,79 @@
1
+ export default {
2
+ tagName: {
3
+ defaultValue: 'div',
4
+ required: false,
5
+ typeMetadata: {
6
+ schema: {
7
+ type: 'string'
8
+ }
9
+ }
10
+ },
11
+ className: {
12
+ defaultValue: '',
13
+ required: false,
14
+ typeMetadata: {
15
+ schema: {
16
+ type: 'string'
17
+ }
18
+ }
19
+ },
20
+ isInline: {
21
+ defaultValue: false,
22
+ required: false,
23
+ typeMetadata: {
24
+ schema: {
25
+ type: 'boolean'
26
+ }
27
+ }
28
+ },
29
+ direction: {
30
+ defaultValue: 'row',
31
+ required: false,
32
+ typeMetadata: {
33
+ schema: {
34
+ type: 'string',
35
+ enum: ['row', 'column', 'rowReverse', 'columnReverse']
36
+ }
37
+ }
38
+ },
39
+ alignItems: {
40
+ defaultValue: '',
41
+ required: false,
42
+ typeMetadata: {
43
+ schema: {
44
+ type: 'string',
45
+ enum: ['start', 'center', 'end', 'baseline', 'stretch']
46
+ }
47
+ }
48
+ },
49
+ justifyContent: {
50
+ defaultValue: '',
51
+ required: false,
52
+ typeMetadata: {
53
+ schema: {
54
+ type: 'string',
55
+ enum: ['start', 'center', 'end', 'spaceBetween', 'spaceAround', 'spaceEvenly']
56
+ }
57
+ }
58
+ },
59
+ alignContent: {
60
+ defaultValue: '',
61
+ required: false,
62
+ typeMetadata: {
63
+ schema: {
64
+ type: 'string',
65
+ enum: ['start', 'center', 'end', 'spaceBetween', 'spaceAround', 'spaceEvenly']
66
+ }
67
+ }
68
+ },
69
+ wrap: {
70
+ defaultValue: 'nowrap',
71
+ required: false,
72
+ typeMetadata: {
73
+ schema: {
74
+ type: 'string',
75
+ enum: ['wrap', 'nowrap', 'wrapReverse']
76
+ }
77
+ }
78
+ }
79
+ };
@@ -0,0 +1,39 @@
1
+ export let Direction = /*#__PURE__*/function (Direction) {
2
+ Direction["Row"] = "row";
3
+ Direction["Column"] = "column";
4
+ Direction["RowReverse"] = "rowReverse";
5
+ Direction["ColumnReverse"] = "columnReverse";
6
+ return Direction;
7
+ }({});
8
+ export let AlignItems = /*#__PURE__*/function (AlignItems) {
9
+ AlignItems["Start"] = "start";
10
+ AlignItems["Center"] = "center";
11
+ AlignItems["End"] = "end";
12
+ AlignItems["Baseline"] = "baseline";
13
+ AlignItems["Stretch"] = "stretch";
14
+ return AlignItems;
15
+ }({});
16
+ export let JustifyContent = /*#__PURE__*/function (JustifyContent) {
17
+ JustifyContent["Start"] = "start";
18
+ JustifyContent["Center"] = "center";
19
+ JustifyContent["End"] = "end";
20
+ JustifyContent["SpaceBetween"] = "spaceBetween";
21
+ JustifyContent["SpaceAround"] = "spaceAround";
22
+ JustifyContent["SpaceEvenly"] = "spaceEvenly";
23
+ return JustifyContent;
24
+ }({});
25
+ export let AlignContent = /*#__PURE__*/function (AlignContent) {
26
+ AlignContent["Start"] = "start";
27
+ AlignContent["Center"] = "center";
28
+ AlignContent["End"] = "end";
29
+ AlignContent["SpaceBetween"] = "spaceBetween";
30
+ AlignContent["SpaceAround"] = "spaceAround";
31
+ AlignContent["Stretch"] = "stretch";
32
+ return AlignContent;
33
+ }({});
34
+ export let Wrap = /*#__PURE__*/function (Wrap) {
35
+ Wrap["Wrap"] = "wrap";
36
+ Wrap["NoWrap"] = "nowrap";
37
+ Wrap["WrapReverse"] = "wrapReverse";
38
+ return Wrap;
39
+ }({});
@@ -0,0 +1,2 @@
1
+ export { default as Properties } from "./Properties";
2
+ export { Properties as PropertiesType, Direction, AlignItems, JustifyContent, AlignContent, Wrap } from "./Types";
@@ -0,0 +1,26 @@
1
+ function TagModel(_ref) {
2
+ let {
3
+ id,
4
+ label,
5
+ color,
6
+ imageSrc,
7
+ imageAltText,
8
+ iconName,
9
+ disabled,
10
+ size,
11
+ tooltip
12
+ } = _ref;
13
+ return {
14
+ id,
15
+ label,
16
+ color,
17
+ imageSrc,
18
+ imageAltText,
19
+ iconName,
20
+ disabled,
21
+ size,
22
+ tooltip
23
+ };
24
+ }
25
+
26
+ export default TagModel;
@@ -0,0 +1,28 @@
1
+ import AbstractController from "./AbstractController";
2
+
3
+ class SortByController extends AbstractController {
4
+ handle(event) {
5
+ const {
6
+ sortByUseCase
7
+ } = this.service;
8
+ let {
9
+ state,
10
+ updateState,
11
+ action,
12
+ dispatch
13
+ } = event;
14
+ let {
15
+ id,
16
+ name
17
+ } = action.payload;
18
+ sortByUseCase.updateDependencies(state, updateState);
19
+ sortByUseCase.execute({
20
+ id,
21
+ name,
22
+ dispatch
23
+ });
24
+ }
25
+
26
+ }
27
+
28
+ export default SortByController;
@@ -0,0 +1,28 @@
1
+ import { SORTBY_SORTED } from "../../../../../bc/sort-by/Constants";
2
+ import AbstractUseCase from "./AbstractUseCase";
3
+
4
+ class SortBy extends AbstractUseCase {
5
+ execute(input) {
6
+ const {
7
+ id,
8
+ name,
9
+ dispatch
10
+ } = input;
11
+ const {
12
+ repository,
13
+ presenter
14
+ } = this.dependencies;
15
+ const sortBy = repository.getSortByEntity();
16
+ sortBy.doSorting(id, name);
17
+ presenter.updateSortBy(sortBy.toObject());
18
+ dispatch({
19
+ type: SORTBY_SORTED,
20
+ payload: {
21
+ sortBy: sortBy.toObject()
22
+ }
23
+ });
24
+ }
25
+
26
+ }
27
+
28
+ export default SortBy;
@@ -0,0 +1,20 @@
1
+ import Properties from "../../../../../bc/sort-by/Properties";
2
+
3
+ // REVIEW: Class never used
4
+ class DemoBehaviour {
5
+ static create() {
6
+ return {
7
+ name: 'demo_behaviour',
8
+ setInitialState: () => ({}),
9
+ properties: Properties,
10
+ eventHandlers: {
11
+ "DEMO": () => {
12
+ alert('demo');
13
+ }
14
+ }
15
+ };
16
+ }
17
+
18
+ }
19
+
20
+ export default DemoBehaviour;
@@ -0,0 +1,84 @@
1
+ import { ErrorCodes } from "../../../../cc/component/ErrorStructure";
2
+
3
+ /**
4
+ * SlotValidator validates slot component types against allowedComponentTypes restrictions.
5
+ * Supports wildcard '*' to allow all component types.
6
+ * Non-breaking validation - errors don't disrupt component flow.
7
+ */
8
+ export default class SlotValidator {
9
+ /**
10
+ * Validates that all components in slots respect the allowedComponentTypes restrictions
11
+ * @param slots - Array of slot definitions with component type restrictions
12
+ * @returns SlotValidationResult with validation status and errors
13
+ */
14
+ static validateSlots() {
15
+ let slots = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
16
+ const errors = [];
17
+ slots.forEach(slot => {
18
+ const {
19
+ name: slotName,
20
+ elements = [],
21
+ allowedComponentTypes = ['*']
22
+ } = slot; // If allowedComponentTypes contains '*', all components are allowed
23
+
24
+ const allowAllComponents = allowedComponentTypes.includes('*');
25
+ elements.forEach(element => {
26
+ const {
27
+ type: componentType,
28
+ name: elementName
29
+ } = element; // Skip validation if wildcard is specified
30
+
31
+ if (!allowAllComponents && !allowedComponentTypes.includes(componentType)) {
32
+ errors.push({
33
+ message: `Component type '${componentType}' is not allowed in slot '${slotName}'. Allowed types: ${allowedComponentTypes.join(', ')}`,
34
+ slotName,
35
+ elementName,
36
+ componentType
37
+ });
38
+ }
39
+ });
40
+ });
41
+ return {
42
+ isValid: errors.length === 0,
43
+ errors
44
+ };
45
+ }
46
+ /**
47
+ * Throws a structured error if slot validation fails
48
+ * Error is non-breaking to allow other components to continue rendering
49
+ * @param slots - Array of slot definitions
50
+ * @throws ErrorStructure with non-breaking error flag
51
+ */
52
+
53
+
54
+ static validateAndThrowIfInvalid() {
55
+ let slots = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
56
+ const validationResult = SlotValidator.validateSlots(slots);
57
+
58
+ if (!validationResult.isValid) {
59
+ // Non-breaking error - component continues to render
60
+ const error = {
61
+ code: ErrorCodes.PROPERTY_VALIDATION_FAILED,
62
+ message: 'Slot component type validation failed',
63
+ errorDetails: {
64
+ isBreaking: false,
65
+ // Important: allows other components to continue
66
+ slotValidationErrors: validationResult.errors
67
+ }
68
+ };
69
+ throw error;
70
+ }
71
+ }
72
+ /**
73
+ * Returns true if wildcard is defined, allowing all component types
74
+ * @param allowedComponentTypes - Array of allowed component types
75
+ * @returns boolean
76
+ */
77
+
78
+
79
+ static hasWildcardPermission() {
80
+ let allowedComponentTypes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
81
+ return allowedComponentTypes.includes('*') || allowedComponentTypes.length === 0;
82
+ }
83
+
84
+ }
@@ -0,0 +1,56 @@
1
+ import React, { useState, useRef, useEffect, forwardRef } from 'react';
2
+ import DependencyFactory from "./DependencyFactory";
3
+ /* eslint-disable */
4
+
5
+ function Component(props) {
6
+ const [state, setState] = useState(null);
7
+ const elementRef = useRef(null);
8
+ const {
9
+ controller,
10
+ presenter,
11
+ eventManager
12
+ } = DependencyFactory.create({
13
+ updateState: newState => {
14
+ // Hack initial render
15
+ if (state == null) {
16
+ setState(newState);
17
+ } else {
18
+ setState(() => newState);
19
+ }
20
+ }
21
+ });
22
+ const helpers = {
23
+ updateState: controller.updateState.bind(controller),
24
+ updateProperties: controller.updateProperties.bind(controller),
25
+ dispatch: controller.dispatch.bind(controller)
26
+ };
27
+ useEffect(() => {
28
+ controller.initialize({ ...input,
29
+ newProps: props,
30
+ helpers
31
+ });
32
+ eventManager.name = input.name;
33
+ controller.mount();
34
+ return () => {
35
+ controller.unmount();
36
+ };
37
+ }, []);
38
+ useEffect(() => {
39
+ controller.updateProperties(props);
40
+ }, [props]);
41
+ const View = /*#__PURE__*/forwardRef(input.View);
42
+
43
+ if (state?.error) {
44
+ console.log(state.error);
45
+ return /*#__PURE__*/React.createElement("div", null, "error");
46
+ } else {
47
+ return /*#__PURE__*/React.createElement(View, {
48
+ ref: eventManager.setElement.bind(eventManager),
49
+ helpers: helpers,
50
+ state: state
51
+ });
52
+ }
53
+ }
54
+
55
+ ;
56
+ export default Component;