jaguar-form 1.0.4 → 1.0.6
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/README.md +38 -2
- package/dist/Cascader-ZIkXvvC3.js +226 -0
- package/dist/Select-BIBk_TT6.js +415 -0
- package/dist/TreeSelect-BQCyCCqa.js +350 -0
- package/dist/{compound-D4_6P0d_.js → compound-BX_PoTK5.js} +100 -88
- package/dist/compound.js +1 -1
- package/dist/core.js +1 -1
- package/dist/date-time.js +1 -1
- package/dist/demo-plant.svg +1 -0
- package/dist/form-CSfUExUT.js +599 -0
- package/dist/form.js +3 -3
- package/dist/{icons-BI3fdIey.js → icons-BwE05e0C.js} +1 -1
- package/dist/{image-upload-VtUlQgzJ.js → image-upload-D9oPG0Eh.js} +252 -179
- package/dist/image-upload.js +1 -1
- package/dist/index.js +15 -14
- package/dist/input.js +1 -1
- package/dist/inputs-Dx3xOy9q.js +718 -0
- package/dist/{useSelection-C0OEFZUE.js → lazy-tree-NCX3ntYm.js} +96 -4
- package/dist/locale/load.js +7 -3
- package/dist/pickers-Bci1y8cc.js +634 -0
- package/dist/select.js +3 -1
- package/dist/selection-DCIzhR5q.js +197 -0
- package/dist/{slider-CNwkLMmo.js → slider-AM0Egz9P.js} +1 -1
- package/dist/slider.js +1 -1
- package/dist/store-CFSQW-Fv.js +622 -0
- package/dist/style.css +1 -1
- package/dist/tree-select.js +1 -1
- package/dist/types/components/compound/ControlGroup.d.ts +5 -2
- package/dist/types/components/compound/index.d.ts +10 -1
- package/dist/types/components/extended-inputs.d.ts +34 -0
- package/dist/types/components/image-upload/ManagedImageUpload.d.ts +11 -4
- package/dist/types/components/image-upload/index.d.ts +3 -2
- package/dist/types/components/image-upload/upload.d.ts +1 -1
- package/dist/types/components/image-upload/usePreparation.d.ts +7 -0
- package/dist/types/components/image-upload/validation.d.ts +16 -0
- package/dist/types/components/inputs.d.ts +42 -4
- package/dist/types/components/select/Cascader.d.ts +13 -0
- package/dist/types/components/select/types.d.ts +10 -1
- package/dist/types/components/select/useRemoteOptions.d.ts +18 -0
- package/dist/types/components/select.d.ts +3 -0
- package/dist/types/config/index.d.ts +3 -0
- package/dist/types/entries/input.d.ts +5 -2
- package/dist/types/entries/select.d.ts +3 -0
- package/dist/types/form/adapter.d.ts +1 -0
- package/dist/types/form/index.d.ts +85 -10
- package/dist/types/form/store.d.ts +21 -1
- package/dist/types/locale/load.d.ts +2 -1
- package/dist/types/primitives/Control.d.ts +3 -1
- package/dist/types/primitives/Popup.d.ts +1 -0
- package/dist/types/types.d.ts +1 -0
- package/dist/types/utils/cascader.d.ts +12 -0
- package/dist/types/utils/decimal.d.ts +22 -0
- package/dist/types/utils/remote-options.d.ts +24 -0
- package/dist/useControllable-QDX_UWRh.js +102 -0
- package/package.json +1 -1
- package/dist/Control-B36bu6zQ.js +0 -47
- package/dist/Select-BG2H-YnK.js +0 -252
- package/dist/TreeSelect-CkPtMg-g.js +0 -440
- package/dist/form-DTI0Sqsy.js +0 -413
- package/dist/inputs-BOP8Ryne.js +0 -403
- package/dist/pickers-C9QTR2XN.js +0 -631
- package/dist/selection-CIEa1uce.js +0 -146
- package/dist/store-DOn9K-EA.js +0 -491
- package/dist/useControllable-Zax42z2F.js +0 -87
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { o as e, t } from "./useControllable-
|
|
2
|
-
import {
|
|
3
|
-
import { t as r } from "./selection-CIEa1uce.js";
|
|
1
|
+
import { o as e, t } from "./useControllable-QDX_UWRh.js";
|
|
2
|
+
import { o as n, t as r } from "./selection-DCIzhR5q.js";
|
|
4
3
|
import { useCallback as i, useLayoutEffect as a, useMemo as o, useRef as s, useState as c } from "react";
|
|
5
4
|
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
6
5
|
// src/primitives/selection.tsx
|
|
@@ -355,4 +354,97 @@ function S(e) {
|
|
|
355
354
|
triggerReadOnly: d || e.readOnly || !!(f && e.needConfirm)
|
|
356
355
|
};
|
|
357
356
|
}
|
|
358
|
-
|
|
357
|
+
// src/utils/lazy-tree.ts
|
|
358
|
+
var C = (e) => e.hasChildren === !0 && e.children === void 0, w = (e) => !!(e.children?.length || C(e));
|
|
359
|
+
function T(e, t, n) {
|
|
360
|
+
let r = _(e), i = r.map.get(t);
|
|
361
|
+
if (!i || !C(i)) return e;
|
|
362
|
+
let a = {
|
|
363
|
+
...i,
|
|
364
|
+
children: n,
|
|
365
|
+
hasChildren: n.length > 0
|
|
366
|
+
}, o = t;
|
|
367
|
+
for (; r.parent.has(o);) {
|
|
368
|
+
let e = r.parent.get(o), t = r.map.get(e);
|
|
369
|
+
a = {
|
|
370
|
+
...t,
|
|
371
|
+
children: t.children.map((e) => Object.is(e.value, o) ? a : e)
|
|
372
|
+
}, o = e;
|
|
373
|
+
}
|
|
374
|
+
let s = e.map((e) => Object.is(e.value, o) ? a : e);
|
|
375
|
+
return _(s), s;
|
|
376
|
+
}
|
|
377
|
+
function E(e, t) {
|
|
378
|
+
let n = e, r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = () => t(n, new Map(i)), o = () => {
|
|
379
|
+
for (let e of r.values()) e.abort();
|
|
380
|
+
r.clear(), i.clear();
|
|
381
|
+
};
|
|
382
|
+
return {
|
|
383
|
+
reset(e) {
|
|
384
|
+
o(), n = e, a();
|
|
385
|
+
},
|
|
386
|
+
dispose: o,
|
|
387
|
+
async load(e, t) {
|
|
388
|
+
if (r.has(e)) return !1;
|
|
389
|
+
let o = _(n).map.get(e);
|
|
390
|
+
if (!o || !C(o)) return !1;
|
|
391
|
+
let s = new AbortController();
|
|
392
|
+
r.set(e, s), i.set(e, "loading"), a();
|
|
393
|
+
let c = () => r.get(e) === s && !s.signal.aborted;
|
|
394
|
+
try {
|
|
395
|
+
let l = await t(o, { signal: s.signal });
|
|
396
|
+
if (!c()) return !1;
|
|
397
|
+
if (!Array.isArray(l)) throw TypeError("loadChildren must return an array");
|
|
398
|
+
return n = T(n, e, l), r.delete(e), i.delete(e), a(), !0;
|
|
399
|
+
} catch {
|
|
400
|
+
return c() && (r.delete(e), i.set(e, "error"), a()), !1;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
function D(e, t, n, r) {
|
|
406
|
+
let i = n.trim().toLocaleLowerCase(), a = [], o = e.map((t, n) => ({
|
|
407
|
+
node: t,
|
|
408
|
+
depth: 0,
|
|
409
|
+
blocked: !1,
|
|
410
|
+
position: n + 1,
|
|
411
|
+
setSize: e.length,
|
|
412
|
+
parent: void 0,
|
|
413
|
+
matched: !1
|
|
414
|
+
})).reverse();
|
|
415
|
+
for (; o.length;) {
|
|
416
|
+
let e = o.pop(), n = e.matched || !!(i && r(e.node).toLocaleLowerCase().includes(i));
|
|
417
|
+
a.push({
|
|
418
|
+
...e,
|
|
419
|
+
matched: n
|
|
420
|
+
});
|
|
421
|
+
let s = e.node.children;
|
|
422
|
+
if (s && (i || t.has(e.node.value))) for (let t = s.length - 1; t >= 0; t--) o.push({
|
|
423
|
+
node: s[t],
|
|
424
|
+
depth: e.depth + 1,
|
|
425
|
+
blocked: e.blocked || !!e.node.disabled,
|
|
426
|
+
position: t + 1,
|
|
427
|
+
setSize: s.length,
|
|
428
|
+
parent: e.node.value,
|
|
429
|
+
matched: n
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
if (!i) return a;
|
|
433
|
+
let s = /* @__PURE__ */ new Set();
|
|
434
|
+
for (let e = a.length - 1; e >= 0; e--) {
|
|
435
|
+
let t = a[e];
|
|
436
|
+
(t.matched || s.has(t.node.value)) && (s.add(t.node.value), t.parent !== void 0 && s.add(t.parent));
|
|
437
|
+
}
|
|
438
|
+
let c = a.filter((e) => s.has(e.node.value)), l = /* @__PURE__ */ new Map();
|
|
439
|
+
for (let e of c) l.set(e.parent, (l.get(e.parent) ?? 0) + 1);
|
|
440
|
+
let u = /* @__PURE__ */ new Map();
|
|
441
|
+
return c.map((e) => {
|
|
442
|
+
let t = (u.get(e.parent) ?? 0) + 1;
|
|
443
|
+
return u.set(e.parent, t), {
|
|
444
|
+
...e,
|
|
445
|
+
position: t,
|
|
446
|
+
setSize: l.get(e.parent)
|
|
447
|
+
};
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
export { S as a, b as c, p as d, f, D as i, _ as l, w as n, y as o, g as p, C as r, x as s, E as t, v as u };
|
package/dist/locale/load.js
CHANGED
|
@@ -15,7 +15,11 @@ var e = {
|
|
|
15
15
|
"ru-RU": () => import("./ru-RU.js"),
|
|
16
16
|
"ar-SA": () => import("./ar-SA.js")
|
|
17
17
|
};
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
function t(t) {
|
|
19
|
+
let n = t.replace(/_/g, "-").toLowerCase();
|
|
20
|
+
return /^zh-(tw|hk|mo|hant)(-|$)/.test(n) ? "zh-TW" : Object.keys(e).find((e) => e.toLowerCase() === n) ?? Object.keys(e).find((e) => e.split("-")[0] === n.split("-")[0]) ?? "en-US";
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
+
async function n(n) {
|
|
23
|
+
return (await e[t(n)]()).default;
|
|
24
|
+
}
|
|
25
|
+
export { n as loadLocale, t as normalizeLocaleCode };
|