@formio/js 5.1.0-dev.6147.abe2ba0 → 5.1.0-dev.6151.5c28053
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/formio.form.js +8 -8
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +8 -8
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.utils.js +3 -3
- package/dist/formio.utils.min.js +1 -1
- package/lib/cjs/components/_classes/component/Component.js +10 -5
- package/lib/cjs/components/datamap/DataMap.d.ts +1 -1
- package/lib/cjs/components/datamap/DataMap.js +4 -4
- package/lib/cjs/components/day/Day.js +1 -1
- package/lib/cjs/components/textarea/TextArea.js +6 -1
- package/lib/cjs/utils/Evaluator.d.ts +7 -1
- package/lib/cjs/utils/Evaluator.js +10 -1
- package/lib/cjs/utils/index.d.ts +10 -3
- package/lib/cjs/utils/index.js +10 -1
- package/lib/cjs/utils/utils.d.ts +4 -4
- package/lib/cjs/utils/utils.js +2 -2
- package/lib/cjs/widgets/CalendarWidget.d.ts +1 -1
- package/lib/cjs/widgets/CalendarWidget.js +2 -4
- package/lib/mjs/components/_classes/component/Component.js +10 -5
- package/lib/mjs/components/datamap/DataMap.d.ts +1 -1
- package/lib/mjs/components/datamap/DataMap.js +1 -1
- package/lib/mjs/components/day/Day.js +1 -1
- package/lib/mjs/components/textarea/TextArea.js +6 -1
- package/lib/mjs/utils/Evaluator.d.ts +7 -1
- package/lib/mjs/utils/Evaluator.js +9 -1
- package/lib/mjs/utils/index.d.ts +10 -3
- package/lib/mjs/utils/index.js +7 -1
- package/lib/mjs/utils/utils.d.ts +4 -4
- package/lib/mjs/utils/utils.js +2 -2
- package/lib/mjs/widgets/CalendarWidget.d.ts +1 -1
- package/lib/mjs/widgets/CalendarWidget.js +2 -4
- package/package.json +1 -1
@@ -2375,12 +2375,14 @@ class Component extends Element_1.default {
|
|
2375
2375
|
ckeditor: {
|
2376
2376
|
image: {
|
2377
2377
|
toolbar: [
|
2378
|
+
'toggleImageCaption',
|
2378
2379
|
'imageTextAlternative',
|
2379
2380
|
'|',
|
2380
|
-
'imageStyle:
|
2381
|
-
'imageStyle:
|
2382
|
-
'imageStyle:
|
2383
|
-
'
|
2381
|
+
'imageStyle:inline',
|
2382
|
+
'imageStyle:wrapText',
|
2383
|
+
'imageStyle:breakText',
|
2384
|
+
'|',
|
2385
|
+
'resizeImage'
|
2384
2386
|
],
|
2385
2387
|
styles: [
|
2386
2388
|
'full',
|
@@ -2402,7 +2404,10 @@ class Component extends Element_1.default {
|
|
2402
2404
|
if (this.component.isUploadEnabled) {
|
2403
2405
|
settings.extraPlugins.push((0, uploadAdapter_1.getFormioUploadAdapterPlugin)(this.fileService, this));
|
2404
2406
|
}
|
2405
|
-
|
2407
|
+
Formio_1.Formio.requireLibrary(`ckeditor-css`, isIEBrowser ? 'CKEDITOR' : 'ClassicEditor', [
|
2408
|
+
{ type: 'styles', src: `${Formio_1.Formio.cdn.ckeditor}/ckeditor.css` }
|
2409
|
+
], true);
|
2410
|
+
return Formio_1.Formio.requireLibrary('ckeditor', isIEBrowser ? 'CKEDITOR' : 'ClassicEditor', lodash_1.default.get(this.options, 'editors.ckeditor.src', `${Formio_1.Formio.cdn.ckeditor}/ckeditor.umd.js`), true)
|
2406
2411
|
.then(() => {
|
2407
2412
|
if (!element.parentNode) {
|
2408
2413
|
return Promise.reject();
|
@@ -7,7 +7,7 @@ const Component_1 = __importDefault(require("../_classes/component/Component"));
|
|
7
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
|
-
const
|
10
|
+
const utils_1 = require("../../utils/utils");
|
11
11
|
class DataMapComponent extends DataGrid_1.default {
|
12
12
|
static schema(...extend) {
|
13
13
|
return Component_1.default.schema({
|
@@ -50,7 +50,7 @@ class DataMapComponent extends DataGrid_1.default {
|
|
50
50
|
return lodash_1.default.omit(schema, 'components');
|
51
51
|
}
|
52
52
|
static savedValueTypes(schema) {
|
53
|
-
return (0,
|
53
|
+
return (0, utils_1.getComponentSavedTypes)(schema) || [utils_1.componentValueTypes.object];
|
54
54
|
}
|
55
55
|
constructor(component, options, data) {
|
56
56
|
super(component, options, data);
|
@@ -149,7 +149,7 @@ class DataMapComponent extends DataGrid_1.default {
|
|
149
149
|
getRowKey(rowIndex) {
|
150
150
|
const keys = Object.keys(this.dataValue);
|
151
151
|
if (!keys[rowIndex]) {
|
152
|
-
keys[rowIndex] = (0,
|
152
|
+
keys[rowIndex] = (0, utils_1.uniqueKey)(this.dataValue, this.defaultRowKey);
|
153
153
|
}
|
154
154
|
return keys[rowIndex];
|
155
155
|
}
|
@@ -232,7 +232,7 @@ class DataMapComponent extends DataGrid_1.default {
|
|
232
232
|
components['__key'] = this.createComponent(this.keySchema, options, { __key: this.builderMode ? this.defaultRowKey : key });
|
233
233
|
components['__key'].on('componentChange', (event) => {
|
234
234
|
const dataValue = this.dataValue;
|
235
|
-
const newKey = (0,
|
235
|
+
const newKey = (0, utils_1.uniqueKey)(dataValue, event.value);
|
236
236
|
dataValue[newKey] = dataValue[key];
|
237
237
|
delete dataValue[key];
|
238
238
|
const comp = components[this.valueKey];
|
@@ -53,7 +53,7 @@ class DayComponent extends Field_1.default {
|
|
53
53
|
return (0, utils_1.getComponentSavedTypes)(schema) || [utils_1.componentValueTypes.string];
|
54
54
|
}
|
55
55
|
constructor(component, options, data) {
|
56
|
-
if (!options.inFormBuilder && !options.building) {
|
56
|
+
if (options && !options.inFormBuilder && !options.building) {
|
57
57
|
if (component.maxDate && component.maxDate.indexOf('moment(') === -1) {
|
58
58
|
component.maxDate = (0, moment_1.default)(component.maxDate, 'YYYY-MM-DD').toISOString();
|
59
59
|
}
|
@@ -193,7 +193,12 @@ class TextAreaComponent extends TextField_1.default {
|
|
193
193
|
const editorHeight = (numRows * 31) + 14;
|
194
194
|
editor.ui.view.editable.editableElement.style.height = `${(editorHeight)}px`;
|
195
195
|
}
|
196
|
-
|
196
|
+
if (isReadOnly) {
|
197
|
+
editor.enableReadOnlyMode(this.id);
|
198
|
+
}
|
199
|
+
else {
|
200
|
+
editor.disableReadOnlyMode(this.id);
|
201
|
+
}
|
197
202
|
editor.data.set(value);
|
198
203
|
}
|
199
204
|
editorReady(editor);
|
@@ -1,3 +1,10 @@
|
|
1
|
+
/**
|
2
|
+
* For backwards compatibility we a standalone interpolate function. This merely calls the
|
3
|
+
* global mutable Evaluator instance's interpolate function.
|
4
|
+
* @param {...any} args - interpolate arguments, typically "rawTemplate", "data", and "options"
|
5
|
+
* @returns {any} the interpolation result.
|
6
|
+
*/
|
7
|
+
export function interpolate(...args: any[]): any;
|
1
8
|
/**
|
2
9
|
* Set the evaluator to use for evaluating expressions.
|
3
10
|
* @param {CoreEvaluator} override - The new evaluator instance to use.
|
@@ -11,5 +18,4 @@ export class DefaultEvaluator extends CoreEvaluator {
|
|
11
18
|
interpolate(rawTemplate: any, data: any, _options: any): any;
|
12
19
|
}
|
13
20
|
export let Evaluator: DefaultEvaluator;
|
14
|
-
export function interpolate(rawTemplate: any, data: any, _options: any): any;
|
15
21
|
import { DefaultEvaluator as CoreEvaluator } from '@formio/core';
|
@@ -62,7 +62,16 @@ class DefaultEvaluator extends core_1.DefaultEvaluator {
|
|
62
62
|
exports.DefaultEvaluator = DefaultEvaluator;
|
63
63
|
exports.Evaluator = new DefaultEvaluator();
|
64
64
|
// preserve the standalone interpolate function for backwards compatibility
|
65
|
-
|
65
|
+
/**
|
66
|
+
* For backwards compatibility we a standalone interpolate function. This merely calls the
|
67
|
+
* global mutable Evaluator instance's interpolate function.
|
68
|
+
* @param {...any} args - interpolate arguments, typically "rawTemplate", "data", and "options"
|
69
|
+
* @returns {any} the interpolation result.
|
70
|
+
*/
|
71
|
+
function interpolate(...args) {
|
72
|
+
return exports.Evaluator.interpolate(...args);
|
73
|
+
}
|
74
|
+
exports.interpolate = interpolate;
|
66
75
|
/**
|
67
76
|
* Set the evaluator to use for evaluating expressions.
|
68
77
|
* @param {CoreEvaluator} override - The new evaluator instance to use.
|
package/lib/cjs/utils/index.d.ts
CHANGED
@@ -3,7 +3,12 @@ export * from "./formUtils";
|
|
3
3
|
export default FormioUtils;
|
4
4
|
declare const FormioUtils: {
|
5
5
|
Evaluator: import("./Evaluator").DefaultEvaluator;
|
6
|
-
interpolate:
|
6
|
+
interpolate: typeof interpolate;
|
7
|
+
ConditionOperators: {
|
8
|
+
[x: string]: typeof import("./conditionOperators/IsEqualTo").default | typeof import("./conditionOperators/DateGreaterThan").default;
|
9
|
+
};
|
10
|
+
_: any;
|
11
|
+
moment: typeof moment;
|
7
12
|
flattenComponents: typeof import("@formio/core/lib/utils/formUtil").flattenComponents;
|
8
13
|
guid: typeof import("@formio/core/lib/utils/formUtil").guid;
|
9
14
|
uniqueName: typeof import("@formio/core/lib/utils/formUtil").uniqueName;
|
@@ -133,8 +138,8 @@ declare const FormioUtils: {
|
|
133
138
|
translateHTMLTemplate(template: string, translate: Function): string;
|
134
139
|
sanitize(string: string, options: any): string;
|
135
140
|
fastCloneDeep(obj: any): any;
|
136
|
-
isInputComponent(componentJson: import("@formio/core").Component):
|
137
|
-
getArrayFromComponentPath(pathStr: string):
|
141
|
+
isInputComponent(componentJson: import("@formio/core").Component): boolean;
|
142
|
+
getArrayFromComponentPath(pathStr: string): string[];
|
138
143
|
isChildOf(child: any, parent: any): boolean;
|
139
144
|
getStringFromComponentPath(path: number[]): string;
|
140
145
|
round(number: number, precision: number): string;
|
@@ -160,4 +165,6 @@ declare const FormioUtils: {
|
|
160
165
|
};
|
161
166
|
import { Evaluator } from './Evaluator';
|
162
167
|
import { registerEvaluator } from './Evaluator';
|
168
|
+
import { interpolate } from './Evaluator';
|
169
|
+
import moment from 'moment';
|
163
170
|
export { FormioUtils as Utils, Evaluator, registerEvaluator };
|
package/lib/cjs/utils/index.js
CHANGED
@@ -25,6 +25,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
25
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
26
26
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
27
27
|
};
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
30
|
+
};
|
28
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
29
32
|
exports.registerEvaluator = exports.Evaluator = exports.Utils = void 0;
|
30
33
|
const utils = __importStar(require("./utils"));
|
@@ -32,8 +35,14 @@ const formUtils = __importStar(require("./formUtils"));
|
|
32
35
|
const Evaluator_1 = require("./Evaluator");
|
33
36
|
Object.defineProperty(exports, "Evaluator", { enumerable: true, get: function () { return Evaluator_1.Evaluator; } });
|
34
37
|
Object.defineProperty(exports, "registerEvaluator", { enumerable: true, get: function () { return Evaluator_1.registerEvaluator; } });
|
38
|
+
const conditionOperators_1 = __importDefault(require("./conditionOperators"));
|
39
|
+
const lodash_1 = __importDefault(require("lodash"));
|
40
|
+
const moment_1 = __importDefault(require("moment"));
|
35
41
|
const FormioUtils = Object.assign(Object.assign(Object.assign({}, utils), formUtils), { Evaluator: Evaluator_1.Evaluator,
|
36
|
-
interpolate: Evaluator_1.interpolate
|
42
|
+
interpolate: Evaluator_1.interpolate,
|
43
|
+
ConditionOperators: conditionOperators_1.default,
|
44
|
+
_: lodash_1.default,
|
45
|
+
moment: moment_1.default });
|
37
46
|
exports.Utils = FormioUtils;
|
38
47
|
if (typeof global === 'object') {
|
39
48
|
global.FormioUtils = FormioUtils;
|
package/lib/cjs/utils/utils.d.ts
CHANGED
@@ -403,15 +403,15 @@ export function fastCloneDeep(obj: any): any;
|
|
403
403
|
/**
|
404
404
|
* Returns if the component is an input component.
|
405
405
|
* @param {import('@formio/core').Component} componentJson - The JSON of a component.
|
406
|
-
* @returns {
|
406
|
+
* @returns {boolean} - TRUE if the component is an input component; FALSE otherwise.
|
407
407
|
*/
|
408
|
-
export function isInputComponent(componentJson: import('@formio/core').Component):
|
408
|
+
export function isInputComponent(componentJson: import('@formio/core').Component): boolean;
|
409
409
|
/**
|
410
410
|
* Takes a component path, and returns a component path array.
|
411
411
|
* @param {string} pathStr - The path string to convert to an array.
|
412
|
-
* @returns {
|
412
|
+
* @returns {Array<string>} - The array of paths.
|
413
413
|
*/
|
414
|
-
export function getArrayFromComponentPath(pathStr: string):
|
414
|
+
export function getArrayFromComponentPath(pathStr: string): Array<string>;
|
415
415
|
/**
|
416
416
|
* Returns true if the component is a child of the parent.
|
417
417
|
* @param {any} child - The child component to check.
|
package/lib/cjs/utils/utils.js
CHANGED
@@ -1317,7 +1317,7 @@ exports.fastCloneDeep = fastCloneDeep;
|
|
1317
1317
|
/**
|
1318
1318
|
* Returns if the component is an input component.
|
1319
1319
|
* @param {import('@formio/core').Component} componentJson - The JSON of a component.
|
1320
|
-
* @returns {
|
1320
|
+
* @returns {boolean} - TRUE if the component is an input component; FALSE otherwise.
|
1321
1321
|
*/
|
1322
1322
|
function isInputComponent(componentJson) {
|
1323
1323
|
if (componentJson.input === false || componentJson.input === true) {
|
@@ -1342,7 +1342,7 @@ exports.isInputComponent = isInputComponent;
|
|
1342
1342
|
/**
|
1343
1343
|
* Takes a component path, and returns a component path array.
|
1344
1344
|
* @param {string} pathStr - The path string to convert to an array.
|
1345
|
-
* @returns {
|
1345
|
+
* @returns {Array<string>} - The array of paths.
|
1346
1346
|
*/
|
1347
1347
|
function getArrayFromComponentPath(pathStr) {
|
1348
1348
|
if (!pathStr || !lodash_1.default.isString(pathStr)) {
|
@@ -77,7 +77,7 @@ export default class CalendarWidget extends InputWidget {
|
|
77
77
|
* @returns {void}
|
78
78
|
*/
|
79
79
|
setValue(value: any): void;
|
80
|
-
getValueAsString(value: any, format
|
80
|
+
getValueAsString(value: any, format?: string): string;
|
81
81
|
setErrorClasses(hasErrors: any): void;
|
82
82
|
isCalendarElement(element: any): any;
|
83
83
|
initFlatpickr(Flatpickr: any): void;
|
@@ -265,9 +265,7 @@ class CalendarWidget extends InputWidget_1.default {
|
|
265
265
|
}
|
266
266
|
// If the component is a textfield that does not have timezone information included in the string value then skip
|
267
267
|
// the timezone offset
|
268
|
-
|
269
|
-
this.settings.skipOffset = true;
|
270
|
-
}
|
268
|
+
this.settings.skipOffset = this.component.type === 'textfield' && !(0, utils_1.hasEncodedTimezone)(value);
|
271
269
|
if (value) {
|
272
270
|
if (!saveAsText && this.settings.readOnly) {
|
273
271
|
this.calendar.setDate((0, utils_1.dayjsDate)(value, this.valueFormat, this.timezone).format(), false);
|
@@ -283,7 +281,7 @@ class CalendarWidget extends InputWidget_1.default {
|
|
283
281
|
this.calendar.clear(false);
|
284
282
|
}
|
285
283
|
}
|
286
|
-
getValueAsString(value, format) {
|
284
|
+
getValueAsString(value, format = '') {
|
287
285
|
const inputFormat = format || this.dateFormat;
|
288
286
|
const valueFormat = this.calendar ? this.valueFormat : this.settings.dateFormat;
|
289
287
|
if (this.settings.saveAs === 'text' && this.componentInstance.parent && !this.settings.readOnly) {
|
@@ -2364,12 +2364,14 @@ export default class Component extends Element {
|
|
2364
2364
|
ckeditor: {
|
2365
2365
|
image: {
|
2366
2366
|
toolbar: [
|
2367
|
+
'toggleImageCaption',
|
2367
2368
|
'imageTextAlternative',
|
2368
2369
|
'|',
|
2369
|
-
'imageStyle:
|
2370
|
-
'imageStyle:
|
2371
|
-
'imageStyle:
|
2372
|
-
'
|
2370
|
+
'imageStyle:inline',
|
2371
|
+
'imageStyle:wrapText',
|
2372
|
+
'imageStyle:breakText',
|
2373
|
+
'|',
|
2374
|
+
'resizeImage'
|
2373
2375
|
],
|
2374
2376
|
styles: [
|
2375
2377
|
'full',
|
@@ -2391,7 +2393,10 @@ export default class Component extends Element {
|
|
2391
2393
|
if (this.component.isUploadEnabled) {
|
2392
2394
|
settings.extraPlugins.push(getFormioUploadAdapterPlugin(this.fileService, this));
|
2393
2395
|
}
|
2394
|
-
|
2396
|
+
Formio.requireLibrary(`ckeditor-css`, isIEBrowser ? 'CKEDITOR' : 'ClassicEditor', [
|
2397
|
+
{ type: 'styles', src: `${Formio.cdn.ckeditor}/ckeditor.css` }
|
2398
|
+
], true);
|
2399
|
+
return Formio.requireLibrary('ckeditor', isIEBrowser ? 'CKEDITOR' : 'ClassicEditor', _.get(this.options, 'editors.ckeditor.src', `${Formio.cdn.ckeditor}/ckeditor.umd.js`), true)
|
2395
2400
|
.then(() => {
|
2396
2401
|
if (!element.parentNode) {
|
2397
2402
|
return Promise.reject();
|
@@ -2,7 +2,7 @@ import Component from '../_classes/component/Component';
|
|
2
2
|
import DataGridComponent from '../datagrid/DataGrid';
|
3
3
|
import _ from 'lodash';
|
4
4
|
import EventEmitter from 'eventemitter3';
|
5
|
-
import { componentValueTypes, getComponentSavedTypes, uniqueKey } from '../../utils/
|
5
|
+
import { componentValueTypes, getComponentSavedTypes, uniqueKey } from '../../utils/utils';
|
6
6
|
export default class DataMapComponent extends DataGridComponent {
|
7
7
|
static schema(...extend) {
|
8
8
|
return Component.schema({
|
@@ -53,7 +53,7 @@ export default class DayComponent extends Field {
|
|
53
53
|
// Empty value used before 9.3.x
|
54
54
|
static oldEmptyValue = '00/00/0000';
|
55
55
|
constructor(component, options, data) {
|
56
|
-
if (!options.inFormBuilder && !options.building) {
|
56
|
+
if (options && !options.inFormBuilder && !options.building) {
|
57
57
|
if (component.maxDate && component.maxDate.indexOf('moment(') === -1) {
|
58
58
|
component.maxDate = moment(component.maxDate, 'YYYY-MM-DD').toISOString();
|
59
59
|
}
|
@@ -188,7 +188,12 @@ export default class TextAreaComponent extends TextFieldComponent {
|
|
188
188
|
const editorHeight = (numRows * 31) + 14;
|
189
189
|
editor.ui.view.editable.editableElement.style.height = `${(editorHeight)}px`;
|
190
190
|
}
|
191
|
-
|
191
|
+
if (isReadOnly) {
|
192
|
+
editor.enableReadOnlyMode(this.id);
|
193
|
+
}
|
194
|
+
else {
|
195
|
+
editor.disableReadOnlyMode(this.id);
|
196
|
+
}
|
192
197
|
editor.data.set(value);
|
193
198
|
}
|
194
199
|
editorReady(editor);
|
@@ -1,3 +1,10 @@
|
|
1
|
+
/**
|
2
|
+
* For backwards compatibility we a standalone interpolate function. This merely calls the
|
3
|
+
* global mutable Evaluator instance's interpolate function.
|
4
|
+
* @param {...any} args - interpolate arguments, typically "rawTemplate", "data", and "options"
|
5
|
+
* @returns {any} the interpolation result.
|
6
|
+
*/
|
7
|
+
export function interpolate(...args: any[]): any;
|
1
8
|
/**
|
2
9
|
* Set the evaluator to use for evaluating expressions.
|
3
10
|
* @param {CoreEvaluator} override - The new evaluator instance to use.
|
@@ -11,5 +18,4 @@ export class DefaultEvaluator extends CoreEvaluator {
|
|
11
18
|
interpolate(rawTemplate: any, data: any, _options: any): any;
|
12
19
|
}
|
13
20
|
export let Evaluator: DefaultEvaluator;
|
14
|
-
export function interpolate(rawTemplate: any, data: any, _options: any): any;
|
15
21
|
import { DefaultEvaluator as CoreEvaluator } from '@formio/core';
|
@@ -52,7 +52,15 @@ export class DefaultEvaluator extends CoreEvaluator {
|
|
52
52
|
}
|
53
53
|
export let Evaluator = new DefaultEvaluator();
|
54
54
|
// preserve the standalone interpolate function for backwards compatibility
|
55
|
-
|
55
|
+
/**
|
56
|
+
* For backwards compatibility we a standalone interpolate function. This merely calls the
|
57
|
+
* global mutable Evaluator instance's interpolate function.
|
58
|
+
* @param {...any} args - interpolate arguments, typically "rawTemplate", "data", and "options"
|
59
|
+
* @returns {any} the interpolation result.
|
60
|
+
*/
|
61
|
+
export function interpolate(...args) {
|
62
|
+
return Evaluator.interpolate(...args);
|
63
|
+
}
|
56
64
|
/**
|
57
65
|
* Set the evaluator to use for evaluating expressions.
|
58
66
|
* @param {CoreEvaluator} override - The new evaluator instance to use.
|
package/lib/mjs/utils/index.d.ts
CHANGED
@@ -3,7 +3,12 @@ export * from "./formUtils";
|
|
3
3
|
export default FormioUtils;
|
4
4
|
declare const FormioUtils: {
|
5
5
|
Evaluator: import("./Evaluator").DefaultEvaluator;
|
6
|
-
interpolate:
|
6
|
+
interpolate: typeof interpolate;
|
7
|
+
ConditionOperators: {
|
8
|
+
[x: string]: typeof import("./conditionOperators/IsEqualTo").default | typeof import("./conditionOperators/DateGreaterThan").default;
|
9
|
+
};
|
10
|
+
_: any;
|
11
|
+
moment: typeof moment;
|
7
12
|
flattenComponents: typeof import("@formio/core/lib/utils/formUtil").flattenComponents;
|
8
13
|
guid: typeof import("@formio/core/lib/utils/formUtil").guid;
|
9
14
|
uniqueName: typeof import("@formio/core/lib/utils/formUtil").uniqueName;
|
@@ -133,8 +138,8 @@ declare const FormioUtils: {
|
|
133
138
|
translateHTMLTemplate(template: string, translate: Function): string;
|
134
139
|
sanitize(string: string, options: any): string;
|
135
140
|
fastCloneDeep(obj: any): any;
|
136
|
-
isInputComponent(componentJson: import("@formio/core").Component):
|
137
|
-
getArrayFromComponentPath(pathStr: string):
|
141
|
+
isInputComponent(componentJson: import("@formio/core").Component): boolean;
|
142
|
+
getArrayFromComponentPath(pathStr: string): string[];
|
138
143
|
isChildOf(child: any, parent: any): boolean;
|
139
144
|
getStringFromComponentPath(path: number[]): string;
|
140
145
|
round(number: number, precision: number): string;
|
@@ -160,4 +165,6 @@ declare const FormioUtils: {
|
|
160
165
|
};
|
161
166
|
import { Evaluator } from './Evaluator';
|
162
167
|
import { registerEvaluator } from './Evaluator';
|
168
|
+
import { interpolate } from './Evaluator';
|
169
|
+
import moment from 'moment';
|
163
170
|
export { FormioUtils as Utils, Evaluator, registerEvaluator };
|
package/lib/mjs/utils/index.js
CHANGED
@@ -1,11 +1,17 @@
|
|
1
1
|
import * as utils from './utils';
|
2
2
|
import * as formUtils from './formUtils';
|
3
3
|
import { Evaluator, registerEvaluator, interpolate } from './Evaluator';
|
4
|
+
import ConditionOperators from './conditionOperators';
|
5
|
+
import _ from 'lodash';
|
6
|
+
import moment from 'moment';
|
4
7
|
const FormioUtils = {
|
5
8
|
...utils,
|
6
9
|
...formUtils,
|
7
10
|
Evaluator,
|
8
|
-
interpolate
|
11
|
+
interpolate,
|
12
|
+
ConditionOperators,
|
13
|
+
_,
|
14
|
+
moment
|
9
15
|
};
|
10
16
|
if (typeof global === 'object') {
|
11
17
|
global.FormioUtils = FormioUtils;
|
package/lib/mjs/utils/utils.d.ts
CHANGED
@@ -403,15 +403,15 @@ export function fastCloneDeep(obj: any): any;
|
|
403
403
|
/**
|
404
404
|
* Returns if the component is an input component.
|
405
405
|
* @param {import('@formio/core').Component} componentJson - The JSON of a component.
|
406
|
-
* @returns {
|
406
|
+
* @returns {boolean} - TRUE if the component is an input component; FALSE otherwise.
|
407
407
|
*/
|
408
|
-
export function isInputComponent(componentJson: import('@formio/core').Component):
|
408
|
+
export function isInputComponent(componentJson: import('@formio/core').Component): boolean;
|
409
409
|
/**
|
410
410
|
* Takes a component path, and returns a component path array.
|
411
411
|
* @param {string} pathStr - The path string to convert to an array.
|
412
|
-
* @returns {
|
412
|
+
* @returns {Array<string>} - The array of paths.
|
413
413
|
*/
|
414
|
-
export function getArrayFromComponentPath(pathStr: string):
|
414
|
+
export function getArrayFromComponentPath(pathStr: string): Array<string>;
|
415
415
|
/**
|
416
416
|
* Returns true if the component is a child of the parent.
|
417
417
|
* @param {any} child - The child component to check.
|
package/lib/mjs/utils/utils.js
CHANGED
@@ -1257,7 +1257,7 @@ export function fastCloneDeep(obj) {
|
|
1257
1257
|
/**
|
1258
1258
|
* Returns if the component is an input component.
|
1259
1259
|
* @param {import('@formio/core').Component} componentJson - The JSON of a component.
|
1260
|
-
* @returns {
|
1260
|
+
* @returns {boolean} - TRUE if the component is an input component; FALSE otherwise.
|
1261
1261
|
*/
|
1262
1262
|
export function isInputComponent(componentJson) {
|
1263
1263
|
if (componentJson.input === false || componentJson.input === true) {
|
@@ -1281,7 +1281,7 @@ export function isInputComponent(componentJson) {
|
|
1281
1281
|
/**
|
1282
1282
|
* Takes a component path, and returns a component path array.
|
1283
1283
|
* @param {string} pathStr - The path string to convert to an array.
|
1284
|
-
* @returns {
|
1284
|
+
* @returns {Array<string>} - The array of paths.
|
1285
1285
|
*/
|
1286
1286
|
export function getArrayFromComponentPath(pathStr) {
|
1287
1287
|
if (!pathStr || !_.isString(pathStr)) {
|
@@ -77,7 +77,7 @@ export default class CalendarWidget extends InputWidget {
|
|
77
77
|
* @returns {void}
|
78
78
|
*/
|
79
79
|
setValue(value: any): void;
|
80
|
-
getValueAsString(value: any, format
|
80
|
+
getValueAsString(value: any, format?: string): string;
|
81
81
|
setErrorClasses(hasErrors: any): void;
|
82
82
|
isCalendarElement(element: any): any;
|
83
83
|
initFlatpickr(Flatpickr: any): void;
|
@@ -257,9 +257,7 @@ export default class CalendarWidget extends InputWidget {
|
|
257
257
|
}
|
258
258
|
// If the component is a textfield that does not have timezone information included in the string value then skip
|
259
259
|
// the timezone offset
|
260
|
-
|
261
|
-
this.settings.skipOffset = true;
|
262
|
-
}
|
260
|
+
this.settings.skipOffset = this.component.type === 'textfield' && !hasEncodedTimezone(value);
|
263
261
|
if (value) {
|
264
262
|
if (!saveAsText && this.settings.readOnly) {
|
265
263
|
this.calendar.setDate(dayjsDate(value, this.valueFormat, this.timezone).format(), false);
|
@@ -275,7 +273,7 @@ export default class CalendarWidget extends InputWidget {
|
|
275
273
|
this.calendar.clear(false);
|
276
274
|
}
|
277
275
|
}
|
278
|
-
getValueAsString(value, format) {
|
276
|
+
getValueAsString(value, format = '') {
|
279
277
|
const inputFormat = format || this.dateFormat;
|
280
278
|
const valueFormat = this.calendar ? this.valueFormat : this.settings.dateFormat;
|
281
279
|
if (this.settings.saveAs === 'text' && this.componentInstance.parent && !this.settings.readOnly) {
|