@arquimedes.co/eureka-forms 0.1.2 → 0.2.5
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.
- package/dist/@Types/@Types.d.ts +1 -1
- package/dist/@Types/@Types.js +1 -1
- package/dist/@Types/Form.d.ts +63 -63
- package/dist/@Types/Form.js +1 -1
- package/dist/@Types/FormStep.d.ts +105 -105
- package/dist/@Types/FormStep.js +1 -1
- package/dist/@Types/Organization.d.ts +16 -16
- package/dist/@Types/Organization.js +1 -1
- package/dist/App.d.ts +34 -32
- package/dist/App.js +262 -261
- package/dist/App.module.css +21 -0
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.d.ts +4 -4
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +232 -232
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.module.css +46 -0
- package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.d.ts +12 -12
- package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.js +33 -33
- package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.module.css +48 -0
- package/dist/FormComponents/Form/Form.d.ts +24 -23
- package/dist/FormComponents/Form/Form.js +116 -116
- package/dist/FormComponents/Form/Form.module.css +39 -0
- package/dist/FormComponents/Form/StepperForm/StepperForm.d.ts +4 -4
- package/dist/FormComponents/Form/StepperForm/StepperForm.js +6 -6
- package/dist/FormComponents/Form/StepperForm/StepperForm.module.css +0 -0
- package/dist/FormComponents/Section/MaterialSection/MaterialSection.d.ts +4 -4
- package/dist/FormComponents/Section/MaterialSection/MaterialSection.js +42 -42
- package/dist/FormComponents/Section/MaterialSection/MaterialSection.module.css +8 -0
- package/dist/FormComponents/Section/Section.d.ts +24 -23
- package/dist/FormComponents/Section/Section.js +25 -25
- package/dist/FormComponents/Step/ClassifierSelectorStep/ClassifierSelectorStep.d.ts +9 -9
- package/dist/FormComponents/Step/ClassifierSelectorStep/ClassifierSelectorStep.js +37 -37
- package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.d.ts +4 -4
- package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +105 -105
- package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.module.css +25 -0
- package/dist/FormComponents/Step/DatePickerStep/DatePickerStep.d.ts +9 -9
- package/dist/FormComponents/Step/DatePickerStep/DatePickerStep.js +25 -25
- package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.d.ts +4 -4
- package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +35 -35
- package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.module.css +9 -0
- package/dist/FormComponents/Step/FileUploadStep/FileUploadStep.d.ts +9 -9
- package/dist/FormComponents/Step/FileUploadStep/FileUploadStep.js +25 -25
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.d.ts +11 -11
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +110 -110
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.module.css +52 -0
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.d.ts +13 -13
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +165 -165
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.module.css +45 -0
- package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.d.ts +4 -4
- package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +99 -99
- package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.module.css +25 -0
- package/dist/FormComponents/Step/SelectorStep/SelectorStep.d.ts +9 -9
- package/dist/FormComponents/Step/SelectorStep/SelectorStep.js +37 -37
- package/dist/FormComponents/Step/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.d.ts +4 -4
- package/dist/FormComponents/Step/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.js +11 -11
- package/dist/FormComponents/Step/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.module.css +7 -0
- package/dist/FormComponents/Step/SeparatorStep/SeparatorStep.d.ts +9 -9
- package/dist/FormComponents/Step/SeparatorStep/SeparatorStep.js +37 -37
- package/dist/FormComponents/Step/Step.d.ts +10 -10
- package/dist/FormComponents/Step/Step.js +73 -64
- package/dist/FormComponents/Step/StepFunctions.d.ts +5 -5
- package/dist/FormComponents/Step/StepFunctions.js +51 -51
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/DraftEditor.css +35 -0
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.d.ts +6 -6
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +112 -112
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.module.css +58 -0
- package/dist/FormComponents/Step/TextAreaStep/TextAreaStep.d.ts +9 -9
- package/dist/FormComponents/Step/TextAreaStep/TextAreaStep.js +25 -25
- package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.d.ts +4 -4
- package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +43 -43
- package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.module.css +9 -0
- package/dist/FormComponents/Step/TextInputStep/TextInputStep.d.ts +9 -9
- package/dist/FormComponents/Step/TextInputStep/TextInputStep.js +25 -25
- package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.d.ts +4 -4
- package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.js +18 -18
- package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.module.css +35 -0
- package/dist/FormComponents/Step/TitleStep/TitleStep.d.ts +9 -9
- package/dist/FormComponents/Step/TitleStep/TitleStep.js +37 -37
- package/dist/FormComponents/Term/MaterialTerm/MaterialTerm.d.ts +4 -4
- package/dist/FormComponents/Term/MaterialTerm/MaterialTerm.js +77 -77
- package/dist/FormComponents/Term/MaterialTerm/MaterialTerm.module.css +73 -0
- package/dist/FormComponents/Term/Term.d.ts +15 -15
- package/dist/FormComponents/Term/Term.js +25 -25
- package/dist/Widget.d.ts +1 -1
- package/dist/Widget.js +39 -56
- package/dist/constants/Files/FileExtensions.d.ts +3 -3
- package/dist/constants/Files/FileExtensions.js +65 -65
- package/dist/constants/Files/FileMaxSize.d.ts +2 -2
- package/dist/constants/Files/FileMaxSize.js +2 -2
- package/dist/constants/FormStepTypes.d.ts +33 -33
- package/dist/constants/FormStepTypes.js +39 -39
- package/dist/constants/InternalFormStyle.d.ts +3 -3
- package/dist/constants/InternalFormStyle.js +12 -12
- package/dist/constants/MaterialClassNameSeed.d.ts +1 -1
- package/dist/constants/MaterialClassNameSeed.js +1 -1
- package/dist/controllers/FileService.d.ts +5 -5
- package/dist/controllers/FileService.js +89 -89
- package/dist/index.d.ts +1 -2
- package/dist/index.js +16 -17
- package/dist/index.lib.d.ts +3 -0
- package/dist/index.lib.js +3 -0
- package/dist/index.module.css +14 -0
- package/dist/shared/Loader/Loader.d.ts +18 -18
- package/dist/shared/Loader/Loader.js +26 -26
- package/dist/shared/Loader/Loader.module.css +12 -0
- package/dist/shared/Navbar/Navbar.d.ts +9 -9
- package/dist/shared/Navbar/Navbar.js +18 -18
- package/dist/shared/Navbar/Navbar.module.css +18 -0
- package/dist/shared/RoundedButton/RoundedButton.d.ts +30 -30
- package/dist/shared/RoundedButton/RoundedButton.js +45 -45
- package/dist/shared/RoundedCheckBox/RoundedCheckBox.d.ts +24 -24
- package/dist/shared/RoundedCheckBox/RoundedCheckBox.js +101 -101
- package/dist/shared/RoundedDatePicker/RoundedDatePicker.d.ts +40 -40
- package/dist/shared/RoundedDatePicker/RoundedDatePicker.js +246 -246
- package/dist/shared/RoundedSelect/RoundedSelect.d.ts +42 -42
- package/dist/shared/RoundedSelect/RoundedSelect.js +171 -171
- package/dist/shared/RoundedTextField/RoundedTextField.d.ts +41 -41
- package/dist/shared/RoundedTextField/RoundedTextField.js +138 -138
- package/package.json +2 -2
|
@@ -1,64 +1,73 @@
|
|
|
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
|
-
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
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import Types from '../../constants/FormStepTypes';
|
|
25
|
-
import SelectorStep from './SelectorStep/SelectorStep';
|
|
26
|
-
import SeparatorStep from './SeparatorStep/SeparatorStep';
|
|
27
|
-
import TextInputStep from './TextInputStep/TextInputStep';
|
|
28
|
-
import TitleStep from './TitleStep/TitleStep';
|
|
29
|
-
import ClassifierSelectorStep from './ClassifierSelectorStep/ClassifierSelectorStep';
|
|
30
|
-
import TextAreaStep from './TextAreaStep/TextAreaStep';
|
|
31
|
-
import DatePickerStep from './DatePickerStep/DatePickerStep';
|
|
32
|
-
import FileUploadStep from './FileUploadStep/FileUploadStep';
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
+
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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import Types from '../../constants/FormStepTypes';
|
|
25
|
+
import SelectorStep from './SelectorStep/SelectorStep';
|
|
26
|
+
import SeparatorStep from './SeparatorStep/SeparatorStep';
|
|
27
|
+
import TextInputStep from './TextInputStep/TextInputStep';
|
|
28
|
+
import TitleStep from './TitleStep/TitleStep';
|
|
29
|
+
import ClassifierSelectorStep from './ClassifierSelectorStep/ClassifierSelectorStep';
|
|
30
|
+
import TextAreaStep from './TextAreaStep/TextAreaStep';
|
|
31
|
+
import DatePickerStep from './DatePickerStep/DatePickerStep';
|
|
32
|
+
import FileUploadStep from './FileUploadStep/FileUploadStep';
|
|
33
|
+
import React from 'react';
|
|
34
|
+
function StepComponent(_a) {
|
|
35
|
+
var step = _a.step, props = __rest(_a, ["step"]);
|
|
36
|
+
switch (step.type) {
|
|
37
|
+
case Types.TITLE: {
|
|
38
|
+
return _jsx(TitleStep, __assign({ step: step }, props), void 0);
|
|
39
|
+
}
|
|
40
|
+
case Types.SELECTOR: {
|
|
41
|
+
return _jsx(SelectorStep, __assign({ step: step }, props), void 0);
|
|
42
|
+
}
|
|
43
|
+
case Types.CLASSIFIER_SELECTOR: {
|
|
44
|
+
return (_jsx(ClassifierSelectorStep, __assign({ step: step }, props), void 0));
|
|
45
|
+
}
|
|
46
|
+
case Types.TEXTAREA: {
|
|
47
|
+
return _jsx(TextAreaStep, __assign({ step: step }, props), void 0);
|
|
48
|
+
}
|
|
49
|
+
case Types.TEXTINPUT: {
|
|
50
|
+
return _jsx(TextInputStep, __assign({ step: step }, props), void 0);
|
|
51
|
+
}
|
|
52
|
+
case Types.DATEPICKER: {
|
|
53
|
+
return _jsx(DatePickerStep, __assign({ step: step }, props), void 0);
|
|
54
|
+
}
|
|
55
|
+
case Types.SEPARATOR: {
|
|
56
|
+
return _jsx(SeparatorStep, __assign({ step: step }, props), void 0);
|
|
57
|
+
}
|
|
58
|
+
case Types.FILEUPLOAD: {
|
|
59
|
+
return _jsx(FileUploadStep, __assign({ step: step }, props), void 0);
|
|
60
|
+
}
|
|
61
|
+
default:
|
|
62
|
+
console.log('TYPENOTFOUND', step.type);
|
|
63
|
+
var customStep = props.customSteps[step.type];
|
|
64
|
+
console.log(customStep);
|
|
65
|
+
if (customStep) {
|
|
66
|
+
return React.cloneElement(customStep, __assign({ step: step }, props));
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
return _jsx("div", {}, void 0);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export default StepComponent;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Form } from '../../@Types/Form';
|
|
2
|
-
import { ClassifierSelector, FormSelector, FormStep } from '../../@Types/FormStep';
|
|
3
|
-
export declare function calcFillerSize(step: FormSelector | ClassifierSelector, steps: Record<string, FormStep>, values: Record<string, unknown>, form: Form): number;
|
|
4
|
-
export declare function recursivelyCheckOpenSize(step: FormStep, steps: Record<string, FormStep>, values: Record<string, any>): number;
|
|
5
|
-
export declare const calcStepWidth: (stepSize: 1 | 2 | 3 | 4, form: Form) => number;
|
|
1
|
+
import { Form } from '../../@Types/Form';
|
|
2
|
+
import { ClassifierSelector, FormSelector, FormStep } from '../../@Types/FormStep';
|
|
3
|
+
export declare function calcFillerSize(step: FormSelector | ClassifierSelector, steps: Record<string, FormStep>, values: Record<string, unknown>, form: Form): number;
|
|
4
|
+
export declare function recursivelyCheckOpenSize(step: FormStep, steps: Record<string, FormStep>, values: Record<string, any>): number;
|
|
5
|
+
export declare const calcStepWidth: (stepSize: 1 | 2 | 3 | 4, form: Form) => number;
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import Types, { ClassifierOptionTypes, OptionTypes, } from '../../constants/FormStepTypes';
|
|
2
|
-
export function calcFillerSize(step, steps, values, form) {
|
|
3
|
-
if (step.maxSize < form.blockNum) {
|
|
4
|
-
var stepSize = step.maxSize - recursivelyCheckOpenSize(step, steps, values);
|
|
5
|
-
return (form.blockSize * stepSize + form.spacingSize * (stepSize - 1) + 20);
|
|
6
|
-
}
|
|
7
|
-
else {
|
|
8
|
-
return 0;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
export function recursivelyCheckOpenSize(step, steps, values) {
|
|
12
|
-
var value = values[step.id];
|
|
13
|
-
if (step.type === Types.SELECTOR) {
|
|
14
|
-
var size = step.size;
|
|
15
|
-
if (value) {
|
|
16
|
-
var currentOption = step.options.find(function (option) { return option.value === value; });
|
|
17
|
-
if ((currentOption === null || currentOption === void 0 ? void 0 : currentOption.type) === OptionTypes.NESTED) {
|
|
18
|
-
var optionSize = 0;
|
|
19
|
-
for (var _i = 0, _a = currentOption.steps; _i < _a.length; _i++) {
|
|
20
|
-
var pStepId = _a[_i];
|
|
21
|
-
var pStep = steps[pStepId];
|
|
22
|
-
optionSize += recursivelyCheckOpenSize(pStep, steps, values);
|
|
23
|
-
}
|
|
24
|
-
size += optionSize;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return size;
|
|
28
|
-
}
|
|
29
|
-
if (step.type === Types.CLASSIFIER_SELECTOR) {
|
|
30
|
-
var size = step.size;
|
|
31
|
-
if (value) {
|
|
32
|
-
var currentOption = step.options[value];
|
|
33
|
-
if ((currentOption === null || currentOption === void 0 ? void 0 : currentOption.type) === ClassifierOptionTypes.NESTED) {
|
|
34
|
-
var optionSize = 0;
|
|
35
|
-
for (var _b = 0, _c = currentOption.steps; _b < _c.length; _b++) {
|
|
36
|
-
var pStepId = _c[_b];
|
|
37
|
-
var pStep = steps[pStepId];
|
|
38
|
-
optionSize += recursivelyCheckOpenSize(pStep, steps, values);
|
|
39
|
-
}
|
|
40
|
-
size += optionSize;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return size;
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
return 4;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
export var calcStepWidth = function (stepSize, form) {
|
|
50
|
-
return form.blockSize * stepSize + form.spacingSize * (stepSize - 1);
|
|
51
|
-
};
|
|
1
|
+
import Types, { ClassifierOptionTypes, OptionTypes, } from '../../constants/FormStepTypes';
|
|
2
|
+
export function calcFillerSize(step, steps, values, form) {
|
|
3
|
+
if (step.maxSize < form.blockNum) {
|
|
4
|
+
var stepSize = step.maxSize - recursivelyCheckOpenSize(step, steps, values);
|
|
5
|
+
return (form.blockSize * stepSize + form.spacingSize * (stepSize - 1) + 20);
|
|
6
|
+
}
|
|
7
|
+
else {
|
|
8
|
+
return 0;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export function recursivelyCheckOpenSize(step, steps, values) {
|
|
12
|
+
var value = values[step.id];
|
|
13
|
+
if (step.type === Types.SELECTOR) {
|
|
14
|
+
var size = step.size;
|
|
15
|
+
if (value) {
|
|
16
|
+
var currentOption = step.options.find(function (option) { return option.value === value; });
|
|
17
|
+
if ((currentOption === null || currentOption === void 0 ? void 0 : currentOption.type) === OptionTypes.NESTED) {
|
|
18
|
+
var optionSize = 0;
|
|
19
|
+
for (var _i = 0, _a = currentOption.steps; _i < _a.length; _i++) {
|
|
20
|
+
var pStepId = _a[_i];
|
|
21
|
+
var pStep = steps[pStepId];
|
|
22
|
+
optionSize += recursivelyCheckOpenSize(pStep, steps, values);
|
|
23
|
+
}
|
|
24
|
+
size += optionSize;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return size;
|
|
28
|
+
}
|
|
29
|
+
if (step.type === Types.CLASSIFIER_SELECTOR) {
|
|
30
|
+
var size = step.size;
|
|
31
|
+
if (value) {
|
|
32
|
+
var currentOption = step.options[value];
|
|
33
|
+
if ((currentOption === null || currentOption === void 0 ? void 0 : currentOption.type) === ClassifierOptionTypes.NESTED) {
|
|
34
|
+
var optionSize = 0;
|
|
35
|
+
for (var _b = 0, _c = currentOption.steps; _b < _c.length; _b++) {
|
|
36
|
+
var pStepId = _c[_b];
|
|
37
|
+
var pStep = steps[pStepId];
|
|
38
|
+
optionSize += recursivelyCheckOpenSize(pStep, steps, values);
|
|
39
|
+
}
|
|
40
|
+
size += optionSize;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return size;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
return 4;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export var calcStepWidth = function (stepSize, form) {
|
|
50
|
+
return form.blockSize * stepSize + form.spacingSize * (stepSize - 1);
|
|
51
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.EF-DraftContainer {
|
|
2
|
+
font: inherit;
|
|
3
|
+
font-size: 1rem;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.EF-DraftContainer .DraftEditor-root {
|
|
7
|
+
height: unset;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.EF-DraftContainer .rdw-option-wrapper {
|
|
11
|
+
border-radius: 7px;
|
|
12
|
+
border: 1px solid var(--eureka-outline);
|
|
13
|
+
}
|
|
14
|
+
.EF-DraftContainer .rdw-option-wrapper:active {
|
|
15
|
+
border: 1px solid var(--eureka-primary);
|
|
16
|
+
}
|
|
17
|
+
.EF-DraftContainer .rdw-option-wrapper:hover {
|
|
18
|
+
box-shadow: none;
|
|
19
|
+
border: 1px solid var(--eureka-primary);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.EF-DraftContainer .rdw-option-active {
|
|
23
|
+
border: 1px solid var(--eureka-primary);
|
|
24
|
+
box-shadow: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.EF-DraftContainer .rdw-editor-toolbar {
|
|
28
|
+
border-radius: 15px 15px 0 0;
|
|
29
|
+
border: none;
|
|
30
|
+
border-bottom: 1px solid var(--eureka-outline);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.EF-DraftContainer .rdw-editor-main {
|
|
34
|
+
cursor: text;
|
|
35
|
+
}
|
package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
|
|
3
|
-
import './DraftEditor.css';
|
|
4
|
-
import { TextAreaStepProps } from '../TextAreaStep';
|
|
5
|
-
declare function TextAreaStep({ step, errors, control, postview, formStyle, originalValues, }: TextAreaStepProps): JSX.Element;
|
|
6
|
-
export default TextAreaStep;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
|
|
3
|
+
import './DraftEditor.css';
|
|
4
|
+
import { TextAreaStepProps } from '../TextAreaStep';
|
|
5
|
+
declare function TextAreaStep({ step, errors, control, postview, formStyle, originalValues, }: TextAreaStepProps): JSX.Element;
|
|
6
|
+
export default TextAreaStep;
|
|
@@ -1,112 +1,112 @@
|
|
|
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 { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import RoundedTextField from '../../../../shared/RoundedTextField/RoundedTextField';
|
|
14
|
-
import styles from './MaterialTextAreaStep.module.css';
|
|
15
|
-
import { Controller } from 'react-hook-form';
|
|
16
|
-
import { Editor } from 'react-draft-wysiwyg'; //Load programatically only if step has editor
|
|
17
|
-
import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
|
|
18
|
-
import './DraftEditor.css';
|
|
19
|
-
import { convertFromRaw, EditorState } from 'draft-js';
|
|
20
|
-
import { useState } from 'react';
|
|
21
|
-
import { ClickAwayListener } from '@material-ui/core';
|
|
22
|
-
function TextAreaStep(_a) {
|
|
23
|
-
var step = _a.step, errors = _a.errors, control = _a.control, postview = _a.postview, formStyle = _a.formStyle, originalValues = _a.originalValues;
|
|
24
|
-
var _b = useState(false), hovering = _b[0], setHovering = _b[1];
|
|
25
|
-
var _c = useState(false), focus = _c[0], setFocus = _c[1];
|
|
26
|
-
var calcStyle = function () {
|
|
27
|
-
if (focus) {
|
|
28
|
-
return {
|
|
29
|
-
border: '2px solid ' + formStyle.primaryColor,
|
|
30
|
-
marginTop: -1,
|
|
31
|
-
marginLeft: -1,
|
|
32
|
-
marginBottom: 0,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
else if (hovering) {
|
|
36
|
-
return { border: '1px solid ' + formStyle.primaryColor };
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
return { border: '1px solid ' + formStyle.outlineColor };
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
if (step.hasTextEditor) {
|
|
43
|
-
return (_jsxs("div", __assign({ className: styles.textEditorContainer, style: {
|
|
44
|
-
'--eureka-outline': formStyle.outlineColor,
|
|
45
|
-
'--eureka-primary': formStyle.primaryColor,
|
|
46
|
-
} }, { children: [step.label && (_jsxs("div", __assign({ className: styles.textEditorLabel, style: {
|
|
47
|
-
color: !!errors[step.id]
|
|
48
|
-
? formStyle.errorColor
|
|
49
|
-
: formStyle.textColor,
|
|
50
|
-
} }, { children: [step.label, " ", step.required ? ' *' : ''] }), void 0)), _jsx(ClickAwayListener, __assign({ mouseEvent: "onMouseDown", onClickAway: function () {
|
|
51
|
-
if (!postview) {
|
|
52
|
-
setFocus(false);
|
|
53
|
-
}
|
|
54
|
-
} }, { children: _jsxs("div", __assign({ className: styles.textContainer + ' EF-DraftContainer', style: calcStyle(), onMouseEnter: function () {
|
|
55
|
-
if (!postview) {
|
|
56
|
-
setHovering(true);
|
|
57
|
-
}
|
|
58
|
-
}, onMouseLeave: function () {
|
|
59
|
-
if (!postview) {
|
|
60
|
-
setHovering(false);
|
|
61
|
-
}
|
|
62
|
-
}, onClick: function () {
|
|
63
|
-
if (!postview) {
|
|
64
|
-
setFocus(true);
|
|
65
|
-
}
|
|
66
|
-
} }, { children: [postview && (_jsx("div", { className: styles.disabledCurtain }, void 0)), _jsx(Controller, { name: step.id, control: control, defaultValue: originalValues[step.id]
|
|
67
|
-
? EditorState.createWithContent(convertFromRaw(originalValues[step.id].draft))
|
|
68
|
-
: EditorState.createEmpty(), rules: step.required
|
|
69
|
-
? {
|
|
70
|
-
validate: function (editorState) {
|
|
71
|
-
return editorState
|
|
72
|
-
.getCurrentContent()
|
|
73
|
-
.hasText();
|
|
74
|
-
},
|
|
75
|
-
}
|
|
76
|
-
: {}, shouldUnregister: true, render: function (_a) {
|
|
77
|
-
var _b;
|
|
78
|
-
var field = _a.field;
|
|
79
|
-
return (_jsx(Editor, { onBlur: field.onBlur, editorState: field.value, onEditorStateChange: field.onChange, toolbarClassName: styles.toolbar, editorClassName: styles.editor, wrapperClassName: styles.wrapper, editorStyle: { lineHeight: '85%' }, placeholder: (_b = step.description) !== null && _b !== void 0 ? _b : '', toolbar: {
|
|
80
|
-
options: ['inline', 'list', 'history'],
|
|
81
|
-
inline: {
|
|
82
|
-
options: [
|
|
83
|
-
'bold',
|
|
84
|
-
'italic',
|
|
85
|
-
'underline',
|
|
86
|
-
'strikethrough',
|
|
87
|
-
],
|
|
88
|
-
},
|
|
89
|
-
list: {
|
|
90
|
-
options: ['unordered'],
|
|
91
|
-
},
|
|
92
|
-
} }, void 0));
|
|
93
|
-
} }, void 0)] }), void 0) }), void 0), _jsx("div", __assign({ className: styles.errorMsg, style: {
|
|
94
|
-
color: formStyle.errorColor,
|
|
95
|
-
} }, { children: !!errors[step.id] && 'Este campo es obligatorio' }), void 0)] }), void 0));
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
return (_jsx("div", __assign({ className: styles.container, style: {
|
|
99
|
-
paddingBottom: step.description || !!errors[step.id] ? '0px' : '23px',
|
|
100
|
-
} }, { children: _jsx(Controller, { name: step.id, control: control, defaultValue: "", rules: {
|
|
101
|
-
required: step.required
|
|
102
|
-
? 'Este campo es obligatorio'
|
|
103
|
-
: undefined,
|
|
104
|
-
}, shouldUnregister: true, render: function (_a) {
|
|
105
|
-
var field = _a.field;
|
|
106
|
-
return (_jsx(RoundedTextField, __assign({}, field, { label: step.label, required: step.required, cantEdit: postview, fontWeight: 400, multiline: true, minRows: 4, maxRows: 6, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, textColor: formStyle.textColor, errorColor: formStyle.errorColor, backgroundColor: formStyle.backgroundColor, innerBackgroundColor: formStyle.stepBackgroundColor, helperText: errors[step.id]
|
|
107
|
-
? errors[step.id].message
|
|
108
|
-
: step.description, error: !!errors[step.id] }), void 0));
|
|
109
|
-
} }, void 0) }), void 0));
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
export default TextAreaStep;
|
|
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 { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import RoundedTextField from '../../../../shared/RoundedTextField/RoundedTextField';
|
|
14
|
+
import styles from './MaterialTextAreaStep.module.css';
|
|
15
|
+
import { Controller } from 'react-hook-form';
|
|
16
|
+
import { Editor } from 'react-draft-wysiwyg'; //Load programatically only if step has editor
|
|
17
|
+
import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
|
|
18
|
+
import './DraftEditor.css';
|
|
19
|
+
import { convertFromRaw, EditorState } from 'draft-js';
|
|
20
|
+
import { useState } from 'react';
|
|
21
|
+
import { ClickAwayListener } from '@material-ui/core';
|
|
22
|
+
function TextAreaStep(_a) {
|
|
23
|
+
var step = _a.step, errors = _a.errors, control = _a.control, postview = _a.postview, formStyle = _a.formStyle, originalValues = _a.originalValues;
|
|
24
|
+
var _b = useState(false), hovering = _b[0], setHovering = _b[1];
|
|
25
|
+
var _c = useState(false), focus = _c[0], setFocus = _c[1];
|
|
26
|
+
var calcStyle = function () {
|
|
27
|
+
if (focus) {
|
|
28
|
+
return {
|
|
29
|
+
border: '2px solid ' + formStyle.primaryColor,
|
|
30
|
+
marginTop: -1,
|
|
31
|
+
marginLeft: -1,
|
|
32
|
+
marginBottom: 0,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
else if (hovering) {
|
|
36
|
+
return { border: '1px solid ' + formStyle.primaryColor };
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return { border: '1px solid ' + formStyle.outlineColor };
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
if (step.hasTextEditor) {
|
|
43
|
+
return (_jsxs("div", __assign({ className: styles.textEditorContainer, style: {
|
|
44
|
+
'--eureka-outline': formStyle.outlineColor,
|
|
45
|
+
'--eureka-primary': formStyle.primaryColor,
|
|
46
|
+
} }, { children: [step.label && (_jsxs("div", __assign({ className: styles.textEditorLabel, style: {
|
|
47
|
+
color: !!errors[step.id]
|
|
48
|
+
? formStyle.errorColor
|
|
49
|
+
: formStyle.textColor,
|
|
50
|
+
} }, { children: [step.label, " ", step.required ? ' *' : ''] }), void 0)), _jsx(ClickAwayListener, __assign({ mouseEvent: "onMouseDown", onClickAway: function () {
|
|
51
|
+
if (!postview) {
|
|
52
|
+
setFocus(false);
|
|
53
|
+
}
|
|
54
|
+
} }, { children: _jsxs("div", __assign({ className: styles.textContainer + ' EF-DraftContainer', style: calcStyle(), onMouseEnter: function () {
|
|
55
|
+
if (!postview) {
|
|
56
|
+
setHovering(true);
|
|
57
|
+
}
|
|
58
|
+
}, onMouseLeave: function () {
|
|
59
|
+
if (!postview) {
|
|
60
|
+
setHovering(false);
|
|
61
|
+
}
|
|
62
|
+
}, onClick: function () {
|
|
63
|
+
if (!postview) {
|
|
64
|
+
setFocus(true);
|
|
65
|
+
}
|
|
66
|
+
} }, { children: [postview && (_jsx("div", { className: styles.disabledCurtain }, void 0)), _jsx(Controller, { name: step.id, control: control, defaultValue: originalValues[step.id]
|
|
67
|
+
? EditorState.createWithContent(convertFromRaw(originalValues[step.id].draft))
|
|
68
|
+
: EditorState.createEmpty(), rules: step.required
|
|
69
|
+
? {
|
|
70
|
+
validate: function (editorState) {
|
|
71
|
+
return editorState
|
|
72
|
+
.getCurrentContent()
|
|
73
|
+
.hasText();
|
|
74
|
+
},
|
|
75
|
+
}
|
|
76
|
+
: {}, shouldUnregister: true, render: function (_a) {
|
|
77
|
+
var _b;
|
|
78
|
+
var field = _a.field;
|
|
79
|
+
return (_jsx(Editor, { onBlur: field.onBlur, editorState: field.value, onEditorStateChange: field.onChange, toolbarClassName: styles.toolbar, editorClassName: styles.editor, wrapperClassName: styles.wrapper, editorStyle: { lineHeight: '85%' }, placeholder: (_b = step.description) !== null && _b !== void 0 ? _b : '', toolbar: {
|
|
80
|
+
options: ['inline', 'list', 'history'],
|
|
81
|
+
inline: {
|
|
82
|
+
options: [
|
|
83
|
+
'bold',
|
|
84
|
+
'italic',
|
|
85
|
+
'underline',
|
|
86
|
+
'strikethrough',
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
list: {
|
|
90
|
+
options: ['unordered'],
|
|
91
|
+
},
|
|
92
|
+
} }, void 0));
|
|
93
|
+
} }, void 0)] }), void 0) }), void 0), _jsx("div", __assign({ className: styles.errorMsg, style: {
|
|
94
|
+
color: formStyle.errorColor,
|
|
95
|
+
} }, { children: !!errors[step.id] && 'Este campo es obligatorio' }), void 0)] }), void 0));
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
return (_jsx("div", __assign({ className: styles.container, style: {
|
|
99
|
+
paddingBottom: step.description || !!errors[step.id] ? '0px' : '23px',
|
|
100
|
+
} }, { children: _jsx(Controller, { name: step.id, control: control, defaultValue: "", rules: {
|
|
101
|
+
required: step.required
|
|
102
|
+
? 'Este campo es obligatorio'
|
|
103
|
+
: undefined,
|
|
104
|
+
}, shouldUnregister: true, render: function (_a) {
|
|
105
|
+
var field = _a.field;
|
|
106
|
+
return (_jsx(RoundedTextField, __assign({}, field, { label: step.label, required: step.required, cantEdit: postview, fontWeight: 400, multiline: true, minRows: 4, maxRows: 6, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, textColor: formStyle.textColor, errorColor: formStyle.errorColor, backgroundColor: formStyle.backgroundColor, innerBackgroundColor: formStyle.stepBackgroundColor, helperText: errors[step.id]
|
|
107
|
+
? errors[step.id].message
|
|
108
|
+
: step.description, error: !!errors[step.id] }), void 0));
|
|
109
|
+
} }, void 0) }), void 0));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
export default TextAreaStep;
|
package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.module.css
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
.container,
|
|
2
|
+
.textEditorContainer {
|
|
3
|
+
width: fit-content;
|
|
4
|
+
max-width: 100%;
|
|
5
|
+
display: flex;
|
|
6
|
+
padding: 10px;
|
|
7
|
+
padding-bottom: 0px;
|
|
8
|
+
padding-top: 5px;
|
|
9
|
+
width: calc(100% - 20px);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.textEditorContainer {
|
|
13
|
+
max-width: '100%';
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.textContainer {
|
|
19
|
+
height: 100%;
|
|
20
|
+
border-radius: 15px;
|
|
21
|
+
height: 265px;
|
|
22
|
+
width: 100%;
|
|
23
|
+
position: relative;
|
|
24
|
+
margin-bottom: 1px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.editor {
|
|
28
|
+
margin: -5px 10px 0 10px;
|
|
29
|
+
height: calc(100% - 46px) !important;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.wrapper {
|
|
33
|
+
height: 100%;
|
|
34
|
+
border-radius: 15px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.disabledCurtain {
|
|
38
|
+
position: absolute;
|
|
39
|
+
bottom: 0;
|
|
40
|
+
top: 0;
|
|
41
|
+
left: 0;
|
|
42
|
+
right: 0;
|
|
43
|
+
z-index: 2;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.errorMsg {
|
|
47
|
+
margin-top: 4px;
|
|
48
|
+
margin-bottom: 5px;
|
|
49
|
+
margin-left: 14px;
|
|
50
|
+
font-size: 0.75rem;
|
|
51
|
+
height: 0.75rem;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.textEditorLabel {
|
|
55
|
+
margin-left: 5px;
|
|
56
|
+
margin-bottom: 2px;
|
|
57
|
+
font-size: 1rem;
|
|
58
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { TextArea } from '../../../@Types/FormStep';
|
|
3
|
-
import { StepProps } from '../Step';
|
|
4
|
-
export interface TextAreaStepProps extends StepProps {
|
|
5
|
-
/** The TextAreaStep to display */
|
|
6
|
-
step: TextArea;
|
|
7
|
-
}
|
|
8
|
-
declare function TextAreaStep(props: TextAreaStepProps): JSX.Element;
|
|
9
|
-
export default TextAreaStep;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TextArea } from '../../../@Types/FormStep';
|
|
3
|
+
import { StepProps } from '../Step';
|
|
4
|
+
export interface TextAreaStepProps extends StepProps {
|
|
5
|
+
/** The TextAreaStep to display */
|
|
6
|
+
step: TextArea;
|
|
7
|
+
}
|
|
8
|
+
declare function TextAreaStep(props: TextAreaStepProps): JSX.Element;
|
|
9
|
+
export default TextAreaStep;
|