@formio/js 5.1.0-dev.6046.0d30acf → 5.1.0-dev.6048.569bfc1
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 +5 -5
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +6 -6
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.utils.js +1 -1
- package/dist/formio.utils.min.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +14 -0
- package/lib/cjs/components/_classes/component/Component.js +35 -11
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +0 -1
- package/lib/cjs/components/_classes/nested/NestedComponent.js +0 -11
- package/lib/cjs/components/address/Address.d.ts +1 -0
- package/lib/cjs/components/datagrid/DataGrid.js +0 -3
- package/lib/cjs/components/editgrid/EditGrid.js +0 -8
- package/lib/cjs/components/select/editForm/Select.edit.data.js +1 -1
- package/lib/cjs/utils/utils.d.ts +0 -8
- package/lib/cjs/utils/utils.js +1 -22
- package/lib/mjs/components/_classes/component/Component.d.ts +14 -0
- package/lib/mjs/components/_classes/component/Component.js +36 -12
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +0 -1
- package/lib/mjs/components/_classes/nested/NestedComponent.js +0 -11
- package/lib/mjs/components/address/Address.d.ts +1 -0
- package/lib/mjs/components/datagrid/DataGrid.js +0 -3
- package/lib/mjs/components/editgrid/EditGrid.js +0 -7
- package/lib/mjs/components/select/editForm/Select.edit.data.js +1 -1
- package/lib/mjs/utils/utils.d.ts +0 -8
- package/lib/mjs/utils/utils.js +0 -20
- package/package.json +1 -1
@@ -129,6 +129,16 @@ declare class Component extends Element {
|
|
129
129
|
* The reference attribute name for this component
|
130
130
|
*/
|
131
131
|
_referenceAttributeName: string;
|
132
|
+
/**
|
133
|
+
* Sometimes the customDefaultValue does not set the "value" within the script, but is just a script to execute. This
|
134
|
+
* flag is used to determine if the customDefaultValue should be used to set the value of the component or not based on
|
135
|
+
* if there is a "value=" within the script.
|
136
|
+
*/
|
137
|
+
shouldSetCustomDefault: any;
|
138
|
+
/**
|
139
|
+
* Same as customDefaultValue, but for calculateValue.
|
140
|
+
*/
|
141
|
+
shouldSetCalculatedValue: any;
|
132
142
|
triggerChange: (...args: any[]) => any;
|
133
143
|
/**
|
134
144
|
* Used to trigger a redraw event within this component.
|
@@ -778,6 +788,10 @@ declare class Component extends Element {
|
|
778
788
|
* @returns {void}
|
779
789
|
*/
|
780
790
|
setElementInvalid(element: HTMLElement, invalid: boolean): void;
|
791
|
+
/**
|
792
|
+
* Clear any conditionally hidden components for this component only.
|
793
|
+
*/
|
794
|
+
clearComponentOnHide(): void;
|
781
795
|
/**
|
782
796
|
* Clears the components data if it is conditionally hidden AND clearOnHide is set to true for this component.
|
783
797
|
*/
|
@@ -361,6 +361,22 @@ class Component extends Element_1.default {
|
|
361
361
|
* The reference attribute name for this component
|
362
362
|
*/
|
363
363
|
this._referenceAttributeName = 'ref';
|
364
|
+
/**
|
365
|
+
* Sometimes the customDefaultValue does not set the "value" within the script, but is just a script to execute. This
|
366
|
+
* flag is used to determine if the customDefaultValue should be used to set the value of the component or not based on
|
367
|
+
* if there is a "value=" within the script.
|
368
|
+
*/
|
369
|
+
this.shouldSetCustomDefault = true;
|
370
|
+
if (this.component.customDefaultValue && (typeof this.component.customDefaultValue === 'string')) {
|
371
|
+
this.shouldSetCustomDefault = this.component.customDefaultValue.match(/value\s*=/);
|
372
|
+
}
|
373
|
+
/**
|
374
|
+
* Same as customDefaultValue, but for calculateValue.
|
375
|
+
*/
|
376
|
+
this.shouldSetCalculatedValue = true;
|
377
|
+
if (this.component.calculateValue && (typeof this.component.calculateValue === 'string')) {
|
378
|
+
this.shouldSetCalculatedValue = this.component.calculateValue.match(/value\s*=/);
|
379
|
+
}
|
364
380
|
/**
|
365
381
|
* Used to trigger a new change in this component.
|
366
382
|
* @type {Function} - Call to trigger a change in this component.
|
@@ -1954,7 +1970,7 @@ class Component extends Element_1.default {
|
|
1954
1970
|
if (this.visible !== visible) {
|
1955
1971
|
this.visible = visible;
|
1956
1972
|
}
|
1957
|
-
this.
|
1973
|
+
this.clearComponentOnHide();
|
1958
1974
|
return visible;
|
1959
1975
|
}
|
1960
1976
|
/**
|
@@ -2214,16 +2230,11 @@ class Component extends Element_1.default {
|
|
2214
2230
|
element.setAttribute('aria-invalid', invalid ? 'true' : 'false');
|
2215
2231
|
}
|
2216
2232
|
/**
|
2217
|
-
*
|
2233
|
+
* Clear any conditionally hidden components for this component only.
|
2218
2234
|
*/
|
2219
|
-
|
2235
|
+
clearComponentOnHide() {
|
2220
2236
|
// clearOnHide defaults to true for old forms (without the value set) so only trigger if the value is false.
|
2221
|
-
if (
|
2222
|
-
// if change happens inside EditGrid's row, it doesn't trigger change on the root level, so rootPristine will be true
|
2223
|
-
(!this.rootPristine || this.options.server || (0, utils_1.isInsideScopingComponent)(this)) &&
|
2224
|
-
this.component.clearOnHide !== false &&
|
2225
|
-
!this.options.readOnly &&
|
2226
|
-
!this.options.showHiddenFields) {
|
2237
|
+
if (this.component.clearOnHide !== false && !this.options.readOnly && !this.options.showHiddenFields) {
|
2227
2238
|
if (this.conditionallyHidden()) {
|
2228
2239
|
this.deleteValue();
|
2229
2240
|
}
|
@@ -2235,6 +2246,12 @@ class Component extends Element_1.default {
|
|
2235
2246
|
}
|
2236
2247
|
}
|
2237
2248
|
}
|
2249
|
+
/**
|
2250
|
+
* Clears the components data if it is conditionally hidden AND clearOnHide is set to true for this component.
|
2251
|
+
*/
|
2252
|
+
clearOnHide() {
|
2253
|
+
this.clearComponentOnHide();
|
2254
|
+
}
|
2238
2255
|
/**
|
2239
2256
|
* Triggers a debounced onChange event for the root component (usually Webform).
|
2240
2257
|
* @param {...any} args - The arguments to pass to the onChange event.
|
@@ -2535,7 +2552,10 @@ class Component extends Element_1.default {
|
|
2535
2552
|
}
|
2536
2553
|
getCustomDefaultValue(defaultValue) {
|
2537
2554
|
if (this.component.customDefaultValue && !this.options.preview) {
|
2538
|
-
|
2555
|
+
const customDefaultValue = this.evaluate(this.component.customDefaultValue, { value: '' }, 'value');
|
2556
|
+
if (this.shouldSetCustomDefault) {
|
2557
|
+
defaultValue = customDefaultValue;
|
2558
|
+
}
|
2539
2559
|
}
|
2540
2560
|
return defaultValue;
|
2541
2561
|
}
|
@@ -2795,7 +2815,7 @@ class Component extends Element_1.default {
|
|
2795
2815
|
}
|
2796
2816
|
doValueCalculation(dataValue, data, row) {
|
2797
2817
|
var _a;
|
2798
|
-
|
2818
|
+
const calculatedValue = this.evaluate(this.component.calculateValue, {
|
2799
2819
|
value: dataValue,
|
2800
2820
|
data,
|
2801
2821
|
row: row || this.data,
|
@@ -2803,6 +2823,10 @@ class Component extends Element_1.default {
|
|
2803
2823
|
data: this.rootValue
|
2804
2824
|
}
|
2805
2825
|
}, 'value');
|
2826
|
+
if (this.shouldSetCalculatedValue) {
|
2827
|
+
return calculatedValue;
|
2828
|
+
}
|
2829
|
+
return dataValue;
|
2806
2830
|
}
|
2807
2831
|
/* eslint-disable max-statements */
|
2808
2832
|
calculateComponentValue(data, flags, row) {
|
@@ -181,7 +181,6 @@ export default class NestedComponent extends Field {
|
|
181
181
|
checkData(data: any, flags: any, row: any, components: any): true | undefined;
|
182
182
|
checkConditions(data: any, flags: any, row: any): boolean;
|
183
183
|
clearOnHide(show: any): void;
|
184
|
-
restoreComponentsContext(): void;
|
185
184
|
/**
|
186
185
|
* Allow components to hook into the next page trigger to perform their own logic.
|
187
186
|
* @param {Function} next - The callback to continue to the next page.
|
@@ -631,19 +631,8 @@ class NestedComponent extends Field_1.default {
|
|
631
631
|
}
|
632
632
|
clearOnHide(show) {
|
633
633
|
super.clearOnHide(show);
|
634
|
-
if (this.component.clearOnHide) {
|
635
|
-
if (this.allowData && !this.hasValue() && !this.conditionallyHidden()) {
|
636
|
-
this.dataValue = this.defaultValue;
|
637
|
-
}
|
638
|
-
if (this.hasValue()) {
|
639
|
-
this.restoreComponentsContext();
|
640
|
-
}
|
641
|
-
}
|
642
634
|
this.getComponents().forEach(component => component.clearOnHide(show));
|
643
635
|
}
|
644
|
-
restoreComponentsContext() {
|
645
|
-
this.getComponents().forEach((component) => component.data = this.dataValue);
|
646
|
-
}
|
647
636
|
/**
|
648
637
|
* Allow components to hook into the next page trigger to perform their own logic.
|
649
638
|
* @param {Function} next - The callback to continue to the next page.
|
@@ -36,6 +36,7 @@ export default class AddressComponent extends ContainerComponent {
|
|
36
36
|
get autocompleteMode(): boolean;
|
37
37
|
get manualMode(): boolean;
|
38
38
|
get manualModeEnabled(): boolean;
|
39
|
+
restoreComponentsContext(): void;
|
39
40
|
get isMultiple(): boolean;
|
40
41
|
set address(value: any);
|
41
42
|
get address(): any;
|
@@ -613,9 +613,6 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
613
613
|
this.updateOnChange(flags, changed);
|
614
614
|
return changed;
|
615
615
|
}
|
616
|
-
restoreComponentsContext() {
|
617
|
-
this.rows.forEach((row, index) => lodash_1.default.forIn(row, (component) => component.data = this.dataValue[index]));
|
618
|
-
}
|
619
616
|
toggleGroup(element, index) {
|
620
617
|
element.classList.toggle('collapsed');
|
621
618
|
lodash_1.default.each(this.refs.chunks[index], row => {
|
@@ -553,14 +553,6 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
553
553
|
}
|
554
554
|
});
|
555
555
|
}
|
556
|
-
restoreComponentsContext() {
|
557
|
-
this.getComponents().forEach((component) => {
|
558
|
-
var _a;
|
559
|
-
const rowData = this.dataValue[component.rowIndex];
|
560
|
-
const editRowData = (_a = this.editRows[component.rowIndex]) === null || _a === void 0 ? void 0 : _a.data;
|
561
|
-
component.data = rowData || editRowData;
|
562
|
-
});
|
563
|
-
}
|
564
556
|
flattenComponents(rowIndex) {
|
565
557
|
const result = {};
|
566
558
|
this.everyComponent((component) => {
|
package/lib/cjs/utils/utils.d.ts
CHANGED
@@ -478,14 +478,6 @@ export function getDataParentComponent(componentInstance: Component): Component
|
|
478
478
|
* @returns {boolean} - TRUE if the value is a promise; FALSE otherwise
|
479
479
|
*/
|
480
480
|
export function isPromise(value: any): boolean;
|
481
|
-
/**
|
482
|
-
* Determines if the component has a scoping parent in tree (a component which scopes its children and manages its
|
483
|
-
* changes by itself, e.g. EditGrid)
|
484
|
-
* @param {Component} componentInstance - The component to check for the scoping parent.
|
485
|
-
* @param {boolean} firstPass - Whether it is the first pass of the function
|
486
|
-
* @returns {boolean|*} - TRUE if the component has a scoping parent; FALSE otherwise
|
487
|
-
*/
|
488
|
-
export function isInsideScopingComponent(componentInstance: Component, firstPass?: boolean): boolean | any;
|
489
481
|
/**
|
490
482
|
* Returns all the focusable elements within the provided dom element.
|
491
483
|
* @param {HTMLElement} element - The element to get the focusable elements from.
|
package/lib/cjs/utils/utils.js
CHANGED
@@ -19,7 +19,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
19
19
|
};
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
21
21
|
exports.firstNonNil = exports.unfold = exports.bootstrapVersion = exports.uniqueKey = exports.iterateKey = exports.delay = exports.fieldData = exports.getCurrencyAffixes = exports.getNumberDecimalLimit = exports.getNumberSeparators = exports.matchInputMask = exports.unmaskValue = exports.getInputMask = exports.convertFormatToMask = exports.convertFormatToMoment = exports.convertFormatToFlatpickr = exports.getLocaleDateFormatInfo = exports.formatOffset = exports.formatDate = exports.momentDate = exports.loadZones = exports.shouldLoadZones = exports.zonesLoaded = exports.offsetDate = exports.currentTimezone = exports.isValidDate = exports.getDateSetting = exports.guid = exports.uniqueName = exports.convertStringToHTMLElement = exports.unescapeHTML = exports.removeHTML = exports.setActionProperty = exports.checkTrigger = exports.checkCondition = exports.checkJsonConditional = exports.checkCustomConditional = exports.getComponentActualValue = exports.checkSimpleConditional = exports.checkCalculated = exports.isMongoId = exports.boolValue = exports.getScriptPlugin = exports.getElementRect = exports.getPropertyValue = exports.getRandomComponentId = exports.evaluate = exports.moment = exports.ConditionOperators = exports.jsonLogic = void 0;
|
22
|
-
exports.interpolateErrors = exports.getComponentSavedTypes = exports.componentValueTypes = exports._ = exports.getFocusableElements = exports.
|
22
|
+
exports.interpolateErrors = exports.getComponentSavedTypes = exports.componentValueTypes = exports._ = exports.getFocusableElements = exports.isPromise = exports.getDataParentComponent = exports.getComponentPath = exports.getComponentPathWithoutIndicies = exports.getBrowserInfo = exports.getIEBrowserVersion = exports.round = exports.getStringFromComponentPath = exports.isChildOf = exports.getArrayFromComponentPath = exports.isInputComponent = exports.interpolate = exports.Evaluator = exports.fastCloneDeep = exports.sanitize = exports.translateHTMLTemplate = exports.getContextButtons = exports.getContextComponents = exports.observeOverload = exports.withSwitch = void 0;
|
23
23
|
const lodash_1 = __importDefault(require("lodash"));
|
24
24
|
exports._ = lodash_1.default;
|
25
25
|
const json_logic_js_1 = __importDefault(require("json-logic-js"));
|
@@ -1593,27 +1593,6 @@ function isPromise(value) {
|
|
1593
1593
|
&& Object.prototype.toString.call(value) === '[object Promise]';
|
1594
1594
|
}
|
1595
1595
|
exports.isPromise = isPromise;
|
1596
|
-
/**
|
1597
|
-
* Determines if the component has a scoping parent in tree (a component which scopes its children and manages its
|
1598
|
-
* changes by itself, e.g. EditGrid)
|
1599
|
-
* @param {Component} componentInstance - The component to check for the scoping parent.
|
1600
|
-
* @param {boolean} firstPass - Whether it is the first pass of the function
|
1601
|
-
* @returns {boolean|*} - TRUE if the component has a scoping parent; FALSE otherwise
|
1602
|
-
*/
|
1603
|
-
function isInsideScopingComponent(componentInstance, firstPass = true) {
|
1604
|
-
if (!firstPass && (componentInstance === null || componentInstance === void 0 ? void 0 : componentInstance.hasScopedChildren)) {
|
1605
|
-
return true;
|
1606
|
-
}
|
1607
|
-
const dataParent = getDataParentComponent(componentInstance);
|
1608
|
-
if (dataParent === null || dataParent === void 0 ? void 0 : dataParent.hasScopedChildren) {
|
1609
|
-
return true;
|
1610
|
-
}
|
1611
|
-
else if (dataParent === null || dataParent === void 0 ? void 0 : dataParent.parent) {
|
1612
|
-
return isInsideScopingComponent(dataParent.parent, false);
|
1613
|
-
}
|
1614
|
-
return false;
|
1615
|
-
}
|
1616
|
-
exports.isInsideScopingComponent = isInsideScopingComponent;
|
1617
1596
|
/**
|
1618
1597
|
* Returns all the focusable elements within the provided dom element.
|
1619
1598
|
* @param {HTMLElement} element - The element to get the focusable elements from.
|
@@ -129,6 +129,16 @@ declare class Component extends Element {
|
|
129
129
|
* The reference attribute name for this component
|
130
130
|
*/
|
131
131
|
_referenceAttributeName: string;
|
132
|
+
/**
|
133
|
+
* Sometimes the customDefaultValue does not set the "value" within the script, but is just a script to execute. This
|
134
|
+
* flag is used to determine if the customDefaultValue should be used to set the value of the component or not based on
|
135
|
+
* if there is a "value=" within the script.
|
136
|
+
*/
|
137
|
+
shouldSetCustomDefault: any;
|
138
|
+
/**
|
139
|
+
* Same as customDefaultValue, but for calculateValue.
|
140
|
+
*/
|
141
|
+
shouldSetCalculatedValue: any;
|
132
142
|
triggerChange: (...args: any[]) => any;
|
133
143
|
/**
|
134
144
|
* Used to trigger a redraw event within this component.
|
@@ -778,6 +788,10 @@ declare class Component extends Element {
|
|
778
788
|
* @returns {void}
|
779
789
|
*/
|
780
790
|
setElementInvalid(element: HTMLElement, invalid: boolean): void;
|
791
|
+
/**
|
792
|
+
* Clear any conditionally hidden components for this component only.
|
793
|
+
*/
|
794
|
+
clearComponentOnHide(): void;
|
781
795
|
/**
|
782
796
|
* Clears the components data if it is conditionally hidden AND clearOnHide is set to true for this component.
|
783
797
|
*/
|
@@ -6,7 +6,7 @@ import isMobile from 'ismobilejs';
|
|
6
6
|
import { processOne, processOneSync, validateProcessInfo } from '@formio/core/process';
|
7
7
|
import { Formio } from '../../../Formio';
|
8
8
|
import * as FormioUtils from '../../../utils/utils';
|
9
|
-
import { fastCloneDeep, boolValue,
|
9
|
+
import { fastCloneDeep, boolValue, currentTimezone, getScriptPlugin, getContextualRowData } from '../../../utils/utils';
|
10
10
|
import Element from '../../../Element';
|
11
11
|
import ComponentModal from '../componentModal/ComponentModal';
|
12
12
|
import Widgets from '../../../widgets';
|
@@ -326,6 +326,22 @@ export default class Component extends Element {
|
|
326
326
|
* The reference attribute name for this component
|
327
327
|
*/
|
328
328
|
this._referenceAttributeName = 'ref';
|
329
|
+
/**
|
330
|
+
* Sometimes the customDefaultValue does not set the "value" within the script, but is just a script to execute. This
|
331
|
+
* flag is used to determine if the customDefaultValue should be used to set the value of the component or not based on
|
332
|
+
* if there is a "value=" within the script.
|
333
|
+
*/
|
334
|
+
this.shouldSetCustomDefault = true;
|
335
|
+
if (this.component.customDefaultValue && (typeof this.component.customDefaultValue === 'string')) {
|
336
|
+
this.shouldSetCustomDefault = this.component.customDefaultValue.match(/value\s*=/);
|
337
|
+
}
|
338
|
+
/**
|
339
|
+
* Same as customDefaultValue, but for calculateValue.
|
340
|
+
*/
|
341
|
+
this.shouldSetCalculatedValue = true;
|
342
|
+
if (this.component.calculateValue && (typeof this.component.calculateValue === 'string')) {
|
343
|
+
this.shouldSetCalculatedValue = this.component.calculateValue.match(/value\s*=/);
|
344
|
+
}
|
329
345
|
/**
|
330
346
|
* Used to trigger a new change in this component.
|
331
347
|
* @type {Function} - Call to trigger a change in this component.
|
@@ -1920,7 +1936,7 @@ export default class Component extends Element {
|
|
1920
1936
|
if (this.visible !== visible) {
|
1921
1937
|
this.visible = visible;
|
1922
1938
|
}
|
1923
|
-
this.
|
1939
|
+
this.clearComponentOnHide();
|
1924
1940
|
return visible;
|
1925
1941
|
}
|
1926
1942
|
/**
|
@@ -2180,16 +2196,11 @@ export default class Component extends Element {
|
|
2180
2196
|
element.setAttribute('aria-invalid', invalid ? 'true' : 'false');
|
2181
2197
|
}
|
2182
2198
|
/**
|
2183
|
-
*
|
2199
|
+
* Clear any conditionally hidden components for this component only.
|
2184
2200
|
*/
|
2185
|
-
|
2201
|
+
clearComponentOnHide() {
|
2186
2202
|
// clearOnHide defaults to true for old forms (without the value set) so only trigger if the value is false.
|
2187
|
-
if (
|
2188
|
-
// if change happens inside EditGrid's row, it doesn't trigger change on the root level, so rootPristine will be true
|
2189
|
-
(!this.rootPristine || this.options.server || isInsideScopingComponent(this)) &&
|
2190
|
-
this.component.clearOnHide !== false &&
|
2191
|
-
!this.options.readOnly &&
|
2192
|
-
!this.options.showHiddenFields) {
|
2203
|
+
if (this.component.clearOnHide !== false && !this.options.readOnly && !this.options.showHiddenFields) {
|
2193
2204
|
if (this.conditionallyHidden()) {
|
2194
2205
|
this.deleteValue();
|
2195
2206
|
}
|
@@ -2201,6 +2212,12 @@ export default class Component extends Element {
|
|
2201
2212
|
}
|
2202
2213
|
}
|
2203
2214
|
}
|
2215
|
+
/**
|
2216
|
+
* Clears the components data if it is conditionally hidden AND clearOnHide is set to true for this component.
|
2217
|
+
*/
|
2218
|
+
clearOnHide() {
|
2219
|
+
this.clearComponentOnHide();
|
2220
|
+
}
|
2204
2221
|
/**
|
2205
2222
|
* Triggers a debounced onChange event for the root component (usually Webform).
|
2206
2223
|
* @param {...any} args - The arguments to pass to the onChange event.
|
@@ -2504,7 +2521,10 @@ export default class Component extends Element {
|
|
2504
2521
|
}
|
2505
2522
|
getCustomDefaultValue(defaultValue) {
|
2506
2523
|
if (this.component.customDefaultValue && !this.options.preview) {
|
2507
|
-
|
2524
|
+
const customDefaultValue = this.evaluate(this.component.customDefaultValue, { value: '' }, 'value');
|
2525
|
+
if (this.shouldSetCustomDefault) {
|
2526
|
+
defaultValue = customDefaultValue;
|
2527
|
+
}
|
2508
2528
|
}
|
2509
2529
|
return defaultValue;
|
2510
2530
|
}
|
@@ -2763,7 +2783,7 @@ export default class Component extends Element {
|
|
2763
2783
|
return value;
|
2764
2784
|
}
|
2765
2785
|
doValueCalculation(dataValue, data, row) {
|
2766
|
-
|
2786
|
+
const calculatedValue = this.evaluate(this.component.calculateValue, {
|
2767
2787
|
value: dataValue,
|
2768
2788
|
data,
|
2769
2789
|
row: row || this.data,
|
@@ -2771,6 +2791,10 @@ export default class Component extends Element {
|
|
2771
2791
|
data: this.rootValue
|
2772
2792
|
}
|
2773
2793
|
}, 'value');
|
2794
|
+
if (this.shouldSetCalculatedValue) {
|
2795
|
+
return calculatedValue;
|
2796
|
+
}
|
2797
|
+
return dataValue;
|
2774
2798
|
}
|
2775
2799
|
/* eslint-disable max-statements */
|
2776
2800
|
calculateComponentValue(data, flags, row) {
|
@@ -181,7 +181,6 @@ export default class NestedComponent extends Field {
|
|
181
181
|
checkData(data: any, flags: any, row: any, components: any): true | undefined;
|
182
182
|
checkConditions(data: any, flags: any, row: any): boolean;
|
183
183
|
clearOnHide(show: any): void;
|
184
|
-
restoreComponentsContext(): void;
|
185
184
|
/**
|
186
185
|
* Allow components to hook into the next page trigger to perform their own logic.
|
187
186
|
* @param {Function} next - The callback to continue to the next page.
|
@@ -627,19 +627,8 @@ export default class NestedComponent extends Field {
|
|
627
627
|
}
|
628
628
|
clearOnHide(show) {
|
629
629
|
super.clearOnHide(show);
|
630
|
-
if (this.component.clearOnHide) {
|
631
|
-
if (this.allowData && !this.hasValue() && !this.conditionallyHidden()) {
|
632
|
-
this.dataValue = this.defaultValue;
|
633
|
-
}
|
634
|
-
if (this.hasValue()) {
|
635
|
-
this.restoreComponentsContext();
|
636
|
-
}
|
637
|
-
}
|
638
630
|
this.getComponents().forEach(component => component.clearOnHide(show));
|
639
631
|
}
|
640
|
-
restoreComponentsContext() {
|
641
|
-
this.getComponents().forEach((component) => component.data = this.dataValue);
|
642
|
-
}
|
643
632
|
/**
|
644
633
|
* Allow components to hook into the next page trigger to perform their own logic.
|
645
634
|
* @param {Function} next - The callback to continue to the next page.
|
@@ -36,6 +36,7 @@ export default class AddressComponent extends ContainerComponent {
|
|
36
36
|
get autocompleteMode(): boolean;
|
37
37
|
get manualMode(): boolean;
|
38
38
|
get manualModeEnabled(): boolean;
|
39
|
+
restoreComponentsContext(): void;
|
39
40
|
get isMultiple(): boolean;
|
40
41
|
set address(value: any);
|
41
42
|
get address(): any;
|
@@ -609,9 +609,6 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
609
609
|
this.updateOnChange(flags, changed);
|
610
610
|
return changed;
|
611
611
|
}
|
612
|
-
restoreComponentsContext() {
|
613
|
-
this.rows.forEach((row, index) => _.forIn(row, (component) => component.data = this.dataValue[index]));
|
614
|
-
}
|
615
612
|
toggleGroup(element, index) {
|
616
613
|
element.classList.toggle('collapsed');
|
617
614
|
_.each(this.refs.chunks[index], row => {
|
@@ -546,13 +546,6 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
546
546
|
}
|
547
547
|
});
|
548
548
|
}
|
549
|
-
restoreComponentsContext() {
|
550
|
-
this.getComponents().forEach((component) => {
|
551
|
-
const rowData = this.dataValue[component.rowIndex];
|
552
|
-
const editRowData = this.editRows[component.rowIndex]?.data;
|
553
|
-
component.data = rowData || editRowData;
|
554
|
-
});
|
555
|
-
}
|
556
549
|
flattenComponents(rowIndex) {
|
557
550
|
const result = {};
|
558
551
|
this.everyComponent((component) => {
|
package/lib/mjs/utils/utils.d.ts
CHANGED
@@ -478,14 +478,6 @@ export function getDataParentComponent(componentInstance: Component): Component
|
|
478
478
|
* @returns {boolean} - TRUE if the value is a promise; FALSE otherwise
|
479
479
|
*/
|
480
480
|
export function isPromise(value: any): boolean;
|
481
|
-
/**
|
482
|
-
* Determines if the component has a scoping parent in tree (a component which scopes its children and manages its
|
483
|
-
* changes by itself, e.g. EditGrid)
|
484
|
-
* @param {Component} componentInstance - The component to check for the scoping parent.
|
485
|
-
* @param {boolean} firstPass - Whether it is the first pass of the function
|
486
|
-
* @returns {boolean|*} - TRUE if the component has a scoping parent; FALSE otherwise
|
487
|
-
*/
|
488
|
-
export function isInsideScopingComponent(componentInstance: Component, firstPass?: boolean): boolean | any;
|
489
481
|
/**
|
490
482
|
* Returns all the focusable elements within the provided dom element.
|
491
483
|
* @param {HTMLElement} element - The element to get the focusable elements from.
|
package/lib/mjs/utils/utils.js
CHANGED
@@ -1502,26 +1502,6 @@ export function isPromise(value) {
|
|
1502
1502
|
&& typeof value.then === 'function'
|
1503
1503
|
&& Object.prototype.toString.call(value) === '[object Promise]';
|
1504
1504
|
}
|
1505
|
-
/**
|
1506
|
-
* Determines if the component has a scoping parent in tree (a component which scopes its children and manages its
|
1507
|
-
* changes by itself, e.g. EditGrid)
|
1508
|
-
* @param {Component} componentInstance - The component to check for the scoping parent.
|
1509
|
-
* @param {boolean} firstPass - Whether it is the first pass of the function
|
1510
|
-
* @returns {boolean|*} - TRUE if the component has a scoping parent; FALSE otherwise
|
1511
|
-
*/
|
1512
|
-
export function isInsideScopingComponent(componentInstance, firstPass = true) {
|
1513
|
-
if (!firstPass && componentInstance?.hasScopedChildren) {
|
1514
|
-
return true;
|
1515
|
-
}
|
1516
|
-
const dataParent = getDataParentComponent(componentInstance);
|
1517
|
-
if (dataParent?.hasScopedChildren) {
|
1518
|
-
return true;
|
1519
|
-
}
|
1520
|
-
else if (dataParent?.parent) {
|
1521
|
-
return isInsideScopingComponent(dataParent.parent, false);
|
1522
|
-
}
|
1523
|
-
return false;
|
1524
|
-
}
|
1525
1505
|
/**
|
1526
1506
|
* Returns all the focusable elements within the provided dom element.
|
1527
1507
|
* @param {HTMLElement} element - The element to get the focusable elements from.
|