@reformer/core 1.1.0-beta.3 → 1.1.0-beta.5
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/behaviors.js +23 -22
- package/dist/core/behavior/behavior-context.d.ts +6 -2
- package/dist/core/behavior/behavior-context.js +7 -2
- package/dist/core/types/form-context.d.ts +10 -4
- package/dist/core/validation/validate-form.js +6 -6
- package/dist/create-field-path-nXfTtl55.js +283 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/{create-field-path-CdPF3lIK.js → registry-helpers-BfCZcMkO.js} +79 -357
- package/dist/validation-context-cWXmh_Ho.js +156 -0
- package/dist/validators.js +105 -120
- package/llms.txt +653 -3
- package/package.json +1 -1
- package/dist/node-factory-D7DOnSSN.js +0 -3200
|
@@ -1,243 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
function w() {
|
|
3
|
-
if (d > 1)
|
|
4
|
-
d--;
|
|
5
|
-
else {
|
|
6
|
-
for (var i, t = !1; l !== void 0; ) {
|
|
7
|
-
var e = l;
|
|
8
|
-
for (l = void 0, x++; e !== void 0; ) {
|
|
9
|
-
var n = e.o;
|
|
10
|
-
if (e.o = void 0, e.f &= -3, !(8 & e.f) && _(e)) try {
|
|
11
|
-
e.c();
|
|
12
|
-
} catch (o) {
|
|
13
|
-
t || (i = o, t = !0);
|
|
14
|
-
}
|
|
15
|
-
e = n;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
if (x = 0, d--, t) throw i;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
var r = void 0;
|
|
22
|
-
function C(i) {
|
|
23
|
-
var t = r;
|
|
24
|
-
r = void 0;
|
|
25
|
-
try {
|
|
26
|
-
return i();
|
|
27
|
-
} finally {
|
|
28
|
-
r = t;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
var l = void 0, d = 0, x = 0, y = 0;
|
|
32
|
-
function k(i) {
|
|
33
|
-
if (r !== void 0) {
|
|
34
|
-
var t = i.n;
|
|
35
|
-
if (t === void 0 || t.t !== r)
|
|
36
|
-
return t = { i: 0, S: i, p: r.s, n: void 0, t: r, e: void 0, x: void 0, r: t }, r.s !== void 0 && (r.s.n = t), r.s = t, i.n = t, 32 & r.f && i.S(t), t;
|
|
37
|
-
if (t.i === -1)
|
|
38
|
-
return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p = r.s, t.n = void 0, r.s.n = t, r.s = t), t;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function c(i, t) {
|
|
42
|
-
this.v = i, this.i = 0, this.n = void 0, this.t = void 0, this.W = t?.watched, this.Z = t?.unwatched, this.name = t?.name;
|
|
43
|
-
}
|
|
44
|
-
c.prototype.brand = P;
|
|
45
|
-
c.prototype.h = function() {
|
|
46
|
-
return !0;
|
|
47
|
-
};
|
|
48
|
-
c.prototype.S = function(i) {
|
|
49
|
-
var t = this, e = this.t;
|
|
50
|
-
e !== i && i.e === void 0 && (i.x = e, this.t = i, e !== void 0 ? e.e = i : C(function() {
|
|
51
|
-
var n;
|
|
52
|
-
(n = t.W) == null || n.call(t);
|
|
53
|
-
}));
|
|
54
|
-
};
|
|
55
|
-
c.prototype.U = function(i) {
|
|
56
|
-
var t = this;
|
|
57
|
-
if (this.t !== void 0) {
|
|
58
|
-
var e = i.e, n = i.x;
|
|
59
|
-
e !== void 0 && (e.x = n, i.e = void 0), n !== void 0 && (n.e = e, i.x = void 0), i === this.t && (this.t = n, n === void 0 && C(function() {
|
|
60
|
-
var o;
|
|
61
|
-
(o = t.Z) == null || o.call(t);
|
|
62
|
-
}));
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
c.prototype.subscribe = function(i) {
|
|
66
|
-
var t = this;
|
|
67
|
-
return F(function() {
|
|
68
|
-
var e = t.value, n = r;
|
|
69
|
-
r = void 0;
|
|
70
|
-
try {
|
|
71
|
-
i(e);
|
|
72
|
-
} finally {
|
|
73
|
-
r = n;
|
|
74
|
-
}
|
|
75
|
-
}, { name: "sub" });
|
|
76
|
-
};
|
|
77
|
-
c.prototype.valueOf = function() {
|
|
78
|
-
return this.value;
|
|
79
|
-
};
|
|
80
|
-
c.prototype.toString = function() {
|
|
81
|
-
return this.value + "";
|
|
82
|
-
};
|
|
83
|
-
c.prototype.toJSON = function() {
|
|
84
|
-
return this.value;
|
|
85
|
-
};
|
|
86
|
-
c.prototype.peek = function() {
|
|
87
|
-
var i = r;
|
|
88
|
-
r = void 0;
|
|
89
|
-
try {
|
|
90
|
-
return this.value;
|
|
91
|
-
} finally {
|
|
92
|
-
r = i;
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
Object.defineProperty(c.prototype, "value", { get: function() {
|
|
96
|
-
var i = k(this);
|
|
97
|
-
return i !== void 0 && (i.i = this.i), this.v;
|
|
98
|
-
}, set: function(i) {
|
|
99
|
-
if (i !== this.v) {
|
|
100
|
-
if (x > 100) throw new Error("Cycle detected");
|
|
101
|
-
this.v = i, this.i++, y++, d++;
|
|
102
|
-
try {
|
|
103
|
-
for (var t = this.t; t !== void 0; t = t.x) t.t.N();
|
|
104
|
-
} finally {
|
|
105
|
-
w();
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
} });
|
|
109
|
-
function O(i, t) {
|
|
110
|
-
return new c(i, t);
|
|
111
|
-
}
|
|
112
|
-
function _(i) {
|
|
113
|
-
for (var t = i.s; t !== void 0; t = t.n) if (t.S.i !== t.i || !t.S.h() || t.S.i !== t.i) return !0;
|
|
114
|
-
return !1;
|
|
115
|
-
}
|
|
116
|
-
function b(i) {
|
|
117
|
-
for (var t = i.s; t !== void 0; t = t.n) {
|
|
118
|
-
var e = t.S.n;
|
|
119
|
-
if (e !== void 0 && (t.r = e), t.S.n = t, t.i = -1, t.n === void 0) {
|
|
120
|
-
i.s = t;
|
|
121
|
-
break;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
function V(i) {
|
|
126
|
-
for (var t = i.s, e = void 0; t !== void 0; ) {
|
|
127
|
-
var n = t.p;
|
|
128
|
-
t.i === -1 ? (t.S.U(t), n !== void 0 && (n.n = t.n), t.n !== void 0 && (t.n.p = n)) : e = t, t.S.n = t.r, t.r !== void 0 && (t.r = void 0), t = n;
|
|
129
|
-
}
|
|
130
|
-
i.s = e;
|
|
131
|
-
}
|
|
132
|
-
function h(i, t) {
|
|
133
|
-
c.call(this, void 0), this.x = i, this.s = void 0, this.g = y - 1, this.f = 4, this.W = t?.watched, this.Z = t?.unwatched, this.name = t?.name;
|
|
134
|
-
}
|
|
135
|
-
h.prototype = new c();
|
|
136
|
-
h.prototype.h = function() {
|
|
137
|
-
if (this.f &= -3, 1 & this.f) return !1;
|
|
138
|
-
if ((36 & this.f) == 32 || (this.f &= -5, this.g === y)) return !0;
|
|
139
|
-
if (this.g = y, this.f |= 1, this.i > 0 && !_(this))
|
|
140
|
-
return this.f &= -2, !0;
|
|
141
|
-
var i = r;
|
|
142
|
-
try {
|
|
143
|
-
b(this), r = this;
|
|
144
|
-
var t = this.x();
|
|
145
|
-
(16 & this.f || this.v !== t || this.i === 0) && (this.v = t, this.f &= -17, this.i++);
|
|
146
|
-
} catch (e) {
|
|
147
|
-
this.v = e, this.f |= 16, this.i++;
|
|
148
|
-
}
|
|
149
|
-
return r = i, V(this), this.f &= -2, !0;
|
|
150
|
-
};
|
|
151
|
-
h.prototype.S = function(i) {
|
|
152
|
-
if (this.t === void 0) {
|
|
153
|
-
this.f |= 36;
|
|
154
|
-
for (var t = this.s; t !== void 0; t = t.n) t.S.S(t);
|
|
155
|
-
}
|
|
156
|
-
c.prototype.S.call(this, i);
|
|
157
|
-
};
|
|
158
|
-
h.prototype.U = function(i) {
|
|
159
|
-
if (this.t !== void 0 && (c.prototype.U.call(this, i), this.t === void 0)) {
|
|
160
|
-
this.f &= -33;
|
|
161
|
-
for (var t = this.s; t !== void 0; t = t.n) t.S.U(t);
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
h.prototype.N = function() {
|
|
165
|
-
if (!(2 & this.f)) {
|
|
166
|
-
this.f |= 6;
|
|
167
|
-
for (var i = this.t; i !== void 0; i = i.x) i.t.N();
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
Object.defineProperty(h.prototype, "value", { get: function() {
|
|
171
|
-
if (1 & this.f) throw new Error("Cycle detected");
|
|
172
|
-
var i = k(this);
|
|
173
|
-
if (this.h(), i !== void 0 && (i.i = this.i), 16 & this.f) throw this.v;
|
|
174
|
-
return this.v;
|
|
175
|
-
} });
|
|
176
|
-
function B(i, t) {
|
|
177
|
-
return new h(i, t);
|
|
178
|
-
}
|
|
179
|
-
function E(i) {
|
|
180
|
-
var t = i.u;
|
|
181
|
-
if (i.u = void 0, typeof t == "function") {
|
|
182
|
-
d++;
|
|
183
|
-
var e = r;
|
|
184
|
-
r = void 0;
|
|
185
|
-
try {
|
|
186
|
-
t();
|
|
187
|
-
} catch (n) {
|
|
188
|
-
throw i.f &= -2, i.f |= 8, S(i), n;
|
|
189
|
-
} finally {
|
|
190
|
-
r = e, w();
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
function S(i) {
|
|
195
|
-
for (var t = i.s; t !== void 0; t = t.n) t.S.U(t);
|
|
196
|
-
i.x = void 0, i.s = void 0, E(i);
|
|
197
|
-
}
|
|
198
|
-
function A(i) {
|
|
199
|
-
if (r !== this) throw new Error("Out-of-order effect");
|
|
200
|
-
V(this), r = i, this.f &= -2, 8 & this.f && S(this), w();
|
|
201
|
-
}
|
|
202
|
-
function u(i, t) {
|
|
203
|
-
this.x = i, this.u = void 0, this.s = void 0, this.o = void 0, this.f = 32, this.name = t?.name;
|
|
204
|
-
}
|
|
205
|
-
u.prototype.c = function() {
|
|
206
|
-
var i = this.S();
|
|
207
|
-
try {
|
|
208
|
-
if (8 & this.f || this.x === void 0) return;
|
|
209
|
-
var t = this.x();
|
|
210
|
-
typeof t == "function" && (this.u = t);
|
|
211
|
-
} finally {
|
|
212
|
-
i();
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
u.prototype.S = function() {
|
|
216
|
-
if (1 & this.f) throw new Error("Cycle detected");
|
|
217
|
-
this.f |= 1, this.f &= -9, E(this), b(this), d++;
|
|
218
|
-
var i = r;
|
|
219
|
-
return r = this, A.bind(this, i);
|
|
220
|
-
};
|
|
221
|
-
u.prototype.N = function() {
|
|
222
|
-
2 & this.f || (this.f |= 2, this.o = l, l = this);
|
|
223
|
-
};
|
|
224
|
-
u.prototype.d = function() {
|
|
225
|
-
this.f |= 8, 1 & this.f || S(this);
|
|
226
|
-
};
|
|
227
|
-
u.prototype.dispose = function() {
|
|
228
|
-
this.d();
|
|
229
|
-
};
|
|
230
|
-
function F(i, t) {
|
|
231
|
-
var e = new u(i, t);
|
|
232
|
-
try {
|
|
233
|
-
e.c();
|
|
234
|
-
} catch (o) {
|
|
235
|
-
throw e.d(), o;
|
|
236
|
-
}
|
|
237
|
-
var n = e.d.bind(e);
|
|
238
|
-
return n[Symbol.dispose] = n, n;
|
|
239
|
-
}
|
|
240
|
-
class R {
|
|
1
|
+
class h {
|
|
241
2
|
stack = [];
|
|
242
3
|
/**
|
|
243
4
|
* Добавить элемент в стек
|
|
@@ -291,7 +52,7 @@ class R {
|
|
|
291
52
|
this.stack = [];
|
|
292
53
|
}
|
|
293
54
|
}
|
|
294
|
-
class
|
|
55
|
+
class f {
|
|
295
56
|
validators = [];
|
|
296
57
|
conditionStack = [];
|
|
297
58
|
/**
|
|
@@ -323,12 +84,12 @@ class I {
|
|
|
323
84
|
return this.validators;
|
|
324
85
|
}
|
|
325
86
|
}
|
|
326
|
-
class
|
|
87
|
+
class a {
|
|
327
88
|
/**
|
|
328
89
|
* Global stack активных реестров
|
|
329
90
|
* Используется для изоляции форм друг от друга
|
|
330
91
|
*/
|
|
331
|
-
static registryStack = new
|
|
92
|
+
static registryStack = new h();
|
|
332
93
|
contextStack = [];
|
|
333
94
|
validators = [];
|
|
334
95
|
/**
|
|
@@ -348,7 +109,7 @@ class f {
|
|
|
348
109
|
* ```
|
|
349
110
|
*/
|
|
350
111
|
static getCurrent() {
|
|
351
|
-
return
|
|
112
|
+
return a.registryStack.getCurrent();
|
|
352
113
|
}
|
|
353
114
|
/**
|
|
354
115
|
* Начать регистрацию валидаторов для формы
|
|
@@ -356,8 +117,8 @@ class f {
|
|
|
356
117
|
* Помещает this в global stack для изоляции форм
|
|
357
118
|
*/
|
|
358
119
|
beginRegistration() {
|
|
359
|
-
const t = new
|
|
360
|
-
return this.contextStack.push(t),
|
|
120
|
+
const t = new f();
|
|
121
|
+
return this.contextStack.push(t), a.registryStack.push(this), t;
|
|
361
122
|
}
|
|
362
123
|
/**
|
|
363
124
|
* Завершить регистрацию и применить валидаторы к GroupNode
|
|
@@ -370,7 +131,7 @@ class f {
|
|
|
370
131
|
const e = this.contextStack.pop();
|
|
371
132
|
if (!e)
|
|
372
133
|
throw new Error("No active registration context");
|
|
373
|
-
|
|
134
|
+
a.registryStack.verify(this, "ValidationRegistry"), this.validators = e.getValidators(), this.applyValidators(t, this.validators), this.applyArrayItemValidators(t, this.validators);
|
|
374
135
|
}
|
|
375
136
|
/**
|
|
376
137
|
* Отменить регистрацию без применения валидаторов
|
|
@@ -381,7 +142,7 @@ class f {
|
|
|
381
142
|
cancelRegistration() {
|
|
382
143
|
if (!this.contextStack.pop())
|
|
383
144
|
throw new Error("No active registration context to cancel");
|
|
384
|
-
|
|
145
|
+
a.registryStack.verify(this, "ValidationRegistry");
|
|
385
146
|
}
|
|
386
147
|
/**
|
|
387
148
|
* Получить текущий контекст регистрации
|
|
@@ -392,39 +153,39 @@ class f {
|
|
|
392
153
|
/**
|
|
393
154
|
* Зарегистрировать синхронный валидатор
|
|
394
155
|
*/
|
|
395
|
-
registerSync(t, e,
|
|
396
|
-
const
|
|
397
|
-
if (!
|
|
156
|
+
registerSync(t, e, i) {
|
|
157
|
+
const r = this.getCurrentContext();
|
|
158
|
+
if (!r)
|
|
398
159
|
throw new Error("Validators can only be registered inside a validation schema function");
|
|
399
|
-
|
|
160
|
+
r.addValidator({
|
|
400
161
|
fieldPath: t,
|
|
401
162
|
type: "sync",
|
|
402
163
|
validator: e,
|
|
403
|
-
options:
|
|
164
|
+
options: i
|
|
404
165
|
});
|
|
405
166
|
}
|
|
406
167
|
/**
|
|
407
168
|
* Зарегистрировать асинхронный валидатор
|
|
408
169
|
*/
|
|
409
|
-
registerAsync(t, e,
|
|
410
|
-
const
|
|
411
|
-
if (!
|
|
170
|
+
registerAsync(t, e, i) {
|
|
171
|
+
const r = this.getCurrentContext();
|
|
172
|
+
if (!r)
|
|
412
173
|
throw new Error("Validators can only be registered inside a validation schema function");
|
|
413
|
-
|
|
174
|
+
r.addValidator({
|
|
414
175
|
fieldPath: t,
|
|
415
176
|
type: "async",
|
|
416
177
|
validator: e,
|
|
417
|
-
options:
|
|
178
|
+
options: i
|
|
418
179
|
});
|
|
419
180
|
}
|
|
420
181
|
/**
|
|
421
182
|
* Зарегистрировать tree валидатор
|
|
422
183
|
*/
|
|
423
184
|
registerTree(t, e) {
|
|
424
|
-
const
|
|
425
|
-
if (!
|
|
185
|
+
const i = this.getCurrentContext();
|
|
186
|
+
if (!i)
|
|
426
187
|
throw new Error("Validators can only be registered inside a validation schema function");
|
|
427
|
-
|
|
188
|
+
i.addValidator({
|
|
428
189
|
fieldPath: e?.targetField || "__tree__",
|
|
429
190
|
type: "tree",
|
|
430
191
|
validator: t,
|
|
@@ -435,10 +196,10 @@ class f {
|
|
|
435
196
|
* Войти в условный блок
|
|
436
197
|
*/
|
|
437
198
|
enterCondition(t, e) {
|
|
438
|
-
const
|
|
439
|
-
if (!
|
|
199
|
+
const i = this.getCurrentContext();
|
|
200
|
+
if (!i)
|
|
440
201
|
throw new Error("Conditions can only be used inside a validation schema function");
|
|
441
|
-
|
|
202
|
+
i.enterCondition(t, e);
|
|
442
203
|
}
|
|
443
204
|
/**
|
|
444
205
|
* Выйти из условного блока
|
|
@@ -459,12 +220,12 @@ class f {
|
|
|
459
220
|
* @param itemSchemaFn - Validation schema для элемента массива
|
|
460
221
|
*/
|
|
461
222
|
registerArrayItemValidation(t, e) {
|
|
462
|
-
const
|
|
463
|
-
if (!
|
|
223
|
+
const i = this.getCurrentContext();
|
|
224
|
+
if (!i)
|
|
464
225
|
throw new Error(
|
|
465
226
|
"Array item validators can only be registered inside a validation schema function"
|
|
466
227
|
);
|
|
467
|
-
|
|
228
|
+
i.addValidator({
|
|
468
229
|
fieldPath: t,
|
|
469
230
|
type: "array-items",
|
|
470
231
|
validator: e,
|
|
@@ -485,12 +246,12 @@ class f {
|
|
|
485
246
|
* @private
|
|
486
247
|
*/
|
|
487
248
|
applyValidators(t, e) {
|
|
488
|
-
const
|
|
489
|
-
for (const
|
|
490
|
-
if (
|
|
249
|
+
const i = /* @__PURE__ */ new Map();
|
|
250
|
+
for (const r of e) {
|
|
251
|
+
if (r.type === "tree" || r.type === "array-items")
|
|
491
252
|
continue;
|
|
492
|
-
const
|
|
493
|
-
|
|
253
|
+
const n = i.get(r.fieldPath) || [];
|
|
254
|
+
n.push(r), i.set(r.fieldPath, n);
|
|
494
255
|
}
|
|
495
256
|
}
|
|
496
257
|
/**
|
|
@@ -498,18 +259,18 @@ class f {
|
|
|
498
259
|
* @private
|
|
499
260
|
*/
|
|
500
261
|
applyArrayItemValidators(t, e) {
|
|
501
|
-
const
|
|
502
|
-
if (
|
|
503
|
-
for (const
|
|
504
|
-
const
|
|
505
|
-
if (
|
|
506
|
-
const s =
|
|
507
|
-
|
|
262
|
+
const i = e.filter((r) => r.type === "array-items");
|
|
263
|
+
if (i.length !== 0)
|
|
264
|
+
for (const r of i) {
|
|
265
|
+
const n = t[r.fieldPath.split(".")[0]];
|
|
266
|
+
if (n && "applyValidationSchema" in n) {
|
|
267
|
+
const s = r.validator;
|
|
268
|
+
n.applyValidationSchema(s);
|
|
508
269
|
}
|
|
509
270
|
}
|
|
510
271
|
}
|
|
511
272
|
}
|
|
512
|
-
class
|
|
273
|
+
class p {
|
|
513
274
|
/**
|
|
514
275
|
* Форма с типизированным Proxy-доступом к полям
|
|
515
276
|
*/
|
|
@@ -521,21 +282,24 @@ class U {
|
|
|
521
282
|
this.form = e;
|
|
522
283
|
}
|
|
523
284
|
/**
|
|
524
|
-
* Безопасно установить значение поля по строковому пути
|
|
285
|
+
* Безопасно установить значение поля по строковому пути или FieldPath
|
|
525
286
|
*
|
|
526
287
|
* Автоматически использует emitEvent: false для предотвращения циклов
|
|
288
|
+
*
|
|
289
|
+
* @param path - Строковый путь к полю или FieldPath объект
|
|
290
|
+
* @param value - Новое значение
|
|
527
291
|
*/
|
|
528
292
|
setFieldValue(t, e) {
|
|
529
|
-
const
|
|
530
|
-
|
|
293
|
+
const i = typeof t == "string" ? t : t.toString(), r = this._form.getFieldByPath(i);
|
|
294
|
+
r && r.setValue(e, { emitEvent: !1 });
|
|
531
295
|
}
|
|
532
296
|
}
|
|
533
|
-
class
|
|
297
|
+
class c {
|
|
534
298
|
/**
|
|
535
299
|
* Stack активных контекстов регистрации
|
|
536
300
|
* Используется для изоляции форм друг от друга
|
|
537
301
|
*/
|
|
538
|
-
static contextStack = new
|
|
302
|
+
static contextStack = new h();
|
|
539
303
|
registrations = [];
|
|
540
304
|
isRegistering = !1;
|
|
541
305
|
/**
|
|
@@ -555,7 +319,7 @@ class v {
|
|
|
555
319
|
* ```
|
|
556
320
|
*/
|
|
557
321
|
static getCurrent() {
|
|
558
|
-
return
|
|
322
|
+
return c.contextStack.getCurrent();
|
|
559
323
|
}
|
|
560
324
|
/**
|
|
561
325
|
* Начать регистрацию behaviors
|
|
@@ -564,7 +328,7 @@ class v {
|
|
|
564
328
|
* Помещает this в context stack для изоляции форм
|
|
565
329
|
*/
|
|
566
330
|
beginRegistration() {
|
|
567
|
-
this.isRegistering = !0, this.registrations = [],
|
|
331
|
+
this.isRegistering = !0, this.registrations = [], c.contextStack.push(this);
|
|
568
332
|
}
|
|
569
333
|
/**
|
|
570
334
|
* Зарегистрировать behavior handler
|
|
@@ -597,40 +361,40 @@ class v {
|
|
|
597
361
|
* @returns Количество зарегистрированных behaviors и функция cleanup
|
|
598
362
|
*/
|
|
599
363
|
endRegistration(t) {
|
|
600
|
-
this.isRegistering = !1,
|
|
601
|
-
const e = new
|
|
602
|
-
for (const
|
|
603
|
-
const s = this.createEffect(
|
|
604
|
-
s &&
|
|
364
|
+
this.isRegistering = !1, c.contextStack.verify(this, "BehaviorRegistry");
|
|
365
|
+
const e = new p(t), i = [];
|
|
366
|
+
for (const n of this.registrations) {
|
|
367
|
+
const s = this.createEffect(n, t, e);
|
|
368
|
+
s && i.push(s);
|
|
605
369
|
}
|
|
606
|
-
const
|
|
607
|
-
|
|
370
|
+
const r = () => {
|
|
371
|
+
i.forEach((n) => n());
|
|
608
372
|
};
|
|
609
373
|
return {
|
|
610
374
|
count: this.registrations.length,
|
|
611
|
-
cleanup:
|
|
375
|
+
cleanup: r
|
|
612
376
|
};
|
|
613
377
|
}
|
|
614
378
|
/**
|
|
615
379
|
* Создать effect подписку для behavior
|
|
616
380
|
* @private
|
|
617
381
|
*/
|
|
618
|
-
createEffect(t, e,
|
|
619
|
-
const { handler:
|
|
382
|
+
createEffect(t, e, i) {
|
|
383
|
+
const { handler: r, debounce: n = 0 } = t;
|
|
620
384
|
let s = null;
|
|
621
|
-
const
|
|
622
|
-
|
|
623
|
-
},
|
|
385
|
+
const g = (l) => {
|
|
386
|
+
n > 0 ? (s && clearTimeout(s), s = setTimeout(l, n)) : l();
|
|
387
|
+
}, u = () => {
|
|
624
388
|
s && (clearTimeout(s), s = null);
|
|
625
|
-
},
|
|
626
|
-
return
|
|
627
|
-
|
|
389
|
+
}, d = r(e, i, g);
|
|
390
|
+
return d ? () => {
|
|
391
|
+
u(), d && d();
|
|
628
392
|
} : null;
|
|
629
393
|
}
|
|
630
394
|
}
|
|
631
|
-
function
|
|
632
|
-
const
|
|
633
|
-
return
|
|
395
|
+
function y() {
|
|
396
|
+
const o = a.getCurrent();
|
|
397
|
+
return o || {
|
|
634
398
|
registerSync: () => {
|
|
635
399
|
},
|
|
636
400
|
registerAsync: () => {
|
|
@@ -645,60 +409,18 @@ function $() {
|
|
|
645
409
|
}
|
|
646
410
|
};
|
|
647
411
|
}
|
|
648
|
-
function
|
|
649
|
-
const
|
|
650
|
-
return
|
|
412
|
+
function x() {
|
|
413
|
+
const o = c.getCurrent();
|
|
414
|
+
return o || {
|
|
651
415
|
register: () => {
|
|
652
416
|
}
|
|
653
417
|
};
|
|
654
418
|
}
|
|
655
|
-
function W() {
|
|
656
|
-
return T("");
|
|
657
|
-
}
|
|
658
|
-
function T(i) {
|
|
659
|
-
return new Proxy(
|
|
660
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
661
|
-
{},
|
|
662
|
-
{
|
|
663
|
-
get(t, e) {
|
|
664
|
-
if (e === "__path" || e === "__fieldPath")
|
|
665
|
-
return i || e;
|
|
666
|
-
if (e === "__key") {
|
|
667
|
-
const a = i.split(".");
|
|
668
|
-
return a[a.length - 1] || e;
|
|
669
|
-
}
|
|
670
|
-
const n = i ? `${i}.${e}` : e, o = {
|
|
671
|
-
__path: n,
|
|
672
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
673
|
-
__key: e,
|
|
674
|
-
__formType: void 0,
|
|
675
|
-
__fieldType: void 0
|
|
676
|
-
};
|
|
677
|
-
return new Proxy(o, {
|
|
678
|
-
get(a, s) {
|
|
679
|
-
if (s === "__path" || s === "__fieldPath")
|
|
680
|
-
return n;
|
|
681
|
-
if (s === "__key")
|
|
682
|
-
return e;
|
|
683
|
-
if (s === "__formType" || s === "__fieldType")
|
|
684
|
-
return;
|
|
685
|
-
const p = `${n}.${s}`;
|
|
686
|
-
return T(p);
|
|
687
|
-
}
|
|
688
|
-
});
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
);
|
|
692
|
-
}
|
|
693
419
|
export {
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
W as c,
|
|
701
|
-
O as d,
|
|
702
|
-
$ as g,
|
|
703
|
-
B as w
|
|
420
|
+
c as B,
|
|
421
|
+
h as R,
|
|
422
|
+
a as V,
|
|
423
|
+
x as a,
|
|
424
|
+
p as b,
|
|
425
|
+
y as g
|
|
704
426
|
};
|