@bonlineza/luxity-lib 2.34.0 → 2.34.2
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/Accordion.js +76 -116
- package/AddInterest.js +434 -768
- package/BrandSelector.js +176 -336
- package/Checkbox.js +68 -101
- package/CheckboxButton.js +79 -124
- package/CommunicationPreferenceOptionsRenderer.js +107 -125
- package/CommunicationPreferenceSection.js +114 -134
- package/CommunicationPreferences.js +443 -339
- package/CountryCodeSelect.js +7 -10
- package/CurrencyInputFormatter.js +29 -56
- package/CurrencySelect.js +188 -19
- package/GALink.js +6 -16
- package/GenderSelector.js +88 -142
- package/GraphQLDropdownSelector.js +505 -939
- package/GraphQLMultiSelector.js +141 -274
- package/IconHeader.js +11 -25
- package/IconWrapper.js +3 -7
- package/InterestCatSelector.js +34 -74
- package/InterestItem.js +103 -187
- package/Interests.js +485 -890
- package/InterestsSubheading.js +5 -10
- package/InvertedTextButton.js +27 -63
- package/LuxityAppSideNav.js +18 -21
- package/LuxityDesktopHeader.js +376 -214
- package/LuxityFooter.js +464 -260
- package/LuxityGraphQLDropdownSelector.js +519 -969
- package/LuxityGraphQLMultiselector.js +167 -321
- package/LuxityMobileHeader.js +221 -278
- package/LuxityPageReady.js +74 -136
- package/LuxitySideNav.js +134 -155
- package/MaterialSelector.js +525 -976
- package/ModelSelector.js +525 -976
- package/NotificationDropDown.js +111 -209
- package/Notify.js +0 -1
- package/OutlinePrimaryButton.js +26 -58
- package/PriceRangeSelector.js +168 -281
- package/PrimaryButton.js +26 -58
- package/RadioButtons.js +114 -140
- package/RangeSlider.js +152 -242
- package/RareStepFooter.js +27 -41
- package/RareStepHeader.js +139 -190
- package/ReactSelectWrapper.js +0 -1
- package/SecondaryButton.js +26 -58
- package/ShoeSizeRangeSelector.js +162 -260
- package/ShoeSizeSelector.js +158 -263
- package/SimpleErrorBoundary.js +59 -106
- package/StyleSelector.js +176 -336
- package/TextButton.js +26 -58
- package/Tooltip.js +17 -39
- package/Tracking.js +0 -1
- package/WrapperButton.js +20 -43
- package/build/bundle.css +1 -1
- package/build/bundle.js +1338 -1722
- package/package.json +1 -1
- package/svg/Accessories.js +6 -13
- package/svg/Account.js +6 -13
- package/svg/Add.js +6 -13
- package/svg/ArrowRight.js +6 -13
- package/svg/Bags.js +6 -13
- package/svg/BurgerMenu.js +6 -13
- package/svg/Calendar.js +6 -13
- package/svg/CalendarCircled.js +6 -13
- package/svg/CheckCircled.js +6 -13
- package/svg/Close.js +6 -13
- package/svg/Clothing.js +6 -13
- package/svg/Dot.js +6 -13
- package/svg/Edit.js +6 -13
- package/svg/Eye.js +6 -13
- package/svg/FileAttach.js +6 -13
- package/svg/FileAttachCircled.js +6 -13
- package/svg/LightBulb.js +6 -13
- package/svg/Logo.js +6 -13
- package/svg/LuxityMenu.js +6 -13
- package/svg/Minus.js +6 -13
- package/svg/MobileAvatar.js +6 -13
- package/svg/MyOrder.js +6 -13
- package/svg/MyPayment.js +6 -13
- package/svg/MyProfile.js +8 -14
- package/svg/MySale.js +6 -13
- package/svg/Notification.js +6 -13
- package/svg/PointerDown.js +6 -13
- package/svg/Search.js +6 -13
- package/svg/Shoes.js +6 -13
- package/svg/SvgWrapper.js +3 -7
- package/svg/Trash.js +6 -13
- package/svg/Watches.js +6 -13
|
@@ -9,169 +9,132 @@
|
|
|
9
9
|
EllipsisLoader = EllipsisLoader && Object.prototype.hasOwnProperty.call(EllipsisLoader, 'default') ? EllipsisLoader['default'] : EllipsisLoader;
|
|
10
10
|
var Notifications__default = 'default' in Notifications ? Notifications['default'] : Notifications;
|
|
11
11
|
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
17
|
-
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
18
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
19
|
-
})), keys.push.apply(keys, symbols);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return keys;
|
|
12
|
+
function _arrayLikeToArray(r, a) {
|
|
13
|
+
(null == a || a > r.length) && (a = r.length);
|
|
14
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
15
|
+
return n;
|
|
23
16
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
27
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
28
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
29
|
-
_defineProperty(target, key, source[key]);
|
|
30
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
31
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return target;
|
|
17
|
+
function _arrayWithHoles(r) {
|
|
18
|
+
if (Array.isArray(r)) return r;
|
|
36
19
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
writable: true
|
|
45
|
-
});
|
|
46
|
-
} else {
|
|
47
|
-
obj[key] = value;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return obj;
|
|
20
|
+
function _defineProperty(e, r, t) {
|
|
21
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
22
|
+
value: t,
|
|
23
|
+
enumerable: !0,
|
|
24
|
+
configurable: !0,
|
|
25
|
+
writable: !0
|
|
26
|
+
}) : e[r] = t, e;
|
|
51
27
|
}
|
|
52
|
-
|
|
53
28
|
function _extends() {
|
|
54
|
-
_extends = Object.assign ? Object.assign.bind() : function (
|
|
55
|
-
for (var
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
29
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
30
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
31
|
+
var t = arguments[e];
|
|
32
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
33
|
+
}
|
|
34
|
+
return n;
|
|
35
|
+
}, _extends.apply(null, arguments);
|
|
36
|
+
}
|
|
37
|
+
function _iterableToArrayLimit(r, l) {
|
|
38
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
39
|
+
if (null != t) {
|
|
40
|
+
var e,
|
|
41
|
+
n,
|
|
42
|
+
i,
|
|
43
|
+
u,
|
|
44
|
+
a = [],
|
|
45
|
+
f = !0,
|
|
46
|
+
o = !1;
|
|
47
|
+
try {
|
|
48
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
49
|
+
if (Object(t) !== t) return;
|
|
50
|
+
f = !1;
|
|
51
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
52
|
+
} catch (r) {
|
|
53
|
+
o = !0, n = r;
|
|
54
|
+
} finally {
|
|
55
|
+
try {
|
|
56
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
57
|
+
} finally {
|
|
58
|
+
if (o) throw n;
|
|
62
59
|
}
|
|
63
60
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
};
|
|
67
|
-
return _extends.apply(this, arguments);
|
|
61
|
+
return a;
|
|
62
|
+
}
|
|
68
63
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
var
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
target[key] = source[key];
|
|
64
|
+
function _nonIterableRest() {
|
|
65
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
66
|
+
}
|
|
67
|
+
function ownKeys(e, r) {
|
|
68
|
+
var t = Object.keys(e);
|
|
69
|
+
if (Object.getOwnPropertySymbols) {
|
|
70
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
71
|
+
r && (o = o.filter(function (r) {
|
|
72
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
73
|
+
})), t.push.apply(t, o);
|
|
80
74
|
}
|
|
81
|
-
|
|
82
|
-
return target;
|
|
75
|
+
return t;
|
|
83
76
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
77
|
+
function _objectSpread2(e) {
|
|
78
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
79
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
80
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
81
|
+
_defineProperty(e, r, t[r]);
|
|
82
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
83
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return e;
|
|
87
|
+
}
|
|
88
|
+
function _objectWithoutProperties(e, t) {
|
|
89
|
+
if (null == e) return {};
|
|
90
|
+
var o,
|
|
91
|
+
r,
|
|
92
|
+
i = _objectWithoutPropertiesLoose(e, t);
|
|
92
93
|
if (Object.getOwnPropertySymbols) {
|
|
93
|
-
var
|
|
94
|
-
|
|
95
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
96
|
-
key = sourceSymbolKeys[i];
|
|
97
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
98
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
99
|
-
target[key] = source[key];
|
|
100
|
-
}
|
|
94
|
+
var s = Object.getOwnPropertySymbols(e);
|
|
95
|
+
for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
101
96
|
}
|
|
102
|
-
|
|
103
|
-
return target;
|
|
97
|
+
return i;
|
|
104
98
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
99
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
100
|
+
if (null == r) return {};
|
|
101
|
+
var t = {};
|
|
102
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
103
|
+
if (e.includes(n)) continue;
|
|
104
|
+
t[n] = r[n];
|
|
109
105
|
}
|
|
110
|
-
|
|
111
|
-
|
|
106
|
+
return t;
|
|
107
|
+
}
|
|
108
|
+
function _slicedToArray(r, e) {
|
|
109
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
110
|
+
}
|
|
111
|
+
function _taggedTemplateLiteral(e, t) {
|
|
112
|
+
return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, {
|
|
112
113
|
raw: {
|
|
113
|
-
value: Object.freeze(
|
|
114
|
+
value: Object.freeze(t)
|
|
114
115
|
}
|
|
115
116
|
}));
|
|
116
117
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function _iterableToArrayLimit(arr, i) {
|
|
127
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
128
|
-
|
|
129
|
-
if (_i == null) return;
|
|
130
|
-
var _arr = [];
|
|
131
|
-
var _n = true;
|
|
132
|
-
var _d = false;
|
|
133
|
-
|
|
134
|
-
var _s, _e;
|
|
135
|
-
|
|
136
|
-
try {
|
|
137
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
138
|
-
_arr.push(_s.value);
|
|
139
|
-
|
|
140
|
-
if (i && _arr.length === i) break;
|
|
141
|
-
}
|
|
142
|
-
} catch (err) {
|
|
143
|
-
_d = true;
|
|
144
|
-
_e = err;
|
|
145
|
-
} finally {
|
|
146
|
-
try {
|
|
147
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
148
|
-
} finally {
|
|
149
|
-
if (_d) throw _e;
|
|
150
|
-
}
|
|
118
|
+
function _toPrimitive(t, r) {
|
|
119
|
+
if ("object" != typeof t || !t) return t;
|
|
120
|
+
var e = t[Symbol.toPrimitive];
|
|
121
|
+
if (void 0 !== e) {
|
|
122
|
+
var i = e.call(t, r || "default");
|
|
123
|
+
if ("object" != typeof i) return i;
|
|
124
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
151
125
|
}
|
|
152
|
-
|
|
153
|
-
return _arr;
|
|
126
|
+
return ("string" === r ? String : Number)(t);
|
|
154
127
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
159
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
160
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
161
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
162
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
128
|
+
function _toPropertyKey(t) {
|
|
129
|
+
var i = _toPrimitive(t, "string");
|
|
130
|
+
return "symbol" == typeof i ? i : i + "";
|
|
163
131
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
return arr2;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
function _nonIterableRest() {
|
|
174
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
132
|
+
function _unsupportedIterableToArray(r, a) {
|
|
133
|
+
if (r) {
|
|
134
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
135
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
136
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
137
|
+
}
|
|
175
138
|
}
|
|
176
139
|
|
|
177
140
|
var isCheckBoxInput = (element) => element.type === 'checkbox';
|
|
@@ -238,18 +201,50 @@
|
|
|
238
201
|
|
|
239
202
|
var isUndefined = (val) => val === undefined;
|
|
240
203
|
|
|
241
|
-
var get = (
|
|
242
|
-
if (!path || !isObject(
|
|
204
|
+
var get = (object, path, defaultValue) => {
|
|
205
|
+
if (!path || !isObject(object)) {
|
|
243
206
|
return defaultValue;
|
|
244
207
|
}
|
|
245
|
-
const result = compact(path.split(/[,[\].]+?/)).reduce((result, key) => isNullOrUndefined(result) ? result : result[key],
|
|
246
|
-
return isUndefined(result) || result ===
|
|
247
|
-
? isUndefined(
|
|
208
|
+
const result = compact(path.split(/[,[\].]+?/)).reduce((result, key) => isNullOrUndefined(result) ? result : result[key], object);
|
|
209
|
+
return isUndefined(result) || result === object
|
|
210
|
+
? isUndefined(object[path])
|
|
248
211
|
? defaultValue
|
|
249
|
-
:
|
|
212
|
+
: object[path]
|
|
250
213
|
: result;
|
|
251
214
|
};
|
|
252
215
|
|
|
216
|
+
var isBoolean = (value) => typeof value === 'boolean';
|
|
217
|
+
|
|
218
|
+
var isKey = (value) => /^\w*$/.test(value);
|
|
219
|
+
|
|
220
|
+
var stringToPath = (input) => compact(input.replace(/["|']|\]/g, '').split(/\.|\[/));
|
|
221
|
+
|
|
222
|
+
var set = (object, path, value) => {
|
|
223
|
+
let index = -1;
|
|
224
|
+
const tempPath = isKey(path) ? [path] : stringToPath(path);
|
|
225
|
+
const length = tempPath.length;
|
|
226
|
+
const lastIndex = length - 1;
|
|
227
|
+
while (++index < length) {
|
|
228
|
+
const key = tempPath[index];
|
|
229
|
+
let newValue = value;
|
|
230
|
+
if (index !== lastIndex) {
|
|
231
|
+
const objValue = object[key];
|
|
232
|
+
newValue =
|
|
233
|
+
isObject(objValue) || Array.isArray(objValue)
|
|
234
|
+
? objValue
|
|
235
|
+
: !isNaN(+tempPath[index + 1])
|
|
236
|
+
? []
|
|
237
|
+
: {};
|
|
238
|
+
}
|
|
239
|
+
if (key === '__proto__') {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
object[key] = newValue;
|
|
243
|
+
object = object[key];
|
|
244
|
+
}
|
|
245
|
+
return object;
|
|
246
|
+
};
|
|
247
|
+
|
|
253
248
|
const EVENTS = {
|
|
254
249
|
BLUR: 'blur',
|
|
255
250
|
FOCUS_OUT: 'focusout',
|
|
@@ -337,15 +332,13 @@
|
|
|
337
332
|
|
|
338
333
|
var convertToArrayPayload = (value) => (Array.isArray(value) ? value : [value]);
|
|
339
334
|
|
|
340
|
-
var shouldSubscribeByName = (name, signalName, exact) =>
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
convertToArrayPayload(name).some((currentName) => currentName &&
|
|
348
|
-
(currentName.startsWith(signalName) ||
|
|
335
|
+
var shouldSubscribeByName = (name, signalName, exact) => !name ||
|
|
336
|
+
!signalName ||
|
|
337
|
+
name === signalName ||
|
|
338
|
+
convertToArrayPayload(name).some((currentName) => currentName &&
|
|
339
|
+
(exact
|
|
340
|
+
? currentName === signalName
|
|
341
|
+
: currentName.startsWith(signalName) ||
|
|
349
342
|
signalName.startsWith(currentName)));
|
|
350
343
|
|
|
351
344
|
function useSubscribe(props) {
|
|
@@ -403,6 +396,7 @@
|
|
|
403
396
|
isLoading: false,
|
|
404
397
|
dirtyFields: false,
|
|
405
398
|
touchedFields: false,
|
|
399
|
+
validatingFields: false,
|
|
406
400
|
isValidating: false,
|
|
407
401
|
isValid: false,
|
|
408
402
|
errors: false,
|
|
@@ -453,7 +447,7 @@
|
|
|
453
447
|
*
|
|
454
448
|
* @example
|
|
455
449
|
* ```tsx
|
|
456
|
-
* const {
|
|
450
|
+
* const { control } = useForm();
|
|
457
451
|
* const values = useWatch({
|
|
458
452
|
* name: "fieldName"
|
|
459
453
|
* control,
|
|
@@ -479,33 +473,6 @@
|
|
|
479
473
|
return value;
|
|
480
474
|
}
|
|
481
475
|
|
|
482
|
-
var isKey = (value) => /^\w*$/.test(value);
|
|
483
|
-
|
|
484
|
-
var stringToPath = (input) => compact(input.replace(/["|']|\]/g, '').split(/\.|\[/));
|
|
485
|
-
|
|
486
|
-
function set(object, path, value) {
|
|
487
|
-
let index = -1;
|
|
488
|
-
const tempPath = isKey(path) ? [path] : stringToPath(path);
|
|
489
|
-
const length = tempPath.length;
|
|
490
|
-
const lastIndex = length - 1;
|
|
491
|
-
while (++index < length) {
|
|
492
|
-
const key = tempPath[index];
|
|
493
|
-
let newValue = value;
|
|
494
|
-
if (index !== lastIndex) {
|
|
495
|
-
const objValue = object[key];
|
|
496
|
-
newValue =
|
|
497
|
-
isObject(objValue) || Array.isArray(objValue)
|
|
498
|
-
? objValue
|
|
499
|
-
: !isNaN(+tempPath[index + 1])
|
|
500
|
-
? []
|
|
501
|
-
: {};
|
|
502
|
-
}
|
|
503
|
-
object[key] = newValue;
|
|
504
|
-
object = object[key];
|
|
505
|
-
}
|
|
506
|
-
return object;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
476
|
/**
|
|
510
477
|
* Custom hook to work with controlled component, this function provide you with both form and field level state. Re-render is isolated at the hook level.
|
|
511
478
|
*
|
|
@@ -543,17 +510,18 @@
|
|
|
543
510
|
const formState = useFormState({
|
|
544
511
|
control,
|
|
545
512
|
name,
|
|
513
|
+
exact: true,
|
|
546
514
|
});
|
|
547
515
|
const _registerProps = React__default.useRef(control.register(name, {
|
|
548
516
|
...props.rules,
|
|
549
517
|
value,
|
|
518
|
+
...(isBoolean(props.disabled) ? { disabled: props.disabled } : {}),
|
|
550
519
|
}));
|
|
551
|
-
_registerProps.current = control.register(name, props.rules);
|
|
552
520
|
React__default.useEffect(() => {
|
|
553
521
|
const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
|
|
554
522
|
const updateMounted = (name, value) => {
|
|
555
523
|
const field = get(control._fields, name);
|
|
556
|
-
if (field) {
|
|
524
|
+
if (field && field._f) {
|
|
557
525
|
field._f.mount = value;
|
|
558
526
|
}
|
|
559
527
|
};
|
|
@@ -574,17 +542,22 @@
|
|
|
574
542
|
};
|
|
575
543
|
}, [name, control, isArrayField, shouldUnregister]);
|
|
576
544
|
React__default.useEffect(() => {
|
|
577
|
-
control.
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
545
|
+
if (get(control._fields, name)) {
|
|
546
|
+
control._updateDisabledField({
|
|
547
|
+
disabled,
|
|
548
|
+
fields: control._fields,
|
|
549
|
+
name,
|
|
550
|
+
value: get(control._fields, name)._f.value,
|
|
551
|
+
});
|
|
552
|
+
}
|
|
582
553
|
}, [disabled, name, control]);
|
|
583
554
|
return {
|
|
584
555
|
field: {
|
|
585
556
|
name,
|
|
586
557
|
value,
|
|
587
|
-
disabled
|
|
558
|
+
...(isBoolean(disabled) || formState.disabled
|
|
559
|
+
? { disabled: formState.disabled || disabled }
|
|
560
|
+
: {}),
|
|
588
561
|
onChange: React__default.useCallback((event) => _registerProps.current.onChange({
|
|
589
562
|
target: {
|
|
590
563
|
value: getEventValue(event),
|
|
@@ -599,7 +572,7 @@
|
|
|
599
572
|
},
|
|
600
573
|
type: EVENTS.BLUR,
|
|
601
574
|
}), [name, control]),
|
|
602
|
-
ref: (elm) => {
|
|
575
|
+
ref: React__default.useCallback((elm) => {
|
|
603
576
|
const field = get(control._fields, name);
|
|
604
577
|
if (field && elm) {
|
|
605
578
|
field._f.ref = {
|
|
@@ -609,7 +582,7 @@
|
|
|
609
582
|
reportValidity: () => elm.reportValidity(),
|
|
610
583
|
};
|
|
611
584
|
}
|
|
612
|
-
},
|
|
585
|
+
}, [control._fields, name]),
|
|
613
586
|
},
|
|
614
587
|
formState,
|
|
615
588
|
fieldState: Object.defineProperties({}, {
|
|
@@ -625,6 +598,10 @@
|
|
|
625
598
|
enumerable: true,
|
|
626
599
|
get: () => !!get(formState.touchedFields, name),
|
|
627
600
|
},
|
|
601
|
+
isValidating: {
|
|
602
|
+
enumerable: true,
|
|
603
|
+
get: () => !!get(formState.validatingFields, name),
|
|
604
|
+
},
|
|
628
605
|
error: {
|
|
629
606
|
enumerable: true,
|
|
630
607
|
get: () => get(formState.errors, name),
|
|
@@ -643,28 +620,6 @@
|
|
|
643
620
|
}
|
|
644
621
|
: {};
|
|
645
622
|
|
|
646
|
-
const focusFieldBy = (fields, callback, fieldsNames) => {
|
|
647
|
-
for (const key of fieldsNames || Object.keys(fields)) {
|
|
648
|
-
const field = get(fields, key);
|
|
649
|
-
if (field) {
|
|
650
|
-
const { _f, ...currentField } = field;
|
|
651
|
-
if (_f && callback(_f.name)) {
|
|
652
|
-
if (_f.ref.focus) {
|
|
653
|
-
_f.ref.focus();
|
|
654
|
-
break;
|
|
655
|
-
}
|
|
656
|
-
else if (_f.refs && _f.refs[0].focus) {
|
|
657
|
-
_f.refs[0].focus();
|
|
658
|
-
break;
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
else if (isObject(currentField)) {
|
|
662
|
-
focusFieldBy(currentField, callback);
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
};
|
|
667
|
-
|
|
668
623
|
var getValidationModes = (mode) => ({
|
|
669
624
|
isOnSubmit: !mode || mode === VALIDATION_MODE.onSubmit,
|
|
670
625
|
isOnBlur: mode === VALIDATION_MODE.onBlur,
|
|
@@ -679,15 +634,41 @@
|
|
|
679
634
|
[..._names.watch].some((watchName) => name.startsWith(watchName) &&
|
|
680
635
|
/^\.\w+/.test(name.slice(watchName.length))));
|
|
681
636
|
|
|
637
|
+
const iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {
|
|
638
|
+
for (const key of fieldsNames || Object.keys(fields)) {
|
|
639
|
+
const field = get(fields, key);
|
|
640
|
+
if (field) {
|
|
641
|
+
const { _f, ...currentField } = field;
|
|
642
|
+
if (_f) {
|
|
643
|
+
if (_f.refs && _f.refs[0] && action(_f.refs[0], key) && !abortEarly) {
|
|
644
|
+
return true;
|
|
645
|
+
}
|
|
646
|
+
else if (_f.ref && action(_f.ref, _f.name) && !abortEarly) {
|
|
647
|
+
return true;
|
|
648
|
+
}
|
|
649
|
+
else {
|
|
650
|
+
if (iterateFieldsByAction(currentField, action)) {
|
|
651
|
+
break;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
else if (isObject(currentField)) {
|
|
656
|
+
if (iterateFieldsByAction(currentField, action)) {
|
|
657
|
+
break;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
return;
|
|
663
|
+
};
|
|
664
|
+
|
|
682
665
|
var updateFieldArrayRootError = (errors, error, name) => {
|
|
683
|
-
const fieldArrayErrors =
|
|
666
|
+
const fieldArrayErrors = convertToArrayPayload(get(errors, name));
|
|
684
667
|
set(fieldArrayErrors, 'root', error[name]);
|
|
685
668
|
set(errors, name, fieldArrayErrors);
|
|
686
669
|
return errors;
|
|
687
670
|
};
|
|
688
671
|
|
|
689
|
-
var isBoolean = (value) => typeof value === 'boolean';
|
|
690
|
-
|
|
691
672
|
var isFileInput = (element) => element.type === 'file';
|
|
692
673
|
|
|
693
674
|
var isFunction = (value) => typeof value === 'function';
|
|
@@ -979,7 +960,7 @@
|
|
|
979
960
|
return object;
|
|
980
961
|
}
|
|
981
962
|
|
|
982
|
-
|
|
963
|
+
var createSubject = () => {
|
|
983
964
|
let _observers = [];
|
|
984
965
|
const next = (value) => {
|
|
985
966
|
for (const observer of _observers) {
|
|
@@ -1005,7 +986,7 @@
|
|
|
1005
986
|
subscribe,
|
|
1006
987
|
unsubscribe,
|
|
1007
988
|
};
|
|
1008
|
-
}
|
|
989
|
+
};
|
|
1009
990
|
|
|
1010
991
|
var isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);
|
|
1011
992
|
|
|
@@ -1154,6 +1135,13 @@
|
|
|
1154
1135
|
: rule.value
|
|
1155
1136
|
: rule;
|
|
1156
1137
|
|
|
1138
|
+
const ASYNC_FUNCTION = 'AsyncFunction';
|
|
1139
|
+
var hasPromiseValidation = (fieldReference) => (!fieldReference || !fieldReference.validate) &&
|
|
1140
|
+
!!((isFunction(fieldReference.validate) &&
|
|
1141
|
+
fieldReference.validate.constructor.name === ASYNC_FUNCTION) ||
|
|
1142
|
+
(isObject(fieldReference.validate) &&
|
|
1143
|
+
Object.values(fieldReference.validate).find((validateFunction) => validateFunction.constructor.name === ASYNC_FUNCTION)));
|
|
1144
|
+
|
|
1157
1145
|
var hasValidation = (options) => options.mount &&
|
|
1158
1146
|
(options.required ||
|
|
1159
1147
|
options.min ||
|
|
@@ -1215,7 +1203,7 @@
|
|
|
1215
1203
|
reValidateMode: VALIDATION_MODE.onChange,
|
|
1216
1204
|
shouldFocusError: true,
|
|
1217
1205
|
};
|
|
1218
|
-
function createFormControl(props = {}
|
|
1206
|
+
function createFormControl(props = {}) {
|
|
1219
1207
|
let _options = {
|
|
1220
1208
|
...defaultOptions,
|
|
1221
1209
|
...props,
|
|
@@ -1231,7 +1219,9 @@
|
|
|
1231
1219
|
isValid: false,
|
|
1232
1220
|
touchedFields: {},
|
|
1233
1221
|
dirtyFields: {},
|
|
1234
|
-
|
|
1222
|
+
validatingFields: {},
|
|
1223
|
+
errors: _options.errors || {},
|
|
1224
|
+
disabled: _options.disabled || false,
|
|
1235
1225
|
};
|
|
1236
1226
|
let _fields = {};
|
|
1237
1227
|
let _defaultValues = isObject(_options.defaultValues) || isObject(_options.values)
|
|
@@ -1256,6 +1246,7 @@
|
|
|
1256
1246
|
const _proxyFormState = {
|
|
1257
1247
|
isDirty: false,
|
|
1258
1248
|
dirtyFields: false,
|
|
1249
|
+
validatingFields: false,
|
|
1259
1250
|
touchedFields: false,
|
|
1260
1251
|
isValidating: false,
|
|
1261
1252
|
isValid: false,
|
|
@@ -1266,7 +1257,6 @@
|
|
|
1266
1257
|
array: createSubject(),
|
|
1267
1258
|
state: createSubject(),
|
|
1268
1259
|
};
|
|
1269
|
-
const shouldCaptureDirtyFields = props.resetOptions && props.resetOptions.keepDirtyValues;
|
|
1270
1260
|
const validationModeBeforeSubmit = getValidationModes(_options.mode);
|
|
1271
1261
|
const validationModeAfterSubmit = getValidationModes(_options.reValidateMode);
|
|
1272
1262
|
const shouldDisplayAllAssociatedErrors = _options.criteriaMode === VALIDATION_MODE.all;
|
|
@@ -1286,10 +1276,21 @@
|
|
|
1286
1276
|
}
|
|
1287
1277
|
}
|
|
1288
1278
|
};
|
|
1289
|
-
const _updateIsValidating = (
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1279
|
+
const _updateIsValidating = (names, isValidating) => {
|
|
1280
|
+
if (_proxyFormState.isValidating || _proxyFormState.validatingFields) {
|
|
1281
|
+
(names || Array.from(_names.mount)).forEach((name) => {
|
|
1282
|
+
if (name) {
|
|
1283
|
+
isValidating
|
|
1284
|
+
? set(_formState.validatingFields, name, isValidating)
|
|
1285
|
+
: unset(_formState.validatingFields, name);
|
|
1286
|
+
}
|
|
1287
|
+
});
|
|
1288
|
+
_subjects.state.next({
|
|
1289
|
+
validatingFields: _formState.validatingFields,
|
|
1290
|
+
isValidating: !isEmptyObject(_formState.validatingFields),
|
|
1291
|
+
});
|
|
1292
|
+
}
|
|
1293
|
+
};
|
|
1293
1294
|
const _updateFieldArray = (name, values = [], method, args, shouldSetValues = true, shouldUpdateFieldsAndState = true) => {
|
|
1294
1295
|
if (args && method) {
|
|
1295
1296
|
_state.action = true;
|
|
@@ -1330,6 +1331,13 @@
|
|
|
1330
1331
|
errors: _formState.errors,
|
|
1331
1332
|
});
|
|
1332
1333
|
};
|
|
1334
|
+
const _setErrors = (errors) => {
|
|
1335
|
+
_formState.errors = errors;
|
|
1336
|
+
_subjects.state.next({
|
|
1337
|
+
errors: _formState.errors,
|
|
1338
|
+
isValid: false,
|
|
1339
|
+
});
|
|
1340
|
+
};
|
|
1333
1341
|
const updateValidAndValue = (name, shouldSkipSetValueAs, value, ref) => {
|
|
1334
1342
|
const field = get(_fields, name);
|
|
1335
1343
|
if (field) {
|
|
@@ -1348,15 +1356,18 @@
|
|
|
1348
1356
|
const output = {
|
|
1349
1357
|
name,
|
|
1350
1358
|
};
|
|
1359
|
+
const disabledField = !!(get(_fields, name) &&
|
|
1360
|
+
get(_fields, name)._f &&
|
|
1361
|
+
get(_fields, name)._f.disabled);
|
|
1351
1362
|
if (!isBlurEvent || shouldDirty) {
|
|
1352
1363
|
if (_proxyFormState.isDirty) {
|
|
1353
1364
|
isPreviousDirty = _formState.isDirty;
|
|
1354
1365
|
_formState.isDirty = output.isDirty = _getDirty();
|
|
1355
1366
|
shouldUpdateField = isPreviousDirty !== output.isDirty;
|
|
1356
1367
|
}
|
|
1357
|
-
const isCurrentFieldPristine = deepEqual(get(_defaultValues, name), fieldValue);
|
|
1358
|
-
isPreviousDirty = get(_formState.dirtyFields, name);
|
|
1359
|
-
isCurrentFieldPristine
|
|
1368
|
+
const isCurrentFieldPristine = disabledField || deepEqual(get(_defaultValues, name), fieldValue);
|
|
1369
|
+
isPreviousDirty = !!(!disabledField && get(_formState.dirtyFields, name));
|
|
1370
|
+
isCurrentFieldPristine || disabledField
|
|
1360
1371
|
? unset(_formState.dirtyFields, name)
|
|
1361
1372
|
: set(_formState.dirtyFields, name, true);
|
|
1362
1373
|
output.dirtyFields = _formState.dirtyFields;
|
|
@@ -1410,9 +1421,13 @@
|
|
|
1410
1421
|
};
|
|
1411
1422
|
_subjects.state.next(updatedFormState);
|
|
1412
1423
|
}
|
|
1413
|
-
_updateIsValidating(false);
|
|
1414
1424
|
};
|
|
1415
|
-
const _executeSchema = async (name) =>
|
|
1425
|
+
const _executeSchema = async (name) => {
|
|
1426
|
+
_updateIsValidating(name, true);
|
|
1427
|
+
const result = await _options.resolver(_formValues, _options.context, getResolverOptions(name || _names.mount, _fields, _options.criteriaMode, _options.shouldUseNativeValidation));
|
|
1428
|
+
_updateIsValidating(name);
|
|
1429
|
+
return result;
|
|
1430
|
+
};
|
|
1416
1431
|
const executeSchemaAndUpdateState = async (names) => {
|
|
1417
1432
|
const { errors } = await _executeSchema(names);
|
|
1418
1433
|
if (names) {
|
|
@@ -1437,7 +1452,14 @@
|
|
|
1437
1452
|
const { _f, ...fieldValue } = field;
|
|
1438
1453
|
if (_f) {
|
|
1439
1454
|
const isFieldArrayRoot = _names.array.has(_f.name);
|
|
1455
|
+
const isPromiseFunction = field._f && hasPromiseValidation(field._f);
|
|
1456
|
+
if (isPromiseFunction && _proxyFormState.validatingFields) {
|
|
1457
|
+
_updateIsValidating([name], true);
|
|
1458
|
+
}
|
|
1440
1459
|
const fieldError = await validateField(field, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !shouldOnlyCheckValid, isFieldArrayRoot);
|
|
1460
|
+
if (isPromiseFunction && _proxyFormState.validatingFields) {
|
|
1461
|
+
_updateIsValidating([name]);
|
|
1462
|
+
}
|
|
1441
1463
|
if (fieldError[_f.name]) {
|
|
1442
1464
|
context.valid = false;
|
|
1443
1465
|
if (shouldOnlyCheckValid) {
|
|
@@ -1451,7 +1473,7 @@
|
|
|
1451
1473
|
: set(_formState.errors, _f.name, fieldError[_f.name])
|
|
1452
1474
|
: unset(_formState.errors, _f.name));
|
|
1453
1475
|
}
|
|
1454
|
-
fieldValue &&
|
|
1476
|
+
!isEmptyObject(fieldValue) &&
|
|
1455
1477
|
(await executeBuiltInValidation(fieldValue, shouldOnlyCheckValid, context));
|
|
1456
1478
|
}
|
|
1457
1479
|
}
|
|
@@ -1566,17 +1588,22 @@
|
|
|
1566
1588
|
}
|
|
1567
1589
|
isWatched(name, _names) && _subjects.state.next({ ..._formState });
|
|
1568
1590
|
_subjects.values.next({
|
|
1569
|
-
name,
|
|
1591
|
+
name: _state.mount ? name : undefined,
|
|
1570
1592
|
values: { ..._formValues },
|
|
1571
1593
|
});
|
|
1572
|
-
!_state.mount && flushRootRender();
|
|
1573
1594
|
};
|
|
1574
1595
|
const onChange = async (event) => {
|
|
1596
|
+
_state.mount = true;
|
|
1575
1597
|
const target = event.target;
|
|
1576
1598
|
let name = target.name;
|
|
1577
1599
|
let isFieldValueUpdated = true;
|
|
1578
1600
|
const field = get(_fields, name);
|
|
1579
1601
|
const getCurrentFieldValue = () => target.type ? getFieldValue(field._f) : getEventValue(event);
|
|
1602
|
+
const _updateIsFieldValueUpdated = (fieldValue) => {
|
|
1603
|
+
isFieldValueUpdated =
|
|
1604
|
+
Number.isNaN(fieldValue) ||
|
|
1605
|
+
deepEqual(fieldValue, get(_formValues, name, fieldValue));
|
|
1606
|
+
};
|
|
1580
1607
|
if (field) {
|
|
1581
1608
|
let error;
|
|
1582
1609
|
let isValid;
|
|
@@ -1605,25 +1632,36 @@
|
|
|
1605
1632
|
values: { ..._formValues },
|
|
1606
1633
|
});
|
|
1607
1634
|
if (shouldSkipValidation) {
|
|
1608
|
-
_proxyFormState.isValid
|
|
1635
|
+
if (_proxyFormState.isValid) {
|
|
1636
|
+
if (props.mode === 'onBlur') {
|
|
1637
|
+
if (isBlurEvent) {
|
|
1638
|
+
_updateValid();
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
else {
|
|
1642
|
+
_updateValid();
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1609
1645
|
return (shouldRender &&
|
|
1610
1646
|
_subjects.state.next({ name, ...(watched ? {} : fieldState) }));
|
|
1611
1647
|
}
|
|
1612
1648
|
!isBlurEvent && watched && _subjects.state.next({ ..._formState });
|
|
1613
|
-
_updateIsValidating(true);
|
|
1614
1649
|
if (_options.resolver) {
|
|
1615
1650
|
const { errors } = await _executeSchema([name]);
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1651
|
+
_updateIsFieldValueUpdated(fieldValue);
|
|
1652
|
+
if (isFieldValueUpdated) {
|
|
1653
|
+
const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields, name);
|
|
1654
|
+
const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name || name);
|
|
1655
|
+
error = errorLookupResult.error;
|
|
1656
|
+
name = errorLookupResult.name;
|
|
1657
|
+
isValid = isEmptyObject(errors);
|
|
1658
|
+
}
|
|
1621
1659
|
}
|
|
1622
1660
|
else {
|
|
1661
|
+
_updateIsValidating([name], true);
|
|
1623
1662
|
error = (await validateField(field, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[name];
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
fieldValue === get(_formValues, name, fieldValue);
|
|
1663
|
+
_updateIsValidating([name]);
|
|
1664
|
+
_updateIsFieldValueUpdated(fieldValue);
|
|
1627
1665
|
if (isFieldValueUpdated) {
|
|
1628
1666
|
if (error) {
|
|
1629
1667
|
isValid = false;
|
|
@@ -1640,11 +1678,17 @@
|
|
|
1640
1678
|
}
|
|
1641
1679
|
}
|
|
1642
1680
|
};
|
|
1681
|
+
const _focusInput = (ref, key) => {
|
|
1682
|
+
if (get(_formState.errors, key) && ref.focus) {
|
|
1683
|
+
ref.focus();
|
|
1684
|
+
return 1;
|
|
1685
|
+
}
|
|
1686
|
+
return;
|
|
1687
|
+
};
|
|
1643
1688
|
const trigger = async (name, options = {}) => {
|
|
1644
1689
|
let isValid;
|
|
1645
1690
|
let validationResult;
|
|
1646
1691
|
const fieldNames = convertToArrayPayload(name);
|
|
1647
|
-
_updateIsValidating(true);
|
|
1648
1692
|
if (_options.resolver) {
|
|
1649
1693
|
const errors = await executeSchemaAndUpdateState(isUndefined(name) ? name : fieldNames);
|
|
1650
1694
|
isValid = isEmptyObject(errors);
|
|
@@ -1669,17 +1713,15 @@
|
|
|
1669
1713
|
: { name }),
|
|
1670
1714
|
...(_options.resolver || !name ? { isValid } : {}),
|
|
1671
1715
|
errors: _formState.errors,
|
|
1672
|
-
isValidating: false,
|
|
1673
1716
|
});
|
|
1674
1717
|
options.shouldFocus &&
|
|
1675
1718
|
!validationResult &&
|
|
1676
|
-
|
|
1719
|
+
iterateFieldsByAction(_fields, _focusInput, name ? fieldNames : _names.mount);
|
|
1677
1720
|
return validationResult;
|
|
1678
1721
|
};
|
|
1679
1722
|
const getValues = (fieldNames) => {
|
|
1680
1723
|
const values = {
|
|
1681
|
-
..._defaultValues,
|
|
1682
|
-
...(_state.mount ? _formValues : {}),
|
|
1724
|
+
...(_state.mount ? _formValues : _defaultValues),
|
|
1683
1725
|
};
|
|
1684
1726
|
return isUndefined(fieldNames)
|
|
1685
1727
|
? values
|
|
@@ -1690,8 +1732,9 @@
|
|
|
1690
1732
|
const getFieldState = (name, formState) => ({
|
|
1691
1733
|
invalid: !!get((formState || _formState).errors, name),
|
|
1692
1734
|
isDirty: !!get((formState || _formState).dirtyFields, name),
|
|
1693
|
-
isTouched: !!get((formState || _formState).touchedFields, name),
|
|
1694
1735
|
error: get((formState || _formState).errors, name),
|
|
1736
|
+
isValidating: !!get(_formState.validatingFields, name),
|
|
1737
|
+
isTouched: !!get((formState || _formState).touchedFields, name),
|
|
1695
1738
|
});
|
|
1696
1739
|
const clearErrors = (name) => {
|
|
1697
1740
|
name &&
|
|
@@ -1702,7 +1745,11 @@
|
|
|
1702
1745
|
};
|
|
1703
1746
|
const setError = (name, error, options) => {
|
|
1704
1747
|
const ref = (get(_fields, name, { _f: {} })._f || {}).ref;
|
|
1748
|
+
const currentError = get(_formState.errors, name) || {};
|
|
1749
|
+
// Don't override existing error messages elsewhere in the object tree.
|
|
1750
|
+
const { ref: currentRef, message, type, ...restOfErrorTree } = currentError;
|
|
1705
1751
|
set(_formState.errors, name, {
|
|
1752
|
+
...restOfErrorTree,
|
|
1706
1753
|
...error,
|
|
1707
1754
|
ref,
|
|
1708
1755
|
});
|
|
@@ -1729,6 +1776,8 @@
|
|
|
1729
1776
|
!options.keepError && unset(_formState.errors, fieldName);
|
|
1730
1777
|
!options.keepDirty && unset(_formState.dirtyFields, fieldName);
|
|
1731
1778
|
!options.keepTouched && unset(_formState.touchedFields, fieldName);
|
|
1779
|
+
!options.keepIsValidating &&
|
|
1780
|
+
unset(_formState.validatingFields, fieldName);
|
|
1732
1781
|
!_options.shouldUnregister &&
|
|
1733
1782
|
!options.keepDefaultValue &&
|
|
1734
1783
|
unset(_defaultValues, fieldName);
|
|
@@ -1742,18 +1791,20 @@
|
|
|
1742
1791
|
});
|
|
1743
1792
|
!options.keepIsValid && _updateValid();
|
|
1744
1793
|
};
|
|
1745
|
-
const _updateDisabledField = ({ disabled, name, field, fields, }) => {
|
|
1746
|
-
if (isBoolean(disabled)) {
|
|
1747
|
-
const
|
|
1794
|
+
const _updateDisabledField = ({ disabled, name, field, fields, value, }) => {
|
|
1795
|
+
if ((isBoolean(disabled) && _state.mount) || !!disabled) {
|
|
1796
|
+
const inputValue = disabled
|
|
1748
1797
|
? undefined
|
|
1749
|
-
:
|
|
1750
|
-
|
|
1751
|
-
|
|
1798
|
+
: isUndefined(value)
|
|
1799
|
+
? getFieldValue(field ? field._f : get(fields, name)._f)
|
|
1800
|
+
: value;
|
|
1801
|
+
set(_formValues, name, inputValue);
|
|
1802
|
+
updateTouchAndDirty(name, inputValue, false, false, true);
|
|
1752
1803
|
}
|
|
1753
1804
|
};
|
|
1754
1805
|
const register = (name, options = {}) => {
|
|
1755
1806
|
let field = get(_fields, name);
|
|
1756
|
-
const disabledIsDefined = isBoolean(options.disabled);
|
|
1807
|
+
const disabledIsDefined = isBoolean(options.disabled) || isBoolean(props.disabled);
|
|
1757
1808
|
set(_fields, name, {
|
|
1758
1809
|
...(field || {}),
|
|
1759
1810
|
_f: {
|
|
@@ -1767,15 +1818,20 @@
|
|
|
1767
1818
|
if (field) {
|
|
1768
1819
|
_updateDisabledField({
|
|
1769
1820
|
field,
|
|
1770
|
-
disabled: options.disabled
|
|
1821
|
+
disabled: isBoolean(options.disabled)
|
|
1822
|
+
? options.disabled
|
|
1823
|
+
: props.disabled,
|
|
1771
1824
|
name,
|
|
1825
|
+
value: options.value,
|
|
1772
1826
|
});
|
|
1773
1827
|
}
|
|
1774
1828
|
else {
|
|
1775
1829
|
updateValidAndValue(name, true, options.value);
|
|
1776
1830
|
}
|
|
1777
1831
|
return {
|
|
1778
|
-
...(disabledIsDefined
|
|
1832
|
+
...(disabledIsDefined
|
|
1833
|
+
? { disabled: options.disabled || props.disabled }
|
|
1834
|
+
: {}),
|
|
1779
1835
|
...(_options.progressive
|
|
1780
1836
|
? {
|
|
1781
1837
|
required: !!options.required,
|
|
@@ -1835,8 +1891,25 @@
|
|
|
1835
1891
|
};
|
|
1836
1892
|
};
|
|
1837
1893
|
const _focusError = () => _options.shouldFocusError &&
|
|
1838
|
-
|
|
1894
|
+
iterateFieldsByAction(_fields, _focusInput, _names.mount);
|
|
1895
|
+
const _disableForm = (disabled) => {
|
|
1896
|
+
if (isBoolean(disabled)) {
|
|
1897
|
+
_subjects.state.next({ disabled });
|
|
1898
|
+
iterateFieldsByAction(_fields, (ref, name) => {
|
|
1899
|
+
const currentField = get(_fields, name);
|
|
1900
|
+
if (currentField) {
|
|
1901
|
+
ref.disabled = currentField._f.disabled || disabled;
|
|
1902
|
+
if (Array.isArray(currentField._f.refs)) {
|
|
1903
|
+
currentField._f.refs.forEach((inputRef) => {
|
|
1904
|
+
inputRef.disabled = currentField._f.disabled || disabled;
|
|
1905
|
+
});
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
}, 0, false);
|
|
1909
|
+
}
|
|
1910
|
+
};
|
|
1839
1911
|
const handleSubmit = (onValid, onInvalid) => async (e) => {
|
|
1912
|
+
let onValidError = undefined;
|
|
1840
1913
|
if (e) {
|
|
1841
1914
|
e.preventDefault && e.preventDefault();
|
|
1842
1915
|
e.persist && e.persist();
|
|
@@ -1858,7 +1931,12 @@
|
|
|
1858
1931
|
_subjects.state.next({
|
|
1859
1932
|
errors: {},
|
|
1860
1933
|
});
|
|
1861
|
-
|
|
1934
|
+
try {
|
|
1935
|
+
await onValid(fieldValues, e);
|
|
1936
|
+
}
|
|
1937
|
+
catch (error) {
|
|
1938
|
+
onValidError = error;
|
|
1939
|
+
}
|
|
1862
1940
|
}
|
|
1863
1941
|
else {
|
|
1864
1942
|
if (onInvalid) {
|
|
@@ -1870,19 +1948,22 @@
|
|
|
1870
1948
|
_subjects.state.next({
|
|
1871
1949
|
isSubmitted: true,
|
|
1872
1950
|
isSubmitting: false,
|
|
1873
|
-
isSubmitSuccessful: isEmptyObject(_formState.errors),
|
|
1951
|
+
isSubmitSuccessful: isEmptyObject(_formState.errors) && !onValidError,
|
|
1874
1952
|
submitCount: _formState.submitCount + 1,
|
|
1875
1953
|
errors: _formState.errors,
|
|
1876
1954
|
});
|
|
1955
|
+
if (onValidError) {
|
|
1956
|
+
throw onValidError;
|
|
1957
|
+
}
|
|
1877
1958
|
};
|
|
1878
1959
|
const resetField = (name, options = {}) => {
|
|
1879
1960
|
if (get(_fields, name)) {
|
|
1880
1961
|
if (isUndefined(options.defaultValue)) {
|
|
1881
|
-
setValue(name, get(_defaultValues, name));
|
|
1962
|
+
setValue(name, cloneObject(get(_defaultValues, name)));
|
|
1882
1963
|
}
|
|
1883
1964
|
else {
|
|
1884
1965
|
setValue(name, options.defaultValue);
|
|
1885
|
-
set(_defaultValues, name, options.defaultValue);
|
|
1966
|
+
set(_defaultValues, name, cloneObject(options.defaultValue));
|
|
1886
1967
|
}
|
|
1887
1968
|
if (!options.keepTouched) {
|
|
1888
1969
|
unset(_formState.touchedFields, name);
|
|
@@ -1890,7 +1971,7 @@
|
|
|
1890
1971
|
if (!options.keepDirty) {
|
|
1891
1972
|
unset(_formState.dirtyFields, name);
|
|
1892
1973
|
_formState.isDirty = options.defaultValue
|
|
1893
|
-
? _getDirty(name, get(_defaultValues, name))
|
|
1974
|
+
? _getDirty(name, cloneObject(get(_defaultValues, name)))
|
|
1894
1975
|
: _getDirty();
|
|
1895
1976
|
}
|
|
1896
1977
|
if (!options.keepError) {
|
|
@@ -1903,14 +1984,13 @@
|
|
|
1903
1984
|
const _reset = (formValues, keepStateOptions = {}) => {
|
|
1904
1985
|
const updatedValues = formValues ? cloneObject(formValues) : _defaultValues;
|
|
1905
1986
|
const cloneUpdatedValues = cloneObject(updatedValues);
|
|
1906
|
-
const
|
|
1907
|
-
|
|
1908
|
-
: _defaultValues;
|
|
1987
|
+
const isEmptyResetValues = isEmptyObject(formValues);
|
|
1988
|
+
const values = isEmptyResetValues ? _defaultValues : cloneUpdatedValues;
|
|
1909
1989
|
if (!keepStateOptions.keepDefaultValues) {
|
|
1910
1990
|
_defaultValues = updatedValues;
|
|
1911
1991
|
}
|
|
1912
1992
|
if (!keepStateOptions.keepValues) {
|
|
1913
|
-
if (keepStateOptions.keepDirtyValues
|
|
1993
|
+
if (keepStateOptions.keepDirtyValues) {
|
|
1914
1994
|
for (const fieldName of _names.mount) {
|
|
1915
1995
|
get(_formState.dirtyFields, fieldName)
|
|
1916
1996
|
? set(values, fieldName, get(_formValues, fieldName))
|
|
@@ -1950,38 +2030,50 @@
|
|
|
1950
2030
|
});
|
|
1951
2031
|
}
|
|
1952
2032
|
_names = {
|
|
1953
|
-
mount: new Set(),
|
|
2033
|
+
mount: keepStateOptions.keepDirtyValues ? _names.mount : new Set(),
|
|
1954
2034
|
unMount: new Set(),
|
|
1955
2035
|
array: new Set(),
|
|
1956
2036
|
watch: new Set(),
|
|
1957
2037
|
watchAll: false,
|
|
1958
2038
|
focus: '',
|
|
1959
2039
|
};
|
|
1960
|
-
|
|
1961
|
-
|
|
2040
|
+
_state.mount =
|
|
2041
|
+
!_proxyFormState.isValid ||
|
|
2042
|
+
!!keepStateOptions.keepIsValid ||
|
|
2043
|
+
!!keepStateOptions.keepDirtyValues;
|
|
1962
2044
|
_state.watch = !!props.shouldUnregister;
|
|
1963
2045
|
_subjects.state.next({
|
|
1964
2046
|
submitCount: keepStateOptions.keepSubmitCount
|
|
1965
2047
|
? _formState.submitCount
|
|
1966
2048
|
: 0,
|
|
1967
|
-
isDirty:
|
|
1968
|
-
?
|
|
1969
|
-
:
|
|
1970
|
-
|
|
2049
|
+
isDirty: isEmptyResetValues
|
|
2050
|
+
? false
|
|
2051
|
+
: keepStateOptions.keepDirty
|
|
2052
|
+
? _formState.isDirty
|
|
2053
|
+
: !!(keepStateOptions.keepDefaultValues &&
|
|
2054
|
+
!deepEqual(formValues, _defaultValues)),
|
|
1971
2055
|
isSubmitted: keepStateOptions.keepIsSubmitted
|
|
1972
2056
|
? _formState.isSubmitted
|
|
1973
2057
|
: false,
|
|
1974
|
-
dirtyFields:
|
|
1975
|
-
?
|
|
1976
|
-
: keepStateOptions.
|
|
1977
|
-
?
|
|
1978
|
-
|
|
2058
|
+
dirtyFields: isEmptyResetValues
|
|
2059
|
+
? {}
|
|
2060
|
+
: keepStateOptions.keepDirtyValues
|
|
2061
|
+
? keepStateOptions.keepDefaultValues && _formValues
|
|
2062
|
+
? getDirtyFields(_defaultValues, _formValues)
|
|
2063
|
+
: _formState.dirtyFields
|
|
2064
|
+
: keepStateOptions.keepDefaultValues && formValues
|
|
2065
|
+
? getDirtyFields(_defaultValues, formValues)
|
|
2066
|
+
: keepStateOptions.keepDirty
|
|
2067
|
+
? _formState.dirtyFields
|
|
2068
|
+
: {},
|
|
1979
2069
|
touchedFields: keepStateOptions.keepTouched
|
|
1980
2070
|
? _formState.touchedFields
|
|
1981
2071
|
: {},
|
|
1982
2072
|
errors: keepStateOptions.keepErrors ? _formState.errors : {},
|
|
2073
|
+
isSubmitSuccessful: keepStateOptions.keepIsSubmitSuccessful
|
|
2074
|
+
? _formState.isSubmitSuccessful
|
|
2075
|
+
: false,
|
|
1983
2076
|
isSubmitting: false,
|
|
1984
|
-
isSubmitSuccessful: false,
|
|
1985
2077
|
});
|
|
1986
2078
|
};
|
|
1987
2079
|
const reset = (formValues, keepStateOptions) => _reset(isFunction(formValues)
|
|
@@ -2031,8 +2123,10 @@
|
|
|
2031
2123
|
_reset,
|
|
2032
2124
|
_resetDefaultValues,
|
|
2033
2125
|
_updateFormState,
|
|
2126
|
+
_disableForm,
|
|
2034
2127
|
_subjects,
|
|
2035
2128
|
_proxyFormState,
|
|
2129
|
+
_setErrors,
|
|
2036
2130
|
get _fields() {
|
|
2037
2131
|
return _fields;
|
|
2038
2132
|
},
|
|
@@ -2129,14 +2223,16 @@
|
|
|
2129
2223
|
submitCount: 0,
|
|
2130
2224
|
dirtyFields: {},
|
|
2131
2225
|
touchedFields: {},
|
|
2132
|
-
|
|
2226
|
+
validatingFields: {},
|
|
2227
|
+
errors: props.errors || {},
|
|
2228
|
+
disabled: props.disabled || false,
|
|
2133
2229
|
defaultValues: isFunction(props.defaultValues)
|
|
2134
2230
|
? undefined
|
|
2135
2231
|
: props.defaultValues,
|
|
2136
2232
|
});
|
|
2137
2233
|
if (!_formControl.current) {
|
|
2138
2234
|
_formControl.current = {
|
|
2139
|
-
...createFormControl(props
|
|
2235
|
+
...createFormControl(props),
|
|
2140
2236
|
formState,
|
|
2141
2237
|
};
|
|
2142
2238
|
}
|
|
@@ -2150,15 +2246,32 @@
|
|
|
2150
2246
|
}
|
|
2151
2247
|
},
|
|
2152
2248
|
});
|
|
2249
|
+
React__default.useEffect(() => control._disableForm(props.disabled), [control, props.disabled]);
|
|
2250
|
+
React__default.useEffect(() => {
|
|
2251
|
+
if (control._proxyFormState.isDirty) {
|
|
2252
|
+
const isDirty = control._getDirty();
|
|
2253
|
+
if (isDirty !== formState.isDirty) {
|
|
2254
|
+
control._subjects.state.next({
|
|
2255
|
+
isDirty,
|
|
2256
|
+
});
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
}, [control, formState.isDirty]);
|
|
2153
2260
|
React__default.useEffect(() => {
|
|
2154
2261
|
if (props.values && !deepEqual(props.values, _values.current)) {
|
|
2155
2262
|
control._reset(props.values, control._options.resetOptions);
|
|
2156
2263
|
_values.current = props.values;
|
|
2264
|
+
updateFormState((state) => ({ ...state }));
|
|
2157
2265
|
}
|
|
2158
2266
|
else {
|
|
2159
2267
|
control._resetDefaultValues();
|
|
2160
2268
|
}
|
|
2161
2269
|
}, [props.values, control]);
|
|
2270
|
+
React__default.useEffect(() => {
|
|
2271
|
+
if (props.errors) {
|
|
2272
|
+
control._setErrors(props.errors);
|
|
2273
|
+
}
|
|
2274
|
+
}, [props.errors, control]);
|
|
2162
2275
|
React__default.useEffect(() => {
|
|
2163
2276
|
if (!control._state.mount) {
|
|
2164
2277
|
control._updateValid();
|
|
@@ -2170,6 +2283,12 @@
|
|
|
2170
2283
|
}
|
|
2171
2284
|
control._removeUnmounted();
|
|
2172
2285
|
});
|
|
2286
|
+
React__default.useEffect(() => {
|
|
2287
|
+
props.shouldUnregister &&
|
|
2288
|
+
control._subjects.values.next({
|
|
2289
|
+
values: control._getWatch(),
|
|
2290
|
+
});
|
|
2291
|
+
}, [props.shouldUnregister, control]);
|
|
2173
2292
|
_formControl.current.formState = getProxyFormState(formState, control);
|
|
2174
2293
|
return _formControl.current;
|
|
2175
2294
|
}
|
|
@@ -2262,31 +2381,27 @@
|
|
|
2262
2381
|
});
|
|
2263
2382
|
|
|
2264
2383
|
var _excluded = ["ref"];
|
|
2265
|
-
|
|
2266
2384
|
var _templateObject$5, _templateObject2;
|
|
2267
2385
|
var OptionsRow = styled__default.div(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: nowrap;\n flex-direction: row;\n"])));
|
|
2268
2386
|
var Options = styled__default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: nowrap;\n flex-direction: row;\n flex-basis: 60%;\n"])));
|
|
2269
|
-
|
|
2270
2387
|
var CommunicationPreferenceOptionsRenderer = function CommunicationPreferenceOptionsRenderer(_ref) {
|
|
2271
2388
|
var control = _ref.control,
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2389
|
+
name = _ref.name,
|
|
2390
|
+
isDisabled = _ref.isDisabled,
|
|
2391
|
+
options = _ref.options,
|
|
2392
|
+
defaultValue = _ref.defaultValue,
|
|
2393
|
+
setValue = _ref.setValue;
|
|
2278
2394
|
var _useController = useController({
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2395
|
+
name: name,
|
|
2396
|
+
control: control,
|
|
2397
|
+
defaultValue: defaultValue
|
|
2398
|
+
}),
|
|
2399
|
+
_useController$field = _useController.field,
|
|
2400
|
+
ref = _useController$field.ref,
|
|
2401
|
+
inputProps = _objectWithoutProperties(_useController$field, _excluded),
|
|
2402
|
+
_useController$fieldS = _useController.fieldState,
|
|
2403
|
+
invalid = _useController$fieldS.invalid,
|
|
2404
|
+
error = _useController$fieldS.error;
|
|
2290
2405
|
React.useEffect(function () {
|
|
2291
2406
|
if (defaultValue) {
|
|
2292
2407
|
setValue(name, defaultValue);
|
|
@@ -2316,16 +2431,15 @@
|
|
|
2316
2431
|
return props.theme.colors.primary;
|
|
2317
2432
|
});
|
|
2318
2433
|
var SectionHeading = styled__default.div(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["\n padding: 5px 10px;\n"])));
|
|
2319
|
-
|
|
2320
2434
|
var CommunicationPreferenceSection = function CommunicationPreferenceSection(_ref) {
|
|
2321
2435
|
var section_heading = _ref.section_heading,
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2436
|
+
description = _ref.description,
|
|
2437
|
+
control = _ref.control,
|
|
2438
|
+
name = _ref.name,
|
|
2439
|
+
isDisabled = _ref.isDisabled,
|
|
2440
|
+
options = _ref.options,
|
|
2441
|
+
defaultValue = _ref.defaultValue,
|
|
2442
|
+
setValue = _ref.setValue;
|
|
2329
2443
|
return /*#__PURE__*/React__default.createElement(SectionContainer, null, /*#__PURE__*/React__default.createElement(SectionHeading, null, section_heading), /*#__PURE__*/React__default.createElement(CommunicationPreferenceOptionsRenderer, {
|
|
2330
2444
|
description: description,
|
|
2331
2445
|
control: control,
|
|
@@ -2336,7 +2450,6 @@
|
|
|
2336
2450
|
setValue: setValue
|
|
2337
2451
|
}));
|
|
2338
2452
|
};
|
|
2339
|
-
|
|
2340
2453
|
var CommunicationPreferenceSection$1 = themed(CommunicationPreferenceSection);
|
|
2341
2454
|
|
|
2342
2455
|
var defaultNotifyTime = 5000;
|
|
@@ -2382,30 +2495,25 @@
|
|
|
2382
2495
|
success: false,
|
|
2383
2496
|
failed: false
|
|
2384
2497
|
};
|
|
2385
|
-
|
|
2386
2498
|
var CommunicationPreferences = function CommunicationPreferences(_ref) {
|
|
2387
2499
|
var header = _ref.header,
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2500
|
+
requestInstance = _ref.requestInstance,
|
|
2501
|
+
updateNotificationsApi = _ref.updateNotificationsApi,
|
|
2502
|
+
preferenceData = _ref.preferenceData,
|
|
2503
|
+
btnClassName = _ref.btnClassName;
|
|
2393
2504
|
var _useForm = useForm(),
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2505
|
+
handleSubmit = _useForm.handleSubmit,
|
|
2506
|
+
control = _useForm.control,
|
|
2507
|
+
setValue = _useForm.setValue;
|
|
2398
2508
|
var _useState = React.useState(_objectSpread2({}, BaseRequest)),
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2509
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
2510
|
+
requestState = _useState2[0],
|
|
2511
|
+
setRequestState = _useState2[1];
|
|
2403
2512
|
var _useState3 = React.useState(false),
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2513
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
2514
|
+
isEditing = _useState4[0],
|
|
2515
|
+
setIsEditing = _useState4[1];
|
|
2516
|
+
//
|
|
2409
2517
|
var communicationOptions = [{
|
|
2410
2518
|
label: 'WhatsApp',
|
|
2411
2519
|
value: 'WHATSAPP'
|
|
@@ -2413,11 +2521,9 @@
|
|
|
2413
2521
|
label: 'Email',
|
|
2414
2522
|
value: 'EMAIL'
|
|
2415
2523
|
}];
|
|
2416
|
-
|
|
2417
2524
|
var updateRequestState = function updateRequestState(obj) {
|
|
2418
2525
|
setRequestState(_objectSpread2(_objectSpread2({}, BaseRequest), obj));
|
|
2419
2526
|
};
|
|
2420
|
-
|
|
2421
2527
|
var onSubmit = function onSubmit(form_data) {
|
|
2422
2528
|
updateRequestState({
|
|
2423
2529
|
loading: true
|
|
@@ -2446,7 +2552,6 @@
|
|
|
2446
2552
|
}));
|
|
2447
2553
|
});
|
|
2448
2554
|
};
|
|
2449
|
-
|
|
2450
2555
|
return /*#__PURE__*/React__default.createElement(React.Fragment, null, requestState.loading && /*#__PURE__*/React__default.createElement(EllipsisLoader, null), header, /*#__PURE__*/React__default.createElement(CommunicationPreferenceContainer, null, /*#__PURE__*/React__default.createElement("form", {
|
|
2451
2556
|
onSubmit: handleSubmit(onSubmit)
|
|
2452
2557
|
}, /*#__PURE__*/React__default.createElement(CommunicationPreferenceSection$1, {
|
|
@@ -2474,7 +2579,6 @@
|
|
|
2474
2579
|
}
|
|
2475
2580
|
}, "Edit")))));
|
|
2476
2581
|
};
|
|
2477
|
-
|
|
2478
2582
|
var index = themed(CommunicationPreferences);
|
|
2479
2583
|
|
|
2480
2584
|
return index;
|