@aemforms/af-core 0.22.66 → 0.22.67
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/lib/Form.js +28 -26
- package/package.json +2 -2
package/lib/Form.js
CHANGED
|
@@ -7,7 +7,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
7
7
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
8
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
9
|
};
|
|
10
|
-
var _Form_instances, _Form_getNavigableChildren, _Form_getFirstNavigableChild, _Form_setActiveFirstDeepChild, _Form_getNextItem, _Form_getPreviousItem;
|
|
10
|
+
var _Form_instances, _Form_getNavigableChildren, _Form_getFirstNavigableChild, _Form_setActiveFirstDeepChild, _Form_getNextItem, _Form_getPreviousItem, _Form_clearCurrentFocus;
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const Container_1 = __importDefault(require("./Container"));
|
|
13
13
|
const FormMetaData_1 = __importDefault(require("./FormMetaData"));
|
|
@@ -82,32 +82,28 @@ class Form extends Container_1.default {
|
|
|
82
82
|
return submitMetaInstance;
|
|
83
83
|
}
|
|
84
84
|
setFocus(field, focusOption) {
|
|
85
|
-
if (focusOption) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
let currActiveChildIndex = activeChild !== null ? navigableChidren.indexOf(activeChild) : -1;
|
|
90
|
-
if (parent.activeChild === null) {
|
|
91
|
-
__classPrivateFieldGet(this, _Form_instances, "m", _Form_setActiveFirstDeepChild).call(this, navigableChidren[0]);
|
|
92
|
-
currActiveChildIndex = 0;
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
if (focusOption === Model_1.FocusOption.NEXT_ITEM) {
|
|
96
|
-
activeChild = __classPrivateFieldGet(this, _Form_instances, "m", _Form_getNextItem).call(this, currActiveChildIndex, navigableChidren);
|
|
97
|
-
}
|
|
98
|
-
else if (focusOption === Model_1.FocusOption.PREVIOUS_ITEM) {
|
|
99
|
-
activeChild = __classPrivateFieldGet(this, _Form_instances, "m", _Form_getPreviousItem).call(this, currActiveChildIndex, navigableChidren);
|
|
100
|
-
}
|
|
101
|
-
if (activeChild !== null) {
|
|
102
|
-
__classPrivateFieldGet(this, _Form_instances, "m", _Form_setActiveFirstDeepChild).call(this, activeChild);
|
|
103
|
-
}
|
|
85
|
+
if (!focusOption) {
|
|
86
|
+
__classPrivateFieldGet(this, _Form_instances, "m", _Form_clearCurrentFocus).call(this, field);
|
|
87
|
+
__classPrivateFieldGet(this, _Form_instances, "m", _Form_setActiveFirstDeepChild).call(this, field);
|
|
88
|
+
return;
|
|
104
89
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
90
|
+
const parent = ((field === null || field === void 0 ? void 0 : field.isContainer) ? field : field.parent);
|
|
91
|
+
const navigableChidren = __classPrivateFieldGet(this, _Form_instances, "m", _Form_getNavigableChildren).call(this, parent.items);
|
|
92
|
+
let activeChild = parent.activeChild;
|
|
93
|
+
let currActiveChildIndex = activeChild !== null ? navigableChidren.indexOf(activeChild) : -1;
|
|
94
|
+
if (parent.activeChild === null) {
|
|
95
|
+
__classPrivateFieldGet(this, _Form_instances, "m", _Form_setActiveFirstDeepChild).call(this, navigableChidren[0]);
|
|
96
|
+
currActiveChildIndex = 0;
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (focusOption === Model_1.FocusOption.NEXT_ITEM) {
|
|
100
|
+
activeChild = __classPrivateFieldGet(this, _Form_instances, "m", _Form_getNextItem).call(this, currActiveChildIndex, navigableChidren);
|
|
101
|
+
}
|
|
102
|
+
else if (focusOption === Model_1.FocusOption.PREVIOUS_ITEM) {
|
|
103
|
+
activeChild = __classPrivateFieldGet(this, _Form_instances, "m", _Form_getPreviousItem).call(this, currActiveChildIndex, navigableChidren);
|
|
104
|
+
}
|
|
105
|
+
if (activeChild !== null) {
|
|
106
|
+
__classPrivateFieldGet(this, _Form_instances, "m", _Form_setActiveFirstDeepChild).call(this, activeChild);
|
|
111
107
|
}
|
|
112
108
|
}
|
|
113
109
|
getState() {
|
|
@@ -244,6 +240,7 @@ _Form_instances = new WeakSet(), _Form_getNavigableChildren = function _Form_get
|
|
|
244
240
|
parent.activeChild = currentField;
|
|
245
241
|
return;
|
|
246
242
|
}
|
|
243
|
+
__classPrivateFieldGet(this, _Form_instances, "m", _Form_clearCurrentFocus).call(this, currentField);
|
|
247
244
|
let currentActiveChild = currentField.activeChild;
|
|
248
245
|
currentActiveChild = (currentActiveChild === null) ? __classPrivateFieldGet(this, _Form_instances, "m", _Form_getFirstNavigableChild).call(this, currentField) : currentField.activeChild;
|
|
249
246
|
__classPrivateFieldGet(this, _Form_instances, "m", _Form_setActiveFirstDeepChild).call(this, currentActiveChild);
|
|
@@ -257,5 +254,10 @@ _Form_instances = new WeakSet(), _Form_getNavigableChildren = function _Form_get
|
|
|
257
254
|
return navigableChidren[currIndex - 1];
|
|
258
255
|
}
|
|
259
256
|
return null;
|
|
257
|
+
}, _Form_clearCurrentFocus = function _Form_clearCurrentFocus(field) {
|
|
258
|
+
const parent = field.parent;
|
|
259
|
+
if (parent != null && parent.activeChild != null) {
|
|
260
|
+
parent.activeChild = null;
|
|
261
|
+
}
|
|
260
262
|
};
|
|
261
263
|
exports.default = Form;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aemforms/af-core",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.67",
|
|
4
4
|
"description": "Core Module for Forms Runtime",
|
|
5
5
|
"author": "Adobe Systems",
|
|
6
6
|
"license": "Adobe Proprietary",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@adobe/json-formula": "0.1.50",
|
|
38
|
-
"@aemforms/af-formatters": "^0.22.
|
|
38
|
+
"@aemforms/af-formatters": "^0.22.67"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@babel/preset-env": "^7.20.2",
|