@arquimedes.co/eureka-forms 1.9.73-test → 1.9.75-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.
- package/dist/@Types/FormStep.d.ts +4 -1
- package/dist/App.d.ts +2 -0
- package/dist/FormComponents/Step/MapperStep/MapperStep.d.ts +1 -0
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/MapperElement.d.ts +8 -3
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/MapperElement.js +4 -15
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/PillElementContainer/PillElementContainer.d.ts +2 -5
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/PillElementContainer/PillElementContainer.js +9 -6
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/MaterialMapperStep.d.ts +5 -6
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/MaterialMapperStep.js +21 -5
- package/dist/constants/FormStepTypes.d.ts +2 -1
- package/dist/constants/FormStepTypes.js +1 -0
- package/package.json +1 -1
|
@@ -121,7 +121,10 @@ interface HideFormEntityValuePickerOption {
|
|
|
121
121
|
}
|
|
122
122
|
export interface Mapper extends GSteps.GBaseStep {
|
|
123
123
|
type: Types.MAPPER;
|
|
124
|
-
style:
|
|
124
|
+
style: {
|
|
125
|
+
type: MapperStyleTypes;
|
|
126
|
+
size?: number;
|
|
127
|
+
};
|
|
125
128
|
label: string;
|
|
126
129
|
description: string | null;
|
|
127
130
|
addBtnLabel: string;
|
package/dist/App.d.ts
CHANGED
|
@@ -40,6 +40,8 @@ export interface CustomStep {
|
|
|
40
40
|
componentProps?: Record<string, any>;
|
|
41
41
|
component: ReactNode;
|
|
42
42
|
calcValue?: (step: any, value: any) => any;
|
|
43
|
+
/** Function to change custom steps nested step ids to the generated ones. */
|
|
44
|
+
calcRecursiveData?: (step: any, ids: Record<string, string>) => void;
|
|
43
45
|
calcDependencyValue?: (step: any, value: any) => any;
|
|
44
46
|
}
|
|
45
47
|
declare function App({ apiKey, domain, preview, partial, formData, postview, editable, isWidget, internal, valuesData, customSend, customSteps, classifiers, handleConfirmed, ...others }: AppProps): JSX.Element;
|
|
@@ -4,6 +4,7 @@ import { StepProps } from '../Step';
|
|
|
4
4
|
export interface MapperStepProps extends StepProps {
|
|
5
5
|
/** The MapperStep to display */
|
|
6
6
|
step: Mapper;
|
|
7
|
+
customAdd?: JSX.Element;
|
|
7
8
|
}
|
|
8
9
|
declare function MapperStep({ step, formStyle, ...others }: MapperStepProps): JSX.Element;
|
|
9
10
|
export default MapperStep;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MapperStepProps } from '../../MapperStep';
|
|
3
3
|
import { MapperElement } from '../MaterialMapperStep';
|
|
4
|
-
|
|
4
|
+
interface CustomMapperElementModifiers<Type> {
|
|
5
|
+
calcName?: (element: MapperElement<Type>) => string;
|
|
6
|
+
}
|
|
7
|
+
export interface MapperElementComponentProps<Type> {
|
|
5
8
|
num: number;
|
|
6
|
-
|
|
9
|
+
customElementModifiers?: CustomMapperElementModifiers<Type>;
|
|
10
|
+
element: MapperElement<Type>;
|
|
7
11
|
handleDelete: Function;
|
|
8
|
-
}
|
|
12
|
+
}
|
|
13
|
+
declare function MapperElementComponent<Type = any>(props: MapperStepProps & MapperElementComponentProps<Type>): JSX.Element;
|
|
9
14
|
export default MapperElementComponent;
|
|
@@ -9,30 +9,19 @@ 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 { createElement as _createElement } from "react";
|
|
24
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
14
|
import StepComponent from '../../../Step';
|
|
26
15
|
import PillElementContainer from './PillElementContainer/PillElementContainer';
|
|
27
|
-
function MapperElementComponent(
|
|
28
|
-
var
|
|
16
|
+
function MapperElementComponent(props) {
|
|
17
|
+
var level = props.level, form = props.form, step = props.step, element = props.element, editable = props.editable;
|
|
29
18
|
if (element.deleted) {
|
|
30
19
|
return _jsx("div", {});
|
|
31
20
|
}
|
|
32
|
-
return (_jsx(PillElementContainer, __assign({
|
|
21
|
+
return (_jsx(PillElementContainer, __assign({}, props, { step: step }, { children: step.rootSteps.map(function (idSubStep) {
|
|
33
22
|
var _a;
|
|
34
23
|
var subStep = form.steps[element.ids[idSubStep]];
|
|
35
|
-
return (_createElement(StepComponent, __assign({},
|
|
24
|
+
return (_createElement(StepComponent, __assign({}, props, { globalEditable: editable ? (_a = step.editable) !== null && _a !== void 0 ? _a : true : false, step: subStep, key: idSubStep, level: level + 1 })));
|
|
36
25
|
}) })));
|
|
37
26
|
}
|
|
38
27
|
export default MapperElementComponent;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MapperStepProps } from '../../../MapperStep';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
declare function PillElementContainer({ step, size, num, children, editable, postview, formStyle, handleDelete, widthStats, }: Pick<MapperStepProps, 'editable' | 'postview' | 'widthStats'> & {
|
|
6
|
-
step: Mapper;
|
|
3
|
+
import { MapperElementComponentProps } from '../MapperElement';
|
|
4
|
+
declare function PillElementContainer<Type = any>({ step, form, num, element, children, editable, postview, formStyle, handleDelete, widthStats, customElementModifiers, }: MapperStepProps & MapperElementComponentProps<Type> & {
|
|
7
5
|
num: number;
|
|
8
6
|
formStyle: {
|
|
9
7
|
textColor: string;
|
|
10
8
|
};
|
|
11
|
-
size: Form['size'];
|
|
12
9
|
handleDelete?: Function;
|
|
13
10
|
/** children to render */
|
|
14
11
|
children?: any;
|
|
@@ -13,13 +13,16 @@ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import styles from './PillElementContainer.module.css';
|
|
14
14
|
import DeleteRoundedIcon from '@material-ui/icons/DeleteRounded';
|
|
15
15
|
function PillElementContainer(_a) {
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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;
|
|
18
|
+
var size = form.size;
|
|
19
|
+
var calcName = (customElementModifiers !== null && customElementModifiers !== void 0 ? customElementModifiers : {}).calcName;
|
|
20
|
+
return (_jsx("div", __assign({ className: widthStats.isMobile ? styles.mobileContainer : styles.container }, { children: _jsxs("div", __assign({ className: styles.contentContainer, style: {
|
|
20
21
|
width: (size.blockSize + size.spacingSize) *
|
|
21
|
-
(size.blockNum - 1),
|
|
22
|
-
} }, { children: [_jsxs("div", __assign({ className: styles.titleLbl, style: { color: formStyle.textColor } }, { children: [
|
|
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
|
|
24
|
+
? calcName(element)
|
|
25
|
+
: step.unitLabel + ' ' + (num + 1), ":"] })), step.deletable !== false && (_jsx("div", __assign({ className: !editable || postview
|
|
23
26
|
? styles.disabledDeleteBtn
|
|
24
27
|
: styles.deleteBtn, style: { color: formStyle.textColor }, onClick: function () {
|
|
25
28
|
if (editable && !postview) {
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MapperStepProps } from '../MapperStep';
|
|
3
|
-
export interface MapperElement {
|
|
3
|
+
export interface MapperElement<Type> {
|
|
4
4
|
ids: Record<string, string>;
|
|
5
5
|
id: string;
|
|
6
6
|
deleted?: boolean;
|
|
7
|
-
value?:
|
|
7
|
+
value?: Type;
|
|
8
8
|
}
|
|
9
|
-
export declare function ElementsComponent({ step, form, inputRef, editable, postview, elements, formStyle, customAdd, dependencyStore, setDependencyStore, ...others }: MapperStepProps & {
|
|
10
|
-
onChange: (elements: MapperElement[]) => void;
|
|
11
|
-
elements: MapperElement[];
|
|
9
|
+
export declare function ElementsComponent<Type = any>({ step, form, inputRef, editable, postview, elements, formStyle, customAdd, dependencyStore, setDependencyStore, ...others }: MapperStepProps & {
|
|
10
|
+
onChange: (elements: MapperElement<Type>[]) => void;
|
|
11
|
+
elements: MapperElement<Type>[];
|
|
12
12
|
inputRef: any;
|
|
13
|
-
customAdd?: JSX.Element;
|
|
14
13
|
}): JSX.Element;
|
|
15
14
|
declare function MapperStep(props: MapperStepProps): JSX.Element;
|
|
16
15
|
export default MapperStep;
|
|
@@ -33,7 +33,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
33
33
|
import { useState, useEffect, cloneElement } from 'react';
|
|
34
34
|
import styles from './MaterialMapperStep.module.css';
|
|
35
35
|
import { Controller } from 'react-hook-form';
|
|
36
|
-
import StepTypes, { ClassifierOptionTypes, MapperStyleTypes, OptionTypes, } from '../../../../constants/FormStepTypes';
|
|
36
|
+
import StepTypes, { ClassifierOptionTypes, EntityValueOptionTypes, MapperStyleTypes, OptionTypes, } from '../../../../constants/FormStepTypes';
|
|
37
37
|
import RoundedButton from '../../../../shared/RoundedButton/RoundedButton';
|
|
38
38
|
import { nanoid } from 'nanoid';
|
|
39
39
|
import { calcStepDependencyValue } from '../../../Form/ColumnForm/ColumnForm';
|
|
@@ -71,7 +71,7 @@ export function ElementsComponent(_a) {
|
|
|
71
71
|
elemSteps[newIdStep] = baseStep;
|
|
72
72
|
newSteps[newIdStep] = baseStep;
|
|
73
73
|
}
|
|
74
|
-
calcRecursiveData(element, elemSteps, deps, others.originalValues);
|
|
74
|
+
calcRecursiveData(element, elemSteps, deps, others.customSteps, others.originalValues);
|
|
75
75
|
}
|
|
76
76
|
setDependencyStore(deps);
|
|
77
77
|
setLocalSteps(__assign(__assign({}, localSteps), newSteps));
|
|
@@ -102,13 +102,14 @@ export function ElementsComponent(_a) {
|
|
|
102
102
|
newSteps[newIdStep] = baseStep;
|
|
103
103
|
}
|
|
104
104
|
var deps = __assign({}, dependencyStore);
|
|
105
|
-
calcRecursiveData(newElement, newSteps, deps);
|
|
105
|
+
calcRecursiveData(newElement, newSteps, others.customSteps, deps);
|
|
106
106
|
onChange(__spreadArray(__spreadArray([], elements, true), [newElement], false));
|
|
107
107
|
setLocalSteps(__assign(__assign({}, localSteps), newSteps));
|
|
108
108
|
setDependencyStore(deps);
|
|
109
109
|
};
|
|
110
110
|
var calcStyles = function () {
|
|
111
|
-
|
|
111
|
+
var _a;
|
|
112
|
+
switch ((_a = step.style) === null || _a === void 0 ? void 0 : _a.type) {
|
|
112
113
|
case MapperStyleTypes.LIST:
|
|
113
114
|
return { container: styles.listContainer };
|
|
114
115
|
case MapperStyleTypes.PILL:
|
|
@@ -150,7 +151,7 @@ function MapperStep(props) {
|
|
|
150
151
|
} }));
|
|
151
152
|
}
|
|
152
153
|
export default MapperStep;
|
|
153
|
-
function calcRecursiveData(element, newSteps, deps, originalValues) {
|
|
154
|
+
function calcRecursiveData(element, newSteps, deps, customSteps, originalValues) {
|
|
154
155
|
if (originalValues === void 0) { originalValues = {}; }
|
|
155
156
|
for (var _i = 0, _a = Object.keys(newSteps); _i < _a.length; _i++) {
|
|
156
157
|
var idStep = _a[_i];
|
|
@@ -165,6 +166,10 @@ function calcRecursiveData(element, newSteps, deps, originalValues) {
|
|
|
165
166
|
}
|
|
166
167
|
}
|
|
167
168
|
}
|
|
169
|
+
var custom = customSteps[step === null || step === void 0 ? void 0 : step.type];
|
|
170
|
+
if (custom.calcRecursiveData) {
|
|
171
|
+
custom.calcRecursiveData(step, element.ids);
|
|
172
|
+
}
|
|
168
173
|
switch (step.type) {
|
|
169
174
|
case StepTypes.SELECTOR: {
|
|
170
175
|
for (var _b = 0, _c = step.options; _b < _c.length; _b++) {
|
|
@@ -233,6 +238,17 @@ function calcRecursiveData(element, newSteps, deps, originalValues) {
|
|
|
233
238
|
}
|
|
234
239
|
}
|
|
235
240
|
}
|
|
241
|
+
for (var _k = 0, _l = Object.keys(step.options); _k < _l.length; _k++) {
|
|
242
|
+
var idOption = _l[_k];
|
|
243
|
+
var option = step.options[idOption];
|
|
244
|
+
if (option.type === EntityValueOptionTypes.NESTED) {
|
|
245
|
+
for (var i = 0; i < option.steps.length; i++) {
|
|
246
|
+
var idStep_6 = option.steps[i];
|
|
247
|
+
var newId = element.ids[idStep_6];
|
|
248
|
+
option.steps[i] = newId;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
236
252
|
break;
|
|
237
253
|
case CBRFormStepTypes.CBR_LOCATIVAS:
|
|
238
254
|
var elementStep = step;
|
package/package.json
CHANGED