@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/cjs/CDN.d.ts
CHANGED
package/lib/cjs/CDN.js
CHANGED
package/lib/cjs/Webform.js
CHANGED
|
@@ -17,7 +17,6 @@ const formUtils_1 = require("./utils/formUtils");
|
|
|
17
17
|
if (typeof window !== 'undefined' && typeof window.global === 'undefined') {
|
|
18
18
|
window.global = window;
|
|
19
19
|
}
|
|
20
|
-
const dragula_1 = __importDefault(require("dragula"));
|
|
21
20
|
// Initialize the available forms.
|
|
22
21
|
Formio_1.Formio.forms = {};
|
|
23
22
|
// Allow people to register components.
|
|
@@ -314,7 +313,6 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
314
313
|
// Ensure the root is set to this component.
|
|
315
314
|
this.root = this;
|
|
316
315
|
this.localRoot = this;
|
|
317
|
-
this.root.dragulaLib = dragula_1.default;
|
|
318
316
|
}
|
|
319
317
|
/* eslint-enable max-statements */
|
|
320
318
|
get language() {
|
|
@@ -1132,7 +1130,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
1132
1130
|
});
|
|
1133
1131
|
const displayedErrors = [];
|
|
1134
1132
|
if (errors.length) {
|
|
1135
|
-
errors = lodash_1.default.uniqBy(errors, (error) => error.message);
|
|
1133
|
+
errors = lodash_1.default.uniqBy(errors, (error) => { var _a, _b; return [error.message, (_a = error.component) === null || _a === void 0 ? void 0 : _a.id, (_b = error.context) === null || _b === void 0 ? void 0 : _b.path].join(); });
|
|
1136
1134
|
const createListItem = (message, index) => {
|
|
1137
1135
|
var _a, _b, _c;
|
|
1138
1136
|
const err = 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.
|
|
@@ -22,6 +22,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
25
34
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
36
|
};
|
|
@@ -2374,6 +2383,15 @@ class Component extends Element_1.default {
|
|
|
2374
2383
|
return editor;
|
|
2375
2384
|
});
|
|
2376
2385
|
}
|
|
2386
|
+
getDragula() {
|
|
2387
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2388
|
+
return new Promise((resolve) => {
|
|
2389
|
+
return Formio_1.Formio.requireLibrary('dragula', 'dragula', `${Formio_1.Formio.cdn.dragula}/dragula.js`, true, (ready) => {
|
|
2390
|
+
return ready.then(resolve);
|
|
2391
|
+
});
|
|
2392
|
+
});
|
|
2393
|
+
});
|
|
2394
|
+
}
|
|
2377
2395
|
get tree() {
|
|
2378
2396
|
return this.component.tree || false;
|
|
2379
2397
|
}
|
|
@@ -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.
|
|
@@ -681,8 +681,11 @@ class NestedComponent extends Field_1.default {
|
|
|
681
681
|
isValid(data, dirty) {
|
|
682
682
|
return this.getComponents().reduce((valid, comp) => comp.isValid(data, dirty) && valid, super.isValid(data, dirty));
|
|
683
683
|
}
|
|
684
|
-
validationProcessor({ scope, data, row, instance }, flags) {
|
|
684
|
+
validationProcessor({ scope, data, row, instance, component }, flags) {
|
|
685
685
|
const { dirty } = flags;
|
|
686
|
+
if (this.root.hasExtraPages && this.page !== this.root.page) {
|
|
687
|
+
instance = this.getComponentById(component.id);
|
|
688
|
+
}
|
|
686
689
|
if (!instance) {
|
|
687
690
|
return;
|
|
688
691
|
}
|
|
@@ -113,6 +113,10 @@ class AddressComponent extends Container_1.default {
|
|
|
113
113
|
if (!this.builderMode) {
|
|
114
114
|
if (this.component.provider) {
|
|
115
115
|
const { provider, providerOptions, } = this.component;
|
|
116
|
+
if (lodash_1.default.get(providerOptions, 'params.subscriptionKey')) {
|
|
117
|
+
lodash_1.default.set(providerOptions, "params['subscription-key']", lodash_1.default.get(providerOptions, 'params.subscriptionKey'));
|
|
118
|
+
lodash_1.default.unset(providerOptions, 'params.subscriptionKey');
|
|
119
|
+
}
|
|
116
120
|
this.provider = this.initializeProvider(provider, providerOptions);
|
|
117
121
|
}
|
|
118
122
|
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;
|
|
@@ -117,7 +117,7 @@ class CheckBoxComponent extends Field_1.default {
|
|
|
117
117
|
super.detach();
|
|
118
118
|
}
|
|
119
119
|
get emptyValue() {
|
|
120
|
-
return this.component.inputType === 'radio' ?
|
|
120
|
+
return this.component.inputType === 'radio' ? '' : false;
|
|
121
121
|
}
|
|
122
122
|
isEmpty(value = this.dataValue) {
|
|
123
123
|
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,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
name: 'ckeckbox',
|
|
5
|
+
path: 'ckeckbox',
|
|
6
|
+
type: 'form',
|
|
7
|
+
display: 'form',
|
|
8
|
+
components: [
|
|
9
|
+
{
|
|
10
|
+
label: 'Checkbox',
|
|
11
|
+
inputType: 'radio',
|
|
12
|
+
tableView: false,
|
|
13
|
+
defaultValue: false,
|
|
14
|
+
key: 'checkbox',
|
|
15
|
+
type: 'checkbox',
|
|
16
|
+
name: 'some name',
|
|
17
|
+
value: 'ok',
|
|
18
|
+
input: true,
|
|
19
|
+
'some name': false
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
type: 'button',
|
|
23
|
+
label: 'Submit',
|
|
24
|
+
key: 'submit',
|
|
25
|
+
disableOnInvalid: true,
|
|
26
|
+
input: true,
|
|
27
|
+
tableView: false
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
};
|
|
@@ -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 };
|
|
@@ -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.customDefaultComponent = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
|
6
|
+
exports.customDefaultComponent = 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 customDefaultComponent_1 = __importDefault(require("./customDefaultComponent"));
|
|
@@ -16,3 +16,5 @@ const comp4_1 = __importDefault(require("./comp4"));
|
|
|
16
16
|
exports.comp4 = comp4_1.default;
|
|
17
17
|
const comp5_1 = __importDefault(require("./comp5"));
|
|
18
18
|
exports.comp5 = comp5_1.default;
|
|
19
|
+
const comp6_1 = __importDefault(require("./comp6"));
|
|
20
|
+
exports.comp6 = comp6_1.default;
|
|
@@ -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;
|
|
@@ -6,8 +6,7 @@ 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");
|
|
10
|
-
const dragula_1 = __importDefault(require("dragula"));
|
|
9
|
+
const Components_1 = __importDefault(require("../Components"));
|
|
11
10
|
class DataGridComponent extends NestedArrayComponent_1.default {
|
|
12
11
|
static schema(...extend) {
|
|
13
12
|
return NestedArrayComponent_1.default.schema({
|
|
@@ -44,6 +43,9 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
44
43
|
if (this.initRows || !lodash_1.default.isEqual(this.dataValue, this.emptyValue)) {
|
|
45
44
|
this.createRows(true);
|
|
46
45
|
}
|
|
46
|
+
if (this.allowReorder) {
|
|
47
|
+
this.dragulaReady = this.getDragula();
|
|
48
|
+
}
|
|
47
49
|
this.visibleColumns = {};
|
|
48
50
|
this.prevHasAddButton = this.hasAddButton();
|
|
49
51
|
this.checkColumns();
|
|
@@ -282,31 +284,25 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
282
284
|
this.refs[`${this.datagridKey}-row`].forEach((row, index) => {
|
|
283
285
|
row.dragInfo = { index };
|
|
284
286
|
});
|
|
285
|
-
this.dragula
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}
|
|
287
|
+
this.dragulaReady.then((dragula) => {
|
|
288
|
+
// The drop event may call redraw twice which calls attach twice and because this block of code is asynchronous
|
|
289
|
+
// BOTH redraws may be called before this block of code runs (which causes this block of code to run twice sequentially).
|
|
290
|
+
// This causes two dragula() calls on the same container which breaks dragula. To fix this the return value must
|
|
291
|
+
// be saved in this.dragula and have its container contents reset if it exists
|
|
292
|
+
if (this.dragula && this.dragula.containers) {
|
|
293
|
+
this.dragula.containers = [];
|
|
293
294
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
if (
|
|
300
|
-
|
|
295
|
+
this.dragula = dragula([this.refs[`${this.datagridKey}-tbody`]], {
|
|
296
|
+
moves: (_draggedElement, _oldParent, clickedElement) => {
|
|
297
|
+
const clickedElementKey = clickedElement.getAttribute('data-key');
|
|
298
|
+
const oldParentKey = _oldParent.getAttribute('data-key');
|
|
299
|
+
//Check if the clicked button belongs to that container, if false, it belongs to the nested container
|
|
300
|
+
if (oldParentKey === clickedElementKey) {
|
|
301
|
+
return clickedElement.classList.contains('formio-drag-button');
|
|
301
302
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
}, '');
|
|
306
|
-
el.children[index].style.cssText = cssText;
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
}
|
|
303
|
+
}
|
|
304
|
+
}).on('drop', this.onReorder.bind(this))
|
|
305
|
+
.on('cloned', this.onCloned.bind(this));
|
|
310
306
|
});
|
|
311
307
|
}
|
|
312
308
|
this.refs[`${this.datagridKey}-addRow`].forEach((addButton) => {
|
|
@@ -373,6 +369,22 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
373
369
|
this.setValue(dataValue, { isReordered: true });
|
|
374
370
|
this.rebuild();
|
|
375
371
|
}
|
|
372
|
+
onCloned(el, original) {
|
|
373
|
+
if (el && el.children && original && original.children) {
|
|
374
|
+
lodash_1.default.each(original.children, (child, index) => {
|
|
375
|
+
const styles = getComputedStyle(child, null);
|
|
376
|
+
if (styles.cssText !== '') {
|
|
377
|
+
el.children[index].style.cssText = styles.cssText;
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
const cssText = Object.values(styles).reduce((css, propertyName) => {
|
|
381
|
+
return `${css}${propertyName}:${styles.getPropertyValue(propertyName)};`;
|
|
382
|
+
}, '');
|
|
383
|
+
el.children[index].style.cssText = cssText;
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
}
|
|
376
388
|
focusOnNewRowElement(row) {
|
|
377
389
|
Object.keys(row).find((key) => {
|
|
378
390
|
const element = row[key].element;
|
|
@@ -422,7 +434,7 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
422
434
|
}
|
|
423
435
|
component.rowIndex = rowIndex;
|
|
424
436
|
component.row = `${rowIndex}-${colIndex}`;
|
|
425
|
-
component.path = Components_1.
|
|
437
|
+
component.path = Components_1.default.getComponentPath(component);
|
|
426
438
|
});
|
|
427
439
|
}
|
|
428
440
|
updateRowsComponents(rowIndex) {
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let title: string;
|
|
3
|
+
let name: string;
|
|
4
|
+
let path: string;
|
|
5
|
+
let type: string;
|
|
6
|
+
let display: string;
|
|
7
|
+
let components: ({
|
|
8
|
+
label: string;
|
|
9
|
+
reorder: boolean;
|
|
10
|
+
addAnotherPosition: string;
|
|
11
|
+
layoutFixed: boolean;
|
|
12
|
+
enableRowGroups: boolean;
|
|
13
|
+
initEmpty: boolean;
|
|
14
|
+
tableView: boolean;
|
|
15
|
+
defaultValue: {}[];
|
|
16
|
+
validate: {
|
|
17
|
+
required: boolean;
|
|
18
|
+
};
|
|
19
|
+
key: string;
|
|
20
|
+
type: string;
|
|
21
|
+
input: boolean;
|
|
22
|
+
components: {
|
|
23
|
+
label: string;
|
|
24
|
+
columns: ({
|
|
25
|
+
components: {
|
|
26
|
+
label: string;
|
|
27
|
+
applyMaskOn: string;
|
|
28
|
+
tableView: boolean;
|
|
29
|
+
key: string;
|
|
30
|
+
type: string;
|
|
31
|
+
input: boolean;
|
|
32
|
+
}[];
|
|
33
|
+
width: number;
|
|
34
|
+
offset: number;
|
|
35
|
+
push: number;
|
|
36
|
+
pull: number;
|
|
37
|
+
size: string;
|
|
38
|
+
currentWidth: number;
|
|
39
|
+
} | {
|
|
40
|
+
components: {
|
|
41
|
+
label: string;
|
|
42
|
+
tableView: boolean;
|
|
43
|
+
key: string;
|
|
44
|
+
type: string;
|
|
45
|
+
input: boolean;
|
|
46
|
+
}[];
|
|
47
|
+
width: number;
|
|
48
|
+
offset: number;
|
|
49
|
+
push: number;
|
|
50
|
+
pull: number;
|
|
51
|
+
size: string;
|
|
52
|
+
currentWidth: number;
|
|
53
|
+
})[];
|
|
54
|
+
key: string;
|
|
55
|
+
type: string;
|
|
56
|
+
input: boolean;
|
|
57
|
+
tableView: boolean;
|
|
58
|
+
}[];
|
|
59
|
+
disableOnInvalid?: undefined;
|
|
60
|
+
} | {
|
|
61
|
+
type: string;
|
|
62
|
+
label: string;
|
|
63
|
+
key: string;
|
|
64
|
+
disableOnInvalid: boolean;
|
|
65
|
+
input: boolean;
|
|
66
|
+
tableView: boolean;
|
|
67
|
+
reorder?: undefined;
|
|
68
|
+
addAnotherPosition?: undefined;
|
|
69
|
+
layoutFixed?: undefined;
|
|
70
|
+
enableRowGroups?: undefined;
|
|
71
|
+
initEmpty?: undefined;
|
|
72
|
+
defaultValue?: undefined;
|
|
73
|
+
validate?: undefined;
|
|
74
|
+
components?: undefined;
|
|
75
|
+
})[];
|
|
76
|
+
let pdfComponents: never[];
|
|
77
|
+
namespace settings {
|
|
78
|
+
let logs: string;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
export default _default;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
title: 'randomName',
|
|
5
|
+
name: 'randomName',
|
|
6
|
+
path: 'randomName',
|
|
7
|
+
type: 'form',
|
|
8
|
+
display: 'form',
|
|
9
|
+
components: [
|
|
10
|
+
{
|
|
11
|
+
label: 'Data Grid',
|
|
12
|
+
reorder: false,
|
|
13
|
+
addAnotherPosition: 'bottom',
|
|
14
|
+
layoutFixed: false,
|
|
15
|
+
enableRowGroups: false,
|
|
16
|
+
initEmpty: false,
|
|
17
|
+
tableView: false,
|
|
18
|
+
defaultValue: [
|
|
19
|
+
{}
|
|
20
|
+
],
|
|
21
|
+
validate: {
|
|
22
|
+
required: true
|
|
23
|
+
},
|
|
24
|
+
key: 'dataGrid',
|
|
25
|
+
type: 'datagrid',
|
|
26
|
+
input: true,
|
|
27
|
+
components: [
|
|
28
|
+
{
|
|
29
|
+
label: 'Columns',
|
|
30
|
+
columns: [
|
|
31
|
+
{
|
|
32
|
+
components: [
|
|
33
|
+
{
|
|
34
|
+
label: 'Text Field',
|
|
35
|
+
applyMaskOn: 'change',
|
|
36
|
+
tableView: true,
|
|
37
|
+
key: 'textField',
|
|
38
|
+
type: 'textfield',
|
|
39
|
+
input: true
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
width: 6,
|
|
43
|
+
offset: 0,
|
|
44
|
+
push: 0,
|
|
45
|
+
pull: 0,
|
|
46
|
+
size: 'md',
|
|
47
|
+
currentWidth: 6
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
components: [
|
|
51
|
+
{
|
|
52
|
+
label: 'Checkbox',
|
|
53
|
+
tableView: false,
|
|
54
|
+
key: 'checkbox',
|
|
55
|
+
type: 'checkbox',
|
|
56
|
+
input: true
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
width: 6,
|
|
60
|
+
offset: 0,
|
|
61
|
+
push: 0,
|
|
62
|
+
pull: 0,
|
|
63
|
+
size: 'md',
|
|
64
|
+
currentWidth: 6
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
key: 'columns',
|
|
68
|
+
type: 'columns',
|
|
69
|
+
input: false,
|
|
70
|
+
tableView: false
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
type: 'button',
|
|
76
|
+
label: 'Submit',
|
|
77
|
+
key: 'submit',
|
|
78
|
+
disableOnInvalid: true,
|
|
79
|
+
input: true,
|
|
80
|
+
tableView: false
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
pdfComponents: [],
|
|
84
|
+
settings: {
|
|
85
|
+
logs: 'true'
|
|
86
|
+
}
|
|
87
|
+
};
|
|
@@ -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 };
|
|
@@ -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.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;
|
|
6
|
+
exports.withReorder = exports.withCheckboxes = exports.twoWithAllowCalculatedOverride = exports.withAllowCalculateOverride = exports.modalWithRequiredFields = exports.withRowGroupsAndDefValue = exports.withLogic = exports.withDefValue = exports.withConditionalFieldsAndValidations = exports.withCollapsibleRowGroups = exports.comp10 = 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"));
|
|
@@ -22,6 +22,8 @@ const comp8_1 = __importDefault(require("./comp8"));
|
|
|
22
22
|
exports.comp8 = comp8_1.default;
|
|
23
23
|
const comp9_1 = __importDefault(require("./comp9"));
|
|
24
24
|
exports.comp9 = comp9_1.default;
|
|
25
|
+
const comp10_1 = __importDefault(require("./comp10"));
|
|
26
|
+
exports.comp10 = comp10_1.default;
|
|
25
27
|
const comp_with_def_value_1 = __importDefault(require("./comp-with-def-value"));
|
|
26
28
|
exports.withDefValue = comp_with_def_value_1.default;
|
|
27
29
|
const comp_row_groups_with_def_value_1 = __importDefault(require("./comp-row-groups-with-def-value"));
|
|
@@ -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);
|
|
@@ -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;
|