@formio/js 5.0.0-dev.5692.a9fe9c4 → 5.0.0-dev.5696.7642331
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 +14 -0
- 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.form.css +0 -1
- package/dist/formio.form.js +69 -125
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.css +0 -1
- package/dist/formio.full.js +51 -31
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.js +2 -2
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +57 -17
- package/dist/formio.utils.min.js +1 -1
- package/lib/cjs/CDN.d.ts +1 -0
- package/lib/cjs/CDN.js +1 -0
- package/lib/cjs/Webform.js +1 -3
- package/lib/cjs/components/_classes/component/Component.d.ts +1 -0
- package/lib/cjs/components/_classes/component/Component.js +18 -0
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +2 -1
- package/lib/cjs/components/_classes/nested/NestedComponent.js +4 -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/checkbox/Checkbox.d.ts +1 -1
- package/lib/cjs/components/checkbox/Checkbox.js +1 -1
- package/lib/cjs/components/checkbox/fixtures/comp6.d.ts +32 -0
- package/lib/cjs/components/checkbox/fixtures/comp6.js +30 -0
- package/lib/cjs/components/checkbox/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/checkbox/fixtures/index.js +3 -1
- package/lib/cjs/components/currency/Currency.d.ts +2 -0
- package/lib/cjs/components/datagrid/DataGrid.d.ts +2 -0
- package/lib/cjs/components/datagrid/DataGrid.js +38 -26
- package/lib/cjs/components/datagrid/fixtures/comp10.d.ts +81 -0
- package/lib/cjs/components/datagrid/fixtures/comp10.js +87 -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/day/fixtures/comp8.d.ts +41 -0
- package/lib/cjs/components/day/fixtures/comp8.js +40 -0
- package/lib/cjs/components/day/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/day/fixtures/index.js +3 -1
- package/lib/cjs/components/editgrid/EditGrid.js +12 -1
- package/lib/cjs/components/editgrid/fixtures/comp-test-events.d.ts +54 -0
- package/lib/cjs/components/editgrid/fixtures/comp-test-events.js +54 -0
- 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 +3 -1
- package/lib/cjs/components/editgrid/fixtures/index.js +5 -1
- package/lib/cjs/components/number/Number.d.ts +17 -2
- package/lib/cjs/components/number/Number.js +26 -6
- package/lib/cjs/components/number/fixtures/comp10.d.ts +18 -0
- package/lib/cjs/components/number/fixtures/comp10.js +21 -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/cjs/components/radio/Radio.js +7 -6
- package/lib/cjs/components/radio/fixtures/comp12.d.ts +29 -0
- package/lib/cjs/components/radio/fixtures/comp12.js +36 -0
- package/lib/cjs/components/radio/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/radio/fixtures/index.js +3 -1
- package/lib/cjs/components/time/Time.d.ts +2 -2
- package/lib/cjs/components/time/Time.js +3 -2
- package/lib/cjs/components/time/fixtures/comp4.d.ts +166 -0
- package/lib/cjs/components/time/fixtures/comp4.js +171 -0
- package/lib/cjs/components/time/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/time/fixtures/index.js +3 -1
- package/lib/cjs/translations/en.d.ts +3 -0
- package/lib/cjs/translations/en.js +4 -1
- 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 +1 -10
- package/lib/cjs/utils/utils.js +59 -7
- package/lib/mjs/CDN.d.ts +1 -0
- package/lib/mjs/CDN.js +1 -0
- package/lib/mjs/Webform.js +1 -3
- package/lib/mjs/components/_classes/component/Component.d.ts +1 -0
- package/lib/mjs/components/_classes/component/Component.js +7 -0
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +2 -1
- package/lib/mjs/components/_classes/nested/NestedComponent.js +4 -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/checkbox/Checkbox.d.ts +1 -1
- package/lib/mjs/components/checkbox/Checkbox.js +1 -1
- package/lib/mjs/components/checkbox/fixtures/comp6.d.ts +32 -0
- package/lib/mjs/components/checkbox/fixtures/comp6.js +28 -0
- package/lib/mjs/components/checkbox/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/checkbox/fixtures/index.js +2 -1
- package/lib/mjs/components/currency/Currency.d.ts +2 -0
- package/lib/mjs/components/datagrid/DataGrid.d.ts +2 -0
- package/lib/mjs/components/datagrid/DataGrid.js +37 -25
- package/lib/mjs/components/datagrid/fixtures/comp10.d.ts +81 -0
- package/lib/mjs/components/datagrid/fixtures/comp10.js +85 -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/day/fixtures/comp8.d.ts +41 -0
- package/lib/mjs/components/day/fixtures/comp8.js +38 -0
- package/lib/mjs/components/day/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/day/fixtures/index.js +2 -1
- package/lib/mjs/components/editgrid/EditGrid.js +12 -1
- package/lib/mjs/components/editgrid/fixtures/comp-test-events.d.ts +54 -0
- package/lib/mjs/components/editgrid/fixtures/comp-test-events.js +52 -0
- 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 +3 -1
- package/lib/mjs/components/editgrid/fixtures/index.js +3 -1
- package/lib/mjs/components/number/Number.d.ts +17 -2
- package/lib/mjs/components/number/Number.js +25 -5
- package/lib/mjs/components/number/fixtures/comp10.d.ts +18 -0
- package/lib/mjs/components/number/fixtures/comp10.js +19 -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/lib/mjs/components/radio/Radio.js +7 -6
- package/lib/mjs/components/radio/fixtures/comp12.d.ts +29 -0
- package/lib/mjs/components/radio/fixtures/comp12.js +34 -0
- package/lib/mjs/components/radio/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/radio/fixtures/index.js +2 -1
- package/lib/mjs/components/time/Time.d.ts +2 -2
- package/lib/mjs/components/time/Time.js +3 -2
- package/lib/mjs/components/time/fixtures/comp4.d.ts +166 -0
- package/lib/mjs/components/time/fixtures/comp4.js +169 -0
- package/lib/mjs/components/time/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/time/fixtures/index.js +2 -1
- package/lib/mjs/translations/en.d.ts +3 -0
- package/lib/mjs/translations/en.js +4 -1
- 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 +1 -10
- package/lib/mjs/utils/utils.js +58 -7
- package/package.json +2 -2
package/lib/mjs/Webform.js
CHANGED
|
@@ -12,7 +12,6 @@ import { eachComponent } from "./utils/formUtils";
|
|
|
12
12
|
if (typeof window !== 'undefined' && typeof window.global === 'undefined') {
|
|
13
13
|
window.global = window;
|
|
14
14
|
}
|
|
15
|
-
import dragula from "dragula";
|
|
16
15
|
// Initialize the available forms.
|
|
17
16
|
Formio.forms = {};
|
|
18
17
|
// Allow people to register components.
|
|
@@ -286,7 +285,6 @@ export default class Webform extends NestedDataComponent {
|
|
|
286
285
|
// Ensure the root is set to this component.
|
|
287
286
|
this.root = this;
|
|
288
287
|
this.localRoot = this;
|
|
289
|
-
this.root.dragulaLib = dragula;
|
|
290
288
|
}
|
|
291
289
|
/* eslint-enable max-statements */
|
|
292
290
|
get language() {
|
|
@@ -1136,7 +1134,7 @@ export default class Webform extends NestedDataComponent {
|
|
|
1136
1134
|
});
|
|
1137
1135
|
const displayedErrors = [];
|
|
1138
1136
|
if (errors.length) {
|
|
1139
|
-
errors = _.uniqBy(errors, (error) => error.message);
|
|
1137
|
+
errors = _.uniqBy(errors, (error) => [error.message, error.component?.id, error.context?.path].join());
|
|
1140
1138
|
const createListItem = (message, index) => {
|
|
1141
1139
|
const err = errors[index];
|
|
1142
1140
|
const messageFromIndex = !_.isUndefined(index) && errors && errors[index];
|
|
@@ -830,6 +830,7 @@ declare class Component extends Element {
|
|
|
830
830
|
quill: any;
|
|
831
831
|
get shouldSanitizeValue(): boolean;
|
|
832
832
|
addAce(element: any, settings: any, onChange: any): any;
|
|
833
|
+
getDragula(): Promise<any>;
|
|
833
834
|
get tree(): any;
|
|
834
835
|
/**
|
|
835
836
|
* The empty value for this component.
|
|
@@ -2351,6 +2351,13 @@ export default class Component extends Element {
|
|
|
2351
2351
|
return editor;
|
|
2352
2352
|
});
|
|
2353
2353
|
}
|
|
2354
|
+
async getDragula() {
|
|
2355
|
+
return new Promise((resolve) => {
|
|
2356
|
+
return Formio.requireLibrary('dragula', 'dragula', `${Formio.cdn.dragula}/dragula.js`, true, (ready) => {
|
|
2357
|
+
return ready.then(resolve);
|
|
2358
|
+
});
|
|
2359
|
+
});
|
|
2360
|
+
}
|
|
2354
2361
|
get tree() {
|
|
2355
2362
|
return this.component.tree || false;
|
|
2356
2363
|
}
|
|
@@ -211,11 +211,12 @@ export default class NestedComponent extends Field {
|
|
|
211
211
|
calculateValue(data: any, flags: any, row: any): any;
|
|
212
212
|
isLastPage(): boolean;
|
|
213
213
|
isValid(data: any, dirty: any): any;
|
|
214
|
-
validationProcessor({ scope, data, row, instance }: {
|
|
214
|
+
validationProcessor({ scope, data, row, instance, component }: {
|
|
215
215
|
scope: any;
|
|
216
216
|
data: any;
|
|
217
217
|
row: any;
|
|
218
218
|
instance: any;
|
|
219
|
+
component: any;
|
|
219
220
|
}, flags: any): void;
|
|
220
221
|
/**
|
|
221
222
|
* Perform a validation on all child components of this nested component.
|
|
@@ -677,8 +677,11 @@ export default class NestedComponent extends Field {
|
|
|
677
677
|
isValid(data, dirty) {
|
|
678
678
|
return this.getComponents().reduce((valid, comp) => comp.isValid(data, dirty) && valid, super.isValid(data, dirty));
|
|
679
679
|
}
|
|
680
|
-
validationProcessor({ scope, data, row, instance }, flags) {
|
|
680
|
+
validationProcessor({ scope, data, row, instance, component }, flags) {
|
|
681
681
|
const { dirty } = flags;
|
|
682
|
+
if (this.root.hasExtraPages && this.page !== this.root.page) {
|
|
683
|
+
instance = this.getComponentById(component.id);
|
|
684
|
+
}
|
|
682
685
|
if (!instance) {
|
|
683
686
|
return;
|
|
684
687
|
}
|
|
@@ -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) {
|
|
@@ -43,7 +43,7 @@ export default class CheckBoxComponent extends Field {
|
|
|
43
43
|
attach(element: any): Promise<void>;
|
|
44
44
|
input: any;
|
|
45
45
|
detach(element: any): void;
|
|
46
|
-
get emptyValue(): false |
|
|
46
|
+
get emptyValue(): false | "";
|
|
47
47
|
getValueAt(index: any): any;
|
|
48
48
|
get checked(): boolean;
|
|
49
49
|
setCheckedState(value: any): any;
|
|
@@ -116,7 +116,7 @@ export default class CheckBoxComponent extends Field {
|
|
|
116
116
|
super.detach();
|
|
117
117
|
}
|
|
118
118
|
get emptyValue() {
|
|
119
|
-
return this.component.inputType === 'radio' ?
|
|
119
|
+
return this.component.inputType === 'radio' ? '' : false;
|
|
120
120
|
}
|
|
121
121
|
isEmpty(value = this.dataValue) {
|
|
122
122
|
return super.isEmpty(value) || value === false;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let name: string;
|
|
3
|
+
let path: string;
|
|
4
|
+
let type: string;
|
|
5
|
+
let display: string;
|
|
6
|
+
let components: ({
|
|
7
|
+
label: string;
|
|
8
|
+
inputType: string;
|
|
9
|
+
tableView: boolean;
|
|
10
|
+
defaultValue: boolean;
|
|
11
|
+
key: string;
|
|
12
|
+
type: string;
|
|
13
|
+
name: string;
|
|
14
|
+
value: string;
|
|
15
|
+
input: boolean;
|
|
16
|
+
'some name': boolean;
|
|
17
|
+
disableOnInvalid?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
type: string;
|
|
20
|
+
label: string;
|
|
21
|
+
key: string;
|
|
22
|
+
disableOnInvalid: boolean;
|
|
23
|
+
input: boolean;
|
|
24
|
+
tableView: boolean;
|
|
25
|
+
inputType?: undefined;
|
|
26
|
+
defaultValue?: undefined;
|
|
27
|
+
name?: undefined;
|
|
28
|
+
value?: undefined;
|
|
29
|
+
'some name'?: undefined;
|
|
30
|
+
})[];
|
|
31
|
+
}
|
|
32
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
name: 'ckeckbox',
|
|
3
|
+
path: 'ckeckbox',
|
|
4
|
+
type: 'form',
|
|
5
|
+
display: 'form',
|
|
6
|
+
components: [
|
|
7
|
+
{
|
|
8
|
+
label: 'Checkbox',
|
|
9
|
+
inputType: 'radio',
|
|
10
|
+
tableView: false,
|
|
11
|
+
defaultValue: false,
|
|
12
|
+
key: 'checkbox',
|
|
13
|
+
type: 'checkbox',
|
|
14
|
+
name: 'some name',
|
|
15
|
+
value: 'ok',
|
|
16
|
+
input: true,
|
|
17
|
+
'some name': false
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: 'button',
|
|
21
|
+
label: 'Submit',
|
|
22
|
+
key: 'submit',
|
|
23
|
+
disableOnInvalid: true,
|
|
24
|
+
input: true,
|
|
25
|
+
tableView: false
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
};
|
|
@@ -3,5 +3,6 @@ import comp2 from './comp2';
|
|
|
3
3
|
import comp3 from './comp3';
|
|
4
4
|
import comp4 from './comp4';
|
|
5
5
|
import comp5 from './comp5';
|
|
6
|
+
import comp6 from './comp6';
|
|
6
7
|
import customDefaultComponent from './customDefaultComponent';
|
|
7
|
-
export { comp1, comp2, comp3, comp4, comp5, customDefaultComponent };
|
|
8
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, customDefaultComponent };
|
|
@@ -4,4 +4,5 @@ import comp2 from './comp2';
|
|
|
4
4
|
import comp3 from './comp3';
|
|
5
5
|
import comp4 from './comp4';
|
|
6
6
|
import comp5 from './comp5';
|
|
7
|
-
|
|
7
|
+
import comp6 from './comp6';
|
|
8
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, customDefaultComponent };
|
|
@@ -2,6 +2,8 @@ export default class CurrencyComponent extends NumberComponent {
|
|
|
2
2
|
constructor(component: any, options: any, data: any);
|
|
3
3
|
currencyPrefix: any;
|
|
4
4
|
currencySuffix: any;
|
|
5
|
+
parseNumber(value: any): number;
|
|
6
|
+
parseValue(value: any): string | null;
|
|
5
7
|
addZerosAndFormatValue(value: any): any;
|
|
6
8
|
stripPrefixSuffix(value: any): any;
|
|
7
9
|
}
|
|
@@ -12,6 +12,7 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
|
12
12
|
tabIndex: number;
|
|
13
13
|
rows: any[] | undefined;
|
|
14
14
|
columns: any[] | undefined;
|
|
15
|
+
dragulaReady: Promise<any> | undefined;
|
|
15
16
|
visibleColumns: {} | undefined;
|
|
16
17
|
set dataValue(value: any[]);
|
|
17
18
|
get dataValue(): any[];
|
|
@@ -71,6 +72,7 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
|
71
72
|
*/
|
|
72
73
|
reorderValues(valuesArr: any, oldPosition: number, newPosition: number, movedBelow: boolean | any): void;
|
|
73
74
|
onReorder(element: any, _target: any, _source: any, sibling: any): void;
|
|
75
|
+
onCloned(el: any, original: any): void;
|
|
74
76
|
focusOnNewRowElement(row: any): void;
|
|
75
77
|
addRow(): void;
|
|
76
78
|
updateComponentsRowIndex(components: any, rowIndex: any): void;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import NestedArrayComponent from '../_classes/nestedarray/NestedArrayComponent';
|
|
3
3
|
import { fastCloneDeep, getFocusableElements } from '../../utils/utils';
|
|
4
|
-
import
|
|
5
|
-
import dragula from 'dragula';
|
|
4
|
+
import Components from '../Components';
|
|
6
5
|
export default class DataGridComponent extends NestedArrayComponent {
|
|
7
6
|
static schema(...extend) {
|
|
8
7
|
return NestedArrayComponent.schema({
|
|
@@ -39,6 +38,9 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
|
39
38
|
if (this.initRows || !_.isEqual(this.dataValue, this.emptyValue)) {
|
|
40
39
|
this.createRows(true);
|
|
41
40
|
}
|
|
41
|
+
if (this.allowReorder) {
|
|
42
|
+
this.dragulaReady = this.getDragula();
|
|
43
|
+
}
|
|
42
44
|
this.visibleColumns = {};
|
|
43
45
|
this.prevHasAddButton = this.hasAddButton();
|
|
44
46
|
this.checkColumns();
|
|
@@ -279,31 +281,25 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
|
279
281
|
this.refs[`${this.datagridKey}-row`].forEach((row, index) => {
|
|
280
282
|
row.dragInfo = { index };
|
|
281
283
|
});
|
|
282
|
-
this.dragula
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}
|
|
284
|
+
this.dragulaReady.then((dragula) => {
|
|
285
|
+
// The drop event may call redraw twice which calls attach twice and because this block of code is asynchronous
|
|
286
|
+
// BOTH redraws may be called before this block of code runs (which causes this block of code to run twice sequentially).
|
|
287
|
+
// This causes two dragula() calls on the same container which breaks dragula. To fix this the return value must
|
|
288
|
+
// be saved in this.dragula and have its container contents reset if it exists
|
|
289
|
+
if (this.dragula && this.dragula.containers) {
|
|
290
|
+
this.dragula.containers = [];
|
|
290
291
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
if (
|
|
297
|
-
|
|
292
|
+
this.dragula = dragula([this.refs[`${this.datagridKey}-tbody`]], {
|
|
293
|
+
moves: (_draggedElement, _oldParent, clickedElement) => {
|
|
294
|
+
const clickedElementKey = clickedElement.getAttribute('data-key');
|
|
295
|
+
const oldParentKey = _oldParent.getAttribute('data-key');
|
|
296
|
+
//Check if the clicked button belongs to that container, if false, it belongs to the nested container
|
|
297
|
+
if (oldParentKey === clickedElementKey) {
|
|
298
|
+
return clickedElement.classList.contains('formio-drag-button');
|
|
298
299
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}, '');
|
|
303
|
-
el.children[index].style.cssText = cssText;
|
|
304
|
-
}
|
|
305
|
-
});
|
|
306
|
-
}
|
|
300
|
+
}
|
|
301
|
+
}).on('drop', this.onReorder.bind(this))
|
|
302
|
+
.on('cloned', this.onCloned.bind(this));
|
|
307
303
|
});
|
|
308
304
|
}
|
|
309
305
|
this.refs[`${this.datagridKey}-addRow`].forEach((addButton) => {
|
|
@@ -370,6 +366,22 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
|
370
366
|
this.setValue(dataValue, { isReordered: true });
|
|
371
367
|
this.rebuild();
|
|
372
368
|
}
|
|
369
|
+
onCloned(el, original) {
|
|
370
|
+
if (el && el.children && original && original.children) {
|
|
371
|
+
_.each(original.children, (child, index) => {
|
|
372
|
+
const styles = getComputedStyle(child, null);
|
|
373
|
+
if (styles.cssText !== '') {
|
|
374
|
+
el.children[index].style.cssText = styles.cssText;
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
const cssText = Object.values(styles).reduce((css, propertyName) => {
|
|
378
|
+
return `${css}${propertyName}:${styles.getPropertyValue(propertyName)};`;
|
|
379
|
+
}, '');
|
|
380
|
+
el.children[index].style.cssText = cssText;
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
}
|
|
373
385
|
focusOnNewRowElement(row) {
|
|
374
386
|
Object.keys(row).find((key) => {
|
|
375
387
|
const element = row[key].element;
|
|
@@ -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
|
+
};
|
|
@@ -7,6 +7,7 @@ import comp6 from './comp6';
|
|
|
7
7
|
import comp7 from './comp7';
|
|
8
8
|
import comp8 from './comp8';
|
|
9
9
|
import comp9 from './comp9';
|
|
10
|
+
import comp10 from './comp10';
|
|
10
11
|
import withCollapsibleRowGroups from './comp-with-collapsible-groups';
|
|
11
12
|
import withConditionalFieldsAndValidations from './comp-with-conditional-components-and-validations';
|
|
12
13
|
import withDefValue from './comp-with-def-value';
|
|
@@ -17,4 +18,4 @@ import withAllowCalculateOverride from './comp-with-allow-calculate-override';
|
|
|
17
18
|
import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
|
|
18
19
|
import withCheckboxes from './comp-with-checkboxes';
|
|
19
20
|
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 };
|
|
21
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
|
|
@@ -7,6 +7,7 @@ import comp6 from './comp6';
|
|
|
7
7
|
import comp7 from './comp7';
|
|
8
8
|
import comp8 from './comp8';
|
|
9
9
|
import comp9 from './comp9';
|
|
10
|
+
import comp10 from './comp10';
|
|
10
11
|
import withDefValue from './comp-with-def-value';
|
|
11
12
|
import withRowGroupsAndDefValue from './comp-row-groups-with-def-value';
|
|
12
13
|
import modalWithRequiredFields from './comp-modal-with-required-fields';
|
|
@@ -17,4 +18,4 @@ import withAllowCalculateOverride from './comp-with-allow-calculate-override';
|
|
|
17
18
|
import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
|
|
18
19
|
import withCheckboxes from './comp-with-checkboxes';
|
|
19
20
|
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 };
|
|
21
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, 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({
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let components: ({
|
|
3
|
+
label: string;
|
|
4
|
+
hideInputLabels: boolean;
|
|
5
|
+
inputsLabelPosition: string;
|
|
6
|
+
useLocaleSettings: boolean;
|
|
7
|
+
alwaysEnabled: boolean;
|
|
8
|
+
tableView: boolean;
|
|
9
|
+
fields: {
|
|
10
|
+
day: {
|
|
11
|
+
hide: boolean;
|
|
12
|
+
required: boolean;
|
|
13
|
+
};
|
|
14
|
+
month: {
|
|
15
|
+
hide: boolean;
|
|
16
|
+
required: boolean;
|
|
17
|
+
};
|
|
18
|
+
year: {
|
|
19
|
+
hide: boolean;
|
|
20
|
+
required: boolean;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
key: string;
|
|
24
|
+
type: string;
|
|
25
|
+
input: boolean;
|
|
26
|
+
showValidations?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
label: string;
|
|
29
|
+
showValidations: boolean;
|
|
30
|
+
alwaysEnabled: boolean;
|
|
31
|
+
tableView: boolean;
|
|
32
|
+
key: string;
|
|
33
|
+
type: string;
|
|
34
|
+
input: boolean;
|
|
35
|
+
hideInputLabels?: undefined;
|
|
36
|
+
inputsLabelPosition?: undefined;
|
|
37
|
+
useLocaleSettings?: undefined;
|
|
38
|
+
fields?: undefined;
|
|
39
|
+
})[];
|
|
40
|
+
}
|
|
41
|
+
export default _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"components": [
|
|
3
|
+
{
|
|
4
|
+
"label": "Day - Table",
|
|
5
|
+
"hideInputLabels": false,
|
|
6
|
+
"inputsLabelPosition": "top",
|
|
7
|
+
"useLocaleSettings": false,
|
|
8
|
+
"alwaysEnabled": false,
|
|
9
|
+
"tableView": false,
|
|
10
|
+
"fields": {
|
|
11
|
+
"day": {
|
|
12
|
+
"hide": false,
|
|
13
|
+
"required": true
|
|
14
|
+
},
|
|
15
|
+
"month": {
|
|
16
|
+
"hide": false,
|
|
17
|
+
"required": true
|
|
18
|
+
},
|
|
19
|
+
"year": {
|
|
20
|
+
"hide": false,
|
|
21
|
+
"required": true
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"key": "dayTable",
|
|
25
|
+
"type": "day",
|
|
26
|
+
"input": true
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"label": "Submit",
|
|
30
|
+
"showValidations": false,
|
|
31
|
+
"alwaysEnabled": false,
|
|
32
|
+
"tableView": false,
|
|
33
|
+
"key": "submit",
|
|
34
|
+
"type": "button",
|
|
35
|
+
"input": true
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
};
|
|
@@ -5,4 +5,5 @@ 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
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 };
|
|
@@ -5,4 +5,5 @@ 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
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 };
|
|
@@ -672,6 +672,11 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
672
672
|
}
|
|
673
673
|
},
|
|
674
674
|
}, this.component.saveRow || 'Save'));
|
|
675
|
+
this.emit('editGridOpenModal', {
|
|
676
|
+
component: this.component,
|
|
677
|
+
row: editRow,
|
|
678
|
+
instance: this,
|
|
679
|
+
});
|
|
675
680
|
return this.attachComponents(modalContent, components);
|
|
676
681
|
}
|
|
677
682
|
showDialog(rowIndex) {
|
|
@@ -729,6 +734,11 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
729
734
|
editRow.data = dataSnapshot;
|
|
730
735
|
this.restoreRowContext(editRow);
|
|
731
736
|
}
|
|
737
|
+
this.emit('editGridEditRow', {
|
|
738
|
+
component: this.component,
|
|
739
|
+
row: editRow,
|
|
740
|
+
instance: this,
|
|
741
|
+
});
|
|
732
742
|
if (this.component.modal) {
|
|
733
743
|
return this.addRowModal(rowIndex);
|
|
734
744
|
}
|
|
@@ -1079,7 +1089,8 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
1079
1089
|
return false;
|
|
1080
1090
|
}
|
|
1081
1091
|
else if (rowsEditing && this.saveEditMode && !this.component.openWhenEmpty) {
|
|
1082
|
-
this.setCustomValidity(this.t(this.errorMessage('unsavedRowsError')), dirty);
|
|
1092
|
+
this._errors = this.setCustomValidity(this.t(this.errorMessage('unsavedRowsError')), dirty);
|
|
1093
|
+
errors.push(...this._errors);
|
|
1083
1094
|
return false;
|
|
1084
1095
|
}
|
|
1085
1096
|
const message = this.invalid || this.invalidMessage(data, dirty, false, row);
|