@arquimedes.co/eureka-forms 1.9.93-test → 1.9.94-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 +28 -12
- package/dist/FormComponents/Step/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +44 -31
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/MaterialMapperStep.js +11 -7
- package/dist/constants/FormStepTypes.d.ts +4 -0
- package/dist/constants/FormStepTypes.js +5 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Types, { ClassifierOptionTypes, OptionTypes, RatingTypes, MapperStyleTypes, EntityValueOptionTypes } from '../constants/FormStepTypes';
|
|
1
|
+
import Types, { ClassifierOptionTypes, OptionTypes, RatingTypes, MapperStyleTypes, EntityValueOptionTypes, EntityValueDataTypes } from '../constants/FormStepTypes';
|
|
2
2
|
import * as GSteps from './GenericFormSteps';
|
|
3
3
|
export type FormStep = Title | Rating | CheckBox | TextArea | TextInput | DatePicker | FileUpload | Separator | FormSelector | ClassifierSelector | Collapsible | EntityValuePicker | Mapper;
|
|
4
4
|
export interface Title extends GSteps.GBaseStep {
|
|
@@ -98,17 +98,8 @@ export interface EntityValuePicker extends GSteps.GSmartSelect {
|
|
|
98
98
|
type: Types.ENTITYVALUEPICKER;
|
|
99
99
|
idEntity: string;
|
|
100
100
|
icon: string | null;
|
|
101
|
-
filters:
|
|
102
|
-
|
|
103
|
-
idStep?: string;
|
|
104
|
-
value?: string;
|
|
105
|
-
required?: boolean;
|
|
106
|
-
}[];
|
|
107
|
-
path: {
|
|
108
|
-
idEntity: string;
|
|
109
|
-
idStep?: string;
|
|
110
|
-
idEntityValue?: string;
|
|
111
|
-
}[];
|
|
101
|
+
filters: EntityValuePickerFilter[];
|
|
102
|
+
path: EntityValuePickerPath[];
|
|
112
103
|
options: Record<string, FormEntityValuePickerOption>;
|
|
113
104
|
maxSize?: number;
|
|
114
105
|
}
|
|
@@ -122,6 +113,31 @@ interface HideFormEntityValuePickerOption {
|
|
|
122
113
|
type: EntityValueOptionTypes.HIDE;
|
|
123
114
|
idEntityValue: String;
|
|
124
115
|
}
|
|
116
|
+
export type EntityValuePickerPath = StepEntityValuePickerPath | ValueEntityValuePickerPath;
|
|
117
|
+
export interface StepEntityValuePickerPath {
|
|
118
|
+
idEntity: string;
|
|
119
|
+
type: EntityValueDataTypes.STEP;
|
|
120
|
+
idStep: string;
|
|
121
|
+
any: boolean;
|
|
122
|
+
}
|
|
123
|
+
export interface ValueEntityValuePickerPath {
|
|
124
|
+
idEntity: string;
|
|
125
|
+
type: EntityValueDataTypes.VALUE;
|
|
126
|
+
idEntityValue: string | null;
|
|
127
|
+
}
|
|
128
|
+
export type EntityValuePickerFilter = StepEntityValuePickerFilter | ValueEntityValuePickerFilter;
|
|
129
|
+
export interface StepEntityValuePickerFilter {
|
|
130
|
+
idProperty: string;
|
|
131
|
+
type: EntityValueDataTypes.STEP;
|
|
132
|
+
idStep: string;
|
|
133
|
+
any: boolean;
|
|
134
|
+
required: boolean;
|
|
135
|
+
}
|
|
136
|
+
export interface ValueEntityValuePickerFilter {
|
|
137
|
+
idProperty: string;
|
|
138
|
+
type: EntityValueDataTypes.VALUE;
|
|
139
|
+
value: any;
|
|
140
|
+
}
|
|
125
141
|
export interface Mapper extends GSteps.GBaseStep {
|
|
126
142
|
type: Types.MAPPER;
|
|
127
143
|
style: {
|
|
@@ -59,7 +59,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
59
59
|
import { createElement as _createElement } from "react";
|
|
60
60
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
61
61
|
import React, { useEffect, useState } from 'react';
|
|
62
|
-
import FormStepTypes, { EntityValueOptionTypes, } from '../../../../constants/FormStepTypes';
|
|
62
|
+
import FormStepTypes, { EntityValueDataTypes, EntityValueOptionTypes, } from '../../../../constants/FormStepTypes';
|
|
63
63
|
import styles from './MaterialEntityValuePickerStep.module.css';
|
|
64
64
|
import StepComponent from '../../Step';
|
|
65
65
|
import { Controller } from 'react-hook-form';
|
|
@@ -85,50 +85,63 @@ function EntityValuePicker(_a) {
|
|
|
85
85
|
var getEntityValueOptions = function (_a, _step, dependencyStore, domain) {
|
|
86
86
|
var idOrganization = _a.idOrganization;
|
|
87
87
|
return __awaiter(_this, void 0, void 0, function () {
|
|
88
|
-
var params, _i, _b, filter,
|
|
89
|
-
var
|
|
90
|
-
return __generator(this, function (
|
|
91
|
-
switch (
|
|
88
|
+
var params, _i, _b, filter, currentValue, urlPath, _c, _d, path, idEntityValue, currentValue, url, response;
|
|
89
|
+
var _e, _f, _g;
|
|
90
|
+
return __generator(this, function (_h) {
|
|
91
|
+
switch (_h.label) {
|
|
92
92
|
case 0:
|
|
93
93
|
params = new URLSearchParams({});
|
|
94
94
|
for (_i = 0, _b = step.filters; _i < _b.length; _i++) {
|
|
95
95
|
filter = _b[_i];
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
96
|
+
switch (filter.type) {
|
|
97
|
+
case EntityValueDataTypes.STEP:
|
|
98
|
+
currentValue = dependencyStore[filter.idStep];
|
|
99
|
+
if (currentValue) {
|
|
100
|
+
if (typeof currentValue === 'string')
|
|
101
|
+
params.set(filter.idProperty, currentValue);
|
|
102
|
+
else
|
|
103
|
+
params.set(filter.idProperty, (_e = currentValue._id) !== null && _e !== void 0 ? _e : currentValue.id);
|
|
104
|
+
}
|
|
105
|
+
else if (filter.required) {
|
|
106
|
+
return [2 /*return*/, null];
|
|
107
|
+
}
|
|
108
|
+
break;
|
|
109
|
+
case EntityValueDataTypes.VALUE:
|
|
110
|
+
default:
|
|
111
|
+
params.set(filter.idProperty, filter.value);
|
|
112
|
+
break;
|
|
109
113
|
}
|
|
110
|
-
if (value_1)
|
|
111
|
-
params.set(filter.idProperty, value_1);
|
|
112
114
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
urlPath = '';
|
|
116
|
+
for (_c = 0, _d = step.path; _c < _d.length; _c++) {
|
|
117
|
+
path = _d[_c];
|
|
118
|
+
idEntityValue = 'null';
|
|
119
|
+
switch (path.type) {
|
|
120
|
+
case EntityValueDataTypes.STEP:
|
|
121
|
+
currentValue = dependencyStore[path.idStep];
|
|
122
|
+
if (!currentValue)
|
|
123
|
+
return [2 /*return*/, null];
|
|
119
124
|
if (typeof currentValue === 'string')
|
|
120
125
|
idEntityValue = currentValue;
|
|
121
126
|
else
|
|
122
|
-
idEntityValue = (
|
|
123
|
-
|
|
127
|
+
idEntityValue = (_f = currentValue._id) !== null && _f !== void 0 ? _f : currentValue.id;
|
|
128
|
+
break;
|
|
129
|
+
case EntityValueDataTypes.VALUE:
|
|
130
|
+
default:
|
|
131
|
+
idEntityValue = (_g = path.idEntityValue) !== null && _g !== void 0 ? _g : 'null';
|
|
132
|
+
break;
|
|
124
133
|
}
|
|
125
|
-
|
|
126
|
-
|
|
134
|
+
urlPath +=
|
|
135
|
+
'/' +
|
|
136
|
+
path.idEntity +
|
|
137
|
+
(idEntityValue ? '/' + idEntityValue : '');
|
|
138
|
+
}
|
|
139
|
+
url = "".concat(domain !== null && domain !== void 0 ? domain : idOrganization, "/entities/").concat(step.idEntity).concat(urlPath, "?").concat(params.toString());
|
|
127
140
|
return [4 /*yield*/, (domain
|
|
128
141
|
? widgetInstance.get(url)
|
|
129
142
|
: axiosInstance.get(url))];
|
|
130
143
|
case 1:
|
|
131
|
-
response =
|
|
144
|
+
response = _h.sent();
|
|
132
145
|
return [2 /*return*/, response.data.filter(function (option) { var _a; return ((_a = step.options[option._id]) === null || _a === void 0 ? void 0 : _a.type) !== EntityValueOptionTypes.HIDE; })];
|
|
133
146
|
}
|
|
134
147
|
});
|
|
@@ -33,7 +33,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
33
33
|
import React, { 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, EntityValueOptionTypes, MapperStyleTypes, OptionTypes, } from '../../../../constants/FormStepTypes';
|
|
36
|
+
import StepTypes, { ClassifierOptionTypes, EntityValueDataTypes, 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';
|
|
@@ -249,12 +249,16 @@ function calcRecursiveData(element, newSteps, deps, customSteps, originalValues)
|
|
|
249
249
|
case StepTypes.ENTITYVALUEPICKER:
|
|
250
250
|
for (var _j = 0, _k = step.filters; _j < _k.length; _j++) {
|
|
251
251
|
var filter = _k[_j];
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
252
|
+
switch (filter.type) {
|
|
253
|
+
case EntityValueDataTypes.STEP:
|
|
254
|
+
var newId = element.ids[filter.idStep];
|
|
255
|
+
if (newId) {
|
|
256
|
+
filter.idStep = newId;
|
|
257
|
+
deps[newId] = calcStepDependencyValue(newSteps[newId], originalValues);
|
|
258
|
+
}
|
|
259
|
+
break;
|
|
260
|
+
default:
|
|
261
|
+
break;
|
|
258
262
|
}
|
|
259
263
|
}
|
|
260
264
|
for (var _l = 0, _m = Object.keys((_a = step.options) !== null && _a !== void 0 ? _a : {}); _l < _m.length; _l++) {
|
|
@@ -52,3 +52,8 @@ export var MapperStyleTypes;
|
|
|
52
52
|
MapperStyleTypes["LIST"] = "LIST";
|
|
53
53
|
MapperStyleTypes["INLINE"] = "INLINE";
|
|
54
54
|
})(MapperStyleTypes || (MapperStyleTypes = {}));
|
|
55
|
+
export var EntityValueDataTypes;
|
|
56
|
+
(function (EntityValueDataTypes) {
|
|
57
|
+
EntityValueDataTypes["STEP"] = "STEP";
|
|
58
|
+
EntityValueDataTypes["VALUE"] = "VALUE";
|
|
59
|
+
})(EntityValueDataTypes || (EntityValueDataTypes = {}));
|
package/package.json
CHANGED