@declarion/react 0.1.46 → 0.1.47
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/index.js +747 -739
- package/dist-lib/index.js.map +1 -1
- package/package.json +1 -1
package/dist-lib/index.js
CHANGED
|
@@ -4152,14 +4152,22 @@ function En(e) {
|
|
|
4152
4152
|
return null;
|
|
4153
4153
|
}
|
|
4154
4154
|
}
|
|
4155
|
-
function Dn(e) {
|
|
4155
|
+
function Dn(e, t) {
|
|
4156
|
+
if (t !== "linkedin.com") return null;
|
|
4157
|
+
try {
|
|
4158
|
+
let t = new URL(e).pathname.match(/^\/(in|company|school)\/([^/]+)/i);
|
|
4159
|
+
if (t) return `${t[1].toLowerCase()}/${decodeURIComponent(t[2])}`;
|
|
4160
|
+
} catch {}
|
|
4161
|
+
return null;
|
|
4162
|
+
}
|
|
4163
|
+
function On(e) {
|
|
4156
4164
|
try {
|
|
4157
4165
|
return new URL(e), !0;
|
|
4158
4166
|
} catch {
|
|
4159
4167
|
return !1;
|
|
4160
4168
|
}
|
|
4161
4169
|
}
|
|
4162
|
-
function
|
|
4170
|
+
function kn({ field: e, value: t, mode: n, onChange: r }) {
|
|
4163
4171
|
let i = String(t ?? ""), [a, o] = p(null);
|
|
4164
4172
|
if (n === "display") {
|
|
4165
4173
|
if (!i) return /* @__PURE__ */ N("span", {
|
|
@@ -4170,11 +4178,11 @@ function On({ field: e, value: t, mode: n, onChange: r }) {
|
|
|
4170
4178
|
children: "—"
|
|
4171
4179
|
});
|
|
4172
4180
|
let t = e.display?.widget === "link", n = Tn(i);
|
|
4173
|
-
if (n == null || !
|
|
4181
|
+
if (n == null || !On(n)) return /* @__PURE__ */ N("span", {
|
|
4174
4182
|
style: { fontSize: 12.5 },
|
|
4175
4183
|
children: i
|
|
4176
4184
|
});
|
|
4177
|
-
let r = En(n), s = !t && r != null && a !== r, c = t ? i : r ?? i;
|
|
4185
|
+
let r = En(n), s = !t && r != null && a !== r, c = t ? i : Dn(n, r ?? "") ?? r ?? i;
|
|
4178
4186
|
return /* @__PURE__ */ P("a", {
|
|
4179
4187
|
href: n,
|
|
4180
4188
|
target: "_blank",
|
|
@@ -4213,7 +4221,7 @@ function On({ field: e, value: t, mode: n, onChange: r }) {
|
|
|
4213
4221
|
}
|
|
4214
4222
|
//#endregion
|
|
4215
4223
|
//#region src/components/fields/TimestampField.tsx
|
|
4216
|
-
function
|
|
4224
|
+
function An(e, t) {
|
|
4217
4225
|
if (t) {
|
|
4218
4226
|
let t = /* @__PURE__ */ new Date(e + "T00:00:00");
|
|
4219
4227
|
return isNaN(t.getTime()) ? e : new Intl.DateTimeFormat(void 0, {
|
|
@@ -4263,14 +4271,14 @@ function kn(e, t) {
|
|
|
4263
4271
|
minute: "2-digit"
|
|
4264
4272
|
}).format(i);
|
|
4265
4273
|
}
|
|
4266
|
-
function
|
|
4274
|
+
function jn(e) {
|
|
4267
4275
|
if (e.endsWith("Z")) return "UTC";
|
|
4268
4276
|
let t = e.match(/([+-]\d{2}:\d{2})$/);
|
|
4269
4277
|
if (!t) return null;
|
|
4270
4278
|
let n = t[1].charAt(0), r = parseInt(t[1].substring(1, 3), 10), i = parseInt(t[1].substring(4, 6), 10);
|
|
4271
4279
|
return r === 0 && i === 0 ? "UTC" : `UTC${n}${r}${i > 0 ? `:${String(i).padStart(2, "0")}` : ""}`;
|
|
4272
4280
|
}
|
|
4273
|
-
function
|
|
4281
|
+
function Mn(e, t) {
|
|
4274
4282
|
let n = e.match(/([+-]\d{2}:\d{2})$/), r = e.endsWith("Z");
|
|
4275
4283
|
if (n || r) {
|
|
4276
4284
|
let i = new Date(e);
|
|
@@ -4284,7 +4292,7 @@ function jn(e, t) {
|
|
|
4284
4292
|
}
|
|
4285
4293
|
return t ? e.slice(0, 10) : e.slice(0, 16);
|
|
4286
4294
|
}
|
|
4287
|
-
function
|
|
4295
|
+
function Nn({ field: e, value: t, mode: n, onChange: r }) {
|
|
4288
4296
|
let i = e.type === "date", a = !!e.timezone;
|
|
4289
4297
|
if (n === "display") {
|
|
4290
4298
|
if (!t) return /* @__PURE__ */ N("span", {
|
|
@@ -4294,7 +4302,7 @@ function Mn({ field: e, value: t, mode: n, onChange: r }) {
|
|
|
4294
4302
|
},
|
|
4295
4303
|
children: "—"
|
|
4296
4304
|
});
|
|
4297
|
-
let e = String(t), n =
|
|
4305
|
+
let e = String(t), n = An(e, i), r = a && !i ? jn(e) : null;
|
|
4298
4306
|
return /* @__PURE__ */ P("span", {
|
|
4299
4307
|
style: { fontSize: 12.5 },
|
|
4300
4308
|
children: [n, r && /* @__PURE__ */ N("span", {
|
|
@@ -4307,7 +4315,7 @@ function Mn({ field: e, value: t, mode: n, onChange: r }) {
|
|
|
4307
4315
|
});
|
|
4308
4316
|
}
|
|
4309
4317
|
let o = "";
|
|
4310
|
-
return t && (o =
|
|
4318
|
+
return t && (o = Mn(String(t), i)), /* @__PURE__ */ N(J, {
|
|
4311
4319
|
type: i ? "date" : "datetime-local",
|
|
4312
4320
|
value: o,
|
|
4313
4321
|
onChange: (e) => {
|
|
@@ -4321,7 +4329,7 @@ function Mn({ field: e, value: t, mode: n, onChange: r }) {
|
|
|
4321
4329
|
}
|
|
4322
4330
|
//#endregion
|
|
4323
4331
|
//#region src/components/fields/BoolField.tsx
|
|
4324
|
-
function
|
|
4332
|
+
function Pn({ value: e, mode: t, onChange: n }) {
|
|
4325
4333
|
let r = !!e;
|
|
4326
4334
|
return t === "display" ? /* @__PURE__ */ P("span", {
|
|
4327
4335
|
style: {
|
|
@@ -4344,7 +4352,7 @@ function Nn({ value: e, mode: t, onChange: n }) {
|
|
|
4344
4352
|
}
|
|
4345
4353
|
//#endregion
|
|
4346
4354
|
//#region src/components/fields/NumberField.tsx
|
|
4347
|
-
function
|
|
4355
|
+
function Fn(e) {
|
|
4348
4356
|
let t = e.trim();
|
|
4349
4357
|
if (t === "" || t === "-") return t;
|
|
4350
4358
|
let n = t.startsWith("-"), [r, i] = (n ? t.slice(1) : t).split("."), a;
|
|
@@ -4356,8 +4364,8 @@ function Pn(e) {
|
|
|
4356
4364
|
let o = n ? `-${a}` : a;
|
|
4357
4365
|
return i !== void 0 && (o += `.${i}`), o;
|
|
4358
4366
|
}
|
|
4359
|
-
var
|
|
4360
|
-
function
|
|
4367
|
+
var In = new Intl.NumberFormat();
|
|
4368
|
+
function Ln({ field: e, fieldName: t, value: n, mode: r, onChange: i, record: a }) {
|
|
4361
4369
|
let o = e.display?.widget === "money", s = e.type === "decimal" || o, c = a?.$units?.[t], l = !c && e.unit ? e.unit.display || e.unit.storage : void 0, u = c || (l && !l.startsWith("$") ? l : void 0);
|
|
4362
4370
|
if (r === "display") {
|
|
4363
4371
|
if (n == null) return /* @__PURE__ */ N("span", {
|
|
@@ -4368,10 +4376,10 @@ function In({ field: e, fieldName: t, value: n, mode: r, onChange: i, record: a
|
|
|
4368
4376
|
children: "—"
|
|
4369
4377
|
});
|
|
4370
4378
|
let e;
|
|
4371
|
-
if (s && typeof n == "string") e =
|
|
4379
|
+
if (s && typeof n == "string") e = Fn(n);
|
|
4372
4380
|
else {
|
|
4373
4381
|
let t = Number(n);
|
|
4374
|
-
e = isNaN(t) ? null :
|
|
4382
|
+
e = isNaN(t) ? null : In.format(t);
|
|
4375
4383
|
}
|
|
4376
4384
|
return e == null ? /* @__PURE__ */ N("span", {
|
|
4377
4385
|
style: { fontSize: 12.5 },
|
|
@@ -4410,27 +4418,27 @@ function In({ field: e, fieldName: t, value: n, mode: r, onChange: i, record: a
|
|
|
4410
4418
|
}
|
|
4411
4419
|
//#endregion
|
|
4412
4420
|
//#region src/api/data.ts
|
|
4413
|
-
function
|
|
4421
|
+
function Rn(e, t) {
|
|
4414
4422
|
let n = new URL(`/api/data/${e}`, window.location.origin);
|
|
4415
4423
|
if (t.page && n.searchParams.set("page", String(t.page)), t.per_page && n.searchParams.set("per_page", String(t.per_page)), t.sort && n.searchParams.set("sort", t.sort), t.search && n.searchParams.set("search", t.search), t.filters && t.filters.length > 0 && n.searchParams.set("filters", JSON.stringify(t.filters)), t.include_deleted && n.searchParams.set("include_deleted", "true"), t.expand) for (let e of t.expand) n.searchParams.append("expand", e);
|
|
4416
4424
|
return t.screen && n.searchParams.set("screen", t.screen), n.pathname + n.search;
|
|
4417
4425
|
}
|
|
4418
|
-
async function
|
|
4419
|
-
return Z(
|
|
4426
|
+
async function zn(e, t = {}) {
|
|
4427
|
+
return Z(Rn(e, t));
|
|
4420
4428
|
}
|
|
4421
|
-
async function
|
|
4429
|
+
async function Bn(e, t) {
|
|
4422
4430
|
let n = new URLSearchParams();
|
|
4423
4431
|
if (typeof t == "string") n.set("id", t);
|
|
4424
4432
|
else for (let [e, r] of Object.entries(t)) n.set(e, r);
|
|
4425
4433
|
return Z(`/api/data/${e}?${n.toString()}`);
|
|
4426
4434
|
}
|
|
4427
|
-
async function
|
|
4435
|
+
async function Vn(e, t) {
|
|
4428
4436
|
return { data: (await Z(`/api/data/${e}`, {
|
|
4429
4437
|
method: "POST",
|
|
4430
4438
|
body: JSON.stringify([t])
|
|
4431
4439
|
}))[0] };
|
|
4432
4440
|
}
|
|
4433
|
-
async function
|
|
4441
|
+
async function Hn(e, t, n) {
|
|
4434
4442
|
let r = typeof t == "string" ? { id: t } : t;
|
|
4435
4443
|
return { data: (await Z(`/api/data/${e}`, {
|
|
4436
4444
|
method: "PATCH",
|
|
@@ -4440,21 +4448,21 @@ async function Vn(e, t, n) {
|
|
|
4440
4448
|
}])
|
|
4441
4449
|
}))[0] };
|
|
4442
4450
|
}
|
|
4443
|
-
async function
|
|
4451
|
+
async function Un(e, t) {
|
|
4444
4452
|
let n = typeof t == "string" ? { id: t } : t;
|
|
4445
4453
|
await Z(`/api/data/${e}/delete`, {
|
|
4446
4454
|
method: "POST",
|
|
4447
4455
|
body: JSON.stringify([n])
|
|
4448
4456
|
});
|
|
4449
4457
|
}
|
|
4450
|
-
async function
|
|
4458
|
+
async function Wn(e, t) {
|
|
4451
4459
|
let n = typeof t == "string" ? { id: t } : t;
|
|
4452
4460
|
await Z(`/api/data/${e}/restore`, {
|
|
4453
4461
|
method: "POST",
|
|
4454
4462
|
body: JSON.stringify([n])
|
|
4455
4463
|
});
|
|
4456
4464
|
}
|
|
4457
|
-
var
|
|
4465
|
+
var Gn = class extends Error {
|
|
4458
4466
|
status;
|
|
4459
4467
|
response;
|
|
4460
4468
|
constructor(e, t) {
|
|
@@ -4462,53 +4470,53 @@ var Wn = class extends Error {
|
|
|
4462
4470
|
super(n || "Action failed"), this.name = "ActionBatchError", this.status = e, this.response = t;
|
|
4463
4471
|
}
|
|
4464
4472
|
};
|
|
4465
|
-
function
|
|
4473
|
+
function Kn(e) {
|
|
4466
4474
|
if (!e || typeof e != "object") return !1;
|
|
4467
4475
|
let t = e;
|
|
4468
4476
|
return typeof t.status == "string" && Array.isArray(t.errors);
|
|
4469
4477
|
}
|
|
4470
|
-
function
|
|
4478
|
+
function qn(e, t) {
|
|
4471
4479
|
let n = { ...e ?? {} };
|
|
4472
4480
|
if ("_ids" in n) throw Error("handler param \"_ids\" collides with reserved key");
|
|
4473
4481
|
return t !== void 0 && (n._ids = t), n;
|
|
4474
4482
|
}
|
|
4475
|
-
async function
|
|
4483
|
+
async function Jn(e, t) {
|
|
4476
4484
|
try {
|
|
4477
4485
|
return await Z(`/api/actions/${e}`, {
|
|
4478
4486
|
method: "POST",
|
|
4479
4487
|
body: JSON.stringify(t)
|
|
4480
4488
|
});
|
|
4481
4489
|
} catch (e) {
|
|
4482
|
-
throw e instanceof Ye &&
|
|
4490
|
+
throw e instanceof Ye && Kn(e.raw) ? new Gn(e.status, e.raw) : e;
|
|
4483
4491
|
}
|
|
4484
4492
|
}
|
|
4485
|
-
async function
|
|
4493
|
+
async function Yn(e, t) {
|
|
4486
4494
|
let n = new URLSearchParams();
|
|
4487
4495
|
return n.set("ids", t.join(",")), Z(`/api/associations/${e}?${n.toString()}`);
|
|
4488
4496
|
}
|
|
4489
4497
|
//#endregion
|
|
4490
4498
|
//#region src/hooks/useEntityData.ts
|
|
4491
|
-
function
|
|
4499
|
+
function Xn(e, t) {
|
|
4492
4500
|
return O({
|
|
4493
4501
|
queryKey: [
|
|
4494
4502
|
"entity-data",
|
|
4495
4503
|
e,
|
|
4496
4504
|
t
|
|
4497
4505
|
],
|
|
4498
|
-
queryFn: () =>
|
|
4506
|
+
queryFn: () => zn(e, t),
|
|
4499
4507
|
enabled: !!e,
|
|
4500
4508
|
placeholderData: (t, n) => n?.queryKey?.[1] === e ? t : void 0
|
|
4501
4509
|
});
|
|
4502
4510
|
}
|
|
4503
4511
|
//#endregion
|
|
4504
4512
|
//#region src/hooks/useEntity.ts
|
|
4505
|
-
function
|
|
4513
|
+
function Zn(e) {
|
|
4506
4514
|
let { data: t } = st();
|
|
4507
4515
|
if (!(!t || !e)) return t.entities[e];
|
|
4508
4516
|
}
|
|
4509
4517
|
//#endregion
|
|
4510
4518
|
//#region src/components/fields/RefField.tsx
|
|
4511
|
-
function
|
|
4519
|
+
function Qn(e) {
|
|
4512
4520
|
if (e == null) return "—";
|
|
4513
4521
|
if (typeof e == "object" && !Array.isArray(e)) {
|
|
4514
4522
|
let t = Object.values(e)[0];
|
|
@@ -4516,8 +4524,8 @@ function Zn(e) {
|
|
|
4516
4524
|
}
|
|
4517
4525
|
return String(e);
|
|
4518
4526
|
}
|
|
4519
|
-
function
|
|
4520
|
-
let a = e.ref?.entity, o =
|
|
4527
|
+
function $n({ field: e, value: t, mode: n, onChange: r, refs: i }) {
|
|
4528
|
+
let a = e.ref?.entity, o = Zn(a), s = e.display?.ref_display_field ?? e.ref?.display?.field ?? o?.display?.display_field, c = d(() => o ? [...o.fields].find(([, e]) => e.primary)?.[0] ?? "id" : "id", [o]), { data: l, isLoading: u } = Xn(n === "edit" ? a : void 0, {
|
|
4521
4529
|
per_page: 200,
|
|
4522
4530
|
sort: s ? `${s}:asc` : void 0
|
|
4523
4531
|
}), f = l?.data ?? [], p = d(() => {
|
|
@@ -4527,12 +4535,12 @@ function Qn({ field: e, value: t, mode: n, onChange: r, refs: i }) {
|
|
|
4527
4535
|
let t = i[a];
|
|
4528
4536
|
if (t) {
|
|
4529
4537
|
let n = t[e];
|
|
4530
|
-
if (n) return s ?
|
|
4538
|
+
if (n) return s ? Qn(n[s]) : e;
|
|
4531
4539
|
}
|
|
4532
4540
|
}
|
|
4533
4541
|
if (s && f.length > 0) {
|
|
4534
4542
|
let n = f.find((t) => String(t[c]) === e);
|
|
4535
|
-
if (n) return
|
|
4543
|
+
if (n) return Qn(n[s] ?? t);
|
|
4536
4544
|
}
|
|
4537
4545
|
return e;
|
|
4538
4546
|
}, [
|
|
@@ -4567,7 +4575,7 @@ function Qn({ field: e, value: t, mode: n, onChange: r, refs: i }) {
|
|
|
4567
4575
|
let t = String(e[c]);
|
|
4568
4576
|
return {
|
|
4569
4577
|
value: t,
|
|
4570
|
-
label: s ?
|
|
4578
|
+
label: s ? Qn(e[s] ?? t) : t
|
|
4571
4579
|
};
|
|
4572
4580
|
})
|
|
4573
4581
|
],
|
|
@@ -4577,23 +4585,23 @@ function Qn({ field: e, value: t, mode: n, onChange: r, refs: i }) {
|
|
|
4577
4585
|
}
|
|
4578
4586
|
//#endregion
|
|
4579
4587
|
//#region src/components/fields/JsonField.tsx
|
|
4580
|
-
var
|
|
4581
|
-
function
|
|
4588
|
+
var er = o(() => import("./JsonEditor-CWueGEgA.js").then((e) => ({ default: e.JsonEditor })));
|
|
4589
|
+
function tr() {
|
|
4582
4590
|
return /* @__PURE__ */ N("div", { className: "h-20 rounded-md border border-border bg-muted animate-pulse" });
|
|
4583
4591
|
}
|
|
4584
|
-
function
|
|
4592
|
+
function nr({ value: e, mode: t, onChange: r }) {
|
|
4585
4593
|
return t === "display" ? e == null || typeof e == "string" && !e ? /* @__PURE__ */ N("span", {
|
|
4586
4594
|
className: "text-sm text-muted-foreground",
|
|
4587
4595
|
children: "-"
|
|
4588
4596
|
}) : /* @__PURE__ */ N(n, {
|
|
4589
|
-
fallback: /* @__PURE__ */ N(
|
|
4590
|
-
children: /* @__PURE__ */ N(
|
|
4597
|
+
fallback: /* @__PURE__ */ N(tr, {}),
|
|
4598
|
+
children: /* @__PURE__ */ N(er, {
|
|
4591
4599
|
value: e,
|
|
4592
4600
|
readOnly: !0
|
|
4593
4601
|
})
|
|
4594
4602
|
}) : /* @__PURE__ */ N(n, {
|
|
4595
|
-
fallback: /* @__PURE__ */ N(
|
|
4596
|
-
children: /* @__PURE__ */ N(
|
|
4603
|
+
fallback: /* @__PURE__ */ N(tr, {}),
|
|
4604
|
+
children: /* @__PURE__ */ N(er, {
|
|
4597
4605
|
value: e,
|
|
4598
4606
|
onChange: r
|
|
4599
4607
|
})
|
|
@@ -4601,14 +4609,14 @@ function tr({ value: e, mode: t, onChange: r }) {
|
|
|
4601
4609
|
}
|
|
4602
4610
|
//#endregion
|
|
4603
4611
|
//#region src/components/fields/MultilangField.tsx
|
|
4604
|
-
function
|
|
4612
|
+
function rr(e) {
|
|
4605
4613
|
return e == null ? {} : typeof e == "object" && !Array.isArray(e) ? e : typeof e == "string" ? { en: e } : {};
|
|
4606
4614
|
}
|
|
4607
|
-
function
|
|
4615
|
+
function ir({ value: e, mode: t, onChange: n }) {
|
|
4608
4616
|
let { data: r } = st(), i = r?.languages?.length ? r.languages : [{
|
|
4609
4617
|
code: "en",
|
|
4610
4618
|
name: { en: "English" }
|
|
4611
|
-
}], a =
|
|
4619
|
+
}], a = rr(e);
|
|
4612
4620
|
if (t === "display") return /* @__PURE__ */ N("span", {
|
|
4613
4621
|
style: { fontSize: 12.5 },
|
|
4614
4622
|
children: Object.values(a)[0] ?? "—"
|
|
@@ -4657,14 +4665,14 @@ function rr({ value: e, mode: t, onChange: n }) {
|
|
|
4657
4665
|
}
|
|
4658
4666
|
//#endregion
|
|
4659
4667
|
//#region src/components/fields/MultilangTextField.tsx
|
|
4660
|
-
function
|
|
4668
|
+
function ar(e) {
|
|
4661
4669
|
return e == null ? {} : typeof e == "object" && !Array.isArray(e) ? e : typeof e == "string" ? { en: e } : {};
|
|
4662
4670
|
}
|
|
4663
|
-
function
|
|
4671
|
+
function or({ value: e, mode: t, onChange: n }) {
|
|
4664
4672
|
let { data: r } = st(), i = r?.languages?.length ? r.languages : [{
|
|
4665
4673
|
code: "en",
|
|
4666
4674
|
name: { en: "English" }
|
|
4667
|
-
}], a =
|
|
4675
|
+
}], a = ar(e);
|
|
4668
4676
|
if (t === "display") return /* @__PURE__ */ N("p", {
|
|
4669
4677
|
style: {
|
|
4670
4678
|
fontSize: 12.5,
|
|
@@ -4713,21 +4721,21 @@ function ar({ value: e, mode: t, onChange: n }) {
|
|
|
4713
4721
|
}
|
|
4714
4722
|
//#endregion
|
|
4715
4723
|
//#region src/components/fields/StructureField.tsx
|
|
4716
|
-
function
|
|
4724
|
+
function sr(e) {
|
|
4717
4725
|
let { field: t, value: n, mode: r, onChange: i } = e, { data: a } = st(), o = t.structure ? a?.structures?.[t.structure] : void 0;
|
|
4718
|
-
return o ? t.array ? /* @__PURE__ */ N(
|
|
4726
|
+
return o ? t.array ? /* @__PURE__ */ N(lr, {
|
|
4719
4727
|
structDef: o,
|
|
4720
4728
|
value: n,
|
|
4721
4729
|
mode: r,
|
|
4722
4730
|
onChange: i
|
|
4723
|
-
}) : /* @__PURE__ */ N(
|
|
4731
|
+
}) : /* @__PURE__ */ N(cr, {
|
|
4724
4732
|
structDef: o,
|
|
4725
4733
|
value: n,
|
|
4726
4734
|
mode: r,
|
|
4727
4735
|
onChange: i
|
|
4728
|
-
}) : /* @__PURE__ */ N(
|
|
4736
|
+
}) : /* @__PURE__ */ N(nr, { ...e });
|
|
4729
4737
|
}
|
|
4730
|
-
function
|
|
4738
|
+
function cr({ structDef: e, value: t, mode: n, onChange: r }) {
|
|
4731
4739
|
let i = typeof t == "object" && t && !Array.isArray(t) ? t : {}, a = e.fields.names(), o = {
|
|
4732
4740
|
display: "flex",
|
|
4733
4741
|
flexDirection: "column",
|
|
@@ -4763,7 +4771,7 @@ function sr({ structDef: e, value: t, mode: n, onChange: r }) {
|
|
|
4763
4771
|
minWidth: 0,
|
|
4764
4772
|
flex: 1
|
|
4765
4773
|
},
|
|
4766
|
-
children: n.type === "structure" && n.structure ? /* @__PURE__ */ N(
|
|
4774
|
+
children: n.type === "structure" && n.structure ? /* @__PURE__ */ N(sr, {
|
|
4767
4775
|
field: n,
|
|
4768
4776
|
fieldName: t,
|
|
4769
4777
|
value: r,
|
|
@@ -4803,7 +4811,7 @@ function sr({ structDef: e, value: t, mode: n, onChange: r }) {
|
|
|
4803
4811
|
children: [/* @__PURE__ */ N(q, {
|
|
4804
4812
|
required: n.required,
|
|
4805
4813
|
children: n.display ? X(n.display.name) : t
|
|
4806
|
-
}), n.type === "structure" && n.structure ? /* @__PURE__ */ N(
|
|
4814
|
+
}), n.type === "structure" && n.structure ? /* @__PURE__ */ N(sr, {
|
|
4807
4815
|
field: n,
|
|
4808
4816
|
fieldName: t,
|
|
4809
4817
|
value: i[t],
|
|
@@ -4820,7 +4828,7 @@ function sr({ structDef: e, value: t, mode: n, onChange: r }) {
|
|
|
4820
4828
|
})
|
|
4821
4829
|
});
|
|
4822
4830
|
}
|
|
4823
|
-
function
|
|
4831
|
+
function lr({ structDef: e, value: t, mode: n, onChange: r }) {
|
|
4824
4832
|
let i = Array.isArray(t) ? t : [];
|
|
4825
4833
|
if (n === "display") return i.length === 0 ? /* @__PURE__ */ N("span", {
|
|
4826
4834
|
style: {
|
|
@@ -4834,7 +4842,7 @@ function cr({ structDef: e, value: t, mode: n, onChange: r }) {
|
|
|
4834
4842
|
flexDirection: "column",
|
|
4835
4843
|
gap: 8
|
|
4836
4844
|
},
|
|
4837
|
-
children: i.map((t, n) => /* @__PURE__ */ N(
|
|
4845
|
+
children: i.map((t, n) => /* @__PURE__ */ N(cr, {
|
|
4838
4846
|
structDef: e,
|
|
4839
4847
|
value: t,
|
|
4840
4848
|
mode: "display"
|
|
@@ -4857,7 +4865,7 @@ function cr({ structDef: e, value: t, mode: n, onChange: r }) {
|
|
|
4857
4865
|
},
|
|
4858
4866
|
children: [i.map((t, n) => /* @__PURE__ */ P("div", {
|
|
4859
4867
|
style: { position: "relative" },
|
|
4860
|
-
children: [/* @__PURE__ */ N(
|
|
4868
|
+
children: [/* @__PURE__ */ N(cr, {
|
|
4861
4869
|
structDef: e,
|
|
4862
4870
|
value: t,
|
|
4863
4871
|
mode: "edit",
|
|
@@ -4884,16 +4892,16 @@ function cr({ structDef: e, value: t, mode: n, onChange: r }) {
|
|
|
4884
4892
|
}
|
|
4885
4893
|
//#endregion
|
|
4886
4894
|
//#region src/components/fields/SecretField.tsx
|
|
4887
|
-
var
|
|
4888
|
-
function
|
|
4889
|
-
let [i, a] = p(""), o = r !== void 0, s = e ===
|
|
4895
|
+
var ur = "[SET]";
|
|
4896
|
+
function dr({ value: e, mode: t, onChange: n, record: r }) {
|
|
4897
|
+
let [i, a] = p(""), o = r !== void 0, s = e === ur || typeof e == "string" && e !== "";
|
|
4890
4898
|
return t === "display" ? s ? /* @__PURE__ */ N("span", {
|
|
4891
4899
|
className: "mono",
|
|
4892
4900
|
style: {
|
|
4893
4901
|
fontSize: 12.5,
|
|
4894
4902
|
color: "var(--text-3)"
|
|
4895
4903
|
},
|
|
4896
|
-
children:
|
|
4904
|
+
children: ur
|
|
4897
4905
|
}) : /* @__PURE__ */ N("span", {
|
|
4898
4906
|
style: {
|
|
4899
4907
|
fontSize: 12.5,
|
|
@@ -4904,23 +4912,23 @@ function ur({ value: e, mode: t, onChange: n, record: r }) {
|
|
|
4904
4912
|
}) : /* @__PURE__ */ N(Y, {
|
|
4905
4913
|
value: i,
|
|
4906
4914
|
onChange: (e) => {
|
|
4907
|
-
a(e), o && e === "" ? n?.(s ?
|
|
4915
|
+
a(e), o && e === "" ? n?.(s ? ur : "") : n?.(e);
|
|
4908
4916
|
},
|
|
4909
4917
|
placeholder: o ? "Leave blank to keep existing value" : "Enter value"
|
|
4910
4918
|
});
|
|
4911
4919
|
}
|
|
4912
4920
|
//#endregion
|
|
4913
4921
|
//#region src/components/fields/PasswordField.tsx
|
|
4914
|
-
var
|
|
4915
|
-
function
|
|
4916
|
-
let [i, a] = p(""), o = r !== void 0, s = e ===
|
|
4922
|
+
var fr = "[SET]";
|
|
4923
|
+
function pr({ value: e, mode: t, onChange: n, record: r }) {
|
|
4924
|
+
let [i, a] = p(""), o = r !== void 0, s = e === fr || typeof e == "string" && e !== "";
|
|
4917
4925
|
return t === "display" ? s ? /* @__PURE__ */ N("span", {
|
|
4918
4926
|
className: "mono",
|
|
4919
4927
|
style: {
|
|
4920
4928
|
fontSize: 12.5,
|
|
4921
4929
|
color: "var(--text-3)"
|
|
4922
4930
|
},
|
|
4923
|
-
children:
|
|
4931
|
+
children: fr
|
|
4924
4932
|
}) : /* @__PURE__ */ N("span", {
|
|
4925
4933
|
style: {
|
|
4926
4934
|
fontSize: 12.5,
|
|
@@ -4931,18 +4939,18 @@ function fr({ value: e, mode: t, onChange: n, record: r }) {
|
|
|
4931
4939
|
}) : /* @__PURE__ */ N(Y, {
|
|
4932
4940
|
value: i,
|
|
4933
4941
|
onChange: (e) => {
|
|
4934
|
-
a(e), o && e === "" ? n?.(s ?
|
|
4942
|
+
a(e), o && e === "" ? n?.(s ? fr : "") : n?.(e);
|
|
4935
4943
|
},
|
|
4936
4944
|
placeholder: o ? "Leave blank to keep existing value" : "Enter password"
|
|
4937
4945
|
});
|
|
4938
4946
|
}
|
|
4939
4947
|
//#endregion
|
|
4940
4948
|
//#region src/components/fields/StringArrayField.tsx
|
|
4941
|
-
function
|
|
4949
|
+
function mr(e) {
|
|
4942
4950
|
return Array.isArray(e) ? e.filter((e) => e != null).map(String) : [];
|
|
4943
4951
|
}
|
|
4944
|
-
function
|
|
4945
|
-
let r =
|
|
4952
|
+
function hr({ value: e, mode: t, onChange: n }) {
|
|
4953
|
+
let r = mr(e), [i, a] = p("");
|
|
4946
4954
|
if (t === "display") return r.length === 0 ? /* @__PURE__ */ N("span", {
|
|
4947
4955
|
style: {
|
|
4948
4956
|
fontSize: 12.5,
|
|
@@ -5008,11 +5016,11 @@ function mr({ value: e, mode: t, onChange: n }) {
|
|
|
5008
5016
|
}
|
|
5009
5017
|
//#endregion
|
|
5010
5018
|
//#region src/components/fields/IntArrayField.tsx
|
|
5011
|
-
function
|
|
5019
|
+
function gr(e) {
|
|
5012
5020
|
return Array.isArray(e) ? e.filter((e) => e != null).map(Number).filter((e) => !isNaN(e)) : [];
|
|
5013
5021
|
}
|
|
5014
|
-
function
|
|
5015
|
-
let r =
|
|
5022
|
+
function _r({ value: e, mode: t, onChange: n }) {
|
|
5023
|
+
let r = gr(e), [i, a] = p("");
|
|
5016
5024
|
if (t === "display") return r.length === 0 ? /* @__PURE__ */ N("span", {
|
|
5017
5025
|
style: {
|
|
5018
5026
|
fontSize: 12.5,
|
|
@@ -5081,61 +5089,61 @@ function gr({ value: e, mode: t, onChange: n }) {
|
|
|
5081
5089
|
}
|
|
5082
5090
|
//#endregion
|
|
5083
5091
|
//#region src/components/fields/index.tsx
|
|
5084
|
-
var
|
|
5092
|
+
var vr = {
|
|
5085
5093
|
string: mn,
|
|
5086
5094
|
text: gn,
|
|
5087
5095
|
enum: vn,
|
|
5088
5096
|
email: yn,
|
|
5089
|
-
url:
|
|
5097
|
+
url: kn,
|
|
5090
5098
|
phone: mn,
|
|
5091
|
-
timestamp:
|
|
5092
|
-
date:
|
|
5093
|
-
time:
|
|
5094
|
-
bool:
|
|
5095
|
-
int:
|
|
5096
|
-
float:
|
|
5097
|
-
decimal:
|
|
5099
|
+
timestamp: Nn,
|
|
5100
|
+
date: Nn,
|
|
5101
|
+
time: Nn,
|
|
5102
|
+
bool: Pn,
|
|
5103
|
+
int: Ln,
|
|
5104
|
+
float: Ln,
|
|
5105
|
+
decimal: Ln,
|
|
5098
5106
|
uuid: mn,
|
|
5099
|
-
ref:
|
|
5100
|
-
json:
|
|
5107
|
+
ref: $n,
|
|
5108
|
+
json: nr,
|
|
5101
5109
|
tags: mn,
|
|
5102
|
-
string_array:
|
|
5103
|
-
int_array:
|
|
5104
|
-
multilang:
|
|
5105
|
-
multilang_text:
|
|
5106
|
-
structure:
|
|
5107
|
-
secret:
|
|
5108
|
-
password:
|
|
5110
|
+
string_array: hr,
|
|
5111
|
+
int_array: _r,
|
|
5112
|
+
multilang: ir,
|
|
5113
|
+
multilang_text: or,
|
|
5114
|
+
structure: sr,
|
|
5115
|
+
secret: dr,
|
|
5116
|
+
password: pr
|
|
5109
5117
|
};
|
|
5110
5118
|
function $(e) {
|
|
5111
|
-
if (e.field.type === "json" && e.field.structure) return /* @__PURE__ */ N(
|
|
5119
|
+
if (e.field.type === "json" && e.field.structure) return /* @__PURE__ */ N(sr, { ...e });
|
|
5112
5120
|
let t = e.field.display?.widget;
|
|
5113
|
-
if (t &&
|
|
5114
|
-
let n =
|
|
5121
|
+
if (t && vr[t]) {
|
|
5122
|
+
let n = vr[t];
|
|
5115
5123
|
return /* @__PURE__ */ N(n, { ...e });
|
|
5116
5124
|
}
|
|
5117
|
-
return /* @__PURE__ */ N(
|
|
5125
|
+
return /* @__PURE__ */ N(vr[e.field.type] ?? mn, { ...e });
|
|
5118
5126
|
}
|
|
5119
5127
|
//#endregion
|
|
5120
5128
|
//#region src/lib/field-regions.ts
|
|
5121
|
-
var
|
|
5122
|
-
function
|
|
5123
|
-
return
|
|
5124
|
-
|
|
5129
|
+
var yr = /* @__PURE__ */ new Map();
|
|
5130
|
+
function br(e, t) {
|
|
5131
|
+
return yr.set(e, t), () => {
|
|
5132
|
+
yr.get(e) === t && yr.delete(e);
|
|
5125
5133
|
};
|
|
5126
5134
|
}
|
|
5127
|
-
function
|
|
5128
|
-
return
|
|
5135
|
+
function xr(e) {
|
|
5136
|
+
return yr.get(e);
|
|
5129
5137
|
}
|
|
5130
5138
|
//#endregion
|
|
5131
5139
|
//#region src/lib/ui-actions.ts
|
|
5132
|
-
function
|
|
5140
|
+
function Sr(e, t) {
|
|
5133
5141
|
return e.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (e, n) => {
|
|
5134
|
-
let r =
|
|
5142
|
+
let r = Cr(n, t);
|
|
5135
5143
|
return r == null ? "" : String(r);
|
|
5136
5144
|
});
|
|
5137
5145
|
}
|
|
5138
|
-
function
|
|
5146
|
+
function Cr(e, t) {
|
|
5139
5147
|
let n = e.split(".");
|
|
5140
5148
|
if (n.length < 2) return;
|
|
5141
5149
|
let [r, ...i] = n;
|
|
@@ -5144,46 +5152,46 @@ function Sr(e, t) {
|
|
|
5144
5152
|
}, t.row) : void 0;
|
|
5145
5153
|
if (r === "field" && i.length >= 2) {
|
|
5146
5154
|
let [e, t] = i;
|
|
5147
|
-
return
|
|
5155
|
+
return xr(e)?.getField(t);
|
|
5148
5156
|
}
|
|
5149
5157
|
if (r === "params") return t.params ? i.reduce((e, t) => {
|
|
5150
5158
|
if (e && typeof e == "object") return e[t];
|
|
5151
5159
|
}, t.params) : void 0;
|
|
5152
5160
|
}
|
|
5153
|
-
async function
|
|
5161
|
+
async function wr(e, t) {
|
|
5154
5162
|
for (let n of e) try {
|
|
5155
|
-
await
|
|
5163
|
+
await Tr(n, t);
|
|
5156
5164
|
} catch (e) {
|
|
5157
5165
|
let t = e instanceof Error ? e.message : String(e);
|
|
5158
5166
|
j.error(`ui_step failed: ${t}`);
|
|
5159
5167
|
return;
|
|
5160
5168
|
}
|
|
5161
5169
|
}
|
|
5162
|
-
async function
|
|
5170
|
+
async function Tr(e, t) {
|
|
5163
5171
|
if (e.copy_to_clipboard != null) {
|
|
5164
|
-
let n =
|
|
5172
|
+
let n = Sr(e.copy_to_clipboard, t);
|
|
5165
5173
|
await navigator.clipboard.writeText(n);
|
|
5166
5174
|
return;
|
|
5167
5175
|
}
|
|
5168
5176
|
if (e.set_field) {
|
|
5169
|
-
let { target: n, value: r } = e.set_field, { region: i, field: a } =
|
|
5177
|
+
let { target: n, value: r } = e.set_field, { region: i, field: a } = Er(n), o = xr(i);
|
|
5170
5178
|
if (!o) throw Error(`region "${i}" not registered`);
|
|
5171
|
-
o.setField(a,
|
|
5179
|
+
o.setField(a, Sr(r, t));
|
|
5172
5180
|
return;
|
|
5173
5181
|
}
|
|
5174
5182
|
if (e.focus_field) {
|
|
5175
|
-
let { region: t, field: n } =
|
|
5183
|
+
let { region: t, field: n } = Er(e.focus_field), r = xr(t);
|
|
5176
5184
|
if (!r) throw Error(`region "${t}" not registered`);
|
|
5177
5185
|
r.focusField(n);
|
|
5178
5186
|
return;
|
|
5179
5187
|
}
|
|
5180
5188
|
if (e.show_toast) {
|
|
5181
|
-
let n =
|
|
5189
|
+
let n = Sr(e.show_toast.message, t), r = e.show_toast.kind ?? "info";
|
|
5182
5190
|
r === "success" ? j.success(n) : r === "error" ? j.error(n) : j(n);
|
|
5183
5191
|
return;
|
|
5184
5192
|
}
|
|
5185
5193
|
}
|
|
5186
|
-
function
|
|
5194
|
+
function Er(e) {
|
|
5187
5195
|
let t = e.indexOf(".");
|
|
5188
5196
|
if (t <= 0) throw Error(`invalid path "${e}" (expected "region.field")`);
|
|
5189
5197
|
return {
|
|
@@ -5191,20 +5199,20 @@ function Tr(e) {
|
|
|
5191
5199
|
field: e.slice(t + 1)
|
|
5192
5200
|
};
|
|
5193
5201
|
}
|
|
5194
|
-
function
|
|
5202
|
+
function Dr(e) {
|
|
5195
5203
|
return !e.handler && !!e.ui_steps && e.ui_steps.length > 0;
|
|
5196
5204
|
}
|
|
5197
5205
|
//#endregion
|
|
5198
5206
|
//#region src/components/shared/ActionDialog.tsx
|
|
5199
|
-
var
|
|
5200
|
-
function
|
|
5207
|
+
var Or = /^\$row\.([a-zA-Z_][a-zA-Z0-9_]*)$/;
|
|
5208
|
+
function kr(e, t) {
|
|
5201
5209
|
if (typeof e != "string") return e ?? "";
|
|
5202
|
-
let n = e.match(
|
|
5210
|
+
let n = e.match(Or);
|
|
5203
5211
|
if (!n) return e;
|
|
5204
5212
|
let r = n[1];
|
|
5205
5213
|
return t && r in t ? t[r] ?? "" : (typeof console < "u" && console.warn && console.warn(`ActionDialog: prefill template ${e} could not be resolved; row missing or has no field '${r}'`), "");
|
|
5206
5214
|
}
|
|
5207
|
-
function
|
|
5215
|
+
function Ar(e) {
|
|
5208
5216
|
return {
|
|
5209
5217
|
type: e.type ?? "string",
|
|
5210
5218
|
required: e.required,
|
|
@@ -5217,16 +5225,16 @@ function kr(e) {
|
|
|
5217
5225
|
ref: e.ref ? { entity: e.ref } : void 0
|
|
5218
5226
|
};
|
|
5219
5227
|
}
|
|
5220
|
-
function
|
|
5221
|
-
return e.includes("{{") ?
|
|
5228
|
+
function jr(e, t) {
|
|
5229
|
+
return e.includes("{{") ? Sr(e, { params: t }) : e;
|
|
5222
5230
|
}
|
|
5223
|
-
var
|
|
5224
|
-
function
|
|
5231
|
+
var Mr = /\{\{\s*([^}]+?)\s*\}\}/g;
|
|
5232
|
+
function Nr(e, t) {
|
|
5225
5233
|
let n = `params.${t}`;
|
|
5226
|
-
for (let t of e.matchAll(
|
|
5234
|
+
for (let t of e.matchAll(Mr)) if (t[1] === n) return !0;
|
|
5227
5235
|
return !1;
|
|
5228
5236
|
}
|
|
5229
|
-
function
|
|
5237
|
+
function Pr({ param: e, value: t, onChange: n, statusGroups: r }) {
|
|
5230
5238
|
let i = d(() => {
|
|
5231
5239
|
let t = r ? Object.entries(r) : [];
|
|
5232
5240
|
return [{
|
|
@@ -5244,12 +5252,12 @@ function Nr({ param: e, value: t, onChange: n, statusGroups: r }) {
|
|
|
5244
5252
|
placeholder: "Select status group…"
|
|
5245
5253
|
});
|
|
5246
5254
|
}
|
|
5247
|
-
function
|
|
5255
|
+
function Fr({ param: e, value: t, onChange: n, statusGroups: r, formData: i }) {
|
|
5248
5256
|
let a = d(() => {
|
|
5249
5257
|
if (!r) return [];
|
|
5250
5258
|
let t = e.filter?.status_group;
|
|
5251
5259
|
if (t) {
|
|
5252
|
-
let e =
|
|
5260
|
+
let e = jr(t, i);
|
|
5253
5261
|
return e && r[e] ? r[e].statuses : [];
|
|
5254
5262
|
}
|
|
5255
5263
|
return Object.values(r).flatMap((e) => e.statuses);
|
|
@@ -5271,12 +5279,12 @@ function Pr({ param: e, value: t, onChange: n, statusGroups: r, formData: i }) {
|
|
|
5271
5279
|
placeholder: "Select status…"
|
|
5272
5280
|
});
|
|
5273
5281
|
}
|
|
5274
|
-
function
|
|
5282
|
+
function Ir({ open: e, onOpenChange: t, action: n, actionName: r, onSubmit: i, isPending: a, row: o }) {
|
|
5275
5283
|
let { data: c } = st(), l = n.resolved_params, u = n.resolved_hidden_defaults ?? {}, f = d(() => l ? Array.from(l) : [], [l]), m = d(() => {
|
|
5276
5284
|
if (!(!n.entity || !c)) return c.entities[n.entity]?.status_groups;
|
|
5277
5285
|
}, [n.entity, c]), [h, g] = p(s(() => {
|
|
5278
5286
|
let e = { ...u };
|
|
5279
|
-
for (let [t, n] of f) e[t] =
|
|
5287
|
+
for (let [t, n] of f) e[t] = kr(n.default, o);
|
|
5280
5288
|
return e;
|
|
5281
5289
|
}, [f, o])), _ = s((e, t) => {
|
|
5282
5290
|
g((n) => {
|
|
@@ -5288,7 +5296,7 @@ function Fr({ open: e, onOpenChange: t, action: n, actionName: r, onSubmit: i, i
|
|
|
5288
5296
|
for (let [t, n] of l) {
|
|
5289
5297
|
if (n.type !== "status") continue;
|
|
5290
5298
|
let i = n.filter?.status_group;
|
|
5291
|
-
i &&
|
|
5299
|
+
i && Nr(i, e) && (r[t] = "");
|
|
5292
5300
|
}
|
|
5293
5301
|
return r;
|
|
5294
5302
|
});
|
|
@@ -5389,20 +5397,20 @@ function Fr({ open: e, onOpenChange: t, action: n, actionName: r, onSubmit: i, i
|
|
|
5389
5397
|
},
|
|
5390
5398
|
children: f.map(([e, t]) => {
|
|
5391
5399
|
let n = X(t.display?.name) || e, r;
|
|
5392
|
-
return r = t.type === "status_group" ? /* @__PURE__ */ N(
|
|
5400
|
+
return r = t.type === "status_group" ? /* @__PURE__ */ N(Pr, {
|
|
5393
5401
|
param: t,
|
|
5394
5402
|
value: h[e],
|
|
5395
5403
|
onChange: (t) => _(e, t),
|
|
5396
5404
|
statusGroups: m,
|
|
5397
5405
|
formData: h
|
|
5398
|
-
}) : t.type === "status" ? /* @__PURE__ */ N(
|
|
5406
|
+
}) : t.type === "status" ? /* @__PURE__ */ N(Fr, {
|
|
5399
5407
|
param: t,
|
|
5400
5408
|
value: h[e],
|
|
5401
5409
|
onChange: (t) => _(e, t),
|
|
5402
5410
|
statusGroups: m,
|
|
5403
5411
|
formData: h
|
|
5404
5412
|
}) : $({
|
|
5405
|
-
field:
|
|
5413
|
+
field: Ar(t),
|
|
5406
5414
|
fieldName: e,
|
|
5407
5415
|
value: h[e],
|
|
5408
5416
|
mode: "edit",
|
|
@@ -5455,7 +5463,7 @@ function Fr({ open: e, onOpenChange: t, action: n, actionName: r, onSubmit: i, i
|
|
|
5455
5463
|
}
|
|
5456
5464
|
//#endregion
|
|
5457
5465
|
//#region src/components/shared/ActionRunner.tsx
|
|
5458
|
-
function
|
|
5466
|
+
function Lr(e) {
|
|
5459
5467
|
if (!e || typeof e != "object") return { kind: "success" };
|
|
5460
5468
|
let t = e, n = t.status, r = t.success?.length ?? 0, i = t.errors?.length ?? 0, a = t.skipped?.length ?? 0, o = t.errors?.[0]?.error;
|
|
5461
5469
|
if (n === "partial") {
|
|
@@ -5470,8 +5478,8 @@ function Ir(e) {
|
|
|
5470
5478
|
detail: "No items matched"
|
|
5471
5479
|
} : n === "accepted" ? { kind: "accepted" } : { kind: "success" };
|
|
5472
5480
|
}
|
|
5473
|
-
function
|
|
5474
|
-
if (e instanceof
|
|
5481
|
+
function Rr(e) {
|
|
5482
|
+
if (e instanceof Gn) {
|
|
5475
5483
|
let t = e.response.errors ?? [];
|
|
5476
5484
|
if (t.length === 1) return {
|
|
5477
5485
|
kind: "error",
|
|
@@ -5491,25 +5499,25 @@ function Lr(e) {
|
|
|
5491
5499
|
detail: e instanceof Error ? e.message : String(e)
|
|
5492
5500
|
};
|
|
5493
5501
|
}
|
|
5494
|
-
var
|
|
5495
|
-
function
|
|
5496
|
-
let e = c(
|
|
5502
|
+
var zr = r(null);
|
|
5503
|
+
function Br() {
|
|
5504
|
+
let e = c(zr);
|
|
5497
5505
|
if (!e) throw Error("useActionRunner must be used within <ActionRunnerProvider>");
|
|
5498
5506
|
return e;
|
|
5499
5507
|
}
|
|
5500
|
-
function
|
|
5508
|
+
function Vr(e) {
|
|
5501
5509
|
let t = {}, n = e.action?.resolved_hidden_defaults;
|
|
5502
5510
|
if (n) for (let [e, r] of Object.entries(n)) r !== void 0 && (t[e] = r);
|
|
5503
5511
|
return t;
|
|
5504
5512
|
}
|
|
5505
|
-
function
|
|
5513
|
+
function Hr({ children: e }) {
|
|
5506
5514
|
let t = x(), { data: n } = st(), [r, i] = p(null), a = s((e) => {
|
|
5507
5515
|
if (e?.progress_screen) return n?.screens[e.progress_screen]?.route;
|
|
5508
5516
|
}, [n?.screens]), o = s((e, n, r, i, o) => {
|
|
5509
5517
|
switch (i.kind) {
|
|
5510
5518
|
case "success":
|
|
5511
5519
|
if (n) {
|
|
5512
|
-
let n =
|
|
5520
|
+
let n = Ur(o), i = a(r);
|
|
5513
5521
|
j.success(`${e} started`, {
|
|
5514
5522
|
description: n ? `Job ${n} queued` : "Running in background",
|
|
5515
5523
|
...i ? { action: {
|
|
@@ -5520,7 +5528,7 @@ function Vr({ children: e }) {
|
|
|
5520
5528
|
} else j.success(`${e} complete`);
|
|
5521
5529
|
return;
|
|
5522
5530
|
case "accepted": {
|
|
5523
|
-
let n =
|
|
5531
|
+
let n = Ur(o), i = a(r);
|
|
5524
5532
|
j.success(`${e} started`, {
|
|
5525
5533
|
description: n ? `Job ${n} queued` : "Running in background",
|
|
5526
5534
|
...i ? { action: {
|
|
@@ -5544,9 +5552,9 @@ function Vr({ children: e }) {
|
|
|
5544
5552
|
let t = e.action, n = e.destructive ?? t?.destructive ?? !1, r = e.longRunning ?? t?.long_running ?? !1, a = e.title || X(t?.display?.name) || "Action", s = async (n) => {
|
|
5545
5553
|
try {
|
|
5546
5554
|
let i = await e.execute(n);
|
|
5547
|
-
o(a, r, t,
|
|
5555
|
+
o(a, r, t, Lr(i), i);
|
|
5548
5556
|
} catch (e) {
|
|
5549
|
-
o(a, r, t,
|
|
5557
|
+
o(a, r, t, Rr(e));
|
|
5550
5558
|
}
|
|
5551
5559
|
};
|
|
5552
5560
|
if (t?.resolved_params && t.resolved_params.length > 0) {
|
|
@@ -5569,7 +5577,7 @@ function Vr({ children: e }) {
|
|
|
5569
5577
|
});
|
|
5570
5578
|
return;
|
|
5571
5579
|
}
|
|
5572
|
-
s(
|
|
5580
|
+
s(Vr(e));
|
|
5573
5581
|
}, [o]), l = d(() => ({ run: c }), [c]), u = r?.opts.action, f = s(async (e) => {
|
|
5574
5582
|
if (!r) return;
|
|
5575
5583
|
let t = r.id, n = r, a = n.opts.action, s = n.opts.longRunning ?? a?.long_running ?? !1;
|
|
@@ -5578,10 +5586,10 @@ function Vr({ children: e }) {
|
|
|
5578
5586
|
pending: !0
|
|
5579
5587
|
} : e);
|
|
5580
5588
|
try {
|
|
5581
|
-
let r = await n.opts.execute(e), c =
|
|
5589
|
+
let r = await n.opts.execute(e), c = Lr(r);
|
|
5582
5590
|
o(n.title, s, a, c, r), c.kind !== "partial" && i((e) => e?.id === t ? null : e);
|
|
5583
5591
|
} catch (e) {
|
|
5584
|
-
o(n.title, s, a,
|
|
5592
|
+
o(n.title, s, a, Rr(e));
|
|
5585
5593
|
} finally {
|
|
5586
5594
|
i((e) => e?.id === t ? {
|
|
5587
5595
|
...e,
|
|
@@ -5589,11 +5597,11 @@ function Vr({ children: e }) {
|
|
|
5589
5597
|
} : e);
|
|
5590
5598
|
}
|
|
5591
5599
|
}, [r, o]);
|
|
5592
|
-
return /* @__PURE__ */ P(
|
|
5600
|
+
return /* @__PURE__ */ P(zr.Provider, {
|
|
5593
5601
|
value: l,
|
|
5594
5602
|
children: [
|
|
5595
5603
|
e,
|
|
5596
|
-
r?.kind === "params" && u && /* @__PURE__ */ N(
|
|
5604
|
+
r?.kind === "params" && u && /* @__PURE__ */ N(Ir, {
|
|
5597
5605
|
open: !0,
|
|
5598
5606
|
onOpenChange: (e) => {
|
|
5599
5607
|
e || i(null);
|
|
@@ -5603,16 +5611,16 @@ function Vr({ children: e }) {
|
|
|
5603
5611
|
onSubmit: f,
|
|
5604
5612
|
isPending: r.pending
|
|
5605
5613
|
}),
|
|
5606
|
-
r?.kind === "confirm" && /* @__PURE__ */ N(
|
|
5614
|
+
r?.kind === "confirm" && /* @__PURE__ */ N(Wr, {
|
|
5607
5615
|
state: r,
|
|
5608
5616
|
onClose: () => i(null),
|
|
5609
5617
|
onExecute: async (e) => {
|
|
5610
5618
|
let t = r.id, n = r, a = n.opts.action, s = n.opts.longRunning ?? a?.long_running ?? !1, c = !1;
|
|
5611
5619
|
try {
|
|
5612
|
-
let t = await n.opts.execute(e), r =
|
|
5620
|
+
let t = await n.opts.execute(e), r = Lr(t);
|
|
5613
5621
|
o(n.title, s, a, r, t), c = r.kind === "partial";
|
|
5614
5622
|
} catch (e) {
|
|
5615
|
-
o(n.title, s, a,
|
|
5623
|
+
o(n.title, s, a, Rr(e));
|
|
5616
5624
|
} finally {
|
|
5617
5625
|
c || i((e) => e?.id === t ? null : e);
|
|
5618
5626
|
}
|
|
@@ -5621,12 +5629,12 @@ function Vr({ children: e }) {
|
|
|
5621
5629
|
]
|
|
5622
5630
|
});
|
|
5623
5631
|
}
|
|
5624
|
-
function
|
|
5632
|
+
function Ur(e) {
|
|
5625
5633
|
if (!e || typeof e != "object") return;
|
|
5626
5634
|
let t = e, n = t.job_id ?? t.id;
|
|
5627
5635
|
return typeof n == "string" ? n : void 0;
|
|
5628
5636
|
}
|
|
5629
|
-
function
|
|
5637
|
+
function Wr({ state: e, onClose: t, onExecute: n }) {
|
|
5630
5638
|
let { title: r, opts: i } = e, [a, o] = p(!1), s = i.action, c = s?.handler ?? "action.confirm@v1", l = i.destructive ?? s?.destructive ?? !1;
|
|
5631
5639
|
return /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N("div", {
|
|
5632
5640
|
onClick: t,
|
|
@@ -5724,7 +5732,7 @@ function Ur({ state: e, onClose: t, onExecute: n }) {
|
|
|
5724
5732
|
onClick: async () => {
|
|
5725
5733
|
o(!0);
|
|
5726
5734
|
try {
|
|
5727
|
-
await n(
|
|
5735
|
+
await n(Vr(i));
|
|
5728
5736
|
} finally {
|
|
5729
5737
|
o(!1);
|
|
5730
5738
|
}
|
|
@@ -5737,7 +5745,7 @@ function Ur({ state: e, onClose: t, onExecute: n }) {
|
|
|
5737
5745
|
}
|
|
5738
5746
|
//#endregion
|
|
5739
5747
|
//#region src/api/events.ts
|
|
5740
|
-
async function*
|
|
5748
|
+
async function* Gr(e) {
|
|
5741
5749
|
let t = await fetch("/api/events", {
|
|
5742
5750
|
credentials: "include",
|
|
5743
5751
|
signal: e
|
|
@@ -5775,11 +5783,11 @@ async function* Wr(e) {
|
|
|
5775
5783
|
}
|
|
5776
5784
|
//#endregion
|
|
5777
5785
|
//#region src/hooks/useChildrenData.ts
|
|
5778
|
-
var
|
|
5779
|
-
function
|
|
5786
|
+
var Kr = "entity-children";
|
|
5787
|
+
function qr(e, t, n, r, i, a) {
|
|
5780
5788
|
return O({
|
|
5781
5789
|
queryKey: [
|
|
5782
|
-
|
|
5790
|
+
Kr,
|
|
5783
5791
|
e,
|
|
5784
5792
|
t,
|
|
5785
5793
|
n,
|
|
@@ -5799,8 +5807,8 @@ function Kr(e, t, n, r, i, a) {
|
|
|
5799
5807
|
}
|
|
5800
5808
|
//#endregion
|
|
5801
5809
|
//#region src/hooks/useSSE.ts
|
|
5802
|
-
var
|
|
5803
|
-
function
|
|
5810
|
+
var Jr = 3e4, Yr = 1e3, Xr = 50;
|
|
5811
|
+
function Zr(e, t) {
|
|
5804
5812
|
if (t.length === 0) return;
|
|
5805
5813
|
let n = /* @__PURE__ */ new Map();
|
|
5806
5814
|
for (let e of t) {
|
|
@@ -5812,21 +5820,21 @@ function Xr(e, t) {
|
|
|
5812
5820
|
return n[0] === "entity-children" && n[3] === t;
|
|
5813
5821
|
} }), r.mutated && e.invalidateQueries({ queryKey: ["entity-item", t] });
|
|
5814
5822
|
}
|
|
5815
|
-
function
|
|
5823
|
+
function Qr() {
|
|
5816
5824
|
let e = qt((e) => e.isAuthenticated), t = k(), n = f(null);
|
|
5817
5825
|
l(() => {
|
|
5818
5826
|
if (!e) return;
|
|
5819
5827
|
let r = !0, i = 0, a = [], o = null, s = () => {
|
|
5820
|
-
o = null, a.length !== 0 &&
|
|
5828
|
+
o = null, a.length !== 0 && Zr(t, a.splice(0, a.length));
|
|
5821
5829
|
}, c = () => {
|
|
5822
|
-
o === null && (o = setTimeout(s,
|
|
5830
|
+
o === null && (o = setTimeout(s, Xr));
|
|
5823
5831
|
};
|
|
5824
5832
|
async function l() {
|
|
5825
5833
|
for (; r;) {
|
|
5826
5834
|
let e = new AbortController();
|
|
5827
5835
|
n.current = e;
|
|
5828
5836
|
try {
|
|
5829
|
-
for await (let t of
|
|
5837
|
+
for await (let t of Gr(e.signal)) {
|
|
5830
5838
|
if (!r) break;
|
|
5831
5839
|
if (i = 0, t.type === "session_refresh") {
|
|
5832
5840
|
try {
|
|
@@ -5843,19 +5851,19 @@ function Zr() {
|
|
|
5843
5851
|
if (!r || e instanceof DOMException && e.name === "AbortError") break;
|
|
5844
5852
|
}
|
|
5845
5853
|
if (r) {
|
|
5846
|
-
let e = Math.min(
|
|
5854
|
+
let e = Math.min(Yr * 2 ** i, Jr), t = e * .5 * Math.random();
|
|
5847
5855
|
await new Promise((n) => setTimeout(n, e + t)), i++;
|
|
5848
5856
|
}
|
|
5849
5857
|
}
|
|
5850
5858
|
}
|
|
5851
5859
|
return l(), () => {
|
|
5852
|
-
r = !1, n.current?.abort(), o !== null && (clearTimeout(o), o = null), a.length > 0 &&
|
|
5860
|
+
r = !1, n.current?.abort(), o !== null && (clearTimeout(o), o = null), a.length > 0 && Zr(t, a.splice(0, a.length));
|
|
5853
5861
|
};
|
|
5854
5862
|
}, [e, t]);
|
|
5855
5863
|
}
|
|
5856
5864
|
//#endregion
|
|
5857
5865
|
//#region src/api/params.ts
|
|
5858
|
-
async function
|
|
5866
|
+
async function $r() {
|
|
5859
5867
|
let e = (await Z("/api/params/public")).data;
|
|
5860
5868
|
if (Array.isArray(e)) return { parameters: e };
|
|
5861
5869
|
let t = e ?? {};
|
|
@@ -5865,10 +5873,10 @@ async function Qr() {
|
|
|
5865
5873
|
branding: t.branding
|
|
5866
5874
|
};
|
|
5867
5875
|
}
|
|
5868
|
-
async function
|
|
5876
|
+
async function ei(e) {
|
|
5869
5877
|
return (await Z(`/api/params/${encodeURIComponent(e)}`)).data;
|
|
5870
5878
|
}
|
|
5871
|
-
async function
|
|
5879
|
+
async function ti(e, t, n) {
|
|
5872
5880
|
await Z("/api/data/user", {
|
|
5873
5881
|
method: "PATCH",
|
|
5874
5882
|
body: JSON.stringify([{
|
|
@@ -5882,29 +5890,29 @@ async function ei(e, t, n) {
|
|
|
5882
5890
|
}
|
|
5883
5891
|
//#endregion
|
|
5884
5892
|
//#region src/hooks/useParams.ts
|
|
5885
|
-
function
|
|
5893
|
+
function ni() {
|
|
5886
5894
|
return O({
|
|
5887
5895
|
queryKey: ["params-public"],
|
|
5888
|
-
queryFn:
|
|
5896
|
+
queryFn: $r,
|
|
5889
5897
|
staleTime: 300 * 1e3
|
|
5890
5898
|
});
|
|
5891
5899
|
}
|
|
5892
|
-
function
|
|
5900
|
+
function ri(e) {
|
|
5893
5901
|
return O({
|
|
5894
5902
|
queryKey: ["params", e],
|
|
5895
|
-
queryFn: () =>
|
|
5903
|
+
queryFn: () => ei(e),
|
|
5896
5904
|
enabled: !!e,
|
|
5897
5905
|
staleTime: 300 * 1e3
|
|
5898
5906
|
});
|
|
5899
5907
|
}
|
|
5900
5908
|
//#endregion
|
|
5901
5909
|
//#region src/components/layout/Layout.tsx
|
|
5902
|
-
var
|
|
5903
|
-
function
|
|
5904
|
-
let { isAuthenticated: e, isLoading: t, user: n, activeTenant: r } = qt(), i = x(), a = b(), { data: o } = st(), s = Q((e) => e.sidebar), c = Q((e) => e.tabsPosition), u = Q((e) => e.aiSurface), f = Q((e) => e.theme), m = Q((e) => e.set), h = Q((e) => e.hydrateFromParams), { data: g } =
|
|
5910
|
+
var ii = "default";
|
|
5911
|
+
function ai() {
|
|
5912
|
+
let { isAuthenticated: e, isLoading: t, user: n, activeTenant: r } = qt(), i = x(), a = b(), { data: o } = st(), s = Q((e) => e.sidebar), c = Q((e) => e.tabsPosition), u = Q((e) => e.aiSurface), f = Q((e) => e.theme), m = Q((e) => e.set), h = Q((e) => e.hydrateFromParams), { data: g } = ni(), v = jt((e) => e.tabs), y = jt((e) => e.activeTabId), S = jt((e) => e.closeTab), C = jt((e) => e.setScope), w = jt((e) => e.hydrate), [T, E] = p(ii), [D, O] = p(!1), [k, A] = p("default"), [j, M] = p(!1), F = u !== "off", I = u === "panel" || u === "both", ee = u === "command" || u === "both", L = (e = "default") => {
|
|
5905
5913
|
F && (A(e), O(!0));
|
|
5906
5914
|
};
|
|
5907
|
-
|
|
5915
|
+
Qr(), l(() => {
|
|
5908
5916
|
if (!t && !e) {
|
|
5909
5917
|
let e = a.pathname + a.search;
|
|
5910
5918
|
i(`/login${e && e !== "/" ? `?redirect=${encodeURIComponent(e)}` : ""}`, { replace: !0 });
|
|
@@ -5930,7 +5938,7 @@ function ii() {
|
|
|
5930
5938
|
h(e);
|
|
5931
5939
|
}, [g, h]), l(() => {
|
|
5932
5940
|
if (!o) return;
|
|
5933
|
-
let e =
|
|
5941
|
+
let e = oi(o.navigation, o.screens, a.pathname);
|
|
5934
5942
|
e && E(e);
|
|
5935
5943
|
}, [o, a.pathname]), l(() => {
|
|
5936
5944
|
let e = (e) => {
|
|
@@ -5946,7 +5954,7 @@ function ii() {
|
|
|
5946
5954
|
F,
|
|
5947
5955
|
I
|
|
5948
5956
|
]);
|
|
5949
|
-
let R = d(() => o ?
|
|
5957
|
+
let R = d(() => o ? si(o.navigation, o.screens, a.pathname, v, y, i) : [], [
|
|
5950
5958
|
o,
|
|
5951
5959
|
a.pathname,
|
|
5952
5960
|
v,
|
|
@@ -5992,7 +6000,7 @@ function ii() {
|
|
|
5992
6000
|
break;
|
|
5993
6001
|
}
|
|
5994
6002
|
};
|
|
5995
|
-
return /* @__PURE__ */ N(
|
|
6003
|
+
return /* @__PURE__ */ N(Hr, { children: /* @__PURE__ */ P("div", {
|
|
5996
6004
|
id: "app",
|
|
5997
6005
|
"data-sidebar": s,
|
|
5998
6006
|
style: { height: "100vh" },
|
|
@@ -6054,7 +6062,7 @@ function ii() {
|
|
|
6054
6062
|
]
|
|
6055
6063
|
}) });
|
|
6056
6064
|
}
|
|
6057
|
-
function
|
|
6065
|
+
function oi(e, t, n) {
|
|
6058
6066
|
let r = (e) => {
|
|
6059
6067
|
if (!e.screen) return !1;
|
|
6060
6068
|
let r = t[e.screen];
|
|
@@ -6071,11 +6079,11 @@ function ai(e, t, n) {
|
|
|
6071
6079
|
}
|
|
6072
6080
|
};
|
|
6073
6081
|
for (let t of e) {
|
|
6074
|
-
let e = i(t, t.area ||
|
|
6082
|
+
let e = i(t, t.area || ii);
|
|
6075
6083
|
if (e) return e;
|
|
6076
6084
|
}
|
|
6077
6085
|
}
|
|
6078
|
-
function
|
|
6086
|
+
function si(e, t, n, r, i, a) {
|
|
6079
6087
|
let o = (e, r) => {
|
|
6080
6088
|
if (e.screen) {
|
|
6081
6089
|
let i = t[e.screen];
|
|
@@ -6116,7 +6124,7 @@ function oi(e, t, n, r, i, a) {
|
|
|
6116
6124
|
}
|
|
6117
6125
|
//#endregion
|
|
6118
6126
|
//#region src/components/pages/auth/AuthShell.tsx
|
|
6119
|
-
function
|
|
6127
|
+
function ci(e) {
|
|
6120
6128
|
if (e) {
|
|
6121
6129
|
if (e.en) return e.en;
|
|
6122
6130
|
for (let t of Object.keys(e)) {
|
|
@@ -6125,27 +6133,27 @@ function si(e) {
|
|
|
6125
6133
|
}
|
|
6126
6134
|
}
|
|
6127
6135
|
}
|
|
6128
|
-
function
|
|
6136
|
+
function li(e) {
|
|
6129
6137
|
let t = {};
|
|
6130
6138
|
if (!e) return t;
|
|
6131
6139
|
for (let n of e) t[n.code] = n.value;
|
|
6132
6140
|
return t;
|
|
6133
6141
|
}
|
|
6134
|
-
var
|
|
6142
|
+
var ui = [
|
|
6135
6143
|
["SOC 2 · ISO 27001", "shield"],
|
|
6136
6144
|
["Multi-tenant · SSO", "tenant"],
|
|
6137
6145
|
["RBAC + ABAC", "users"],
|
|
6138
6146
|
["Full audit trail", "activity"]
|
|
6139
6147
|
];
|
|
6140
|
-
function
|
|
6141
|
-
let s = Q((e) => e.theme), c = Q((e) => e.set), u = Q((e) => e.hydrateFromParams), f = () => c("theme", s === "dark" ? "light" : "dark"), { data: p } =
|
|
6148
|
+
function di({ children: e, workspaceHost: t = "acme.declarion.app", tagline: n, subTagline: r, version: i, badges: a, brandName: o }) {
|
|
6149
|
+
let s = Q((e) => e.theme), c = Q((e) => e.set), u = Q((e) => e.hydrateFromParams), f = () => c("theme", s === "dark" ? "light" : "dark"), { data: p } = ni();
|
|
6142
6150
|
l(() => {
|
|
6143
|
-
p && u(
|
|
6151
|
+
p && u(li(p.parameters));
|
|
6144
6152
|
}, [p, u]);
|
|
6145
|
-
let m = p?.branding, h = o ?? m?.wordmark ?? m?.app_name ?? "Declarion", g = n ??
|
|
6153
|
+
let m = p?.branding, h = o ?? m?.wordmark ?? m?.app_name ?? "Declarion", g = n ?? ci(m?.auth_tagline) ?? "The declarative platform for enterprise apps.", _ = r ?? ci(m?.auth_subtagline) ?? "Ship ERP, TMS, WMS and custom back-offices in days - not quarters. YAML-first, AI-native, audit-ready from day one.", v = i ?? m?.version_label ?? "v4.2", y = d(() => {
|
|
6146
6154
|
if (a && a.length) return a;
|
|
6147
|
-
let e = (m?.auth_badges ?? []).map((e) =>
|
|
6148
|
-
return e.length ? e.slice(0, 4).map((e) => [e, "shield"]) :
|
|
6155
|
+
let e = (m?.auth_badges ?? []).map((e) => ci(e)).filter((e) => !!e);
|
|
6156
|
+
return e.length ? e.slice(0, 4).map((e) => [e, "shield"]) : ui;
|
|
6149
6157
|
}, [a, m?.auth_badges]);
|
|
6150
6158
|
return /* @__PURE__ */ P("div", {
|
|
6151
6159
|
style: {
|
|
@@ -6450,7 +6458,7 @@ function ui({ children: e, workspaceHost: t = "acme.declarion.app", tagline: n,
|
|
|
6450
6458
|
}
|
|
6451
6459
|
//#endregion
|
|
6452
6460
|
//#region src/components/pages/auth/icons.tsx
|
|
6453
|
-
function
|
|
6461
|
+
function fi({ size: e = 14 }) {
|
|
6454
6462
|
return /* @__PURE__ */ P("svg", {
|
|
6455
6463
|
width: e,
|
|
6456
6464
|
height: e,
|
|
@@ -6476,7 +6484,7 @@ function di({ size: e = 14 }) {
|
|
|
6476
6484
|
]
|
|
6477
6485
|
});
|
|
6478
6486
|
}
|
|
6479
|
-
function
|
|
6487
|
+
function pi({ size: e = 14 }) {
|
|
6480
6488
|
return /* @__PURE__ */ P("svg", {
|
|
6481
6489
|
width: e,
|
|
6482
6490
|
height: e,
|
|
@@ -6504,21 +6512,21 @@ function fi({ size: e = 14 }) {
|
|
|
6504
6512
|
}
|
|
6505
6513
|
//#endregion
|
|
6506
6514
|
//#region src/components/pages/auth/SignIn.tsx
|
|
6507
|
-
var
|
|
6515
|
+
var mi = {
|
|
6508
6516
|
google: {
|
|
6509
6517
|
label: "Continue with Google",
|
|
6510
|
-
icon: /* @__PURE__ */ N(
|
|
6518
|
+
icon: /* @__PURE__ */ N(fi, { size: 14 })
|
|
6511
6519
|
},
|
|
6512
6520
|
microsoft: {
|
|
6513
6521
|
label: "Continue with Microsoft",
|
|
6514
|
-
icon: /* @__PURE__ */ N(
|
|
6522
|
+
icon: /* @__PURE__ */ N(pi, { size: 14 })
|
|
6515
6523
|
},
|
|
6516
6524
|
azure: {
|
|
6517
6525
|
label: "Continue with Microsoft",
|
|
6518
|
-
icon: /* @__PURE__ */ N(
|
|
6526
|
+
icon: /* @__PURE__ */ N(pi, { size: 14 })
|
|
6519
6527
|
}
|
|
6520
6528
|
};
|
|
6521
|
-
function
|
|
6529
|
+
function hi() {
|
|
6522
6530
|
let e = x(), [t] = C(), { login: n, isLoginPending: r, isAuthenticated: i } = Jt(), [a, o] = p(""), [s, c] = p(""), u = t.get("redirect") || "/", d = u.startsWith("/") && !u.startsWith("//") ? u : "/", f = t.get("sso_error"), { data: m } = O({
|
|
6523
6531
|
queryKey: ["check-setup"],
|
|
6524
6532
|
queryFn: Rt
|
|
@@ -6544,7 +6552,7 @@ function mi() {
|
|
|
6544
6552
|
password: s
|
|
6545
6553
|
});
|
|
6546
6554
|
}
|
|
6547
|
-
return /* @__PURE__ */ N(
|
|
6555
|
+
return /* @__PURE__ */ N(di, { children: /* @__PURE__ */ P("form", {
|
|
6548
6556
|
onSubmit: _,
|
|
6549
6557
|
children: [
|
|
6550
6558
|
/* @__PURE__ */ N("div", {
|
|
@@ -6582,7 +6590,7 @@ function mi() {
|
|
|
6582
6590
|
marginBottom: 12
|
|
6583
6591
|
},
|
|
6584
6592
|
children: g.map((e) => {
|
|
6585
|
-
let t =
|
|
6593
|
+
let t = mi[e.slug.toLowerCase()] ?? {
|
|
6586
6594
|
label: `Continue with ${e.name}`,
|
|
6587
6595
|
icon: /* @__PURE__ */ N(B.shield, { size: 13 })
|
|
6588
6596
|
};
|
|
@@ -6715,7 +6723,7 @@ function mi() {
|
|
|
6715
6723
|
}
|
|
6716
6724
|
//#endregion
|
|
6717
6725
|
//#region src/components/pages/auth/SignUp.tsx
|
|
6718
|
-
function
|
|
6726
|
+
function gi() {
|
|
6719
6727
|
let e = x(), { signup: t, isSignupPending: n, isAuthenticated: r } = Jt(), [i, a] = p(""), [o, s] = p(""), [c, u] = p(""), [d, f] = p(""), [m, g] = p("acme"), [_, v] = p(""), [y, b] = p(!1), { data: S } = O({
|
|
6720
6728
|
queryKey: ["check-setup"],
|
|
6721
6729
|
queryFn: Rt
|
|
@@ -6732,7 +6740,7 @@ function hi() {
|
|
|
6732
6740
|
displayName: [i, o].filter(Boolean).join(" ") || c
|
|
6733
6741
|
});
|
|
6734
6742
|
}
|
|
6735
|
-
return /* @__PURE__ */ N(
|
|
6743
|
+
return /* @__PURE__ */ N(di, { children: /* @__PURE__ */ P("form", {
|
|
6736
6744
|
onSubmit: C,
|
|
6737
6745
|
children: [
|
|
6738
6746
|
/* @__PURE__ */ N("div", {
|
|
@@ -6903,9 +6911,9 @@ function hi() {
|
|
|
6903
6911
|
}
|
|
6904
6912
|
//#endregion
|
|
6905
6913
|
//#region src/components/pages/auth/Forgot.tsx
|
|
6906
|
-
function
|
|
6914
|
+
function _i() {
|
|
6907
6915
|
let [e, t] = p(""), [n, r] = p(!1);
|
|
6908
|
-
return /* @__PURE__ */ N(
|
|
6916
|
+
return /* @__PURE__ */ N(di, { children: /* @__PURE__ */ P("div", { children: [
|
|
6909
6917
|
/* @__PURE__ */ N("div", {
|
|
6910
6918
|
style: {
|
|
6911
6919
|
fontSize: 10.5,
|
|
@@ -6985,7 +6993,7 @@ function gi() {
|
|
|
6985
6993
|
}
|
|
6986
6994
|
//#endregion
|
|
6987
6995
|
//#region src/components/pages/auth/TwoFA.tsx
|
|
6988
|
-
function
|
|
6996
|
+
function vi() {
|
|
6989
6997
|
let e = x(), t = f([]);
|
|
6990
6998
|
function n(e) {
|
|
6991
6999
|
t.current[e]?.focus(), t.current[e]?.select();
|
|
@@ -6997,7 +7005,7 @@ function _i() {
|
|
|
6997
7005
|
function i(e, t) {
|
|
6998
7006
|
t.key === "Backspace" && !t.target.value && e > 0 && n(e - 1);
|
|
6999
7007
|
}
|
|
7000
|
-
return /* @__PURE__ */ N(
|
|
7008
|
+
return /* @__PURE__ */ N(di, { children: /* @__PURE__ */ P("div", { children: [
|
|
7001
7009
|
/* @__PURE__ */ N("div", {
|
|
7002
7010
|
style: {
|
|
7003
7011
|
fontSize: 10.5,
|
|
@@ -7099,7 +7107,7 @@ function _i() {
|
|
|
7099
7107
|
}
|
|
7100
7108
|
//#endregion
|
|
7101
7109
|
//#region src/components/pages/SSOCallbackPage.tsx
|
|
7102
|
-
function
|
|
7110
|
+
function yi() {
|
|
7103
7111
|
let e = x(), [t] = C(), { setUser: n, setTenants: r } = qt(), i = k();
|
|
7104
7112
|
return l(() => {
|
|
7105
7113
|
let a = t.get("redirect") || "/", o = a.startsWith("/") && !a.startsWith("//") ? a : "/";
|
|
@@ -7123,7 +7131,7 @@ function vi() {
|
|
|
7123
7131
|
}
|
|
7124
7132
|
//#endregion
|
|
7125
7133
|
//#region src/components/pages/NotFoundPage.tsx
|
|
7126
|
-
function
|
|
7134
|
+
function bi() {
|
|
7127
7135
|
let e = x();
|
|
7128
7136
|
return /* @__PURE__ */ N("div", {
|
|
7129
7137
|
style: {
|
|
@@ -7165,7 +7173,7 @@ function yi() {
|
|
|
7165
7173
|
}
|
|
7166
7174
|
//#endregion
|
|
7167
7175
|
//#region src/components/shared/ChangePasswordDialog.tsx
|
|
7168
|
-
function
|
|
7176
|
+
function xi({ open: e, onClose: t, onSubmit: n }) {
|
|
7169
7177
|
let [r, i] = p(""), [a, o] = p(""), [s, c] = p(""), [l, u] = p(!1), [d, f] = p(null);
|
|
7170
7178
|
if (!e) return null;
|
|
7171
7179
|
let m = () => {
|
|
@@ -7341,7 +7349,7 @@ function bi({ open: e, onClose: t, onSubmit: n }) {
|
|
|
7341
7349
|
}
|
|
7342
7350
|
//#endregion
|
|
7343
7351
|
//#region src/components/pages/profile/Profile.tsx
|
|
7344
|
-
function
|
|
7352
|
+
function Si() {
|
|
7345
7353
|
let e = x(), t = qt((e) => e.user), n = qt((e) => e.activeTenant), [r, i] = p(!1), [a, o] = p({
|
|
7346
7354
|
email: !0,
|
|
7347
7355
|
inapp: !0,
|
|
@@ -7479,7 +7487,7 @@ function xi() {
|
|
|
7479
7487
|
}),
|
|
7480
7488
|
/* @__PURE__ */ N(G, {
|
|
7481
7489
|
label: "Timezone",
|
|
7482
|
-
children:
|
|
7490
|
+
children: wi()
|
|
7483
7491
|
}),
|
|
7484
7492
|
/* @__PURE__ */ N(G, {
|
|
7485
7493
|
label: "Language",
|
|
@@ -7505,7 +7513,7 @@ function xi() {
|
|
|
7505
7513
|
gap: 10
|
|
7506
7514
|
},
|
|
7507
7515
|
children: [
|
|
7508
|
-
/* @__PURE__ */ N(
|
|
7516
|
+
/* @__PURE__ */ N(Ci, {
|
|
7509
7517
|
icon: /* @__PURE__ */ N(B.key, { size: 13 }),
|
|
7510
7518
|
label: "Password",
|
|
7511
7519
|
hint: "Update at any time",
|
|
@@ -7515,7 +7523,7 @@ function xi() {
|
|
|
7515
7523
|
children: "Change"
|
|
7516
7524
|
})
|
|
7517
7525
|
}),
|
|
7518
|
-
/* @__PURE__ */ N(
|
|
7526
|
+
/* @__PURE__ */ N(Ci, {
|
|
7519
7527
|
icon: /* @__PURE__ */ N(B.shield, { size: 13 }),
|
|
7520
7528
|
label: "Two-factor authentication",
|
|
7521
7529
|
hint: "Authenticator app recommended",
|
|
@@ -7525,7 +7533,7 @@ function xi() {
|
|
|
7525
7533
|
children: "Not set up"
|
|
7526
7534
|
})
|
|
7527
7535
|
}),
|
|
7528
|
-
/* @__PURE__ */ N(
|
|
7536
|
+
/* @__PURE__ */ N(Ci, {
|
|
7529
7537
|
icon: /* @__PURE__ */ N(B.device, { size: 13 }),
|
|
7530
7538
|
label: "Trusted devices",
|
|
7531
7539
|
hint: "Sign-in sessions by device",
|
|
@@ -7535,7 +7543,7 @@ function xi() {
|
|
|
7535
7543
|
children: "Manage"
|
|
7536
7544
|
})
|
|
7537
7545
|
}),
|
|
7538
|
-
/* @__PURE__ */ N(
|
|
7546
|
+
/* @__PURE__ */ N(Ci, {
|
|
7539
7547
|
icon: /* @__PURE__ */ N(B.activity, { size: 13 }),
|
|
7540
7548
|
label: "Sign-in history",
|
|
7541
7549
|
hint: "Audit trail of recent logins",
|
|
@@ -7686,7 +7694,7 @@ function xi() {
|
|
|
7686
7694
|
]
|
|
7687
7695
|
})
|
|
7688
7696
|
]
|
|
7689
|
-
}), /* @__PURE__ */ N(
|
|
7697
|
+
}), /* @__PURE__ */ N(xi, {
|
|
7690
7698
|
open: r,
|
|
7691
7699
|
onClose: () => i(!1),
|
|
7692
7700
|
onSubmit: async () => {
|
|
@@ -7695,7 +7703,7 @@ function xi() {
|
|
|
7695
7703
|
})]
|
|
7696
7704
|
});
|
|
7697
7705
|
}
|
|
7698
|
-
function
|
|
7706
|
+
function Ci({ icon: e, label: t, hint: n, action: r }) {
|
|
7699
7707
|
return /* @__PURE__ */ P("div", {
|
|
7700
7708
|
style: {
|
|
7701
7709
|
display: "flex",
|
|
@@ -7741,7 +7749,7 @@ function Si({ icon: e, label: t, hint: n, action: r }) {
|
|
|
7741
7749
|
]
|
|
7742
7750
|
});
|
|
7743
7751
|
}
|
|
7744
|
-
function
|
|
7752
|
+
function wi() {
|
|
7745
7753
|
try {
|
|
7746
7754
|
return Intl.DateTimeFormat().resolvedOptions().timeZone || "—";
|
|
7747
7755
|
} catch {
|
|
@@ -7750,13 +7758,13 @@ function Ci() {
|
|
|
7750
7758
|
}
|
|
7751
7759
|
//#endregion
|
|
7752
7760
|
//#region src/components/pages/profile/Preferences.tsx
|
|
7753
|
-
var
|
|
7761
|
+
var Ti = {
|
|
7754
7762
|
theme: "ui_theme",
|
|
7755
7763
|
accent: "ui_accent",
|
|
7756
7764
|
density: "ui_density",
|
|
7757
7765
|
radius: "ui_radius",
|
|
7758
7766
|
zebra: "ui_zebra_rows"
|
|
7759
|
-
},
|
|
7767
|
+
}, Ei = [
|
|
7760
7768
|
{
|
|
7761
7769
|
id: "violet",
|
|
7762
7770
|
c: "#5B5BD6"
|
|
@@ -7777,11 +7785,11 @@ var wi = {
|
|
|
7777
7785
|
id: "rose",
|
|
7778
7786
|
c: "#BE123C"
|
|
7779
7787
|
}
|
|
7780
|
-
],
|
|
7788
|
+
], Di = [
|
|
7781
7789
|
"compact",
|
|
7782
7790
|
"comfortable",
|
|
7783
7791
|
"cozy"
|
|
7784
|
-
],
|
|
7792
|
+
], Oi = [
|
|
7785
7793
|
["Command palette", "⌘ K"],
|
|
7786
7794
|
["Toggle AI assistant", "⌘ /"],
|
|
7787
7795
|
["Collapse sidebar", "⌘ B"],
|
|
@@ -7789,11 +7797,11 @@ var wi = {
|
|
|
7789
7797
|
["Quick search", "/"],
|
|
7790
7798
|
["Escape / close", "Esc"]
|
|
7791
7799
|
];
|
|
7792
|
-
function
|
|
7800
|
+
function ki() {
|
|
7793
7801
|
let e = Q((e) => e.theme), t = Q((e) => e.accent), n = Q((e) => e.density), r = Q((e) => e.radius), i = Q((e) => e.zebra), a = Q((e) => e.set), o = qt((e) => e.user?.id), s = (e, t) => {
|
|
7794
7802
|
if (a(e, t), !o) return;
|
|
7795
|
-
let n =
|
|
7796
|
-
n &&
|
|
7803
|
+
let n = Ti[e];
|
|
7804
|
+
n && ti(o, n, t).catch((t) => {
|
|
7797
7805
|
j.error(`Could not save ${e}`, { description: t.message });
|
|
7798
7806
|
});
|
|
7799
7807
|
};
|
|
@@ -7847,7 +7855,7 @@ function Oi() {
|
|
|
7847
7855
|
gap: 12
|
|
7848
7856
|
},
|
|
7849
7857
|
children: [
|
|
7850
|
-
/* @__PURE__ */ N(
|
|
7858
|
+
/* @__PURE__ */ N(Ai, {
|
|
7851
7859
|
label: "Theme",
|
|
7852
7860
|
hint: "Pick light or dark (system sync coming soon)",
|
|
7853
7861
|
children: /* @__PURE__ */ N("div", {
|
|
@@ -7855,14 +7863,14 @@ function Oi() {
|
|
|
7855
7863
|
display: "flex",
|
|
7856
7864
|
gap: 6
|
|
7857
7865
|
},
|
|
7858
|
-
children: [["light", "Light"], ["dark", "Dark"]].map(([t, n]) => /* @__PURE__ */ N(
|
|
7866
|
+
children: [["light", "Light"], ["dark", "Dark"]].map(([t, n]) => /* @__PURE__ */ N(ji, {
|
|
7859
7867
|
active: e === t,
|
|
7860
7868
|
onClick: () => s("theme", t),
|
|
7861
7869
|
children: n
|
|
7862
7870
|
}, t))
|
|
7863
7871
|
})
|
|
7864
7872
|
}),
|
|
7865
|
-
/* @__PURE__ */ N(
|
|
7873
|
+
/* @__PURE__ */ N(Ai, {
|
|
7866
7874
|
label: "Accent color",
|
|
7867
7875
|
hint: "Your personal accent across the app",
|
|
7868
7876
|
children: /* @__PURE__ */ N("div", {
|
|
@@ -7870,7 +7878,7 @@ function Oi() {
|
|
|
7870
7878
|
display: "flex",
|
|
7871
7879
|
gap: 8
|
|
7872
7880
|
},
|
|
7873
|
-
children:
|
|
7881
|
+
children: Ei.map((e) => /* @__PURE__ */ N("button", {
|
|
7874
7882
|
onClick: () => s("accent", e.id),
|
|
7875
7883
|
"aria-label": `Accent ${e.id}`,
|
|
7876
7884
|
style: {
|
|
@@ -7884,7 +7892,7 @@ function Oi() {
|
|
|
7884
7892
|
}, e.id))
|
|
7885
7893
|
})
|
|
7886
7894
|
}),
|
|
7887
|
-
/* @__PURE__ */ N(
|
|
7895
|
+
/* @__PURE__ */ N(Ai, {
|
|
7888
7896
|
label: "Density",
|
|
7889
7897
|
hint: "Compact saves space; cozy is easier on the eyes",
|
|
7890
7898
|
children: /* @__PURE__ */ N("div", {
|
|
@@ -7892,7 +7900,7 @@ function Oi() {
|
|
|
7892
7900
|
display: "flex",
|
|
7893
7901
|
gap: 6
|
|
7894
7902
|
},
|
|
7895
|
-
children:
|
|
7903
|
+
children: Di.map((e) => /* @__PURE__ */ N(ji, {
|
|
7896
7904
|
active: n === e,
|
|
7897
7905
|
onClick: () => s("density", e),
|
|
7898
7906
|
capitalize: !0,
|
|
@@ -7900,7 +7908,7 @@ function Oi() {
|
|
|
7900
7908
|
}, e))
|
|
7901
7909
|
})
|
|
7902
7910
|
}),
|
|
7903
|
-
/* @__PURE__ */ P(
|
|
7911
|
+
/* @__PURE__ */ P(Ai, {
|
|
7904
7912
|
label: "Border radius",
|
|
7905
7913
|
children: [/* @__PURE__ */ N("input", {
|
|
7906
7914
|
type: "range",
|
|
@@ -7919,7 +7927,7 @@ function Oi() {
|
|
|
7919
7927
|
children: [r, "px"]
|
|
7920
7928
|
})]
|
|
7921
7929
|
}),
|
|
7922
|
-
/* @__PURE__ */ N(
|
|
7930
|
+
/* @__PURE__ */ N(Ai, {
|
|
7923
7931
|
label: "Zebra rows",
|
|
7924
7932
|
hint: "Alternating row backgrounds on tables",
|
|
7925
7933
|
children: /* @__PURE__ */ N(Ce, {
|
|
@@ -7940,7 +7948,7 @@ function Oi() {
|
|
|
7940
7948
|
gridTemplateColumns: "1fr 1fr",
|
|
7941
7949
|
gap: 8
|
|
7942
7950
|
},
|
|
7943
|
-
children:
|
|
7951
|
+
children: Oi.map(([e, t]) => /* @__PURE__ */ P("div", {
|
|
7944
7952
|
style: {
|
|
7945
7953
|
display: "flex",
|
|
7946
7954
|
alignItems: "center",
|
|
@@ -7961,7 +7969,7 @@ function Oi() {
|
|
|
7961
7969
|
})
|
|
7962
7970
|
});
|
|
7963
7971
|
}
|
|
7964
|
-
function
|
|
7972
|
+
function Ai({ label: e, hint: t, children: n }) {
|
|
7965
7973
|
return /* @__PURE__ */ P("div", {
|
|
7966
7974
|
style: {
|
|
7967
7975
|
display: "flex",
|
|
@@ -7998,7 +8006,7 @@ function ki({ label: e, hint: t, children: n }) {
|
|
|
7998
8006
|
})]
|
|
7999
8007
|
});
|
|
8000
8008
|
}
|
|
8001
|
-
function
|
|
8009
|
+
function ji({ active: e, onClick: t, children: n, capitalize: r }) {
|
|
8002
8010
|
return /* @__PURE__ */ N("button", {
|
|
8003
8011
|
onClick: t,
|
|
8004
8012
|
style: {
|
|
@@ -8016,7 +8024,7 @@ function Ai({ active: e, onClick: t, children: n, capitalize: r }) {
|
|
|
8016
8024
|
}
|
|
8017
8025
|
//#endregion
|
|
8018
8026
|
//#region src/components/pages/AdminCatalogPage.tsx
|
|
8019
|
-
function
|
|
8027
|
+
function Mi() {
|
|
8020
8028
|
let { data: e } = st(), [t, n] = p("handlers");
|
|
8021
8029
|
return e ? /* @__PURE__ */ P("div", {
|
|
8022
8030
|
style: {
|
|
@@ -8067,11 +8075,11 @@ function ji() {
|
|
|
8067
8075
|
overflowY: "auto",
|
|
8068
8076
|
padding: "0 20px 20px"
|
|
8069
8077
|
},
|
|
8070
|
-
children: [t === "handlers" && /* @__PURE__ */ N(
|
|
8078
|
+
children: [t === "handlers" && /* @__PURE__ */ N(Ni, { schema: e }), t === "actions" && /* @__PURE__ */ N(Ii, { schema: e })]
|
|
8071
8079
|
})]
|
|
8072
8080
|
}) : null;
|
|
8073
8081
|
}
|
|
8074
|
-
function
|
|
8082
|
+
function Ni({ schema: e }) {
|
|
8075
8083
|
let t = d(() => {
|
|
8076
8084
|
let t = [];
|
|
8077
8085
|
if (e.handlers) for (let [n, r] of Object.entries(e.handlers)) t.push({
|
|
@@ -8104,7 +8112,7 @@ function Mi({ schema: e }) {
|
|
|
8104
8112
|
flexDirection: "column",
|
|
8105
8113
|
gap: 8
|
|
8106
8114
|
},
|
|
8107
|
-
children: t.map(({ code: e, handler: t, entity: n }) => /* @__PURE__ */ N(
|
|
8115
|
+
children: t.map(({ code: e, handler: t, entity: n }) => /* @__PURE__ */ N(Pi, {
|
|
8108
8116
|
code: e,
|
|
8109
8117
|
handler: t,
|
|
8110
8118
|
entity: n
|
|
@@ -8112,7 +8120,7 @@ function Mi({ schema: e }) {
|
|
|
8112
8120
|
})]
|
|
8113
8121
|
});
|
|
8114
8122
|
}
|
|
8115
|
-
function
|
|
8123
|
+
function Pi({ code: e, handler: t, entity: n }) {
|
|
8116
8124
|
let [r, i] = p(!1), a = t.display?.name ? X(t.display.name) : e;
|
|
8117
8125
|
return /* @__PURE__ */ P("div", {
|
|
8118
8126
|
style: {
|
|
@@ -8208,7 +8216,7 @@ function Ni({ code: e, handler: t, entity: n }) {
|
|
|
8208
8216
|
},
|
|
8209
8217
|
children: (t.params?.names() ?? []).map((e) => {
|
|
8210
8218
|
let n = t.params.get(e);
|
|
8211
|
-
return n ? /* @__PURE__ */ N(
|
|
8219
|
+
return n ? /* @__PURE__ */ N(Fi, {
|
|
8212
8220
|
code: e,
|
|
8213
8221
|
param: n
|
|
8214
8222
|
}, e) : null;
|
|
@@ -8217,7 +8225,7 @@ function Ni({ code: e, handler: t, entity: n }) {
|
|
|
8217
8225
|
})]
|
|
8218
8226
|
});
|
|
8219
8227
|
}
|
|
8220
|
-
function
|
|
8228
|
+
function Fi({ code: e, param: t }) {
|
|
8221
8229
|
let n = t.display?.name ? X(t.display.name) : void 0;
|
|
8222
8230
|
return /* @__PURE__ */ P("div", {
|
|
8223
8231
|
style: {
|
|
@@ -8269,7 +8277,7 @@ function Pi({ code: e, param: t }) {
|
|
|
8269
8277
|
]
|
|
8270
8278
|
});
|
|
8271
8279
|
}
|
|
8272
|
-
function
|
|
8280
|
+
function Ii({ schema: e }) {
|
|
8273
8281
|
let t = d(() => {
|
|
8274
8282
|
let t = [];
|
|
8275
8283
|
if (e.actions) for (let [n, r] of Object.entries(e.actions)) t.push({
|
|
@@ -8317,14 +8325,14 @@ function Fi({ schema: e }) {
|
|
|
8317
8325
|
flexDirection: "column",
|
|
8318
8326
|
gap: 6
|
|
8319
8327
|
},
|
|
8320
|
-
children: t.map(({ code: e, action: t }) => /* @__PURE__ */ N(
|
|
8328
|
+
children: t.map(({ code: e, action: t }) => /* @__PURE__ */ N(Li, {
|
|
8321
8329
|
code: e,
|
|
8322
8330
|
action: t
|
|
8323
8331
|
}, e))
|
|
8324
8332
|
})] }, e))]
|
|
8325
8333
|
});
|
|
8326
8334
|
}
|
|
8327
|
-
function
|
|
8335
|
+
function Li({ code: e, action: t }) {
|
|
8328
8336
|
let n = X(t.display?.name);
|
|
8329
8337
|
return /* @__PURE__ */ P("div", {
|
|
8330
8338
|
style: {
|
|
@@ -8400,10 +8408,10 @@ function Ii({ code: e, action: t }) {
|
|
|
8400
8408
|
}
|
|
8401
8409
|
//#endregion
|
|
8402
8410
|
//#region src/hooks/useMutations.ts
|
|
8403
|
-
function
|
|
8411
|
+
function Ri(e) {
|
|
8404
8412
|
let t = k();
|
|
8405
8413
|
return D({
|
|
8406
|
-
mutationFn: (t) =>
|
|
8414
|
+
mutationFn: (t) => Vn(e, t),
|
|
8407
8415
|
onSuccess: () => {
|
|
8408
8416
|
t.invalidateQueries({ queryKey: ["entity-data", e] }), j.success("Record created");
|
|
8409
8417
|
},
|
|
@@ -8412,22 +8420,22 @@ function Li(e) {
|
|
|
8412
8420
|
}
|
|
8413
8421
|
});
|
|
8414
8422
|
}
|
|
8415
|
-
function
|
|
8423
|
+
function zi(e) {
|
|
8416
8424
|
let t = k();
|
|
8417
8425
|
return D({
|
|
8418
|
-
mutationFn: ({ pkValues: t, data: n }) =>
|
|
8426
|
+
mutationFn: ({ pkValues: t, data: n }) => Hn(e, t, n),
|
|
8419
8427
|
onSuccess: (n, r) => {
|
|
8420
|
-
t.invalidateQueries({ queryKey: ["entity-data", e] }), t.invalidateQueries({ queryKey: ["entity-item", e] }), t.invalidateQueries({ queryKey: [
|
|
8428
|
+
t.invalidateQueries({ queryKey: ["entity-data", e] }), t.invalidateQueries({ queryKey: ["entity-item", e] }), t.invalidateQueries({ queryKey: [Kr, e] }), t.invalidateQueries({ queryKey: ["object-status", e] }), t.invalidateQueries({ queryKey: ["object-properties", e] }), j.success("Record updated");
|
|
8421
8429
|
},
|
|
8422
8430
|
onError: (e) => {
|
|
8423
8431
|
j.error(e.message);
|
|
8424
8432
|
}
|
|
8425
8433
|
});
|
|
8426
8434
|
}
|
|
8427
|
-
function
|
|
8435
|
+
function Bi(e) {
|
|
8428
8436
|
let t = k();
|
|
8429
8437
|
return D({
|
|
8430
|
-
mutationFn: (t) =>
|
|
8438
|
+
mutationFn: (t) => Un(e, t),
|
|
8431
8439
|
onSuccess: (n, r) => {
|
|
8432
8440
|
t.invalidateQueries({ queryKey: ["entity-data", e] }), t.invalidateQueries({ queryKey: ["entity-item", e] }), j.success("Record deleted");
|
|
8433
8441
|
},
|
|
@@ -8436,10 +8444,10 @@ function zi(e) {
|
|
|
8436
8444
|
}
|
|
8437
8445
|
});
|
|
8438
8446
|
}
|
|
8439
|
-
function
|
|
8447
|
+
function Vi(e) {
|
|
8440
8448
|
let t = k();
|
|
8441
8449
|
return D({
|
|
8442
|
-
mutationFn: (t) =>
|
|
8450
|
+
mutationFn: (t) => Wn(e, t),
|
|
8443
8451
|
onSuccess: () => {
|
|
8444
8452
|
t.invalidateQueries({ queryKey: ["entity-data", e] }), t.invalidateQueries({ queryKey: ["entity-item", e] }), t.invalidateQueries({ queryKey: ["object-status", e] }), t.invalidateQueries({ queryKey: ["object-properties", e] }), j.success("Record restored");
|
|
8445
8453
|
},
|
|
@@ -8448,16 +8456,16 @@ function Bi(e) {
|
|
|
8448
8456
|
}
|
|
8449
8457
|
});
|
|
8450
8458
|
}
|
|
8451
|
-
function
|
|
8459
|
+
function Hi(e) {
|
|
8452
8460
|
let t = k();
|
|
8453
8461
|
return D({
|
|
8454
8462
|
mutationFn: async ({ actionCode: e, body: t }) => {
|
|
8455
|
-
let n = await
|
|
8463
|
+
let n = await Jn(e, t);
|
|
8456
8464
|
if (n.status === "error") throw Error("Action failed for all items");
|
|
8457
8465
|
return n;
|
|
8458
8466
|
},
|
|
8459
8467
|
onSuccess: (n) => {
|
|
8460
|
-
e && (t.invalidateQueries({ queryKey: ["entity-data", e] }), t.invalidateQueries({ queryKey: ["entity-item", e] }), t.invalidateQueries({ queryKey: [
|
|
8468
|
+
e && (t.invalidateQueries({ queryKey: ["entity-data", e] }), t.invalidateQueries({ queryKey: ["entity-item", e] }), t.invalidateQueries({ queryKey: [Kr, e] }), t.invalidateQueries({ queryKey: ["object-status", e] }), t.invalidateQueries({ queryKey: ["object-properties", e] })), n.status === "accepted" ? j.success("Action started - check audit for progress") : n.status === "partial" ? j.warning("Action partially completed - some items failed or were skipped") : j.success("Action executed");
|
|
8461
8469
|
},
|
|
8462
8470
|
onError: (e) => {
|
|
8463
8471
|
j.error(e.message);
|
|
@@ -8466,7 +8474,7 @@ function Vi(e) {
|
|
|
8466
8474
|
}
|
|
8467
8475
|
//#endregion
|
|
8468
8476
|
//#region src/hooks/useDebounce.ts
|
|
8469
|
-
function
|
|
8477
|
+
function Ui(e, t) {
|
|
8470
8478
|
let [n, r] = p(e);
|
|
8471
8479
|
return l(() => {
|
|
8472
8480
|
let n = setTimeout(() => r(e), t);
|
|
@@ -8475,7 +8483,7 @@ function Hi(e, t) {
|
|
|
8475
8483
|
}
|
|
8476
8484
|
//#endregion
|
|
8477
8485
|
//#region src/components/shared/EmptyState.tsx
|
|
8478
|
-
function
|
|
8486
|
+
function Wi({ icon: e, title: t, description: n, action: r }) {
|
|
8479
8487
|
return /* @__PURE__ */ P("div", {
|
|
8480
8488
|
style: {
|
|
8481
8489
|
display: "flex",
|
|
@@ -8527,21 +8535,21 @@ function Ui({ icon: e, title: t, description: n, action: r }) {
|
|
|
8527
8535
|
}
|
|
8528
8536
|
//#endregion
|
|
8529
8537
|
//#region src/components/shared/LoadingSkeleton.tsx
|
|
8530
|
-
var
|
|
8538
|
+
var Gi = {
|
|
8531
8539
|
display: "block",
|
|
8532
8540
|
background: "linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 40%, var(--surface-3) 80%)",
|
|
8533
8541
|
backgroundSize: "200% 100%",
|
|
8534
8542
|
borderRadius: 6,
|
|
8535
8543
|
animation: "declarion-shimmer 1.2s ease-in-out infinite"
|
|
8536
8544
|
};
|
|
8537
|
-
function
|
|
8545
|
+
function Ki({ height: e, width: t }) {
|
|
8538
8546
|
return /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N("style", { children: "@keyframes declarion-shimmer{from{background-position:200% 0}to{background-position:-200% 0}}" }), /* @__PURE__ */ N("span", { style: {
|
|
8539
|
-
...
|
|
8547
|
+
...Gi,
|
|
8540
8548
|
height: e,
|
|
8541
8549
|
width: t ?? "100%"
|
|
8542
8550
|
} })] });
|
|
8543
8551
|
}
|
|
8544
|
-
function
|
|
8552
|
+
function qi({ rows: e = 8, cols: t = 4 }) {
|
|
8545
8553
|
return /* @__PURE__ */ P("div", {
|
|
8546
8554
|
style: {
|
|
8547
8555
|
padding: 16,
|
|
@@ -8556,7 +8564,7 @@ function Ki({ rows: e = 8, cols: t = 4 }) {
|
|
|
8556
8564
|
},
|
|
8557
8565
|
children: Array.from({ length: t }).map((e, t) => /* @__PURE__ */ N("div", {
|
|
8558
8566
|
style: { flex: 1 },
|
|
8559
|
-
children: /* @__PURE__ */ N(
|
|
8567
|
+
children: /* @__PURE__ */ N(Ki, { height: 14 })
|
|
8560
8568
|
}, t))
|
|
8561
8569
|
}), Array.from({ length: e }).map((e, n) => /* @__PURE__ */ N("div", {
|
|
8562
8570
|
style: {
|
|
@@ -8565,12 +8573,12 @@ function Ki({ rows: e = 8, cols: t = 4 }) {
|
|
|
8565
8573
|
},
|
|
8566
8574
|
children: Array.from({ length: t }).map((e, t) => /* @__PURE__ */ N("div", {
|
|
8567
8575
|
style: { flex: 1 },
|
|
8568
|
-
children: /* @__PURE__ */ N(
|
|
8576
|
+
children: /* @__PURE__ */ N(Ki, { height: 28 })
|
|
8569
8577
|
}, t))
|
|
8570
8578
|
}, n))]
|
|
8571
8579
|
});
|
|
8572
8580
|
}
|
|
8573
|
-
function
|
|
8581
|
+
function Ji() {
|
|
8574
8582
|
return /* @__PURE__ */ P("div", {
|
|
8575
8583
|
style: {
|
|
8576
8584
|
padding: 20,
|
|
@@ -8578,7 +8586,7 @@ function qi() {
|
|
|
8578
8586
|
flexDirection: "column",
|
|
8579
8587
|
gap: 18
|
|
8580
8588
|
},
|
|
8581
|
-
children: [/* @__PURE__ */ N(
|
|
8589
|
+
children: [/* @__PURE__ */ N(Ki, {
|
|
8582
8590
|
height: 28,
|
|
8583
8591
|
width: 200
|
|
8584
8592
|
}), /* @__PURE__ */ N("div", {
|
|
@@ -8593,10 +8601,10 @@ function qi() {
|
|
|
8593
8601
|
flexDirection: "column",
|
|
8594
8602
|
gap: 6
|
|
8595
8603
|
},
|
|
8596
|
-
children: [/* @__PURE__ */ N(
|
|
8604
|
+
children: [/* @__PURE__ */ N(Ki, {
|
|
8597
8605
|
height: 14,
|
|
8598
8606
|
width: 100
|
|
8599
|
-
}), /* @__PURE__ */ N(
|
|
8607
|
+
}), /* @__PURE__ */ N(Ki, {
|
|
8600
8608
|
height: 32,
|
|
8601
8609
|
width: "100%"
|
|
8602
8610
|
})]
|
|
@@ -8606,7 +8614,7 @@ function qi() {
|
|
|
8606
8614
|
}
|
|
8607
8615
|
//#endregion
|
|
8608
8616
|
//#region src/components/shared/ConfirmDialog.tsx
|
|
8609
|
-
function
|
|
8617
|
+
function Yi({ open: e, onOpenChange: t, title: n, description: r, confirmLabel: i = "Confirm", onConfirm: a, destructive: o = !1 }) {
|
|
8610
8618
|
return e ? /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N("div", {
|
|
8611
8619
|
onClick: () => t(!1),
|
|
8612
8620
|
style: {
|
|
@@ -8707,25 +8715,25 @@ function Ji({ open: e, onOpenChange: t, title: n, description: r, confirmLabel:
|
|
|
8707
8715
|
}
|
|
8708
8716
|
//#endregion
|
|
8709
8717
|
//#region src/lib/actions.ts
|
|
8710
|
-
function
|
|
8718
|
+
function Xi(e, t) {
|
|
8711
8719
|
if (!e || e.length === 0) return !0;
|
|
8712
8720
|
for (let n of e) {
|
|
8713
8721
|
if (n.status && n.status.length > 0) {
|
|
8714
8722
|
let e = t.status;
|
|
8715
8723
|
if (typeof e != "string" || !n.status.includes(e)) return !1;
|
|
8716
8724
|
}
|
|
8717
|
-
if (n.field && !
|
|
8725
|
+
if (n.field && !Zi(n, t)) return !1;
|
|
8718
8726
|
}
|
|
8719
8727
|
return !0;
|
|
8720
8728
|
}
|
|
8721
|
-
function
|
|
8729
|
+
function Zi(e, t) {
|
|
8722
8730
|
let n = t[e.field], r = e.op || "eq";
|
|
8723
|
-
return typeof e.value == "boolean" && r === "eq" ?
|
|
8731
|
+
return typeof e.value == "boolean" && r === "eq" ? Qi(n) === e.value : typeof n == "number" && typeof e.value == "number" ? $i(n, e.value, r) : $i(n == null ? "" : String(n), e.value == null ? "" : String(e.value), r);
|
|
8724
8732
|
}
|
|
8725
|
-
function
|
|
8733
|
+
function Qi(e) {
|
|
8726
8734
|
return e == null ? !1 : typeof e == "boolean" ? e : typeof e == "string" ? e !== "" : typeof e == "number" ? e !== 0 : !0;
|
|
8727
8735
|
}
|
|
8728
|
-
function
|
|
8736
|
+
function $i(e, t, n) {
|
|
8729
8737
|
switch (n) {
|
|
8730
8738
|
case "eq": return e === t;
|
|
8731
8739
|
case "ne": return e !== t;
|
|
@@ -8736,14 +8744,14 @@ function Qi(e, t, n) {
|
|
|
8736
8744
|
default: return !1;
|
|
8737
8745
|
}
|
|
8738
8746
|
}
|
|
8739
|
-
function
|
|
8747
|
+
function ea(e, t) {
|
|
8740
8748
|
return e ? Object.entries(e).filter(([, e]) => e.visibility?.includes(t)).map(([e, t]) => ({
|
|
8741
8749
|
code: e,
|
|
8742
8750
|
action: t
|
|
8743
8751
|
})) : [];
|
|
8744
8752
|
}
|
|
8745
|
-
function
|
|
8746
|
-
return !e && !r ? [] : t === void 0 ?
|
|
8753
|
+
function ta(e, t, n, r) {
|
|
8754
|
+
return !e && !r ? [] : t === void 0 ? ea(e, n) : t.map((t) => {
|
|
8747
8755
|
let n = e?.[t] ?? r?.[t];
|
|
8748
8756
|
return n ? {
|
|
8749
8757
|
code: t,
|
|
@@ -8751,14 +8759,14 @@ function ea(e, t, n, r) {
|
|
|
8751
8759
|
} : null;
|
|
8752
8760
|
}).filter((e) => e !== null);
|
|
8753
8761
|
}
|
|
8754
|
-
function
|
|
8762
|
+
function na(e) {
|
|
8755
8763
|
let t = e.resolved_params;
|
|
8756
8764
|
return t ? t.length > 0 : !1;
|
|
8757
8765
|
}
|
|
8758
|
-
function
|
|
8766
|
+
function ra(e) {
|
|
8759
8767
|
return e.type === "association" && !!e.association;
|
|
8760
8768
|
}
|
|
8761
|
-
function
|
|
8769
|
+
function ia(e, t) {
|
|
8762
8770
|
if (e) {
|
|
8763
8771
|
for (let n of Object.values(e.screens)) if (n.entity === t && n.type === "list") {
|
|
8764
8772
|
let r = e.entities[t];
|
|
@@ -8771,7 +8779,7 @@ function ra(e, t) {
|
|
|
8771
8779
|
}
|
|
8772
8780
|
//#endregion
|
|
8773
8781
|
//#region src/lib/filters.ts
|
|
8774
|
-
var
|
|
8782
|
+
var aa = new Set([
|
|
8775
8783
|
"is_empty",
|
|
8776
8784
|
"is_not_empty",
|
|
8777
8785
|
"today",
|
|
@@ -8781,7 +8789,7 @@ var ia = new Set([
|
|
|
8781
8789
|
"last_30_days",
|
|
8782
8790
|
"last_hour",
|
|
8783
8791
|
"last_24_hours"
|
|
8784
|
-
]),
|
|
8792
|
+
]), oa = {
|
|
8785
8793
|
eq: "is",
|
|
8786
8794
|
not_eq: "is not",
|
|
8787
8795
|
gt: ">",
|
|
@@ -8803,7 +8811,7 @@ var ia = new Set([
|
|
|
8803
8811
|
last_hour: "last hour",
|
|
8804
8812
|
last_24_hours: "last 24 hours"
|
|
8805
8813
|
};
|
|
8806
|
-
function
|
|
8814
|
+
function sa(e) {
|
|
8807
8815
|
let t = e.get("filters");
|
|
8808
8816
|
if (!t) return [];
|
|
8809
8817
|
try {
|
|
@@ -8813,35 +8821,35 @@ function oa(e) {
|
|
|
8813
8821
|
return [];
|
|
8814
8822
|
}
|
|
8815
8823
|
}
|
|
8816
|
-
function
|
|
8824
|
+
function ca(e, t) {
|
|
8817
8825
|
e.length === 0 ? t.delete("filters") : t.set("filters", JSON.stringify(e));
|
|
8818
8826
|
}
|
|
8819
|
-
function
|
|
8827
|
+
function la(e) {
|
|
8820
8828
|
return e.some((e) => e.or != null);
|
|
8821
8829
|
}
|
|
8822
|
-
function
|
|
8830
|
+
function ua(e) {
|
|
8823
8831
|
let t = [];
|
|
8824
8832
|
for (let n of e) {
|
|
8825
|
-
if (n.field && n.op && t.push(n), n.or) for (let e of n.or) t.push(...
|
|
8826
|
-
n.and && t.push(...
|
|
8833
|
+
if (n.field && n.op && t.push(n), n.or) for (let e of n.or) t.push(...ua(e));
|
|
8834
|
+
n.and && t.push(...ua(n.and));
|
|
8827
8835
|
}
|
|
8828
8836
|
return t;
|
|
8829
8837
|
}
|
|
8830
|
-
function
|
|
8831
|
-
return
|
|
8838
|
+
function da(e) {
|
|
8839
|
+
return ua(e).length;
|
|
8832
8840
|
}
|
|
8833
|
-
function
|
|
8841
|
+
function fa(e, t) {
|
|
8834
8842
|
return {
|
|
8835
8843
|
field: e,
|
|
8836
8844
|
op: "eq",
|
|
8837
8845
|
value: t
|
|
8838
8846
|
};
|
|
8839
8847
|
}
|
|
8840
|
-
function
|
|
8848
|
+
function pa(e, t) {
|
|
8841
8849
|
let n = [];
|
|
8842
8850
|
for (let r of e) if (r.field !== t) {
|
|
8843
8851
|
if (r.or) {
|
|
8844
|
-
let e = r.or.map((e) =>
|
|
8852
|
+
let e = r.or.map((e) => pa(e, t)).filter((e) => e.length > 0);
|
|
8845
8853
|
e.length > 0 && n.push({
|
|
8846
8854
|
...r,
|
|
8847
8855
|
or: e
|
|
@@ -8849,7 +8857,7 @@ function fa(e, t) {
|
|
|
8849
8857
|
continue;
|
|
8850
8858
|
}
|
|
8851
8859
|
if (r.and) {
|
|
8852
|
-
let e =
|
|
8860
|
+
let e = pa(r.and, t);
|
|
8853
8861
|
e.length > 0 && n.push({
|
|
8854
8862
|
...r,
|
|
8855
8863
|
and: e
|
|
@@ -8862,14 +8870,14 @@ function fa(e, t) {
|
|
|
8862
8870
|
}
|
|
8863
8871
|
//#endregion
|
|
8864
8872
|
//#region src/hooks/useFilters.ts
|
|
8865
|
-
function
|
|
8866
|
-
let [e, t] = C(), n = d(() =>
|
|
8873
|
+
function ma() {
|
|
8874
|
+
let [e, t] = C(), n = d(() => sa(e), [e]);
|
|
8867
8875
|
return {
|
|
8868
8876
|
filters: n,
|
|
8869
|
-
activeCount: d(() =>
|
|
8877
|
+
activeCount: d(() => da(n), [n]),
|
|
8870
8878
|
setFilters: s((n) => {
|
|
8871
8879
|
let r = new URLSearchParams(e);
|
|
8872
|
-
|
|
8880
|
+
ca(n, r), r.set("page", "1"), t(r);
|
|
8873
8881
|
}, [e, t]),
|
|
8874
8882
|
clearFilters: s(() => {
|
|
8875
8883
|
let n = new URLSearchParams(e);
|
|
@@ -8879,17 +8887,17 @@ function pa() {
|
|
|
8879
8887
|
}
|
|
8880
8888
|
//#endregion
|
|
8881
8889
|
//#region src/components/list/PeekFieldCell.tsx
|
|
8882
|
-
var
|
|
8890
|
+
var ha = new Set([
|
|
8883
8891
|
"enum",
|
|
8884
8892
|
"bool",
|
|
8885
8893
|
"ref"
|
|
8886
8894
|
]);
|
|
8887
|
-
function
|
|
8895
|
+
function ga(e) {
|
|
8888
8896
|
let t = e.display?.widget;
|
|
8889
|
-
return t &&
|
|
8897
|
+
return t && ha.has(t) ? !0 : ha.has(e.type);
|
|
8890
8898
|
}
|
|
8891
|
-
function
|
|
8892
|
-
let [u, d] = p(!1), [f, m] = p(r), h =
|
|
8899
|
+
function _a({ field: e, fieldName: t, label: n, value: r, record: i, refs: a, readOnly: o, onCommit: c }) {
|
|
8900
|
+
let [u, d] = p(!1), [f, m] = p(r), h = ga(e);
|
|
8893
8901
|
l(() => {
|
|
8894
8902
|
u || m(r);
|
|
8895
8903
|
}, [r, u]);
|
|
@@ -9017,7 +9025,7 @@ function ga({ field: e, fieldName: t, label: n, value: r, record: i, refs: a, re
|
|
|
9017
9025
|
}
|
|
9018
9026
|
//#endregion
|
|
9019
9027
|
//#region src/components/list/QuickPeek.tsx
|
|
9020
|
-
function
|
|
9028
|
+
function va(e, t = 12) {
|
|
9021
9029
|
let n = e.display?.icon;
|
|
9022
9030
|
if (!n) return null;
|
|
9023
9031
|
let r = B[n];
|
|
@@ -9026,8 +9034,8 @@ function _a(e, t = 12) {
|
|
|
9026
9034
|
size: t
|
|
9027
9035
|
});
|
|
9028
9036
|
}
|
|
9029
|
-
function
|
|
9030
|
-
let [g, _] = p({ ...e }), [v, y] = p(!1), [b, x] = p(!1), S = f(null), { run: C } =
|
|
9037
|
+
function ya({ record: e, title: t, recordId: n, avatarName: r, fields: i, refs: a, screen: o, actions: s, executeAction: c, onClose: u, onOpen: m, onSave: h }) {
|
|
9038
|
+
let [g, _] = p({ ...e }), [v, y] = p(!1), [b, x] = p(!1), S = f(null), { run: C } = Br();
|
|
9031
9039
|
l(() => {
|
|
9032
9040
|
_({ ...e }), y(!1);
|
|
9033
9041
|
}, [e]);
|
|
@@ -9158,9 +9166,9 @@ function va({ record: e, title: t, recordId: n, avatarName: r, fields: i, refs:
|
|
|
9158
9166
|
/* @__PURE__ */ N(ge, { children: "Esc" }),
|
|
9159
9167
|
" to close."
|
|
9160
9168
|
]
|
|
9161
|
-
}), i.map((e) => /* @__PURE__ */ N(
|
|
9169
|
+
}), i.map((e) => /* @__PURE__ */ N(ba, {
|
|
9162
9170
|
label: e.label,
|
|
9163
|
-
children: /* @__PURE__ */ N(
|
|
9171
|
+
children: /* @__PURE__ */ N(_a, {
|
|
9164
9172
|
field: e.field,
|
|
9165
9173
|
fieldName: e.key,
|
|
9166
9174
|
label: e.label,
|
|
@@ -9216,7 +9224,7 @@ function va({ record: e, title: t, recordId: n, avatarName: r, fields: i, refs:
|
|
|
9216
9224
|
width: 220,
|
|
9217
9225
|
align: "end",
|
|
9218
9226
|
children: E.map(({ code: e, action: t }) => /* @__PURE__ */ N(K, {
|
|
9219
|
-
icon:
|
|
9227
|
+
icon: va(t),
|
|
9220
9228
|
danger: t.destructive,
|
|
9221
9229
|
onClick: () => {
|
|
9222
9230
|
x(!1), D({
|
|
@@ -9230,7 +9238,7 @@ function va({ record: e, title: t, recordId: n, avatarName: r, fields: i, refs:
|
|
|
9230
9238
|
}),
|
|
9231
9239
|
T && /* @__PURE__ */ N(V, {
|
|
9232
9240
|
kind: "default",
|
|
9233
|
-
icon:
|
|
9241
|
+
icon: va(T.action, 13),
|
|
9234
9242
|
onClick: () => D(T),
|
|
9235
9243
|
children: X(T.action.display?.name) || T.code
|
|
9236
9244
|
}),
|
|
@@ -9245,7 +9253,7 @@ function va({ record: e, title: t, recordId: n, avatarName: r, fields: i, refs:
|
|
|
9245
9253
|
]
|
|
9246
9254
|
})] });
|
|
9247
9255
|
}
|
|
9248
|
-
function
|
|
9256
|
+
function ba({ label: e, children: t }) {
|
|
9249
9257
|
return /* @__PURE__ */ P("div", {
|
|
9250
9258
|
style: {
|
|
9251
9259
|
display: "grid",
|
|
@@ -9266,20 +9274,20 @@ function ya({ label: e, children: t }) {
|
|
|
9266
9274
|
}
|
|
9267
9275
|
//#endregion
|
|
9268
9276
|
//#region src/components/list/peekDraftStore.ts
|
|
9269
|
-
var
|
|
9270
|
-
function
|
|
9271
|
-
|
|
9272
|
-
}
|
|
9273
|
-
function Sa(e) {
|
|
9274
|
-
let t = ba.get(e);
|
|
9275
|
-
return t === void 0 ? null : (ba.delete(e), t);
|
|
9277
|
+
var xa = /* @__PURE__ */ new Map();
|
|
9278
|
+
function Sa(e, t) {
|
|
9279
|
+
xa.set(e, t);
|
|
9276
9280
|
}
|
|
9277
9281
|
function Ca(e) {
|
|
9278
|
-
|
|
9282
|
+
let t = xa.get(e);
|
|
9283
|
+
return t === void 0 ? null : (xa.delete(e), t);
|
|
9284
|
+
}
|
|
9285
|
+
function wa(e) {
|
|
9286
|
+
xa.delete(e);
|
|
9279
9287
|
}
|
|
9280
9288
|
//#endregion
|
|
9281
9289
|
//#region src/components/list/BulkBar.tsx
|
|
9282
|
-
function
|
|
9290
|
+
function Ta({ count: e, actions: t, onClear: n, onDelete: r, onExport: i }) {
|
|
9283
9291
|
let [a, o] = p(!1), s = f(null), c = t.filter((e) => e.primary), l = t.filter((e) => !e.primary);
|
|
9284
9292
|
return /* @__PURE__ */ P("div", {
|
|
9285
9293
|
style: {
|
|
@@ -9345,7 +9353,7 @@ function wa({ count: e, actions: t, onClear: n, onDelete: r, onExport: i }) {
|
|
|
9345
9353
|
background: "var(--inverted-overlay)",
|
|
9346
9354
|
margin: "0 4px"
|
|
9347
9355
|
} }),
|
|
9348
|
-
c.map((e) => /* @__PURE__ */ N(
|
|
9356
|
+
c.map((e) => /* @__PURE__ */ N(Ea, {
|
|
9349
9357
|
icon: e.icon,
|
|
9350
9358
|
label: e.label,
|
|
9351
9359
|
onClick: e.onRun
|
|
@@ -9409,7 +9417,7 @@ function wa({ count: e, actions: t, onClear: n, onDelete: r, onExport: i }) {
|
|
|
9409
9417
|
]
|
|
9410
9418
|
});
|
|
9411
9419
|
}
|
|
9412
|
-
function
|
|
9420
|
+
function Ea({ icon: e, label: t, onClick: n }) {
|
|
9413
9421
|
return /* @__PURE__ */ P("button", {
|
|
9414
9422
|
onClick: n,
|
|
9415
9423
|
style: {
|
|
@@ -9433,8 +9441,8 @@ function Ta({ icon: e, label: t, onClick: n }) {
|
|
|
9433
9441
|
}
|
|
9434
9442
|
//#endregion
|
|
9435
9443
|
//#region src/components/filters/FilterChips.tsx
|
|
9436
|
-
function
|
|
9437
|
-
return e.length === 0 ? null :
|
|
9444
|
+
function Da({ filters: e, onRemove: t, onClearAll: n, onChipClick: r, fieldLabel: i = (e) => e }) {
|
|
9445
|
+
return e.length === 0 ? null : la(e) ? /* @__PURE__ */ P("div", {
|
|
9438
9446
|
style: {
|
|
9439
9447
|
display: "flex",
|
|
9440
9448
|
alignItems: "center",
|
|
@@ -9465,10 +9473,10 @@ function Ea({ filters: e, onRemove: t, onClearAll: n, onChipClick: r, fieldLabel
|
|
|
9465
9473
|
}), /* @__PURE__ */ N(ye, {
|
|
9466
9474
|
tone: "slate",
|
|
9467
9475
|
onClick: r,
|
|
9468
|
-
children: e.filter((e) => e.field && e.op).map((e) => `${i(e.field)} ${
|
|
9476
|
+
children: e.filter((e) => e.field && e.op).map((e) => `${i(e.field)} ${ka(e)}`).join(" AND ")
|
|
9469
9477
|
})]
|
|
9470
9478
|
}, t))
|
|
9471
|
-
}, n) : e.field && e.op ? /* @__PURE__ */ N(
|
|
9479
|
+
}, n) : e.field && e.op ? /* @__PURE__ */ N(Oa, {
|
|
9472
9480
|
node: e,
|
|
9473
9481
|
fieldLabel: i,
|
|
9474
9482
|
onRemove: () => t(e.field),
|
|
@@ -9488,7 +9496,7 @@ function Ea({ filters: e, onRemove: t, onClearAll: n, onChipClick: r, fieldLabel
|
|
|
9488
9496
|
flexWrap: "wrap",
|
|
9489
9497
|
paddingBottom: 12
|
|
9490
9498
|
},
|
|
9491
|
-
children: [
|
|
9499
|
+
children: [ua(e).map((e, n) => /* @__PURE__ */ N(Oa, {
|
|
9492
9500
|
node: e,
|
|
9493
9501
|
fieldLabel: i,
|
|
9494
9502
|
onRemove: () => t(e.field),
|
|
@@ -9502,7 +9510,7 @@ function Ea({ filters: e, onRemove: t, onClearAll: n, onChipClick: r, fieldLabel
|
|
|
9502
9510
|
})]
|
|
9503
9511
|
});
|
|
9504
9512
|
}
|
|
9505
|
-
function
|
|
9513
|
+
function Oa({ node: e, fieldLabel: t, onRemove: n, onClick: r }) {
|
|
9506
9514
|
return /* @__PURE__ */ N(ye, {
|
|
9507
9515
|
tone: "slate",
|
|
9508
9516
|
icon: /* @__PURE__ */ N(B.filter, { size: 11 }),
|
|
@@ -9516,24 +9524,24 @@ function Da({ node: e, fieldLabel: t, onRemove: n, onClick: r }) {
|
|
|
9516
9524
|
" ",
|
|
9517
9525
|
/* @__PURE__ */ N("span", {
|
|
9518
9526
|
style: { fontWeight: 600 },
|
|
9519
|
-
children:
|
|
9527
|
+
children: ka(e)
|
|
9520
9528
|
})
|
|
9521
9529
|
] })
|
|
9522
9530
|
});
|
|
9523
9531
|
}
|
|
9524
|
-
function
|
|
9532
|
+
function ka(e) {
|
|
9525
9533
|
if (!e.op) return "";
|
|
9526
|
-
let t =
|
|
9527
|
-
return
|
|
9534
|
+
let t = oa[e.op] || e.op;
|
|
9535
|
+
return aa.has(e.op) ? t : `${t} ${Array.isArray(e.value) ? e.value.join(", ") : String(e.value ?? "")}`;
|
|
9528
9536
|
}
|
|
9529
9537
|
//#endregion
|
|
9530
9538
|
//#region src/components/filters/FilterDrawer.tsx
|
|
9531
|
-
function
|
|
9539
|
+
function Aa({ open: e, onClose: t, filters: n, onApply: r, availableFields: i }) {
|
|
9532
9540
|
let [a, o] = p(n), [s, c] = p(!1);
|
|
9533
9541
|
if (l(() => {
|
|
9534
9542
|
e && o(n);
|
|
9535
9543
|
}, [e, n]), !e) return null;
|
|
9536
|
-
let u =
|
|
9544
|
+
let u = la(a), d = new Set(a.filter((e) => e.field).map((e) => e.field)), f = (e) => {
|
|
9537
9545
|
let t = i.find((t) => t.code === e);
|
|
9538
9546
|
if (!t) return;
|
|
9539
9547
|
let n = t.operators[0] || "eq";
|
|
@@ -9615,14 +9623,14 @@ function ka({ open: e, onClose: t, filters: n, onApply: r, availableFields: i })
|
|
|
9615
9623
|
if (!e.or) {
|
|
9616
9624
|
if (!e.field || !e.op) return null;
|
|
9617
9625
|
let n = i.find((t) => t.code === e.field);
|
|
9618
|
-
return n ? /* @__PURE__ */ N(
|
|
9626
|
+
return n ? /* @__PURE__ */ N(ja, {
|
|
9619
9627
|
node: e,
|
|
9620
9628
|
meta: n,
|
|
9621
9629
|
onUpdate: (e) => m(t, e),
|
|
9622
9630
|
onRemove: () => h(t)
|
|
9623
9631
|
}, `${e.field}-${t}`) : null;
|
|
9624
9632
|
}
|
|
9625
|
-
return /* @__PURE__ */ N(
|
|
9633
|
+
return /* @__PURE__ */ N(Ma, {
|
|
9626
9634
|
groups: e.or,
|
|
9627
9635
|
availableFields: i,
|
|
9628
9636
|
onChange: (e) => {
|
|
@@ -9633,7 +9641,7 @@ function ka({ open: e, onClose: t, filters: n, onApply: r, availableFields: i })
|
|
|
9633
9641
|
}) : a.map((e, t) => {
|
|
9634
9642
|
if (!e.field || !e.op) return null;
|
|
9635
9643
|
let n = i.find((t) => t.code === e.field);
|
|
9636
|
-
return n ? /* @__PURE__ */ N(
|
|
9644
|
+
return n ? /* @__PURE__ */ N(ja, {
|
|
9637
9645
|
node: e,
|
|
9638
9646
|
meta: n,
|
|
9639
9647
|
onUpdate: (e) => m(t, e),
|
|
@@ -9646,7 +9654,7 @@ function ka({ open: e, onClose: t, filters: n, onApply: r, availableFields: i })
|
|
|
9646
9654
|
gap: 6,
|
|
9647
9655
|
paddingTop: 6
|
|
9648
9656
|
},
|
|
9649
|
-
children: s ? /* @__PURE__ */ N(
|
|
9657
|
+
children: s ? /* @__PURE__ */ N(Na, {
|
|
9650
9658
|
fields: i,
|
|
9651
9659
|
activeFields: d,
|
|
9652
9660
|
onSelect: f,
|
|
@@ -9709,10 +9717,10 @@ function ka({ open: e, onClose: t, filters: n, onApply: r, availableFields: i })
|
|
|
9709
9717
|
]
|
|
9710
9718
|
})] });
|
|
9711
9719
|
}
|
|
9712
|
-
function
|
|
9713
|
-
let i =
|
|
9720
|
+
function ja({ node: e, meta: t, onUpdate: n, onRemove: r }) {
|
|
9721
|
+
let i = aa.has(e.op), a = t.operators.map((e) => ({
|
|
9714
9722
|
value: e,
|
|
9715
|
-
label:
|
|
9723
|
+
label: oa[e] || e
|
|
9716
9724
|
}));
|
|
9717
9725
|
return /* @__PURE__ */ P("div", {
|
|
9718
9726
|
style: {
|
|
@@ -9761,7 +9769,7 @@ function Aa({ node: e, meta: t, onUpdate: n, onRemove: r }) {
|
|
|
9761
9769
|
]
|
|
9762
9770
|
});
|
|
9763
9771
|
}
|
|
9764
|
-
function
|
|
9772
|
+
function Ma({ groups: e, availableFields: t, onChange: n }) {
|
|
9765
9773
|
return /* @__PURE__ */ P("div", {
|
|
9766
9774
|
style: {
|
|
9767
9775
|
display: "flex",
|
|
@@ -9816,7 +9824,7 @@ function ja({ groups: e, availableFields: t, onChange: n }) {
|
|
|
9816
9824
|
}),
|
|
9817
9825
|
r.map((r, a) => {
|
|
9818
9826
|
let o = t.find((e) => e.code === r.field);
|
|
9819
|
-
return o ? /* @__PURE__ */ N(
|
|
9827
|
+
return o ? /* @__PURE__ */ N(ja, {
|
|
9820
9828
|
node: r,
|
|
9821
9829
|
meta: o,
|
|
9822
9830
|
onUpdate: (t) => {
|
|
@@ -9853,7 +9861,7 @@ function ja({ groups: e, availableFields: t, onChange: n }) {
|
|
|
9853
9861
|
})]
|
|
9854
9862
|
});
|
|
9855
9863
|
}
|
|
9856
|
-
function
|
|
9864
|
+
function Na({ fields: e, activeFields: t, onSelect: n, onCancel: r }) {
|
|
9857
9865
|
let [i, a] = p(""), o = e.filter((e) => !t.has(e.code) && (i === "" || e.label.toLowerCase().includes(i.toLowerCase()) || e.code.toLowerCase().includes(i.toLowerCase())));
|
|
9858
9866
|
return /* @__PURE__ */ P("div", {
|
|
9859
9867
|
style: {
|
|
@@ -9926,7 +9934,7 @@ function Ma({ fields: e, activeFields: t, onSelect: n, onCancel: r }) {
|
|
|
9926
9934
|
}
|
|
9927
9935
|
//#endregion
|
|
9928
9936
|
//#region src/components/columns/ColumnPicker.tsx
|
|
9929
|
-
function
|
|
9937
|
+
function Pa({ availableColumns: e, visibleColumns: t, onToggle: n, onReset: r, onShowAll: i, columnLabel: a = (e) => e }) {
|
|
9930
9938
|
let o = f(null), [s, c] = p(!1);
|
|
9931
9939
|
return /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(V, {
|
|
9932
9940
|
ref: o,
|
|
@@ -9976,7 +9984,7 @@ function Na({ availableColumns: e, visibleColumns: t, onToggle: n, onReset: r, o
|
|
|
9976
9984
|
}
|
|
9977
9985
|
//#endregion
|
|
9978
9986
|
//#region src/components/views/ViewSwitcher.tsx
|
|
9979
|
-
var
|
|
9987
|
+
var Fa = {
|
|
9980
9988
|
display: "flex",
|
|
9981
9989
|
alignItems: "center",
|
|
9982
9990
|
gap: 6,
|
|
@@ -9990,7 +9998,7 @@ var Pa = {
|
|
|
9990
9998
|
color: "var(--text-2)",
|
|
9991
9999
|
fontFamily: "inherit"
|
|
9992
10000
|
};
|
|
9993
|
-
function
|
|
10001
|
+
function Ia({ views: e, activeViewId: t, isDirty: n, onSelect: r, onSave: i, onSaveAs: a }) {
|
|
9994
10002
|
let o = f(null), [s, c] = p(!1), l = e.find((e) => e.id === t), u = e.filter((e) => e.source === "system"), d = e.filter((e) => e.source === "personal"), m = e.filter((e) => e.source === "shared"), h = l ? X(l.name) : "Default view", g = (e) => /* @__PURE__ */ N("div", {
|
|
9995
10003
|
style: {
|
|
9996
10004
|
padding: "6px 8px 4px",
|
|
@@ -10013,7 +10021,7 @@ function Fa({ views: e, activeViewId: t, isDirty: n, onSelect: r, onSave: i, onS
|
|
|
10013
10021
|
ref: o,
|
|
10014
10022
|
type: "button",
|
|
10015
10023
|
onClick: () => c(!s),
|
|
10016
|
-
style:
|
|
10024
|
+
style: Fa,
|
|
10017
10025
|
children: [
|
|
10018
10026
|
/* @__PURE__ */ N(B.star, { size: 12 }),
|
|
10019
10027
|
/* @__PURE__ */ N("span", { children: h }),
|
|
@@ -10092,14 +10100,14 @@ function Fa({ views: e, activeViewId: t, isDirty: n, onSelect: r, onSave: i, onS
|
|
|
10092
10100
|
}
|
|
10093
10101
|
//#endregion
|
|
10094
10102
|
//#region src/hooks/useScreen.ts
|
|
10095
|
-
function
|
|
10103
|
+
function La(e) {
|
|
10096
10104
|
let { data: t } = st();
|
|
10097
10105
|
if (!(!t || !e)) return t.screens[e];
|
|
10098
10106
|
}
|
|
10099
10107
|
//#endregion
|
|
10100
10108
|
//#region src/hooks/useViews.ts
|
|
10101
|
-
function
|
|
10102
|
-
let n =
|
|
10109
|
+
function Ra(e, t) {
|
|
10110
|
+
let n = La(e), { data: r } = Xn("view", {
|
|
10103
10111
|
filters: [{
|
|
10104
10112
|
field: "screen_code",
|
|
10105
10113
|
op: "eq",
|
|
@@ -10148,7 +10156,7 @@ function La(e, t) {
|
|
|
10148
10156
|
}
|
|
10149
10157
|
//#endregion
|
|
10150
10158
|
//#region src/components/pages/SmartListPage.tsx
|
|
10151
|
-
var
|
|
10159
|
+
var za = new Set([
|
|
10152
10160
|
"string",
|
|
10153
10161
|
"text",
|
|
10154
10162
|
"email",
|
|
@@ -10174,28 +10182,28 @@ var Ra = new Set([
|
|
|
10174
10182
|
"enum",
|
|
10175
10183
|
"status"
|
|
10176
10184
|
]);
|
|
10177
|
-
function
|
|
10185
|
+
function Ba(e) {
|
|
10178
10186
|
let t = [];
|
|
10179
10187
|
for (let [n, r] of e.fields) {
|
|
10180
10188
|
if (r.primary || r.auto || r.ref || r.array || r.structure || r.display?.is_listable === !1) continue;
|
|
10181
10189
|
let e = (r.type || "").toLowerCase(), i = !!(r.enum || r.values);
|
|
10182
|
-
if (!(!
|
|
10190
|
+
if (!(!za.has(e) && !i) && (t.push(n), t.length >= 8)) break;
|
|
10183
10191
|
}
|
|
10184
10192
|
return t;
|
|
10185
10193
|
}
|
|
10186
|
-
function
|
|
10194
|
+
function Va(e, t, n, r) {
|
|
10187
10195
|
if (e.detail_screen === "none") return null;
|
|
10188
10196
|
let i = e.detail_screen ?? n?.detail_screen;
|
|
10189
10197
|
if (!i) return null;
|
|
10190
10198
|
let a = r?.[i];
|
|
10191
10199
|
return a?.route ? a.route.replace(":id", encodeURIComponent(t)) : null;
|
|
10192
10200
|
}
|
|
10193
|
-
function
|
|
10194
|
-
let t = Mt(), [n, r] = C(), { data: i } = st(), [a, o] = p(null), [c, u] = p({}), [m, h] = p(!1), [g, _] = p(null), { filters: v, activeCount: y, setFilters: b, clearFilters: x } =
|
|
10201
|
+
function Ha({ screenCode: e }) {
|
|
10202
|
+
let t = Mt(), [n, r] = C(), { data: i } = st(), [a, o] = p(null), [c, u] = p({}), [m, h] = p(!1), [g, _] = p(null), { filters: v, activeCount: y, setFilters: b, clearFilters: x } = ma(), S = qt((e) => e.user), w = Ra(e, S?.id), T = i?.screens[e], E = T?.entity ? i?.entities[T.entity] : void 0, D = T?.entity, O = i?.actions, k = d(() => ta(E?.actions, T?.actions, "list_toolbar", O), [
|
|
10195
10203
|
E?.actions,
|
|
10196
10204
|
T?.actions,
|
|
10197
10205
|
O
|
|
10198
|
-
]), A = d(() =>
|
|
10206
|
+
]), A = d(() => ta(E?.actions, T?.row_actions, "list_row", O), [
|
|
10199
10207
|
E?.actions,
|
|
10200
10208
|
T?.row_actions,
|
|
10201
10209
|
O
|
|
@@ -10222,13 +10230,13 @@ function Va({ screenCode: e }) {
|
|
|
10222
10230
|
let e = se(T.route);
|
|
10223
10231
|
e && oe(e.id, n.toString());
|
|
10224
10232
|
}, [n, T?.route]);
|
|
10225
|
-
let ce = parseInt(n.get("page") ?? "1", 10), le = n.get("search") ?? "", ue = n.get("sort") ?? T?.sort_default ?? "", de =
|
|
10233
|
+
let ce = parseInt(n.get("page") ?? "1", 10), le = n.get("search") ?? "", ue = n.get("sort") ?? T?.sort_default ?? "", de = Ui(le, 300), fe = d(() => {
|
|
10226
10234
|
let e = n.get("columns");
|
|
10227
10235
|
return e ? e.split(",").filter(Boolean) : T?.columns ?? [];
|
|
10228
10236
|
}, [n, T?.columns]), pe = d(() => {
|
|
10229
10237
|
let e = [], t = [...T?.columns ?? [], ...fe];
|
|
10230
10238
|
return t.some((e) => e.startsWith("$status.")) && e.push("statuses"), t.some((e) => e.startsWith("$property.")) && e.push("properties"), e.length > 0 && e.unshift("refs"), e.length > 0 ? e : void 0;
|
|
10231
|
-
}, [T?.columns, fe]), { data: me, isLoading: he, isError: z } =
|
|
10239
|
+
}, [T?.columns, fe]), { data: me, isLoading: he, isError: z } = Xn(D, {
|
|
10232
10240
|
page: ce,
|
|
10233
10241
|
per_page: 50,
|
|
10234
10242
|
sort: ue || void 0,
|
|
@@ -10237,7 +10245,7 @@ function Va({ screenCode: e }) {
|
|
|
10237
10245
|
include_deleted: ie || void 0,
|
|
10238
10246
|
expand: pe,
|
|
10239
10247
|
screen: T?.fixed_filters ? e : void 0
|
|
10240
|
-
}), _e =
|
|
10248
|
+
}), _e = Bi(D ?? ""), ve = zi(D ?? ""), ye = d(() => {
|
|
10241
10249
|
if (!ue) return [];
|
|
10242
10250
|
let [e, t] = ue.split(":");
|
|
10243
10251
|
return [{
|
|
@@ -10331,7 +10339,7 @@ function Va({ screenCode: e }) {
|
|
|
10331
10339
|
id: "_actions",
|
|
10332
10340
|
header: "",
|
|
10333
10341
|
size: 40,
|
|
10334
|
-
cell: ({ row: e }) => /* @__PURE__ */ N(
|
|
10342
|
+
cell: ({ row: e }) => /* @__PURE__ */ N(Ga, {
|
|
10335
10343
|
row: e.original,
|
|
10336
10344
|
rowId: String(e.original[be] ?? ""),
|
|
10337
10345
|
screen: T,
|
|
@@ -10423,7 +10431,7 @@ function Va({ screenCode: e }) {
|
|
|
10423
10431
|
let n = new URLSearchParams(t);
|
|
10424
10432
|
return n.set("page", String(e)), n;
|
|
10425
10433
|
});
|
|
10426
|
-
}, [r]), Ie = d(() => !T || !E ? !1 :
|
|
10434
|
+
}, [r]), Ie = d(() => !T || !E ? !1 : Va(T, "_", E, i?.screens) !== null, [
|
|
10427
10435
|
T,
|
|
10428
10436
|
E,
|
|
10429
10437
|
i?.screens
|
|
@@ -10431,10 +10439,10 @@ function Va({ screenCode: e }) {
|
|
|
10431
10439
|
if (!E || !T) return;
|
|
10432
10440
|
let r = E.fields.names()?.find((e) => E.fields.get(e)?.primary), a = r ? String(e[r] ?? "") : "";
|
|
10433
10441
|
if (!a) return;
|
|
10434
|
-
let o =
|
|
10442
|
+
let o = Va(T, a, E, i?.screens);
|
|
10435
10443
|
if (!o) return;
|
|
10436
10444
|
if (n?.draft) {
|
|
10437
|
-
|
|
10445
|
+
Sa(a, n.draft);
|
|
10438
10446
|
let [e, t] = o.split("?", 2), r = new URLSearchParams(t ?? "");
|
|
10439
10447
|
r.set("edit", "true"), o = `${e}?${r.toString()}`;
|
|
10440
10448
|
}
|
|
@@ -10470,8 +10478,8 @@ function Va({ screenCode: e }) {
|
|
|
10470
10478
|
}
|
|
10471
10479
|
}
|
|
10472
10480
|
};
|
|
10473
|
-
a(e), n = r.filter((e) => E.fields.get(e)), n.length === 0 && (n =
|
|
10474
|
-
} else n =
|
|
10481
|
+
a(e), n = r.filter((e) => E.fields.get(e)), n.length === 0 && (n = Ba(E));
|
|
10482
|
+
} else n = Ba(E);
|
|
10475
10483
|
return n.map((e) => {
|
|
10476
10484
|
let t = E.fields.get(e), n = !t.primary && !t.auto && !t.ref;
|
|
10477
10485
|
return {
|
|
@@ -10489,7 +10497,7 @@ function Va({ screenCode: e }) {
|
|
|
10489
10497
|
i?.entities
|
|
10490
10498
|
]), Ve = d(() => E?.actions ? E.actions : {}, [E?.actions]), He = s(async (e, t, n) => {
|
|
10491
10499
|
let r = E?.fields.names().find((e) => E.fields.get(e)?.primary), i = r && W ? [String(W[r] ?? "")] : void 0;
|
|
10492
|
-
return
|
|
10500
|
+
return Jn(t.entity ? `${t.entity}.${e}` : e, qn(n, i));
|
|
10493
10501
|
}, [E, W]), Ue = s(async () => {
|
|
10494
10502
|
if (!a || a.ids.length === 0) return;
|
|
10495
10503
|
o(null);
|
|
@@ -10515,7 +10523,7 @@ function Va({ screenCode: e }) {
|
|
|
10515
10523
|
},
|
|
10516
10524
|
children: [
|
|
10517
10525
|
/* @__PURE__ */ P(M, { children: [
|
|
10518
|
-
/* @__PURE__ */ N(
|
|
10526
|
+
/* @__PURE__ */ N(Ka, {
|
|
10519
10527
|
title: Ge,
|
|
10520
10528
|
total: Ee?.total,
|
|
10521
10529
|
loaded: q.length,
|
|
@@ -10545,7 +10553,7 @@ function Va({ screenCode: e }) {
|
|
|
10545
10553
|
flexWrap: "wrap"
|
|
10546
10554
|
},
|
|
10547
10555
|
children: [
|
|
10548
|
-
/* @__PURE__ */ N(
|
|
10556
|
+
/* @__PURE__ */ N(Ia, {
|
|
10549
10557
|
views: w,
|
|
10550
10558
|
activeViewId: n.get("view"),
|
|
10551
10559
|
isDirty: !1,
|
|
@@ -10591,7 +10599,7 @@ function Va({ screenCode: e }) {
|
|
|
10591
10599
|
children: y
|
|
10592
10600
|
})]
|
|
10593
10601
|
}),
|
|
10594
|
-
/* @__PURE__ */ N(
|
|
10602
|
+
/* @__PURE__ */ N(Pa, {
|
|
10595
10603
|
availableColumns: T.columns ?? [],
|
|
10596
10604
|
visibleColumns: fe,
|
|
10597
10605
|
onToggle: (e) => {
|
|
@@ -10653,9 +10661,9 @@ function Va({ screenCode: e }) {
|
|
|
10653
10661
|
}),
|
|
10654
10662
|
v.length > 0 && /* @__PURE__ */ N("div", {
|
|
10655
10663
|
style: { padding: "0 20px 10px" },
|
|
10656
|
-
children: /* @__PURE__ */ N(
|
|
10664
|
+
children: /* @__PURE__ */ N(Da, {
|
|
10657
10665
|
filters: v,
|
|
10658
|
-
onRemove: (e) => b(
|
|
10666
|
+
onRemove: (e) => b(pa(v, e)),
|
|
10659
10667
|
onClearAll: x,
|
|
10660
10668
|
onChipClick: () => h(!0),
|
|
10661
10669
|
fieldLabel: (e) => {
|
|
@@ -10673,16 +10681,16 @@ function Va({ screenCode: e }) {
|
|
|
10673
10681
|
})
|
|
10674
10682
|
})
|
|
10675
10683
|
] }),
|
|
10676
|
-
he ? /* @__PURE__ */ N(
|
|
10684
|
+
he ? /* @__PURE__ */ N(qi, { cols: T.columns?.length ?? 4 }) : z ? /* @__PURE__ */ N("div", {
|
|
10677
10685
|
style: { padding: "0 20px" },
|
|
10678
|
-
children: /* @__PURE__ */ N(
|
|
10686
|
+
children: /* @__PURE__ */ N(Wi, {
|
|
10679
10687
|
icon: "alert-circle",
|
|
10680
10688
|
title: "Failed to load data",
|
|
10681
10689
|
description: "Something went wrong. Please try again."
|
|
10682
10690
|
})
|
|
10683
10691
|
}) : q.length === 0 ? /* @__PURE__ */ N("div", {
|
|
10684
10692
|
style: { padding: "0 20px" },
|
|
10685
|
-
children: /* @__PURE__ */ N(
|
|
10693
|
+
children: /* @__PURE__ */ N(Wi, {
|
|
10686
10694
|
icon: Ke,
|
|
10687
10695
|
title: de || y > 0 ? "No results found" : `No ${Ge.toLowerCase()} yet`,
|
|
10688
10696
|
description: de || y > 0 ? "Try adjusting your search or filters" : `Create your first ${X(We.name).toLowerCase()} to get started`,
|
|
@@ -10913,14 +10921,14 @@ function Va({ screenCode: e }) {
|
|
|
10913
10921
|
})]
|
|
10914
10922
|
})
|
|
10915
10923
|
}),
|
|
10916
|
-
/* @__PURE__ */ N(
|
|
10924
|
+
/* @__PURE__ */ N(Aa, {
|
|
10917
10925
|
open: m,
|
|
10918
10926
|
onClose: () => h(!1),
|
|
10919
10927
|
filters: v,
|
|
10920
10928
|
onApply: b,
|
|
10921
|
-
availableFields:
|
|
10929
|
+
availableFields: Ua(T, E, i?.entities)
|
|
10922
10930
|
}),
|
|
10923
|
-
/* @__PURE__ */ N(
|
|
10931
|
+
/* @__PURE__ */ N(Yi, {
|
|
10924
10932
|
open: a !== null,
|
|
10925
10933
|
onOpenChange: (e) => !e && o(null),
|
|
10926
10934
|
title: `Delete ${X(We.name)}`,
|
|
@@ -10929,7 +10937,7 @@ function Va({ screenCode: e }) {
|
|
|
10929
10937
|
onConfirm: Ue,
|
|
10930
10938
|
destructive: !0
|
|
10931
10939
|
}),
|
|
10932
|
-
I && Oe.length > 0 && /* @__PURE__ */ N(
|
|
10940
|
+
I && Oe.length > 0 && /* @__PURE__ */ N(qa, {
|
|
10933
10941
|
selectedIds: Oe,
|
|
10934
10942
|
toolbarActions: k,
|
|
10935
10943
|
data: q,
|
|
@@ -10997,7 +11005,7 @@ function Va({ screenCode: e }) {
|
|
|
10997
11005
|
}
|
|
10998
11006
|
})]
|
|
10999
11007
|
}),
|
|
11000
|
-
Ce && W && E && /* @__PURE__ */ N(
|
|
11008
|
+
Ce && W && E && /* @__PURE__ */ N(ya, {
|
|
11001
11009
|
record: W,
|
|
11002
11010
|
title: (() => {
|
|
11003
11011
|
let e = T.columns?.find((e) => !e.startsWith("$status.") && !e.startsWith("$property."));
|
|
@@ -11014,7 +11022,7 @@ function Va({ screenCode: e }) {
|
|
|
11014
11022
|
onClose: () => {
|
|
11015
11023
|
if (E && W) {
|
|
11016
11024
|
let e = E.fields.names()?.find((e) => E.fields.get(e)?.primary);
|
|
11017
|
-
e &&
|
|
11025
|
+
e && wa(String(W[e] ?? ""));
|
|
11018
11026
|
}
|
|
11019
11027
|
G(null);
|
|
11020
11028
|
},
|
|
@@ -11040,7 +11048,7 @@ function Va({ screenCode: e }) {
|
|
|
11040
11048
|
]
|
|
11041
11049
|
});
|
|
11042
11050
|
}
|
|
11043
|
-
function
|
|
11051
|
+
function Ua(e, t, n) {
|
|
11044
11052
|
if (!e || !t) return [];
|
|
11045
11053
|
let r = e.filters ?? t.fields.names(), i = [];
|
|
11046
11054
|
for (let e of r) {
|
|
@@ -11084,7 +11092,7 @@ function Ha(e, t, n) {
|
|
|
11084
11092
|
}
|
|
11085
11093
|
let r = t.fields.get(e);
|
|
11086
11094
|
if (!r) continue;
|
|
11087
|
-
let a = ze(r, e, n), o =
|
|
11095
|
+
let a = ze(r, e, n), o = Wa(r.type), s = r.values?.map((e) => ({
|
|
11088
11096
|
value: e.code,
|
|
11089
11097
|
label: X(e.name) || e.code,
|
|
11090
11098
|
color: e.color
|
|
@@ -11099,7 +11107,7 @@ function Ha(e, t, n) {
|
|
|
11099
11107
|
}
|
|
11100
11108
|
return i;
|
|
11101
11109
|
}
|
|
11102
|
-
function
|
|
11110
|
+
function Wa(e) {
|
|
11103
11111
|
switch (e) {
|
|
11104
11112
|
case "string":
|
|
11105
11113
|
case "text":
|
|
@@ -11184,8 +11192,8 @@ function Ua(e) {
|
|
|
11184
11192
|
];
|
|
11185
11193
|
}
|
|
11186
11194
|
}
|
|
11187
|
-
function
|
|
11188
|
-
let u = f(null), [d, m] = p(!1), { run: h } =
|
|
11195
|
+
function Ga({ row: e, rowId: t, screen: n, entity: r, allScreens: i, hasDefaultActions: a, rowActions: o, tabNavigate: s, onDelete: c, onPeek: l }) {
|
|
11196
|
+
let u = f(null), [d, m] = p(!1), { run: h } = Br(), g = Va(n, t, r, i), _ = X(r.display.name), v = (e) => () => {
|
|
11189
11197
|
m(!1), e();
|
|
11190
11198
|
};
|
|
11191
11199
|
return /* @__PURE__ */ P("div", {
|
|
@@ -11237,7 +11245,7 @@ function Wa({ row: e, rowId: t, screen: n, entity: r, allScreens: i, hasDefaultA
|
|
|
11237
11245
|
}),
|
|
11238
11246
|
a && o.length > 0 && /* @__PURE__ */ N(K, { divider: !0 }),
|
|
11239
11247
|
o.map(({ code: n, action: i }) => {
|
|
11240
|
-
let a =
|
|
11248
|
+
let a = Xi(i.conditions, e), o = X(i.display?.name) || n, l = i.display?.icon, u = l && B[l] ? B[l] : void 0, d = u ? /* @__PURE__ */ N(u, { size: 12 }) : null;
|
|
11241
11249
|
return i.type === "edit" && g ? /* @__PURE__ */ N(K, {
|
|
11242
11250
|
icon: /* @__PURE__ */ N(B.edit, { size: 12 }),
|
|
11243
11251
|
onClick: v(() => s(g, {
|
|
@@ -11260,7 +11268,7 @@ function Wa({ row: e, rowId: t, screen: n, entity: r, allScreens: i, hasDefaultA
|
|
|
11260
11268
|
h({
|
|
11261
11269
|
action: i,
|
|
11262
11270
|
title: o,
|
|
11263
|
-
execute: (n) =>
|
|
11271
|
+
execute: (n) => Jn(e, qn(n, [t]))
|
|
11264
11272
|
});
|
|
11265
11273
|
}),
|
|
11266
11274
|
children: o
|
|
@@ -11271,8 +11279,8 @@ function Wa({ row: e, rowId: t, screen: n, entity: r, allScreens: i, hasDefaultA
|
|
|
11271
11279
|
]
|
|
11272
11280
|
});
|
|
11273
11281
|
}
|
|
11274
|
-
function
|
|
11275
|
-
let v = f(null), [y, b] = p(!1), { run: x } =
|
|
11282
|
+
function Ka({ title: e, total: t, loaded: n, screenRoute: r, entityName: i, screenIcon: a, readonly: o, screenHasExplicitActions: s, toolbarActions: c, selectedIds: l, data: u, pkField: d, entityCode: m, onOpenDelete: h, onActionSuccess: g, tabNavigate: _ }) {
|
|
11283
|
+
let v = f(null), [y, b] = p(!1), { run: x } = Br(), S = c.find(({ action: e }) => e.type === "create"), C = c.filter(({ action: e }) => e.type !== "create" && e.type !== "edit"), w = C.filter(({ action: e }) => e.primary && !e.bulk_selection_required).slice(0, 2), T = C.filter(({ action: e }) => !e.bulk_selection_required), E = C.filter(({ action: e }) => e.bulk_selection_required), D = (e) => {
|
|
11276
11284
|
let t = e.display?.icon, n = t && B[t] ? B[t] : void 0;
|
|
11277
11285
|
return n ? /* @__PURE__ */ N(n, { size: 13 }) : null;
|
|
11278
11286
|
}, O = (e, t) => {
|
|
@@ -11281,7 +11289,7 @@ function Ga({ title: e, total: t, loaded: n, screenRoute: r, entityName: i, scre
|
|
|
11281
11289
|
action: t,
|
|
11282
11290
|
title: X(t.display?.name) || e,
|
|
11283
11291
|
execute: async (e) => {
|
|
11284
|
-
let t = await
|
|
11292
|
+
let t = await Jn(r, qn(e, n));
|
|
11285
11293
|
return n && n.length > 0 && g(), t;
|
|
11286
11294
|
}
|
|
11287
11295
|
});
|
|
@@ -11329,7 +11337,7 @@ function Ga({ title: e, total: t, loaded: n, screenRoute: r, entityName: i, scre
|
|
|
11329
11337
|
if (t.type === "delete") {
|
|
11330
11338
|
let n = l, r = t.conditions && t.conditions.length > 0 ? n.filter((e) => {
|
|
11331
11339
|
let n = u.find((t) => String(t[d] ?? "") === e);
|
|
11332
|
-
return n ?
|
|
11340
|
+
return n ? Xi(t.conditions, n) : !1;
|
|
11333
11341
|
}) : n, i = r.length === 0;
|
|
11334
11342
|
return /* @__PURE__ */ N(V, {
|
|
11335
11343
|
icon: /* @__PURE__ */ N(B.trash, { size: 13 }),
|
|
@@ -11461,8 +11469,8 @@ function Ga({ title: e, total: t, loaded: n, screenRoute: r, entityName: i, scre
|
|
|
11461
11469
|
]
|
|
11462
11470
|
});
|
|
11463
11471
|
}
|
|
11464
|
-
function
|
|
11465
|
-
let { run: c } =
|
|
11472
|
+
function qa({ selectedIds: e, toolbarActions: t, data: n, pkField: r, entityCode: i, onOpenDelete: a, onClear: o, onActionSuccess: s }) {
|
|
11473
|
+
let { run: c } = Br(), l = k(), u = t.filter(({ action: e }) => e.type !== "create" && e.type !== "edit" && e.type !== "delete" && e.bulk_selection_required), d = t.find(({ action: e }) => e.type === "delete"), f = (e) => {
|
|
11466
11474
|
let t = e.display?.icon, n = t && B[t] ? B[t] : void 0;
|
|
11467
11475
|
return n ? /* @__PURE__ */ N(n, { size: 12 }) : null;
|
|
11468
11476
|
}, p = u.map(({ code: t, action: n }) => ({
|
|
@@ -11477,13 +11485,13 @@ function Ka({ selectedIds: e, toolbarActions: t, data: n, pkField: r, entityCode
|
|
|
11477
11485
|
action: n,
|
|
11478
11486
|
title: X(n.display?.name) || t,
|
|
11479
11487
|
execute: async (t) => {
|
|
11480
|
-
let n = await
|
|
11488
|
+
let n = await Jn(r, qn(t, e));
|
|
11481
11489
|
return s(), i && (l.invalidateQueries({ queryKey: ["entity-data", i] }), l.invalidateQueries({ queryKey: ["entity-item", i] })), n;
|
|
11482
11490
|
}
|
|
11483
11491
|
});
|
|
11484
11492
|
}
|
|
11485
11493
|
}));
|
|
11486
|
-
return /* @__PURE__ */ N(
|
|
11494
|
+
return /* @__PURE__ */ N(Ta, {
|
|
11487
11495
|
count: e.length,
|
|
11488
11496
|
actions: p,
|
|
11489
11497
|
onClear: o,
|
|
@@ -11491,14 +11499,14 @@ function Ka({ selectedIds: e, toolbarActions: t, data: n, pkField: r, entityCode
|
|
|
11491
11499
|
let t = d.action, i = e;
|
|
11492
11500
|
a(t.conditions && t.conditions.length > 0 ? i.filter((e) => {
|
|
11493
11501
|
let i = n.find((t) => String(t[r] ?? "") === e);
|
|
11494
|
-
return i ?
|
|
11502
|
+
return i ? Xi(t.conditions, i) : !1;
|
|
11495
11503
|
}) : i, X(t.confirmation) || void 0);
|
|
11496
11504
|
} : void 0
|
|
11497
11505
|
});
|
|
11498
11506
|
}
|
|
11499
11507
|
//#endregion
|
|
11500
11508
|
//#region src/lib/timestamp.ts
|
|
11501
|
-
function
|
|
11509
|
+
function Ja(e) {
|
|
11502
11510
|
let t = e.match(/([+-]\d{2}:\d{2})$/), n = e.endsWith("Z");
|
|
11503
11511
|
if (t || n) {
|
|
11504
11512
|
let r = new Date(e);
|
|
@@ -11533,7 +11541,7 @@ function qa(e) {
|
|
|
11533
11541
|
}
|
|
11534
11542
|
//#endregion
|
|
11535
11543
|
//#region src/hooks/useEntityItem.ts
|
|
11536
|
-
function
|
|
11544
|
+
function Ya(e, t) {
|
|
11537
11545
|
let n = t === void 0 || t === "new" ? void 0 : typeof t == "string" ? t : Object.keys(t).sort().map((e) => `${e}=${t[e]}`).join("&");
|
|
11538
11546
|
return O({
|
|
11539
11547
|
queryKey: [
|
|
@@ -11541,13 +11549,13 @@ function Ja(e, t) {
|
|
|
11541
11549
|
e,
|
|
11542
11550
|
n
|
|
11543
11551
|
],
|
|
11544
|
-
queryFn: () =>
|
|
11552
|
+
queryFn: () => Bn(e, t),
|
|
11545
11553
|
enabled: !!e && !!t && t !== "new" && n !== void 0
|
|
11546
11554
|
});
|
|
11547
11555
|
}
|
|
11548
11556
|
//#endregion
|
|
11549
11557
|
//#region src/components/shared/AssociationTabs.tsx
|
|
11550
|
-
function
|
|
11558
|
+
function Xa({ entityCode: e, recordId: t, associations: n, schema: r }) {
|
|
11551
11559
|
let i = d(() => Object.entries(n), [n]), [a, o] = p(0);
|
|
11552
11560
|
if (i.length === 0) return null;
|
|
11553
11561
|
let [s, c] = i[a];
|
|
@@ -11590,7 +11598,7 @@ function Ya({ entityCode: e, recordId: t, associations: n, schema: r }) {
|
|
|
11590
11598
|
}),
|
|
11591
11599
|
collapsible: !1,
|
|
11592
11600
|
padding: "0",
|
|
11593
|
-
children: /* @__PURE__ */ N(
|
|
11601
|
+
children: /* @__PURE__ */ N(Za, {
|
|
11594
11602
|
entityCode: e,
|
|
11595
11603
|
recordId: t,
|
|
11596
11604
|
assocKey: s,
|
|
@@ -11599,21 +11607,21 @@ function Ya({ entityCode: e, recordId: t, associations: n, schema: r }) {
|
|
|
11599
11607
|
})
|
|
11600
11608
|
});
|
|
11601
11609
|
}
|
|
11602
|
-
function
|
|
11610
|
+
function Za({ entityCode: e, recordId: t, assocKey: n, association: r, schema: i }) {
|
|
11603
11611
|
let a = Mt(), o = `${e}.${n}`, { data: s, isLoading: c } = O({
|
|
11604
11612
|
queryKey: [
|
|
11605
11613
|
"association",
|
|
11606
11614
|
o,
|
|
11607
11615
|
t
|
|
11608
11616
|
],
|
|
11609
|
-
queryFn: () =>
|
|
11617
|
+
queryFn: () => Yn(o, [t])
|
|
11610
11618
|
}), l = s?.target_entity ?? r.target, u = i.entities[l], f = s?.ids ?? [], p = d(() => u?.fields.names().find((e) => u.fields.get(e)?.primary) ?? "id", [u]), m = d(() => f.slice(0, 50), [f]), { data: h, isLoading: g } = O({
|
|
11611
11619
|
queryKey: [
|
|
11612
11620
|
"association-records",
|
|
11613
11621
|
l,
|
|
11614
11622
|
m
|
|
11615
11623
|
],
|
|
11616
|
-
queryFn: () =>
|
|
11624
|
+
queryFn: () => zn(l, {
|
|
11617
11625
|
per_page: 50,
|
|
11618
11626
|
filters: [{
|
|
11619
11627
|
field: p,
|
|
@@ -11626,7 +11634,7 @@ function Xa({ entityCode: e, recordId: t, assocKey: n, association: r, schema: i
|
|
|
11626
11634
|
let t = u.fields.get(e);
|
|
11627
11635
|
return t && !t.primary && !t.auto && t.display?.is_listable !== !1;
|
|
11628
11636
|
}).slice(0, 6) : [], [u]), b = () => {
|
|
11629
|
-
let e =
|
|
11637
|
+
let e = ia(i, l);
|
|
11630
11638
|
if (!e) return;
|
|
11631
11639
|
let t = X(r.display?.name) || n, o = new URLSearchParams();
|
|
11632
11640
|
o.set("filters", JSON.stringify([{
|
|
@@ -11655,7 +11663,7 @@ function Xa({ entityCode: e, recordId: t, assocKey: n, association: r, schema: i
|
|
|
11655
11663
|
style: x,
|
|
11656
11664
|
children: "No related records."
|
|
11657
11665
|
});
|
|
11658
|
-
let S =
|
|
11666
|
+
let S = ia(i, l);
|
|
11659
11667
|
return /* @__PURE__ */ P("div", {
|
|
11660
11668
|
style: { padding: "8px 0" },
|
|
11661
11669
|
children: [
|
|
@@ -11730,17 +11738,17 @@ function Xa({ entityCode: e, recordId: t, assocKey: n, association: r, schema: i
|
|
|
11730
11738
|
}
|
|
11731
11739
|
//#endregion
|
|
11732
11740
|
//#region src/lib/utils.ts
|
|
11733
|
-
function
|
|
11741
|
+
function Qa(...e) {
|
|
11734
11742
|
return ae(ie(e));
|
|
11735
11743
|
}
|
|
11736
11744
|
//#endregion
|
|
11737
11745
|
//#region src/lib/size-value.ts
|
|
11738
|
-
var
|
|
11739
|
-
function
|
|
11746
|
+
var $a = /^(\d+)px$/;
|
|
11747
|
+
function eo(e) {
|
|
11740
11748
|
if (e == null || e === "") return null;
|
|
11741
11749
|
if (e === "auto") return { kind: "auto" };
|
|
11742
11750
|
if (e === "fill") return { kind: "fill" };
|
|
11743
|
-
let t =
|
|
11751
|
+
let t = $a.exec(e);
|
|
11744
11752
|
if (t) {
|
|
11745
11753
|
let e = parseInt(t[1], 10);
|
|
11746
11754
|
return e > 0 ? {
|
|
@@ -11756,7 +11764,7 @@ function $a(e) {
|
|
|
11756
11764
|
}
|
|
11757
11765
|
//#endregion
|
|
11758
11766
|
//#region src/components/detail-layout/LayoutRow.tsx
|
|
11759
|
-
function
|
|
11767
|
+
function to({ config: e, ctx: t }) {
|
|
11760
11768
|
let { items: n, gap: r = 0, resizable: i = !1, stack_below: a } = e, o = a === "never" ? 0 : a ?? 768, [c, u] = p(!1), d = f(null);
|
|
11761
11769
|
l(() => {
|
|
11762
11770
|
if (o === 0) return;
|
|
@@ -11768,7 +11776,7 @@ function eo({ config: e, ctx: t }) {
|
|
|
11768
11776
|
return t.observe(e), () => t.disconnect();
|
|
11769
11777
|
}, [o]);
|
|
11770
11778
|
let [m, h] = p(null), g = f(null), _ = s(() => n.map((t) => {
|
|
11771
|
-
let n =
|
|
11779
|
+
let n = eo(t.width ?? t.column?.width ?? t.row?.width ?? e.width);
|
|
11772
11780
|
return n && n.kind === "weight" ? n.value : 1;
|
|
11773
11781
|
}), [n, e.width]), v = s((e, t) => {
|
|
11774
11782
|
t.preventDefault();
|
|
@@ -11787,20 +11795,20 @@ function eo({ config: e, ctx: t }) {
|
|
|
11787
11795
|
g.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
|
|
11788
11796
|
};
|
|
11789
11797
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", i);
|
|
11790
|
-
}, [m, _]), y = m ?? _(), b = e.height ?
|
|
11798
|
+
}, [m, _]), y = m ?? _(), b = e.height ? ro(e.height) : void 0;
|
|
11791
11799
|
return /* @__PURE__ */ N("div", {
|
|
11792
11800
|
ref: d,
|
|
11793
|
-
className:
|
|
11801
|
+
className: Qa("flex", c && "flex-col"),
|
|
11794
11802
|
style: {
|
|
11795
11803
|
gap: r ? `${r}px` : void 0,
|
|
11796
11804
|
...b
|
|
11797
11805
|
},
|
|
11798
11806
|
children: n.map((r, a) => /* @__PURE__ */ P("div", {
|
|
11799
|
-
className:
|
|
11800
|
-
style: c ? void 0 :
|
|
11807
|
+
className: Qa("min-w-0 flex items-stretch", c && "w-full"),
|
|
11808
|
+
style: c ? void 0 : no(r.width ?? r.column?.width ?? r.row?.width ?? e.width, y[a], r.min_width, r.max_width),
|
|
11801
11809
|
children: [/* @__PURE__ */ N("div", {
|
|
11802
|
-
className:
|
|
11803
|
-
children: /* @__PURE__ */ N(
|
|
11810
|
+
className: Qa("flex-1 min-w-0 flex flex-col", b && "overflow-y-auto overflow-x-hidden"),
|
|
11811
|
+
children: /* @__PURE__ */ N(ps, {
|
|
11804
11812
|
node: r,
|
|
11805
11813
|
ctx: t
|
|
11806
11814
|
})
|
|
@@ -11811,17 +11819,17 @@ function eo({ config: e, ctx: t }) {
|
|
|
11811
11819
|
}, a))
|
|
11812
11820
|
});
|
|
11813
11821
|
}
|
|
11814
|
-
function
|
|
11815
|
-
let i =
|
|
11822
|
+
function no(e, t, n, r) {
|
|
11823
|
+
let i = eo(e), a;
|
|
11816
11824
|
return a = !i || i.kind === "weight" ? `${t} 1 0%` : i.kind === "px" ? `0 0 ${i.value}px` : i.kind === "fill" ? "1 1 0%" : "0 0 auto", {
|
|
11817
11825
|
flex: a,
|
|
11818
11826
|
minWidth: n,
|
|
11819
11827
|
maxWidth: r
|
|
11820
11828
|
};
|
|
11821
11829
|
}
|
|
11822
|
-
function
|
|
11830
|
+
function ro(e) {
|
|
11823
11831
|
if (!e) return;
|
|
11824
|
-
let t =
|
|
11832
|
+
let t = eo(e);
|
|
11825
11833
|
if (t?.kind === "px") return {
|
|
11826
11834
|
height: `${t.value}px`,
|
|
11827
11835
|
overflow: "hidden"
|
|
@@ -11833,12 +11841,12 @@ function no(e) {
|
|
|
11833
11841
|
}
|
|
11834
11842
|
//#endregion
|
|
11835
11843
|
//#region src/components/detail-layout/LayoutColumn.tsx
|
|
11836
|
-
function
|
|
11844
|
+
function io({ config: e, ctx: t }) {
|
|
11837
11845
|
let { items: n, gap: r = 12 } = e;
|
|
11838
11846
|
return /* @__PURE__ */ N("div", {
|
|
11839
11847
|
className: "flex flex-col h-full",
|
|
11840
11848
|
style: { gap: r ? `${r}px` : void 0 },
|
|
11841
|
-
children: n.map((e, n) => /* @__PURE__ */ N(
|
|
11849
|
+
children: n.map((e, n) => /* @__PURE__ */ N(ps, {
|
|
11842
11850
|
node: e,
|
|
11843
11851
|
ctx: t
|
|
11844
11852
|
}, n))
|
|
@@ -11846,7 +11854,7 @@ function ro({ config: e, ctx: t }) {
|
|
|
11846
11854
|
}
|
|
11847
11855
|
//#endregion
|
|
11848
11856
|
//#region src/components/detail-layout/LayoutTabs.tsx
|
|
11849
|
-
function
|
|
11857
|
+
function ao(e, t) {
|
|
11850
11858
|
if (e.children) {
|
|
11851
11859
|
if (e.label) return X(e.label);
|
|
11852
11860
|
let n = t.entity.children?.find((t) => t.entity === e.children);
|
|
@@ -11856,7 +11864,7 @@ function io(e, t) {
|
|
|
11856
11864
|
}
|
|
11857
11865
|
return e.section ? X(e.section.name) : "Tab";
|
|
11858
11866
|
}
|
|
11859
|
-
function
|
|
11867
|
+
function oo(e, t) {
|
|
11860
11868
|
if (e.icon) return e.icon;
|
|
11861
11869
|
if (e.children) {
|
|
11862
11870
|
let n = t.entity.children?.find((t) => t.entity === e.children);
|
|
@@ -11865,7 +11873,7 @@ function ao(e, t) {
|
|
|
11865
11873
|
if (r) return r.display.icon;
|
|
11866
11874
|
}
|
|
11867
11875
|
}
|
|
11868
|
-
function
|
|
11876
|
+
function so({ config: e, ctx: t }) {
|
|
11869
11877
|
let { items: n } = e, [r, i] = p(0);
|
|
11870
11878
|
return n.length === 0 ? null : /* @__PURE__ */ N(be, {
|
|
11871
11879
|
title: /* @__PURE__ */ N("div", {
|
|
@@ -11879,7 +11887,7 @@ function oo({ config: e, ctx: t }) {
|
|
|
11879
11887
|
overflowX: "auto"
|
|
11880
11888
|
},
|
|
11881
11889
|
children: n.map((e, n) => {
|
|
11882
|
-
let a =
|
|
11890
|
+
let a = ao(e, t), o = oo(e, t), s = n === r;
|
|
11883
11891
|
return /* @__PURE__ */ P("button", {
|
|
11884
11892
|
onClick: (e) => {
|
|
11885
11893
|
e.stopPropagation(), i(n);
|
|
@@ -11908,7 +11916,7 @@ function oo({ config: e, ctx: t }) {
|
|
|
11908
11916
|
}),
|
|
11909
11917
|
collapsible: !1,
|
|
11910
11918
|
padding: "14px",
|
|
11911
|
-
children: /* @__PURE__ */ N(
|
|
11919
|
+
children: /* @__PURE__ */ N(ps, {
|
|
11912
11920
|
node: n[r],
|
|
11913
11921
|
ctx: t
|
|
11914
11922
|
}, r)
|
|
@@ -11916,7 +11924,7 @@ function oo({ config: e, ctx: t }) {
|
|
|
11916
11924
|
}
|
|
11917
11925
|
//#endregion
|
|
11918
11926
|
//#region src/components/detail-layout/SectionBlock.tsx
|
|
11919
|
-
function
|
|
11927
|
+
function co({ config: e, ctx: t }) {
|
|
11920
11928
|
let { name: n, items: r, collapsed: i = !1, columns: a, icon: o, badge: s } = e, c = a ? {
|
|
11921
11929
|
...t,
|
|
11922
11930
|
columns: a
|
|
@@ -11930,7 +11938,7 @@ function so({ config: e, ctx: t }) {
|
|
|
11930
11938
|
defaultOpen: !i,
|
|
11931
11939
|
icon: u,
|
|
11932
11940
|
badge: d,
|
|
11933
|
-
children: /* @__PURE__ */ N(
|
|
11941
|
+
children: /* @__PURE__ */ N(fs, {
|
|
11934
11942
|
nodes: r,
|
|
11935
11943
|
ctx: c
|
|
11936
11944
|
})
|
|
@@ -11938,38 +11946,38 @@ function so({ config: e, ctx: t }) {
|
|
|
11938
11946
|
}
|
|
11939
11947
|
//#endregion
|
|
11940
11948
|
//#region src/lib/child-config.ts
|
|
11941
|
-
function
|
|
11949
|
+
function lo(e, t, n) {
|
|
11942
11950
|
let r = e.display, i = {
|
|
11943
11951
|
entity: e.entity,
|
|
11944
11952
|
foreign_key: e.foreign_key,
|
|
11945
|
-
name:
|
|
11946
|
-
icon:
|
|
11947
|
-
mode:
|
|
11948
|
-
columns:
|
|
11949
|
-
sort:
|
|
11950
|
-
limit:
|
|
11951
|
-
editable:
|
|
11952
|
-
interaction:
|
|
11953
|
-
}, a =
|
|
11953
|
+
name: uo(n?.label, r?.name, po(t)),
|
|
11954
|
+
icon: uo(n?.icon, r?.icon, t.display.icon) ?? "",
|
|
11955
|
+
mode: uo(n?.mode, r?.mode, "table"),
|
|
11956
|
+
columns: uo(n?.columns, r?.columns, ho(t, e.foreign_key)),
|
|
11957
|
+
sort: uo(n?.sort, r?.sort, mo(t)),
|
|
11958
|
+
limit: uo(n?.limit, r?.limit, 20),
|
|
11959
|
+
editable: uo(n?.editable, r?.editable, !0),
|
|
11960
|
+
interaction: uo(n?.interaction, r?.interaction, fo(t))
|
|
11961
|
+
}, a = uo(n?.position_field, r?.position_field, void 0);
|
|
11954
11962
|
a && (i.position_field = a, i.sort = a + ":asc");
|
|
11955
11963
|
let o = n?.timeline ?? r?.timeline;
|
|
11956
|
-
i.mode === "timeline" ? i.timeline =
|
|
11964
|
+
i.mode === "timeline" ? i.timeline = go(o ?? {}, t) : o && (i.timeline = o);
|
|
11957
11965
|
let s = n?.cards ?? r?.cards;
|
|
11958
11966
|
s && (i.cards = s);
|
|
11959
11967
|
let c = n?.quick_add ?? e.quick_add;
|
|
11960
11968
|
return c && (i.quick_add = c), i;
|
|
11961
11969
|
}
|
|
11962
|
-
function
|
|
11970
|
+
function uo(e, t, n) {
|
|
11963
11971
|
return e ?? t ?? n;
|
|
11964
11972
|
}
|
|
11965
|
-
function
|
|
11966
|
-
let t = !!
|
|
11973
|
+
function fo(e) {
|
|
11974
|
+
let t = !!So(e);
|
|
11967
11975
|
return e.readonly ? "readonly" : t ? "navigate" : "inline_edit";
|
|
11968
11976
|
}
|
|
11969
|
-
function
|
|
11977
|
+
function po(e) {
|
|
11970
11978
|
return e.display.name_plural && Object.keys(e.display.name_plural).length > 0 ? e.display.name_plural : e.display.name;
|
|
11971
11979
|
}
|
|
11972
|
-
function
|
|
11980
|
+
function mo(e) {
|
|
11973
11981
|
if (e.fields.get("created_at")?.type === "timestamp") return "created_at:desc";
|
|
11974
11982
|
if (e.fields.get("updated_at")?.type === "timestamp") return "updated_at:desc";
|
|
11975
11983
|
for (let t of e.fields.names()) {
|
|
@@ -11980,10 +11988,10 @@ function po(e) {
|
|
|
11980
11988
|
let n = e.fields.get(t);
|
|
11981
11989
|
if (n && n.type === "date") return t + ":desc";
|
|
11982
11990
|
}
|
|
11983
|
-
let t =
|
|
11991
|
+
let t = So(e);
|
|
11984
11992
|
return t ? t + ":asc" : "";
|
|
11985
11993
|
}
|
|
11986
|
-
function
|
|
11994
|
+
function ho(e, t) {
|
|
11987
11995
|
let n = new Set(Array.isArray(t) ? t : [t]), r = [];
|
|
11988
11996
|
for (let t of e.fields.names()) {
|
|
11989
11997
|
if (r.length >= 6) break;
|
|
@@ -11992,11 +12000,11 @@ function mo(e, t) {
|
|
|
11992
12000
|
}
|
|
11993
12001
|
return r;
|
|
11994
12002
|
}
|
|
11995
|
-
function
|
|
12003
|
+
function go(e, t) {
|
|
11996
12004
|
let n = { ...e };
|
|
11997
|
-
return n.time_field ||=
|
|
12005
|
+
return n.time_field ||= yo(t), n.type_field ||= bo(t, "enum"), n.summary_field ||= xo(t, "string", "text"), n.content_field ||= bo(t, "text"), n.author_field || t.fields.get("created_by") && (n.author_field = "created_by"), n.direction_field ||= _o(t), n.intent_field ||= vo(t), n;
|
|
11998
12006
|
}
|
|
11999
|
-
function
|
|
12007
|
+
function _o(e) {
|
|
12000
12008
|
let t = e.fields.get("direction");
|
|
12001
12009
|
if (t && t.type === "enum") return "direction";
|
|
12002
12010
|
for (let t of [
|
|
@@ -12009,11 +12017,11 @@ function go(e) {
|
|
|
12009
12017
|
if (n && n.type === "bool") return t;
|
|
12010
12018
|
}
|
|
12011
12019
|
}
|
|
12012
|
-
function
|
|
12020
|
+
function vo(e) {
|
|
12013
12021
|
let t = e.fields.get("intent");
|
|
12014
12022
|
if (t && t.type === "enum") return "intent";
|
|
12015
12023
|
}
|
|
12016
|
-
function
|
|
12024
|
+
function yo(e) {
|
|
12017
12025
|
for (let t of e.fields.names()) {
|
|
12018
12026
|
let n = e.fields.get(t);
|
|
12019
12027
|
if (n && n.type === "timestamp" && !n.auto) return t;
|
|
@@ -12025,13 +12033,13 @@ function vo(e) {
|
|
|
12025
12033
|
if (n && n.type === "timestamp") return t;
|
|
12026
12034
|
}
|
|
12027
12035
|
}
|
|
12028
|
-
function
|
|
12036
|
+
function bo(e, t) {
|
|
12029
12037
|
for (let n of e.fields.names()) {
|
|
12030
12038
|
let r = e.fields.get(n);
|
|
12031
12039
|
if (r && r.type === t) return n;
|
|
12032
12040
|
}
|
|
12033
12041
|
}
|
|
12034
|
-
function
|
|
12042
|
+
function xo(e, ...t) {
|
|
12035
12043
|
for (let n of e.fields.names()) {
|
|
12036
12044
|
let r = e.fields.get(n);
|
|
12037
12045
|
if (r) {
|
|
@@ -12039,16 +12047,16 @@ function bo(e, ...t) {
|
|
|
12039
12047
|
}
|
|
12040
12048
|
}
|
|
12041
12049
|
}
|
|
12042
|
-
function
|
|
12050
|
+
function So(e) {
|
|
12043
12051
|
let t = Ve(e);
|
|
12044
12052
|
return t.length > 0 ? t[0] : void 0;
|
|
12045
12053
|
}
|
|
12046
|
-
function
|
|
12054
|
+
function Co(e, t) {
|
|
12047
12055
|
return e.children?.find((e) => e.entity === t);
|
|
12048
12056
|
}
|
|
12049
12057
|
//#endregion
|
|
12050
12058
|
//#region src/lib/quick-add.ts
|
|
12051
|
-
function
|
|
12059
|
+
function wo(e, t, n, r) {
|
|
12052
12060
|
let i = {
|
|
12053
12061
|
...t ?? {},
|
|
12054
12062
|
...e
|
|
@@ -12059,7 +12067,7 @@ function Co(e, t, n, r) {
|
|
|
12059
12067
|
} else i[n] = Array.isArray(r) ? r[0] : r;
|
|
12060
12068
|
return i;
|
|
12061
12069
|
}
|
|
12062
|
-
function
|
|
12070
|
+
function To(e, t) {
|
|
12063
12071
|
for (let n of t) {
|
|
12064
12072
|
let t = e[n];
|
|
12065
12073
|
if (t == null || t === "") return !1;
|
|
@@ -12068,32 +12076,32 @@ function wo(e, t) {
|
|
|
12068
12076
|
}
|
|
12069
12077
|
//#endregion
|
|
12070
12078
|
//#region src/components/detail-layout/useQuickAdd.ts
|
|
12071
|
-
function
|
|
12079
|
+
function Eo() {
|
|
12072
12080
|
let e = /* @__PURE__ */ new Date();
|
|
12073
12081
|
return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}T${String(e.getHours()).padStart(2, "0")}:${String(e.getMinutes()).padStart(2, "0")}`;
|
|
12074
12082
|
}
|
|
12075
|
-
function
|
|
12083
|
+
function Do(e, t, n, r) {
|
|
12076
12084
|
let [i, a] = p(() => {
|
|
12077
12085
|
let t = e.quick_add, n = r.entities[e.entity], i = {};
|
|
12078
|
-
if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (i[e] =
|
|
12086
|
+
if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (i[e] = Eo()) : i[e] = t.defaults[e];
|
|
12079
12087
|
return i;
|
|
12080
12088
|
}), o = k(), { mutate: s, isPending: c, error: l, reset: u } = D({
|
|
12081
|
-
mutationFn: (t) =>
|
|
12089
|
+
mutationFn: (t) => Vn(e.entity, t),
|
|
12082
12090
|
onSuccess: () => {
|
|
12083
12091
|
let i = e.quick_add, s = r.entities[e.entity], c = {};
|
|
12084
|
-
if (i?.fields) for (let e of i.fields) i?.defaults?.[e] == null ? s?.fields.get(e)?.type === "timestamp" ? c[e] =
|
|
12092
|
+
if (i?.fields) for (let e of i.fields) i?.defaults?.[e] == null ? s?.fields.get(e)?.type === "timestamp" ? c[e] = Eo() : c[e] = "" : c[e] = i.defaults[e];
|
|
12085
12093
|
a(c);
|
|
12086
12094
|
let l = Array.isArray(n) ? n.join("|") : n;
|
|
12087
12095
|
o.invalidateQueries({ queryKey: [
|
|
12088
|
-
|
|
12096
|
+
Kr,
|
|
12089
12097
|
t,
|
|
12090
12098
|
l,
|
|
12091
12099
|
e.entity
|
|
12092
12100
|
] });
|
|
12093
12101
|
}
|
|
12094
|
-
}), d = e.quick_add, f = r.entities[e.entity], m =
|
|
12102
|
+
}), d = e.quick_add, f = r.entities[e.entity], m = To(i, d?.fields.filter((e) => f?.fields.get(e)?.required) ?? []);
|
|
12095
12103
|
function h(t) {
|
|
12096
|
-
t.preventDefault(), d && s(
|
|
12104
|
+
t.preventDefault(), d && s(wo(i, d.defaults, e.foreign_key, n));
|
|
12097
12105
|
}
|
|
12098
12106
|
function g(e, t) {
|
|
12099
12107
|
l && u(), a((n) => ({
|
|
@@ -12114,8 +12122,8 @@ function Eo(e, t, n, r) {
|
|
|
12114
12122
|
}
|
|
12115
12123
|
//#endregion
|
|
12116
12124
|
//#region src/components/detail-layout/QuickAddForm.tsx
|
|
12117
|
-
function
|
|
12118
|
-
let { values: i, quickAdd: a, childEntity: o, isPending: s, error: c, isReady: l, handleSubmit: u, handleFieldChange: d } =
|
|
12125
|
+
function Oo({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
12126
|
+
let { values: i, quickAdd: a, childEntity: o, isPending: s, error: c, isReady: l, handleSubmit: u, handleFieldChange: d } = Do(e, t, n, r);
|
|
12119
12127
|
return !a || a.fields.length === 0 || !o ? null : /* @__PURE__ */ P("form", {
|
|
12120
12128
|
onSubmit: u,
|
|
12121
12129
|
style: {
|
|
@@ -12173,8 +12181,8 @@ function Do({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
12173
12181
|
}
|
|
12174
12182
|
//#endregion
|
|
12175
12183
|
//#region src/components/detail-layout/ChildrenTable.tsx
|
|
12176
|
-
function
|
|
12177
|
-
let i = r.entities[e.entity], a = Mt(), { data: o, isLoading: s, isError: c } =
|
|
12184
|
+
function ko({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
12185
|
+
let i = r.entities[e.entity], a = Mt(), { data: o, isLoading: s, isError: c } = qr(t, n, e.entity, e.foreign_key, e.sort, e.limit), l = o?.data ?? [], u = o?.$refs, d = e.columns, f = e.interaction === "navigate", p = d[0], m = f && i ? Object.values(r.screens ?? {}).find((t) => t.type === "detail" && t.entity === e.entity) : void 0, h = i ? So(i) : void 0;
|
|
12178
12186
|
if (!i) return /* @__PURE__ */ N("div", {
|
|
12179
12187
|
style: {
|
|
12180
12188
|
fontSize: 12.5,
|
|
@@ -12183,7 +12191,7 @@ function Oo({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
12183
12191
|
},
|
|
12184
12192
|
children: "Entity not found."
|
|
12185
12193
|
});
|
|
12186
|
-
let g = /* @__PURE__ */ N(
|
|
12194
|
+
let g = /* @__PURE__ */ N(Oo, {
|
|
12187
12195
|
config: e,
|
|
12188
12196
|
parentEntity: t,
|
|
12189
12197
|
parentId: n,
|
|
@@ -12287,8 +12295,8 @@ function Oo({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
12287
12295
|
}
|
|
12288
12296
|
//#endregion
|
|
12289
12297
|
//#region src/components/detail-layout/ChildrenList.tsx
|
|
12290
|
-
function
|
|
12291
|
-
let i = r.entities[e.entity], { data: a, isLoading: o, isError: s } =
|
|
12298
|
+
function Ao({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
12299
|
+
let i = r.entities[e.entity], { data: a, isLoading: o, isError: s } = qr(t, n, e.entity, e.foreign_key, e.sort, e.limit), c = a?.data ?? [], l = a?.$refs, u = e.columns;
|
|
12292
12300
|
if (!i) return /* @__PURE__ */ N("div", {
|
|
12293
12301
|
style: {
|
|
12294
12302
|
fontSize: 12.5,
|
|
@@ -12297,7 +12305,7 @@ function ko({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
12297
12305
|
},
|
|
12298
12306
|
children: "Entity not found."
|
|
12299
12307
|
});
|
|
12300
|
-
let d = /* @__PURE__ */ N(
|
|
12308
|
+
let d = /* @__PURE__ */ N(Oo, {
|
|
12301
12309
|
config: e,
|
|
12302
12310
|
parentEntity: t,
|
|
12303
12311
|
parentId: n,
|
|
@@ -12405,8 +12413,8 @@ function ko({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
12405
12413
|
}
|
|
12406
12414
|
//#endregion
|
|
12407
12415
|
//#region src/components/detail-layout/ChildrenCards.tsx
|
|
12408
|
-
function
|
|
12409
|
-
let i = r.entities[e.entity], { data: a, isLoading: o, isError: s } =
|
|
12416
|
+
function jo({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
12417
|
+
let i = r.entities[e.entity], { data: a, isLoading: o, isError: s } = qr(t, n, e.entity, e.foreign_key, e.sort, e.limit), c = a?.data ?? [], l = a?.$refs, u = e.columns, d = e.cards, f = d?.header_field ?? u[0], p = d?.badge_field, m = d?.columns_count ?? 3;
|
|
12410
12418
|
if (!i) return /* @__PURE__ */ N("div", {
|
|
12411
12419
|
style: {
|
|
12412
12420
|
fontSize: 12.5,
|
|
@@ -12419,7 +12427,7 @@ function Ao({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
12419
12427
|
display: "grid",
|
|
12420
12428
|
gridTemplateColumns: `repeat(auto-fill, minmax(${m >= 4 ? 180 : 240}px, 1fr))`,
|
|
12421
12429
|
gap: 12
|
|
12422
|
-
}, g = /* @__PURE__ */ N(
|
|
12430
|
+
}, g = /* @__PURE__ */ N(Oo, {
|
|
12423
12431
|
config: e,
|
|
12424
12432
|
parentEntity: t,
|
|
12425
12433
|
parentId: n,
|
|
@@ -12545,9 +12553,9 @@ function Ao({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
12545
12553
|
}
|
|
12546
12554
|
//#endregion
|
|
12547
12555
|
//#region src/components/detail-layout/TimelineComposer.tsx
|
|
12548
|
-
var
|
|
12549
|
-
function
|
|
12550
|
-
let { values: i, quickAdd: a, childEntity: o, isPending: c, error: u, isReady: m, handleSubmit: h, handleFieldChange: g } =
|
|
12556
|
+
var Mo = "quick_entry", No = 100, Po = 180, Fo = 800;
|
|
12557
|
+
function Io({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
12558
|
+
let { values: i, quickAdd: a, childEntity: o, isPending: c, error: u, isReady: m, handleSubmit: h, handleFieldChange: g } = Do(e, t, n, r), [_, v] = p(Po), y = f(null), b = f(i);
|
|
12551
12559
|
b.current = i;
|
|
12552
12560
|
let x = f(g);
|
|
12553
12561
|
x.current = g;
|
|
@@ -12561,7 +12569,7 @@ function Fo({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
12561
12569
|
t && (t.querySelector("textarea, input, select, [contenteditable]") ?? t).focus();
|
|
12562
12570
|
}
|
|
12563
12571
|
}), []);
|
|
12564
|
-
l(() =>
|
|
12572
|
+
l(() => br(Mo, C), [C]);
|
|
12565
12573
|
let w = s((e) => {
|
|
12566
12574
|
e.preventDefault(), y.current = {
|
|
12567
12575
|
startY: e.clientY,
|
|
@@ -12570,7 +12578,7 @@ function Fo({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
12570
12578
|
let t = (e) => {
|
|
12571
12579
|
if (!y.current) return;
|
|
12572
12580
|
let t = y.current.startY - e.clientY;
|
|
12573
|
-
v(Math.min(
|
|
12581
|
+
v(Math.min(Fo, Math.max(No, y.current.startHeight + t)));
|
|
12574
12582
|
}, n = () => {
|
|
12575
12583
|
y.current = null, document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
|
|
12576
12584
|
};
|
|
@@ -12701,8 +12709,8 @@ function Fo({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
12701
12709
|
}
|
|
12702
12710
|
//#endregion
|
|
12703
12711
|
//#region src/components/detail-layout/ChildrenTimeline.tsx
|
|
12704
|
-
function
|
|
12705
|
-
let i = r.entities[e.entity], { data: a, isLoading: o, isError: s } =
|
|
12712
|
+
function Lo({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
12713
|
+
let i = r.entities[e.entity], { data: a, isLoading: o, isError: s } = qr(t, n, e.entity, e.foreign_key, e.sort, e.limit), c = a?.data ?? [], u = a?.$refs, d = e.timeline, m = d?.scroll ?? !1, h = d?.auto_scroll ?? "none", g = f(null), _ = f(!1), v = f(0);
|
|
12706
12714
|
l(() => {
|
|
12707
12715
|
_.current = !1, v.current = 0;
|
|
12708
12716
|
}, [n]), l(() => {
|
|
@@ -12752,7 +12760,7 @@ function Io({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
12752
12760
|
children: "No activity yet."
|
|
12753
12761
|
}) : c.map((a, o) => {
|
|
12754
12762
|
let s = String(a.id ?? o);
|
|
12755
|
-
return /* @__PURE__ */ N(
|
|
12763
|
+
return /* @__PURE__ */ N(Ro, {
|
|
12756
12764
|
row: a,
|
|
12757
12765
|
rowId: s,
|
|
12758
12766
|
childEntity: i,
|
|
@@ -12805,7 +12813,7 @@ function Io({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
12805
12813
|
},
|
|
12806
12814
|
children: C
|
|
12807
12815
|
}),
|
|
12808
|
-
/* @__PURE__ */ N(
|
|
12816
|
+
/* @__PURE__ */ N(Io, {
|
|
12809
12817
|
config: e,
|
|
12810
12818
|
parentEntity: t,
|
|
12811
12819
|
parentId: n,
|
|
@@ -12819,17 +12827,17 @@ function Io({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
12819
12827
|
gap: 8
|
|
12820
12828
|
},
|
|
12821
12829
|
children: C
|
|
12822
|
-
}), /* @__PURE__ */ N(
|
|
12830
|
+
}), /* @__PURE__ */ N(Io, {
|
|
12823
12831
|
config: e,
|
|
12824
12832
|
parentEntity: t,
|
|
12825
12833
|
parentId: n,
|
|
12826
12834
|
schema: r
|
|
12827
12835
|
})] });
|
|
12828
12836
|
}
|
|
12829
|
-
function
|
|
12837
|
+
function Ro({ row: e, rowId: t, childEntity: n, entityCode: r, parentEntity: i, parentId: a, timeline: o, editableFields: c, refs: l, isEditing: u, onStartEdit: d, onCancelEdit: f, onSaved: m, schema: h }) {
|
|
12830
12838
|
let g = k(), [_, v] = p({}), y = s(() => {
|
|
12831
12839
|
g.invalidateQueries({ queryKey: [
|
|
12832
|
-
|
|
12840
|
+
Kr,
|
|
12833
12841
|
i,
|
|
12834
12842
|
a,
|
|
12835
12843
|
r
|
|
@@ -12840,13 +12848,13 @@ function Lo({ row: e, rowId: t, childEntity: n, entityCode: r, parentEntity: i,
|
|
|
12840
12848
|
a,
|
|
12841
12849
|
r
|
|
12842
12850
|
]), b = D({
|
|
12843
|
-
mutationFn: (e) =>
|
|
12851
|
+
mutationFn: (e) => Hn(r, t, e),
|
|
12844
12852
|
onSuccess: () => {
|
|
12845
12853
|
y(), j.success("Updated"), m();
|
|
12846
12854
|
},
|
|
12847
12855
|
onError: (e) => j.error(e.message)
|
|
12848
12856
|
}), x = D({
|
|
12849
|
-
mutationFn: () =>
|
|
12857
|
+
mutationFn: () => Un(r, t),
|
|
12850
12858
|
onSuccess: () => {
|
|
12851
12859
|
y(), j.success("Deleted");
|
|
12852
12860
|
},
|
|
@@ -12962,7 +12970,7 @@ function Lo({ row: e, rowId: t, childEntity: n, entityCode: r, parentEntity: i,
|
|
|
12962
12970
|
refs: l
|
|
12963
12971
|
})
|
|
12964
12972
|
}),
|
|
12965
|
-
M && e[M] != null && n.fields.get(M) && /* @__PURE__ */ N(
|
|
12973
|
+
M && e[M] != null && n.fields.get(M) && /* @__PURE__ */ N(zo, {
|
|
12966
12974
|
value: e[M],
|
|
12967
12975
|
field: n.fields.get(M)
|
|
12968
12976
|
}),
|
|
@@ -13044,8 +13052,8 @@ function Lo({ row: e, rowId: t, childEntity: n, entityCode: r, parentEntity: i,
|
|
|
13044
13052
|
]
|
|
13045
13053
|
});
|
|
13046
13054
|
}
|
|
13047
|
-
function
|
|
13048
|
-
let n =
|
|
13055
|
+
function zo({ value: e, field: t }) {
|
|
13056
|
+
let n = Bo(e, t);
|
|
13049
13057
|
return n === null ? null : /* @__PURE__ */ N(U, {
|
|
13050
13058
|
tone: "slate",
|
|
13051
13059
|
size: "xs",
|
|
@@ -13059,7 +13067,7 @@ function Ro({ value: e, field: t }) {
|
|
|
13059
13067
|
})
|
|
13060
13068
|
});
|
|
13061
13069
|
}
|
|
13062
|
-
function
|
|
13070
|
+
function Bo(e, t) {
|
|
13063
13071
|
if (t.type === "bool") return e === !0;
|
|
13064
13072
|
if (typeof e == "string") {
|
|
13065
13073
|
let t = e.toLowerCase();
|
|
@@ -13070,7 +13078,7 @@ function zo(e, t) {
|
|
|
13070
13078
|
}
|
|
13071
13079
|
//#endregion
|
|
13072
13080
|
//#region src/components/detail-layout/EditableChildrenTable.tsx
|
|
13073
|
-
function
|
|
13081
|
+
function Vo({ config: e, childEntity: t, schema: n, rows: r, onChange: i, validationErrors: a, refs: o }) {
|
|
13074
13082
|
let c = f(null), l = e.columns, u = new Set(Array.isArray(e.foreign_key) ? e.foreign_key : [e.foreign_key]), d = l.filter((n) => {
|
|
13075
13083
|
if (u.has(n) || e.position_field && n === e.position_field) return !1;
|
|
13076
13084
|
let r = t.fields.get(n);
|
|
@@ -13250,7 +13258,7 @@ function Bo({ config: e, childEntity: t, schema: n, rows: r, onChange: i, valida
|
|
|
13250
13258
|
}
|
|
13251
13259
|
//#endregion
|
|
13252
13260
|
//#region src/components/detail-layout/DraggableChildrenTable.tsx
|
|
13253
|
-
function
|
|
13261
|
+
function Ho({ config: e, childEntity: t, schema: n, rows: r, onChange: i, validationErrors: a, refs: o }) {
|
|
13254
13262
|
let c = f(null), l = e.position_field, u = e.columns, p = ue(le(se, { activationConstraint: { distance: 5 } })), m = new Set(Array.isArray(e.foreign_key) ? e.foreign_key : [e.foreign_key]), h = u.filter((e) => {
|
|
13255
13263
|
if (m.has(e) || e === l) return !1;
|
|
13256
13264
|
let n = t.fields.get(e);
|
|
@@ -13389,7 +13397,7 @@ function Vo({ config: e, childEntity: t, schema: n, rows: r, onChange: i, valida
|
|
|
13389
13397
|
] }) }), /* @__PURE__ */ N(de, {
|
|
13390
13398
|
items: v,
|
|
13391
13399
|
strategy: pe,
|
|
13392
|
-
children: /* @__PURE__ */ N("tbody", { children: r.map((e) => /* @__PURE__ */ N(
|
|
13400
|
+
children: /* @__PURE__ */ N("tbody", { children: r.map((e) => /* @__PURE__ */ N(Uo, {
|
|
13393
13401
|
row: e,
|
|
13394
13402
|
columns: _,
|
|
13395
13403
|
editableColumns: h,
|
|
@@ -13415,7 +13423,7 @@ function Vo({ config: e, childEntity: t, schema: n, rows: r, onChange: i, valida
|
|
|
13415
13423
|
})
|
|
13416
13424
|
})] });
|
|
13417
13425
|
}
|
|
13418
|
-
function
|
|
13426
|
+
function Uo({ row: e, columns: t, editableColumns: n, displayOnlyColumns: r, childEntity: i, validationErrors: a, refs: o, onCellChange: s, onDelete: c, onUndoDelete: l }) {
|
|
13419
13427
|
let u = !!e._deleted, d = a?.[e._key], { attributes: f, listeners: p, setNodeRef: m, transform: h, transition: g, isDragging: _ } = fe({
|
|
13420
13428
|
id: e._key,
|
|
13421
13429
|
disabled: u
|
|
@@ -13520,10 +13528,10 @@ function Ho({ row: e, columns: t, editableColumns: n, displayOnlyColumns: r, chi
|
|
|
13520
13528
|
}
|
|
13521
13529
|
//#endregion
|
|
13522
13530
|
//#region src/components/detail-layout/ChildrenBlock.tsx
|
|
13523
|
-
function
|
|
13531
|
+
function Wo({ node: e, ctx: t }) {
|
|
13524
13532
|
let n = e.children;
|
|
13525
13533
|
if (!n || t.isNew && t.mode !== "edit") return null;
|
|
13526
|
-
let r =
|
|
13534
|
+
let r = Co(t.entity, n);
|
|
13527
13535
|
if (!r) return /* @__PURE__ */ P("div", {
|
|
13528
13536
|
className: "text-sm text-muted-foreground py-2",
|
|
13529
13537
|
children: ["Unknown child relation: ", n]
|
|
@@ -13533,10 +13541,10 @@ function Uo({ node: e, ctx: t }) {
|
|
|
13533
13541
|
className: "text-sm text-muted-foreground py-2",
|
|
13534
13542
|
children: ["Entity not found: ", r.entity]
|
|
13535
13543
|
});
|
|
13536
|
-
let a =
|
|
13544
|
+
let a = lo(r, i, e);
|
|
13537
13545
|
if (t.mode === "edit" && a.editable && a.interaction !== "navigate" && a.interaction !== "readonly" && !i.readonly && a.mode === "table" && t.pendingChildren !== void 0 && t.onChildrenChange) {
|
|
13538
13546
|
let e = t.pendingChildren[n] ?? [], r = t.childValidationErrors?.[n];
|
|
13539
|
-
return /* @__PURE__ */ N(a.position_field ?
|
|
13547
|
+
return /* @__PURE__ */ N(a.position_field ? Ho : Vo, {
|
|
13540
13548
|
config: a,
|
|
13541
13549
|
childEntity: i,
|
|
13542
13550
|
schema: t.schema,
|
|
@@ -13554,19 +13562,19 @@ function Uo({ node: e, ctx: t }) {
|
|
|
13554
13562
|
schema: t.schema
|
|
13555
13563
|
};
|
|
13556
13564
|
switch (a.mode) {
|
|
13557
|
-
case "table": return /* @__PURE__ */ N(
|
|
13558
|
-
case "list": return /* @__PURE__ */ N(
|
|
13559
|
-
case "cards": return /* @__PURE__ */ N(
|
|
13560
|
-
case "timeline": return /* @__PURE__ */ N(
|
|
13561
|
-
default: return /* @__PURE__ */ N(
|
|
13565
|
+
case "table": return /* @__PURE__ */ N(ko, { ...o });
|
|
13566
|
+
case "list": return /* @__PURE__ */ N(Ao, { ...o });
|
|
13567
|
+
case "cards": return /* @__PURE__ */ N(jo, { ...o });
|
|
13568
|
+
case "timeline": return /* @__PURE__ */ N(Lo, { ...o });
|
|
13569
|
+
default: return /* @__PURE__ */ N(ko, { ...o });
|
|
13562
13570
|
}
|
|
13563
13571
|
}
|
|
13564
13572
|
//#endregion
|
|
13565
13573
|
//#region src/hooks/useAssociatedData.ts
|
|
13566
|
-
function
|
|
13574
|
+
function Go(e, t, n, r, i, a, o, s) {
|
|
13567
13575
|
return E({
|
|
13568
13576
|
queryKey: [
|
|
13569
|
-
|
|
13577
|
+
Kr,
|
|
13570
13578
|
e,
|
|
13571
13579
|
t,
|
|
13572
13580
|
n,
|
|
@@ -13595,7 +13603,7 @@ function Wo(e, t, n, r, i, a, o, s) {
|
|
|
13595
13603
|
}
|
|
13596
13604
|
//#endregion
|
|
13597
13605
|
//#region src/components/detail-layout/AssociatedToolbar.tsx
|
|
13598
|
-
function
|
|
13606
|
+
function Ko({ entity: e, searchable: t, filterFields: n, searchValue: r, onSearchChange: i, filters: a, onFilterChange: o, allEntities: s }) {
|
|
13599
13607
|
let c = t === !0, l = n && n.length > 0;
|
|
13600
13608
|
return !c && !l ? null : /* @__PURE__ */ P("div", {
|
|
13601
13609
|
style: {
|
|
@@ -13619,7 +13627,7 @@ function Go({ entity: e, searchable: t, filterFields: n, searchValue: r, onSearc
|
|
|
13619
13627
|
let n = e.fields.get(t);
|
|
13620
13628
|
if (!n) return null;
|
|
13621
13629
|
let r = a[t] ?? "__all__", i = ze(n, t, s);
|
|
13622
|
-
return n.type === "ref" && n.ref?.entity ? /* @__PURE__ */ N(
|
|
13630
|
+
return n.type === "ref" && n.ref?.entity ? /* @__PURE__ */ N(qo, {
|
|
13623
13631
|
field: n,
|
|
13624
13632
|
label: i,
|
|
13625
13633
|
value: r,
|
|
@@ -13642,8 +13650,8 @@ function Go({ entity: e, searchable: t, filterFields: n, searchValue: r, onSearc
|
|
|
13642
13650
|
})]
|
|
13643
13651
|
});
|
|
13644
13652
|
}
|
|
13645
|
-
function
|
|
13646
|
-
let i =
|
|
13653
|
+
function qo({ field: e, label: t, value: n, onChange: r }) {
|
|
13654
|
+
let i = Zn(e.ref?.entity), a = e.display?.ref_display_field ?? i?.display?.display_field, o = d(() => i ? [...i.fields].find(([, e]) => e.primary)?.[0] ?? "id" : "id", [i]), { data: s } = Xn(e.ref?.entity, {
|
|
13647
13655
|
per_page: 200,
|
|
13648
13656
|
sort: a ? `${a}:asc` : void 0
|
|
13649
13657
|
}), c = s?.data ?? [], l = (e) => {
|
|
@@ -13675,7 +13683,7 @@ function Ko({ field: e, label: t, value: n, onChange: r }) {
|
|
|
13675
13683
|
}
|
|
13676
13684
|
//#endregion
|
|
13677
13685
|
//#region src/components/detail-layout/AssociatedBlock.tsx
|
|
13678
|
-
function
|
|
13686
|
+
function Jo({ node: e, ctx: t }) {
|
|
13679
13687
|
let n = e.associated;
|
|
13680
13688
|
if (!n || t.isNew) return null;
|
|
13681
13689
|
let r = t.schema.entities[n];
|
|
@@ -13720,7 +13728,7 @@ function qo({ node: e, ctx: t }) {
|
|
|
13720
13728
|
textTransform: "uppercase"
|
|
13721
13729
|
},
|
|
13722
13730
|
children: c
|
|
13723
|
-
}), l ? /* @__PURE__ */ N(
|
|
13731
|
+
}), l ? /* @__PURE__ */ N(Xo, {
|
|
13724
13732
|
entityCode: n,
|
|
13725
13733
|
entity: r,
|
|
13726
13734
|
parentEntity: t.entityCode,
|
|
@@ -13733,7 +13741,7 @@ function qo({ node: e, ctx: t }) {
|
|
|
13733
13741
|
searchable: e.searchable,
|
|
13734
13742
|
filterFields: e.filters,
|
|
13735
13743
|
sort: e.sort
|
|
13736
|
-
}) : /* @__PURE__ */ N(
|
|
13744
|
+
}) : /* @__PURE__ */ N(Yo, {
|
|
13737
13745
|
entityCode: n,
|
|
13738
13746
|
entity: r,
|
|
13739
13747
|
parentEntity: t.entityCode,
|
|
@@ -13746,9 +13754,9 @@ function qo({ node: e, ctx: t }) {
|
|
|
13746
13754
|
sort: e.sort
|
|
13747
13755
|
})] });
|
|
13748
13756
|
}
|
|
13749
|
-
function
|
|
13750
|
-
let d = k(), { data: f, isLoading: p, isError: m } =
|
|
13751
|
-
return /* @__PURE__ */ N(
|
|
13757
|
+
function Yo({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: c, ctx: l, sort: u }) {
|
|
13758
|
+
let d = k(), { data: f, isLoading: p, isError: m } = qr(n, r, e, i, u), h = f?.data ?? [], g = f?.$refs;
|
|
13759
|
+
return /* @__PURE__ */ N(Zo, {
|
|
13752
13760
|
entityCode: e,
|
|
13753
13761
|
entity: t,
|
|
13754
13762
|
parentId: r,
|
|
@@ -13763,7 +13771,7 @@ function Jo({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
13763
13771
|
isError: m,
|
|
13764
13772
|
invalidateQuery: s(() => {
|
|
13765
13773
|
d.invalidateQueries({ queryKey: [
|
|
13766
|
-
|
|
13774
|
+
Kr,
|
|
13767
13775
|
n,
|
|
13768
13776
|
r,
|
|
13769
13777
|
e
|
|
@@ -13776,7 +13784,7 @@ function Jo({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
13776
13784
|
])
|
|
13777
13785
|
});
|
|
13778
13786
|
}
|
|
13779
|
-
function
|
|
13787
|
+
function Xo({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: c, ctx: u, searchable: m, filterFields: h, sort: g }) {
|
|
13780
13788
|
let _ = k(), [v, y] = p(""), [b, x] = p(""), [S, C] = p({}), w = f(void 0);
|
|
13781
13789
|
l(() => (w.current && clearTimeout(w.current), w.current = setTimeout(() => {
|
|
13782
13790
|
x(v);
|
|
@@ -13794,7 +13802,7 @@ function Yo({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
13794
13802
|
[e]: t
|
|
13795
13803
|
};
|
|
13796
13804
|
});
|
|
13797
|
-
}, []), E = d(() => Object.keys(S).length > 0 ? S : void 0, [S]), { data: D, isLoading: O, isError: A, hasNextPage: j, fetchNextPage: M, isFetchingNextPage: F } =
|
|
13805
|
+
}, []), E = d(() => Object.keys(S).length > 0 ? S : void 0, [S]), { data: D, isLoading: O, isError: A, hasNextPage: j, fetchNextPage: M, isFetchingNextPage: F } = Go(n, r, e, i, g, void 0, b || void 0, E), { rows: I, refs: ee } = d(() => {
|
|
13798
13806
|
if (!D?.pages) return {
|
|
13799
13807
|
rows: [],
|
|
13800
13808
|
refs: void 0
|
|
@@ -13816,7 +13824,7 @@ function Yo({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
13816
13824
|
} });
|
|
13817
13825
|
}, [_, e]);
|
|
13818
13826
|
return /* @__PURE__ */ P("div", { children: [
|
|
13819
|
-
/* @__PURE__ */ N(
|
|
13827
|
+
/* @__PURE__ */ N(Ko, {
|
|
13820
13828
|
entity: t,
|
|
13821
13829
|
searchable: m,
|
|
13822
13830
|
filterFields: h,
|
|
@@ -13826,7 +13834,7 @@ function Yo({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
13826
13834
|
onFilterChange: T,
|
|
13827
13835
|
allEntities: u.schema.entities
|
|
13828
13836
|
}),
|
|
13829
|
-
/* @__PURE__ */ N(
|
|
13837
|
+
/* @__PURE__ */ N(Zo, {
|
|
13830
13838
|
entityCode: e,
|
|
13831
13839
|
entity: t,
|
|
13832
13840
|
parentId: r,
|
|
@@ -13854,7 +13862,7 @@ function Yo({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
13854
13862
|
})
|
|
13855
13863
|
] });
|
|
13856
13864
|
}
|
|
13857
|
-
function
|
|
13865
|
+
function Zo({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i, editable: a, interaction: o, ctx: c, rows: u, refs: m, isLoading: h, isError: g, invalidateQuery: _ }) {
|
|
13858
13866
|
let v = Mt(), y = i.find((e) => e !== r), b = d(() => o === "navigate" ? Object.values(c.schema.screens ?? {}).find((t) => t.type === "detail" && t.entity === e) : void 0, [
|
|
13859
13867
|
o,
|
|
13860
13868
|
c.schema.screens,
|
|
@@ -13887,7 +13895,7 @@ function Xo({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
13887
13895
|
}
|
|
13888
13896
|
}));
|
|
13889
13897
|
try {
|
|
13890
|
-
await
|
|
13898
|
+
await Hn(e, t, n), T((e) => {
|
|
13891
13899
|
let n = e[t];
|
|
13892
13900
|
if (!n) return e;
|
|
13893
13901
|
if (n.ver > r) return {
|
|
@@ -13961,7 +13969,7 @@ function Xo({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
13961
13969
|
}
|
|
13962
13970
|
F(!0);
|
|
13963
13971
|
try {
|
|
13964
|
-
await
|
|
13972
|
+
await Vn(e, O), k(null), j([]), _();
|
|
13965
13973
|
} catch (e) {
|
|
13966
13974
|
j([`_error:${e instanceof Error ? e.message : "Create failed"}`]);
|
|
13967
13975
|
} finally {
|
|
@@ -13977,7 +13985,7 @@ function Xo({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
13977
13985
|
]), ae = s(async (t) => {
|
|
13978
13986
|
ee(null), R((e) => new Set(e).add(t));
|
|
13979
13987
|
try {
|
|
13980
|
-
await
|
|
13988
|
+
await Un(e, t), _();
|
|
13981
13989
|
} catch {} finally {
|
|
13982
13990
|
R((e) => {
|
|
13983
13991
|
let n = new Set(e);
|
|
@@ -14050,7 +14058,7 @@ function Xo({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
14050
14058
|
width: 40
|
|
14051
14059
|
} })] }) }), /* @__PURE__ */ P("tbody", { children: [u.map((n) => {
|
|
14052
14060
|
let r = String(n.id ?? ""), o = L.has(r), s = w[r], c = b && r ? b.route.replace(/:\w+/, r) : void 0, l = X(t.display?.name) || e, u = t.display?.icon;
|
|
14053
|
-
return /* @__PURE__ */ N(
|
|
14061
|
+
return /* @__PURE__ */ N(Qo, {
|
|
14054
14062
|
rowId: r,
|
|
14055
14063
|
row: n,
|
|
14056
14064
|
entity: t,
|
|
@@ -14078,7 +14086,7 @@ function Xo({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
14078
14086
|
icon: u
|
|
14079
14087
|
}) : void 0
|
|
14080
14088
|
}, r);
|
|
14081
|
-
}), O && /* @__PURE__ */ N(
|
|
14089
|
+
}), O && /* @__PURE__ */ N($o, {
|
|
14082
14090
|
draftRow: O,
|
|
14083
14091
|
entity: t,
|
|
14084
14092
|
columns: i,
|
|
@@ -14109,7 +14117,7 @@ function Xo({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
14109
14117
|
children: "Add row"
|
|
14110
14118
|
})
|
|
14111
14119
|
}),
|
|
14112
|
-
I && /* @__PURE__ */ N(
|
|
14120
|
+
I && /* @__PURE__ */ N(Yi, {
|
|
14113
14121
|
open: I.show,
|
|
14114
14122
|
onOpenChange: (e) => !e && ee(null),
|
|
14115
14123
|
title: "Delete record",
|
|
@@ -14120,7 +14128,7 @@ function Xo({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
14120
14128
|
})
|
|
14121
14129
|
] });
|
|
14122
14130
|
}
|
|
14123
|
-
function
|
|
14131
|
+
function Qo({ rowId: e, row: t, entity: n, columns: r, editableColumns: i, editable: a, isDeleting: o, activeCell: s, setActiveCell: c, rowState: l, onCellChange: u, onDeleteClick: f, refs: p, identityCol: m, href: h, onNavigate: g }) {
|
|
14124
14132
|
let _ = d(() => !l || Object.keys(l.buffer).length === 0 ? t : {
|
|
14125
14133
|
...t,
|
|
14126
14134
|
...l.buffer
|
|
@@ -14215,7 +14223,7 @@ function Zo({ rowId: e, row: t, entity: n, columns: r, editableColumns: i, edita
|
|
|
14215
14223
|
})]
|
|
14216
14224
|
});
|
|
14217
14225
|
}
|
|
14218
|
-
function
|
|
14226
|
+
function $o({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey: i, draftErrors: a, draftSaving: o, onChange: s, onConfirm: c, onCancel: l, refs: u }) {
|
|
14219
14227
|
let d = a.find((e) => e.startsWith("_error:")), f = new Set(a.filter((e) => !e.startsWith("_error:")));
|
|
14220
14228
|
return /* @__PURE__ */ P("tr", {
|
|
14221
14229
|
style: { background: "var(--surface-2)" },
|
|
@@ -14289,7 +14297,7 @@ function Qo({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey
|
|
|
14289
14297
|
}
|
|
14290
14298
|
//#endregion
|
|
14291
14299
|
//#region src/components/shared/ActionConfirmDialog.tsx
|
|
14292
|
-
function
|
|
14300
|
+
function es({ open: e, onOpenChange: t, actionName: n, message: r, onConfirm: i, isPending: a }) {
|
|
14293
14301
|
return e ? /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N("div", {
|
|
14294
14302
|
onClick: () => !a && t(!1),
|
|
14295
14303
|
style: {
|
|
@@ -14390,7 +14398,7 @@ function $o({ open: e, onOpenChange: t, actionName: n, message: r, onConfirm: i,
|
|
|
14390
14398
|
}
|
|
14391
14399
|
//#endregion
|
|
14392
14400
|
//#region src/components/shared/ActionResultDialog.tsx
|
|
14393
|
-
function
|
|
14401
|
+
function ts({ open: e, onClose: t, display: n }) {
|
|
14394
14402
|
return e ? /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N("div", { style: {
|
|
14395
14403
|
position: "fixed",
|
|
14396
14404
|
inset: 0,
|
|
@@ -14472,7 +14480,7 @@ function es({ open: e, onClose: t, display: n }) {
|
|
|
14472
14480
|
gap: 12,
|
|
14473
14481
|
overflowY: "auto"
|
|
14474
14482
|
},
|
|
14475
|
-
children: n.fields.map((e, t) => /* @__PURE__ */ N(
|
|
14483
|
+
children: n.fields.map((e, t) => /* @__PURE__ */ N(ns, { field: e }, t))
|
|
14476
14484
|
}),
|
|
14477
14485
|
/* @__PURE__ */ P("div", {
|
|
14478
14486
|
style: {
|
|
@@ -14492,7 +14500,7 @@ function es({ open: e, onClose: t, display: n }) {
|
|
|
14492
14500
|
]
|
|
14493
14501
|
})] }) : null;
|
|
14494
14502
|
}
|
|
14495
|
-
function
|
|
14503
|
+
function ns({ field: e }) {
|
|
14496
14504
|
return /* @__PURE__ */ P("div", {
|
|
14497
14505
|
style: {
|
|
14498
14506
|
display: "flex",
|
|
@@ -14531,12 +14539,12 @@ function ts({ field: e }) {
|
|
|
14531
14539
|
}
|
|
14532
14540
|
//#endregion
|
|
14533
14541
|
//#region src/components/shared/ActionButton.tsx
|
|
14534
|
-
function
|
|
14535
|
-
let [f, m] = p(!1), [h, g] = p(!1), [_, v] = p(!1), [y, b] = p(null), x =
|
|
14542
|
+
function rs({ actionCode: e, action: t, entityCode: n, objectIds: r = [], row: i, variant: a = "outline", size: o = "default", onSuccess: c, onBatchStart: l, onBatchError: u, onBatchPartial: d }) {
|
|
14543
|
+
let [f, m] = p(!1), [h, g] = p(!1), [_, v] = p(!1), [y, b] = p(null), x = Hi(n), { data: S } = st(), C = Mt(), w = ra(t), T = na(t), E = !!t.confirmation && Object.keys(t.confirmation).length > 0, D = i ? Xi(t.conditions, i) : !0, O = s(async () => {
|
|
14536
14544
|
if (!(!t.association || r.length === 0)) {
|
|
14537
14545
|
v(!0);
|
|
14538
14546
|
try {
|
|
14539
|
-
let e = await
|
|
14547
|
+
let e = await Yn(n ? `${n}.${t.association}` : t.association, r), i = ia(S, e.target_entity);
|
|
14540
14548
|
if (!i) {
|
|
14541
14549
|
j.error(`No list screen found for ${e.target_entity}`);
|
|
14542
14550
|
return;
|
|
@@ -14581,8 +14589,8 @@ function ns({ actionCode: e, action: t, entityCode: n, objectIds: r = [], row: i
|
|
|
14581
14589
|
c,
|
|
14582
14590
|
d
|
|
14583
14591
|
]), I = s(() => {
|
|
14584
|
-
if (
|
|
14585
|
-
|
|
14592
|
+
if (Dr(t)) {
|
|
14593
|
+
wr(t.ui_steps, { row: i }).then(() => c?.());
|
|
14586
14594
|
return;
|
|
14587
14595
|
}
|
|
14588
14596
|
if (w) {
|
|
@@ -14591,7 +14599,7 @@ function ns({ actionCode: e, action: t, entityCode: n, objectIds: r = [], row: i
|
|
|
14591
14599
|
}
|
|
14592
14600
|
T ? m(!0) : E ? g(!0) : (l?.(r.length), x.mutate({
|
|
14593
14601
|
actionCode: k,
|
|
14594
|
-
body:
|
|
14602
|
+
body: qn(void 0, A)
|
|
14595
14603
|
}, {
|
|
14596
14604
|
onSuccess: (e) => F(e),
|
|
14597
14605
|
onError: () => u?.(r.length)
|
|
@@ -14614,7 +14622,7 @@ function ns({ actionCode: e, action: t, entityCode: n, objectIds: r = [], row: i
|
|
|
14614
14622
|
]), ee = s(() => {
|
|
14615
14623
|
l?.(r.length), x.mutate({
|
|
14616
14624
|
actionCode: k,
|
|
14617
|
-
body:
|
|
14625
|
+
body: qn(void 0, A)
|
|
14618
14626
|
}, {
|
|
14619
14627
|
onSuccess: (e) => F(e, () => g(!1)),
|
|
14620
14628
|
onError: () => u?.(r.length)
|
|
@@ -14630,7 +14638,7 @@ function ns({ actionCode: e, action: t, entityCode: n, objectIds: r = [], row: i
|
|
|
14630
14638
|
]), L = s((e) => {
|
|
14631
14639
|
l?.(r.length), x.mutate({
|
|
14632
14640
|
actionCode: k,
|
|
14633
|
-
body:
|
|
14641
|
+
body: qn(e, A)
|
|
14634
14642
|
}, {
|
|
14635
14643
|
onSuccess: (e) => F(e, () => m(!1)),
|
|
14636
14644
|
onError: () => u?.(r.length)
|
|
@@ -14663,7 +14671,7 @@ function ns({ actionCode: e, action: t, entityCode: n, objectIds: r = [], row: i
|
|
|
14663
14671
|
"aria-label": R,
|
|
14664
14672
|
children: R
|
|
14665
14673
|
}),
|
|
14666
|
-
T && /* @__PURE__ */ N(
|
|
14674
|
+
T && /* @__PURE__ */ N(Ir, {
|
|
14667
14675
|
open: f,
|
|
14668
14676
|
onOpenChange: m,
|
|
14669
14677
|
action: t,
|
|
@@ -14672,7 +14680,7 @@ function ns({ actionCode: e, action: t, entityCode: n, objectIds: r = [], row: i
|
|
|
14672
14680
|
isPending: x.isPending,
|
|
14673
14681
|
row: i
|
|
14674
14682
|
}),
|
|
14675
|
-
E && /* @__PURE__ */ N(
|
|
14683
|
+
E && /* @__PURE__ */ N(es, {
|
|
14676
14684
|
open: h,
|
|
14677
14685
|
onOpenChange: g,
|
|
14678
14686
|
actionName: R,
|
|
@@ -14680,7 +14688,7 @@ function ns({ actionCode: e, action: t, entityCode: n, objectIds: r = [], row: i
|
|
|
14680
14688
|
onConfirm: ee,
|
|
14681
14689
|
isPending: x.isPending
|
|
14682
14690
|
}),
|
|
14683
|
-
y && /* @__PURE__ */ N(
|
|
14691
|
+
y && /* @__PURE__ */ N(ts, {
|
|
14684
14692
|
open: !!y,
|
|
14685
14693
|
onClose: () => {
|
|
14686
14694
|
b(null), c?.();
|
|
@@ -14691,10 +14699,10 @@ function ns({ actionCode: e, action: t, entityCode: n, objectIds: r = [], row: i
|
|
|
14691
14699
|
}
|
|
14692
14700
|
//#endregion
|
|
14693
14701
|
//#region src/components/detail-layout/FieldsBlock.tsx
|
|
14694
|
-
function
|
|
14702
|
+
function is({ fields: e, ctx: t }) {
|
|
14695
14703
|
let { entity: n, entityCode: r, record: i, mode: a, onFieldChange: o, schema: s } = t, c = t.columns ?? 2, l = c === 1 && e.length === 1;
|
|
14696
14704
|
return /* @__PURE__ */ N("div", {
|
|
14697
|
-
className:
|
|
14705
|
+
className: Qa("grid gap-x-6 gap-y-3", c === 1 ? "grid-cols-1" : "grid-cols-1 md:grid-cols-2"),
|
|
14698
14706
|
children: e.map((e) => {
|
|
14699
14707
|
let u = e.name, d = n.fields.get(u);
|
|
14700
14708
|
if (!d) return null;
|
|
@@ -14702,7 +14710,7 @@ function rs({ fields: e, ctx: t }) {
|
|
|
14702
14710
|
return /* @__PURE__ */ P("div", {
|
|
14703
14711
|
className: c === 1 ? "flex flex-col gap-1" : "flex flex-col md:flex-row gap-1",
|
|
14704
14712
|
children: [!l && /* @__PURE__ */ N("div", {
|
|
14705
|
-
className:
|
|
14713
|
+
className: Qa("text-sm text-muted-foreground", c === 2 && "md:w-40 md:pt-0.5"),
|
|
14706
14714
|
children: ze(d, u, s.entities)
|
|
14707
14715
|
}), /* @__PURE__ */ N("div", {
|
|
14708
14716
|
className: "flex-1 min-w-0",
|
|
@@ -14721,7 +14729,7 @@ function rs({ fields: e, ctx: t }) {
|
|
|
14721
14729
|
})
|
|
14722
14730
|
}), p && /* @__PURE__ */ N("div", {
|
|
14723
14731
|
className: "flex items-center gap-1 shrink-0",
|
|
14724
|
-
children: e.actions.map((e, t) => /* @__PURE__ */ N(
|
|
14732
|
+
children: e.actions.map((e, t) => /* @__PURE__ */ N(rs, {
|
|
14725
14733
|
actionCode: `${u}.action[${t}]`,
|
|
14726
14734
|
action: e,
|
|
14727
14735
|
entityCode: r,
|
|
@@ -14738,7 +14746,7 @@ function rs({ fields: e, ctx: t }) {
|
|
|
14738
14746
|
}
|
|
14739
14747
|
//#endregion
|
|
14740
14748
|
//#region src/components/detail-layout/PropertiesBlock.tsx
|
|
14741
|
-
var
|
|
14749
|
+
var as = new Set([
|
|
14742
14750
|
"string",
|
|
14743
14751
|
"text",
|
|
14744
14752
|
"int",
|
|
@@ -14746,8 +14754,8 @@ var is = new Set([
|
|
|
14746
14754
|
"decimal",
|
|
14747
14755
|
"email",
|
|
14748
14756
|
"url"
|
|
14749
|
-
]),
|
|
14750
|
-
function
|
|
14757
|
+
]), os = 500;
|
|
14758
|
+
function ss({ node: e, ctx: t }) {
|
|
14751
14759
|
let { entity: n, objectProperties: r, onSetProperty: i, isNew: a, mode: o, refs: s } = t, c = n.properties ?? {};
|
|
14752
14760
|
if (a) return null;
|
|
14753
14761
|
let l = e.properties === !0 ? !0 : e.properties, u = l === !0 ? Object.entries(c).sort(([e], [t]) => e.localeCompare(t)) : l.filter((e) => c[e] != null).map((e) => [e, c[e]]);
|
|
@@ -14755,7 +14763,7 @@ function os({ node: e, ctx: t }) {
|
|
|
14755
14763
|
className: "grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-3",
|
|
14756
14764
|
children: u.map(([e, t]) => {
|
|
14757
14765
|
let n = r?.find((t) => t.property_code === e), a = Be(t), c = t.readonly || !i ? "display" : o;
|
|
14758
|
-
return /* @__PURE__ */ N(
|
|
14766
|
+
return /* @__PURE__ */ N(cs, {
|
|
14759
14767
|
propCode: e,
|
|
14760
14768
|
prop: t,
|
|
14761
14769
|
field: a,
|
|
@@ -14767,13 +14775,13 @@ function os({ node: e, ctx: t }) {
|
|
|
14767
14775
|
})
|
|
14768
14776
|
});
|
|
14769
14777
|
}
|
|
14770
|
-
function
|
|
14778
|
+
function cs({ propCode: e, prop: t, field: n, value: r, mode: i, onSetProperty: a, refs: o }) {
|
|
14771
14779
|
let c = f(null);
|
|
14772
14780
|
l(() => () => {
|
|
14773
14781
|
c.current && clearTimeout(c.current);
|
|
14774
14782
|
}, []);
|
|
14775
14783
|
let u = s((n) => {
|
|
14776
|
-
a && (
|
|
14784
|
+
a && (as.has(t.type) ? (c.current && clearTimeout(c.current), c.current = setTimeout(() => a(e, n), os)) : a(e, n));
|
|
14777
14785
|
}, [
|
|
14778
14786
|
e,
|
|
14779
14787
|
t.type,
|
|
@@ -14799,7 +14807,7 @@ function ss({ propCode: e, prop: t, field: n, value: r, mode: i, onSetProperty:
|
|
|
14799
14807
|
}
|
|
14800
14808
|
//#endregion
|
|
14801
14809
|
//#region src/components/shared/StatusGroupsDisplay.tsx
|
|
14802
|
-
function
|
|
14810
|
+
function ls({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r, mode: i = "edit" }) {
|
|
14803
14811
|
return /* @__PURE__ */ N("div", {
|
|
14804
14812
|
style: {
|
|
14805
14813
|
display: "flex",
|
|
@@ -14881,61 +14889,61 @@ function cs({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
14881
14889
|
}
|
|
14882
14890
|
//#endregion
|
|
14883
14891
|
//#region src/components/detail-layout/StatusesBlock.tsx
|
|
14884
|
-
var
|
|
14885
|
-
function
|
|
14892
|
+
var us = () => {};
|
|
14893
|
+
function ds({ node: e, ctx: t }) {
|
|
14886
14894
|
let { entity: n, objectStatuses: r, onSetStatus: i, isStatusPending: a, isNew: o } = t, s = n.status_groups ?? {};
|
|
14887
14895
|
if (o) return null;
|
|
14888
14896
|
let c = e.statuses === !0 ? !0 : e.statuses, l = Object.fromEntries(Object.entries(s).filter(([e]) => c === !0 || c.includes(e)));
|
|
14889
|
-
return Object.keys(l).length === 0 ? null : /* @__PURE__ */ N(
|
|
14897
|
+
return Object.keys(l).length === 0 ? null : /* @__PURE__ */ N(ls, {
|
|
14890
14898
|
statusGroups: l,
|
|
14891
14899
|
objectStatuses: r,
|
|
14892
|
-
onSetStatus: i ??
|
|
14900
|
+
onSetStatus: i ?? us,
|
|
14893
14901
|
isPending: a ?? !1,
|
|
14894
14902
|
mode: t.mode
|
|
14895
14903
|
});
|
|
14896
14904
|
}
|
|
14897
14905
|
//#endregion
|
|
14898
14906
|
//#region src/components/detail-layout/LayoutRenderer.tsx
|
|
14899
|
-
function
|
|
14900
|
-
return /* @__PURE__ */ N(M, { children: e.map((e, n) => /* @__PURE__ */ N(
|
|
14907
|
+
function fs({ nodes: e, ctx: t }) {
|
|
14908
|
+
return /* @__PURE__ */ N(M, { children: e.map((e, n) => /* @__PURE__ */ N(ps, {
|
|
14901
14909
|
node: e,
|
|
14902
14910
|
ctx: t
|
|
14903
14911
|
}, n)) });
|
|
14904
14912
|
}
|
|
14905
|
-
function
|
|
14906
|
-
return e.row ? /* @__PURE__ */ N(
|
|
14913
|
+
function ps({ node: e, ctx: t }) {
|
|
14914
|
+
return e.row ? /* @__PURE__ */ N(to, {
|
|
14907
14915
|
config: e.row,
|
|
14908
14916
|
ctx: t
|
|
14909
|
-
}) : e.column ? /* @__PURE__ */ N(
|
|
14917
|
+
}) : e.column ? /* @__PURE__ */ N(io, {
|
|
14910
14918
|
config: e.column,
|
|
14911
14919
|
node: e,
|
|
14912
14920
|
ctx: t
|
|
14913
|
-
}) : e.tabs ? /* @__PURE__ */ N(
|
|
14921
|
+
}) : e.tabs ? /* @__PURE__ */ N(so, {
|
|
14914
14922
|
config: e.tabs,
|
|
14915
14923
|
ctx: t
|
|
14916
|
-
}) : e.section ? /* @__PURE__ */ N(
|
|
14924
|
+
}) : e.section ? /* @__PURE__ */ N(co, {
|
|
14917
14925
|
config: e.section,
|
|
14918
14926
|
ctx: t
|
|
14919
|
-
}) : e.children ? /* @__PURE__ */ N(
|
|
14927
|
+
}) : e.children ? /* @__PURE__ */ N(Wo, {
|
|
14920
14928
|
node: e,
|
|
14921
14929
|
ctx: t
|
|
14922
|
-
}) : e.associated ? /* @__PURE__ */ N(
|
|
14930
|
+
}) : e.associated ? /* @__PURE__ */ N(Jo, {
|
|
14923
14931
|
node: e,
|
|
14924
14932
|
ctx: t
|
|
14925
|
-
}) : e.fields ? /* @__PURE__ */ N(
|
|
14933
|
+
}) : e.fields ? /* @__PURE__ */ N(is, {
|
|
14926
14934
|
fields: e.fields,
|
|
14927
14935
|
ctx: t
|
|
14928
|
-
}) : e.properties == null ? e.statuses == null ? null : /* @__PURE__ */ N(
|
|
14936
|
+
}) : e.properties == null ? e.statuses == null ? null : /* @__PURE__ */ N(ds, {
|
|
14929
14937
|
node: e,
|
|
14930
14938
|
ctx: t
|
|
14931
|
-
}) : /* @__PURE__ */ N(
|
|
14939
|
+
}) : /* @__PURE__ */ N(ss, {
|
|
14932
14940
|
node: e,
|
|
14933
14941
|
ctx: t
|
|
14934
14942
|
});
|
|
14935
14943
|
}
|
|
14936
14944
|
//#endregion
|
|
14937
14945
|
//#region src/lib/children-validation.ts
|
|
14938
|
-
function
|
|
14946
|
+
function ms(e, t) {
|
|
14939
14947
|
let n = /* @__PURE__ */ new Set();
|
|
14940
14948
|
for (let r of Object.values(t.entities)) if (r.children) {
|
|
14941
14949
|
for (let t of r.children) if (t.entity === e && t.foreign_key) {
|
|
@@ -14945,13 +14953,13 @@ function ps(e, t) {
|
|
|
14945
14953
|
}
|
|
14946
14954
|
return n;
|
|
14947
14955
|
}
|
|
14948
|
-
function
|
|
14956
|
+
function hs(e, t) {
|
|
14949
14957
|
if (!e || !t) return {};
|
|
14950
14958
|
let n = {};
|
|
14951
14959
|
for (let [r, i] of Object.entries(e)) {
|
|
14952
14960
|
let e = t.entities[r];
|
|
14953
14961
|
if (!e) continue;
|
|
14954
|
-
let a =
|
|
14962
|
+
let a = ms(r, t), o = [];
|
|
14955
14963
|
for (let [t, n] of e.fields) n.required && !n.auto && !n.primary && !a.has(t) && o.push(t);
|
|
14956
14964
|
if (o.length !== 0) for (let e of i) {
|
|
14957
14965
|
if (e._deleted) continue;
|
|
@@ -14967,11 +14975,11 @@ function ms(e, t) {
|
|
|
14967
14975
|
}
|
|
14968
14976
|
//#endregion
|
|
14969
14977
|
//#region src/components/pages/SmartDetailPage.tsx
|
|
14970
|
-
var
|
|
14971
|
-
function
|
|
14978
|
+
var gs = () => {};
|
|
14979
|
+
function _s(e, t) {
|
|
14972
14980
|
return e.length === t.length ? JSON.stringify(e) === JSON.stringify(t) : !1;
|
|
14973
14981
|
}
|
|
14974
|
-
function
|
|
14982
|
+
function vs({ screenCode: e }) {
|
|
14975
14983
|
let { id: t } = S(), n = x(), [r, i] = C(), { data: a } = st(), o = qt((e) => e.user), c = a?.screens[e], u = c?.entity ? a?.entities[c.entity] : void 0, m = c?.entity, h = c?.self === !0, g = h ? o?.id : t, _ = !h && g === "new", v = d(() => {
|
|
14976
14984
|
if (!g || _) return;
|
|
14977
14985
|
if (!u) return g;
|
|
@@ -14986,7 +14994,7 @@ function _s({ screenCode: e }) {
|
|
|
14986
14994
|
u
|
|
14987
14995
|
]), y = d(() => {
|
|
14988
14996
|
if (v) return typeof v == "string" ? v : Ue(v);
|
|
14989
|
-
}, [v]), { data: w, isLoading: T } =
|
|
14997
|
+
}, [v]), { data: w, isLoading: T } = Ya(m, v), E = Ri(m ?? ""), D = zi(m ?? ""), O = Bi(m ?? ""), k = Vi(m ?? ""), A = Object.keys(u?.status_groups ?? {}).length > 0, j = w?.data, F = j?.$statuses, I = j?.$properties, ee = r.get("edit") === "true", [L, R] = p(_ || ee), [te, ne] = p({}), [re, ie] = p({}), [ae, oe] = p({}), [se, ce] = p(void 0), [le, ue] = p(void 0), [de, fe] = p({ show: !1 }), [pe, me] = p(() => {
|
|
14990
14998
|
let e = parseInt(c?.sidebar_width || "380", 10);
|
|
14991
14999
|
return isNaN(e) ? 380 : e;
|
|
14992
15000
|
}), he = f(null), z = f(null), V = s((e) => {
|
|
@@ -15048,7 +15056,7 @@ function _s({ screenCode: e }) {
|
|
|
15048
15056
|
l(() => {
|
|
15049
15057
|
if (!(!ee || !U || W.size === 0)) {
|
|
15050
15058
|
if (L || R(!0), Object.keys(te).length === 0) {
|
|
15051
|
-
let e = g ?
|
|
15059
|
+
let e = g ? Ca(g) : null, t = {};
|
|
15052
15060
|
W.forEach((n) => {
|
|
15053
15061
|
let r = e ? e[n] : void 0;
|
|
15054
15062
|
t[n] = r === void 0 ? U[n] ?? "" : r;
|
|
@@ -15123,7 +15131,7 @@ function _s({ screenCode: e }) {
|
|
|
15123
15131
|
let { _key: t, _deleted: n, _dirty: r, ...i } = e;
|
|
15124
15132
|
return i;
|
|
15125
15133
|
}), i = le?.[e] ?? [];
|
|
15126
|
-
(_ || !
|
|
15134
|
+
(_ || !_s(r, i)) && (t[e] = r);
|
|
15127
15135
|
}
|
|
15128
15136
|
Object.keys(t).length > 0 && (e.$children = t);
|
|
15129
15137
|
}
|
|
@@ -15175,9 +15183,9 @@ function _s({ screenCode: e }) {
|
|
|
15175
15183
|
v,
|
|
15176
15184
|
_,
|
|
15177
15185
|
k
|
|
15178
|
-
]), Oe = d(() =>
|
|
15186
|
+
]), Oe = d(() => hs(se, a), [se, a]), ke = Object.keys(Oe).length > 0;
|
|
15179
15187
|
if (!c || !u) return null;
|
|
15180
|
-
if (!_ && T) return /* @__PURE__ */ N(
|
|
15188
|
+
if (!_ && T) return /* @__PURE__ */ N(Ji, {});
|
|
15181
15189
|
if (!_ && !U) return /* @__PURE__ */ P("div", {
|
|
15182
15190
|
style: { padding: 24 },
|
|
15183
15191
|
children: [/* @__PURE__ */ P("div", {
|
|
@@ -15205,7 +15213,7 @@ function _s({ screenCode: e }) {
|
|
|
15205
15213
|
children: "Record not found."
|
|
15206
15214
|
})]
|
|
15207
15215
|
});
|
|
15208
|
-
let Ae = u.display, je = X(c.display?.name) || X(Ae.name), Me = u.display?.display_field, Y = Me ? U?.[Me] : void 0, Ne = Y && typeof Y == "object" && !Array.isArray(Y) ? X(Y) : Y, Pe = _ ? `New ${je}` : Ne ? String(Ne) : je, Fe = E.isPending || D.isPending, Ie = c.actions !== void 0, Le = Ie ?
|
|
15216
|
+
let Ae = u.display, je = X(c.display?.name) || X(Ae.name), Me = u.display?.display_field, Y = Me ? U?.[Me] : void 0, Ne = Y && typeof Y == "object" && !Array.isArray(Y) ? X(Y) : Y, Pe = _ ? `New ${je}` : Ne ? String(Ne) : je, Fe = E.isPending || D.isPending, Ie = c.actions !== void 0, Le = Ie ? ta(u.actions, c.actions, "detail", a?.actions) : ea(u.actions, "detail"), Re = {
|
|
15209
15217
|
schema: a,
|
|
15210
15218
|
entity: u,
|
|
15211
15219
|
entityCode: m,
|
|
@@ -15261,7 +15269,7 @@ function _s({ screenCode: e }) {
|
|
|
15261
15269
|
pendingChildren: L ? se : void 0,
|
|
15262
15270
|
onChildrenChange: L ? Ee : void 0,
|
|
15263
15271
|
childValidationErrors: L ? Oe : void 0
|
|
15264
|
-
}, ze = c.sidebar && c.sidebar.length > 0, Be = /* @__PURE__ */ N(
|
|
15272
|
+
}, ze = c.sidebar && c.sidebar.length > 0, Be = /* @__PURE__ */ N(ys, {
|
|
15265
15273
|
title: Pe,
|
|
15266
15274
|
recordId: g,
|
|
15267
15275
|
editing: L,
|
|
@@ -15303,25 +15311,25 @@ function _s({ screenCode: e }) {
|
|
|
15303
15311
|
color: "var(--danger)",
|
|
15304
15312
|
fontSize: 12.5
|
|
15305
15313
|
},
|
|
15306
|
-
children: [/* @__PURE__ */ N(B.warning, { size: 14 }), /* @__PURE__ */ P("span", { children: ["This record was deleted on ",
|
|
15314
|
+
children: [/* @__PURE__ */ N(B.warning, { size: 14 }), /* @__PURE__ */ P("span", { children: ["This record was deleted on ", Ja(String(U[u.soft_delete]))] })]
|
|
15307
15315
|
}), Ge = A && !_ && !(c.items && c.items.length > 0) && /* @__PURE__ */ N("div", {
|
|
15308
15316
|
className: "mb-4",
|
|
15309
|
-
children: /* @__PURE__ */ N(
|
|
15317
|
+
children: /* @__PURE__ */ N(ls, {
|
|
15310
15318
|
statusGroups: u.status_groups ?? {},
|
|
15311
15319
|
objectStatuses: Re.objectStatuses,
|
|
15312
|
-
onSetStatus: u?.readonly ?
|
|
15320
|
+
onSetStatus: u?.readonly ? gs : L ? (e, t) => ie((n) => ({
|
|
15313
15321
|
...n,
|
|
15314
15322
|
[e]: t
|
|
15315
|
-
})) :
|
|
15323
|
+
})) : gs,
|
|
15316
15324
|
isPending: !1,
|
|
15317
15325
|
mode: L && !u?.readonly ? "edit" : "display"
|
|
15318
15326
|
})
|
|
15319
15327
|
}), Ke = /* @__PURE__ */ P(M, { children: [
|
|
15320
|
-
c.items && c.items.length > 0 && (U || _) && a && /* @__PURE__ */ N(
|
|
15328
|
+
c.items && c.items.length > 0 && (U || _) && a && /* @__PURE__ */ N(fs, {
|
|
15321
15329
|
nodes: c.items,
|
|
15322
15330
|
ctx: Re
|
|
15323
15331
|
}),
|
|
15324
|
-
!_ && g && m && u.associations && Object.keys(u.associations).length > 0 && a && /* @__PURE__ */ N(
|
|
15332
|
+
!_ && g && m && u.associations && Object.keys(u.associations).length > 0 && a && /* @__PURE__ */ N(Xa, {
|
|
15325
15333
|
entityCode: m,
|
|
15326
15334
|
recordId: y ?? g ?? "",
|
|
15327
15335
|
associations: u.associations,
|
|
@@ -15335,9 +15343,9 @@ function _s({ screenCode: e }) {
|
|
|
15335
15343
|
fontSize: 11.5,
|
|
15336
15344
|
color: "var(--text-3)"
|
|
15337
15345
|
},
|
|
15338
|
-
children: [U.created_at != null && /* @__PURE__ */ P("span", { children: ["Created: ",
|
|
15346
|
+
children: [U.created_at != null && /* @__PURE__ */ P("span", { children: ["Created: ", Ja(String(U.created_at))] }), U.updated_at != null && /* @__PURE__ */ P("span", { children: ["Updated: ", Ja(String(U.updated_at))] })]
|
|
15339
15347
|
})
|
|
15340
|
-
] }), qe = /* @__PURE__ */ N(
|
|
15348
|
+
] }), qe = /* @__PURE__ */ N(Yi, {
|
|
15341
15349
|
open: de.show,
|
|
15342
15350
|
onOpenChange: (e) => !e && fe({ show: !1 }),
|
|
15343
15351
|
title: `Delete ${je}`,
|
|
@@ -15408,7 +15416,7 @@ function _s({ screenCode: e }) {
|
|
|
15408
15416
|
height: "100%",
|
|
15409
15417
|
width: `${pe}px`
|
|
15410
15418
|
},
|
|
15411
|
-
children: (U || _) && a && /* @__PURE__ */ N(
|
|
15419
|
+
children: (U || _) && a && /* @__PURE__ */ N(fs, {
|
|
15412
15420
|
nodes: c.sidebar,
|
|
15413
15421
|
ctx: Re
|
|
15414
15422
|
})
|
|
@@ -15440,8 +15448,8 @@ function _s({ screenCode: e }) {
|
|
|
15440
15448
|
]
|
|
15441
15449
|
});
|
|
15442
15450
|
}
|
|
15443
|
-
function
|
|
15444
|
-
let E = f(null), [D, O] = p(!1), { run: k } =
|
|
15451
|
+
function ys({ title: e, recordId: t, editing: n, isNew: r, isSelf: i, isRecordDeleted: a, dirty: o, isSaving: s, hasChildErrors: c, canEdit: l, canDelete: u, hasExplicitActions: d, headerActions: m, entityCode: h, record: g, id: _, listRouteExists: v, onBack: y, onCancelEdit: b, onSave: x, onStartEdit: S, onRequestDelete: C, onRestore: w, isRestoring: T }) {
|
|
15452
|
+
let E = f(null), [D, O] = p(!1), { run: k } = Br(), A = m.filter(({ action: e }) => e.type !== "edit" && e.type !== "delete"), j = A.filter(({ action: e }) => e.primary).slice(0, 2), F = A.filter((e) => !j.includes(e)), I = m.find(({ action: e }) => e.type === "edit"), ee = m.find(({ action: e }) => e.type === "delete"), L = (e) => {
|
|
15445
15453
|
let t = e.display?.icon, n = t && B[t] ? B[t] : void 0;
|
|
15446
15454
|
return n ? /* @__PURE__ */ N(n, { size: 13 }) : null;
|
|
15447
15455
|
}, R = (e, t) => {
|
|
@@ -15449,7 +15457,7 @@ function vs({ title: e, recordId: t, editing: n, isNew: r, isSelf: i, isRecordDe
|
|
|
15449
15457
|
k({
|
|
15450
15458
|
action: t,
|
|
15451
15459
|
title: X(t.display?.name) || e,
|
|
15452
|
-
execute: (e) =>
|
|
15460
|
+
execute: (e) => Jn(r, qn(e, n))
|
|
15453
15461
|
});
|
|
15454
15462
|
};
|
|
15455
15463
|
return /* @__PURE__ */ P("div", {
|
|
@@ -15537,7 +15545,7 @@ function vs({ title: e, recordId: t, editing: n, isNew: r, isSelf: i, isRecordDe
|
|
|
15537
15545
|
children: s ? "Saving…" : "Save"
|
|
15538
15546
|
})
|
|
15539
15547
|
] }) : /* @__PURE__ */ P(M, { children: [
|
|
15540
|
-
!r && _ && j.map(({ code: e, action: t }) => !g ||
|
|
15548
|
+
!r && _ && j.map(({ code: e, action: t }) => !g || Xi(t.conditions, g) ? /* @__PURE__ */ N(V, {
|
|
15541
15549
|
icon: L(t),
|
|
15542
15550
|
danger: t.destructive,
|
|
15543
15551
|
onClick: () => R(e, t),
|
|
@@ -15562,7 +15570,7 @@ function vs({ title: e, recordId: t, editing: n, isNew: r, isSelf: i, isRecordDe
|
|
|
15562
15570
|
width: 220,
|
|
15563
15571
|
align: "end",
|
|
15564
15572
|
children: F.map(({ code: e, action: t }) => {
|
|
15565
|
-
let n = !(!g ||
|
|
15573
|
+
let n = !(!g || Xi(t.conditions, g));
|
|
15566
15574
|
return /* @__PURE__ */ N(K, {
|
|
15567
15575
|
icon: L(t),
|
|
15568
15576
|
danger: t.destructive,
|
|
@@ -15584,7 +15592,7 @@ function vs({ title: e, recordId: t, editing: n, isNew: r, isSelf: i, isRecordDe
|
|
|
15584
15592
|
kind: "primary",
|
|
15585
15593
|
icon: /* @__PURE__ */ N(B.edit, { size: 13 }),
|
|
15586
15594
|
onClick: S,
|
|
15587
|
-
disabled: g ? !
|
|
15595
|
+
disabled: g ? !Xi(I.action.conditions, g) : !1,
|
|
15588
15596
|
children: X(I.action.display?.name) || "Edit"
|
|
15589
15597
|
}) : d ? null : /* @__PURE__ */ N(V, {
|
|
15590
15598
|
kind: "primary",
|
|
@@ -15596,7 +15604,7 @@ function vs({ title: e, recordId: t, editing: n, isNew: r, isSelf: i, isRecordDe
|
|
|
15596
15604
|
kind: "ghost",
|
|
15597
15605
|
icon: /* @__PURE__ */ N(B.trash, { size: 13 }),
|
|
15598
15606
|
danger: !0,
|
|
15599
|
-
disabled: g ? !
|
|
15607
|
+
disabled: g ? !Xi(ee.action.conditions, g) : !1,
|
|
15600
15608
|
onClick: () => C(X(ee.action.confirmation) || void 0),
|
|
15601
15609
|
children: X(ee.action.display?.name) || "Delete"
|
|
15602
15610
|
}) : d ? null : /* @__PURE__ */ N(V, {
|
|
@@ -15612,7 +15620,7 @@ function vs({ title: e, recordId: t, editing: n, isNew: r, isSelf: i, isRecordDe
|
|
|
15612
15620
|
}
|
|
15613
15621
|
//#endregion
|
|
15614
15622
|
//#region src/api/status.ts
|
|
15615
|
-
async function
|
|
15623
|
+
async function bs(e, t, n, r, i) {
|
|
15616
15624
|
let a = {
|
|
15617
15625
|
status_group_code: n,
|
|
15618
15626
|
status_code: r
|
|
@@ -15629,10 +15637,10 @@ async function ys(e, t, n, r, i) {
|
|
|
15629
15637
|
}
|
|
15630
15638
|
//#endregion
|
|
15631
15639
|
//#region src/hooks/useObjectStatus.ts
|
|
15632
|
-
function
|
|
15640
|
+
function xs(e, t) {
|
|
15633
15641
|
let n = k();
|
|
15634
15642
|
return D({
|
|
15635
|
-
mutationFn: ({ groupCode: n, statusCode: r, note: i }) =>
|
|
15643
|
+
mutationFn: ({ groupCode: n, statusCode: r, note: i }) => bs(e, t, n, r, i),
|
|
15636
15644
|
onSuccess: () => {
|
|
15637
15645
|
n.invalidateQueries({ queryKey: ["entity-item", e] });
|
|
15638
15646
|
},
|
|
@@ -15643,7 +15651,7 @@ function bs(e, t) {
|
|
|
15643
15651
|
}
|
|
15644
15652
|
//#endregion
|
|
15645
15653
|
//#region src/api/properties.ts
|
|
15646
|
-
async function
|
|
15654
|
+
async function Ss(e, t, n, r) {
|
|
15647
15655
|
let i = (await Z(`/api/data/${e}`, {
|
|
15648
15656
|
method: "PATCH",
|
|
15649
15657
|
body: JSON.stringify([{
|
|
@@ -15656,7 +15664,7 @@ async function xs(e, t, n, r) {
|
|
|
15656
15664
|
}))[0]?.$properties ?? [];
|
|
15657
15665
|
return i.find((e) => e.property_code === n) ?? i[0];
|
|
15658
15666
|
}
|
|
15659
|
-
async function
|
|
15667
|
+
async function Cs(e, t, n) {
|
|
15660
15668
|
await Z(`/api/data/${e}`, {
|
|
15661
15669
|
method: "PATCH",
|
|
15662
15670
|
body: JSON.stringify([{
|
|
@@ -15670,10 +15678,10 @@ async function Ss(e, t, n) {
|
|
|
15670
15678
|
}
|
|
15671
15679
|
//#endregion
|
|
15672
15680
|
//#region src/hooks/useProperties.ts
|
|
15673
|
-
function
|
|
15681
|
+
function ws(e, t) {
|
|
15674
15682
|
let n = k();
|
|
15675
15683
|
return D({
|
|
15676
|
-
mutationFn: ({ propertyCode: n, value: r }) =>
|
|
15684
|
+
mutationFn: ({ propertyCode: n, value: r }) => Ss(e, t, n, r),
|
|
15677
15685
|
onSuccess: () => {
|
|
15678
15686
|
n.invalidateQueries({ queryKey: ["entity-item", e] });
|
|
15679
15687
|
},
|
|
@@ -15682,10 +15690,10 @@ function Cs(e, t) {
|
|
|
15682
15690
|
}
|
|
15683
15691
|
});
|
|
15684
15692
|
}
|
|
15685
|
-
function
|
|
15693
|
+
function Ts(e, t) {
|
|
15686
15694
|
let n = k();
|
|
15687
15695
|
return D({
|
|
15688
|
-
mutationFn: (n) =>
|
|
15696
|
+
mutationFn: (n) => Cs(e, t, n),
|
|
15689
15697
|
onSuccess: () => {
|
|
15690
15698
|
n.invalidateQueries({ queryKey: ["entity-item", e] });
|
|
15691
15699
|
},
|
|
@@ -15696,7 +15704,7 @@ function ws(e, t) {
|
|
|
15696
15704
|
}
|
|
15697
15705
|
//#endregion
|
|
15698
15706
|
//#region src/components/pages/SmartRecordListPage.tsx
|
|
15699
|
-
function
|
|
15707
|
+
function Es({ screenCode: e }) {
|
|
15700
15708
|
let [t, n] = C(), { data: r } = st(), i = r?.screens[e], a = i?.entity ? r?.entities[i.entity] : void 0, o = i?.entity, { openTab: c } = jt();
|
|
15701
15709
|
l(() => {
|
|
15702
15710
|
if (i?.route && a) {
|
|
@@ -15714,7 +15722,7 @@ function Ts({ screenCode: e }) {
|
|
|
15714
15722
|
i?.display?.name?.en,
|
|
15715
15723
|
a?.display.name_plural?.en
|
|
15716
15724
|
]);
|
|
15717
|
-
let u = t.get("selected") ?? null, m = t.get("search") ?? "", h =
|
|
15725
|
+
let u = t.get("selected") ?? null, m = t.get("search") ?? "", h = Ui(m, 300), g = t.get("sort") ?? i?.sort_default ?? "", _ = d(() => {
|
|
15718
15726
|
let e = t.get("filters");
|
|
15719
15727
|
if (e) try {
|
|
15720
15728
|
let t = JSON.parse(e);
|
|
@@ -15722,7 +15730,7 @@ function Ts({ screenCode: e }) {
|
|
|
15722
15730
|
} catch {
|
|
15723
15731
|
return;
|
|
15724
15732
|
}
|
|
15725
|
-
}, [t]), { data: v, isLoading: y } =
|
|
15733
|
+
}, [t]), { data: v, isLoading: y } = Xn(o, {
|
|
15726
15734
|
page: 1,
|
|
15727
15735
|
per_page: 200,
|
|
15728
15736
|
sort: g || void 0,
|
|
@@ -15740,8 +15748,8 @@ function Ts({ screenCode: e }) {
|
|
|
15740
15748
|
}, { replace: !0 });
|
|
15741
15749
|
}, [n]), E = s((e, t) => {
|
|
15742
15750
|
n((n) => {
|
|
15743
|
-
let r = new URLSearchParams(n), i =
|
|
15744
|
-
return a = t && t !== "__all__" ? [...
|
|
15751
|
+
let r = new URLSearchParams(n), i = sa(n), a;
|
|
15752
|
+
return a = t && t !== "__all__" ? [...pa(i, e), fa(e, t)] : pa(i, e), ca(a, r), r;
|
|
15745
15753
|
}, { replace: !0 });
|
|
15746
15754
|
}, [n]), D = i?.list_resizable ?? !1, O = f(null), [k, A] = p(null), j = f(!1), M = i?.list_width;
|
|
15747
15755
|
l(() => {
|
|
@@ -15884,7 +15892,7 @@ function Ts({ screenCode: e }) {
|
|
|
15884
15892
|
color: "var(--text-3)"
|
|
15885
15893
|
},
|
|
15886
15894
|
children: "No records found"
|
|
15887
|
-
}) : b.map((e) => /* @__PURE__ */ N(
|
|
15895
|
+
}) : b.map((e) => /* @__PURE__ */ N(Ds, {
|
|
15888
15896
|
record: e,
|
|
15889
15897
|
entity: a,
|
|
15890
15898
|
columns: ee,
|
|
@@ -15913,7 +15921,7 @@ function Ts({ screenCode: e }) {
|
|
|
15913
15921
|
minWidth: 0,
|
|
15914
15922
|
overflow: "hidden"
|
|
15915
15923
|
},
|
|
15916
|
-
children: u ? /* @__PURE__ */ N(
|
|
15924
|
+
children: u ? /* @__PURE__ */ N(Os, {
|
|
15917
15925
|
entityCode: o,
|
|
15918
15926
|
recordId: u,
|
|
15919
15927
|
items: i.items,
|
|
@@ -15940,7 +15948,7 @@ function Ts({ screenCode: e }) {
|
|
|
15940
15948
|
]
|
|
15941
15949
|
});
|
|
15942
15950
|
}
|
|
15943
|
-
function
|
|
15951
|
+
function Ds({ record: e, entity: t, columns: n, refs: r, isSelected: i, onClick: a }) {
|
|
15944
15952
|
let o = n[0], s = n[1], c = n.slice(2, 4);
|
|
15945
15953
|
return /* @__PURE__ */ P("button", {
|
|
15946
15954
|
onClick: a,
|
|
@@ -16027,8 +16035,8 @@ function Es({ record: e, entity: t, columns: n, refs: r, isSelected: i, onClick:
|
|
|
16027
16035
|
})]
|
|
16028
16036
|
});
|
|
16029
16037
|
}
|
|
16030
|
-
function
|
|
16031
|
-
let { data: a, isLoading: o } =
|
|
16038
|
+
function Os({ entityCode: e, recordId: t, items: n, schema: r, entity: i }) {
|
|
16039
|
+
let { data: a, isLoading: o } = Ya(e, t), c = zi(e), [l, u] = p(!1), [f, m] = p({}), h = a?.data, g = h?.$statuses, _ = h?.$properties, v = xs(e, t), y = ws(e, t), b = d(() => {
|
|
16032
16040
|
let e = /* @__PURE__ */ new Set();
|
|
16033
16041
|
for (let [t, n] of i.fields) !n.auto && !n.primary && e.add(t);
|
|
16034
16042
|
return e;
|
|
@@ -16062,7 +16070,7 @@ function Ds({ entityCode: e, recordId: t, items: n, schema: r, entity: i }) {
|
|
|
16062
16070
|
[e]: t
|
|
16063
16071
|
}));
|
|
16064
16072
|
}, []);
|
|
16065
|
-
if (o) return /* @__PURE__ */ N(
|
|
16073
|
+
if (o) return /* @__PURE__ */ N(Ji, {});
|
|
16066
16074
|
if (!h) return null;
|
|
16067
16075
|
let T = i.display?.display_field, E = T ? h[T] : h[i.fields.names()[0]], D = E != null && typeof E != "object" ? String(E) : X(i.display.name), O = h?.$refs, k = {
|
|
16068
16076
|
schema: r,
|
|
@@ -16153,7 +16161,7 @@ function Ds({ entityCode: e, recordId: t, items: n, schema: r, entity: i }) {
|
|
|
16153
16161
|
flexDirection: "column",
|
|
16154
16162
|
gap: 12
|
|
16155
16163
|
},
|
|
16156
|
-
children: n && n.length > 0 ? /* @__PURE__ */ N(
|
|
16164
|
+
children: n && n.length > 0 ? /* @__PURE__ */ N(fs, {
|
|
16157
16165
|
nodes: n,
|
|
16158
16166
|
ctx: k
|
|
16159
16167
|
}) : /* @__PURE__ */ P("p", {
|
|
@@ -16172,7 +16180,7 @@ function Ds({ entityCode: e, recordId: t, items: n, schema: r, entity: i }) {
|
|
|
16172
16180
|
}
|
|
16173
16181
|
//#endregion
|
|
16174
16182
|
//#region src/components/shared/ErrorBoundary.tsx
|
|
16175
|
-
var
|
|
16183
|
+
var ks = class extends e {
|
|
16176
16184
|
constructor(e) {
|
|
16177
16185
|
super(e), this.state = {
|
|
16178
16186
|
hasError: !1,
|
|
@@ -16237,20 +16245,20 @@ var Os = class extends e {
|
|
|
16237
16245
|
})
|
|
16238
16246
|
}) : this.props.children;
|
|
16239
16247
|
}
|
|
16240
|
-
},
|
|
16241
|
-
function
|
|
16242
|
-
|
|
16248
|
+
}, As = /* @__PURE__ */ new Map();
|
|
16249
|
+
function js(e, t) {
|
|
16250
|
+
As.set(e, t);
|
|
16243
16251
|
}
|
|
16244
|
-
function
|
|
16245
|
-
return
|
|
16252
|
+
function Ms(e) {
|
|
16253
|
+
return As.get(e);
|
|
16246
16254
|
}
|
|
16247
16255
|
//#endregion
|
|
16248
16256
|
//#region src/app.tsx
|
|
16249
|
-
var
|
|
16257
|
+
var Ns = new w({ defaultOptions: { queries: {
|
|
16250
16258
|
staleTime: 300 * 1e3,
|
|
16251
16259
|
retry: 1
|
|
16252
16260
|
} } });
|
|
16253
|
-
function
|
|
16261
|
+
function Ps(e) {
|
|
16254
16262
|
if (typeof window > "u") return null;
|
|
16255
16263
|
try {
|
|
16256
16264
|
let t = new URL(e, window.location.origin);
|
|
@@ -16259,7 +16267,7 @@ function Ns(e) {
|
|
|
16259
16267
|
return null;
|
|
16260
16268
|
}
|
|
16261
16269
|
}
|
|
16262
|
-
function
|
|
16270
|
+
function Fs() {
|
|
16263
16271
|
let { data: e } = st();
|
|
16264
16272
|
return {
|
|
16265
16273
|
routes: d(() => {
|
|
@@ -16269,29 +16277,29 @@ function Ps() {
|
|
|
16269
16277
|
if (r.type === "list") {
|
|
16270
16278
|
t.push(/* @__PURE__ */ N(v, {
|
|
16271
16279
|
path: r.route,
|
|
16272
|
-
element: /* @__PURE__ */ N(
|
|
16280
|
+
element: /* @__PURE__ */ N(ks, { children: /* @__PURE__ */ N(Ha, { screenCode: n }) })
|
|
16273
16281
|
}, n));
|
|
16274
16282
|
continue;
|
|
16275
16283
|
}
|
|
16276
16284
|
if (r.type === "detail") {
|
|
16277
16285
|
t.push(/* @__PURE__ */ N(v, {
|
|
16278
16286
|
path: r.route,
|
|
16279
|
-
element: /* @__PURE__ */ N(
|
|
16287
|
+
element: /* @__PURE__ */ N(ks, { children: /* @__PURE__ */ N(vs, { screenCode: n }) })
|
|
16280
16288
|
}, n));
|
|
16281
16289
|
continue;
|
|
16282
16290
|
}
|
|
16283
16291
|
if (r.type === "record_list") {
|
|
16284
16292
|
t.push(/* @__PURE__ */ N(v, {
|
|
16285
16293
|
path: r.route,
|
|
16286
|
-
element: /* @__PURE__ */ N(
|
|
16294
|
+
element: /* @__PURE__ */ N(ks, { children: /* @__PURE__ */ N(Es, { screenCode: n }) })
|
|
16287
16295
|
}, n));
|
|
16288
16296
|
continue;
|
|
16289
16297
|
}
|
|
16290
16298
|
if (r.type === "custom") {
|
|
16291
|
-
let e = r.component ?
|
|
16299
|
+
let e = r.component ? Ms(r.component) : void 0;
|
|
16292
16300
|
e && t.push(/* @__PURE__ */ N(v, {
|
|
16293
16301
|
path: r.route,
|
|
16294
|
-
element: /* @__PURE__ */ N(
|
|
16302
|
+
element: /* @__PURE__ */ N(ks, { children: /* @__PURE__ */ N(e, {}) })
|
|
16295
16303
|
}, n));
|
|
16296
16304
|
}
|
|
16297
16305
|
}
|
|
@@ -16315,8 +16323,8 @@ function Ps() {
|
|
|
16315
16323
|
}, [e])
|
|
16316
16324
|
};
|
|
16317
16325
|
}
|
|
16318
|
-
function
|
|
16319
|
-
let e = qt((e) => e.initialize), { data: t } = st(), { routes: n, defaultRoute: r } =
|
|
16326
|
+
function Is() {
|
|
16327
|
+
let e = qt((e) => e.initialize), { data: t } = st(), { routes: n, defaultRoute: r } = Fs();
|
|
16320
16328
|
l(() => {
|
|
16321
16329
|
e();
|
|
16322
16330
|
}, [e]);
|
|
@@ -16328,7 +16336,7 @@ function Fs() {
|
|
|
16328
16336
|
t && t.remove();
|
|
16329
16337
|
return;
|
|
16330
16338
|
}
|
|
16331
|
-
let n =
|
|
16339
|
+
let n = Ps(i);
|
|
16332
16340
|
if (!n) {
|
|
16333
16341
|
t && t.remove(), console.error(`[declarion] branding.css_url rejected: ${i}. Only same-origin, relative URLs are allowed (e.g. /crm-brand.css).`);
|
|
16334
16342
|
return;
|
|
@@ -16340,26 +16348,26 @@ function Fs() {
|
|
|
16340
16348
|
}, [i]), /* @__PURE__ */ P(y, { children: [
|
|
16341
16349
|
/* @__PURE__ */ N(v, {
|
|
16342
16350
|
path: "/login",
|
|
16343
|
-
element: /* @__PURE__ */ N(
|
|
16351
|
+
element: /* @__PURE__ */ N(hi, {})
|
|
16344
16352
|
}),
|
|
16345
16353
|
/* @__PURE__ */ N(v, {
|
|
16346
16354
|
path: "/login/sso-callback",
|
|
16347
|
-
element: /* @__PURE__ */ N(
|
|
16355
|
+
element: /* @__PURE__ */ N(yi, {})
|
|
16348
16356
|
}),
|
|
16349
16357
|
/* @__PURE__ */ N(v, {
|
|
16350
16358
|
path: "/signup",
|
|
16351
|
-
element: /* @__PURE__ */ N(
|
|
16359
|
+
element: /* @__PURE__ */ N(gi, {})
|
|
16352
16360
|
}),
|
|
16353
16361
|
/* @__PURE__ */ N(v, {
|
|
16354
16362
|
path: "/forgot",
|
|
16355
|
-
element: /* @__PURE__ */ N(
|
|
16363
|
+
element: /* @__PURE__ */ N(_i, {})
|
|
16356
16364
|
}),
|
|
16357
16365
|
/* @__PURE__ */ N(v, {
|
|
16358
16366
|
path: "/2fa",
|
|
16359
|
-
element: /* @__PURE__ */ N(
|
|
16367
|
+
element: /* @__PURE__ */ N(vi, {})
|
|
16360
16368
|
}),
|
|
16361
16369
|
/* @__PURE__ */ P(v, {
|
|
16362
|
-
element: /* @__PURE__ */ N(
|
|
16370
|
+
element: /* @__PURE__ */ N(ai, {}),
|
|
16363
16371
|
children: [
|
|
16364
16372
|
r && /* @__PURE__ */ N(v, {
|
|
16365
16373
|
index: !0,
|
|
@@ -16371,28 +16379,28 @@ function Fs() {
|
|
|
16371
16379
|
n,
|
|
16372
16380
|
/* @__PURE__ */ N(v, {
|
|
16373
16381
|
path: "/profile",
|
|
16374
|
-
element: /* @__PURE__ */ N(
|
|
16382
|
+
element: /* @__PURE__ */ N(Si, {})
|
|
16375
16383
|
}),
|
|
16376
16384
|
/* @__PURE__ */ N(v, {
|
|
16377
16385
|
path: "/preferences",
|
|
16378
|
-
element: /* @__PURE__ */ N(
|
|
16386
|
+
element: /* @__PURE__ */ N(ki, {})
|
|
16379
16387
|
}),
|
|
16380
16388
|
/* @__PURE__ */ N(v, {
|
|
16381
16389
|
path: "/admin/catalog",
|
|
16382
|
-
element: /* @__PURE__ */ N(
|
|
16390
|
+
element: /* @__PURE__ */ N(Mi, {})
|
|
16383
16391
|
}),
|
|
16384
16392
|
/* @__PURE__ */ N(v, {
|
|
16385
16393
|
path: "*",
|
|
16386
|
-
element: /* @__PURE__ */ N(
|
|
16394
|
+
element: /* @__PURE__ */ N(bi, {})
|
|
16387
16395
|
})
|
|
16388
16396
|
]
|
|
16389
16397
|
})
|
|
16390
16398
|
] });
|
|
16391
16399
|
}
|
|
16392
|
-
function
|
|
16393
|
-
return /* @__PURE__ */ N(
|
|
16394
|
-
client:
|
|
16395
|
-
children: /* @__PURE__ */ P(m, { children: [/* @__PURE__ */ N(
|
|
16400
|
+
function Ls() {
|
|
16401
|
+
return /* @__PURE__ */ N(ks, { children: /* @__PURE__ */ N(T, {
|
|
16402
|
+
client: Ns,
|
|
16403
|
+
children: /* @__PURE__ */ P(m, { children: [/* @__PURE__ */ N(Is, {}), /* @__PURE__ */ N(A, {
|
|
16396
16404
|
richColors: !0,
|
|
16397
16405
|
position: "top-right",
|
|
16398
16406
|
toastOptions: { className: "select-text" }
|
|
@@ -16401,17 +16409,17 @@ function Is() {
|
|
|
16401
16409
|
}
|
|
16402
16410
|
//#endregion
|
|
16403
16411
|
//#region src/api/entities.ts
|
|
16404
|
-
function
|
|
16412
|
+
function Rs(e, t) {
|
|
16405
16413
|
return e.$statuses?.find((e) => e.group_code === t);
|
|
16406
16414
|
}
|
|
16407
|
-
function
|
|
16415
|
+
function zs(e, t) {
|
|
16408
16416
|
return e.$properties?.find((e) => e.property_code === t);
|
|
16409
16417
|
}
|
|
16410
|
-
function
|
|
16418
|
+
function Bs(e) {
|
|
16411
16419
|
let t = { ...e };
|
|
16412
|
-
return t.$status = (e) =>
|
|
16420
|
+
return t.$status = (e) => Rs(t, e), t.$property = (e) => zs(t, e), t;
|
|
16413
16421
|
}
|
|
16414
|
-
var
|
|
16422
|
+
var Vs = class {
|
|
16415
16423
|
cache = {};
|
|
16416
16424
|
merge(e) {
|
|
16417
16425
|
if (e) for (let t of Object.keys(e)) {
|
|
@@ -16433,23 +16441,23 @@ var Bs = class {
|
|
|
16433
16441
|
this.cache = {};
|
|
16434
16442
|
}
|
|
16435
16443
|
};
|
|
16436
|
-
function
|
|
16444
|
+
function Hs(e, t) {
|
|
16437
16445
|
let n = new URL(`/api/data/${e}`, window.location.origin);
|
|
16438
16446
|
return t.select && t.select.length > 0 && n.searchParams.set("select", t.select.join(",")), t.expand && t.expand.length > 0 && n.searchParams.set("expand", t.expand.join(",")), t.sort && n.searchParams.set("sort", t.sort), t.search && n.searchParams.set("search", t.search), t.limit && n.searchParams.set("limit", String(t.limit)), t.after && n.searchParams.set("after", t.after), t.include_deleted && n.searchParams.set("include_deleted", "true"), t.filters && t.filters.length > 0 && n.searchParams.set("filters", JSON.stringify(t.filters)), n.pathname + n.search;
|
|
16439
16447
|
}
|
|
16440
|
-
var
|
|
16448
|
+
var Us = class {
|
|
16441
16449
|
entity;
|
|
16442
16450
|
refs;
|
|
16443
16451
|
constructor(e, t) {
|
|
16444
|
-
this.entity = e, this.refs = t ?? new
|
|
16452
|
+
this.entity = e, this.refs = t ?? new Vs();
|
|
16445
16453
|
}
|
|
16446
16454
|
async get(e) {
|
|
16447
|
-
return
|
|
16455
|
+
return Bs((await Z(`/api/data/${this.entity}/${e}`)).data);
|
|
16448
16456
|
}
|
|
16449
16457
|
async list(e = {}) {
|
|
16450
|
-
let t = await Z(
|
|
16458
|
+
let t = await Z(Hs(this.entity, e));
|
|
16451
16459
|
return this.refs.merge(t.$refs), {
|
|
16452
|
-
data: t.data.map((e) =>
|
|
16460
|
+
data: t.data.map((e) => Bs(e)),
|
|
16453
16461
|
meta: t.meta,
|
|
16454
16462
|
$refs: this.refs.all()
|
|
16455
16463
|
};
|
|
@@ -16461,7 +16469,7 @@ var Hs = class {
|
|
|
16461
16469
|
return (await Z(`/api/data/${this.entity}`, {
|
|
16462
16470
|
method: "POST",
|
|
16463
16471
|
body: JSON.stringify(e)
|
|
16464
|
-
})).map((e) =>
|
|
16472
|
+
})).map((e) => Bs(e));
|
|
16465
16473
|
}
|
|
16466
16474
|
async update(e, t) {
|
|
16467
16475
|
return (await this.updateMany([{
|
|
@@ -16473,7 +16481,7 @@ var Hs = class {
|
|
|
16473
16481
|
return (await Z(`/api/data/${this.entity}`, {
|
|
16474
16482
|
method: "PATCH",
|
|
16475
16483
|
body: JSON.stringify(e)
|
|
16476
|
-
})).map((e) =>
|
|
16484
|
+
})).map((e) => Bs(e));
|
|
16477
16485
|
}
|
|
16478
16486
|
async delete(e) {
|
|
16479
16487
|
await this.deleteMany([e]);
|
|
@@ -16501,15 +16509,15 @@ var Hs = class {
|
|
|
16501
16509
|
return (await Z(`/api/data/${this.entity}?unique_fields=${n}`, {
|
|
16502
16510
|
method: "POST",
|
|
16503
16511
|
body: JSON.stringify(e)
|
|
16504
|
-
})).map((e) =>
|
|
16512
|
+
})).map((e) => Bs(e));
|
|
16505
16513
|
}
|
|
16506
16514
|
};
|
|
16507
|
-
function
|
|
16508
|
-
return new
|
|
16515
|
+
function Ws(e, t) {
|
|
16516
|
+
return new Us(e, t);
|
|
16509
16517
|
}
|
|
16510
16518
|
//#endregion
|
|
16511
16519
|
//#region src/hooks/useColumns.ts
|
|
16512
|
-
function
|
|
16520
|
+
function Gs(e, t) {
|
|
16513
16521
|
let [n, r] = C(), i = d(() => {
|
|
16514
16522
|
let r = n.get("columns");
|
|
16515
16523
|
return r ? r.split(",").filter(Boolean).filter((t) => e.includes(t)) : t.length > 0 ? t : e;
|
|
@@ -16519,7 +16527,7 @@ function Ws(e, t) {
|
|
|
16519
16527
|
t
|
|
16520
16528
|
]), a = s((e) => {
|
|
16521
16529
|
let i = new URLSearchParams(n);
|
|
16522
|
-
e.length === 0 ||
|
|
16530
|
+
e.length === 0 || Ks(e, t) ? i.delete("columns") : i.set("columns", e.join(",")), r(i);
|
|
16523
16531
|
}, [
|
|
16524
16532
|
n,
|
|
16525
16533
|
r,
|
|
@@ -16545,12 +16553,12 @@ function Ws(e, t) {
|
|
|
16545
16553
|
}, [i, a])
|
|
16546
16554
|
};
|
|
16547
16555
|
}
|
|
16548
|
-
function
|
|
16556
|
+
function Ks(e, t) {
|
|
16549
16557
|
return e.length === t.length ? e.every((e, n) => e === t[n]) : !1;
|
|
16550
16558
|
}
|
|
16551
16559
|
//#endregion
|
|
16552
16560
|
//#region src/components/shared/PageHeader.tsx
|
|
16553
|
-
function
|
|
16561
|
+
function qs({ title: e, backTo: t, actions: n }) {
|
|
16554
16562
|
let r = x(), { switchTab: i, findTabByPathname: a } = jt();
|
|
16555
16563
|
function o() {
|
|
16556
16564
|
if (!t) return;
|
|
@@ -16601,7 +16609,7 @@ function Ks({ title: e, backTo: t, actions: n }) {
|
|
|
16601
16609
|
}
|
|
16602
16610
|
//#endregion
|
|
16603
16611
|
//#region src/components/list/RowMenu.tsx
|
|
16604
|
-
function
|
|
16612
|
+
function Js({ x: e, y: t, onClose: n, onPeek: r, onOpen: i, onEditInline: a, onDuplicate: o, onCopyLink: s, onDelete: c, actions: l }) {
|
|
16605
16613
|
let u = (e) => () => {
|
|
16606
16614
|
n(), e && e();
|
|
16607
16615
|
}, d = r || i || a || o || s, f = l && l.length > 0;
|
|
@@ -16679,8 +16687,8 @@ function qs({ x: e, y: t, onClose: n, onPeek: r, onOpen: i, onEditInline: a, onD
|
|
|
16679
16687
|
}
|
|
16680
16688
|
//#endregion
|
|
16681
16689
|
//#region src/components/list/resolveActions.ts
|
|
16682
|
-
var
|
|
16683
|
-
function
|
|
16690
|
+
var Ys = "list_toolbar", Xs = "list_bulk_bar";
|
|
16691
|
+
function Zs(e) {
|
|
16684
16692
|
let { actions: t, screen: n, selectionCount: r } = e, i = e.hasPermission ?? (() => !0), a = e.maxPrimary ?? 2, o = [];
|
|
16685
16693
|
for (let [e, n] of Object.entries(t)) (n.visibility ?? []).includes("list_toolbar") && i(e) && o.push({
|
|
16686
16694
|
code: e,
|
|
@@ -16700,7 +16708,7 @@ function Xs(e) {
|
|
|
16700
16708
|
selectionCount: r
|
|
16701
16709
|
};
|
|
16702
16710
|
}
|
|
16703
|
-
function
|
|
16711
|
+
function Qs(e) {
|
|
16704
16712
|
let { actions: t, screen: n } = e, r = e.hasPermission ?? (() => !0), i = e.maxPrimary ?? 2, a = [];
|
|
16705
16713
|
for (let [e, n] of Object.entries(t)) (n.visibility ?? []).includes("list_bulk_bar") && r(e) && a.push({
|
|
16706
16714
|
code: e,
|
|
@@ -16714,7 +16722,7 @@ function Zs(e) {
|
|
|
16714
16722
|
}
|
|
16715
16723
|
//#endregion
|
|
16716
16724
|
//#region src/components/list/ListPage.tsx
|
|
16717
|
-
function
|
|
16725
|
+
function $s(e, t = 12) {
|
|
16718
16726
|
let n = e.display?.icon;
|
|
16719
16727
|
if (!n) return null;
|
|
16720
16728
|
let r = B[n];
|
|
@@ -16723,8 +16731,8 @@ function Qs(e, t = 12) {
|
|
|
16723
16731
|
size: t
|
|
16724
16732
|
});
|
|
16725
16733
|
}
|
|
16726
|
-
function
|
|
16727
|
-
let y = f(null), [b, x] = p(!1), { run: S } =
|
|
16734
|
+
function ec({ title: e, singular: t, total: n, shown: r, selectionCount: i, clearSelection: a, onNewRecord: o, screen: s, actions: c, hasPermission: l, executeAction: u, children: m, onBulkDelete: h, onBulkExport: g, onToolbarExport: _, onManageActions: v }) {
|
|
16735
|
+
let y = f(null), [b, x] = p(!1), { run: S } = Br(), C = d(() => Zs({
|
|
16728
16736
|
actions: c,
|
|
16729
16737
|
screen: s,
|
|
16730
16738
|
selectionCount: i,
|
|
@@ -16734,7 +16742,7 @@ function $s({ title: e, singular: t, total: n, shown: r, selectionCount: i, clea
|
|
|
16734
16742
|
s,
|
|
16735
16743
|
i,
|
|
16736
16744
|
l
|
|
16737
|
-
]), w = d(() =>
|
|
16745
|
+
]), w = d(() => Qs({
|
|
16738
16746
|
actions: c,
|
|
16739
16747
|
screen: s,
|
|
16740
16748
|
selectionCount: i,
|
|
@@ -16755,7 +16763,7 @@ function $s({ title: e, singular: t, total: n, shown: r, selectionCount: i, clea
|
|
|
16755
16763
|
}, E = d(() => w.entries.map(({ code: e, action: t }) => ({
|
|
16756
16764
|
id: e,
|
|
16757
16765
|
label: X(t.display?.name) || e,
|
|
16758
|
-
icon:
|
|
16766
|
+
icon: $s(t),
|
|
16759
16767
|
primary: w.primaryCodes.has(e),
|
|
16760
16768
|
destructive: t.destructive,
|
|
16761
16769
|
onRun: () => T({
|
|
@@ -16812,7 +16820,7 @@ function $s({ title: e, singular: t, total: n, shown: r, selectionCount: i, clea
|
|
|
16812
16820
|
}),
|
|
16813
16821
|
C.primary.map((e) => /* @__PURE__ */ N(V, {
|
|
16814
16822
|
kind: "default",
|
|
16815
|
-
icon:
|
|
16823
|
+
icon: $s(e.action, 13),
|
|
16816
16824
|
onClick: () => T(e, !1),
|
|
16817
16825
|
children: X(e.action.display?.name) || e.code
|
|
16818
16826
|
}, e.code)),
|
|
@@ -16835,9 +16843,9 @@ function $s({ title: e, singular: t, total: n, shown: r, selectionCount: i, clea
|
|
|
16835
16843
|
width: 240,
|
|
16836
16844
|
align: "end",
|
|
16837
16845
|
children: [
|
|
16838
|
-
C.global.length > 0 && /* @__PURE__ */ N(
|
|
16846
|
+
C.global.length > 0 && /* @__PURE__ */ N(tc, { children: "Global" }),
|
|
16839
16847
|
C.global.map((e) => /* @__PURE__ */ N(K, {
|
|
16840
|
-
icon:
|
|
16848
|
+
icon: $s(e.action),
|
|
16841
16849
|
danger: e.action.destructive,
|
|
16842
16850
|
onClick: () => {
|
|
16843
16851
|
x(!1), T(e, !1);
|
|
@@ -16877,7 +16885,7 @@ function $s({ title: e, singular: t, total: n, shown: r, selectionCount: i, clea
|
|
|
16877
16885
|
pointerEvents: i === 0 ? "none" : "auto"
|
|
16878
16886
|
},
|
|
16879
16887
|
children: /* @__PURE__ */ N(K, {
|
|
16880
|
-
icon:
|
|
16888
|
+
icon: $s(e.action),
|
|
16881
16889
|
danger: e.action.destructive,
|
|
16882
16890
|
onClick: () => {
|
|
16883
16891
|
x(!1), T(e, !0);
|
|
@@ -16921,7 +16929,7 @@ function $s({ title: e, singular: t, total: n, shown: r, selectionCount: i, clea
|
|
|
16921
16929
|
]
|
|
16922
16930
|
}),
|
|
16923
16931
|
m,
|
|
16924
|
-
i > 0 && /* @__PURE__ */ N(
|
|
16932
|
+
i > 0 && /* @__PURE__ */ N(Ta, {
|
|
16925
16933
|
count: i,
|
|
16926
16934
|
actions: E,
|
|
16927
16935
|
onClear: a,
|
|
@@ -16931,7 +16939,7 @@ function $s({ title: e, singular: t, total: n, shown: r, selectionCount: i, clea
|
|
|
16931
16939
|
]
|
|
16932
16940
|
});
|
|
16933
16941
|
}
|
|
16934
|
-
function
|
|
16942
|
+
function tc({ children: e }) {
|
|
16935
16943
|
return /* @__PURE__ */ N("div", {
|
|
16936
16944
|
style: {
|
|
16937
16945
|
padding: "6px 8px 4px",
|
|
@@ -16946,7 +16954,7 @@ function ec({ children: e }) {
|
|
|
16946
16954
|
}
|
|
16947
16955
|
//#endregion
|
|
16948
16956
|
//#region src/components/list/InlineEditCell.tsx
|
|
16949
|
-
var
|
|
16957
|
+
var nc = {
|
|
16950
16958
|
padding: "4px 6px",
|
|
16951
16959
|
margin: "-4px -6px",
|
|
16952
16960
|
borderRadius: 4,
|
|
@@ -16957,7 +16965,7 @@ var tc = {
|
|
|
16957
16965
|
alignItems: "center",
|
|
16958
16966
|
gap: 4
|
|
16959
16967
|
};
|
|
16960
|
-
function
|
|
16968
|
+
function rc({ value: e, onSave: t, type: n = "text", options: r, trigger: i = "always", label: a, placeholder: o }) {
|
|
16961
16969
|
let [s, c] = p(e), [u, d] = p(e), [m, h] = p(!1), [g, _] = p(e), v = f(null);
|
|
16962
16970
|
l(() => {
|
|
16963
16971
|
c(e), d(e), _(e);
|
|
@@ -17029,7 +17037,7 @@ function nc({ value: e, onSave: t, type: n = "text", options: r, trigger: i = "a
|
|
|
17029
17037
|
onMouseLeave: (e) => {
|
|
17030
17038
|
e.currentTarget.style.borderColor = "transparent";
|
|
17031
17039
|
},
|
|
17032
|
-
style:
|
|
17040
|
+
style: nc,
|
|
17033
17041
|
children: u ?? /* @__PURE__ */ N("span", {
|
|
17034
17042
|
style: { color: "var(--text-4)" },
|
|
17035
17043
|
children: "Click to edit"
|
|
@@ -17038,7 +17046,7 @@ function nc({ value: e, onSave: t, type: n = "text", options: r, trigger: i = "a
|
|
|
17038
17046
|
}
|
|
17039
17047
|
//#endregion
|
|
17040
17048
|
//#region src/components/detail/DetailPage.tsx
|
|
17041
|
-
function
|
|
17049
|
+
function ic(e, t = 13) {
|
|
17042
17050
|
let n = e.display?.icon;
|
|
17043
17051
|
if (!n) return null;
|
|
17044
17052
|
let r = B[n];
|
|
@@ -17047,8 +17055,8 @@ function rc(e, t = 13) {
|
|
|
17047
17055
|
size: t
|
|
17048
17056
|
});
|
|
17049
17057
|
}
|
|
17050
|
-
function
|
|
17051
|
-
let x = f(null), [S, C] = p(!1), { run: w } =
|
|
17058
|
+
function ac({ mode: e, onModeChange: t, onClose: n, onSave: r, onDelete: i, title: a, recordId: o, initialDirty: s, dirty: c, subHeader: u, leading: m, screen: h, actions: g, executeAction: _, sidebar: v, footerMeta: y, children: b }) {
|
|
17059
|
+
let x = f(null), [S, C] = p(!1), { run: w } = Br();
|
|
17052
17060
|
l(() => {
|
|
17053
17061
|
s && e === "view" && t("edit");
|
|
17054
17062
|
}, [s]);
|
|
@@ -17175,7 +17183,7 @@ function ic({ mode: e, onModeChange: t, onClose: n, onSave: r, onDelete: i, titl
|
|
|
17175
17183
|
] }) : /* @__PURE__ */ P(M, { children: [
|
|
17176
17184
|
E.map(({ code: e, action: t }) => /* @__PURE__ */ N(V, {
|
|
17177
17185
|
kind: "default",
|
|
17178
|
-
icon:
|
|
17186
|
+
icon: ic(t),
|
|
17179
17187
|
onClick: () => D({
|
|
17180
17188
|
code: e,
|
|
17181
17189
|
action: t
|
|
@@ -17201,7 +17209,7 @@ function ic({ mode: e, onModeChange: t, onClose: n, onSave: r, onDelete: i, titl
|
|
|
17201
17209
|
width: 220,
|
|
17202
17210
|
align: "end",
|
|
17203
17211
|
children: [T.length === 0 && /* @__PURE__ */ N(K, { children: "No actions" }), T.map(({ code: e, action: t }) => /* @__PURE__ */ N(K, {
|
|
17204
|
-
icon:
|
|
17212
|
+
icon: ic(t),
|
|
17205
17213
|
danger: t.destructive,
|
|
17206
17214
|
onClick: () => {
|
|
17207
17215
|
C(!1), D({
|
|
@@ -17271,7 +17279,7 @@ function ic({ mode: e, onModeChange: t, onClose: n, onSave: r, onDelete: i, titl
|
|
|
17271
17279
|
}
|
|
17272
17280
|
//#endregion
|
|
17273
17281
|
//#region src/components/pages/home/HomeStub.tsx
|
|
17274
|
-
var
|
|
17282
|
+
var oc = [
|
|
17275
17283
|
{
|
|
17276
17284
|
id: "a1",
|
|
17277
17285
|
title: "James Gallagher moved to Discovery",
|
|
@@ -17287,7 +17295,7 @@ var ac = [
|
|
|
17287
17295
|
title: "Refill enrichment job completed (32 leads)",
|
|
17288
17296
|
when: "10:00 AM"
|
|
17289
17297
|
}
|
|
17290
|
-
],
|
|
17298
|
+
], sc = [
|
|
17291
17299
|
{
|
|
17292
17300
|
label: "Open leads",
|
|
17293
17301
|
val: "127",
|
|
@@ -17312,7 +17320,7 @@ var ac = [
|
|
|
17312
17320
|
delta: "2 failed",
|
|
17313
17321
|
tone: "amber"
|
|
17314
17322
|
}
|
|
17315
|
-
],
|
|
17323
|
+
], cc = [
|
|
17316
17324
|
[
|
|
17317
17325
|
"leads",
|
|
17318
17326
|
"Leads",
|
|
@@ -17344,7 +17352,7 @@ var ac = [
|
|
|
17344
17352
|
"entity"
|
|
17345
17353
|
]
|
|
17346
17354
|
];
|
|
17347
|
-
function
|
|
17355
|
+
function lc({ onOpenNav: e, greeting: t = "Good afternoon, Konstantin", tenantLabel: n = "Acme · production" }) {
|
|
17348
17356
|
return /* @__PURE__ */ N("div", {
|
|
17349
17357
|
style: {
|
|
17350
17358
|
padding: "22px 24px",
|
|
@@ -17388,7 +17396,7 @@ function cc({ onOpenNav: e, greeting: t = "Good afternoon, Konstantin", tenantLa
|
|
|
17388
17396
|
gap: 10,
|
|
17389
17397
|
margin: "16px 0"
|
|
17390
17398
|
},
|
|
17391
|
-
children:
|
|
17399
|
+
children: sc.map((e) => /* @__PURE__ */ P("div", {
|
|
17392
17400
|
style: {
|
|
17393
17401
|
padding: 14,
|
|
17394
17402
|
background: "var(--surface)",
|
|
@@ -17436,7 +17444,7 @@ function cc({ onOpenNav: e, greeting: t = "Good afternoon, Konstantin", tenantLa
|
|
|
17436
17444
|
gridTemplateColumns: "repeat(3,1fr)",
|
|
17437
17445
|
gap: 8
|
|
17438
17446
|
},
|
|
17439
|
-
children:
|
|
17447
|
+
children: cc.map(([t, n, r]) => {
|
|
17440
17448
|
let a = B[r];
|
|
17441
17449
|
return /* @__PURE__ */ P("button", {
|
|
17442
17450
|
onClick: () => e?.(t),
|
|
@@ -17481,7 +17489,7 @@ function cc({ onOpenNav: e, greeting: t = "Good afternoon, Konstantin", tenantLa
|
|
|
17481
17489
|
flexDirection: "column",
|
|
17482
17490
|
gap: 8
|
|
17483
17491
|
},
|
|
17484
|
-
children:
|
|
17492
|
+
children: oc.slice(0, 3).map((e) => /* @__PURE__ */ P("div", {
|
|
17485
17493
|
style: {
|
|
17486
17494
|
fontSize: 12,
|
|
17487
17495
|
color: "var(--text-2)"
|
|
@@ -17510,19 +17518,19 @@ function cc({ onOpenNav: e, greeting: t = "Good afternoon, Konstantin", tenantLa
|
|
|
17510
17518
|
}
|
|
17511
17519
|
//#endregion
|
|
17512
17520
|
//#region src/components/pages/pipeline/Pipeline.tsx
|
|
17513
|
-
var
|
|
17521
|
+
var uc = {
|
|
17514
17522
|
"1-New": { color: "slate" },
|
|
17515
17523
|
"2-Contacted": { color: "sky" },
|
|
17516
17524
|
"3-Qualified": { color: "violet" },
|
|
17517
17525
|
"4-Proposal": { color: "amber" },
|
|
17518
17526
|
"5-Won": { color: "emerald" },
|
|
17519
17527
|
"6-Lost": { color: "rose" }
|
|
17520
|
-
},
|
|
17528
|
+
}, dc = {
|
|
17521
17529
|
P0: "rose",
|
|
17522
17530
|
P1: "amber",
|
|
17523
17531
|
P2: "sky",
|
|
17524
17532
|
P3: "slate"
|
|
17525
|
-
},
|
|
17533
|
+
}, fc = [
|
|
17526
17534
|
{
|
|
17527
17535
|
id: "l1",
|
|
17528
17536
|
contact: "James Gallagher",
|
|
@@ -17588,11 +17596,11 @@ var lc = {
|
|
|
17588
17596
|
score: 58
|
|
17589
17597
|
}
|
|
17590
17598
|
];
|
|
17591
|
-
function
|
|
17592
|
-
let e = Object.entries(
|
|
17599
|
+
function pc() {
|
|
17600
|
+
let e = Object.entries(uc).map(([e, t]) => ({
|
|
17593
17601
|
key: e,
|
|
17594
17602
|
color: t.color,
|
|
17595
|
-
leads:
|
|
17603
|
+
leads: fc.filter((t) => t.pipeline === e)
|
|
17596
17604
|
}));
|
|
17597
17605
|
return /* @__PURE__ */ P("div", {
|
|
17598
17606
|
style: {
|
|
@@ -17623,7 +17631,7 @@ function fc() {
|
|
|
17623
17631
|
fontSize: 12,
|
|
17624
17632
|
color: "var(--text-3)"
|
|
17625
17633
|
},
|
|
17626
|
-
children: [
|
|
17634
|
+
children: [fc.length, " leads · $2.4M pipeline"]
|
|
17627
17635
|
})]
|
|
17628
17636
|
}), /* @__PURE__ */ N("div", {
|
|
17629
17637
|
style: {
|
|
@@ -17709,7 +17717,7 @@ function fc() {
|
|
|
17709
17717
|
flexWrap: "wrap"
|
|
17710
17718
|
},
|
|
17711
17719
|
children: [e.priority && e.priority !== "-" && /* @__PURE__ */ N(U, {
|
|
17712
|
-
tone:
|
|
17720
|
+
tone: dc[e.priority] ?? "slate",
|
|
17713
17721
|
size: "xs",
|
|
17714
17722
|
dot: !0,
|
|
17715
17723
|
children: e.priority
|
|
@@ -17728,7 +17736,7 @@ function fc() {
|
|
|
17728
17736
|
}
|
|
17729
17737
|
//#endregion
|
|
17730
17738
|
//#region src/components/pages/jobs/Jobs.tsx
|
|
17731
|
-
var
|
|
17739
|
+
var mc = [
|
|
17732
17740
|
{
|
|
17733
17741
|
id: "job_91a4",
|
|
17734
17742
|
name: "reparse_leads_with_llm",
|
|
@@ -17772,12 +17780,12 @@ var pc = [
|
|
|
17772
17780
|
worker: "wk-us-01",
|
|
17773
17781
|
took: "2m 02s"
|
|
17774
17782
|
}
|
|
17775
|
-
],
|
|
17783
|
+
], hc = {
|
|
17776
17784
|
running: "sky",
|
|
17777
17785
|
success: "emerald",
|
|
17778
17786
|
queued: "slate",
|
|
17779
17787
|
failed: "rose"
|
|
17780
|
-
},
|
|
17788
|
+
}, gc = [
|
|
17781
17789
|
"ID",
|
|
17782
17790
|
"Name",
|
|
17783
17791
|
"Status",
|
|
@@ -17787,7 +17795,7 @@ var pc = [
|
|
|
17787
17795
|
"Worker",
|
|
17788
17796
|
""
|
|
17789
17797
|
];
|
|
17790
|
-
function
|
|
17798
|
+
function _c() {
|
|
17791
17799
|
return /* @__PURE__ */ P("div", {
|
|
17792
17800
|
style: {
|
|
17793
17801
|
padding: "14px 20px",
|
|
@@ -17836,7 +17844,7 @@ function gc() {
|
|
|
17836
17844
|
background: "var(--surface-2)",
|
|
17837
17845
|
color: "var(--text-3)"
|
|
17838
17846
|
},
|
|
17839
|
-
children:
|
|
17847
|
+
children: gc.map((e, t) => /* @__PURE__ */ N("th", {
|
|
17840
17848
|
style: {
|
|
17841
17849
|
padding: "0 10px",
|
|
17842
17850
|
textAlign: "left",
|
|
@@ -17848,7 +17856,7 @@ function gc() {
|
|
|
17848
17856
|
},
|
|
17849
17857
|
children: e
|
|
17850
17858
|
}, e || `_h${t}`))
|
|
17851
|
-
}) }), /* @__PURE__ */ N("tbody", { children:
|
|
17859
|
+
}) }), /* @__PURE__ */ N("tbody", { children: mc.map((e) => /* @__PURE__ */ P("tr", {
|
|
17852
17860
|
style: { height: 32 },
|
|
17853
17861
|
children: [
|
|
17854
17862
|
/* @__PURE__ */ N("td", {
|
|
@@ -17880,7 +17888,7 @@ function gc() {
|
|
|
17880
17888
|
borderBottom: "1px solid var(--divider)"
|
|
17881
17889
|
},
|
|
17882
17890
|
children: /* @__PURE__ */ N(U, {
|
|
17883
|
-
tone:
|
|
17891
|
+
tone: hc[e.status],
|
|
17884
17892
|
size: "xs",
|
|
17885
17893
|
dot: !0,
|
|
17886
17894
|
children: e.status
|
|
@@ -17910,7 +17918,7 @@ function gc() {
|
|
|
17910
17918
|
display: "block",
|
|
17911
17919
|
height: "100%",
|
|
17912
17920
|
width: `${e.progress}%`,
|
|
17913
|
-
background: `var(--pill-${
|
|
17921
|
+
background: `var(--pill-${hc[e.status]})`
|
|
17914
17922
|
} })
|
|
17915
17923
|
}), /* @__PURE__ */ P("span", {
|
|
17916
17924
|
className: "mono num",
|
|
@@ -17964,6 +17972,6 @@ function gc() {
|
|
|
17964
17972
|
});
|
|
17965
17973
|
}
|
|
17966
17974
|
//#endregion
|
|
17967
|
-
export { fn as AIPanel,
|
|
17975
|
+
export { fn as AIPanel, Hr as ActionRunnerProvider, Ls as App, Ls as Declarion, di as AuthShell, _e as Avatar, Ce as BoolToggle, en as Breadcrumbs, V as Btn, Ta as BulkBar, xi as ChangePasswordDialog, we as Check, ye as Chip, Pa as ColumnPicker, cn as CommandPalette, Yi as ConfirmDialog, ke as DateInput, ve as Dropdown, rn as DynamicIcon, Wi as EmptyState, Us as EntityClient, q as FieldLabel, Da as FilterChips, Aa as FilterDrawer, _i as Forgot, lc as HomeStub, B as Icon, H as IconBtn, rc as InlineEditCell, _c as JobsStub, Pe as JsonField, ge as Kbd, K as MenuItem, aa as NO_VALUE_OPS, oa as OP_LABELS, qs as PageHeader, Y as PasswordInput, U as Pill, pc as PipelineStub, ki as Preferences, Si as Profile, ba as QEField, Le as QuickEditCell, ya as QuickPeek, Ke as Rail, W as RecordIdBadge, Vs as RefCache, Fe as RefField, G as RowField, Js as RowMenu, be as SectionCard, Oe as Select, ac as ShellDetailPage, ec as ShellListPage, Nt as Sidebar, hi as SignIn, gi as SignUp, vs as SmartDetailPage, Ha as SmartListPage, Es as SmartRecordListPage, Te as Spinner, an as TabStrip, Ne as TagsInput, Qt as TenantChip, De as TextArea, J as TextInput, nn as TopBar, vi as TwoFA, Xs as VISIBILITY_LIST_BULK_BAR, Ys as VISIBILITY_LIST_TOOLBAR, Ie as ViewField, Ia as ViewSwitcher, Pt as buildSections, da as countActiveFilters, he as cx, Ws as entityClient, Zt as envTone, ze as fieldDisplayName, la as hasOrGroups, X as loc, sa as parseFiltersFromURL, js as registerScreen, Qs as resolveBulkBarActions, Zs as resolveToolbarActions, ca as setFiltersInURL, Br as useActionRunner, Jt as useAuth, Gs as useColumns, Ri as useCreateEntity, Ui as useDebounce, Bi as useDeleteEntity, Ts as useDeleteProperty, Zn as useEntity, Xn as useEntityData, Ya as useEntityItem, ma as useFilters, ni as usePublicParams, ri as useResolvedParam, st as useSchema, La as useScreen, ws as useSetProperty, xs as useSetStatus, Mt as useTabNavigate, jt as useTabStore, zi as useUpdateEntity, Ra as useViews };
|
|
17968
17976
|
|
|
17969
17977
|
//# sourceMappingURL=index.js.map
|