@arquimedes.co/eureka-forms 2.0.18 → 2.0.19-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.
Files changed (55) hide show
  1. package/dist/@Types/Form.d.ts +1 -0
  2. package/dist/@Types/FormStep.d.ts +1 -0
  3. package/dist/App/AppFunctions.js +11 -11
  4. package/dist/Form/Section/MaterialSection/MaterialSection.js +1 -1
  5. package/dist/Form/Terms/Term/MaterialTerm/MaterialTerm.js +9 -1
  6. package/dist/FormSteps/@Construction/CBRElementStep/CBRElementStep.js +2 -2
  7. package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.d.ts +1 -1
  8. package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.js +2 -2
  9. package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.d.ts +2 -2
  10. package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.js +20 -63
  11. package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.module.css +0 -16
  12. package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.d.ts +1 -1
  13. package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +21 -76
  14. package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.module.css +0 -28
  15. package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.d.ts +1 -1
  16. package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +39 -96
  17. package/dist/FormSteps/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.js +2 -2
  18. package/dist/FormSteps/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +7 -38
  19. package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.d.ts +1 -1
  20. package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +20 -74
  21. package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.d.ts +2 -2
  22. package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +18 -42
  23. package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/MapperElementComponent.js +2 -2
  24. package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.js +9 -5
  25. package/dist/FormSteps/RatingStep/MaterialRatingStep/MaterialRatingStep.d.ts +1 -1
  26. package/dist/FormSteps/RatingStep/MaterialRatingStep/MaterialRatingStep.js +15 -43
  27. package/dist/FormSteps/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.d.ts +2 -2
  28. package/dist/FormSteps/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +22 -78
  29. package/dist/FormSteps/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.module.css +0 -16
  30. package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.d.ts +1 -9
  31. package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +26 -57
  32. package/dist/FormSteps/Step.d.ts +0 -2
  33. package/dist/FormSteps/StepFunctions.d.ts +2 -1
  34. package/dist/FormSteps/StepFunctions.js +70 -63
  35. package/dist/FormSteps/StepHooks.d.ts +16 -0
  36. package/dist/FormSteps/StepHooks.js +58 -2
  37. package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaEditorStep.js +1 -1
  38. package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +6 -37
  39. package/dist/FormSteps/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +13 -39
  40. package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.d.ts +1 -1
  41. package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.js +4 -24
  42. package/dist/FormSteps/Utils/@StepFiller/StepFiller.d.ts +9 -0
  43. package/dist/FormSteps/Utils/@StepFiller/StepFiller.js +48 -0
  44. package/dist/FormSteps/{EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.module.css → Utils/@StepFiller/StepFiller.module.css} +16 -16
  45. package/dist/FormSteps/Utils/MaterialInputContainer/MaterialInputContainer.d.ts +11 -0
  46. package/dist/FormSteps/Utils/MaterialInputContainer/MaterialInputContainer.js +32 -0
  47. package/dist/FormSteps/{DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.module.css → Utils/MaterialInputContainer/MaterialInputContainer.module.css} +9 -9
  48. package/dist/Shared/RoundedCheckBox/RoundedCheckBox.d.ts +3 -3
  49. package/dist/Shared/RoundedSmartSelect/RoundedSmartSelect.d.ts +1 -4
  50. package/dist/Shared/RoundedSmartSelect/RoundedSmartSelect.js +1 -3
  51. package/dist/States/SiteSlice.d.ts +2 -1
  52. package/dist/States/SiteSlice.js +25 -6
  53. package/package.json +1 -1
  54. package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.module.css +0 -25
  55. package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.module.css +0 -9
@@ -9,32 +9,20 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
- import { Controller } from 'react-hook-form';
25
13
  import { calcStepWidth } from '../../StepFunctions';
26
14
  import styles from './MaterialTitleStep.module.css';
27
15
  import { useAppSelector } from '../../../hooks';
28
16
  import FormContext from '../../../Contexts/FormContext';
29
17
  import { useContext } from 'react';
30
- import { useStepDependency } from '../../StepHooks';
31
- function Title(_a) {
18
+ import { useFormStep } from '../../StepHooks';
19
+ function TitleStep(_a) {
32
20
  var _b;
33
- var step = _a.step, value = _a.value;
21
+ var step = _a.step;
22
+ var _c = useFormStep(step).value, title = _c.title, description = _c.description;
34
23
  var formStyle = useAppSelector(function (state) { return state.global; }).formStyle;
35
24
  var form = useContext(FormContext);
36
25
  var widthStats = useAppSelector(function (state) { return state.widthStats; });
37
- var _c = value !== null && value !== void 0 ? value : {}, title = _c.title, description = _c.description;
38
26
  var size = (_b = step.size) !== null && _b !== void 0 ? _b : form.size.blockNum;
39
27
  return (_jsxs("div", __assign({ className: styles.container, style: {
40
28
  color: formStyle.textColor,
@@ -50,12 +38,4 @@ function Title(_a) {
50
38
  margin: title ? '10px 0px' : '0px 0px 5px 0px',
51
39
  } }, { children: description })))] })));
52
40
  }
53
- function TitleStep(props) {
54
- var step = props.step;
55
- var originalValue = useStepDependency(step).originalValue;
56
- return (_jsx(Controller, { name: step.id, defaultValue: originalValue, render: function (_a) {
57
- var _b = _a.field, ref = _b.ref, field = __rest(_b, ["ref"]);
58
- return (_jsx(Title, __assign({}, props, field, { inputRef: ref })));
59
- } }));
60
- }
61
41
  export default TitleStep;
@@ -0,0 +1,9 @@
1
+ import { FillerSteps } from '../../StepFunctions';
2
+ import React from 'react';
3
+ export declare const SizeChangeContext: React.Context<(() => void) | undefined>;
4
+ export interface StepFillerContainerProps {
5
+ step: FillerSteps;
6
+ children: React.ReactNode;
7
+ }
8
+ declare function StepFillerContainer({ step, children, }: StepFillerContainerProps): JSX.Element;
9
+ export default StepFillerContainer;
@@ -0,0 +1,48 @@
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, Fragment as _Fragment } from "react/jsx-runtime";
13
+ import { createContext, useCallback, useContext, useState } from 'react';
14
+ import { useFormContext } from 'react-hook-form';
15
+ import { calcFillerSize } from '../../StepFunctions';
16
+ import FormContext from '../../../Contexts/FormContext';
17
+ import styles from './StepFiller.module.css';
18
+ import { selectBreakPoint, useAppSelector } from '../../../hooks';
19
+ export var SizeChangeContext = createContext(undefined);
20
+ function StepFiller(_a) {
21
+ var step = _a.step, children = _a.children;
22
+ var getValues = useFormContext().getValues;
23
+ var form = useContext(FormContext);
24
+ var _b = useState(calcFillerSize(step, form.steps, getValues(), form.size)), fillerSize = _b[0], setFillerSize = _b[1];
25
+ var currentBreakPoint = useAppSelector(selectBreakPoint);
26
+ var handleSizeChange = useCallback(function () {
27
+ setFillerSize(calcFillerSize(step, form.steps, getValues(), form.size));
28
+ }, []);
29
+ if (step.maxSize && step.maxSize < form.size.blockNum) {
30
+ return (_jsxs("div", __assign({ className: styles.firstLvlContainer, style: {
31
+ width: currentBreakPoint <= step.size ? '100%' : 'fit-content',
32
+ } }, { children: [_jsx(SizeChangeContext.Provider, __assign({ value: handleSizeChange }, { children: children })), _jsx("div", { className: styles.smallSeparator, style: {
33
+ width: fillerSize,
34
+ } })] })));
35
+ }
36
+ else {
37
+ return (_jsxs(SizeChangeContext.Provider, __assign({ value: handleSizeChange }, { children: [children, step.maxSize && _jsx("div", { className: styles.separator })] })));
38
+ }
39
+ }
40
+ function StepFillerContainer(_a) {
41
+ var step = _a.step, children = _a.children;
42
+ var handleSizeChange = useContext(SizeChangeContext);
43
+ if (handleSizeChange)
44
+ return _jsx(_Fragment, { children: children });
45
+ else
46
+ return _jsx(StepFiller, { step: step, children: children });
47
+ }
48
+ export default StepFillerContainer;
@@ -1,16 +1,16 @@
1
- .separator {
2
- flex-basis: 100%;
3
- height: 0;
4
- }
5
-
6
- .firstLvlContainer {
7
- max-width: 100%;
8
- display: flex;
9
- flex-flow: row wrap;
10
- }
11
-
12
- .smallSeparator {
13
- height: 0;
14
- max-width: 100%;
15
- flex-basis: 0;
16
- }
1
+ .firstLvlContainer {
2
+ max-width: 100%;
3
+ display: flex;
4
+ flex-flow: row wrap;
5
+ }
6
+
7
+ .smallSeparator {
8
+ height: 0;
9
+ max-width: 100%;
10
+ flex-basis: 0;
11
+ }
12
+
13
+ .separator {
14
+ flex-basis: 100%;
15
+ height: 0;
16
+ }
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { GSmartSelect } from '../../../@Types/GenericFormSteps';
3
+ import { CheckBox, DatePicker, ClassifierSelector, FormSelector } from '../../../@Types/FormStep';
4
+ interface MaterialInputProps {
5
+ step: GSmartSelect | CheckBox | ClassifierSelector | DatePicker | FormSelector;
6
+ editable: boolean;
7
+ onClick?: () => void;
8
+ children: React.ReactNode;
9
+ }
10
+ declare function MaterialInputContainer({ step, editable, children, onClick, }: MaterialInputProps): JSX.Element;
11
+ export default MaterialInputContainer;
@@ -0,0 +1,32 @@
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 } from "react/jsx-runtime";
13
+ import { useContext } from 'react';
14
+ import FormContext from '../../../Contexts/FormContext';
15
+ import { useAppSelector, selectBreakPoint } from '../../../hooks';
16
+ import { calcStepWidth } from '../../StepFunctions';
17
+ import styles from './MaterialInputContainer.module.css';
18
+ function MaterialInputContainer(_a) {
19
+ var step = _a.step, editable = _a.editable, children = _a.children, onClick = _a.onClick;
20
+ var form = useContext(FormContext);
21
+ var currentBreakPoint = useAppSelector(selectBreakPoint);
22
+ var postview = useAppSelector(function (state) { return state.global.postview; });
23
+ return (_jsx("div", __assign({ className: styles.container, style: {
24
+ width: currentBreakPoint <= step.size
25
+ ? '100%'
26
+ : calcStepWidth(step.size, form.size),
27
+ minHeight: step.description || (!postview && editable && step.required)
28
+ ? '55px'
29
+ : '43px',
30
+ }, onClick: onClick, "data-testid": step.id }, { children: children })));
31
+ }
32
+ export default MaterialInputContainer;
@@ -1,9 +1,9 @@
1
- .container {
2
- width: fit-content;
3
- max-width: calc(100% - 20px);
4
- display: flex;
5
- padding: 10px;
6
- padding-bottom: 0px;
7
- padding-top: 5px;
8
- margin-bottom: 0px;
9
- }
1
+ .container {
2
+ width: fit-content;
3
+ max-width: calc(100% - 20px);
4
+ display: flex;
5
+ padding: 10px;
6
+ padding-bottom: 0px;
7
+ padding-top: 5px;
8
+ margin-bottom: 0px;
9
+ }
@@ -11,14 +11,14 @@ interface StyleProps {
11
11
  size?: number | string;
12
12
  cantEdit?: boolean;
13
13
  }
14
- interface ComponentProps extends StyleProps {
15
- onChange?: CheckboxProps['onChange'];
14
+ interface ComponentProps extends StyleProps, Omit<CheckboxProps, 'size' | 'onChange'> {
15
+ onChange?: (checked: boolean) => void;
16
16
  checked: boolean;
17
17
  }
18
18
  /**
19
19
  * Generic datepicker with apps designs. Is class do to the use in the react-hook-forms library
20
20
  */
21
- declare class RoundedCheckBox extends React.Component<ComponentProps & Omit<CheckboxProps, 'size'>> {
21
+ declare class RoundedCheckBox extends React.Component<ComponentProps> {
22
22
  render(): JSX.Element;
23
23
  }
24
24
  export default RoundedCheckBox;
@@ -38,10 +38,7 @@ export interface RoundedSmartSelectProps extends Omit<TextFieldProps, 'color' |
38
38
  /** If the input is loading */
39
39
  loading?: boolean;
40
40
  /** function called when value changes */
41
- handleUpdate?: (event: React.ChangeEvent<{
42
- name?: string | undefined;
43
- value: any;
44
- }> | string, child?: React.ReactNode) => void;
41
+ handleUpdate?: (value: any) => void;
45
42
  /** Strig to place in the label */
46
43
  label: string;
47
44
  /** Minimum width in px of the component */
@@ -218,10 +218,8 @@ export default function RoundedSmartSelect(_a) {
218
218
  else {
219
219
  return (_jsxs(RoundedSelect, __assign({ onBlur: onBlur, onFocus: onFocus, inputRef: inputRef, name: name, fullWidth: true, handleUpdate: function (event) {
220
220
  handleUpdate === null || handleUpdate === void 0 ? void 0 : handleUpdate(options === null || options === void 0 ? void 0 : options.find(function (option) {
221
- return getValueString(option) == event.target.value;
221
+ return getValueString(option) === event.target.value;
222
222
  }));
223
- }, onOpen: function () {
224
- //Show loading icon if loading
225
223
  }, value: loading ? '' : getValueString(value), color: color, errorColor: errorColor, focusColor: focusColor, helperTextColor: helperTextColor, backgroundColor: backgroundColor, outlineColor: outlineColor, cantEdit: cantEdit, disabled: cantEdit || disabled, label: label, required: required, readOnly: readOnly, helperText: hidden ? undefined : helperText, containerMargin: containerMargin, height: height, fontSize: fontSize, error: !hidden && error, iconComponent: loading
226
224
  ? function () { return (_jsx("div", __assign({ style: {
227
225
  marginTop: 3,
@@ -25,6 +25,7 @@ export declare const SiteSlice: import("@reduxjs/toolkit").Slice<SiteState, {
25
25
  };
26
26
  type: string;
27
27
  }) => void;
28
+ clearDependency: (state: import("immer/dist/internal").WritableDraft<SiteState>, { payload: { id, idSection } }: PayloadAction<GBaseStep>) => void;
28
29
  setEmptyDependency: (state: import("immer/dist/internal").WritableDraft<SiteState>, { payload: { step: { id }, empty, }, }: {
29
30
  payload: {
30
31
  step: GBaseStep;
@@ -50,7 +51,7 @@ export declare const SiteSlice: import("@reduxjs/toolkit").Slice<SiteState, {
50
51
  export declare const focusStep: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<{
51
52
  step: FormStep;
52
53
  values: FieldValues;
53
- } | undefined, "site/focusStep">, setStepDependency: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
54
+ } | undefined, "site/focusStep">, clearDependency: import("@reduxjs/toolkit").ActionCreatorWithPayload<GBaseStep, "site/clearDependency">, setStepDependency: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
54
55
  step: GBaseStep;
55
56
  value: StepDependency['value'];
56
57
  }, "site/setStepDependency">, addStepsDependencies: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
@@ -33,11 +33,30 @@ export var SiteSlice = createSlice({
33
33
  var old = state.dependencies[id];
34
34
  if (old && (old.type !== type || old.value !== value)) {
35
35
  state.dependencies[id] = __assign(__assign({}, state.dependencies[id]), { type: type, value: value });
36
- for (var _i = 0, _d = old.dependents; _i < _d.length; _i++) {
37
- var dependent = _d[_i];
38
- if (state.idCurrentSection !== null &&
39
- dependent.idSection !== idSection) {
40
- state.values.sections[dependent.idSection][dependent.id] = calcDefaultValue(dependent);
36
+ if (state.idCurrentSection !== null) {
37
+ for (var _i = 0, _d = old.dependents; _i < _d.length; _i++) {
38
+ var dependent = _d[_i];
39
+ if (dependent.idSection !== idSection) {
40
+ state.values.sections[dependent.idSection][dependent.id] = calcDefaultValue(dependent);
41
+ }
42
+ }
43
+ }
44
+ }
45
+ },
46
+ clearDependency: function (state, _a) {
47
+ var _b = _a.payload, id = _b.id, idSection = _b.idSection;
48
+ if (state.idCurrentSection === null ||
49
+ state.idCurrentSection === idSection) {
50
+ var old = state.dependencies[id];
51
+ if (old && old.value !== null) {
52
+ state.dependencies[id] = __assign(__assign({}, state.dependencies[id]), { value: null, empty: false });
53
+ if (state.idCurrentSection !== null) {
54
+ for (var _i = 0, _c = old.dependents; _i < _c.length; _i++) {
55
+ var dependent = _c[_i];
56
+ if (dependent.idSection !== idSection) {
57
+ state.values.sections[dependent.idSection][dependent.id] = calcDefaultValue(dependent);
58
+ }
59
+ }
41
60
  }
42
61
  }
43
62
  }
@@ -106,5 +125,5 @@ export var SiteSlice = createSlice({
106
125
  });
107
126
  },
108
127
  });
109
- export var focusStep = (_a = SiteSlice.actions, _a.focusStep), setStepDependency = _a.setStepDependency, addStepsDependencies = _a.addStepsDependencies, setEmptyDependency = _a.setEmptyDependency, handlePrevious = _a.handlePrevious, handleNext = _a.handleNext;
128
+ export var focusStep = (_a = SiteSlice.actions, _a.focusStep), clearDependency = _a.clearDependency, setStepDependency = _a.setStepDependency, addStepsDependencies = _a.addStepsDependencies, setEmptyDependency = _a.setEmptyDependency, handlePrevious = _a.handlePrevious, handleNext = _a.handleNext;
110
129
  export default SiteSlice;
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": "2.0.18",
4
+ "version":"2.0.19-test",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",
@@ -1,25 +0,0 @@
1
- .container {
2
- width: fit-content;
3
- max-width: calc(100% - 20px);
4
- display: flex;
5
- padding: 10px;
6
- padding-bottom: 0px;
7
- padding-top: 5px;
8
- margin-bottom: 0px;
9
- }
10
- .separator {
11
- flex-basis: 100%;
12
- height: 0;
13
- }
14
-
15
- .firstLvlContainer {
16
- max-width: 100%;
17
- display: flex;
18
- flex-flow: row wrap;
19
- }
20
-
21
- .smallSeparator {
22
- height: 0;
23
- max-width: 100%;
24
- flex-basis: 0;
25
- }
@@ -1,9 +0,0 @@
1
- .container {
2
- width: fit-content;
3
- max-width: calc(100% - 20px);
4
- display: flex;
5
- padding: 10px;
6
- padding-bottom: 0px;
7
- padding-top: 5px;
8
- margin-bottom: 0px;
9
- }