@formio/js 5.0.0-dev.5643.17b8168 → 5.0.0-dev.5646.8734cf4
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/Changelog.md +1 -0
- package/dist/formio.form.js +23 -24
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +23 -24
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.js +1 -1
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +3 -3
- package/dist/formio.utils.min.js +1 -1
- package/lib/cjs/components/datagrid/fixtures/comp9.d.ts +81 -0
- package/lib/cjs/components/datagrid/fixtures/comp9.js +87 -0
- package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -2
- package/lib/cjs/components/datagrid/fixtures/index.js +3 -3
- package/lib/cjs/components/file/File.js +1 -2
- package/lib/cjs/components/radio/Radio.js +2 -3
- package/lib/cjs/utils/conditionOperators/IsEmptyValue.js +4 -3
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +3 -3
- package/lib/cjs/utils/utils.d.ts +0 -10
- package/lib/cjs/utils/utils.js +59 -7
- package/lib/mjs/components/datagrid/fixtures/comp9.d.ts +81 -0
- package/lib/mjs/components/datagrid/fixtures/comp9.js +85 -0
- package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -2
- package/lib/mjs/components/datagrid/fixtures/index.js +2 -2
- package/lib/mjs/components/file/File.js +1 -2
- package/lib/mjs/components/radio/Radio.js +2 -3
- package/lib/mjs/utils/conditionOperators/IsEmptyValue.js +3 -3
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +1 -1
- package/lib/mjs/utils/utils.d.ts +0 -10
- package/lib/mjs/utils/utils.js +58 -7
- package/package.json +2 -2
- package/lib/cjs/components/datagrid/fixtures/comp-with-checkboxes.d.ts +0 -29
- package/lib/cjs/components/datagrid/fixtures/comp-with-checkboxes.js +0 -36
- package/lib/mjs/components/datagrid/fixtures/comp-with-checkboxes.d.ts +0 -29
- package/lib/mjs/components/datagrid/fixtures/comp-with-checkboxes.js +0 -34
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let title: string;
|
|
3
|
+
let name: string;
|
|
4
|
+
let path: string;
|
|
5
|
+
let type: string;
|
|
6
|
+
let display: string;
|
|
7
|
+
let components: ({
|
|
8
|
+
label: string;
|
|
9
|
+
reorder: boolean;
|
|
10
|
+
addAnotherPosition: string;
|
|
11
|
+
layoutFixed: boolean;
|
|
12
|
+
enableRowGroups: boolean;
|
|
13
|
+
initEmpty: boolean;
|
|
14
|
+
tableView: boolean;
|
|
15
|
+
defaultValue: {}[];
|
|
16
|
+
validate: {
|
|
17
|
+
required: boolean;
|
|
18
|
+
};
|
|
19
|
+
key: string;
|
|
20
|
+
type: string;
|
|
21
|
+
input: boolean;
|
|
22
|
+
components: {
|
|
23
|
+
label: string;
|
|
24
|
+
columns: ({
|
|
25
|
+
components: {
|
|
26
|
+
label: string;
|
|
27
|
+
applyMaskOn: string;
|
|
28
|
+
tableView: boolean;
|
|
29
|
+
key: string;
|
|
30
|
+
type: string;
|
|
31
|
+
input: boolean;
|
|
32
|
+
}[];
|
|
33
|
+
width: number;
|
|
34
|
+
offset: number;
|
|
35
|
+
push: number;
|
|
36
|
+
pull: number;
|
|
37
|
+
size: string;
|
|
38
|
+
currentWidth: number;
|
|
39
|
+
} | {
|
|
40
|
+
components: {
|
|
41
|
+
label: string;
|
|
42
|
+
tableView: boolean;
|
|
43
|
+
key: string;
|
|
44
|
+
type: string;
|
|
45
|
+
input: boolean;
|
|
46
|
+
}[];
|
|
47
|
+
width: number;
|
|
48
|
+
offset: number;
|
|
49
|
+
push: number;
|
|
50
|
+
pull: number;
|
|
51
|
+
size: string;
|
|
52
|
+
currentWidth: number;
|
|
53
|
+
})[];
|
|
54
|
+
key: string;
|
|
55
|
+
type: string;
|
|
56
|
+
input: boolean;
|
|
57
|
+
tableView: boolean;
|
|
58
|
+
}[];
|
|
59
|
+
disableOnInvalid?: undefined;
|
|
60
|
+
} | {
|
|
61
|
+
type: string;
|
|
62
|
+
label: string;
|
|
63
|
+
key: string;
|
|
64
|
+
disableOnInvalid: boolean;
|
|
65
|
+
input: boolean;
|
|
66
|
+
tableView: boolean;
|
|
67
|
+
reorder?: undefined;
|
|
68
|
+
addAnotherPosition?: undefined;
|
|
69
|
+
layoutFixed?: undefined;
|
|
70
|
+
enableRowGroups?: undefined;
|
|
71
|
+
initEmpty?: undefined;
|
|
72
|
+
defaultValue?: undefined;
|
|
73
|
+
validate?: undefined;
|
|
74
|
+
components?: undefined;
|
|
75
|
+
})[];
|
|
76
|
+
let pdfComponents: never[];
|
|
77
|
+
namespace settings {
|
|
78
|
+
let logs: string;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
export default _default;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
title: 'randomName',
|
|
5
|
+
name: 'randomName',
|
|
6
|
+
path: 'randomName',
|
|
7
|
+
type: 'form',
|
|
8
|
+
display: 'form',
|
|
9
|
+
components: [
|
|
10
|
+
{
|
|
11
|
+
label: 'Data Grid',
|
|
12
|
+
reorder: false,
|
|
13
|
+
addAnotherPosition: 'bottom',
|
|
14
|
+
layoutFixed: false,
|
|
15
|
+
enableRowGroups: false,
|
|
16
|
+
initEmpty: false,
|
|
17
|
+
tableView: false,
|
|
18
|
+
defaultValue: [
|
|
19
|
+
{}
|
|
20
|
+
],
|
|
21
|
+
validate: {
|
|
22
|
+
required: true
|
|
23
|
+
},
|
|
24
|
+
key: 'dataGrid',
|
|
25
|
+
type: 'datagrid',
|
|
26
|
+
input: true,
|
|
27
|
+
components: [
|
|
28
|
+
{
|
|
29
|
+
label: 'Columns',
|
|
30
|
+
columns: [
|
|
31
|
+
{
|
|
32
|
+
components: [
|
|
33
|
+
{
|
|
34
|
+
label: 'Text Field',
|
|
35
|
+
applyMaskOn: 'change',
|
|
36
|
+
tableView: true,
|
|
37
|
+
key: 'textField',
|
|
38
|
+
type: 'textfield',
|
|
39
|
+
input: true
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
width: 6,
|
|
43
|
+
offset: 0,
|
|
44
|
+
push: 0,
|
|
45
|
+
pull: 0,
|
|
46
|
+
size: 'md',
|
|
47
|
+
currentWidth: 6
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
components: [
|
|
51
|
+
{
|
|
52
|
+
label: 'Checkbox',
|
|
53
|
+
tableView: false,
|
|
54
|
+
key: 'checkbox',
|
|
55
|
+
type: 'checkbox',
|
|
56
|
+
input: true
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
width: 6,
|
|
60
|
+
offset: 0,
|
|
61
|
+
push: 0,
|
|
62
|
+
pull: 0,
|
|
63
|
+
size: 'md',
|
|
64
|
+
currentWidth: 6
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
key: 'columns',
|
|
68
|
+
type: 'columns',
|
|
69
|
+
input: false,
|
|
70
|
+
tableView: false
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
type: 'button',
|
|
76
|
+
label: 'Submit',
|
|
77
|
+
key: 'submit',
|
|
78
|
+
disableOnInvalid: true,
|
|
79
|
+
input: true,
|
|
80
|
+
tableView: false
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
pdfComponents: [],
|
|
84
|
+
settings: {
|
|
85
|
+
logs: 'true'
|
|
86
|
+
}
|
|
87
|
+
};
|
|
@@ -6,6 +6,7 @@ import comp5 from './comp5';
|
|
|
6
6
|
import comp6 from './comp6';
|
|
7
7
|
import comp7 from './comp7';
|
|
8
8
|
import comp8 from './comp8';
|
|
9
|
+
import comp9 from './comp9';
|
|
9
10
|
import withCollapsibleRowGroups from './comp-with-collapsible-groups';
|
|
10
11
|
import withConditionalFieldsAndValidations from './comp-with-conditional-components-and-validations';
|
|
11
12
|
import withDefValue from './comp-with-def-value';
|
|
@@ -14,5 +15,4 @@ import withRowGroupsAndDefValue from './comp-row-groups-with-def-value';
|
|
|
14
15
|
import modalWithRequiredFields from './comp-modal-with-required-fields';
|
|
15
16
|
import withAllowCalculateOverride from './comp-with-allow-calculate-override';
|
|
16
17
|
import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
|
|
17
|
-
|
|
18
|
-
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes };
|
|
18
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride };
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.twoWithAllowCalculatedOverride = exports.withAllowCalculateOverride = exports.modalWithRequiredFields = exports.withRowGroupsAndDefValue = exports.withLogic = exports.withDefValue = exports.withConditionalFieldsAndValidations = exports.withCollapsibleRowGroups = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
|
7
7
|
const comp1_1 = __importDefault(require("./comp1"));
|
|
8
8
|
exports.comp1 = comp1_1.default;
|
|
9
9
|
const comp2_1 = __importDefault(require("./comp2"));
|
|
@@ -20,6 +20,8 @@ const comp7_1 = __importDefault(require("./comp7"));
|
|
|
20
20
|
exports.comp7 = comp7_1.default;
|
|
21
21
|
const comp8_1 = __importDefault(require("./comp8"));
|
|
22
22
|
exports.comp8 = comp8_1.default;
|
|
23
|
+
const comp9_1 = __importDefault(require("./comp9"));
|
|
24
|
+
exports.comp9 = comp9_1.default;
|
|
23
25
|
const comp_with_def_value_1 = __importDefault(require("./comp-with-def-value"));
|
|
24
26
|
exports.withDefValue = comp_with_def_value_1.default;
|
|
25
27
|
const comp_row_groups_with_def_value_1 = __importDefault(require("./comp-row-groups-with-def-value"));
|
|
@@ -36,5 +38,3 @@ const comp_with_allow_calculate_override_1 = __importDefault(require("./comp-wit
|
|
|
36
38
|
exports.withAllowCalculateOverride = comp_with_allow_calculate_override_1.default;
|
|
37
39
|
const two_comp_with_allow_calculate_override_1 = __importDefault(require("./two-comp-with-allow-calculate-override"));
|
|
38
40
|
exports.twoWithAllowCalculatedOverride = two_comp_with_allow_calculate_override_1.default;
|
|
39
|
-
const comp_with_checkboxes_1 = __importDefault(require("./comp-with-checkboxes"));
|
|
40
|
-
exports.withCheckboxes = comp_with_checkboxes_1.default;
|
|
@@ -652,8 +652,7 @@ class FileComponent extends Field_1.default {
|
|
|
652
652
|
// Check if file with the same name is being uploaded
|
|
653
653
|
const fileWithSameNameUploading = this.filesToSync.filesToUpload
|
|
654
654
|
.some(fileToSync => { var _a; return ((_a = fileToSync.file) === null || _a === void 0 ? void 0 : _a.name) === file.name; });
|
|
655
|
-
const fileWithSameNameUploaded = this.dataValue
|
|
656
|
-
.some(fileStatus => fileStatus.originalName === file.name);
|
|
655
|
+
const fileWithSameNameUploaded = lodash_1.default.some(this.dataValue, fileStatus => fileStatus.originalName === file.name);
|
|
657
656
|
return fileWithSameNameUploaded || fileWithSameNameUploading
|
|
658
657
|
? {
|
|
659
658
|
status: 'error',
|
|
@@ -200,8 +200,7 @@ class RadioComponent extends ListComponent_1.default {
|
|
|
200
200
|
if (this.viewOnly || !this.refs.input || !this.refs.input.length) {
|
|
201
201
|
return this.dataValue;
|
|
202
202
|
}
|
|
203
|
-
|
|
204
|
-
let value = this.component.inputType === 'checkbox' ? '' : this.dataValue;
|
|
203
|
+
let value = this.dataValue;
|
|
205
204
|
this.refs.input.forEach((input, index) => {
|
|
206
205
|
if (input.checked) {
|
|
207
206
|
value = (this.isSelectURL && lodash_1.default.isObject(this.loadedOptions[index].value)) ?
|
|
@@ -323,7 +322,7 @@ class RadioComponent extends ListComponent_1.default {
|
|
|
323
322
|
const value = this.dataValue;
|
|
324
323
|
this.refs.wrapper.forEach((wrapper, index) => {
|
|
325
324
|
const input = this.refs.input[index];
|
|
326
|
-
const checked = (input.type === 'checkbox') ? value[input.value]
|
|
325
|
+
const checked = (input.type === 'checkbox') ? value[input.value] : (input.value.toString() === value.toString());
|
|
327
326
|
if (checked) {
|
|
328
327
|
//add class to container when selected
|
|
329
328
|
this.addClass(wrapper, this.optionSelectedClass);
|
|
@@ -16,10 +16,11 @@ class IsEmptyValue extends ConditionOperator_1.default {
|
|
|
16
16
|
return false;
|
|
17
17
|
}
|
|
18
18
|
execute({ value, instance, conditionComponentPath }) {
|
|
19
|
-
|
|
19
|
+
var _a;
|
|
20
|
+
const isEmptyValue = lodash_1.default.isEmpty(lodash_1.default.isNumber(value) ? String(value) : value);
|
|
20
21
|
if (instance && instance.root) {
|
|
21
|
-
const conditionTriggerComponent = instance.root.getComponent(conditionComponentPath);
|
|
22
|
-
return conditionTriggerComponent ? conditionTriggerComponent.isEmpty() : isEmptyValue;
|
|
22
|
+
const conditionTriggerComponent = ((_a = instance.root) === null || _a === void 0 ? void 0 : _a.getComponent) && instance.root.getComponent(conditionComponentPath);
|
|
23
|
+
return (conditionTriggerComponent === null || conditionTriggerComponent === void 0 ? void 0 : conditionTriggerComponent.isEmpty) ? conditionTriggerComponent.isEmpty() : isEmptyValue;
|
|
23
24
|
}
|
|
24
25
|
return isEmptyValue;
|
|
25
26
|
}
|
|
@@ -14,7 +14,7 @@ class IsEqualTo extends ConditionOperator_1.default {
|
|
|
14
14
|
return 'Is Equal To';
|
|
15
15
|
}
|
|
16
16
|
execute({ value, comparedValue, instance, conditionComponentPath }) {
|
|
17
|
-
var _a;
|
|
17
|
+
var _a, _b;
|
|
18
18
|
if ((value || value === false) && comparedValue && typeof value !== typeof comparedValue && lodash_1.default.isString(comparedValue)) {
|
|
19
19
|
try {
|
|
20
20
|
comparedValue = JSON.parse(comparedValue);
|
|
@@ -23,10 +23,10 @@ class IsEqualTo extends ConditionOperator_1.default {
|
|
|
23
23
|
catch (e) { }
|
|
24
24
|
}
|
|
25
25
|
if (instance && instance.root) {
|
|
26
|
-
const conditionTriggerComponent = instance.root.getComponent(conditionComponentPath);
|
|
26
|
+
const conditionTriggerComponent = ((_a = instance.root) === null || _a === void 0 ? void 0 : _a.getComponent) && instance.root.getComponent(conditionComponentPath);
|
|
27
27
|
if (conditionTriggerComponent
|
|
28
28
|
&& (0, utils_1.isSelectResourceWithObjectValue)(conditionTriggerComponent.component)
|
|
29
|
-
&& ((
|
|
29
|
+
&& ((_b = conditionTriggerComponent.component) === null || _b === void 0 ? void 0 : _b.template)) {
|
|
30
30
|
if (!value || !lodash_1.default.isPlainObject(value)) {
|
|
31
31
|
return false;
|
|
32
32
|
}
|
package/lib/cjs/utils/utils.d.ts
CHANGED
|
@@ -60,16 +60,6 @@ export function isMongoId(text: any): any[] | {
|
|
|
60
60
|
* The full submission data.
|
|
61
61
|
*/
|
|
62
62
|
export function checkCalculated(component: Object, submission: Object, rowData: any): void;
|
|
63
|
-
/**
|
|
64
|
-
* Check if a simple conditional evaluates to true.
|
|
65
|
-
*
|
|
66
|
-
* @param condition
|
|
67
|
-
* @param condition
|
|
68
|
-
* @param row
|
|
69
|
-
* @param data
|
|
70
|
-
* @param instance
|
|
71
|
-
* @returns {boolean}
|
|
72
|
-
*/
|
|
73
63
|
export function checkSimpleConditional(component: any, condition: any, row: any, data: any, instance: any): boolean;
|
|
74
64
|
export function getComponentActualValue(compPath: any, data: any, row: any): any;
|
|
75
65
|
/**
|
package/lib/cjs/utils/utils.js
CHANGED
|
@@ -246,6 +246,44 @@ exports.checkCalculated = checkCalculated;
|
|
|
246
246
|
* @param instance
|
|
247
247
|
* @returns {boolean}
|
|
248
248
|
*/
|
|
249
|
+
function getConditionalPathsRecursive(conditionPaths, data) {
|
|
250
|
+
let currentGlobalIndex = 0;
|
|
251
|
+
const conditionalPathsArray = [];
|
|
252
|
+
const getConditionalPaths = (data, currentPath = '', localIndex = 0) => {
|
|
253
|
+
currentPath = currentPath.replace(/^\.+|\.+$/g, '');
|
|
254
|
+
const currentLocalIndex = localIndex;
|
|
255
|
+
const currentData = lodash_1.default.get(data, currentPath);
|
|
256
|
+
if (Array.isArray(currentData) && currentData.filter(Boolean).length > 0) {
|
|
257
|
+
if (currentData.some(element => typeof element !== 'object')) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
const hasInnerDataArray = currentData.find(x => Array.isArray(x[conditionPaths[currentLocalIndex]]));
|
|
261
|
+
if (hasInnerDataArray) {
|
|
262
|
+
currentData.forEach((_, indexOutside) => {
|
|
263
|
+
const innerCompDataPath = `${currentPath}[${indexOutside}].${conditionPaths[currentLocalIndex]}`;
|
|
264
|
+
getConditionalPaths(data, innerCompDataPath, currentLocalIndex + 1);
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
currentData.forEach((x, index) => {
|
|
269
|
+
if (!lodash_1.default.isNil(x[conditionPaths[currentLocalIndex]])) {
|
|
270
|
+
const compDataPath = `${currentPath}[${index}].${conditionPaths[currentLocalIndex]}`;
|
|
271
|
+
conditionalPathsArray.push(compDataPath);
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
if (!conditionPaths[currentGlobalIndex]) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
currentGlobalIndex = currentGlobalIndex + 1;
|
|
281
|
+
getConditionalPaths(data, `${currentPath}.${conditionPaths[currentGlobalIndex - 1]}`, currentGlobalIndex);
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
getConditionalPaths(data);
|
|
285
|
+
return conditionalPathsArray;
|
|
286
|
+
}
|
|
249
287
|
function checkSimpleConditional(component, condition, row, data, instance) {
|
|
250
288
|
if (condition.when) {
|
|
251
289
|
const value = getComponentActualValue(condition.when, data, row);
|
|
@@ -267,23 +305,37 @@ function checkSimpleConditional(component, condition, row, data, instance) {
|
|
|
267
305
|
return true;
|
|
268
306
|
}
|
|
269
307
|
const conditionsResult = lodash_1.default.map(conditions, (cond) => {
|
|
308
|
+
var _a, _b;
|
|
270
309
|
const { value: comparedValue, operator, component: conditionComponentPath } = cond;
|
|
271
310
|
if (!conditionComponentPath) {
|
|
272
311
|
return true;
|
|
273
312
|
}
|
|
274
|
-
const
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
313
|
+
const splittedConditionPath = conditionComponentPath.split('.');
|
|
314
|
+
const conditionalPaths = ((_a = instance === null || instance === void 0 ? void 0 : instance.parent) === null || _a === void 0 ? void 0 : _a.type) === 'datagrid' || ((_b = instance === null || instance === void 0 ? void 0 : instance.parent) === null || _b === void 0 ? void 0 : _b.type) === 'editgrid' ? [] : getConditionalPathsRecursive(splittedConditionPath, data);
|
|
315
|
+
if (conditionalPaths.length > 0) {
|
|
316
|
+
return conditionalPaths.map((path) => {
|
|
317
|
+
const value = getComponentActualValue(path, data, row);
|
|
318
|
+
const ConditionOperator = conditionOperators_1.default[operator];
|
|
319
|
+
return ConditionOperator
|
|
320
|
+
? new ConditionOperator().getResult({ value, comparedValue, instance, component, conditionComponentPath })
|
|
321
|
+
: true;
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
const value = getComponentActualValue(conditionComponentPath, data, row);
|
|
326
|
+
const СonditionOperator = conditionOperators_1.default[operator];
|
|
327
|
+
return СonditionOperator
|
|
328
|
+
? new СonditionOperator().getResult({ value, comparedValue, instance, component, conditionComponentPath })
|
|
329
|
+
: true;
|
|
330
|
+
}
|
|
279
331
|
});
|
|
280
332
|
let result = false;
|
|
281
333
|
switch (conjunction) {
|
|
282
334
|
case 'any':
|
|
283
|
-
result = lodash_1.default.some(conditionsResult, res => !!res);
|
|
335
|
+
result = lodash_1.default.some(conditionsResult.flat(), res => !!res);
|
|
284
336
|
break;
|
|
285
337
|
default:
|
|
286
|
-
result = lodash_1.default.every(conditionsResult, res => !!res);
|
|
338
|
+
result = lodash_1.default.every(conditionsResult.flat(), res => !!res);
|
|
287
339
|
}
|
|
288
340
|
return show ? result : !result;
|
|
289
341
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let title: string;
|
|
3
|
+
let name: string;
|
|
4
|
+
let path: string;
|
|
5
|
+
let type: string;
|
|
6
|
+
let display: string;
|
|
7
|
+
let components: ({
|
|
8
|
+
label: string;
|
|
9
|
+
reorder: boolean;
|
|
10
|
+
addAnotherPosition: string;
|
|
11
|
+
layoutFixed: boolean;
|
|
12
|
+
enableRowGroups: boolean;
|
|
13
|
+
initEmpty: boolean;
|
|
14
|
+
tableView: boolean;
|
|
15
|
+
defaultValue: {}[];
|
|
16
|
+
validate: {
|
|
17
|
+
required: boolean;
|
|
18
|
+
};
|
|
19
|
+
key: string;
|
|
20
|
+
type: string;
|
|
21
|
+
input: boolean;
|
|
22
|
+
components: {
|
|
23
|
+
label: string;
|
|
24
|
+
columns: ({
|
|
25
|
+
components: {
|
|
26
|
+
label: string;
|
|
27
|
+
applyMaskOn: string;
|
|
28
|
+
tableView: boolean;
|
|
29
|
+
key: string;
|
|
30
|
+
type: string;
|
|
31
|
+
input: boolean;
|
|
32
|
+
}[];
|
|
33
|
+
width: number;
|
|
34
|
+
offset: number;
|
|
35
|
+
push: number;
|
|
36
|
+
pull: number;
|
|
37
|
+
size: string;
|
|
38
|
+
currentWidth: number;
|
|
39
|
+
} | {
|
|
40
|
+
components: {
|
|
41
|
+
label: string;
|
|
42
|
+
tableView: boolean;
|
|
43
|
+
key: string;
|
|
44
|
+
type: string;
|
|
45
|
+
input: boolean;
|
|
46
|
+
}[];
|
|
47
|
+
width: number;
|
|
48
|
+
offset: number;
|
|
49
|
+
push: number;
|
|
50
|
+
pull: number;
|
|
51
|
+
size: string;
|
|
52
|
+
currentWidth: number;
|
|
53
|
+
})[];
|
|
54
|
+
key: string;
|
|
55
|
+
type: string;
|
|
56
|
+
input: boolean;
|
|
57
|
+
tableView: boolean;
|
|
58
|
+
}[];
|
|
59
|
+
disableOnInvalid?: undefined;
|
|
60
|
+
} | {
|
|
61
|
+
type: string;
|
|
62
|
+
label: string;
|
|
63
|
+
key: string;
|
|
64
|
+
disableOnInvalid: boolean;
|
|
65
|
+
input: boolean;
|
|
66
|
+
tableView: boolean;
|
|
67
|
+
reorder?: undefined;
|
|
68
|
+
addAnotherPosition?: undefined;
|
|
69
|
+
layoutFixed?: undefined;
|
|
70
|
+
enableRowGroups?: undefined;
|
|
71
|
+
initEmpty?: undefined;
|
|
72
|
+
defaultValue?: undefined;
|
|
73
|
+
validate?: undefined;
|
|
74
|
+
components?: undefined;
|
|
75
|
+
})[];
|
|
76
|
+
let pdfComponents: never[];
|
|
77
|
+
namespace settings {
|
|
78
|
+
let logs: string;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
export default _default;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
title: 'randomName',
|
|
3
|
+
name: 'randomName',
|
|
4
|
+
path: 'randomName',
|
|
5
|
+
type: 'form',
|
|
6
|
+
display: 'form',
|
|
7
|
+
components: [
|
|
8
|
+
{
|
|
9
|
+
label: 'Data Grid',
|
|
10
|
+
reorder: false,
|
|
11
|
+
addAnotherPosition: 'bottom',
|
|
12
|
+
layoutFixed: false,
|
|
13
|
+
enableRowGroups: false,
|
|
14
|
+
initEmpty: false,
|
|
15
|
+
tableView: false,
|
|
16
|
+
defaultValue: [
|
|
17
|
+
{}
|
|
18
|
+
],
|
|
19
|
+
validate: {
|
|
20
|
+
required: true
|
|
21
|
+
},
|
|
22
|
+
key: 'dataGrid',
|
|
23
|
+
type: 'datagrid',
|
|
24
|
+
input: true,
|
|
25
|
+
components: [
|
|
26
|
+
{
|
|
27
|
+
label: 'Columns',
|
|
28
|
+
columns: [
|
|
29
|
+
{
|
|
30
|
+
components: [
|
|
31
|
+
{
|
|
32
|
+
label: 'Text Field',
|
|
33
|
+
applyMaskOn: 'change',
|
|
34
|
+
tableView: true,
|
|
35
|
+
key: 'textField',
|
|
36
|
+
type: 'textfield',
|
|
37
|
+
input: true
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
width: 6,
|
|
41
|
+
offset: 0,
|
|
42
|
+
push: 0,
|
|
43
|
+
pull: 0,
|
|
44
|
+
size: 'md',
|
|
45
|
+
currentWidth: 6
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
components: [
|
|
49
|
+
{
|
|
50
|
+
label: 'Checkbox',
|
|
51
|
+
tableView: false,
|
|
52
|
+
key: 'checkbox',
|
|
53
|
+
type: 'checkbox',
|
|
54
|
+
input: true
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
width: 6,
|
|
58
|
+
offset: 0,
|
|
59
|
+
push: 0,
|
|
60
|
+
pull: 0,
|
|
61
|
+
size: 'md',
|
|
62
|
+
currentWidth: 6
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
key: 'columns',
|
|
66
|
+
type: 'columns',
|
|
67
|
+
input: false,
|
|
68
|
+
tableView: false
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
type: 'button',
|
|
74
|
+
label: 'Submit',
|
|
75
|
+
key: 'submit',
|
|
76
|
+
disableOnInvalid: true,
|
|
77
|
+
input: true,
|
|
78
|
+
tableView: false
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
pdfComponents: [],
|
|
82
|
+
settings: {
|
|
83
|
+
logs: 'true'
|
|
84
|
+
}
|
|
85
|
+
};
|
|
@@ -6,6 +6,7 @@ import comp5 from './comp5';
|
|
|
6
6
|
import comp6 from './comp6';
|
|
7
7
|
import comp7 from './comp7';
|
|
8
8
|
import comp8 from './comp8';
|
|
9
|
+
import comp9 from './comp9';
|
|
9
10
|
import withCollapsibleRowGroups from './comp-with-collapsible-groups';
|
|
10
11
|
import withConditionalFieldsAndValidations from './comp-with-conditional-components-and-validations';
|
|
11
12
|
import withDefValue from './comp-with-def-value';
|
|
@@ -14,5 +15,4 @@ import withRowGroupsAndDefValue from './comp-row-groups-with-def-value';
|
|
|
14
15
|
import modalWithRequiredFields from './comp-modal-with-required-fields';
|
|
15
16
|
import withAllowCalculateOverride from './comp-with-allow-calculate-override';
|
|
16
17
|
import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
|
|
17
|
-
|
|
18
|
-
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes };
|
|
18
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride };
|
|
@@ -6,6 +6,7 @@ import comp5 from './comp5';
|
|
|
6
6
|
import comp6 from './comp6';
|
|
7
7
|
import comp7 from './comp7';
|
|
8
8
|
import comp8 from './comp8';
|
|
9
|
+
import comp9 from './comp9';
|
|
9
10
|
import withDefValue from './comp-with-def-value';
|
|
10
11
|
import withRowGroupsAndDefValue from './comp-row-groups-with-def-value';
|
|
11
12
|
import modalWithRequiredFields from './comp-modal-with-required-fields';
|
|
@@ -14,5 +15,4 @@ import withLogic from './comp-with-logic';
|
|
|
14
15
|
import withCollapsibleRowGroups from './comp-with-collapsible-groups';
|
|
15
16
|
import withAllowCalculateOverride from './comp-with-allow-calculate-override';
|
|
16
17
|
import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
|
|
17
|
-
|
|
18
|
-
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes };
|
|
18
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride };
|
|
@@ -649,8 +649,7 @@ export default class FileComponent extends Field {
|
|
|
649
649
|
// Check if file with the same name is being uploaded
|
|
650
650
|
const fileWithSameNameUploading = this.filesToSync.filesToUpload
|
|
651
651
|
.some(fileToSync => fileToSync.file?.name === file.name);
|
|
652
|
-
const fileWithSameNameUploaded = this.dataValue
|
|
653
|
-
.some(fileStatus => fileStatus.originalName === file.name);
|
|
652
|
+
const fileWithSameNameUploaded = _.some(this.dataValue, fileStatus => fileStatus.originalName === file.name);
|
|
654
653
|
return fileWithSameNameUploaded || fileWithSameNameUploading
|
|
655
654
|
? {
|
|
656
655
|
status: 'error',
|
|
@@ -200,8 +200,7 @@ export default class RadioComponent extends ListComponent {
|
|
|
200
200
|
if (this.viewOnly || !this.refs.input || !this.refs.input.length) {
|
|
201
201
|
return this.dataValue;
|
|
202
202
|
}
|
|
203
|
-
|
|
204
|
-
let value = this.component.inputType === 'checkbox' ? '' : this.dataValue;
|
|
203
|
+
let value = this.dataValue;
|
|
205
204
|
this.refs.input.forEach((input, index) => {
|
|
206
205
|
if (input.checked) {
|
|
207
206
|
value = (this.isSelectURL && _.isObject(this.loadedOptions[index].value)) ?
|
|
@@ -323,7 +322,7 @@ export default class RadioComponent extends ListComponent {
|
|
|
323
322
|
const value = this.dataValue;
|
|
324
323
|
this.refs.wrapper.forEach((wrapper, index) => {
|
|
325
324
|
const input = this.refs.input[index];
|
|
326
|
-
const checked = (input.type === 'checkbox') ? value[input.value]
|
|
325
|
+
const checked = (input.type === 'checkbox') ? value[input.value] : (input.value.toString() === value.toString());
|
|
327
326
|
if (checked) {
|
|
328
327
|
//add class to container when selected
|
|
329
328
|
this.addClass(wrapper, this.optionSelectedClass);
|
|
@@ -11,10 +11,10 @@ export default class IsEmptyValue extends ConditionOperator {
|
|
|
11
11
|
return false;
|
|
12
12
|
}
|
|
13
13
|
execute({ value, instance, conditionComponentPath }) {
|
|
14
|
-
const isEmptyValue = _.isEmpty(value);
|
|
14
|
+
const isEmptyValue = _.isEmpty(_.isNumber(value) ? String(value) : value);
|
|
15
15
|
if (instance && instance.root) {
|
|
16
|
-
const conditionTriggerComponent = instance.root.getComponent(conditionComponentPath);
|
|
17
|
-
return conditionTriggerComponent ? conditionTriggerComponent.isEmpty() : isEmptyValue;
|
|
16
|
+
const conditionTriggerComponent = instance.root?.getComponent && instance.root.getComponent(conditionComponentPath);
|
|
17
|
+
return conditionTriggerComponent?.isEmpty ? conditionTriggerComponent.isEmpty() : isEmptyValue;
|
|
18
18
|
}
|
|
19
19
|
return isEmptyValue;
|
|
20
20
|
}
|
|
@@ -17,7 +17,7 @@ export default class IsEqualTo extends ConditionOperator {
|
|
|
17
17
|
catch (e) { }
|
|
18
18
|
}
|
|
19
19
|
if (instance && instance.root) {
|
|
20
|
-
const conditionTriggerComponent = instance.root.getComponent(conditionComponentPath);
|
|
20
|
+
const conditionTriggerComponent = instance.root?.getComponent && instance.root.getComponent(conditionComponentPath);
|
|
21
21
|
if (conditionTriggerComponent
|
|
22
22
|
&& isSelectResourceWithObjectValue(conditionTriggerComponent.component)
|
|
23
23
|
&& conditionTriggerComponent.component?.template) {
|
package/lib/mjs/utils/utils.d.ts
CHANGED
|
@@ -60,16 +60,6 @@ export function isMongoId(text: any): any[] | {
|
|
|
60
60
|
* The full submission data.
|
|
61
61
|
*/
|
|
62
62
|
export function checkCalculated(component: Object, submission: Object, rowData: any): void;
|
|
63
|
-
/**
|
|
64
|
-
* Check if a simple conditional evaluates to true.
|
|
65
|
-
*
|
|
66
|
-
* @param condition
|
|
67
|
-
* @param condition
|
|
68
|
-
* @param row
|
|
69
|
-
* @param data
|
|
70
|
-
* @param instance
|
|
71
|
-
* @returns {boolean}
|
|
72
|
-
*/
|
|
73
63
|
export function checkSimpleConditional(component: any, condition: any, row: any, data: any, instance: any): boolean;
|
|
74
64
|
export function getComponentActualValue(compPath: any, data: any, row: any): any;
|
|
75
65
|
/**
|