@formio/js 5.0.0-rc.67 → 5.0.0-rc.68
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/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 +5 -5
- 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 +5 -5
- 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 +2 -2
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- 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/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/package.json +2 -2
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
/*! @license DOMPurify 3.1.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.5/LICENSE */
|
22
22
|
|
23
|
-
/*! formiojs v5.0.0-rc.
|
23
|
+
/*! formiojs v5.0.0-rc.68 | https://unpkg.com/formiojs@5.0.0-rc.68/LICENSE.txt */
|
24
24
|
|
25
25
|
/**
|
26
26
|
* @license
|
@@ -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;
|
@@ -6,7 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
7
7
|
const NestedArrayComponent_1 = __importDefault(require("../_classes/nestedarray/NestedArrayComponent"));
|
8
8
|
const utils_1 = require("../../utils/utils");
|
9
|
-
const Components_1 = require("../Components");
|
9
|
+
const Components_1 = __importDefault(require("../Components"));
|
10
|
+
const dragula_1 = __importDefault(require("dragula"));
|
10
11
|
class DataGridComponent extends NestedArrayComponent_1.default {
|
11
12
|
static schema(...extend) {
|
12
13
|
return NestedArrayComponent_1.default.schema({
|
@@ -281,34 +282,32 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
281
282
|
this.refs[`${this.datagridKey}-row`].forEach((row, index) => {
|
282
283
|
row.dragInfo = { index };
|
283
284
|
});
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
return clickedElement.classList.contains('formio-drag-button');
|
292
|
-
}
|
293
|
-
}
|
294
|
-
}).on('drop', this.onReorder.bind(this));
|
295
|
-
this.dragula.on('cloned', (el, original) => {
|
296
|
-
if (el && el.children && original && original.children) {
|
297
|
-
lodash_1.default.each(original.children, (child, index) => {
|
298
|
-
const styles = getComputedStyle(child, null);
|
299
|
-
if (styles.cssText !== '') {
|
300
|
-
el.children[index].style.cssText = styles.cssText;
|
301
|
-
}
|
302
|
-
else {
|
303
|
-
const cssText = Object.values(styles).reduce((css, propertyName) => {
|
304
|
-
return `${css}${propertyName}:${styles.getPropertyValue(propertyName)};`;
|
305
|
-
}, '');
|
306
|
-
el.children[index].style.cssText = cssText;
|
307
|
-
}
|
308
|
-
});
|
285
|
+
this.dragula = (0, dragula_1.default)([this.refs[`${this.datagridKey}-tbody`]], {
|
286
|
+
moves: (_draggedElement, _oldParent, clickedElement) => {
|
287
|
+
const clickedElementKey = clickedElement.getAttribute('data-key');
|
288
|
+
const oldParentKey = _oldParent.getAttribute('data-key');
|
289
|
+
//Check if the clicked button belongs to that container, if false, it belongs to the nested container
|
290
|
+
if (oldParentKey === clickedElementKey) {
|
291
|
+
return clickedElement.classList.contains('formio-drag-button');
|
309
292
|
}
|
310
|
-
}
|
311
|
-
}
|
293
|
+
}
|
294
|
+
}).on('drop', this.onReorder.bind(this));
|
295
|
+
this.dragula.on('cloned', (el, original) => {
|
296
|
+
if (el && el.children && original && original.children) {
|
297
|
+
lodash_1.default.each(original.children, (child, index) => {
|
298
|
+
const styles = getComputedStyle(child, null);
|
299
|
+
if (styles.cssText !== '') {
|
300
|
+
el.children[index].style.cssText = styles.cssText;
|
301
|
+
}
|
302
|
+
else {
|
303
|
+
const cssText = Object.values(styles).reduce((css, propertyName) => {
|
304
|
+
return `${css}${propertyName}:${styles.getPropertyValue(propertyName)};`;
|
305
|
+
}, '');
|
306
|
+
el.children[index].style.cssText = cssText;
|
307
|
+
}
|
308
|
+
});
|
309
|
+
}
|
310
|
+
});
|
312
311
|
}
|
313
312
|
this.refs[`${this.datagridKey}-addRow`].forEach((addButton) => {
|
314
313
|
this.addEventListener(addButton, 'click', this.addRow.bind(this));
|
@@ -336,6 +335,24 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
336
335
|
getComponentsContainer() {
|
337
336
|
return this.component.components;
|
338
337
|
}
|
338
|
+
/**
|
339
|
+
* Reorder values in array based on the old and new position
|
340
|
+
* @param {any} valuesArr - An array of values.
|
341
|
+
* @param {number} oldPosition - The index of the value in array before reordering.
|
342
|
+
* @param {number} newPosition - The index of the value in array after reordering.
|
343
|
+
* @param {boolean|any} movedBelow - Whether or not the value is moved below.
|
344
|
+
* @returns {void}
|
345
|
+
*/
|
346
|
+
reorderValues(valuesArr, oldPosition, newPosition, movedBelow) {
|
347
|
+
if (!lodash_1.default.isArray(valuesArr) || lodash_1.default.isEmpty(valuesArr)) {
|
348
|
+
return;
|
349
|
+
}
|
350
|
+
const draggedRowData = valuesArr[oldPosition];
|
351
|
+
//insert element at new position
|
352
|
+
valuesArr.splice(newPosition, 0, draggedRowData);
|
353
|
+
//remove element from old position (if was moved above, after insertion it's at +1 index)
|
354
|
+
valuesArr.splice(movedBelow ? oldPosition : oldPosition + 1, 1);
|
355
|
+
}
|
339
356
|
onReorder(element, _target, _source, sibling) {
|
340
357
|
if (!element.dragInfo || (sibling && !sibling.dragInfo)) {
|
341
358
|
console.warn('There is no Drag Info available for either dragged or sibling element');
|
@@ -346,11 +363,9 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
346
363
|
const newPosition = sibling ? sibling.dragInfo.index : this.dataValue.length;
|
347
364
|
const movedBelow = newPosition > oldPosition;
|
348
365
|
const dataValue = (0, utils_1.fastCloneDeep)(this.dataValue);
|
349
|
-
|
350
|
-
//
|
351
|
-
|
352
|
-
//remove element from old position (if was moved above, after insertion it's at +1 index)
|
353
|
-
dataValue.splice(movedBelow ? oldPosition : oldPosition + 1, 1);
|
366
|
+
this.reorderValues(dataValue, oldPosition, newPosition, movedBelow);
|
367
|
+
//reorder select data
|
368
|
+
this.reorderValues(lodash_1.default.get(this.root, `submission.metadata.selectData.${this.path}`, []), oldPosition, newPosition, movedBelow);
|
354
369
|
//need to re-build rows to re-calculate indexes and other indexed fields for component instance (like rows for ex.)
|
355
370
|
this.setValue(dataValue, { isReordered: true });
|
356
371
|
this.rebuild();
|
@@ -404,7 +419,7 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
404
419
|
}
|
405
420
|
component.rowIndex = rowIndex;
|
406
421
|
component.row = `${rowIndex}-${colIndex}`;
|
407
|
-
component.path = Components_1.
|
422
|
+
component.path = Components_1.default.getComponentPath(component);
|
408
423
|
});
|
409
424
|
}
|
410
425
|
updateRowsComponents(rowIndex) {
|
@@ -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,139 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const form = {
|
4
|
+
_id: '66742f4146717b98a9fa280f',
|
5
|
+
title: 'test reorder',
|
6
|
+
name: 'testReorder',
|
7
|
+
path: 'testreorder',
|
8
|
+
type: 'form',
|
9
|
+
display: 'form',
|
10
|
+
components: [
|
11
|
+
{
|
12
|
+
label: 'Data Grid',
|
13
|
+
reorder: true,
|
14
|
+
addAnotherPosition: 'bottom',
|
15
|
+
layoutFixed: false,
|
16
|
+
enableRowGroups: false,
|
17
|
+
initEmpty: false,
|
18
|
+
tableView: false,
|
19
|
+
defaultValue: [
|
20
|
+
{
|
21
|
+
select: '',
|
22
|
+
},
|
23
|
+
],
|
24
|
+
key: 'dataGrid',
|
25
|
+
type: 'datagrid',
|
26
|
+
input: true,
|
27
|
+
components: [
|
28
|
+
{
|
29
|
+
label: 'Select',
|
30
|
+
widget: 'choicesjs',
|
31
|
+
tableView: true,
|
32
|
+
dataSrc: 'resource',
|
33
|
+
data: {
|
34
|
+
resource: '66742ee946717b98a9fa1b0b',
|
35
|
+
},
|
36
|
+
dataType: 'string',
|
37
|
+
valueProperty: 'data.textField',
|
38
|
+
template: '<span>{{ item.data.number }}</span>',
|
39
|
+
validate: {
|
40
|
+
select: false,
|
41
|
+
},
|
42
|
+
key: 'select',
|
43
|
+
type: 'select',
|
44
|
+
searchField: 'data.textField__regex',
|
45
|
+
limit: 10,
|
46
|
+
noRefreshOnScroll: false,
|
47
|
+
addResource: false,
|
48
|
+
reference: false,
|
49
|
+
input: true,
|
50
|
+
},
|
51
|
+
],
|
52
|
+
},
|
53
|
+
{
|
54
|
+
type: 'button',
|
55
|
+
label: 'Submit',
|
56
|
+
key: 'submit',
|
57
|
+
disableOnInvalid: true,
|
58
|
+
input: true,
|
59
|
+
tableView: false,
|
60
|
+
},
|
61
|
+
],
|
62
|
+
created: '2024-06-20T13:31:45.177Z',
|
63
|
+
modified: '2024-06-25T10:32:46.577Z',
|
64
|
+
machineName: 'tifwklexhyrgxbr:testReorder',
|
65
|
+
};
|
66
|
+
const submission = {
|
67
|
+
form: '66742f4146717b98a9fa280f',
|
68
|
+
metadata: {
|
69
|
+
selectData: {
|
70
|
+
dataGrid: [
|
71
|
+
{
|
72
|
+
select: {
|
73
|
+
data: {
|
74
|
+
number: 1,
|
75
|
+
},
|
76
|
+
},
|
77
|
+
},
|
78
|
+
{
|
79
|
+
select: {
|
80
|
+
data: {
|
81
|
+
number: 2,
|
82
|
+
},
|
83
|
+
},
|
84
|
+
},
|
85
|
+
{
|
86
|
+
select: {
|
87
|
+
data: {
|
88
|
+
number: 3,
|
89
|
+
},
|
90
|
+
},
|
91
|
+
},
|
92
|
+
{
|
93
|
+
select: {
|
94
|
+
data: {
|
95
|
+
number: 4,
|
96
|
+
},
|
97
|
+
},
|
98
|
+
},
|
99
|
+
{
|
100
|
+
select: {
|
101
|
+
data: {
|
102
|
+
number: 5,
|
103
|
+
},
|
104
|
+
},
|
105
|
+
},
|
106
|
+
],
|
107
|
+
},
|
108
|
+
},
|
109
|
+
data: {
|
110
|
+
dataGrid: [
|
111
|
+
{
|
112
|
+
select: '11',
|
113
|
+
},
|
114
|
+
{
|
115
|
+
select: '22',
|
116
|
+
},
|
117
|
+
{
|
118
|
+
select: '33',
|
119
|
+
},
|
120
|
+
{
|
121
|
+
select: '44',
|
122
|
+
},
|
123
|
+
{
|
124
|
+
select: '55',
|
125
|
+
},
|
126
|
+
],
|
127
|
+
dataTable: [],
|
128
|
+
submit: true,
|
129
|
+
},
|
130
|
+
_id: '667ab5ee6a69739703d30def',
|
131
|
+
project: '65df46bc93bcfaa231f3db1c',
|
132
|
+
state: 'submitted',
|
133
|
+
created: '2024-06-25T12:19:58.626Z',
|
134
|
+
modified: '2024-06-25T12:19:58.627Z',
|
135
|
+
};
|
136
|
+
exports.default = {
|
137
|
+
form,
|
138
|
+
submission,
|
139
|
+
};
|
@@ -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 };
|
@@ -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.withCheckboxes = 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;
|
6
|
+
exports.withReorder = exports.withCheckboxes = 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"));
|
@@ -40,3 +40,5 @@ const two_comp_with_allow_calculate_override_1 = __importDefault(require("./two-
|
|
40
40
|
exports.twoWithAllowCalculatedOverride = two_comp_with_allow_calculate_override_1.default;
|
41
41
|
const comp_with_checkboxes_1 = __importDefault(require("./comp-with-checkboxes"));
|
42
42
|
exports.withCheckboxes = comp_with_checkboxes_1.default;
|
43
|
+
const comp_with_reorder_1 = __importDefault(require("./comp-with-reorder"));
|
44
|
+
exports.withReorder = comp_with_reorder_1.default;
|
@@ -8,7 +8,7 @@ const DataGrid_1 = __importDefault(require("../datagrid/DataGrid"));
|
|
8
8
|
const lodash_1 = __importDefault(require("lodash"));
|
9
9
|
const eventemitter3_1 = __importDefault(require("eventemitter3"));
|
10
10
|
const utils_1 = require("../../utils/utils");
|
11
|
-
const Components_1 = require("../Components");
|
11
|
+
const Components_1 = __importDefault(require("../Components"));
|
12
12
|
class DataMapComponent extends DataGrid_1.default {
|
13
13
|
static schema(...extend) {
|
14
14
|
return Component_1.default.schema({
|
@@ -241,7 +241,7 @@ class DataMapComponent extends DataGrid_1.default {
|
|
241
241
|
delete dataValue[key];
|
242
242
|
const comp = components[this.valueKey];
|
243
243
|
comp.component.key = newKey;
|
244
|
-
comp.path = Components_1.
|
244
|
+
comp.path = Components_1.default.calculateComponentPath(comp);
|
245
245
|
key = newKey;
|
246
246
|
});
|
247
247
|
const valueComponent = lodash_1.default.clone(this.component.valueComponent);
|
@@ -1091,7 +1091,8 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
1091
1091
|
return false;
|
1092
1092
|
}
|
1093
1093
|
else if (rowsEditing && this.saveEditMode && !this.component.openWhenEmpty) {
|
1094
|
-
this.setCustomValidity(this.t(this.errorMessage('unsavedRowsError')), dirty);
|
1094
|
+
this._errors = this.setCustomValidity(this.t(this.errorMessage('unsavedRowsError')), dirty);
|
1095
|
+
errors.push(...this._errors);
|
1095
1096
|
return false;
|
1096
1097
|
}
|
1097
1098
|
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;
|
@@ -0,0 +1,71 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = {
|
4
|
+
type: 'form',
|
5
|
+
display: 'wizard',
|
6
|
+
components: [
|
7
|
+
{
|
8
|
+
title: 'Page 1',
|
9
|
+
breadcrumbClickable: true,
|
10
|
+
buttonSettings: {
|
11
|
+
previous: true,
|
12
|
+
cancel: true,
|
13
|
+
next: true
|
14
|
+
},
|
15
|
+
collapsible: false,
|
16
|
+
tableView: false,
|
17
|
+
key: 'page3',
|
18
|
+
type: 'panel',
|
19
|
+
label: 'Page 2',
|
20
|
+
input: false,
|
21
|
+
components: [
|
22
|
+
{
|
23
|
+
label: 'Edit Grid',
|
24
|
+
tableView: true,
|
25
|
+
rowDrafts: false,
|
26
|
+
key: 'editGrid',
|
27
|
+
type: 'editgrid',
|
28
|
+
input: true,
|
29
|
+
components: [
|
30
|
+
{
|
31
|
+
label: 'Text Field',
|
32
|
+
tableView: true,
|
33
|
+
key: 'textField',
|
34
|
+
type: 'textfield',
|
35
|
+
input: true,
|
36
|
+
alwaysEnabled: false
|
37
|
+
}
|
38
|
+
],
|
39
|
+
alwaysEnabled: false
|
40
|
+
}
|
41
|
+
],
|
42
|
+
alwaysEnabled: false
|
43
|
+
},
|
44
|
+
{
|
45
|
+
title: 'Page 2',
|
46
|
+
breadcrumbClickable: true,
|
47
|
+
buttonSettings: {
|
48
|
+
previous: true,
|
49
|
+
cancel: true,
|
50
|
+
next: true
|
51
|
+
},
|
52
|
+
collapsible: false,
|
53
|
+
tableView: false,
|
54
|
+
key: 'page2',
|
55
|
+
type: 'panel',
|
56
|
+
label: 'Page 1',
|
57
|
+
input: false,
|
58
|
+
alwaysEnabled: false,
|
59
|
+
components: []
|
60
|
+
},
|
61
|
+
{
|
62
|
+
label: 'Submit',
|
63
|
+
showValidations: false,
|
64
|
+
alwaysEnabled: false,
|
65
|
+
tableView: false,
|
66
|
+
key: 'submit',
|
67
|
+
type: 'button',
|
68
|
+
input: true
|
69
|
+
}
|
70
|
+
]
|
71
|
+
};
|
@@ -7,6 +7,7 @@ import comp12 from './comp12';
|
|
7
7
|
import comp13 from './comp13';
|
8
8
|
import comp14 from './comp14';
|
9
9
|
import comp15 from './comp15';
|
10
|
+
import comp16 from './comp16';
|
10
11
|
import comp4 from './comp4';
|
11
12
|
import comp5 from './comp5';
|
12
13
|
import comp6 from './comp6';
|
@@ -16,4 +17,4 @@ import comp9 from './comp9';
|
|
16
17
|
import compOpenWhenEmpty from './comp-openWhenEmpty';
|
17
18
|
import withOpenWhenEmptyAndConditions from './comp-with-conditions-and-openWhenEmpty';
|
18
19
|
import compWithCustomDefaultValue from './comp-with-custom-default-value';
|
19
|
-
export { comp1, comp2, comp3, comp10, comp11, comp12, comp13, comp14, comp15, comp4, comp5, comp6, comp7, comp8, comp9, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue };
|
20
|
+
export { comp1, comp2, comp3, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp4, comp5, comp6, comp7, comp8, comp9, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue };
|
@@ -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.compWithCustomDefaultValue = exports.withOpenWhenEmptyAndConditions = exports.compOpenWhenEmpty = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp15 = exports.comp14 = exports.comp13 = exports.comp12 = exports.comp11 = exports.comp10 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
6
|
+
exports.compWithCustomDefaultValue = exports.withOpenWhenEmptyAndConditions = exports.compOpenWhenEmpty = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp16 = exports.comp15 = exports.comp14 = exports.comp13 = exports.comp12 = exports.comp11 = exports.comp10 = 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"));
|
@@ -34,6 +34,8 @@ const comp14_1 = __importDefault(require("./comp14"));
|
|
34
34
|
exports.comp14 = comp14_1.default;
|
35
35
|
const comp15_1 = __importDefault(require("./comp15"));
|
36
36
|
exports.comp15 = comp15_1.default;
|
37
|
+
const comp16_1 = __importDefault(require("./comp16"));
|
38
|
+
exports.comp16 = comp16_1.default;
|
37
39
|
const comp_with_conditions_and_openWhenEmpty_1 = __importDefault(require("./comp-with-conditions-and-openWhenEmpty"));
|
38
40
|
exports.withOpenWhenEmptyAndConditions = comp_with_conditions_and_openWhenEmpty_1.default;
|
39
41
|
const comp_openWhenEmpty_1 = __importDefault(require("./comp-openWhenEmpty"));
|
@@ -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;
|