@nice2dev/erp-adapter 1.0.14 → 1.0.15
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/finance/useLoanApi.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +169 -161
- package/dist/index.mjs.map +1 -1
- package/dist/useEntityPresence.d.ts.map +1 -1
- package/dist/useSignalRLiveData.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -120,82 +120,82 @@ function he(c) {
|
|
|
120
120
|
flashChanges: w = !0,
|
|
121
121
|
flashDuration: V = 500,
|
|
122
122
|
optimisticUpdates: O = !0
|
|
123
|
-
} = c, [Q,
|
|
124
|
-
(y,
|
|
125
|
-
const { operation:
|
|
126
|
-
switch (
|
|
123
|
+
} = c, [Q, D] = E(a), [X, q] = E(e.status), [Z, N] = E(/* @__PURE__ */ new Set()), [K, x] = E(/* @__PURE__ */ new Set()), [Y, ae] = E(null), z = oe(/* @__PURE__ */ new Map()), j = oe(/* @__PURE__ */ new Map()), _ = h(
|
|
124
|
+
(y, P) => {
|
|
125
|
+
const { operation: S, key: C, data: k, changes: I } = P;
|
|
126
|
+
switch (S) {
|
|
127
127
|
case "insert":
|
|
128
|
-
return !
|
|
128
|
+
return !k || y.some((L) => L[n] === C) ? y : [...y, k];
|
|
129
129
|
case "update":
|
|
130
|
-
return y.map((
|
|
131
|
-
if (
|
|
132
|
-
return
|
|
133
|
-
const H =
|
|
130
|
+
return y.map((L) => {
|
|
131
|
+
if (L[n] !== C)
|
|
132
|
+
return L;
|
|
133
|
+
const H = z.current.get(C);
|
|
134
134
|
if (H && i) {
|
|
135
135
|
const se = i(
|
|
136
|
-
{ ...
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
{ ...L, ...H.changes },
|
|
137
|
+
k ?? { ...L, ...I },
|
|
138
|
+
P
|
|
139
139
|
);
|
|
140
|
-
return se === "local" ? { ...
|
|
140
|
+
return se === "local" ? { ...L, ...H.changes } : se === "remote" ? (z.current.delete(C), k ?? { ...L, ...I }) : se === "merge" ? { ...L, ...I, ...H.changes } : se;
|
|
141
141
|
}
|
|
142
|
-
return
|
|
142
|
+
return k || { ...L, ...I };
|
|
143
143
|
});
|
|
144
144
|
case "delete":
|
|
145
|
-
return y.filter((
|
|
145
|
+
return y.filter((L) => L[n] !== C);
|
|
146
146
|
default:
|
|
147
147
|
return y;
|
|
148
148
|
}
|
|
149
149
|
},
|
|
150
150
|
[n, i]
|
|
151
|
-
),
|
|
151
|
+
), U = h(
|
|
152
152
|
(y) => {
|
|
153
153
|
if (!w)
|
|
154
154
|
return;
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
return
|
|
161
|
-
}),
|
|
155
|
+
const P = j.current.get(y);
|
|
156
|
+
P && clearTimeout(P), N((C) => /* @__PURE__ */ new Set([...C, y]));
|
|
157
|
+
const S = setTimeout(() => {
|
|
158
|
+
N((C) => {
|
|
159
|
+
const k = new Set(C);
|
|
160
|
+
return k.delete(y), k;
|
|
161
|
+
}), j.current.delete(y);
|
|
162
162
|
}, V);
|
|
163
|
-
|
|
163
|
+
j.current.set(y, S);
|
|
164
164
|
},
|
|
165
165
|
[w, V]
|
|
166
|
-
),
|
|
166
|
+
), B = h(
|
|
167
167
|
async (y) => {
|
|
168
|
-
y.entityName === t && (o && !await o(y) || (
|
|
169
|
-
const
|
|
170
|
-
return r == null || r(y,
|
|
171
|
-
}),
|
|
168
|
+
y.entityName === t && (o && !await o(y) || (D((P) => {
|
|
169
|
+
const S = _(P, y);
|
|
170
|
+
return r == null || r(y, S), S;
|
|
171
|
+
}), U(y.key)));
|
|
172
172
|
},
|
|
173
|
-
[t, o, _, r,
|
|
173
|
+
[t, o, _, r, U]
|
|
174
174
|
), p = h(
|
|
175
175
|
(y) => {
|
|
176
|
-
|
|
176
|
+
B(y);
|
|
177
177
|
},
|
|
178
|
-
[
|
|
178
|
+
[B]
|
|
179
179
|
), le = h(
|
|
180
|
-
(y,
|
|
180
|
+
(y, P) => {
|
|
181
181
|
if (!O)
|
|
182
182
|
return;
|
|
183
|
-
const
|
|
184
|
-
|
|
183
|
+
const S = Q.find((C) => C[n] === y);
|
|
184
|
+
S && (z.current.set(y, { original: S, changes: P }), x((C) => /* @__PURE__ */ new Set([...C, y])));
|
|
185
185
|
},
|
|
186
186
|
[Q, n, O]
|
|
187
187
|
), J = h((y) => {
|
|
188
|
-
|
|
189
|
-
const
|
|
190
|
-
return
|
|
188
|
+
z.current.delete(y), x((P) => {
|
|
189
|
+
const S = new Set(P);
|
|
190
|
+
return S.delete(y), S;
|
|
191
191
|
});
|
|
192
192
|
}, []), F = h(
|
|
193
193
|
(y) => {
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
(
|
|
197
|
-
),
|
|
198
|
-
const C = new Set(
|
|
194
|
+
const P = z.current.get(y);
|
|
195
|
+
P && (D(
|
|
196
|
+
(S) => S.map((C) => C[n] === y ? P.original : C)
|
|
197
|
+
), z.current.delete(y), x((S) => {
|
|
198
|
+
const C = new Set(S);
|
|
199
199
|
return C.delete(y), C;
|
|
200
200
|
}));
|
|
201
201
|
},
|
|
@@ -215,14 +215,16 @@ function he(c) {
|
|
|
215
215
|
}
|
|
216
216
|
}, [e, g, t]);
|
|
217
217
|
return te(() => {
|
|
218
|
-
const y = e.onStatusChange((
|
|
219
|
-
q(
|
|
218
|
+
const y = e.onStatusChange((S) => {
|
|
219
|
+
q(S), S === "connected" && ne();
|
|
220
220
|
});
|
|
221
|
-
|
|
222
|
-
|
|
221
|
+
e.on(v, B), e.status === "connected" && ne();
|
|
222
|
+
const P = j.current;
|
|
223
|
+
return () => {
|
|
224
|
+
y(), e.off(v, B), re(), P.forEach((S) => clearTimeout(S)), P.clear();
|
|
223
225
|
};
|
|
224
|
-
}, [e, v,
|
|
225
|
-
|
|
226
|
+
}, [e, v, B, ne, re]), te(() => {
|
|
227
|
+
D(a);
|
|
226
228
|
}, [a]), {
|
|
227
229
|
data: Q,
|
|
228
230
|
status: X,
|
|
@@ -304,9 +306,12 @@ function pe(c) {
|
|
|
304
306
|
presenceEventName: V = "EntityPresenceChanged",
|
|
305
307
|
joinedEventName: O = "EntityUserJoined",
|
|
306
308
|
leftEventName: Q = "EntityUserLeft",
|
|
307
|
-
onPresenceChange:
|
|
309
|
+
onPresenceChange: D,
|
|
308
310
|
onEditConflict: X
|
|
309
|
-
} = c, [q, Z] = E([]), [
|
|
311
|
+
} = c, [q, Z] = E([]), [N, K] = E(o), [x, Y] = E(), [ae, z] = E(e.status), j = oe(Date.now()), _ = oe(null), U = oe(null), B = oe(null), p = de(() => Array.isArray(n) ? n : [n], [n]), le = de(
|
|
312
|
+
() => `${t}:${[...p].sort().join(",")}`,
|
|
313
|
+
[t, p]
|
|
314
|
+
), J = h(
|
|
310
315
|
async (m, T, s) => {
|
|
311
316
|
if (e.status === "connected")
|
|
312
317
|
try {
|
|
@@ -325,7 +330,7 @@ function pe(c) {
|
|
|
325
330
|
[e, w, t, p, a.id]
|
|
326
331
|
), F = h(
|
|
327
332
|
(m, T) => {
|
|
328
|
-
K(m), Y(T), J(m, T),
|
|
333
|
+
K(m), Y(T), J(m, T), j.current = Date.now();
|
|
329
334
|
},
|
|
330
335
|
[J]
|
|
331
336
|
), ne = h(
|
|
@@ -340,10 +345,10 @@ function pe(c) {
|
|
|
340
345
|
F("viewing", void 0);
|
|
341
346
|
}, [F]), y = h(
|
|
342
347
|
(m) => {
|
|
343
|
-
J(
|
|
348
|
+
J(N, x, m), j.current = Date.now();
|
|
344
349
|
},
|
|
345
|
-
[J,
|
|
346
|
-
),
|
|
350
|
+
[J, N, x]
|
|
351
|
+
), P = h(
|
|
347
352
|
(m) => {
|
|
348
353
|
const T = q.find(
|
|
349
354
|
(s) => s.user.id !== a.id && s.status === "editing" && s.editingField === m
|
|
@@ -351,7 +356,7 @@ function pe(c) {
|
|
|
351
356
|
return (T == null ? void 0 : T.user) ?? null;
|
|
352
357
|
},
|
|
353
358
|
[q, a.id]
|
|
354
|
-
),
|
|
359
|
+
), S = h(
|
|
355
360
|
(m) => {
|
|
356
361
|
const T = q.find((s) => s.status === "editing" && s.editingField === m);
|
|
357
362
|
return (T == null ? void 0 : T.user) ?? null;
|
|
@@ -361,21 +366,21 @@ function pe(c) {
|
|
|
361
366
|
if (e.status === "connected")
|
|
362
367
|
try {
|
|
363
368
|
const m = await e.invoke("GetEntityPresence", t, p);
|
|
364
|
-
Array.isArray(m) && (Z(m),
|
|
369
|
+
Array.isArray(m) && (Z(m), D == null || D(m));
|
|
365
370
|
} catch {
|
|
366
371
|
}
|
|
367
|
-
}, [e, t, p,
|
|
368
|
-
|
|
372
|
+
}, [e, t, p, D]), k = h(() => {
|
|
373
|
+
j.current = Date.now(), U.current && clearTimeout(U.current), B.current && clearTimeout(B.current), (N === "idle" || N === "away") && F(x ? "editing" : "viewing", x), U.current = setTimeout(() => {
|
|
369
374
|
F("idle", x);
|
|
370
|
-
}, i),
|
|
375
|
+
}, i), B.current = setTimeout(() => {
|
|
371
376
|
F("away", x);
|
|
372
377
|
}, u);
|
|
373
|
-
}, [
|
|
378
|
+
}, [N, x, i, u, F]), I = h(
|
|
374
379
|
(m) => {
|
|
375
|
-
m.entityType !== t || !m.entityIds.some((s) => p.includes(s)) || (Z(m.presence.filter((s) => s.user.id !== a.id)),
|
|
380
|
+
m.entityType !== t || !m.entityIds.some((s) => p.includes(s)) || (Z(m.presence.filter((s) => s.user.id !== a.id)), D == null || D(m.presence));
|
|
376
381
|
},
|
|
377
|
-
[t, p, a.id,
|
|
378
|
-
),
|
|
382
|
+
[t, p, a.id, D]
|
|
383
|
+
), L = h(
|
|
379
384
|
(m) => {
|
|
380
385
|
m.entityType !== t || !m.entityIds.some((s) => p.includes(s)) || m.presence.user.id === a.id || Z((s) => {
|
|
381
386
|
const b = s.findIndex(($) => $.user.id === m.presence.user.id);
|
|
@@ -394,8 +399,8 @@ function pe(c) {
|
|
|
394
399
|
[t, p]
|
|
395
400
|
);
|
|
396
401
|
te(() => {
|
|
397
|
-
const m = e.onStatusChange(
|
|
398
|
-
e.on(V, I), e.on(O,
|
|
402
|
+
const m = e.onStatusChange(z);
|
|
403
|
+
e.on(V, I), e.on(O, L), e.on(Q, H);
|
|
399
404
|
const T = async () => {
|
|
400
405
|
if (e.status === "connected")
|
|
401
406
|
try {
|
|
@@ -403,13 +408,13 @@ function pe(c) {
|
|
|
403
408
|
entityType: t,
|
|
404
409
|
entityIds: p,
|
|
405
410
|
user: a,
|
|
406
|
-
status:
|
|
411
|
+
status: N
|
|
407
412
|
}), await C();
|
|
408
413
|
} catch {
|
|
409
414
|
}
|
|
410
415
|
};
|
|
411
416
|
return e.status === "connected" && T(), () => {
|
|
412
|
-
m(), e.off(V, I), e.off(O,
|
|
417
|
+
m(), e.off(V, I), e.off(O, L), e.off(Q, H), e.status === "connected" && e.invoke(v, {
|
|
413
418
|
entityType: t,
|
|
414
419
|
entityIds: p,
|
|
415
420
|
userId: a.id
|
|
@@ -425,41 +430,41 @@ function pe(c) {
|
|
|
425
430
|
O,
|
|
426
431
|
Q,
|
|
427
432
|
I,
|
|
428
|
-
|
|
433
|
+
L,
|
|
429
434
|
H,
|
|
430
435
|
C,
|
|
431
436
|
a,
|
|
432
|
-
|
|
437
|
+
N,
|
|
433
438
|
t,
|
|
434
439
|
p
|
|
435
440
|
]), te(() => (_.current = setInterval(() => {
|
|
436
|
-
J(
|
|
441
|
+
J(N, x);
|
|
437
442
|
}, r), () => {
|
|
438
443
|
_.current && clearInterval(_.current);
|
|
439
|
-
}), [r, J,
|
|
444
|
+
}), [r, J, N, x]), te(() => {
|
|
440
445
|
const m = ["mousemove", "keydown", "mousedown", "touchstart", "scroll"];
|
|
441
|
-
return m.forEach((T) => window.addEventListener(T,
|
|
446
|
+
return m.forEach((T) => window.addEventListener(T, k, { passive: !0 })), U.current = setTimeout(() => {
|
|
442
447
|
F("idle", x);
|
|
443
|
-
}, i),
|
|
448
|
+
}, i), B.current = setTimeout(() => {
|
|
444
449
|
F("away", x);
|
|
445
450
|
}, u), () => {
|
|
446
|
-
m.forEach((T) => window.removeEventListener(T,
|
|
451
|
+
m.forEach((T) => window.removeEventListener(T, k)), U.current && clearTimeout(U.current), B.current && clearTimeout(B.current);
|
|
447
452
|
};
|
|
448
|
-
}, [
|
|
453
|
+
}, [k, i, u, x, F]);
|
|
449
454
|
const se = q.filter((m) => m.status === "viewing" || m.status === "idle").map((m) => m.user), ie = q.filter((m) => m.status === "editing").map((m) => m.user), ue = ie.length > 0;
|
|
450
455
|
return {
|
|
451
456
|
presence: q,
|
|
452
457
|
viewers: se,
|
|
453
458
|
editors: ie,
|
|
454
|
-
myStatus:
|
|
459
|
+
myStatus: N,
|
|
455
460
|
setMyStatus: F,
|
|
456
461
|
startEditing: ne,
|
|
457
462
|
stopEditing: re,
|
|
458
463
|
updateSelection: y,
|
|
459
464
|
connectionStatus: ae,
|
|
460
|
-
isFieldLocked:
|
|
465
|
+
isFieldLocked: P,
|
|
461
466
|
hasActiveEditors: ue,
|
|
462
|
-
getFieldEditor:
|
|
467
|
+
getFieldEditor: S,
|
|
463
468
|
refresh: C
|
|
464
469
|
};
|
|
465
470
|
}
|
|
@@ -562,11 +567,11 @@ function Le(c) {
|
|
|
562
567
|
lockTimeout: V = 6e4,
|
|
563
568
|
enableCursorSharing: O = !0,
|
|
564
569
|
cursorDebounce: Q = 50,
|
|
565
|
-
optimisticUpdates:
|
|
570
|
+
optimisticUpdates: D = !0,
|
|
566
571
|
flashChanges: X = !0,
|
|
567
572
|
flashDuration: q = 500,
|
|
568
573
|
liveDataOptions: Z = {}
|
|
569
|
-
} = c, [
|
|
574
|
+
} = c, [N, K] = E(/* @__PURE__ */ new Map()), [x, Y] = E(/* @__PURE__ */ new Map()), [ae, z] = E([]), [j, _] = E(null), [U, B] = E([]), [p, le] = E([]), [J, F] = E(null), [ne, re] = E([]), y = oe(null), P = oe(/* @__PURE__ */ new Map()), S = h((l) => (P.current.has(l) || P.current.set(l, me(l)), P.current.get(l)), []), C = h(
|
|
570
575
|
(l, f, d) => {
|
|
571
576
|
if (!d.changes)
|
|
572
577
|
return f;
|
|
@@ -575,12 +580,12 @@ function Le(c) {
|
|
|
575
580
|
);
|
|
576
581
|
if (!A)
|
|
577
582
|
return f;
|
|
578
|
-
const M = A.timestamp,
|
|
583
|
+
const M = A.timestamp, R = fe(d.timestamp);
|
|
579
584
|
switch (r) {
|
|
580
585
|
case "last-write-wins":
|
|
581
|
-
return M >
|
|
586
|
+
return M > R ? "local" : "remote";
|
|
582
587
|
case "first-write-wins":
|
|
583
|
-
return M <
|
|
588
|
+
return M < R ? "local" : "remote";
|
|
584
589
|
case "merge":
|
|
585
590
|
return i ? i(l, f, Object.keys(d.changes)[0]) : "merge";
|
|
586
591
|
case "ask-user": {
|
|
@@ -591,9 +596,9 @@ function Le(c) {
|
|
|
591
596
|
localUser: a,
|
|
592
597
|
remoteUser: d.changedBy ? { id: d.changedBy, name: d.changedBy } : { id: "unknown", name: "Unknown" },
|
|
593
598
|
localTimestamp: M,
|
|
594
|
-
remoteTimestamp:
|
|
599
|
+
remoteTimestamp: R
|
|
595
600
|
};
|
|
596
|
-
return
|
|
601
|
+
return z((ce) => [...ce, W]), "local";
|
|
597
602
|
}
|
|
598
603
|
case "reject":
|
|
599
604
|
return "remote";
|
|
@@ -602,14 +607,14 @@ function Le(c) {
|
|
|
602
607
|
}
|
|
603
608
|
},
|
|
604
609
|
[x, r, i, a]
|
|
605
|
-
),
|
|
610
|
+
), k = he({
|
|
606
611
|
adapter: e,
|
|
607
612
|
entityName: t,
|
|
608
613
|
keyField: n,
|
|
609
614
|
initialData: o,
|
|
610
615
|
flashChanges: X,
|
|
611
616
|
flashDuration: q,
|
|
612
|
-
optimisticUpdates:
|
|
617
|
+
optimisticUpdates: D,
|
|
613
618
|
onConflict: C,
|
|
614
619
|
...Z
|
|
615
620
|
}), I = pe({
|
|
@@ -619,12 +624,12 @@ function Le(c) {
|
|
|
619
624
|
// Special ID for grid-level presence
|
|
620
625
|
currentUser: a,
|
|
621
626
|
initialStatus: "viewing"
|
|
622
|
-
}),
|
|
627
|
+
}), L = h(() => {
|
|
623
628
|
!O || e.status !== "connected" || e.invoke("UpdateGridSelection", {
|
|
624
629
|
entityType: t,
|
|
625
630
|
userId: a.id,
|
|
626
|
-
focusedCell:
|
|
627
|
-
selectedCells:
|
|
631
|
+
focusedCell: j,
|
|
632
|
+
selectedCells: U,
|
|
628
633
|
selectedRows: p,
|
|
629
634
|
editingCell: J
|
|
630
635
|
}).catch(() => {
|
|
@@ -634,22 +639,22 @@ function Le(c) {
|
|
|
634
639
|
O,
|
|
635
640
|
t,
|
|
636
641
|
a.id,
|
|
637
|
-
|
|
638
|
-
|
|
642
|
+
j,
|
|
643
|
+
U,
|
|
639
644
|
p,
|
|
640
645
|
J
|
|
641
646
|
]);
|
|
642
647
|
te(() => {
|
|
643
648
|
if (O)
|
|
644
|
-
return y.current && clearTimeout(y.current), y.current = setTimeout(
|
|
649
|
+
return y.current && clearTimeout(y.current), y.current = setTimeout(L, Q), () => {
|
|
645
650
|
y.current && clearTimeout(y.current);
|
|
646
651
|
};
|
|
647
652
|
}, [
|
|
648
653
|
O,
|
|
649
|
-
R,
|
|
650
|
-
Q,
|
|
651
|
-
B,
|
|
652
654
|
L,
|
|
655
|
+
Q,
|
|
656
|
+
j,
|
|
657
|
+
U,
|
|
653
658
|
p,
|
|
654
659
|
J
|
|
655
660
|
]), te(() => {
|
|
@@ -657,17 +662,17 @@ function Le(c) {
|
|
|
657
662
|
return;
|
|
658
663
|
const l = (f) => {
|
|
659
664
|
f.entityType !== t || f.userId === a.id || re((d) => {
|
|
660
|
-
const A = d.findIndex((
|
|
665
|
+
const A = d.findIndex((R) => R.user.id === f.userId), M = {
|
|
661
666
|
user: { id: f.userId, name: f.userName, avatarUrl: f.avatarUrl },
|
|
662
667
|
focusedCell: f.focusedCell,
|
|
663
668
|
selectedCells: f.selectedCells,
|
|
664
669
|
selectedRows: f.selectedRows,
|
|
665
670
|
editingCell: f.editingCell,
|
|
666
|
-
color:
|
|
671
|
+
color: S(f.userId)
|
|
667
672
|
};
|
|
668
673
|
if (A >= 0) {
|
|
669
|
-
const
|
|
670
|
-
return
|
|
674
|
+
const R = [...d];
|
|
675
|
+
return R[A] = M, R;
|
|
671
676
|
}
|
|
672
677
|
return [...d, M];
|
|
673
678
|
});
|
|
@@ -675,7 +680,7 @@ function Le(c) {
|
|
|
675
680
|
return e.on("GridSelectionUpdated", l), () => {
|
|
676
681
|
e.off("GridSelectionUpdated", l);
|
|
677
682
|
};
|
|
678
|
-
}, [e, O, t, a.id,
|
|
683
|
+
}, [e, O, t, a.id, S]), te(() => {
|
|
679
684
|
if (!w)
|
|
680
685
|
return;
|
|
681
686
|
const l = (d) => {
|
|
@@ -700,8 +705,8 @@ function Le(c) {
|
|
|
700
705
|
K((d) => {
|
|
701
706
|
const A = new Map(d);
|
|
702
707
|
let M = !1;
|
|
703
|
-
for (const [
|
|
704
|
-
f - W.timestamp > V && (A.delete(
|
|
708
|
+
for (const [R, W] of A)
|
|
709
|
+
f - W.timestamp > V && (A.delete(R), M = !0);
|
|
705
710
|
return M ? A : d;
|
|
706
711
|
});
|
|
707
712
|
}, 1e4);
|
|
@@ -711,16 +716,16 @@ function Le(c) {
|
|
|
711
716
|
(l) => {
|
|
712
717
|
if (!w)
|
|
713
718
|
return !1;
|
|
714
|
-
const f =
|
|
719
|
+
const f = N.get(G(l));
|
|
715
720
|
return f ? f.user.id !== a.id && Date.now() - f.timestamp < V : !1;
|
|
716
721
|
},
|
|
717
|
-
[w,
|
|
722
|
+
[w, N, a.id, V]
|
|
718
723
|
), se = h(
|
|
719
724
|
(l) => {
|
|
720
|
-
const f =
|
|
725
|
+
const f = N.get(G(l));
|
|
721
726
|
return !f || Date.now() - f.timestamp > V ? null : f.user;
|
|
722
727
|
},
|
|
723
|
-
[
|
|
728
|
+
[N, V]
|
|
724
729
|
), ie = h(
|
|
725
730
|
(l) => H(l) ? !1 : (F(l), I.startEditing(`${l.rowKey}:${l.field}`), w && e.status === "connected" && (e.invoke("AcquireCellLock", {
|
|
726
731
|
entityType: t,
|
|
@@ -735,7 +740,7 @@ function Le(c) {
|
|
|
735
740
|
[H, I, w, e, t, a]
|
|
736
741
|
), ue = h(
|
|
737
742
|
async (l, f) => {
|
|
738
|
-
const d =
|
|
743
|
+
const d = k.data.find((R) => R[n] === l.rowKey);
|
|
739
744
|
if (!d)
|
|
740
745
|
return !1;
|
|
741
746
|
const A = d[l.field];
|
|
@@ -747,10 +752,10 @@ function Le(c) {
|
|
|
747
752
|
newValue: f,
|
|
748
753
|
timestamp: Date.now()
|
|
749
754
|
};
|
|
750
|
-
Y((
|
|
751
|
-
const W = new Map(
|
|
755
|
+
Y((R) => {
|
|
756
|
+
const W = new Map(R);
|
|
752
757
|
return W.set(G(l), M), W;
|
|
753
|
-
}),
|
|
758
|
+
}), D && k.registerPendingChange(l.rowKey, { [l.field]: f });
|
|
754
759
|
try {
|
|
755
760
|
return await e.invoke("UpdateEntityField", {
|
|
756
761
|
entityType: t,
|
|
@@ -759,26 +764,26 @@ function Le(c) {
|
|
|
759
764
|
value: f,
|
|
760
765
|
userId: a.id,
|
|
761
766
|
timestamp: M.timestamp
|
|
762
|
-
}),
|
|
763
|
-
const W = new Map(
|
|
767
|
+
}), k.confirmPendingChange(l.rowKey), Y((R) => {
|
|
768
|
+
const W = new Map(R);
|
|
764
769
|
return W.delete(G(l)), W;
|
|
765
770
|
}), v == null || v(l, f), w && (e.invoke("ReleaseCellLock", { entityType: t, cell: l }).catch(() => {
|
|
766
|
-
}), K((
|
|
767
|
-
const W = new Map(
|
|
771
|
+
}), K((R) => {
|
|
772
|
+
const W = new Map(R);
|
|
768
773
|
return W.delete(G(l)), W;
|
|
769
774
|
})), F(null), I.stopEditing(), !0;
|
|
770
|
-
} catch (
|
|
771
|
-
throw
|
|
775
|
+
} catch (R) {
|
|
776
|
+
throw k.rollbackPendingChange(l.rowKey), Y((W) => {
|
|
772
777
|
const ce = new Map(W);
|
|
773
778
|
return ce.delete(G(l)), ce;
|
|
774
|
-
}),
|
|
779
|
+
}), R;
|
|
775
780
|
}
|
|
776
781
|
},
|
|
777
782
|
[
|
|
778
|
-
|
|
783
|
+
k,
|
|
779
784
|
n,
|
|
780
785
|
g,
|
|
781
|
-
|
|
786
|
+
D,
|
|
782
787
|
e,
|
|
783
788
|
t,
|
|
784
789
|
a.id,
|
|
@@ -801,14 +806,14 @@ function Le(c) {
|
|
|
801
806
|
), T = h(
|
|
802
807
|
(l, f) => {
|
|
803
808
|
const d = ae.find((A) => G(A.cell) === G(l));
|
|
804
|
-
d && (f === "remote" &&
|
|
809
|
+
d && (f === "remote" && k.applyRemoteUpdate({
|
|
805
810
|
operation: "update",
|
|
806
811
|
entityName: t,
|
|
807
812
|
key: l.rowKey,
|
|
808
813
|
changes: { [l.field]: d.remoteValue }
|
|
809
|
-
}),
|
|
814
|
+
}), z((A) => A.filter((M) => G(M.cell) !== G(l))));
|
|
810
815
|
},
|
|
811
|
-
[ae,
|
|
816
|
+
[ae, k, t]
|
|
812
817
|
), s = h(
|
|
813
818
|
async (l) => {
|
|
814
819
|
await e.invoke("InsertEntity", t, l);
|
|
@@ -816,14 +821,14 @@ function Le(c) {
|
|
|
816
821
|
[e, t]
|
|
817
822
|
), b = h(
|
|
818
823
|
async (l, f) => {
|
|
819
|
-
|
|
824
|
+
D && k.registerPendingChange(l, f);
|
|
820
825
|
try {
|
|
821
|
-
await e.invoke("UpdateEntity", t, l, f),
|
|
826
|
+
await e.invoke("UpdateEntity", t, l, f), k.confirmPendingChange(l);
|
|
822
827
|
} catch (d) {
|
|
823
|
-
throw
|
|
828
|
+
throw k.rollbackPendingChange(l), d;
|
|
824
829
|
}
|
|
825
830
|
},
|
|
826
|
-
[e, t,
|
|
831
|
+
[e, t, D, k]
|
|
827
832
|
), $ = h(
|
|
828
833
|
async (l) => {
|
|
829
834
|
await e.invoke("DeleteEntity", t, l);
|
|
@@ -832,26 +837,26 @@ function Le(c) {
|
|
|
832
837
|
), ee = de(
|
|
833
838
|
() => ({
|
|
834
839
|
user: a,
|
|
835
|
-
focusedCell:
|
|
836
|
-
selectedCells:
|
|
840
|
+
focusedCell: j,
|
|
841
|
+
selectedCells: U,
|
|
837
842
|
selectedRows: p,
|
|
838
843
|
editingCell: J,
|
|
839
|
-
color:
|
|
844
|
+
color: S(a.id)
|
|
840
845
|
}),
|
|
841
|
-
[a,
|
|
846
|
+
[a, j, U, p, J, S]
|
|
842
847
|
);
|
|
843
848
|
return {
|
|
844
|
-
data:
|
|
849
|
+
data: k.data,
|
|
845
850
|
presence: I.presence,
|
|
846
851
|
userSelections: ne,
|
|
847
852
|
mySelection: ee,
|
|
848
|
-
flashedKeys:
|
|
853
|
+
flashedKeys: k.flashedKeys,
|
|
849
854
|
pendingEdits: x,
|
|
850
|
-
connectionStatus:
|
|
855
|
+
connectionStatus: k.status,
|
|
851
856
|
myPresenceStatus: I.myStatus,
|
|
852
857
|
// Selection methods
|
|
853
858
|
setFocusedCell: _,
|
|
854
|
-
setSelectedCells:
|
|
859
|
+
setSelectedCells: B,
|
|
855
860
|
setSelectedRows: le,
|
|
856
861
|
// Edit methods
|
|
857
862
|
startCellEdit: ie,
|
|
@@ -859,7 +864,7 @@ function Le(c) {
|
|
|
859
864
|
cancelCellEdit: m,
|
|
860
865
|
isCellLocked: H,
|
|
861
866
|
getCellEditor: se,
|
|
862
|
-
getUserColor:
|
|
867
|
+
getUserColor: S,
|
|
863
868
|
// Row methods
|
|
864
869
|
insertRow: s,
|
|
865
870
|
updateRow: b,
|
|
@@ -1897,7 +1902,7 @@ function Je(c) {
|
|
|
1897
1902
|
fetcher: a = Te,
|
|
1898
1903
|
getAuthToken: o,
|
|
1899
1904
|
onError: r
|
|
1900
|
-
} = c, [i, u] = E([]), [g, v] = E(null), [w, V] = E(null), [O, Q] = E(null), [
|
|
1905
|
+
} = c, [i, u] = E([]), [g, v] = E(null), [w, V] = E(null), [O, Q] = E(null), [D, X] = E(null), [q, Z] = E(null), [N, K] = E([]), [x, Y] = E([]), [ae, z] = E(null), [j, _] = E({
|
|
1901
1906
|
offers: !1,
|
|
1902
1907
|
calculate: !1,
|
|
1903
1908
|
compare: !1,
|
|
@@ -1906,25 +1911,25 @@ function Je(c) {
|
|
|
1906
1911
|
refinancing: !1,
|
|
1907
1912
|
consolidation: !1,
|
|
1908
1913
|
savedCalculations: !1
|
|
1909
|
-
}),
|
|
1914
|
+
}), U = oe(/* @__PURE__ */ new Map()), B = h(() => {
|
|
1910
1915
|
const s = {
|
|
1911
1916
|
"Content-Type": "application/json"
|
|
1912
1917
|
}, b = o == null ? void 0 : o();
|
|
1913
1918
|
return b && (s.Authorization = `Bearer ${b}`), s;
|
|
1914
1919
|
}, [o]), p = h(
|
|
1915
1920
|
async (s, b = {}, $) => {
|
|
1916
|
-
const ee =
|
|
1921
|
+
const ee = U.current.get(s);
|
|
1917
1922
|
ee && ee.abort();
|
|
1918
1923
|
const l = new AbortController();
|
|
1919
|
-
|
|
1924
|
+
U.current.set(s, l);
|
|
1920
1925
|
const f = setTimeout(() => l.abort(), n);
|
|
1921
|
-
_((d) => ({ ...d, [$]: !0 })),
|
|
1926
|
+
_((d) => ({ ...d, [$]: !0 })), z(null);
|
|
1922
1927
|
try {
|
|
1923
1928
|
const d = `${e}${s}`;
|
|
1924
1929
|
return await a(d, {
|
|
1925
1930
|
...b,
|
|
1926
1931
|
headers: {
|
|
1927
|
-
...
|
|
1932
|
+
...B(),
|
|
1928
1933
|
...b.headers
|
|
1929
1934
|
},
|
|
1930
1935
|
signal: l.signal
|
|
@@ -1937,12 +1942,12 @@ function Je(c) {
|
|
|
1937
1942
|
endpoint: s,
|
|
1938
1943
|
statusCode: d.statusCode
|
|
1939
1944
|
};
|
|
1940
|
-
throw d.name !== "AbortError" && (
|
|
1945
|
+
throw d.name !== "AbortError" && (z(A), r == null || r(A)), A;
|
|
1941
1946
|
} finally {
|
|
1942
|
-
clearTimeout(f),
|
|
1947
|
+
clearTimeout(f), U.current.delete(s), _((d) => ({ ...d, [$]: !1 }));
|
|
1943
1948
|
}
|
|
1944
1949
|
},
|
|
1945
|
-
[e, n, a,
|
|
1950
|
+
[e, n, a, B, r]
|
|
1946
1951
|
), le = h(
|
|
1947
1952
|
async (s) => {
|
|
1948
1953
|
var f, d;
|
|
@@ -2004,7 +2009,7 @@ function Je(c) {
|
|
|
2004
2009
|
return Z(ee), ee;
|
|
2005
2010
|
},
|
|
2006
2011
|
[p, t]
|
|
2007
|
-
),
|
|
2012
|
+
), P = h(
|
|
2008
2013
|
async (s) => {
|
|
2009
2014
|
const b = await p(
|
|
2010
2015
|
"/applications",
|
|
@@ -2017,7 +2022,7 @@ function Je(c) {
|
|
|
2017
2022
|
return X(b), b;
|
|
2018
2023
|
},
|
|
2019
2024
|
[p]
|
|
2020
|
-
),
|
|
2025
|
+
), S = h(
|
|
2021
2026
|
async (s) => {
|
|
2022
2027
|
const b = await p(
|
|
2023
2028
|
`/applications/${s}`,
|
|
@@ -2032,7 +2037,7 @@ function Je(c) {
|
|
|
2032
2037
|
await p(`/applications/${s}/cancel`, { method: "POST" }, "apply"), X(null);
|
|
2033
2038
|
},
|
|
2034
2039
|
[p]
|
|
2035
|
-
),
|
|
2040
|
+
), k = h(
|
|
2036
2041
|
async (s, b, $, ee) => {
|
|
2037
2042
|
const l = await p(
|
|
2038
2043
|
"/calculations",
|
|
@@ -2052,7 +2057,7 @@ function Je(c) {
|
|
|
2052
2057
|
"savedCalculations"
|
|
2053
2058
|
),
|
|
2054
2059
|
[p]
|
|
2055
|
-
),
|
|
2060
|
+
), L = h(
|
|
2056
2061
|
async (s) => {
|
|
2057
2062
|
await p(`/calculations/${s}`, { method: "DELETE" }, "savedCalculations"), K((b) => b.filter(($) => $.id !== s));
|
|
2058
2063
|
},
|
|
@@ -2088,9 +2093,9 @@ function Je(c) {
|
|
|
2088
2093
|
const s = await p("/active", { method: "GET" }, "offers");
|
|
2089
2094
|
return Y(s), s;
|
|
2090
2095
|
}, [p]), m = h(() => {
|
|
2091
|
-
|
|
2096
|
+
z(null);
|
|
2092
2097
|
}, []), T = h(() => {
|
|
2093
|
-
u([]), v(null), V(null), Q(null), X(null), Z(null), K([]), Y([]),
|
|
2098
|
+
u([]), v(null), V(null), Q(null), X(null), Z(null), K([]), Y([]), z(null), _({
|
|
2094
2099
|
offers: !1,
|
|
2095
2100
|
calculate: !1,
|
|
2096
2101
|
compare: !1,
|
|
@@ -2101,19 +2106,22 @@ function Je(c) {
|
|
|
2101
2106
|
savedCalculations: !1
|
|
2102
2107
|
});
|
|
2103
2108
|
}, []);
|
|
2104
|
-
return te(() =>
|
|
2105
|
-
|
|
2109
|
+
return te(() => {
|
|
2110
|
+
const s = U.current;
|
|
2111
|
+
return () => {
|
|
2112
|
+
s.forEach((b) => b.abort()), s.clear();
|
|
2113
|
+
};
|
|
2106
2114
|
}, []), {
|
|
2107
2115
|
// State
|
|
2108
2116
|
offers: i,
|
|
2109
2117
|
selectedOffer: g,
|
|
2110
2118
|
latestCalculation: w,
|
|
2111
2119
|
latestComparison: O,
|
|
2112
|
-
applicationState:
|
|
2120
|
+
applicationState: D,
|
|
2113
2121
|
creditAnalysis: q,
|
|
2114
|
-
savedCalculations:
|
|
2122
|
+
savedCalculations: N,
|
|
2115
2123
|
activeLoans: x,
|
|
2116
|
-
loading:
|
|
2124
|
+
loading: j,
|
|
2117
2125
|
error: ae,
|
|
2118
2126
|
// Offer operations
|
|
2119
2127
|
fetchOffers: le,
|
|
@@ -2125,13 +2133,13 @@ function Je(c) {
|
|
|
2125
2133
|
// Credit analysis
|
|
2126
2134
|
runCreditAnalysis: y,
|
|
2127
2135
|
// Application operations
|
|
2128
|
-
submitApplication:
|
|
2129
|
-
getApplicationStatus:
|
|
2136
|
+
submitApplication: P,
|
|
2137
|
+
getApplicationStatus: S,
|
|
2130
2138
|
cancelApplication: C,
|
|
2131
2139
|
// Saved calculations
|
|
2132
|
-
saveCalculation:
|
|
2140
|
+
saveCalculation: k,
|
|
2133
2141
|
loadCalculation: I,
|
|
2134
|
-
deleteSavedCalculation:
|
|
2142
|
+
deleteSavedCalculation: L,
|
|
2135
2143
|
fetchSavedCalculations: H,
|
|
2136
2144
|
// Refinancing & Consolidation
|
|
2137
2145
|
analyzeRefinancing: se,
|