@formio/js 5.0.0-dev.5688.9b6200e → 5.0.0-dev.5695.024ad9c
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 +13 -1
- package/dist/formio.form.js +5 -5
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +6 -6
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.js +1 -1
- package/dist/formio.min.js +1 -1
- package/lib/cjs/components/_classes/component/Component.js +4 -0
- package/lib/cjs/components/_classes/component/fixtures/comp7.d.ts +84 -0
- package/lib/cjs/components/_classes/component/fixtures/comp7.js +86 -0
- package/lib/cjs/components/_classes/component/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/_classes/component/fixtures/index.js +3 -1
- package/lib/cjs/components/address/Address.js +4 -0
- package/lib/cjs/components/address/editForm/Address.edit.provider.js +1 -1
- package/lib/cjs/components/datagrid/DataGrid.d.ts +9 -0
- package/lib/cjs/components/datagrid/DataGrid.js +50 -32
- 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/editgrid/EditGrid.js +2 -2
- package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +5 -0
- package/lib/cjs/providers/address/GoogleAddressProvider.js +23 -1
- package/lib/mjs/components/_classes/component/Component.js +4 -0
- package/lib/mjs/components/_classes/component/fixtures/comp7.d.ts +84 -0
- package/lib/mjs/components/_classes/component/fixtures/comp7.js +84 -0
- package/lib/mjs/components/_classes/component/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/_classes/component/fixtures/index.js +2 -1
- package/lib/mjs/components/address/Address.js +4 -0
- package/lib/mjs/components/address/editForm/Address.edit.provider.js +1 -1
- package/lib/mjs/components/datagrid/DataGrid.d.ts +9 -0
- package/lib/mjs/components/datagrid/DataGrid.js +50 -32
- 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/editgrid/EditGrid.js +2 -2
- package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +5 -0
- package/lib/mjs/providers/address/GoogleAddressProvider.js +22 -1
- package/package.json +1 -1
|
@@ -8,6 +8,9 @@ exports.GoogleAddressProvider = void 0;
|
|
|
8
8
|
const Formio_1 = require("../../Formio");
|
|
9
9
|
const lodash_1 = __importDefault(require("lodash"));
|
|
10
10
|
const AddressProvider_1 = require("./AddressProvider");
|
|
11
|
+
const GOOGLE_MAPS_BASE_URL = 'https://maps.googleapis.com';
|
|
12
|
+
const GOOGLE_MAPS_JS_URL = `${GOOGLE_MAPS_BASE_URL}/maps/api/js`;
|
|
13
|
+
const GOOGLE_MAPS_JS_WITH_PARAMS_URL = `${GOOGLE_MAPS_JS_URL}?v=quarterly&libraries=places&loading=async&callback=googleMapsCallback`;
|
|
11
14
|
/**
|
|
12
15
|
* @typedef {object} AutocompleteOptions
|
|
13
16
|
* @property {string[]} fields - The fields to include in the autocomplete response.
|
|
@@ -55,10 +58,11 @@ class GoogleAddressProvider extends AddressProvider_1.AddressProvider {
|
|
|
55
58
|
var _a;
|
|
56
59
|
super(options);
|
|
57
60
|
this.setAutocompleteOptions();
|
|
58
|
-
let src =
|
|
61
|
+
let src = GOOGLE_MAPS_JS_WITH_PARAMS_URL;
|
|
59
62
|
if ((_a = options.params) === null || _a === void 0 ? void 0 : _a.key) {
|
|
60
63
|
src += `&key=${options.params.key}`;
|
|
61
64
|
}
|
|
65
|
+
this.tryRemoveLibrary(options);
|
|
62
66
|
Formio_1.Formio.requireLibrary(this.getLibraryName(), 'google.maps.places', src);
|
|
63
67
|
}
|
|
64
68
|
/**
|
|
@@ -185,5 +189,23 @@ class GoogleAddressProvider extends AddressProvider_1.AddressProvider {
|
|
|
185
189
|
: this.alternativeDisplayValueProperty;
|
|
186
190
|
return lodash_1.default.get(address, displayedProperty, '');
|
|
187
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Tries to remove the library if api key for loaded script is different.
|
|
194
|
+
* @param {ProviderOptions} options - The options for the provider.
|
|
195
|
+
*/
|
|
196
|
+
tryRemoveLibrary(options = {}) {
|
|
197
|
+
var _a, _b, _c;
|
|
198
|
+
if (!Formio_1.Formio.libraries[this.getLibraryName()]) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const existingScript = document.querySelector(`script[src^="${GOOGLE_MAPS_JS_URL}"]`);
|
|
202
|
+
if (existingScript && ((_a = options.params) === null || _a === void 0 ? void 0 : _a.key) && !existingScript.attributes.src.value.endsWith(options.params.key)) {
|
|
203
|
+
const googleMapsScripts = (_b = document.querySelectorAll(`script[src^="${GOOGLE_MAPS_BASE_URL}"]`)) !== null && _b !== void 0 ? _b : [];
|
|
204
|
+
googleMapsScripts.forEach(script => script.parentNode.removeChild(script));
|
|
205
|
+
delete Formio_1.Formio.libraries[this.getLibraryName()];
|
|
206
|
+
(_c = global === null || global === void 0 ? void 0 : global.google) === null || _c === void 0 ? true : delete _c.maps;
|
|
207
|
+
delete global[`${this.getLibraryName()}Callback`];
|
|
208
|
+
}
|
|
209
|
+
}
|
|
188
210
|
}
|
|
189
211
|
exports.GoogleAddressProvider = GoogleAddressProvider;
|
|
@@ -3361,6 +3361,10 @@ export default class Component extends Element {
|
|
|
3361
3361
|
const disabled = this.shouldDisabled;
|
|
3362
3362
|
// Change states which won't be recalculated during redrawing
|
|
3363
3363
|
if (this.visible !== visible) {
|
|
3364
|
+
// If the logic is triggered by an event and the action sets the hidden state then the original
|
|
3365
|
+
// component definition must be changed so that the components hidden state does not get flipped back by
|
|
3366
|
+
// the fieldLogic function
|
|
3367
|
+
this.originalComponent.hidden = !visible;
|
|
3364
3368
|
this.visible = visible;
|
|
3365
3369
|
}
|
|
3366
3370
|
if (this.disabled !== disabled) {
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let components: ({
|
|
3
|
+
label: string;
|
|
4
|
+
action: string;
|
|
5
|
+
showValidations: boolean;
|
|
6
|
+
tableView: boolean;
|
|
7
|
+
key: string;
|
|
8
|
+
type: string;
|
|
9
|
+
event: string;
|
|
10
|
+
input: boolean;
|
|
11
|
+
theme?: undefined;
|
|
12
|
+
collapsible?: undefined;
|
|
13
|
+
hidden?: undefined;
|
|
14
|
+
logic?: undefined;
|
|
15
|
+
collapsed?: undefined;
|
|
16
|
+
components?: undefined;
|
|
17
|
+
applyMaskOn?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
label: string;
|
|
20
|
+
action: string;
|
|
21
|
+
showValidations: boolean;
|
|
22
|
+
theme: string;
|
|
23
|
+
tableView: boolean;
|
|
24
|
+
key: string;
|
|
25
|
+
type: string;
|
|
26
|
+
event: string;
|
|
27
|
+
input: boolean;
|
|
28
|
+
collapsible?: undefined;
|
|
29
|
+
hidden?: undefined;
|
|
30
|
+
logic?: undefined;
|
|
31
|
+
collapsed?: undefined;
|
|
32
|
+
components?: undefined;
|
|
33
|
+
applyMaskOn?: undefined;
|
|
34
|
+
} | {
|
|
35
|
+
collapsible: boolean;
|
|
36
|
+
hidden: boolean;
|
|
37
|
+
key: string;
|
|
38
|
+
logic: {
|
|
39
|
+
name: string;
|
|
40
|
+
trigger: {
|
|
41
|
+
type: string;
|
|
42
|
+
event: string;
|
|
43
|
+
};
|
|
44
|
+
actions: {
|
|
45
|
+
name: string;
|
|
46
|
+
type: string;
|
|
47
|
+
property: {
|
|
48
|
+
label: string;
|
|
49
|
+
value: string;
|
|
50
|
+
type: string;
|
|
51
|
+
};
|
|
52
|
+
state: boolean;
|
|
53
|
+
}[];
|
|
54
|
+
}[];
|
|
55
|
+
type: string;
|
|
56
|
+
label: string;
|
|
57
|
+
collapsed: boolean;
|
|
58
|
+
input: boolean;
|
|
59
|
+
tableView: boolean;
|
|
60
|
+
components: never[];
|
|
61
|
+
action?: undefined;
|
|
62
|
+
showValidations?: undefined;
|
|
63
|
+
event?: undefined;
|
|
64
|
+
theme?: undefined;
|
|
65
|
+
applyMaskOn?: undefined;
|
|
66
|
+
} | {
|
|
67
|
+
label: string;
|
|
68
|
+
applyMaskOn: string;
|
|
69
|
+
tableView: boolean;
|
|
70
|
+
key: string;
|
|
71
|
+
type: string;
|
|
72
|
+
input: boolean;
|
|
73
|
+
action?: undefined;
|
|
74
|
+
showValidations?: undefined;
|
|
75
|
+
event?: undefined;
|
|
76
|
+
theme?: undefined;
|
|
77
|
+
collapsible?: undefined;
|
|
78
|
+
hidden?: undefined;
|
|
79
|
+
logic?: undefined;
|
|
80
|
+
collapsed?: undefined;
|
|
81
|
+
components?: undefined;
|
|
82
|
+
})[];
|
|
83
|
+
}
|
|
84
|
+
export default _default;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
components: [
|
|
3
|
+
{
|
|
4
|
+
"label": "Show",
|
|
5
|
+
"action": "event",
|
|
6
|
+
"showValidations": false,
|
|
7
|
+
"tableView": false,
|
|
8
|
+
"key": "show",
|
|
9
|
+
"type": "button",
|
|
10
|
+
"event": "show",
|
|
11
|
+
"input": true
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"label": "Hide",
|
|
15
|
+
"action": "event",
|
|
16
|
+
"showValidations": false,
|
|
17
|
+
"theme": "danger",
|
|
18
|
+
"tableView": false,
|
|
19
|
+
"key": "hide",
|
|
20
|
+
"type": "button",
|
|
21
|
+
"event": "hide",
|
|
22
|
+
"input": true
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"collapsible": true,
|
|
26
|
+
"hidden": true,
|
|
27
|
+
"key": "panel",
|
|
28
|
+
"logic": [
|
|
29
|
+
{
|
|
30
|
+
"name": "ShowPanel",
|
|
31
|
+
"trigger": {
|
|
32
|
+
"type": "event",
|
|
33
|
+
"event": "show"
|
|
34
|
+
},
|
|
35
|
+
"actions": [
|
|
36
|
+
{
|
|
37
|
+
"name": "Show",
|
|
38
|
+
"type": "property",
|
|
39
|
+
"property": {
|
|
40
|
+
"label": "Hidden",
|
|
41
|
+
"value": "hidden",
|
|
42
|
+
"type": "boolean"
|
|
43
|
+
},
|
|
44
|
+
"state": false
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "HidePanel",
|
|
50
|
+
"trigger": {
|
|
51
|
+
"type": "event",
|
|
52
|
+
"event": "hide"
|
|
53
|
+
},
|
|
54
|
+
"actions": [
|
|
55
|
+
{
|
|
56
|
+
"name": "Hide",
|
|
57
|
+
"type": "property",
|
|
58
|
+
"property": {
|
|
59
|
+
"label": "Hidden",
|
|
60
|
+
"value": "hidden",
|
|
61
|
+
"type": "boolean"
|
|
62
|
+
},
|
|
63
|
+
"state": true
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"type": "panel",
|
|
69
|
+
"label": "Panel",
|
|
70
|
+
"collapsed": false,
|
|
71
|
+
"input": false,
|
|
72
|
+
"tableView": false,
|
|
73
|
+
"components": []
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"label": "Text Field",
|
|
77
|
+
"applyMaskOn": "change",
|
|
78
|
+
"tableView": true,
|
|
79
|
+
"key": "textField1",
|
|
80
|
+
"type": "textfield",
|
|
81
|
+
"input": true
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
};
|
|
@@ -107,6 +107,10 @@ export default class AddressComponent extends ContainerComponent {
|
|
|
107
107
|
if (!this.builderMode) {
|
|
108
108
|
if (this.component.provider) {
|
|
109
109
|
const { provider, providerOptions, } = this.component;
|
|
110
|
+
if (_.get(providerOptions, 'params.subscriptionKey')) {
|
|
111
|
+
_.set(providerOptions, "params['subscription-key']", _.get(providerOptions, 'params.subscriptionKey'));
|
|
112
|
+
_.unset(providerOptions, 'params.subscriptionKey');
|
|
113
|
+
}
|
|
110
114
|
this.provider = this.initializeProvider(provider, providerOptions);
|
|
111
115
|
}
|
|
112
116
|
else if (this.component.map) {
|
|
@@ -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;
|
|
@@ -2,6 +2,7 @@ import _ from 'lodash';
|
|
|
2
2
|
import NestedArrayComponent from '../_classes/nestedarray/NestedArrayComponent';
|
|
3
3
|
import { fastCloneDeep, getFocusableElements } from '../../utils/utils';
|
|
4
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,12 @@ 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
|
-
//
|
|
350
|
-
|
|
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);
|
|
366
|
+
// When components are reordered we need to set the dataGrid and form pristine properties to false
|
|
367
|
+
this.root.pristine = false;
|
|
368
|
+
this.pristine = false;
|
|
351
369
|
//need to re-build rows to re-calculate indexes and other indexed fields for component instance (like rows for ex.)
|
|
352
370
|
this.setValue(dataValue, { isReordered: true });
|
|
353
371
|
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 };
|
|
@@ -83,7 +83,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
83
83
|
{% if (!instance.options.readOnly && !instance.disabled) { %}
|
|
84
84
|
<div class="col-sm-2">
|
|
85
85
|
<div class="btn-group pull-right">
|
|
86
|
-
<button class="btn btn-default btn-light btn-sm editRow"><i class="{{ iconClass('
|
|
86
|
+
<button class="btn btn-default btn-light btn-sm editRow"><i class="{{ iconClass('edit') }}"></i></button>
|
|
87
87
|
{% if (!instance.hasRemoveButtons || instance.hasRemoveButtons()) { %}
|
|
88
88
|
<button class="btn btn-danger btn-sm removeRow"><i class="{{ iconClass('trash') }}"></i></button>
|
|
89
89
|
{% } %}
|
|
@@ -104,7 +104,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
104
104
|
{% if (!instance.options.readOnly && !instance.disabled) { %}
|
|
105
105
|
<td class="editgrid-table-column">
|
|
106
106
|
<div class="btn-group">
|
|
107
|
-
<button class="btn btn-default btn-light btn-sm editRow" aria-label="{{ t('Edit row') }}"><i class="{{ iconClass('
|
|
107
|
+
<button class="btn btn-default btn-light btn-sm editRow" aria-label="{{ t('Edit row') }}"><i class="{{ iconClass('edit') }}"></i></button>
|
|
108
108
|
{% if (!instance.hasRemoveButtons || instance.hasRemoveButtons()) { %}
|
|
109
109
|
<button class="btn btn-danger btn-sm removeRow" aria-label="{{ t('Remove row') }}"><i class="{{ iconClass('trash') }}"></i></button>
|
|
110
110
|
{% } %}
|