@arquimedes.co/eureka-forms 1.9.87-test → 1.9.88-test

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.
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { MapperStepProps } from '../../../MapperStep';
3
3
  import { MapperElementComponentProps } from '../MapperElement';
4
- declare function PillElementContainer<Type = any>({ step, form, num, element, children, editable, postview, formStyle, handleDelete, widthStats, customElementModifiers, }: MapperStepProps<Type> & MapperElementComponentProps<Type> & {
4
+ declare function ListMapperElement<Type = any>({ step, form, num, loading, element, children, editable, postview, formStyle, handleDelete, widthStats, customElementModifiers, }: MapperStepProps<Type> & MapperElementComponentProps<Type> & {
5
5
  num: number;
6
6
  formStyle: {
7
7
  textColor: string;
@@ -10,4 +10,4 @@ declare function PillElementContainer<Type = any>({ step, form, num, element, ch
10
10
  /** children to render */
11
11
  children?: any;
12
12
  }): JSX.Element;
13
- export default PillElementContainer;
13
+ export default ListMapperElement;
@@ -0,0 +1,34 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import styles from './ListMapperElement.module.css';
14
+ import DeleteRoundedIcon from '@material-ui/icons/DeleteRounded';
15
+ function ListMapperElement(_a) {
16
+ var _b, _c;
17
+ var step = _a.step, form = _a.form, num = _a.num, loading = _a.loading, element = _a.element, children = _a.children, editable = _a.editable, postview = _a.postview, formStyle = _a.formStyle, handleDelete = _a.handleDelete, widthStats = _a.widthStats, customElementModifiers = _a.customElementModifiers;
18
+ var size = form.size;
19
+ var calcName = (customElementModifiers !== null && customElementModifiers !== void 0 ? customElementModifiers : {}).calcName;
20
+ var name = calcName
21
+ ? calcName(element)
22
+ : step.unitLabel + ' ' + (num + 1);
23
+ return (_jsx("div", __assign({ className: widthStats.isMobile ? styles.mobileContainer : styles.container }, { children: _jsxs("div", __assign({ className: styles.contentContainer, style: {
24
+ width: (size.blockSize + size.spacingSize) *
25
+ ((_c = (_b = step.style) === null || _b === void 0 ? void 0 : _b.size) !== null && _c !== void 0 ? _c : size.blockNum - 1),
26
+ } }, { children: [name && (_jsx("div", __assign({ className: styles.titleLbl, style: { color: formStyle.textColor } }, { children: loading ? '' : name + ':' }))), step.deletable !== false && (_jsx("div", __assign({ className: !editable || postview
27
+ ? styles.disabledDeleteBtn
28
+ : styles.deleteBtn, style: { color: formStyle.textColor }, onClick: function () {
29
+ if (editable && !postview) {
30
+ handleDelete === null || handleDelete === void 0 ? void 0 : handleDelete();
31
+ }
32
+ } }, { children: _jsx(DeleteRoundedIcon, { fontSize: "inherit" }) }))), children] })) })));
33
+ }
34
+ export default ListMapperElement;
@@ -3,6 +3,7 @@ import { MapperStepProps } from '../../MapperStep';
3
3
  import { MapperElement } from '../MaterialMapperStep';
4
4
  export interface MapperElementComponentProps<Type> {
5
5
  num: number;
6
+ loading: boolean;
6
7
  element: MapperElement<Type>;
7
8
  handleDelete: Function;
8
9
  }
@@ -12,18 +12,32 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { createElement as _createElement } from "react";
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import StepComponent from '../../../Step';
15
- import PillElementContainer from './PillElementContainer/PillElementContainer';
15
+ import { MapperStyleTypes } from '../../../../../constants/FormStepTypes';
16
+ import styles from './MapperElement.module.css';
17
+ import ListMapperElement from './ListMapperElement/ListMapperElement';
18
+ import PillMapperElement from './PillMapperElement/PillMapperElement';
16
19
  function MapperElementComponent(props) {
17
- var _a, _b;
20
+ var _a, _b, _c;
18
21
  var level = props.level, form = props.form, step = props.step, element = props.element, editable = props.editable;
19
22
  if (element.deleted) {
20
23
  return _jsx("div", {});
21
24
  }
22
25
  var customStepProps = (_b = (_a = props.calcCustomStepProps) === null || _a === void 0 ? void 0 : _a.call(props, element, props.customStepProps)) !== null && _b !== void 0 ? _b : props.customStepProps;
23
- return (_jsx(PillElementContainer, __assign({}, props, { step: step }, { children: step.rootSteps.map(function (idSubStep) {
26
+ var mapSubSteps = function () {
27
+ return step.rootSteps.map(function (idSubStep) {
24
28
  var _a;
25
29
  var subStep = form.steps[element.ids[idSubStep]];
26
30
  return (_createElement(StepComponent, __assign({}, props, { customStepProps: customStepProps, globalEditable: editable ? (_a = step.editable) !== null && _a !== void 0 ? _a : true : false, step: subStep, key: idSubStep, level: level + 1 })));
27
- }) })));
31
+ });
32
+ };
33
+ switch ((_c = step.style) === null || _c === void 0 ? void 0 : _c.type) {
34
+ case MapperStyleTypes.INLINE:
35
+ return (_jsx("div", __assign({ className: styles.contentContainer }, { children: mapSubSteps() })));
36
+ case MapperStyleTypes.LIST:
37
+ return (_jsx(ListMapperElement, __assign({}, props, { step: step }, { children: mapSubSteps() })));
38
+ case MapperStyleTypes.PILL:
39
+ default:
40
+ return (_jsx(PillMapperElement, __assign({}, props, { step: step }, { children: mapSubSteps() })));
41
+ }
28
42
  }
29
43
  export default MapperElementComponent;
@@ -1,41 +1,3 @@
1
- .container,
2
- .mobileContainer {
3
- background-color: #f0f0f0;
4
- border: 1px solid #d6d6d6;
5
- width: fit-content;
6
- border-radius: 20px;
7
- margin-bottom: 10px;
8
- margin-top: 10px;
9
- margin-left: auto;
10
- margin-right: auto;
11
- padding-top: 20px;
12
- padding-bottom: 20px;
13
- position: relative;
14
- }
15
- .container {
16
- max-width: calc(100% - 112px);
17
- padding-right: 55px;
18
- padding-left: 55px;
19
- }
20
-
21
- .mobileContainer {
22
- max-width: calc(100% - 42px);
23
- padding-right: 20px;
24
- padding-left: 20px;
25
- }
26
-
27
- .titleLbl {
28
- width: 100%;
29
- font-size: 20px;
30
- font-weight: 600;
31
- white-space: nowrap;
32
- overflow: hidden;
33
- text-overflow: ellipsis;
34
- cursor: default;
35
- margin-left: 10px;
36
- margin-bottom: 10px;
37
- }
38
-
39
1
  .contentContainer {
40
2
  margin-left: auto;
41
3
  margin-right: auto;
@@ -46,15 +8,3 @@
46
8
  overflow-x: hidden;
47
9
  overflow-y: hidden;
48
10
  }
49
-
50
- .deleteBtn,
51
- .disabledDeleteBtn {
52
- font-size: 24px;
53
- position: absolute;
54
- right: 15px;
55
- top: 15px;
56
- }
57
-
58
- .deleteBtn {
59
- cursor: pointer;
60
- }
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import { MapperStepProps } from '../../../MapperStep';
3
+ import { MapperElementComponentProps } from '../MapperElement';
4
+ declare function PillMapperElement<Type = any>({ step, form, num, loading, element, children, editable, postview, formStyle, handleDelete, widthStats, customElementModifiers, }: MapperStepProps<Type> & MapperElementComponentProps<Type> & {
5
+ num: number;
6
+ formStyle: {
7
+ textColor: string;
8
+ };
9
+ handleDelete?: Function;
10
+ /** children to render */
11
+ children?: any;
12
+ }): JSX.Element;
13
+ export default PillMapperElement;
@@ -9,20 +9,22 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
- import styles from './PillElementContainer.module.css';
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import styles from './PillMapperElement.module.css';
14
14
  import DeleteRoundedIcon from '@material-ui/icons/DeleteRounded';
15
- function PillElementContainer(_a) {
15
+ function PillMapperElement(_a) {
16
16
  var _b, _c;
17
- var step = _a.step, form = _a.form, num = _a.num, element = _a.element, children = _a.children, editable = _a.editable, postview = _a.postview, formStyle = _a.formStyle, handleDelete = _a.handleDelete, widthStats = _a.widthStats, customElementModifiers = _a.customElementModifiers;
17
+ var step = _a.step, form = _a.form, num = _a.num, loading = _a.loading, element = _a.element, children = _a.children, editable = _a.editable, postview = _a.postview, formStyle = _a.formStyle, handleDelete = _a.handleDelete, widthStats = _a.widthStats, customElementModifiers = _a.customElementModifiers;
18
18
  var size = form.size;
19
19
  var calcName = (customElementModifiers !== null && customElementModifiers !== void 0 ? customElementModifiers : {}).calcName;
20
20
  return (_jsx("div", __assign({ className: widthStats.isMobile ? styles.mobileContainer : styles.container }, { children: _jsxs("div", __assign({ className: styles.contentContainer, style: {
21
21
  width: (size.blockSize + size.spacingSize) *
22
22
  ((_c = (_b = step.style) === null || _b === void 0 ? void 0 : _b.size) !== null && _c !== void 0 ? _c : size.blockNum - 1),
23
- } }, { children: [_jsxs("div", __assign({ className: styles.titleLbl, style: { color: formStyle.textColor } }, { children: [calcName
23
+ } }, { children: [_jsx("div", __assign({ className: styles.titleLbl, style: { color: formStyle.textColor } }, { children: loading
24
+ ? ''
25
+ : (calcName
24
26
  ? calcName(element)
25
- : step.unitLabel + ' ' + (num + 1), ":"] })), step.deletable !== false && (_jsx("div", __assign({ className: !editable || postview
27
+ : step.unitLabel + ' ' + (num + 1)) + ':' })), step.deletable !== false && (_jsx("div", __assign({ className: !editable || postview
26
28
  ? styles.disabledDeleteBtn
27
29
  : styles.deleteBtn, style: { color: formStyle.textColor }, onClick: function () {
28
30
  if (editable && !postview) {
@@ -30,4 +32,4 @@ function PillElementContainer(_a) {
30
32
  }
31
33
  } }, { children: _jsx(DeleteRoundedIcon, { fontSize: "inherit" }) }))), children] })) })));
32
34
  }
33
- export default PillElementContainer;
35
+ export default PillMapperElement;
@@ -0,0 +1,60 @@
1
+ .container,
2
+ .mobileContainer {
3
+ background-color: #f0f0f0;
4
+ border: 1px solid #d6d6d6;
5
+ width: fit-content;
6
+ border-radius: 20px;
7
+ margin-bottom: 10px;
8
+ margin-top: 10px;
9
+ margin-left: auto;
10
+ margin-right: auto;
11
+ padding-top: 20px;
12
+ padding-bottom: 20px;
13
+ position: relative;
14
+ }
15
+ .container {
16
+ max-width: calc(100% - 112px);
17
+ padding-right: 55px;
18
+ padding-left: 55px;
19
+ }
20
+
21
+ .mobileContainer {
22
+ max-width: calc(100% - 42px);
23
+ padding-right: 20px;
24
+ padding-left: 20px;
25
+ }
26
+
27
+ .titleLbl {
28
+ width: 100%;
29
+ font-size: 20px;
30
+ font-weight: 600;
31
+ white-space: nowrap;
32
+ overflow: hidden;
33
+ text-overflow: ellipsis;
34
+ cursor: default;
35
+ margin-left: 10px;
36
+ margin-bottom: 10px;
37
+ }
38
+
39
+ .contentContainer {
40
+ margin-left: auto;
41
+ margin-right: auto;
42
+ display: flex;
43
+ flex-flow: row wrap;
44
+ height: fit-content;
45
+ max-width: 100%;
46
+ overflow-x: hidden;
47
+ overflow-y: hidden;
48
+ }
49
+
50
+ .deleteBtn,
51
+ .disabledDeleteBtn {
52
+ font-size: 24px;
53
+ position: absolute;
54
+ right: 15px;
55
+ top: 15px;
56
+ }
57
+
58
+ .deleteBtn {
59
+ cursor: pointer;
60
+ }
@@ -6,7 +6,8 @@ export interface MapperElement<Type> {
6
6
  deleted?: boolean;
7
7
  value?: Type;
8
8
  }
9
- export declare function ElementsComponent<Type = any>({ step, form, inputRef, editable, postview, elements, formStyle, customAdd, dependencyStore, setDependencyStore, ...others }: MapperStepProps<Type> & {
9
+ export declare function ElementsComponent<Type = any>({ step, form, inputRef, editable, postview, elements, formStyle, customAdd, loading, dependencyStore, setDependencyStore, ...others }: MapperStepProps<Type> & {
10
+ loading?: boolean;
10
11
  onChange: (elements: MapperElement<Type>[]) => void;
11
12
  elements: MapperElement<Type>[];
12
13
  inputRef: any;
@@ -42,10 +42,10 @@ import AYFFormStepTypes from '../../../../constants/AYFFormStepTypes';
42
42
  import CBRFormStepTypes from '../../../../constants/CBRFormStepTypes';
43
43
  export function ElementsComponent(_a) {
44
44
  var _b, _c;
45
- var step = _a.step, form = _a.form, inputRef = _a.inputRef, editable = _a.editable, postview = _a.postview, elements = _a.elements, formStyle = _a.formStyle, customAdd = _a.customAdd, dependencyStore = _a.dependencyStore, setDependencyStore = _a.setDependencyStore, others = __rest(_a, ["step", "form", "inputRef", "editable", "postview", "elements", "formStyle", "customAdd", "dependencyStore", "setDependencyStore"]);
46
- var _d = useState(true), firstRender = _d[0], setFirstRender = _d[1];
45
+ var step = _a.step, form = _a.form, inputRef = _a.inputRef, editable = _a.editable, postview = _a.postview, elements = _a.elements, formStyle = _a.formStyle, customAdd = _a.customAdd, _d = _a.loading, loading = _d === void 0 ? false : _d, dependencyStore = _a.dependencyStore, setDependencyStore = _a.setDependencyStore, others = __rest(_a, ["step", "form", "inputRef", "editable", "postview", "elements", "formStyle", "customAdd", "loading", "dependencyStore", "setDependencyStore"]);
46
+ var _e = useState(true), firstRender = _e[0], setFirstRender = _e[1];
47
47
  /** Mapper Steps to pass down */
48
- var _e = useState(), localSteps = _e[0], setLocalSteps = _e[1];
48
+ var _f = useState(), localSteps = _f[0], setLocalSteps = _f[1];
49
49
  var onChange = function (elements) {
50
50
  var _a;
51
51
  var _b;
@@ -127,7 +127,7 @@ export function ElementsComponent(_a) {
127
127
  margin: step.description
128
128
  ? '10px 0px'
129
129
  : '0px 0px 5px 0px',
130
- } }, { children: step.description }))), elements.map(function (element, index) { return (_jsx(MapperElementComponent, __assign({ num: index, element: element, formStyle: formStyle, step: step, form: __assign(__assign({}, form), { steps: __assign(__assign({}, form.steps), localSteps) }), editable: editable, postview: postview, dependencyStore: dependencyStore, setDependencyStore: setDependencyStore, handleDelete: function () {
130
+ } }, { children: step.description }))), elements.map(function (element, index) { return (_jsx(MapperElementComponent, __assign({ num: index, loading: loading, element: element, formStyle: formStyle, step: step, form: __assign(__assign({}, form), { steps: __assign(__assign({}, form.steps), localSteps) }), editable: editable, postview: postview, dependencyStore: dependencyStore, setDependencyStore: setDependencyStore, handleDelete: function () {
131
131
  var tempElements = __spreadArray([], elements, true);
132
132
  tempElements[index].deleted = true;
133
133
  onChange(tempElements);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arquimedes.co/eureka-forms",
3
3
  "repository": "git://github.com/Arquimede5/Eureka-Forms.git",
4
- "version":"1.9.87-test",
4
+ "version":"1.9.88-test",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",