@middag-io/react 0.38.0 → 0.39.0
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-lib/{FormField-B4_ub94_.js → FormField-CKzrwqSV.js} +94 -20
- package/dist-lib/FormPanelBlock-0knL5-AY.js +1425 -0
- package/dist-lib/base/blocks/DenseTableBlock.d.ts.map +1 -1
- package/dist-lib/base/shell/partials/EditablePanelContext.d.ts +53 -0
- package/dist-lib/base/shell/partials/EditablePanelContext.d.ts.map +1 -0
- package/dist-lib/base/shell/partials/EditablePanelContext.js +19 -0
- package/dist-lib/base/shell/partials/EditablePanelProvider.d.ts +20 -0
- package/dist-lib/base/shell/partials/EditablePanelProvider.d.ts.map +1 -0
- package/dist-lib/base/shell/partials/EditablePanelProvider.js +83 -0
- package/dist-lib/base/shell/partials/InlineEditablePanel.d.ts +13 -0
- package/dist-lib/base/shell/partials/InlineEditablePanel.d.ts.map +1 -0
- package/dist-lib/base/shell/partials/InlineEditablePanel.js +1420 -0
- package/dist-lib/base/shell/partials/PageActionButton.js +0 -1
- package/dist-lib/chunks/subpath--GXsYu-v.js +122 -0
- package/dist-lib/chunks/subpath-55YUOrvG.js +22 -0
- package/dist-lib/chunks/subpath-7b9-j7in.js +68 -0
- package/dist-lib/chunks/subpath-B30yU5uo.js +25 -0
- package/dist-lib/chunks/subpath-BhcZoWUz.js +221 -0
- package/dist-lib/chunks/{subpath-DLFO_UGQ.js → subpath-C0XqfmBB.js} +2 -0
- package/dist-lib/contracts/generated/contract-schema.d.ts +1 -1
- package/dist-lib/contracts/generated/contract-types.d.ts +10 -2
- package/dist-lib/contracts/generated/contract-types.d.ts.map +1 -1
- package/dist-lib/contracts/generated/index.d.ts +1 -1
- package/dist-lib/i18n/I18nProvider.js +1 -1
- package/dist-lib/i18n/instance.js +1 -1
- package/dist-lib/i18n/locales/en/ui.json +1 -0
- package/dist-lib/i18n/locales/pt-BR/ui.json +1 -0
- package/dist-lib/i18n/register-strings.js +1 -1
- package/dist-lib/index.d.ts +3 -0
- package/dist-lib/index.d.ts.map +1 -1
- package/dist-lib/lib/actions/resolve-action-target.d.ts +5 -2
- package/dist-lib/lib/actions/resolve-action-target.d.ts.map +1 -1
- package/dist-lib/lib/actions/resolve-action-target.js +6 -0
- package/dist-lib/middag-react.css +1 -1
- package/dist-lib/middag-react.js +7820 -7556
- package/package.json +1 -1
- package/dist-lib/FormPanelBlock-3fH3TyZX.js +0 -1499
|
@@ -8237,12 +8237,86 @@ function Fg(e, t) {
|
|
|
8237
8237
|
return !!(n.required || n.required_when && Bp(n.required_when, t));
|
|
8238
8238
|
}
|
|
8239
8239
|
//#endregion
|
|
8240
|
+
//#region src/base/form/form-schema-builder.ts
|
|
8241
|
+
function Ig(e, t, n) {
|
|
8242
|
+
let { component: r, props: i } = e, a = i.validation, o = n;
|
|
8243
|
+
switch (r) {
|
|
8244
|
+
case "text":
|
|
8245
|
+
case "textarea":
|
|
8246
|
+
case "password":
|
|
8247
|
+
case "slug":
|
|
8248
|
+
case "color": {
|
|
8249
|
+
let e = Bo();
|
|
8250
|
+
return o && (e = e.min(1, t("middag.ui.validation.required"))), a?.minLength && (e = e.min(a.minLength, t("middag.ui.validation.min_length", { min: a.minLength }))), a?.maxLength && (e = e.max(a.maxLength, t("middag.ui.validation.max_length", { max: a.maxLength }))), a?.pattern && (e = e.regex(new RegExp(a.pattern), a.patternMessage ?? t("middag.ui.validation.pattern"))), o ? e : e.or(js(""));
|
|
8251
|
+
}
|
|
8252
|
+
case "email": {
|
|
8253
|
+
let e = Bo();
|
|
8254
|
+
if (o) e = e.min(1, t("middag.ui.validation.required")).email(t("middag.ui.validation.email"));
|
|
8255
|
+
else return e.email(t("middag.ui.validation.email")).or(js(""));
|
|
8256
|
+
return e;
|
|
8257
|
+
}
|
|
8258
|
+
case "url": {
|
|
8259
|
+
let e = Bo();
|
|
8260
|
+
if (o) e = e.min(1, t("middag.ui.validation.required")).url(t("middag.ui.validation.url"));
|
|
8261
|
+
else return e.url(t("middag.ui.validation.url")).or(js(""));
|
|
8262
|
+
return e;
|
|
8263
|
+
}
|
|
8264
|
+
case "int": {
|
|
8265
|
+
let e = ss({ message: t("middag.ui.validation.integer") }).int(t("middag.ui.validation.integer"));
|
|
8266
|
+
return i.min != null && (e = e.min(i.min, t("middag.ui.validation.min_value", { min: i.min }))), i.max != null && (e = e.max(i.max, t("middag.ui.validation.max_value", { max: i.max }))), o ? e : e.nullable();
|
|
8267
|
+
}
|
|
8268
|
+
case "float": {
|
|
8269
|
+
let e = ss();
|
|
8270
|
+
return i.min != null && (e = e.min(i.min, t("middag.ui.validation.min_value", { min: i.min }))), i.max != null && (e = e.max(i.max, t("middag.ui.validation.max_value", { max: i.max }))), o ? e : e.nullable();
|
|
8271
|
+
}
|
|
8272
|
+
case "currency": {
|
|
8273
|
+
let e = ss();
|
|
8274
|
+
return o ? e : e.nullable();
|
|
8275
|
+
}
|
|
8276
|
+
case "select":
|
|
8277
|
+
case "radio":
|
|
8278
|
+
case "entity_picker": {
|
|
8279
|
+
let e = Bo();
|
|
8280
|
+
return o ? e.min(1, t("middag.ui.validation.required")) : e;
|
|
8281
|
+
}
|
|
8282
|
+
case "multiselect":
|
|
8283
|
+
case "tags": {
|
|
8284
|
+
let e = ys(Bo());
|
|
8285
|
+
return o ? e.min(1, t("middag.ui.validation.required")) : e;
|
|
8286
|
+
}
|
|
8287
|
+
case "checkbox":
|
|
8288
|
+
case "switch": return ds();
|
|
8289
|
+
case "date":
|
|
8290
|
+
case "datetime": {
|
|
8291
|
+
let e = Bo();
|
|
8292
|
+
return o ? e.min(1, t("middag.ui.validation.required")) : e;
|
|
8293
|
+
}
|
|
8294
|
+
case "phone": {
|
|
8295
|
+
let e = Bo();
|
|
8296
|
+
return o ? e.min(1, t("middag.ui.validation.required")) : e;
|
|
8297
|
+
}
|
|
8298
|
+
case "document": {
|
|
8299
|
+
let e = i.documentType ?? "generic", n = i.documentScope ?? "any", r = Bo(), a = async (t) => {
|
|
8300
|
+
let { isValidDocument: r } = await import("./document-validation-BSjTDZhG.js");
|
|
8301
|
+
return r(t, e, n);
|
|
8302
|
+
};
|
|
8303
|
+
return o ? r.min(1, t("middag.ui.validation.required")).refine(a, t("middag.ui.validation.document_invalid")) : r.refine(async (e) => e === "" || await a(e), t("middag.ui.validation.document_invalid"));
|
|
8304
|
+
}
|
|
8305
|
+
default: return ps();
|
|
8306
|
+
}
|
|
8307
|
+
}
|
|
8308
|
+
function Lg(e, t, n) {
|
|
8309
|
+
let r = Mg(e), i = {};
|
|
8310
|
+
for (let e of r) e.component === "header" || e.component === "hidden" || e.component === "static" || Ng(e, t) && (i[e.key] = Ig(e, n, Fg(e, t)));
|
|
8311
|
+
return xs(i);
|
|
8312
|
+
}
|
|
8313
|
+
//#endregion
|
|
8240
8314
|
//#region src/base/form/FormField.tsx
|
|
8241
|
-
var
|
|
8242
|
-
function
|
|
8315
|
+
var Rg = dt(() => import("./PhoneField-DZQc97Eo.js").then((e) => ({ default: e.PhoneField }))), zg = dt(() => import("./DateField-x0Ot_z_i.js").then((e) => ({ default: e.DateField }))), Bg = dt(() => import("./DocumentField-fwq79IWM.js").then((e) => ({ default: e.DocumentField }))), Vg = dt(() => import("./DateRangeField-DbWZ2f92.js").then((e) => ({ default: e.DateRangeField })));
|
|
8316
|
+
function Hg() {
|
|
8243
8317
|
return /* @__PURE__ */ H(ot, { className: "h-9 w-full rounded-md" });
|
|
8244
8318
|
}
|
|
8245
|
-
function
|
|
8319
|
+
function Ug({ label: e }) {
|
|
8246
8320
|
return /* @__PURE__ */ H("div", {
|
|
8247
8321
|
className: "pt-4 pb-1",
|
|
8248
8322
|
children: /* @__PURE__ */ H("h4", {
|
|
@@ -8251,21 +8325,21 @@ function Vg({ label: e }) {
|
|
|
8251
8325
|
})
|
|
8252
8326
|
});
|
|
8253
8327
|
}
|
|
8254
|
-
function
|
|
8328
|
+
function Wg({ id: e, value: t }) {
|
|
8255
8329
|
return /* @__PURE__ */ H("input", {
|
|
8256
8330
|
type: "hidden",
|
|
8257
8331
|
id: e,
|
|
8258
8332
|
value: String(t ?? "")
|
|
8259
8333
|
});
|
|
8260
8334
|
}
|
|
8261
|
-
function
|
|
8335
|
+
function Gg({ field: e, value: t, onChange: n, error: r, sourceValues: i = {} }) {
|
|
8262
8336
|
let { t: a } = De(), o = mt(), s = `field-${e.key}-${o}`, c = `${s}-help`, l = `${s}-error`, { component: u, props: d } = e;
|
|
8263
|
-
if (u === "header") return /* @__PURE__ */ H(
|
|
8264
|
-
if (u === "hidden") return /* @__PURE__ */ H(
|
|
8337
|
+
if (u === "header") return /* @__PURE__ */ H(Ug, { label: d.label });
|
|
8338
|
+
if (u === "hidden") return /* @__PURE__ */ H(Wg, {
|
|
8265
8339
|
id: s,
|
|
8266
8340
|
value: t
|
|
8267
8341
|
});
|
|
8268
|
-
let f = Pg(e, i), p = Fg(e, i), m = u === "checkbox" || u === "switch", h =
|
|
8342
|
+
let f = Pg(e, i), p = Fg(e, i), m = u === "checkbox" || u === "switch", h = Kg(u, s, t, n, d, r, c, l, a, i, f, p);
|
|
8269
8343
|
return /* @__PURE__ */ U("div", {
|
|
8270
8344
|
className: "space-y-1.5",
|
|
8271
8345
|
children: [
|
|
@@ -8291,7 +8365,7 @@ function Ug({ field: e, value: t, onChange: n, error: r, sourceValues: i = {} })
|
|
|
8291
8365
|
]
|
|
8292
8366
|
});
|
|
8293
8367
|
}
|
|
8294
|
-
function
|
|
8368
|
+
function Kg(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
8295
8369
|
let f = {
|
|
8296
8370
|
id: t,
|
|
8297
8371
|
error: a,
|
|
@@ -8413,8 +8487,8 @@ function Wg(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
8413
8487
|
label: i.label
|
|
8414
8488
|
});
|
|
8415
8489
|
case "date": return /* @__PURE__ */ H(lt, {
|
|
8416
|
-
fallback: /* @__PURE__ */ H(
|
|
8417
|
-
children: /* @__PURE__ */ H(
|
|
8490
|
+
fallback: /* @__PURE__ */ H(Hg, {}),
|
|
8491
|
+
children: /* @__PURE__ */ H(zg, {
|
|
8418
8492
|
...f,
|
|
8419
8493
|
mode: "date",
|
|
8420
8494
|
value: n,
|
|
@@ -8423,8 +8497,8 @@ function Wg(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
8423
8497
|
})
|
|
8424
8498
|
});
|
|
8425
8499
|
case "datetime": return /* @__PURE__ */ H(lt, {
|
|
8426
|
-
fallback: /* @__PURE__ */ H(
|
|
8427
|
-
children: /* @__PURE__ */ H(
|
|
8500
|
+
fallback: /* @__PURE__ */ H(Hg, {}),
|
|
8501
|
+
children: /* @__PURE__ */ H(zg, {
|
|
8428
8502
|
...f,
|
|
8429
8503
|
mode: "datetime",
|
|
8430
8504
|
value: n,
|
|
@@ -8458,8 +8532,8 @@ function Wg(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
8458
8532
|
value: n
|
|
8459
8533
|
});
|
|
8460
8534
|
case "phone": return /* @__PURE__ */ H(lt, {
|
|
8461
|
-
fallback: /* @__PURE__ */ H(
|
|
8462
|
-
children: /* @__PURE__ */ H(
|
|
8535
|
+
fallback: /* @__PURE__ */ H(Hg, {}),
|
|
8536
|
+
children: /* @__PURE__ */ H(Rg, {
|
|
8463
8537
|
...f,
|
|
8464
8538
|
value: n,
|
|
8465
8539
|
onChange: r,
|
|
@@ -8469,8 +8543,8 @@ function Wg(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
8469
8543
|
})
|
|
8470
8544
|
});
|
|
8471
8545
|
case "document": return /* @__PURE__ */ H(lt, {
|
|
8472
|
-
fallback: /* @__PURE__ */ H(
|
|
8473
|
-
children: /* @__PURE__ */ H(
|
|
8546
|
+
fallback: /* @__PURE__ */ H(Hg, {}),
|
|
8547
|
+
children: /* @__PURE__ */ H(Bg, {
|
|
8474
8548
|
...f,
|
|
8475
8549
|
value: n,
|
|
8476
8550
|
onChange: r,
|
|
@@ -8511,8 +8585,8 @@ function Wg(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
8511
8585
|
maxTags: i.maxTags
|
|
8512
8586
|
});
|
|
8513
8587
|
case "date_range": return /* @__PURE__ */ H(lt, {
|
|
8514
|
-
fallback: /* @__PURE__ */ H(
|
|
8515
|
-
children: /* @__PURE__ */ H(
|
|
8588
|
+
fallback: /* @__PURE__ */ H(Hg, {}),
|
|
8589
|
+
children: /* @__PURE__ */ H(Vg, {
|
|
8516
8590
|
...f,
|
|
8517
8591
|
value: n,
|
|
8518
8592
|
onChange: r,
|
|
@@ -8532,4 +8606,4 @@ function Wg(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
8532
8606
|
}
|
|
8533
8607
|
}
|
|
8534
8608
|
//#endregion
|
|
8535
|
-
export {
|
|
8609
|
+
export { mp as $, Up as A, ys as At, Np as B, cn as Bt, yh as C, sc as Ct, Jp as D, nc as Dt, Kp as E, cc as Et, Rp as F, Ds as Ft, Ap as G, Ip as H, Op as I, Bo as It, xp as J, Dp as K, Mp as L, hs as Lt, Vp as M, js as Mt, Bp as N, ss as Nt, qp as O, ks as Ot, zp as P, xs as Pt, vp as Q, kp as R, pn as Rt, wh as S, mc as St, dh as T, lc as Tt, Fp as U, Lp as V, jp as W, bp as X, _p as Y, yp as Z, vg as _, Xc as _t, Ng as a, fp as at, lg as b, Gc as bt, kg as c, sp as ct, Eg as d, ip as dt, hp as et, Tg as f, rl as ft, yg as g, Qc as gt, xg as h, $c as ht, Fg as i, cp as it, Hp as j, ds as jt, Gp as k, ps as kt, Og as l, ap as lt, Cg as m, nl as mt, Lg as n, rp as nt, jg as o, up as ot, wg as p, el as pt, Sp as q, Mg as r, op as rt, Ag as s, lp as st, Gg as t, pp as tt, Dg as u, dp as ut, pg as v, tl as vt, _h as w, oc as wt, Ph as x, vc as xt, ug as y, Zc as yt, Pp as z, hn as zt };
|