jaguar-form 1.0.7 → 1.0.8
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 +4 -0
- package/dist/{Cascader-iWlk7VJR.js → Cascader-COGUcdDS.js} +4 -4
- package/dist/{Select-CoEW4UIq.js → Select-BxwT7MHH.js} +81 -77
- package/dist/{TreeSelect-BWksr9iW.js → TreeSelect-W5sgU5nW.js} +4 -4
- package/dist/{compound-BW6G7E_-.js → compound-nXxRSVJu.js} +27 -27
- package/dist/compound.js +1 -1
- package/dist/core.js +1 -1
- package/dist/date-time.js +1 -1
- package/dist/{form-B-BSf2n1.js → form-D6O5PqrZ.js} +62 -49
- package/dist/form.js +3 -3
- package/dist/{icons-BwE05e0C.js → icons-B1dOXz-r.js} +1 -1
- package/dist/{image-upload-D9oPG0Eh.js → image-upload-BFVs81x3.js} +46 -42
- package/dist/image-upload.js +1 -1
- package/dist/index.js +15 -15
- package/dist/input.js +1 -1
- package/dist/inputs-w_es2t_C.js +862 -0
- package/dist/{lazy-tree-C9l9lzQw.js → lazy-tree-DNvNf_Yv.js} +20 -17
- package/dist/{pickers-Bci1y8cc.js → pickers-5zLmSrsp.js} +3 -3
- package/dist/select.js +2 -2
- package/dist/selection-CA_66JX9.js +223 -0
- package/dist/{slider-AM0Egz9P.js → slider-Bhd1Z4LP.js} +35 -35
- package/dist/slider.js +1 -1
- package/dist/{store-CFSQW-Fv.js → store-C9eBd8Y7.js} +205 -194
- package/dist/style.css +1 -1
- package/dist/tree-select.js +1 -1
- package/dist/types/components/extended-inputs.d.ts +4 -1
- package/dist/types/components/image-upload/index.d.ts +1 -1
- package/dist/types/components/inputs.d.ts +28 -8
- package/dist/types/config/index.d.ts +32 -1
- package/dist/types/entries/input.d.ts +2 -2
- package/dist/types/form/index.d.ts +3 -0
- package/dist/types/form/store.d.ts +1 -0
- package/dist/types/primitives/Control.d.ts +7 -2
- package/dist/{useControllable-QDX_UWRh.js → useControllable-Dt38Jg9E.js} +54 -21
- package/package.json +1 -1
- package/dist/inputs-DpZdLaoP.js +0 -718
- package/dist/selection-DCIzhR5q.js +0 -197
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { d as e, l as t, s as n, t as r, u as i } from "./compound-
|
|
2
|
-
import { a,
|
|
1
|
+
import { d as e, l as t, s as n, t as r, u as i } from "./compound-nXxRSVJu.js";
|
|
2
|
+
import { c as a, s as o } from "./useControllable-Dt38Jg9E.js";
|
|
3
3
|
import { r as s } from "./locale-yHkdw2xz.js";
|
|
4
|
-
import { n as c, t as l } from "./slider-
|
|
5
|
-
import { i as u, t as d } from "./image-upload-
|
|
4
|
+
import { n as c, t as l } from "./slider-Bhd1Z4LP.js";
|
|
5
|
+
import { i as u, t as d } from "./image-upload-BFVs81x3.js";
|
|
6
6
|
import { cloneElement as f, createContext as p, isValidElement as m, useCallback as h, useContext as g, useEffect as _, useId as v, useMemo as y, useRef as b, useState as x, useSyncExternalStore as S } from "react";
|
|
7
|
-
import { d as C, n as w, t as T } from "./store-
|
|
8
|
-
import { c as E, d as D, f as O, g as k, h as A, l as j, m as M, n as N, o as P, p as F, r as I, s as L, t as R, u as z } from "./inputs-
|
|
9
|
-
import { n as B, t as V } from "./Select-
|
|
10
|
-
import { t as H } from "./TreeSelect-
|
|
7
|
+
import { d as C, n as w, t as T } from "./store-C9eBd8Y7.js";
|
|
8
|
+
import { c as E, d as D, f as O, g as k, h as A, l as j, m as M, n as N, o as P, p as F, r as I, s as L, t as R, u as z } from "./inputs-w_es2t_C.js";
|
|
9
|
+
import { n as B, t as V } from "./Select-BxwT7MHH.js";
|
|
10
|
+
import { t as H } from "./TreeSelect-W5sgU5nW.js";
|
|
11
11
|
import { n as U } from "./validation-D6vk5NAv.js";
|
|
12
|
-
import { t as ee } from "./Cascader-
|
|
13
|
-
import { a as W, c as G, i as K, l as te, n as ne, o as re, r as ie, s as ae, t as oe, u as se } from "./pickers-
|
|
12
|
+
import { t as ee } from "./Cascader-COGUcdDS.js";
|
|
13
|
+
import { a as W, c as G, i as K, l as te, n as ne, o as re, r as ie, s as ae, t as oe, u as se } from "./pickers-5zLmSrsp.js";
|
|
14
14
|
import { jsx as q, jsxs as J } from "react/jsx-runtime";
|
|
15
15
|
// src/form/index.tsx
|
|
16
16
|
var ce = p(null);
|
|
@@ -19,7 +19,7 @@ function le(e = {}) {
|
|
|
19
19
|
t.current = e.onSubmit;
|
|
20
20
|
let [n] = x(() => {
|
|
21
21
|
let n = e.fields ?? [], r = {
|
|
22
|
-
...Object.fromEntries(n.map((e) => [e.name,
|
|
22
|
+
...Object.fromEntries(n.map((e) => [e.name, xe(e)])),
|
|
23
23
|
...typeof e.defaultValues == "function" ? {} : e.defaultValues
|
|
24
24
|
}, i = Object.fromEntries(n.filter((e) => e.transform).map((e) => [e.name, e.transform]));
|
|
25
25
|
return T(r, {
|
|
@@ -147,12 +147,22 @@ function fe(e) {
|
|
|
147
147
|
replace: (n) => t.setValue(e, n)
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
|
+
function Z(e, t, n = w) {
|
|
151
|
+
let r = b(null), i = h(() => {
|
|
152
|
+
let i = t(e.getFormSummary());
|
|
153
|
+
return r.current?.store === e && n(r.current.value, i) ? r.current.value : (r.current = {
|
|
154
|
+
store: e,
|
|
155
|
+
value: i
|
|
156
|
+
}, i);
|
|
157
|
+
}, [
|
|
158
|
+
e,
|
|
159
|
+
t,
|
|
160
|
+
n
|
|
161
|
+
]);
|
|
162
|
+
return S(e.subscribeAll, i, i);
|
|
163
|
+
}
|
|
150
164
|
function pe(e = (e) => e) {
|
|
151
|
-
|
|
152
|
-
let r = e(t.getFormSummary());
|
|
153
|
-
return n.current && w(n.current.value, r) ? n.current.value : (n.current = { value: r }, r);
|
|
154
|
-
}, [t, e]);
|
|
155
|
-
return S(t.subscribeAll, r, r);
|
|
165
|
+
return Z(Y(), e);
|
|
156
166
|
}
|
|
157
167
|
function me(e) {
|
|
158
168
|
return S(e.subscribeAll, e.getFormSummary, e.getFormSummary);
|
|
@@ -164,9 +174,9 @@ function he() {
|
|
|
164
174
|
changedValues: e.getChangedValues()
|
|
165
175
|
};
|
|
166
176
|
}
|
|
167
|
-
var
|
|
177
|
+
var Q = (e, t = 1) => Number.isFinite(e) ? Math.max(1, Math.min(24, Math.floor(e))) : t;
|
|
168
178
|
function ge(e, t, n = !1) {
|
|
169
|
-
let r = typeof t == "number" ? n ? 1 :
|
|
179
|
+
let r = typeof t == "number" ? n ? 1 : Q(t) : Q(t.xs), i = typeof t == "number" ? Q(t) : Q(t.sm, r), a = typeof t == "number" ? i : Q(t.md, i), o = typeof t == "number" ? a : Q(t.lg, a);
|
|
170
180
|
return {
|
|
171
181
|
[`--rfe-${e}-xs`]: r,
|
|
172
182
|
[`--rfe-${e}-sm`]: i,
|
|
@@ -207,13 +217,13 @@ var _e = (e) => e, ve = {
|
|
|
207
217
|
slider: c,
|
|
208
218
|
rangeSlider: l
|
|
209
219
|
};
|
|
210
|
-
function
|
|
220
|
+
function $({ label: e, description: t, error: n, required: r, id: i, children: a, span: o = 1, placement: s, name: c }) {
|
|
211
221
|
return /* @__PURE__ */ J("div", {
|
|
212
222
|
className: "rfe-field",
|
|
213
223
|
"data-field-name": c,
|
|
214
224
|
"data-label-placement": s,
|
|
215
225
|
style: {
|
|
216
|
-
gridColumn: `span ${
|
|
226
|
+
gridColumn: `span ${Q(typeof o == "number" ? o : o.xs)}`,
|
|
217
227
|
...ge("span", o)
|
|
218
228
|
},
|
|
219
229
|
children: [e && /* @__PURE__ */ J("label", {
|
|
@@ -239,15 +249,15 @@ function Q({ label: e, description: t, error: n, required: r, id: i, children: a
|
|
|
239
249
|
})]
|
|
240
250
|
});
|
|
241
251
|
}
|
|
242
|
-
var ye = (e, t) => typeof e.visible == "function" ? e.visible(t) : e.visible !== !1,
|
|
243
|
-
function
|
|
252
|
+
var ye = (e, t) => typeof e.visible == "function" ? e.visible(t) : e.visible !== !1, be = (e) => e.type === "compound" && Array.isArray(e.componentProps?.fields) ? e.componentProps.fields : void 0, xe = (e) => e.defaultValue === void 0 ? be(e) ? n(be(e)) : void 0 : e.defaultValue;
|
|
253
|
+
function Se(e) {
|
|
244
254
|
return [
|
|
245
255
|
...e.required && !e.rules?.some((e) => e.required) ? [{ required: !0 }] : [],
|
|
246
256
|
...e.rules ?? [],
|
|
247
257
|
...e.type === "imageUpload" && e.componentProps?.mode === "upload" ? [u] : []
|
|
248
258
|
];
|
|
249
259
|
}
|
|
250
|
-
function
|
|
260
|
+
function Ce(n, r, a, o) {
|
|
251
261
|
let s = JSON.stringify(a?.map((e) => e.name) ?? []), c = b(a);
|
|
252
262
|
c.current = a;
|
|
253
263
|
let l = y(() => c.current?.map((a) => ({
|
|
@@ -297,13 +307,13 @@ function Se(n, r, a, o) {
|
|
|
297
307
|
}
|
|
298
308
|
};
|
|
299
309
|
}
|
|
300
|
-
function
|
|
301
|
-
let i = Y(), o = X(e.name), c = a(), l = v(), u = e.dependsOn, d = g(
|
|
302
|
-
rules:
|
|
310
|
+
function we({ field: e, components: t, fields: n, validateOn: r }) {
|
|
311
|
+
let i = Y(), o = X(e.name), c = a(), l = v(), u = e.dependsOn, d = g(De), f = e.labelPlacement ?? d, p = g(ke), m = y(() => ({
|
|
312
|
+
rules: Se(e),
|
|
303
313
|
debounce: e.debounce,
|
|
304
314
|
dependsOn: u,
|
|
305
315
|
validateOn: e.validateOn ?? r,
|
|
306
|
-
defaultValue:
|
|
316
|
+
defaultValue: xe(e),
|
|
307
317
|
visible: (t) => ye(e, t)
|
|
308
318
|
}), [
|
|
309
319
|
e,
|
|
@@ -315,7 +325,7 @@ function Ce({ field: e, components: t, fields: n, validateOn: r }) {
|
|
|
315
325
|
e.name,
|
|
316
326
|
m
|
|
317
327
|
]);
|
|
318
|
-
let b =
|
|
328
|
+
let b = Ce(i, e.name, be(e), e.validateOn ?? r), x = o.error ? o : b?.error ?? o, C = h((t) => {
|
|
319
329
|
if (!u) return typeof e.visible == "function" || typeof e.disabled == "function" ? i.subscribeAll(t) : () => {};
|
|
320
330
|
let n = u.map((e) => i.subscribe(e, t));
|
|
321
331
|
return () => n.forEach((e) => e());
|
|
@@ -326,9 +336,9 @@ function Ce({ field: e, components: t, fields: n, validateOn: r }) {
|
|
|
326
336
|
e.disabled
|
|
327
337
|
]);
|
|
328
338
|
S(C, i.getVersion, i.getVersion);
|
|
329
|
-
let w = typeof e.visible == "function" || typeof e.disabled == "function" ? i.getValues() :
|
|
339
|
+
let w = typeof e.visible == "function" || typeof e.disabled == "function" ? i.getValues() : je;
|
|
330
340
|
if (!ye(e, w)) return null;
|
|
331
|
-
let T = t[e.type] ?? ve[e.type], E = f === "floating" && typeof e.label == "string" &&
|
|
341
|
+
let T = t[e.type] ?? ve[e.type], E = f === "floating" && typeof e.label == "string" && Te.has(e.type) && !e.render && !t[e.type], D = {
|
|
332
342
|
...e.componentProps,
|
|
333
343
|
...b ? {
|
|
334
344
|
partStates: b.states,
|
|
@@ -358,7 +368,7 @@ function Ce({ field: e, components: t, fields: n, validateOn: r }) {
|
|
|
358
368
|
readOnly: p.readOnly || e.componentProps?.readOnly,
|
|
359
369
|
"aria-describedby": x.error || e.description ? `${l}-help` : void 0
|
|
360
370
|
};
|
|
361
|
-
return /* @__PURE__ */ J(
|
|
371
|
+
return /* @__PURE__ */ J($, {
|
|
362
372
|
name: e.name,
|
|
363
373
|
placement: f,
|
|
364
374
|
label: E || f === "none" ? void 0 : e.label,
|
|
@@ -377,7 +387,7 @@ function Ce({ field: e, components: t, fields: n, validateOn: r }) {
|
|
|
377
387
|
})]
|
|
378
388
|
});
|
|
379
389
|
}
|
|
380
|
-
var
|
|
390
|
+
var Te = /* @__PURE__ */ new Set([
|
|
381
391
|
"input",
|
|
382
392
|
"password",
|
|
383
393
|
"search",
|
|
@@ -398,12 +408,12 @@ var we = /* @__PURE__ */ new Set([
|
|
|
398
408
|
"yearRange",
|
|
399
409
|
"compound",
|
|
400
410
|
"cascader"
|
|
401
|
-
]),
|
|
411
|
+
]), Ee = new Set([...Te].map((e) => ve[e])), De = p(void 0), Oe = p("blur"), ke = p({
|
|
402
412
|
disabled: !1,
|
|
403
413
|
readOnly: !1,
|
|
404
414
|
loading: !1
|
|
405
|
-
}),
|
|
406
|
-
function
|
|
415
|
+
}), Ae = [], je = {}, Me = {};
|
|
416
|
+
function Ne({ nested: e, initialValues: t, adapter: n, submitHiddenFields: r = !1, validateOn: i = "blur", form: s, fields: c = Ae, defaultValues: l = je, defaultValuesKey: u, components: d = Me, children: f, columns: p = 1, responsive: m = !1, gap: h, labelPlacement: g, disabled: v = !1, readOnly: S = !1, loading: C = !1, layout: w = "vertical", onSubmit: T, onError: E, submitText: D, resetText: O, showActions: k = !0 }) {
|
|
407
417
|
let A = a(), j = o(), M = le(s ? {} : {
|
|
408
418
|
fields: c,
|
|
409
419
|
defaultValues: l,
|
|
@@ -411,7 +421,10 @@ function Me({ nested: e, initialValues: t, adapter: n, submitHiddenFields: r = !
|
|
|
411
421
|
initialValues: t,
|
|
412
422
|
adapter: n,
|
|
413
423
|
nested: e
|
|
414
|
-
}), N = s ?? M, P =
|
|
424
|
+
}), N = s ?? M, P = Z(N, (e) => ({
|
|
425
|
+
isSubmitting: e.isSubmitting,
|
|
426
|
+
isLoading: e.isLoading
|
|
427
|
+
})), F = P.isSubmitting;
|
|
415
428
|
C ||= P.isLoading;
|
|
416
429
|
let [I, L] = x(""), z = b(null);
|
|
417
430
|
_(() => N.bindFieldLocator((e, t) => {
|
|
@@ -448,11 +461,11 @@ function Me({ nested: e, initialValues: t, adapter: n, submitHiddenFields: r = !
|
|
|
448
461
|
]), H = m || typeof p != "number", U = ge("grid", p, m);
|
|
449
462
|
return /* @__PURE__ */ q(ue, {
|
|
450
463
|
form: N,
|
|
451
|
-
children: /* @__PURE__ */ q(
|
|
464
|
+
children: /* @__PURE__ */ q(De.Provider, {
|
|
452
465
|
value: g ?? j.form?.labelPlacement,
|
|
453
|
-
children: /* @__PURE__ */ q(
|
|
466
|
+
children: /* @__PURE__ */ q(Oe.Provider, {
|
|
454
467
|
value: i,
|
|
455
|
-
children: /* @__PURE__ */ q(
|
|
468
|
+
children: /* @__PURE__ */ q(ke.Provider, {
|
|
456
469
|
value: V,
|
|
457
470
|
children: /* @__PURE__ */ J("form", {
|
|
458
471
|
ref: z,
|
|
@@ -479,8 +492,8 @@ function Me({ nested: e, initialValues: t, adapter: n, submitHiddenFields: r = !
|
|
|
479
492
|
children: [
|
|
480
493
|
/* @__PURE__ */ J("div", {
|
|
481
494
|
className: "rfe-form-grid",
|
|
482
|
-
style: H ? void 0 : { gridTemplateColumns: `repeat(${
|
|
483
|
-
children: [c.map((e) => /* @__PURE__ */ q(
|
|
495
|
+
style: H ? void 0 : { gridTemplateColumns: `repeat(${Q(typeof p == "number" ? p : 1)},minmax(0,1fr))` },
|
|
496
|
+
children: [c.map((e) => /* @__PURE__ */ q(we, {
|
|
484
497
|
field: e,
|
|
485
498
|
components: d,
|
|
486
499
|
fields: c,
|
|
@@ -515,8 +528,8 @@ function Me({ nested: e, initialValues: t, adapter: n, submitHiddenFields: r = !
|
|
|
515
528
|
})
|
|
516
529
|
});
|
|
517
530
|
}
|
|
518
|
-
function
|
|
519
|
-
let k = Y(), A = g(
|
|
531
|
+
function Pe({ children: e, name: t, label: i, description: o, required: c, rules: l, defaultValue: p, dependsOn: b, debounce: x, validateOn: C, span: w, labelPlacement: T, disabled: E, visible: D, componentProps: O }) {
|
|
532
|
+
let k = Y(), A = g(Oe), j = g(De), M = T ?? j, N = g(ke), P = C ?? A, F = X(t), I = a(), L = v(), R = m(e) && e.type === r ? e.props.fields : void 0, z = JSON.stringify(R?.map((e) => e.name) ?? []), B = m(e) && e.type === d && e.props.mode === "upload", V = y(() => ({
|
|
520
533
|
rules: [
|
|
521
534
|
...c && !l?.some((e) => e.required) ? [{ required: !0 }] : [],
|
|
522
535
|
...l ?? [],
|
|
@@ -543,15 +556,15 @@ function Ne({ children: e, name: t, label: i, description: o, required: c, rules
|
|
|
543
556
|
t,
|
|
544
557
|
V
|
|
545
558
|
]);
|
|
546
|
-
let H =
|
|
559
|
+
let H = Ce(k, t, R, P), U = F.error ? F : H?.error ?? F, ee = h((e) => typeof D == "function" || typeof E == "function" ? k.subscribeAll(e) : () => {}, [
|
|
547
560
|
k,
|
|
548
561
|
D,
|
|
549
562
|
E
|
|
550
563
|
]);
|
|
551
564
|
S(ee, k.getVersion, k.getVersion);
|
|
552
|
-
let W = typeof D == "function" || typeof E == "function" ? k.getValues() :
|
|
565
|
+
let W = typeof D == "function" || typeof E == "function" ? k.getValues() : je;
|
|
553
566
|
if (!V.visible(W)) return null;
|
|
554
|
-
let G = M === "floating" && typeof i == "string" && m(e) &&
|
|
567
|
+
let G = M === "floating" && typeof i == "string" && m(e) && Ee.has(e.type), K = {
|
|
555
568
|
...O,
|
|
556
569
|
...H ? {
|
|
557
570
|
partStates: H.states,
|
|
@@ -575,7 +588,7 @@ function Ne({ children: e, name: t, label: i, description: o, required: c, rules
|
|
|
575
588
|
"aria-invalid": !!U.error,
|
|
576
589
|
"aria-describedby": U.error || o ? `${L}-help` : void 0
|
|
577
590
|
};
|
|
578
|
-
return /* @__PURE__ */ J(
|
|
591
|
+
return /* @__PURE__ */ J($, {
|
|
579
592
|
name: t,
|
|
580
593
|
placement: M,
|
|
581
594
|
id: L,
|
|
@@ -595,5 +608,5 @@ function Ne({ children: e, name: t, label: i, description: o, required: c, rules
|
|
|
595
608
|
})]
|
|
596
609
|
});
|
|
597
610
|
}
|
|
598
|
-
var
|
|
599
|
-
export { _e as a, le as c,
|
|
611
|
+
var Fe = Object.assign(Ne, { Field: Pe }), Ie = (e) => e;
|
|
612
|
+
export { _e as a, le as c, he as d, me as f, Ie as i, Y as l, de as m, $ as n, X as o, pe as p, ue as r, fe as s, Fe as t, Z as u };
|
package/dist/form.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { n as e, r as t, t as n } from "./validation-D6vk5NAv.js";
|
|
2
|
-
import { _ as r, a as i, c as a, d as o, f as s, g as c, h as l, i as u, l as d, m as f, n as p, o as m, p as h, r as g, s as _, t as v, u as y, v as b, y as x } from "./store-
|
|
3
|
-
import { a as S, c as C, d as w, f as T, i as E, l as D,
|
|
4
|
-
export {
|
|
2
|
+
import { _ as r, a as i, c as a, d as o, f as s, g as c, h as l, i as u, l as d, m as f, n as p, o as m, p as h, r as g, s as _, t as v, u as y, v as b, y as x } from "./store-C9eBd8Y7.js";
|
|
3
|
+
import { a as S, c as C, d as w, f as T, i as E, l as D, m as O, n as k, o as A, p as j, r as M, s as N, t as P, u as F } from "./form-D6O5PqrZ.js";
|
|
4
|
+
export { P as Form, k as FormItem, M as FormProvider, m as changedOutputValues, _ as cloneValues, v as createFormStore, g as createPathAdapter, E as defineComponents, S as defineForm, a as defineValueAdapter, o as editArray, p as equalValue, u as expandPaths, s as fieldSegments, i as getPathValue, h as hasPath, d as inputValues, f as isArrayIndex, n as isEmpty, l as isPlainRecord, c as normalizePaths, r as omitPaths, y as outputValues, b as readPath, A as useField, N as useFieldArray, C as useForm, D as useFormContext, F as useFormSelector, w as useFormState, T as useFormStatus, j as useFormSummary, O as useWatch, e as validateRuleIssue, t as validateRules, x as writePath };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect as e, useId as t, useLayoutEffect as n, useRef as r, useState as i } from "react";
|
|
2
|
-
import { a,
|
|
3
|
-
import { t as l } from "./icons-
|
|
2
|
+
import { c as a, s as o, t as s, u as c } from "./useControllable-Dt38Jg9E.js";
|
|
3
|
+
import { t as l } from "./icons-B1dOXz-r.js";
|
|
4
4
|
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
5
5
|
// src/components/image-upload/validation.ts
|
|
6
6
|
var f = "image/jpeg,image/png,image/webp";
|
|
@@ -218,13 +218,13 @@ var T = [], E = 0;
|
|
|
218
218
|
function ee({ item: t, blocked: n, preview: o, onRemove: s, onRetry: c, onCancel: f, icons: p, sortActions: m, sortProps: h }) {
|
|
219
219
|
let { t: g } = a(), [_, v] = i(""), [y, b] = i(!1), x = r(null);
|
|
220
220
|
e(() => {
|
|
221
|
-
if (!t.file) {
|
|
221
|
+
if (!t.file || S(t.url)) {
|
|
222
222
|
v("");
|
|
223
223
|
return;
|
|
224
224
|
}
|
|
225
225
|
let e = URL.createObjectURL(t.file);
|
|
226
226
|
return v(e), () => URL.revokeObjectURL(e);
|
|
227
|
-
}, [t.file]);
|
|
227
|
+
}, [t.file, t.url]);
|
|
228
228
|
let C = S(t.url) ? t.url : _;
|
|
229
229
|
return e(() => b(!1), [C]), /* @__PURE__ */ d("div", {
|
|
230
230
|
className: "rfe-image-tile",
|
|
@@ -328,8 +328,8 @@ function ee({ item: t, blocked: n, preview: o, onRemove: s, onRetry: c, onCancel
|
|
|
328
328
|
]
|
|
329
329
|
});
|
|
330
330
|
}
|
|
331
|
-
function D(
|
|
332
|
-
let { t: f } = a(), p = o(), h = t(), v =
|
|
331
|
+
function D(s) {
|
|
332
|
+
let { t: f } = a(), p = o(), h = t(), v = s.id ?? h, [S, C] = i(s.defaultValue ?? T), D = s.value ?? S, O = r(D), k = r(() => {}), [A] = i(() => w((e, t) => {
|
|
333
333
|
O.current.some((t) => t.uid === e) && k.current(O.current.map((n) => n.uid === e ? {
|
|
334
334
|
...n,
|
|
335
335
|
...t
|
|
@@ -337,51 +337,51 @@ function D(c) {
|
|
|
337
337
|
})), [j, te] = i([]), [ne, M] = i(!1), N = r(null);
|
|
338
338
|
n(() => {
|
|
339
339
|
O.current = D, k.current = (e) => {
|
|
340
|
-
O.current = e,
|
|
340
|
+
O.current = e, s.value === void 0 && C(e), s.onChange?.(e);
|
|
341
341
|
}, A.retain(new Set(D.filter((e) => e.status === "uploading").map((e) => e.uid)));
|
|
342
342
|
}, [
|
|
343
343
|
D,
|
|
344
|
-
|
|
345
|
-
|
|
344
|
+
s.value,
|
|
345
|
+
s.onChange,
|
|
346
346
|
A
|
|
347
347
|
]), e(() => () => A.dispose(), [A]);
|
|
348
|
-
let P =
|
|
348
|
+
let P = s.multiple !== !1, F = _(P, s.maxCount), I = F <= 1, L = s.maxSize ?? 5, re = s.accept ?? "image/jpeg,image/png,image/webp", R = !!(s.disabled || s.readOnly || s.loading), z = x(s, R), B = JSON.stringify(D.map((e) => e.uid)), ie = r(B);
|
|
349
349
|
n(() => {
|
|
350
350
|
ie.current !== B && z.cancel(), ie.current = B;
|
|
351
351
|
}, [B]);
|
|
352
|
-
let V = R || z.busy, { full: H } = g(D.length, F, P,
|
|
352
|
+
let V = R || z.busy, { full: H } = g(D.length, F, P, s.replaceable), U = y(D, (e) => k.current(e), !!s.sortable && !V && P && D.length > 1), W = (e) => {
|
|
353
353
|
V || H || !e.length || z.prepare(e, (e) => {
|
|
354
354
|
let t = I ? [] : O.current, n = m([], e, {
|
|
355
355
|
maxCount: Math.max(0, F - t.length),
|
|
356
356
|
maxSize: L,
|
|
357
357
|
accept: re
|
|
358
358
|
});
|
|
359
|
-
if (te(n.rejected), n.rejected.length &&
|
|
359
|
+
if (te(n.rejected), n.rejected.length && s.onReject?.(n.rejected), !n.accepted.length) return;
|
|
360
360
|
if (I) {
|
|
361
361
|
A.dispose();
|
|
362
|
-
for (let e of O.current)
|
|
362
|
+
for (let e of O.current) s.onRemove?.(e);
|
|
363
363
|
}
|
|
364
364
|
let r = n.accepted.map((e) => ({
|
|
365
365
|
uid: `${v}-${++E}`,
|
|
366
366
|
name: e.name,
|
|
367
367
|
file: e,
|
|
368
|
-
status:
|
|
368
|
+
status: s.mode === "mixed" ? "local" : "uploading",
|
|
369
369
|
progress: 0
|
|
370
370
|
}));
|
|
371
|
-
if (k.current([...t, ...r]),
|
|
371
|
+
if (k.current([...t, ...r]), s.mode === "upload") for (let e of r) A.start(e, s.upload);
|
|
372
372
|
});
|
|
373
373
|
}, ae = (e) => {
|
|
374
374
|
if (V) return;
|
|
375
375
|
let t = O.current.find((t) => t.uid === e);
|
|
376
|
-
t &&
|
|
376
|
+
t && s.onRemove?.(t), A.abort(e), k.current(O.current.filter((t) => t.uid !== e)), te([]);
|
|
377
377
|
}, G = (e) => {
|
|
378
378
|
V || (A.abort(e), k.current(O.current.map((t) => t.uid === e ? {
|
|
379
379
|
...t,
|
|
380
380
|
status: "ready",
|
|
381
381
|
progress: 0
|
|
382
382
|
} : t)));
|
|
383
|
-
}, K = I && D.length ? f("replaceImage") : f("addImage"), q =
|
|
384
|
-
|
|
383
|
+
}, K = I && D.length ? f("replaceImage") : f("addImage"), q = s.status === "error" || s["aria-invalid"], J = [
|
|
384
|
+
s["aria-describedby"],
|
|
385
385
|
`${v}-hint`,
|
|
386
386
|
j.length ? `${v}-rejected` : void 0
|
|
387
387
|
].filter(Boolean).join(" "), oe = {
|
|
@@ -391,29 +391,29 @@ function D(c) {
|
|
|
391
391
|
};
|
|
392
392
|
return /* @__PURE__ */ d("div", {
|
|
393
393
|
role: "group",
|
|
394
|
-
id: H ||
|
|
395
|
-
tabIndex: H && !
|
|
396
|
-
className:
|
|
397
|
-
style:
|
|
398
|
-
"data-size":
|
|
399
|
-
"data-status": q ? "error" :
|
|
400
|
-
"data-disabled":
|
|
394
|
+
id: H || s.readOnly ? v : void 0,
|
|
395
|
+
tabIndex: H && !s.disabled ? 0 : void 0,
|
|
396
|
+
className: c("rfe-image-upload", s.className),
|
|
397
|
+
style: s.style,
|
|
398
|
+
"data-size": s.size ?? p.size,
|
|
399
|
+
"data-status": q ? "error" : s.status ?? "default",
|
|
400
|
+
"data-disabled": s.disabled || void 0,
|
|
401
401
|
"data-dragging": ne || void 0,
|
|
402
|
-
"aria-label":
|
|
402
|
+
"aria-label": s["aria-label"] ?? K,
|
|
403
403
|
"aria-describedby": J,
|
|
404
404
|
"aria-invalid": q || void 0,
|
|
405
405
|
"aria-busy": z.busy || D.some((e) => e.status === "uploading") || void 0,
|
|
406
406
|
onBlur: (e) => {
|
|
407
|
-
e.currentTarget.contains(e.relatedTarget) ||
|
|
407
|
+
e.currentTarget.contains(e.relatedTarget) || s.onBlur?.();
|
|
408
408
|
},
|
|
409
409
|
onDragOver: (e) => {
|
|
410
|
-
|
|
410
|
+
s.dragDrop !== !1 && e.dataTransfer.types.includes("Files") && (e.preventDefault(), e.dataTransfer.dropEffect = V || H ? "none" : "copy", !V && !H && M(!0));
|
|
411
411
|
},
|
|
412
412
|
onDragLeave: (e) => {
|
|
413
413
|
e.relatedTarget instanceof Node && e.currentTarget.contains(e.relatedTarget) || M(!1);
|
|
414
414
|
},
|
|
415
415
|
onDrop: (e) => {
|
|
416
|
-
|
|
416
|
+
s.dragDrop !== !1 && e.dataTransfer.types.includes("Files") && (e.preventDefault(), M(!1), W(Array.from(e.dataTransfer.files)));
|
|
417
417
|
},
|
|
418
418
|
children: [
|
|
419
419
|
/* @__PURE__ */ d("div", {
|
|
@@ -431,20 +431,20 @@ function D(c) {
|
|
|
431
431
|
onDragEnd: U.reset
|
|
432
432
|
}) : void 0,
|
|
433
433
|
blocked: V,
|
|
434
|
-
preview: (
|
|
435
|
-
icons:
|
|
434
|
+
preview: (s.previewable ?? s.preview ?? !0) && !s.disabled,
|
|
435
|
+
icons: s.icons,
|
|
436
436
|
onRemove: () => ae(e.uid),
|
|
437
437
|
onCancel: () => G(e.uid),
|
|
438
438
|
onRetry: () => {
|
|
439
|
-
|
|
439
|
+
s.mode === "upload" && !V && !A.has(e.uid) && A.start(e, s.upload);
|
|
440
440
|
}
|
|
441
441
|
}, e.uid)),
|
|
442
|
-
!H && !
|
|
442
|
+
!H && !s.readOnly && /* @__PURE__ */ d("button", {
|
|
443
443
|
type: "button",
|
|
444
444
|
id: v,
|
|
445
445
|
className: "rfe-image-add",
|
|
446
446
|
disabled: V,
|
|
447
|
-
"aria-label":
|
|
447
|
+
"aria-label": s["aria-label"] ?? K,
|
|
448
448
|
"aria-describedby": J,
|
|
449
449
|
"aria-invalid": q || void 0,
|
|
450
450
|
onClick: () => N.current?.click(),
|
|
@@ -452,18 +452,18 @@ function D(c) {
|
|
|
452
452
|
/* @__PURE__ */ u("span", {
|
|
453
453
|
className: "rfe-image-add-icon",
|
|
454
454
|
children: /* @__PURE__ */ u(l, {
|
|
455
|
-
name:
|
|
456
|
-
source:
|
|
455
|
+
name: s.loading ? "loading" : "imageAdd",
|
|
456
|
+
source: s.icons?.add
|
|
457
457
|
})
|
|
458
458
|
}),
|
|
459
459
|
/* @__PURE__ */ u("span", { children: K }),
|
|
460
|
-
|
|
460
|
+
s.dragDrop !== !1 && /* @__PURE__ */ u("small", { children: f("dropImage") })
|
|
461
461
|
]
|
|
462
462
|
}),
|
|
463
463
|
/* @__PURE__ */ u("input", {
|
|
464
464
|
ref: N,
|
|
465
465
|
type: "file",
|
|
466
|
-
name:
|
|
466
|
+
name: s.name,
|
|
467
467
|
accept: re,
|
|
468
468
|
multiple: !I && P,
|
|
469
469
|
disabled: V || H,
|
|
@@ -477,7 +477,7 @@ function D(c) {
|
|
|
477
477
|
/* @__PURE__ */ d("div", {
|
|
478
478
|
className: "rfe-image-meta",
|
|
479
479
|
id: `${v}-hint`,
|
|
480
|
-
children: [/* @__PURE__ */ u("span", { children: f("imageHint", { max: L }) }), (
|
|
480
|
+
children: [/* @__PURE__ */ u("span", { children: f("imageHint", { max: L }) }), (s.showCount ?? F > 1) && /* @__PURE__ */ d("span", { children: [
|
|
481
481
|
D.length,
|
|
482
482
|
" / ",
|
|
483
483
|
F
|
|
@@ -573,7 +573,7 @@ function te({ file: t, onRemove: n, preview: o, removeIcon: s, previewIcon: c, s
|
|
|
573
573
|
});
|
|
574
574
|
}
|
|
575
575
|
function ne({ id: e, name: p, value: h, defaultValue: v, onChange: S, onBlur: C, disabled: w, readOnly: T, loading: E, status: ee, size: D, variant: k, className: A, style: ne, multiple: M = !0, dragDrop: N = !0, preview: P = !0, sortable: F = !1, maxCount: I = 3, maxSize: L = 5, accept: re = f, icons: R, onReject: z, showCount: B, replaceable: ie = !1, previewable: V, beforeUpload: H, onPrepareError: U, ...W }) {
|
|
576
|
-
let ae = o(), { t: G } = a(), K = t(), q = e ?? K, [J, oe] =
|
|
576
|
+
let ae = o(), { t: G } = a(), K = t(), q = e ?? K, [J, oe] = s(h, v ?? O, S), Y = Array.isArray(J) ? J : O, [se, ce] = i([]), [le, ue] = i(!1), de = r(null), X = _(M, I), fe = X <= 1, pe = !!(w || T || E), me = x({
|
|
577
577
|
beforeUpload: H,
|
|
578
578
|
onPrepareError: U
|
|
579
579
|
}, pe), he = r(Y);
|
|
@@ -605,7 +605,7 @@ function ne({ id: e, name: p, value: h, defaultValue: v, onChange: S, onBlur: C,
|
|
|
605
605
|
"aria-label": W["aria-label"] ?? ve,
|
|
606
606
|
"aria-describedby": be,
|
|
607
607
|
"aria-invalid": ye || void 0,
|
|
608
|
-
className:
|
|
608
|
+
className: c("rfe-image-upload", A),
|
|
609
609
|
style: ne,
|
|
610
610
|
"data-size": D ?? ae.size,
|
|
611
611
|
"data-variant": k ?? ae.variant,
|
|
@@ -706,6 +706,10 @@ function ne({ id: e, name: p, value: h, defaultValue: v, onChange: S, onBlur: C,
|
|
|
706
706
|
});
|
|
707
707
|
}
|
|
708
708
|
function M(e) {
|
|
709
|
-
|
|
709
|
+
let t = {
|
|
710
|
+
...o().components?.ImageUpload,
|
|
711
|
+
...e
|
|
712
|
+
};
|
|
713
|
+
return t.mode === "upload" || t.mode === "mixed" ? /* @__PURE__ */ u(D, { ...t }) : /* @__PURE__ */ u(ne, { ...t });
|
|
710
714
|
}
|
|
711
715
|
export { C as i, w as n, S as r, M as t };
|
package/dist/image-upload.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as ImageUpload, n as createImageUploadTasks, r as isImageUrl, i as uploadedImagesRule } from "./image-upload-
|
|
1
|
+
export { t as ImageUpload, n as createImageUploadTasks, r as isImageUrl, i as uploadedImagesRule } from "./image-upload-BFVs81x3.js";
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { a as e,
|
|
2
|
-
import { n as
|
|
3
|
-
import { a as
|
|
4
|
-
import { a as
|
|
5
|
-
import { n as
|
|
6
|
-
import { n as
|
|
7
|
-
import { t as
|
|
8
|
-
import { t as
|
|
9
|
-
import { a as
|
|
10
|
-
import { i as
|
|
11
|
-
import { n as
|
|
12
|
-
import { a as
|
|
13
|
-
import { _ as
|
|
14
|
-
import { a as
|
|
15
|
-
export {
|
|
1
|
+
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, u as c } from "./useControllable-Dt38Jg9E.js";
|
|
2
|
+
import { n as l, t as u } from "./icons-B1dOXz-r.js";
|
|
3
|
+
import { a as d, c as f, d as p, f as m, g as h, h as g, i as _, l as v, m as y, n as b, o as x, p as S, r as C, s as w, t as T, u as E } from "./inputs-w_es2t_C.js";
|
|
4
|
+
import { a as D, c as O, i as k, l as A, n as j, o as M, r as N, s as P, t as F, u as I } from "./pickers-5zLmSrsp.js";
|
|
5
|
+
import { n as L, t as R } from "./slider-Bhd1Z4LP.js";
|
|
6
|
+
import { n as z, t as B } from "./Select-BxwT7MHH.js";
|
|
7
|
+
import { t as V } from "./TreeSelect-W5sgU5nW.js";
|
|
8
|
+
import { t as H } from "./Cascader-COGUcdDS.js";
|
|
9
|
+
import { a as U, c as W, d as G, f as K, i as q, l as J, m as Y, n as X, o as Z, p as Q, r as $, s as ee, t as te, u as ne } from "./form-D6O5PqrZ.js";
|
|
10
|
+
import { i as re, n as ie, r as ae, t as oe } from "./image-upload-BFVs81x3.js";
|
|
11
|
+
import { n as se, r as ce, t as le } from "./validation-D6vk5NAv.js";
|
|
12
|
+
import { a as ue, i as de, n as fe, o as pe, r as me, s as he, t as ge } from "./locale-yHkdw2xz.js";
|
|
13
|
+
import { _ as _e, a as ve, c as ye, d as be, f as xe, g as Se, h as Ce, i as we, l as Te, m as Ee, n as De, o as Oe, p as ke, r as Ae, s as je, t as Me, u as Ne, v as Pe, y as Fe } from "./store-C9eBd8Y7.js";
|
|
14
|
+
import { a as Ie, c as Le, d as Re, f as ze, i as Be, l as Ve, n as He, o as Ue, r as We, s as Ge, t as Ke, u as qe } from "./compound-nXxRSVJu.js";
|
|
15
|
+
export { y as Autocomplete, T as Button, H as Cascader, b as Checkbox, C as CheckboxGroup, Ke as CompoundField, i as ConfigProvider, ze as ControlGroup, F as DatePicker, j as DateRangePicker, N as DateTimePicker, k as DateTimeRangePicker, g as DecimalInput, _ as FloatingInput, te as Form, X as FormItem, $ as FormProvider, u as Icon, d as IconButton, oe as ImageUpload, x as Input, He as InputRange, We as InputSelect, D as MonthPicker, M as MonthRangePicker, B as MultiSelect, w as NumberInput, Be as NumberSelect, Ie as NumberUnit, f as Password, v as RadioGroup, R as RangeSlider, Ue as SearchGroup, E as SearchInput, p as Segmented, z as Select, L as Slider, l as SvgIcon, m as Switch, h as TagsInput, S as Textarea, P as TimePicker, O as TimeRangePicker, V as TreeSelect, A as YearPicker, I as YearRangePicker, Oe as changedOutputValues, je as cloneValues, Ge as compoundDefaults, Le as compoundRule, Ve as compoundValues, Me as createFormStore, ie as createImageUploadTasks, Ae as createPathAdapter, c as cx, q as defineComponents, U as defineForm, ge as defineLocale, ye as defineValueAdapter, be as editArray, fe as enUS, De as equalValue, we as expandPaths, xe as fieldSegments, me as formatIssue, de as formatPickerValue, ve as getPathValue, ke as hasPath, Te as inputValues, Ee as isArrayIndex, le as isEmpty, ae as isImageUrl, Ce as isPlainRecord, o as motionDuration, n as motionEnabled, Se as normalizePaths, _e as omitPaths, Ne as outputValues, qe as partDisabled, Re as partVisible, Pe as readPath, ue as resolveLocale, e as scopeTokenStyle, a as tokenStyle, pe as translate, re as uploadedImagesRule, s as useConfig, Z as useField, ee as useFieldArray, W as useForm, J as useFormContext, ne as useFormSelector, G as useFormState, K as useFormStatus, Q as useFormSummary, t as useLocale, r as useText, Y as useWatch, se as validateRuleIssue, ce as validateRules, Fe as writePath, he as zhCN };
|
package/dist/input.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { m as Autocomplete, h as DecimalInput, i as FloatingInput, o as Input, s as NumberInput, c as Password, u as SearchInput, d as Segmented, g as TagsInput, p as Textarea } from "./inputs-
|
|
1
|
+
export { m as Autocomplete, h as DecimalInput, i as FloatingInput, o as Input, s as NumberInput, c as Password, u as SearchInput, d as Segmented, f as Switch, g as TagsInput, p as Textarea } from "./inputs-w_es2t_C.js";
|