@formio/js 5.0.0-rc.67 → 5.0.0-rc.69
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/formio.builder.css +0 -1
- package/dist/formio.builder.min.css +1 -1
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.css +0 -1
- package/dist/formio.form.js +110 -859
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.css +0 -1
- package/dist/formio.full.js +22 -471
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +3 -3
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +95 -874
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/components/currency/Currency.d.ts +1 -0
- package/lib/cjs/components/datagrid/DataGrid.d.ts +9 -0
- package/lib/cjs/components/datagrid/DataGrid.js +49 -34
- package/lib/cjs/components/datagrid/fixtures/comp-with-reorder.d.ts +100 -0
- package/lib/cjs/components/datagrid/fixtures/comp-with-reorder.js +139 -0
- package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/datagrid/fixtures/index.js +3 -1
- package/lib/cjs/components/datamap/DataMap.js +2 -2
- package/lib/cjs/components/editgrid/EditGrid.js +2 -1
- package/lib/cjs/components/editgrid/fixtures/comp16.d.ts +52 -0
- package/lib/cjs/components/editgrid/fixtures/comp16.js +71 -0
- package/lib/cjs/components/editgrid/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/editgrid/fixtures/index.js +3 -1
- package/lib/cjs/components/number/Number.d.ts +10 -1
- package/lib/cjs/components/number/Number.js +16 -7
- package/lib/cjs/components/number/fixtures/comp8.d.ts +32 -0
- package/lib/cjs/components/number/fixtures/comp8.js +28 -0
- package/lib/cjs/components/number/fixtures/comp9.d.ts +18 -0
- package/lib/cjs/components/number/fixtures/comp9.js +21 -0
- package/lib/cjs/components/number/fixtures/index.d.ts +3 -1
- package/lib/cjs/components/number/fixtures/index.js +5 -1
- package/lib/mjs/components/currency/Currency.d.ts +1 -0
- package/lib/mjs/components/datagrid/DataGrid.d.ts +9 -0
- package/lib/mjs/components/datagrid/DataGrid.js +48 -33
- package/lib/mjs/components/datagrid/fixtures/comp-with-reorder.d.ts +100 -0
- package/lib/mjs/components/datagrid/fixtures/comp-with-reorder.js +137 -0
- package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/datagrid/fixtures/index.js +2 -1
- package/lib/mjs/components/datamap/DataMap.js +1 -1
- package/lib/mjs/components/editgrid/EditGrid.js +2 -1
- package/lib/mjs/components/editgrid/fixtures/comp16.d.ts +52 -0
- package/lib/mjs/components/editgrid/fixtures/comp16.js +69 -0
- package/lib/mjs/components/editgrid/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/editgrid/fixtures/index.js +2 -1
- package/lib/mjs/components/number/Number.d.ts +10 -1
- package/lib/mjs/components/number/Number.js +15 -6
- package/lib/mjs/components/number/fixtures/comp8.d.ts +32 -0
- package/lib/mjs/components/number/fixtures/comp8.js +26 -0
- package/lib/mjs/components/number/fixtures/comp9.d.ts +18 -0
- package/lib/mjs/components/number/fixtures/comp9.js +19 -0
- package/lib/mjs/components/number/fixtures/index.d.ts +3 -1
- package/lib/mjs/components/number/fixtures/index.js +3 -1
- package/package.json +2 -2
@@ -45,19 +45,19 @@ class NumberComponent extends Input_1.default {
|
|
45
45
|
return (0, utils_1.getComponentSavedTypes)(schema) || [utils_1.componentValueTypes.number];
|
46
46
|
}
|
47
47
|
constructor(...args) {
|
48
|
-
var _a, _b;
|
48
|
+
var _a, _b, _c;
|
49
49
|
super(...args);
|
50
50
|
const separators = (0, utils_1.getNumberSeparators)(this.options.language || navigator.language);
|
51
|
-
this.decimalSeparator = this.options.decimalSeparator = this.options.decimalSeparator
|
51
|
+
this.decimalSeparator = this.options.decimalSeparator = this.component.decimalSymbol || this.options.decimalSeparator
|
52
52
|
|| ((_a = this.options.properties) === null || _a === void 0 ? void 0 : _a.decimalSeparator)
|
53
53
|
|| separators.decimalSeparator;
|
54
54
|
if (this.component.delimiter) {
|
55
|
-
|
56
|
-
console.warn("Property 'thousandsSeparator' is deprecated. Please use i18n to specify delimiter.");
|
57
|
-
}
|
58
|
-
this.delimiter = ((_b = this.options.properties) === null || _b === void 0 ? void 0 : _b.thousandsSeparator) || this.options.thousandsSeparator || separators.delimiter;
|
55
|
+
this.delimiter = this.component.thousandsSeparator || ((_b = this.options.properties) === null || _b === void 0 ? void 0 : _b.thousandsSeparator) || this.options.thousandsSeparator || separators.delimiter;
|
59
56
|
}
|
60
57
|
else {
|
58
|
+
if (this.component.thousandsSeparator || ((_c = this.options.properties) === null || _c === void 0 ? void 0 : _c.thousandsSeparator) || this.options.thousandsSeparator) {
|
59
|
+
console.warn('In order for thousands separator to work properly, you must set the delimiter to true in the component json');
|
60
|
+
}
|
61
61
|
this.delimiter = '';
|
62
62
|
}
|
63
63
|
const requireDecimal = lodash_1.default.get(this.component, 'requireDecimal', false);
|
@@ -79,7 +79,7 @@ class NumberComponent extends Input_1.default {
|
|
79
79
|
prefix: '',
|
80
80
|
suffix: '',
|
81
81
|
requireDecimal: lodash_1.default.get(this.component, 'requireDecimal', false),
|
82
|
-
thousandsSeparatorSymbol:
|
82
|
+
thousandsSeparatorSymbol: this.delimiter || '',
|
83
83
|
decimalSymbol: lodash_1.default.get(this.component, 'decimalSymbol', this.decimalSeparator),
|
84
84
|
decimalLimit: lodash_1.default.get(this.component, 'decimalLimit', this.decimalLimit),
|
85
85
|
allowNegative: lodash_1.default.get(this.component, 'allowNegative', true),
|
@@ -146,6 +146,15 @@ class NumberComponent extends Input_1.default {
|
|
146
146
|
setValueAt(index, value, flags = {}) {
|
147
147
|
return super.setValueAt(index, this.formatValue(this.parseValue(value)), flags);
|
148
148
|
}
|
149
|
+
/**
|
150
|
+
* Converts a string to a floating point number, formats the number based on the parsed float function
|
151
|
+
* (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseFloat) and then returns the
|
152
|
+
* formatted number back as a string
|
153
|
+
* Example Input: "123.456,22"
|
154
|
+
* Example Output: "123456,22"
|
155
|
+
* @param {string | number} input the numeric string to parse
|
156
|
+
* @returns {string | null} a parsed string
|
157
|
+
*/
|
149
158
|
parseValue(input) {
|
150
159
|
if (typeof input === 'string') {
|
151
160
|
input = input.split(this.delimiter).join('').replace(this.decimalSeparator, '.');
|
@@ -0,0 +1,32 @@
|
|
1
|
+
declare namespace _default {
|
2
|
+
let components: ({
|
3
|
+
label: string;
|
4
|
+
applyMaskOn: string;
|
5
|
+
mask: boolean;
|
6
|
+
tableView: boolean;
|
7
|
+
delimiter: boolean;
|
8
|
+
requireDecimal: boolean;
|
9
|
+
inputFormat: string;
|
10
|
+
truncateMultipleSpaces: boolean;
|
11
|
+
key: string;
|
12
|
+
type: string;
|
13
|
+
input: boolean;
|
14
|
+
decimalSymbol: string;
|
15
|
+
disableOnInvalid?: undefined;
|
16
|
+
} | {
|
17
|
+
type: string;
|
18
|
+
label: string;
|
19
|
+
key: string;
|
20
|
+
disableOnInvalid: boolean;
|
21
|
+
input: boolean;
|
22
|
+
tableView: boolean;
|
23
|
+
applyMaskOn?: undefined;
|
24
|
+
mask?: undefined;
|
25
|
+
delimiter?: undefined;
|
26
|
+
requireDecimal?: undefined;
|
27
|
+
inputFormat?: undefined;
|
28
|
+
truncateMultipleSpaces?: undefined;
|
29
|
+
decimalSymbol?: undefined;
|
30
|
+
})[];
|
31
|
+
}
|
32
|
+
export default _default;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = {
|
4
|
+
components: [
|
5
|
+
{
|
6
|
+
"label": "Number",
|
7
|
+
"applyMaskOn": "change",
|
8
|
+
"mask": false,
|
9
|
+
"tableView": false,
|
10
|
+
"delimiter": false,
|
11
|
+
"requireDecimal": false,
|
12
|
+
"inputFormat": "plain",
|
13
|
+
"truncateMultipleSpaces": false,
|
14
|
+
"key": "number",
|
15
|
+
"type": "number",
|
16
|
+
"input": true,
|
17
|
+
"decimalSymbol": "-"
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"type": "button",
|
21
|
+
"label": "Submit",
|
22
|
+
"key": "submit",
|
23
|
+
"disableOnInvalid": true,
|
24
|
+
"input": true,
|
25
|
+
"tableView": false
|
26
|
+
}
|
27
|
+
]
|
28
|
+
};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
declare namespace _default {
|
2
|
+
let components: {
|
3
|
+
label: string;
|
4
|
+
applyMaskOn: string;
|
5
|
+
mask: boolean;
|
6
|
+
tableView: boolean;
|
7
|
+
delimiter: boolean;
|
8
|
+
requireDecimal: boolean;
|
9
|
+
inputFormat: string;
|
10
|
+
truncateMultipleSpaces: boolean;
|
11
|
+
key: string;
|
12
|
+
type: string;
|
13
|
+
input: boolean;
|
14
|
+
decimalSymbol: string;
|
15
|
+
thousandsSeparator: string;
|
16
|
+
}[];
|
17
|
+
}
|
18
|
+
export default _default;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = {
|
4
|
+
components: [
|
5
|
+
{
|
6
|
+
"label": "Number",
|
7
|
+
"applyMaskOn": "change",
|
8
|
+
"mask": false,
|
9
|
+
"tableView": false,
|
10
|
+
"delimiter": true,
|
11
|
+
"requireDecimal": false,
|
12
|
+
"inputFormat": "plain",
|
13
|
+
"truncateMultipleSpaces": false,
|
14
|
+
"key": "number",
|
15
|
+
"type": "number",
|
16
|
+
"input": true,
|
17
|
+
"decimalSymbol": ",",
|
18
|
+
"thousandsSeparator": "."
|
19
|
+
}
|
20
|
+
]
|
21
|
+
};
|
@@ -5,4 +5,6 @@ import comp4 from './comp4';
|
|
5
5
|
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';
|
10
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9 };
|
@@ -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.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
6
|
+
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"));
|
@@ -18,3 +18,7 @@ const comp6_1 = __importDefault(require("./comp6"));
|
|
18
18
|
exports.comp6 = comp6_1.default;
|
19
19
|
const comp7_1 = __importDefault(require("./comp7"));
|
20
20
|
exports.comp7 = comp7_1.default;
|
21
|
+
const comp8_1 = __importDefault(require("./comp8"));
|
22
|
+
exports.comp8 = comp8_1.default;
|
23
|
+
const comp9_1 = __importDefault(require("./comp9"));
|
24
|
+
exports.comp9 = comp9_1.default;
|
@@ -2,6 +2,7 @@ export default class CurrencyComponent extends NumberComponent {
|
|
2
2
|
constructor(component: any, options: any, data: any);
|
3
3
|
currencyPrefix: any;
|
4
4
|
currencySuffix: any;
|
5
|
+
parseValue(value: any): string | null;
|
5
6
|
addZerosAndFormatValue(value: any): any;
|
6
7
|
stripPrefixSuffix(value: any): any;
|
7
8
|
}
|
@@ -61,6 +61,15 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
61
61
|
loadRefs(element: any, refs: any): void;
|
62
62
|
dragula: any;
|
63
63
|
getComponentsContainer(): any;
|
64
|
+
/**
|
65
|
+
* Reorder values in array based on the old and new position
|
66
|
+
* @param {any} valuesArr - An array of values.
|
67
|
+
* @param {number} oldPosition - The index of the value in array before reordering.
|
68
|
+
* @param {number} newPosition - The index of the value in array after reordering.
|
69
|
+
* @param {boolean|any} movedBelow - Whether or not the value is moved below.
|
70
|
+
* @returns {void}
|
71
|
+
*/
|
72
|
+
reorderValues(valuesArr: any, oldPosition: number, newPosition: number, movedBelow: boolean | any): void;
|
64
73
|
onReorder(element: any, _target: any, _source: any, sibling: any): void;
|
65
74
|
focusOnNewRowElement(row: any): void;
|
66
75
|
addRow(): void;
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import NestedArrayComponent from '../_classes/nestedarray/NestedArrayComponent';
|
3
3
|
import { fastCloneDeep, getFocusableElements } from '../../utils/utils';
|
4
|
-
import
|
4
|
+
import Components from '../Components';
|
5
|
+
import dragula from 'dragula';
|
5
6
|
export default class DataGridComponent extends NestedArrayComponent {
|
6
7
|
static schema(...extend) {
|
7
8
|
return NestedArrayComponent.schema({
|
@@ -278,34 +279,32 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
278
279
|
this.refs[`${this.datagridKey}-row`].forEach((row, index) => {
|
279
280
|
row.dragInfo = { index };
|
280
281
|
});
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
return clickedElement.classList.contains('formio-drag-button');
|
289
|
-
}
|
290
|
-
}
|
291
|
-
}).on('drop', this.onReorder.bind(this));
|
292
|
-
this.dragula.on('cloned', (el, original) => {
|
293
|
-
if (el && el.children && original && original.children) {
|
294
|
-
_.each(original.children, (child, index) => {
|
295
|
-
const styles = getComputedStyle(child, null);
|
296
|
-
if (styles.cssText !== '') {
|
297
|
-
el.children[index].style.cssText = styles.cssText;
|
298
|
-
}
|
299
|
-
else {
|
300
|
-
const cssText = Object.values(styles).reduce((css, propertyName) => {
|
301
|
-
return `${css}${propertyName}:${styles.getPropertyValue(propertyName)};`;
|
302
|
-
}, '');
|
303
|
-
el.children[index].style.cssText = cssText;
|
304
|
-
}
|
305
|
-
});
|
282
|
+
this.dragula = dragula([this.refs[`${this.datagridKey}-tbody`]], {
|
283
|
+
moves: (_draggedElement, _oldParent, clickedElement) => {
|
284
|
+
const clickedElementKey = clickedElement.getAttribute('data-key');
|
285
|
+
const oldParentKey = _oldParent.getAttribute('data-key');
|
286
|
+
//Check if the clicked button belongs to that container, if false, it belongs to the nested container
|
287
|
+
if (oldParentKey === clickedElementKey) {
|
288
|
+
return clickedElement.classList.contains('formio-drag-button');
|
306
289
|
}
|
307
|
-
}
|
308
|
-
}
|
290
|
+
}
|
291
|
+
}).on('drop', this.onReorder.bind(this));
|
292
|
+
this.dragula.on('cloned', (el, original) => {
|
293
|
+
if (el && el.children && original && original.children) {
|
294
|
+
_.each(original.children, (child, index) => {
|
295
|
+
const styles = getComputedStyle(child, null);
|
296
|
+
if (styles.cssText !== '') {
|
297
|
+
el.children[index].style.cssText = styles.cssText;
|
298
|
+
}
|
299
|
+
else {
|
300
|
+
const cssText = Object.values(styles).reduce((css, propertyName) => {
|
301
|
+
return `${css}${propertyName}:${styles.getPropertyValue(propertyName)};`;
|
302
|
+
}, '');
|
303
|
+
el.children[index].style.cssText = cssText;
|
304
|
+
}
|
305
|
+
});
|
306
|
+
}
|
307
|
+
});
|
309
308
|
}
|
310
309
|
this.refs[`${this.datagridKey}-addRow`].forEach((addButton) => {
|
311
310
|
this.addEventListener(addButton, 'click', this.addRow.bind(this));
|
@@ -333,6 +332,24 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
333
332
|
getComponentsContainer() {
|
334
333
|
return this.component.components;
|
335
334
|
}
|
335
|
+
/**
|
336
|
+
* Reorder values in array based on the old and new position
|
337
|
+
* @param {any} valuesArr - An array of values.
|
338
|
+
* @param {number} oldPosition - The index of the value in array before reordering.
|
339
|
+
* @param {number} newPosition - The index of the value in array after reordering.
|
340
|
+
* @param {boolean|any} movedBelow - Whether or not the value is moved below.
|
341
|
+
* @returns {void}
|
342
|
+
*/
|
343
|
+
reorderValues(valuesArr, oldPosition, newPosition, movedBelow) {
|
344
|
+
if (!_.isArray(valuesArr) || _.isEmpty(valuesArr)) {
|
345
|
+
return;
|
346
|
+
}
|
347
|
+
const draggedRowData = valuesArr[oldPosition];
|
348
|
+
//insert element at new position
|
349
|
+
valuesArr.splice(newPosition, 0, draggedRowData);
|
350
|
+
//remove element from old position (if was moved above, after insertion it's at +1 index)
|
351
|
+
valuesArr.splice(movedBelow ? oldPosition : oldPosition + 1, 1);
|
352
|
+
}
|
336
353
|
onReorder(element, _target, _source, sibling) {
|
337
354
|
if (!element.dragInfo || (sibling && !sibling.dragInfo)) {
|
338
355
|
console.warn('There is no Drag Info available for either dragged or sibling element');
|
@@ -343,11 +360,9 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
343
360
|
const newPosition = sibling ? sibling.dragInfo.index : this.dataValue.length;
|
344
361
|
const movedBelow = newPosition > oldPosition;
|
345
362
|
const dataValue = fastCloneDeep(this.dataValue);
|
346
|
-
|
347
|
-
//
|
348
|
-
|
349
|
-
//remove element from old position (if was moved above, after insertion it's at +1 index)
|
350
|
-
dataValue.splice(movedBelow ? oldPosition : oldPosition + 1, 1);
|
363
|
+
this.reorderValues(dataValue, oldPosition, newPosition, movedBelow);
|
364
|
+
//reorder select data
|
365
|
+
this.reorderValues(_.get(this.root, `submission.metadata.selectData.${this.path}`, []), oldPosition, newPosition, movedBelow);
|
351
366
|
//need to re-build rows to re-calculate indexes and other indexed fields for component instance (like rows for ex.)
|
352
367
|
this.setValue(dataValue, { isReordered: true });
|
353
368
|
this.rebuild();
|
@@ -0,0 +1,100 @@
|
|
1
|
+
declare namespace _default {
|
2
|
+
export { form };
|
3
|
+
export { submission };
|
4
|
+
}
|
5
|
+
export default _default;
|
6
|
+
declare namespace form {
|
7
|
+
let _id: string;
|
8
|
+
let title: string;
|
9
|
+
let name: string;
|
10
|
+
let path: string;
|
11
|
+
let type: string;
|
12
|
+
let display: string;
|
13
|
+
let components: ({
|
14
|
+
label: string;
|
15
|
+
reorder: boolean;
|
16
|
+
addAnotherPosition: string;
|
17
|
+
layoutFixed: boolean;
|
18
|
+
enableRowGroups: boolean;
|
19
|
+
initEmpty: boolean;
|
20
|
+
tableView: boolean;
|
21
|
+
defaultValue: {
|
22
|
+
select: string;
|
23
|
+
}[];
|
24
|
+
key: string;
|
25
|
+
type: string;
|
26
|
+
input: boolean;
|
27
|
+
components: {
|
28
|
+
label: string;
|
29
|
+
widget: string;
|
30
|
+
tableView: boolean;
|
31
|
+
dataSrc: string;
|
32
|
+
data: {
|
33
|
+
resource: string;
|
34
|
+
};
|
35
|
+
dataType: string;
|
36
|
+
valueProperty: string;
|
37
|
+
template: string;
|
38
|
+
validate: {
|
39
|
+
select: boolean;
|
40
|
+
};
|
41
|
+
key: string;
|
42
|
+
type: string;
|
43
|
+
searchField: string;
|
44
|
+
limit: number;
|
45
|
+
noRefreshOnScroll: boolean;
|
46
|
+
addResource: boolean;
|
47
|
+
reference: boolean;
|
48
|
+
input: boolean;
|
49
|
+
}[];
|
50
|
+
disableOnInvalid?: undefined;
|
51
|
+
} | {
|
52
|
+
type: string;
|
53
|
+
label: string;
|
54
|
+
key: string;
|
55
|
+
disableOnInvalid: boolean;
|
56
|
+
input: boolean;
|
57
|
+
tableView: boolean;
|
58
|
+
reorder?: undefined;
|
59
|
+
addAnotherPosition?: undefined;
|
60
|
+
layoutFixed?: undefined;
|
61
|
+
enableRowGroups?: undefined;
|
62
|
+
initEmpty?: undefined;
|
63
|
+
defaultValue?: undefined;
|
64
|
+
components?: undefined;
|
65
|
+
})[];
|
66
|
+
let created: string;
|
67
|
+
let modified: string;
|
68
|
+
let machineName: string;
|
69
|
+
}
|
70
|
+
declare namespace submission {
|
71
|
+
let form_1: string;
|
72
|
+
export { form_1 as form };
|
73
|
+
export namespace metadata {
|
74
|
+
namespace selectData {
|
75
|
+
let dataGrid: {
|
76
|
+
select: {
|
77
|
+
data: {
|
78
|
+
number: number;
|
79
|
+
};
|
80
|
+
};
|
81
|
+
}[];
|
82
|
+
}
|
83
|
+
}
|
84
|
+
export namespace data {
|
85
|
+
let dataGrid_1: {
|
86
|
+
select: string;
|
87
|
+
}[];
|
88
|
+
export { dataGrid_1 as dataGrid };
|
89
|
+
export let dataTable: never[];
|
90
|
+
export let submit: boolean;
|
91
|
+
}
|
92
|
+
let _id_1: string;
|
93
|
+
export { _id_1 as _id };
|
94
|
+
export let project: string;
|
95
|
+
export let state: string;
|
96
|
+
let created_1: string;
|
97
|
+
export { created_1 as created };
|
98
|
+
let modified_1: string;
|
99
|
+
export { modified_1 as modified };
|
100
|
+
}
|
@@ -0,0 +1,137 @@
|
|
1
|
+
const form = {
|
2
|
+
_id: '66742f4146717b98a9fa280f',
|
3
|
+
title: 'test reorder',
|
4
|
+
name: 'testReorder',
|
5
|
+
path: 'testreorder',
|
6
|
+
type: 'form',
|
7
|
+
display: 'form',
|
8
|
+
components: [
|
9
|
+
{
|
10
|
+
label: 'Data Grid',
|
11
|
+
reorder: true,
|
12
|
+
addAnotherPosition: 'bottom',
|
13
|
+
layoutFixed: false,
|
14
|
+
enableRowGroups: false,
|
15
|
+
initEmpty: false,
|
16
|
+
tableView: false,
|
17
|
+
defaultValue: [
|
18
|
+
{
|
19
|
+
select: '',
|
20
|
+
},
|
21
|
+
],
|
22
|
+
key: 'dataGrid',
|
23
|
+
type: 'datagrid',
|
24
|
+
input: true,
|
25
|
+
components: [
|
26
|
+
{
|
27
|
+
label: 'Select',
|
28
|
+
widget: 'choicesjs',
|
29
|
+
tableView: true,
|
30
|
+
dataSrc: 'resource',
|
31
|
+
data: {
|
32
|
+
resource: '66742ee946717b98a9fa1b0b',
|
33
|
+
},
|
34
|
+
dataType: 'string',
|
35
|
+
valueProperty: 'data.textField',
|
36
|
+
template: '<span>{{ item.data.number }}</span>',
|
37
|
+
validate: {
|
38
|
+
select: false,
|
39
|
+
},
|
40
|
+
key: 'select',
|
41
|
+
type: 'select',
|
42
|
+
searchField: 'data.textField__regex',
|
43
|
+
limit: 10,
|
44
|
+
noRefreshOnScroll: false,
|
45
|
+
addResource: false,
|
46
|
+
reference: false,
|
47
|
+
input: true,
|
48
|
+
},
|
49
|
+
],
|
50
|
+
},
|
51
|
+
{
|
52
|
+
type: 'button',
|
53
|
+
label: 'Submit',
|
54
|
+
key: 'submit',
|
55
|
+
disableOnInvalid: true,
|
56
|
+
input: true,
|
57
|
+
tableView: false,
|
58
|
+
},
|
59
|
+
],
|
60
|
+
created: '2024-06-20T13:31:45.177Z',
|
61
|
+
modified: '2024-06-25T10:32:46.577Z',
|
62
|
+
machineName: 'tifwklexhyrgxbr:testReorder',
|
63
|
+
};
|
64
|
+
const submission = {
|
65
|
+
form: '66742f4146717b98a9fa280f',
|
66
|
+
metadata: {
|
67
|
+
selectData: {
|
68
|
+
dataGrid: [
|
69
|
+
{
|
70
|
+
select: {
|
71
|
+
data: {
|
72
|
+
number: 1,
|
73
|
+
},
|
74
|
+
},
|
75
|
+
},
|
76
|
+
{
|
77
|
+
select: {
|
78
|
+
data: {
|
79
|
+
number: 2,
|
80
|
+
},
|
81
|
+
},
|
82
|
+
},
|
83
|
+
{
|
84
|
+
select: {
|
85
|
+
data: {
|
86
|
+
number: 3,
|
87
|
+
},
|
88
|
+
},
|
89
|
+
},
|
90
|
+
{
|
91
|
+
select: {
|
92
|
+
data: {
|
93
|
+
number: 4,
|
94
|
+
},
|
95
|
+
},
|
96
|
+
},
|
97
|
+
{
|
98
|
+
select: {
|
99
|
+
data: {
|
100
|
+
number: 5,
|
101
|
+
},
|
102
|
+
},
|
103
|
+
},
|
104
|
+
],
|
105
|
+
},
|
106
|
+
},
|
107
|
+
data: {
|
108
|
+
dataGrid: [
|
109
|
+
{
|
110
|
+
select: '11',
|
111
|
+
},
|
112
|
+
{
|
113
|
+
select: '22',
|
114
|
+
},
|
115
|
+
{
|
116
|
+
select: '33',
|
117
|
+
},
|
118
|
+
{
|
119
|
+
select: '44',
|
120
|
+
},
|
121
|
+
{
|
122
|
+
select: '55',
|
123
|
+
},
|
124
|
+
],
|
125
|
+
dataTable: [],
|
126
|
+
submit: true,
|
127
|
+
},
|
128
|
+
_id: '667ab5ee6a69739703d30def',
|
129
|
+
project: '65df46bc93bcfaa231f3db1c',
|
130
|
+
state: 'submitted',
|
131
|
+
created: '2024-06-25T12:19:58.626Z',
|
132
|
+
modified: '2024-06-25T12:19:58.627Z',
|
133
|
+
};
|
134
|
+
export default {
|
135
|
+
form,
|
136
|
+
submission,
|
137
|
+
};
|
@@ -16,4 +16,5 @@ import modalWithRequiredFields from './comp-modal-with-required-fields';
|
|
16
16
|
import withAllowCalculateOverride from './comp-with-allow-calculate-override';
|
17
17
|
import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
|
18
18
|
import withCheckboxes from './comp-with-checkboxes';
|
19
|
-
|
19
|
+
import withReorder from './comp-with-reorder';
|
20
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
|
@@ -16,4 +16,5 @@ import withCollapsibleRowGroups from './comp-with-collapsible-groups';
|
|
16
16
|
import withAllowCalculateOverride from './comp-with-allow-calculate-override';
|
17
17
|
import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
|
18
18
|
import withCheckboxes from './comp-with-checkboxes';
|
19
|
-
|
19
|
+
import withReorder from './comp-with-reorder';
|
20
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
|
@@ -3,7 +3,7 @@ import DataGridComponent from '../datagrid/DataGrid';
|
|
3
3
|
import _ from 'lodash';
|
4
4
|
import EventEmitter from 'eventemitter3';
|
5
5
|
import { componentValueTypes, getComponentSavedTypes, uniqueKey } from '../../utils/utils';
|
6
|
-
import
|
6
|
+
import Components from '../Components';
|
7
7
|
export default class DataMapComponent extends DataGridComponent {
|
8
8
|
static schema(...extend) {
|
9
9
|
return Component.schema({
|
@@ -1079,7 +1079,8 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
1079
1079
|
return false;
|
1080
1080
|
}
|
1081
1081
|
else if (rowsEditing && this.saveEditMode && !this.component.openWhenEmpty) {
|
1082
|
-
this.setCustomValidity(this.t(this.errorMessage('unsavedRowsError')), dirty);
|
1082
|
+
this._errors = this.setCustomValidity(this.t(this.errorMessage('unsavedRowsError')), dirty);
|
1083
|
+
errors.push(...this._errors);
|
1083
1084
|
return false;
|
1084
1085
|
}
|
1085
1086
|
const message = this.invalid || this.invalidMessage(data, dirty, false, row);
|
@@ -0,0 +1,52 @@
|
|
1
|
+
declare namespace _default {
|
2
|
+
let type: string;
|
3
|
+
let display: string;
|
4
|
+
let components: ({
|
5
|
+
title: string;
|
6
|
+
breadcrumbClickable: boolean;
|
7
|
+
buttonSettings: {
|
8
|
+
previous: boolean;
|
9
|
+
cancel: boolean;
|
10
|
+
next: boolean;
|
11
|
+
};
|
12
|
+
collapsible: boolean;
|
13
|
+
tableView: boolean;
|
14
|
+
key: string;
|
15
|
+
type: string;
|
16
|
+
label: string;
|
17
|
+
input: boolean;
|
18
|
+
components: {
|
19
|
+
label: string;
|
20
|
+
tableView: boolean;
|
21
|
+
rowDrafts: boolean;
|
22
|
+
key: string;
|
23
|
+
type: string;
|
24
|
+
input: boolean;
|
25
|
+
components: {
|
26
|
+
label: string;
|
27
|
+
tableView: boolean;
|
28
|
+
key: string;
|
29
|
+
type: string;
|
30
|
+
input: boolean;
|
31
|
+
alwaysEnabled: boolean;
|
32
|
+
}[];
|
33
|
+
alwaysEnabled: boolean;
|
34
|
+
}[];
|
35
|
+
alwaysEnabled: boolean;
|
36
|
+
showValidations?: undefined;
|
37
|
+
} | {
|
38
|
+
label: string;
|
39
|
+
showValidations: boolean;
|
40
|
+
alwaysEnabled: boolean;
|
41
|
+
tableView: boolean;
|
42
|
+
key: string;
|
43
|
+
type: string;
|
44
|
+
input: boolean;
|
45
|
+
title?: undefined;
|
46
|
+
breadcrumbClickable?: undefined;
|
47
|
+
buttonSettings?: undefined;
|
48
|
+
collapsible?: undefined;
|
49
|
+
components?: undefined;
|
50
|
+
})[];
|
51
|
+
}
|
52
|
+
export default _default;
|