@argusoft/medplat-core 1.0.23 → 1.0.24
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/AddMenuConfiguration-m3R8FDhj.js +5570 -0
- package/dist/AddMenuConfiguration-m3R8FDhj.js.map +1 -0
- package/dist/AddMenuConfiguration.css +1 -1
- package/dist/{ChangePasswordModalCore-DONyFFlx.js → ChangePasswordModalCore-Czu7OZe6.js} +954 -951
- package/dist/ChangePasswordModalCore-Czu7OZe6.js.map +1 -0
- package/dist/{ConditionConfig-C3rF2wXU.js → ConditionConfig-BECSbvY2.js} +2 -2
- package/dist/{ConditionConfig-C3rF2wXU.js.map → ConditionConfig-BECSbvY2.js.map} +1 -1
- package/dist/FhirRawResourceList-ZZFd7gTX.js +550 -0
- package/dist/FhirRawResourceList-ZZFd7gTX.js.map +1 -0
- package/dist/FhirServerList-Dkq7Kbes.js +116 -0
- package/dist/FhirServerList-Dkq7Kbes.js.map +1 -0
- package/dist/FhirServerProfile-CUOwC6Wb.js +253 -0
- package/dist/FhirServerProfile-CUOwC6Wb.js.map +1 -0
- package/dist/FhirServerWizard-Db6Hm4bQ.js +161 -0
- package/dist/FhirServerWizard-Db6Hm4bQ.js.map +1 -0
- package/dist/{ImmunizationConfigurationBase-CTBoSuSz.js → ImmunizationConfigurationBase-BevKZx_l.js} +386 -302
- package/dist/ImmunizationConfigurationBase-BevKZx_l.js.map +1 -0
- package/dist/{ManageEventConfiguration-BntUc_YI.js → ManageEventConfiguration-CBi2KMB1.js} +4 -4
- package/dist/{ManageEventConfiguration-BntUc_YI.js.map → ManageEventConfiguration-CBi2KMB1.js.map} +1 -1
- package/dist/{ManageUser-Gv38VHMu.js → ManageUser-BnEPFSPT.js} +110 -110
- package/dist/{ManageUser-Gv38VHMu.js.map → ManageUser-BnEPFSPT.js.map} +1 -1
- package/dist/{MobileMenuManagement-CV6QCeos.js → MobileMenuManagement-CVAKyKDa.js} +33 -32
- package/dist/MobileMenuManagement-CVAKyKDa.js.map +1 -0
- package/dist/{MobileTypeEventConfigModal-BNjZ8pnq.js → MobileTypeEventConfigModal-C34AN-IJ.js} +2 -2
- package/dist/{MobileTypeEventConfigModal-BNjZ8pnq.js.map → MobileTypeEventConfigModal-C34AN-IJ.js.map} +1 -1
- package/dist/{OtherTypeEventConfigModal-DiVhWDpG.js → OtherTypeEventConfigModal-BYjMFl0-.js} +93 -93
- package/dist/OtherTypeEventConfigModal-BYjMFl0-.js.map +1 -0
- package/dist/ServerFormFields-SLghoZ2z.js +136 -0
- package/dist/ServerFormFields-SLghoZ2z.js.map +1 -0
- package/dist/SyncDialog-BRGpHOE4.js +130 -0
- package/dist/SyncDialog-BRGpHOE4.js.map +1 -0
- package/dist/{TypeConfiguration-CupQxH9Y.js → TypeConfiguration-Bs5WkIa2.js} +2 -2
- package/dist/{TypeConfiguration-CupQxH9Y.js.map → TypeConfiguration-Bs5WkIa2.js.map} +1 -1
- package/dist/dashboardLayoutUtils-Bt5HA96J.js +265 -0
- package/dist/dashboardLayoutUtils-Bt5HA96J.js.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.js +190 -134
- package/dist/index.js.map +1 -1
- package/dist/permissions-DEWACxJN.js +308 -0
- package/dist/permissions-DEWACxJN.js.map +1 -0
- package/package.json +1 -1
- package/dist/AddMenuConfiguration-DsnY0Rws.js +0 -2237
- package/dist/AddMenuConfiguration-DsnY0Rws.js.map +0 -1
- package/dist/ChangePasswordModalCore-DONyFFlx.js.map +0 -1
- package/dist/ImmunizationConfigurationBase-CTBoSuSz.js.map +0 -1
- package/dist/MobileMenuManagement-CV6QCeos.js.map +0 -1
- package/dist/OtherTypeEventConfigModal-DiVhWDpG.js.map +0 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { jsxs as o, jsx as t, Fragment as d } from "react/jsx-runtime";
|
|
2
|
+
import h from "prop-types";
|
|
3
|
+
import { Stack as p, TextField as n, Divider as b, Typography as m, FormControl as g, InputLabel as v, Select as f, MenuItem as y, FormControlLabel as A, Switch as T } from "@mui/material";
|
|
4
|
+
const S = /^[a-z][a-z0-9-]*$/, U = [
|
|
5
|
+
{ value: "NONE", label: "None (public server)" },
|
|
6
|
+
{ value: "BASIC", label: "Basic (username + password)" },
|
|
7
|
+
{ value: "BEARER", label: "Bearer token" },
|
|
8
|
+
{ value: "API_KEY", label: "API key header" }
|
|
9
|
+
];
|
|
10
|
+
function C({ value: a, onChange: u, isEdit: l = !1, errors: s = {} }) {
|
|
11
|
+
const r = (e) => u({ ...a, ...e }), i = a.authType ?? "NONE", c = l && a.hasSecret ? "•••••••• (leave blank to keep current)" : "";
|
|
12
|
+
return /* @__PURE__ */ o(p, { spacing: 2.5, children: [
|
|
13
|
+
/* @__PURE__ */ t(
|
|
14
|
+
n,
|
|
15
|
+
{
|
|
16
|
+
label: "Server Name *",
|
|
17
|
+
size: "small",
|
|
18
|
+
fullWidth: !0,
|
|
19
|
+
value: a.name ?? "",
|
|
20
|
+
onChange: (e) => r({ name: e.target.value }),
|
|
21
|
+
disabled: l,
|
|
22
|
+
error: !!s.name,
|
|
23
|
+
helperText: s.name ?? "Lowercase letters, digits and hyphens. e.g. primary-terminology"
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
/* @__PURE__ */ t(
|
|
27
|
+
n,
|
|
28
|
+
{
|
|
29
|
+
label: "Base URL *",
|
|
30
|
+
size: "small",
|
|
31
|
+
fullWidth: !0,
|
|
32
|
+
value: a.baseUrl ?? "",
|
|
33
|
+
onChange: (e) => r({ baseUrl: e.target.value }),
|
|
34
|
+
error: !!s.baseUrl,
|
|
35
|
+
helperText: s.baseUrl ?? "The FHIR server base URL, e.g. https://your-fhir-server/fhir"
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
/* @__PURE__ */ t(b, { textAlign: "left", children: /* @__PURE__ */ t(m, { variant: "caption", color: "text.secondary", sx: { fontWeight: 700 }, children: "AUTHENTICATION" }) }),
|
|
39
|
+
/* @__PURE__ */ o(g, { fullWidth: !0, size: "small", children: [
|
|
40
|
+
/* @__PURE__ */ t(v, { children: "Authentication" }),
|
|
41
|
+
/* @__PURE__ */ t(f, { value: i, label: "Authentication", onChange: (e) => r({ authType: e.target.value }), children: U.map((e) => /* @__PURE__ */ t(y, { value: e.value, children: e.label }, e.value)) })
|
|
42
|
+
] }),
|
|
43
|
+
i === "BASIC" && /* @__PURE__ */ o(d, { children: [
|
|
44
|
+
/* @__PURE__ */ t(
|
|
45
|
+
n,
|
|
46
|
+
{
|
|
47
|
+
label: "Username",
|
|
48
|
+
size: "small",
|
|
49
|
+
fullWidth: !0,
|
|
50
|
+
value: a.authUsername ?? "",
|
|
51
|
+
onChange: (e) => r({ authUsername: e.target.value })
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
/* @__PURE__ */ t(
|
|
55
|
+
n,
|
|
56
|
+
{
|
|
57
|
+
label: "Password",
|
|
58
|
+
type: "password",
|
|
59
|
+
size: "small",
|
|
60
|
+
fullWidth: !0,
|
|
61
|
+
value: a.authSecret ?? "",
|
|
62
|
+
placeholder: c,
|
|
63
|
+
onChange: (e) => r({ authSecret: e.target.value })
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] }),
|
|
67
|
+
i === "BEARER" && /* @__PURE__ */ t(
|
|
68
|
+
n,
|
|
69
|
+
{
|
|
70
|
+
label: "Bearer Token",
|
|
71
|
+
type: "password",
|
|
72
|
+
size: "small",
|
|
73
|
+
fullWidth: !0,
|
|
74
|
+
value: a.authSecret ?? "",
|
|
75
|
+
placeholder: c,
|
|
76
|
+
onChange: (e) => r({ authSecret: e.target.value }),
|
|
77
|
+
helperText: "Sent as: Authorization: Bearer <token>"
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
i === "API_KEY" && /* @__PURE__ */ o(d, { children: [
|
|
81
|
+
/* @__PURE__ */ t(
|
|
82
|
+
n,
|
|
83
|
+
{
|
|
84
|
+
label: "Header Name",
|
|
85
|
+
size: "small",
|
|
86
|
+
fullWidth: !0,
|
|
87
|
+
value: a.authHeaderName ?? "",
|
|
88
|
+
onChange: (e) => r({ authHeaderName: e.target.value }),
|
|
89
|
+
placeholder: "e.g. x-api-key"
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
/* @__PURE__ */ t(
|
|
93
|
+
n,
|
|
94
|
+
{
|
|
95
|
+
label: "Header Value",
|
|
96
|
+
type: "password",
|
|
97
|
+
size: "small",
|
|
98
|
+
fullWidth: !0,
|
|
99
|
+
value: a.authSecret ?? "",
|
|
100
|
+
placeholder: c,
|
|
101
|
+
onChange: (e) => r({ authSecret: e.target.value })
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
] }),
|
|
105
|
+
/* @__PURE__ */ t(
|
|
106
|
+
A,
|
|
107
|
+
{
|
|
108
|
+
control: /* @__PURE__ */ t(T, { checked: a.isActive ?? !0, onChange: (e) => r({ isActive: e.target.checked }) }),
|
|
109
|
+
label: /* @__PURE__ */ t(m, { variant: "body2", children: "Active" })
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
] });
|
|
113
|
+
}
|
|
114
|
+
C.propTypes = {
|
|
115
|
+
value: h.object.isRequired,
|
|
116
|
+
onChange: h.func.isRequired,
|
|
117
|
+
isEdit: h.bool,
|
|
118
|
+
errors: h.object
|
|
119
|
+
};
|
|
120
|
+
function E(a, { isEdit: u = !1 } = {}) {
|
|
121
|
+
var s, r;
|
|
122
|
+
const l = {};
|
|
123
|
+
if ((s = a.name) != null && s.trim() ? !u && !S.test(a.name) && (l.name = "Lowercase letters, digits, hyphens; must start with a letter.") : l.name = "Name is required.", !((r = a.baseUrl) != null && r.trim())) l.baseUrl = "Base URL is required.";
|
|
124
|
+
else
|
|
125
|
+
try {
|
|
126
|
+
new URL(a.baseUrl);
|
|
127
|
+
} catch {
|
|
128
|
+
l.baseUrl = "Must be a valid URL.";
|
|
129
|
+
}
|
|
130
|
+
return l;
|
|
131
|
+
}
|
|
132
|
+
export {
|
|
133
|
+
C as S,
|
|
134
|
+
E as v
|
|
135
|
+
};
|
|
136
|
+
//# sourceMappingURL=ServerFormFields-SLghoZ2z.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServerFormFields-SLghoZ2z.js","sources":["../src/views/FhirResource/components/ServerFormFields.jsx"],"sourcesContent":["import PropTypes from \"prop-types\";\nimport {\n Stack, TextField, FormControl, InputLabel, Select, MenuItem,\n FormControlLabel, Switch, Typography, Divider,\n} from \"@mui/material\";\n\nconst NAME_PATTERN = /^[a-z][a-z0-9-]*$/;\n\nconst AUTH_TYPES = [\n { value: \"NONE\", label: \"None (public server)\" },\n { value: \"BASIC\", label: \"Basic (username + password)\" },\n { value: \"BEARER\", label: \"Bearer token\" },\n { value: \"API_KEY\", label: \"API key header\" },\n];\n\n/**\n * Controlled server form fields (name, base URL, authentication). Shared by the\n * creation wizard and the edit modal. `value` is the form object; `onChange`\n * receives a partial patch.\n */\nexport default function ServerFormFields({ value, onChange, isEdit = false, errors = {} }) {\n const set = (patch) => onChange({ ...value, ...patch });\n const authType = value.authType ?? \"NONE\";\n const secretPlaceholder = isEdit && value.hasSecret ? \"•••••••• (leave blank to keep current)\" : \"\";\n\n return (\n <Stack spacing={2.5}>\n <TextField\n label=\"Server Name *\"\n size=\"small\"\n fullWidth\n value={value.name ?? \"\"}\n onChange={(e) => set({ name: e.target.value })}\n disabled={isEdit}\n error={Boolean(errors.name)}\n helperText={errors.name ?? \"Lowercase letters, digits and hyphens. e.g. primary-terminology\"}\n />\n\n <TextField\n label=\"Base URL *\"\n size=\"small\"\n fullWidth\n value={value.baseUrl ?? \"\"}\n onChange={(e) => set({ baseUrl: e.target.value })}\n error={Boolean(errors.baseUrl)}\n helperText={errors.baseUrl ?? \"The FHIR server base URL, e.g. https://your-fhir-server/fhir\"}\n />\n\n <Divider textAlign=\"left\">\n <Typography variant=\"caption\" color=\"text.secondary\" sx={{ fontWeight: 700 }}>AUTHENTICATION</Typography>\n </Divider>\n\n <FormControl fullWidth size=\"small\">\n <InputLabel>Authentication</InputLabel>\n <Select value={authType} label=\"Authentication\" onChange={(e) => set({ authType: e.target.value })}>\n {AUTH_TYPES.map((a) => <MenuItem key={a.value} value={a.value}>{a.label}</MenuItem>)}\n </Select>\n </FormControl>\n\n {authType === \"BASIC\" && (\n <>\n <TextField label=\"Username\" size=\"small\" fullWidth\n value={value.authUsername ?? \"\"} onChange={(e) => set({ authUsername: e.target.value })} />\n <TextField label=\"Password\" type=\"password\" size=\"small\" fullWidth\n value={value.authSecret ?? \"\"} placeholder={secretPlaceholder}\n onChange={(e) => set({ authSecret: e.target.value })} />\n </>\n )}\n\n {authType === \"BEARER\" && (\n <TextField label=\"Bearer Token\" type=\"password\" size=\"small\" fullWidth\n value={value.authSecret ?? \"\"} placeholder={secretPlaceholder}\n onChange={(e) => set({ authSecret: e.target.value })}\n helperText=\"Sent as: Authorization: Bearer <token>\" />\n )}\n\n {authType === \"API_KEY\" && (\n <>\n <TextField label=\"Header Name\" size=\"small\" fullWidth\n value={value.authHeaderName ?? \"\"} onChange={(e) => set({ authHeaderName: e.target.value })}\n placeholder=\"e.g. x-api-key\" />\n <TextField label=\"Header Value\" type=\"password\" size=\"small\" fullWidth\n value={value.authSecret ?? \"\"} placeholder={secretPlaceholder}\n onChange={(e) => set({ authSecret: e.target.value })} />\n </>\n )}\n\n <FormControlLabel\n control={<Switch checked={value.isActive ?? true} onChange={(e) => set({ isActive: e.target.checked })} />}\n label={<Typography variant=\"body2\">Active</Typography>}\n />\n </Stack>\n );\n}\n\nServerFormFields.propTypes = {\n value: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n isEdit: PropTypes.bool,\n errors: PropTypes.object,\n};\n\nexport function validateServerForm(form, { isEdit = false } = {}) {\n const errors = {};\n if (!form.name?.trim()) errors.name = \"Name is required.\";\n else if (!isEdit && !NAME_PATTERN.test(form.name)) errors.name = \"Lowercase letters, digits, hyphens; must start with a letter.\";\n if (!form.baseUrl?.trim()) errors.baseUrl = \"Base URL is required.\";\n else {\n try { new URL(form.baseUrl); } catch { errors.baseUrl = \"Must be a valid URL.\"; }\n }\n return errors;\n}\n"],"names":["NAME_PATTERN","AUTH_TYPES","ServerFormFields","value","onChange","isEdit","errors","set","patch","authType","secretPlaceholder","jsxs","Stack","jsx","TextField","Divider","Typography","FormControl","InputLabel","Select","a","MenuItem","Fragment","FormControlLabel","Switch","PropTypes","validateServerForm","form","_a","_b"],"mappings":";;;AAMA,MAAMA,IAAe,qBAEfC,IAAa;AAAA,EACjB,EAAE,OAAO,QAAQ,OAAO,uBAAA;AAAA,EACxB,EAAE,OAAO,SAAS,OAAO,8BAAA;AAAA,EACzB,EAAE,OAAO,UAAU,OAAO,eAAA;AAAA,EAC1B,EAAE,OAAO,WAAW,OAAO,iBAAA;AAC7B;AAOA,SAAwBC,EAAiB,EAAE,OAAAC,GAAO,UAAAC,GAAU,QAAAC,IAAS,IAAO,QAAAC,IAAS,CAAA,KAAM;AACzF,QAAMC,IAAM,CAACC,MAAUJ,EAAS,EAAE,GAAGD,GAAO,GAAGK,GAAO,GAChDC,IAAWN,EAAM,YAAY,QAC7BO,IAAoBL,KAAUF,EAAM,YAAY,2CAA2C;AAEjG,SACE,gBAAAQ,EAACC,GAAA,EAAM,SAAS,KACd,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,OAAM;AAAA,QACN,MAAK;AAAA,QACL,WAAS;AAAA,QACT,OAAOX,EAAM,QAAQ;AAAA,QACrB,UAAU,CAAC,MAAMI,EAAI,EAAE,MAAM,EAAE,OAAO,OAAO;AAAA,QAC7C,UAAUF;AAAA,QACV,OAAO,EAAQC,EAAO;AAAA,QACtB,YAAYA,EAAO,QAAQ;AAAA,MAAA;AAAA,IAAA;AAAA,IAG7B,gBAAAO;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,OAAM;AAAA,QACN,MAAK;AAAA,QACL,WAAS;AAAA,QACT,OAAOX,EAAM,WA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EAAiB,YAAY;AAAA,EAC3B,OAAOuB,EAAU,OAAO;AAAA,EACxB,UAAUA,EAAU,KAAK;AAAA,EACzB,QAAQA,EAAU;AAAA,EAClB,QAAQA,EAAU;AACpB;AAEO,SAASC,EAAmBC,GAAM,EAAE,QAAAtB,IAAS,GAAA,IAAU,CAAA,GAAI;;AAChE,QAAMC,IAAS,CAAA;AAGf,OAFKsB,IAAAD,EAAK,SAAL,QAAAC,EAAW,SACP,CAACvB,KAAU,CAACL,EAAa,KAAK2B,EAAK,IAAI,MAAGrB,EAAO,OAAO,qEADlC,OAAO,qBAElC,GAACuB,IAAAF,EAAK,YAAL,QAAAE,EAAc,WAAe,UAAU;AAAA;AAE1C,QAAI;AAAE,UAAI,IAAIF,EAAK,OAAO;AAAA,IAAG,QAAQ;AAAE,MAAArB,EAAO,UAAU;AAAA,IAAwB;AAElF,SAAOA;AACT;"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { jsxs as n, jsx as t, Fragment as G } from "react/jsx-runtime";
|
|
2
|
+
import { useState as i, useMemo as V } from "react";
|
|
3
|
+
import { Dialog as _, DialogTitle as v, Typography as T, Tabs as Y, Tab as W, DialogContent as J, Box as j, Alert as K, FormControlLabel as C, Checkbox as B, Divider as N, Stack as k, FormControl as Q, InputLabel as X, Select as Z, MenuItem as D, TextField as ee, Switch as te, Chip as se, DialogActions as ae, Button as R } from "@mui/material";
|
|
4
|
+
import { showToast as d } from "@/common/toaster/toaster";
|
|
5
|
+
import { d as le, s as ce, j as ne, k as ie } from "./permissions-DEWACxJN.js";
|
|
6
|
+
const oe = ["ValueSet", "CodeSystem", "Organization", "Location", "HealthcareService"];
|
|
7
|
+
function ue({ open: z, server: s, onClose: p, onDone: o }) {
|
|
8
|
+
var A;
|
|
9
|
+
const [h, E] = i("types"), [y, F] = i({}), [u, H] = i("ValueSet"), [g, L] = i(""), [f, O] = i(!0), [c, m] = i(!1), [w, I] = i(null), r = V(() => {
|
|
10
|
+
const e = (s == null ? void 0 : s.supportedResources) ?? [];
|
|
11
|
+
return e.length ? e : oe;
|
|
12
|
+
}, [s]), S = Object.keys(y).filter((e) => y[e]), P = r.length > 0 && r.every((e) => y[e]), M = r.some((e) => y[e]), U = (e) => {
|
|
13
|
+
F(Object.fromEntries(r.map((l) => [l, e])));
|
|
14
|
+
}, $ = async () => {
|
|
15
|
+
var e, l;
|
|
16
|
+
if (S.length === 0) {
|
|
17
|
+
d({ type: "error", message: "Select at least one resource type." });
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
m(!0);
|
|
21
|
+
try {
|
|
22
|
+
const a = await ce(s.id, S, {
|
|
23
|
+
alsoProcess: f,
|
|
24
|
+
onProgress: I
|
|
25
|
+
});
|
|
26
|
+
d({ type: "success", message: `Synced ${a} resource(s).` }), o == null || o(), p();
|
|
27
|
+
} catch (a) {
|
|
28
|
+
d({ type: "error", message: ((l = (e = a == null ? void 0 : a.response) == null ? void 0 : e.data) == null ? void 0 : l.message) ?? "Sync failed." });
|
|
29
|
+
} finally {
|
|
30
|
+
m(!1), I(null);
|
|
31
|
+
}
|
|
32
|
+
}, q = async () => {
|
|
33
|
+
var e, l;
|
|
34
|
+
if (!u || !g.trim()) {
|
|
35
|
+
d({ type: "error", message: "Resource type and FHIR id are required." });
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
m(!0);
|
|
39
|
+
try {
|
|
40
|
+
const a = await ne(s.id, u, g.trim()), b = a == null ? void 0 : a.data;
|
|
41
|
+
f && (b != null && b.id) && await ie(b.id), d({ type: "success", message: `Synced ${u}/${g.trim()}.` }), o == null || o(), p();
|
|
42
|
+
} catch (a) {
|
|
43
|
+
d({ type: "error", message: ((l = (e = a == null ? void 0 : a.response) == null ? void 0 : e.data) == null ? void 0 : l.message) ?? "Sync failed." });
|
|
44
|
+
} finally {
|
|
45
|
+
m(!1);
|
|
46
|
+
}
|
|
47
|
+
}, x = c && h === "types" && w;
|
|
48
|
+
return /* @__PURE__ */ n(_, { open: z, onClose: c ? void 0 : p, maxWidth: "sm", fullWidth: !0, children: [
|
|
49
|
+
/* @__PURE__ */ n(v, { children: [
|
|
50
|
+
"Sync from “",
|
|
51
|
+
s == null ? void 0 : s.name,
|
|
52
|
+
"”",
|
|
53
|
+
/* @__PURE__ */ t(T, { variant: "caption", color: "text.secondary", display: "block", children: s == null ? void 0 : s.baseUrl })
|
|
54
|
+
] }),
|
|
55
|
+
!x && /* @__PURE__ */ n(Y, { value: h, onChange: (e, l) => E(l), sx: { px: 3, "& .MuiTab-root": { textTransform: "none", fontWeight: 700 } }, children: [
|
|
56
|
+
/* @__PURE__ */ t(W, { value: "types", label: "By Resource Type", disabled: c }),
|
|
57
|
+
/* @__PURE__ */ t(W, { value: "single", label: "Single Resource", disabled: c })
|
|
58
|
+
] }),
|
|
59
|
+
/* @__PURE__ */ n(J, { dividers: !0, children: [
|
|
60
|
+
x ? /* @__PURE__ */ t(le, { progress: w }) : h === "types" ? /* @__PURE__ */ n(j, { children: [
|
|
61
|
+
!((A = s == null ? void 0 : s.supportedResources) != null && A.length) && /* @__PURE__ */ t(K, { severity: "info", sx: { mb: 2 }, children: "Capability not discovered yet — showing common resource types. Use “Refresh Capability” on the server to list exactly what this server supports." }),
|
|
62
|
+
/* @__PURE__ */ t(
|
|
63
|
+
C,
|
|
64
|
+
{
|
|
65
|
+
control: /* @__PURE__ */ t(
|
|
66
|
+
B,
|
|
67
|
+
{
|
|
68
|
+
checked: P,
|
|
69
|
+
indeterminate: M && !P,
|
|
70
|
+
onChange: (e) => U(e.target.checked)
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
label: /* @__PURE__ */ t(T, { variant: "body2", sx: { fontWeight: 700 }, children: "Select All" }),
|
|
74
|
+
sx: { mb: 0.5 }
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
/* @__PURE__ */ t(N, { sx: { mb: 1 } }),
|
|
78
|
+
/* @__PURE__ */ t(k, { children: r.map((e) => /* @__PURE__ */ t(
|
|
79
|
+
C,
|
|
80
|
+
{
|
|
81
|
+
control: /* @__PURE__ */ t(
|
|
82
|
+
B,
|
|
83
|
+
{
|
|
84
|
+
checked: !!y[e],
|
|
85
|
+
onChange: (l) => F((a) => ({ ...a, [e]: l.target.checked }))
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
label: e
|
|
89
|
+
},
|
|
90
|
+
e
|
|
91
|
+
)) })
|
|
92
|
+
] }) : /* @__PURE__ */ n(k, { spacing: 2.5, sx: { pt: 1 }, children: [
|
|
93
|
+
/* @__PURE__ */ n(Q, { fullWidth: !0, size: "small", children: [
|
|
94
|
+
/* @__PURE__ */ t(X, { children: "Resource Type" }),
|
|
95
|
+
/* @__PURE__ */ t(Z, { value: u, label: "Resource Type", onChange: (e) => H(e.target.value), children: r.map((e) => /* @__PURE__ */ t(D, { value: e, children: e }, e)) })
|
|
96
|
+
] }),
|
|
97
|
+
/* @__PURE__ */ t(
|
|
98
|
+
ee,
|
|
99
|
+
{
|
|
100
|
+
label: "FHIR ID *",
|
|
101
|
+
size: "small",
|
|
102
|
+
value: g,
|
|
103
|
+
onChange: (e) => L(e.target.value),
|
|
104
|
+
placeholder: "The FHIR logical id of the resource",
|
|
105
|
+
helperText: "Syncs a single resource by GET /{ResourceType}/{id}"
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
] }),
|
|
109
|
+
!x && /* @__PURE__ */ n(G, { children: [
|
|
110
|
+
/* @__PURE__ */ t(
|
|
111
|
+
C,
|
|
112
|
+
{
|
|
113
|
+
sx: { mt: 2 },
|
|
114
|
+
control: /* @__PURE__ */ t(te, { checked: f, onChange: (e) => O(e.target.checked) }),
|
|
115
|
+
label: /* @__PURE__ */ t(T, { variant: "body2", children: "Process into the system after sync" })
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
h === "types" && S.length > 0 && /* @__PURE__ */ t(j, { sx: { mt: 1 }, children: /* @__PURE__ */ t(k, { direction: "row", spacing: 1, flexWrap: "wrap", useFlexGap: !0, children: S.map((e) => /* @__PURE__ */ t(se, { label: e, size: "small" }, e)) }) })
|
|
119
|
+
] })
|
|
120
|
+
] }),
|
|
121
|
+
/* @__PURE__ */ n(ae, { sx: { px: 3, pb: 2 }, children: [
|
|
122
|
+
!c && /* @__PURE__ */ t(R, { onClick: p, children: "Cancel" }),
|
|
123
|
+
h === "types" ? /* @__PURE__ */ t(R, { variant: "contained", disabled: c, onClick: $, children: c ? "Syncing…" : "Sync Selected" }) : /* @__PURE__ */ t(R, { variant: "contained", disabled: c, onClick: q, children: c ? "Syncing…" : "Sync Resource" })
|
|
124
|
+
] })
|
|
125
|
+
] });
|
|
126
|
+
}
|
|
127
|
+
export {
|
|
128
|
+
ue as S
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=SyncDialog-BRGpHOE4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SyncDialog-BRGpHOE4.js","sources":["../src/views/FhirResource/SyncDialog.jsx"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport {\n Dialog, DialogTitle, DialogContent, DialogActions, Button, Tabs, Tab,\n Box, Stack, FormControlLabel, Checkbox, Switch, Typography, TextField,\n FormControl, InputLabel, Select, MenuItem, Alert, Chip, Divider,\n} from \"@mui/material\";\nimport { showToast } from \"@/common/toaster/toaster\";\nimport {\n syncTypesSequentially, syncSingleResource, reprocessOne,\n} from \"../../services/FhirResource\";\nimport { SyncProgress } from \"./components/FhirUi\";\n\n// Sensible defaults when the server has no discovered capability yet.\nconst DEFAULT_TYPES = [\"ValueSet\", \"CodeSystem\", \"Organization\", \"Location\", \"HealthcareService\"];\n\nfunction SyncDialog({ open, server, onClose, onDone }) {\n const [tab, setTab] = useState(\"types\");\n const [selected, setSelected] = useState({});\n const [singleType, setSingleType] = useState(\"ValueSet\");\n const [fhirId, setFhirId] = useState(\"\");\n const [alsoProcess, setAlsoProcess] = useState(true);\n const [busy, setBusy] = useState(false);\n const [progress, setProgress] = useState(null);\n\n const availableTypes = useMemo(() => {\n const caps = server?.supportedResources ?? [];\n return caps.length ? caps : DEFAULT_TYPES;\n }, [server]);\n\n const checkedTypes = Object.keys(selected).filter((t) => selected[t]);\n const allSelected = availableTypes.length > 0 && availableTypes.every((t) => selected[t]);\n const someSelected = availableTypes.some((t) => selected[t]);\n\n const toggleSelectAll = (checked) => {\n setSelected(Object.fromEntries(availableTypes.map((t) => [t, checked])));\n };\n\n const handleSyncTypes = async () => {\n if (checkedTypes.length === 0) {\n showToast({ type: \"error\", message: \"Select at least one resource type.\" });\n return;\n }\n setBusy(true);\n try {\n const total = await syncTypesSequentially(server.id, checkedTypes, {\n alsoProcess,\n onProgress: setProgress,\n });\n showToast({ type: \"success\", message: `Synced ${total} resource(s).` });\n onDone?.();\n onClose();\n } catch (err) {\n showToast({ type: \"error\", message: err?.response?.data?.message ?? \"Sync failed.\" });\n } finally {\n setBusy(false);\n setProgress(null);\n }\n };\n\n const handleSyncSingle = async () => {\n if (!singleType || !fhirId.trim()) {\n showToast({ type: \"error\", message: \"Resource type and FHIR id are required.\" });\n return;\n }\n setBusy(true);\n try {\n const res = await syncSingleResource(server.id, singleType, fhirId.trim());\n const raw = res?.data;\n if (alsoProcess && raw?.id) await reprocessOne(raw.id);\n showToast({ type: \"success\", message: `Synced ${singleType}/${fhirId.trim()}.` });\n onDone?.();\n onClose();\n } catch (err) {\n showToast({ type: \"error\", message: err?.response?.data?.message ?? \"Sync failed.\" });\n } finally {\n setBusy(false);\n }\n };\n\n const showProgress = busy && tab === \"types\" && progress;\n\n return (\n <Dialog open={open} onClose={busy ? undefined : onClose} maxWidth=\"sm\" fullWidth>\n <DialogTitle>\n Sync from “{server?.name}”\n <Typography variant=\"caption\" color=\"text.secondary\" display=\"block\">\n {server?.baseUrl}\n </Typography>\n </DialogTitle>\n\n {!showProgress && (\n <Tabs value={tab} onChange={(_, v) => setTab(v)} sx={{ px: 3, \"& .MuiTab-root\": { textTransform: \"none\", fontWeight: 700 } }}>\n <Tab value=\"types\" label=\"By Resource Type\" disabled={busy} />\n <Tab value=\"single\" label=\"Single Resource\" disabled={busy} />\n </Tabs>\n )}\n\n <DialogContent dividers>\n {showProgress ? (\n <SyncProgress progress={progress} />\n ) : tab === \"types\" ? (\n <Box>\n {!server?.supportedResources?.length && (\n <Alert severity=\"info\" sx={{ mb: 2 }}>\n Capability not discovered yet — showing common resource types. Use “Refresh Capability” on the\n server to list exactly what this server supports.\n </Alert>\n )}\n <FormControlLabel\n control={\n <Checkbox\n checked={allSelected}\n indeterminate={someSelected && !allSelected}\n onChange={(e) => toggleSelectAll(e.target.checked)}\n />\n }\n label={<Typography variant=\"body2\" sx={{ fontWeight: 700 }}>Select All</Typography>}\n sx={{ mb: 0.5 }}\n />\n <Divider sx={{ mb: 1 }} />\n <Stack>\n {availableTypes.map((t) => (\n <FormControlLabel\n key={t}\n control={\n <Checkbox\n checked={Boolean(selected[t])}\n onChange={(e) => setSelected((s) => ({ ...s, [t]: e.target.checked }))}\n />\n }\n label={t}\n />\n ))}\n </Stack>\n </Box>\n ) : (\n <Stack spacing={2.5} sx={{ pt: 1 }}>\n <FormControl fullWidth size=\"small\">\n <InputLabel>Resource Type</InputLabel>\n <Select value={singleType} label=\"Resource Type\" onChange={(e) => setSingleType(e.target.value)}>\n {availableTypes.map((t) => <MenuItem key={t} value={t}>{t}</MenuItem>)}\n </Select>\n </FormControl>\n <TextField\n label=\"FHIR ID *\"\n size=\"small\"\n value={fhirId}\n onChange={(e) => setFhirId(e.target.value)}\n placeholder=\"The FHIR logical id of the resource\"\n helperText=\"Syncs a single resource by GET /{ResourceType}/{id}\"\n />\n </Stack>\n )}\n\n {!showProgress && (\n <>\n <FormControlLabel\n sx={{ mt: 2 }}\n control={<Switch checked={alsoProcess} onChange={(e) => setAlsoProcess(e.target.checked)} />}\n label={<Typography variant=\"body2\">Process into the system after sync</Typography>}\n />\n {tab === \"types\" && checkedTypes.length > 0 && (\n <Box sx={{ mt: 1 }}>\n <Stack direction=\"row\" spacing={1} flexWrap=\"wrap\" useFlexGap>\n {checkedTypes.map((t) => <Chip key={t} label={t} size=\"small\" />)}\n </Stack>\n </Box>\n )}\n </>\n )}\n </DialogContent>\n\n <DialogActions sx={{ px: 3, pb: 2 }}>\n {/* While a sync is in progress the user can only watch — no cancel. */}\n {!busy && <Button onClick={onClose}>Cancel</Button>}\n {tab === \"types\" ? (\n <Button variant=\"contained\" disabled={busy} onClick={handleSyncTypes}>\n {busy ? \"Syncing…\" : \"Sync Selected\"}\n </Button>\n ) : (\n <Button variant=\"contained\" disabled={busy} onClick={handleSyncSingle}>\n {busy ? \"Syncing…\" : \"Sync Resource\"}\n </Button>\n )}\n </DialogActions>\n </Dialog>\n );\n}\n\nexport default SyncDialog;\n"],"names":["DEFAULT_TYPES","SyncDialog","open","server","onClose","onDone","tab","setTab","useState","selected","setSelected","singleType","setSingleType","fhirId","setFhirId","alsoProcess","setAlsoProcess","busy","setBusy","progress","setProgress","availableTypes","useMemo","caps","checkedTypes","t","allSelected","someSelected","toggleSelectAll","checked","handleSyncTypes","showToast","total","syncTypesSequentially","err","_b","_a","handleSyncSingle","res","syncSingleResource","raw","reprocessOne","showProgress","jsxs","Dialog","DialogTitle","jsx","Typography","Tabs","_","v","Tab","DialogContent","SyncProgress","Box","Alert","FormControlLabel","Checkbox","Divider","Stack","e","s","FormControl","InputLabel","Select","MenuItem","TextField","Fragment","Switch","Chip","DialogActions","Button"],"mappings":";;;;;AAaA,MAAMA,KAAgB,CAAC,YAAY,cAAc,gBAAgB,YAAY,mBAAmB;AAEhG,SAASC,GAAW,EAAE,MAAAC,GAAM,QAAAC,GAAQ,SAAAC,GAAS,QAAAC,KAAU;;AACrD,QAAM,CAACC,GAAKC,CAAM,IAAIC,EAAS,OAAO,GAChC,CAACC,GAAUC,CAAW,IAAIF,EAAS,CAAA,CAAE,GACrC,CAACG,GAAYC,CAAa,IAAIJ,EAAS,UAAU,GACjD,CAACK,GAAQC,CAAS,IAAIN,EAAS,EAAE,GACjC,CAACO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A,UAAA;AAAA,QAAA;AAAA,QAEtEzC,MAAQ,WAAWkB,EAAa,SAAS,KACxC,gBAAAsB,EAACQ,GAAA,EAAI,IAAI,EAAE,IAAI,EAAA,GACb,UAAA,gBAAAR,EAACa,GAAA,EAAM,WAAU,OAAM,SAAS,GAAG,UAAS,QAAO,YAAU,IAC1D,UAAAnC,EAAa,IAAI,CAACC,MAAM,gBAAAqB,EAACuB,IAAA,EAAa,OAAO5C,GAAG,MAAK,QAAA,GAAlBA,CAA0B,CAAE,GAClE,EAAA,CACF;AAAA,MAAA,EAAA,CAEJ;AAAA,IAAA,GAEJ;AAAA,IAEA,gBAAAkB,EAAC2B,MAAc,IAAI,EAAE,IAAI,GAAG,IAAI,KAE7B,UAAA;AAAA,MAAA,CAACrD,KAAQ,gBAAA6B,EAACyB,GAAA,EAAO,SAASnE,GAAS,UAAA,UAAM;AAAA,MACzCE,MAAQ,UACP,gBAAAwC,EAACyB,GAAA,EAAO,SAAQ,aAAY,UAAUtD,GAAM,SAASa,GAClD,UAAAb,IAAO,aAAa,iBACvB,IAEA,gBAAA6B,EAACyB,GAAA,EAAO,SAAQ,aAAY,UAAUtD,GAAM,SAASoB,GAClD,UAAApB,IAAO,aAAa,gBAAA,CACvB;AAAA,IAAA,EAAA,CAEJ;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -5,7 +5,7 @@ import * as s from "yup";
|
|
|
5
5
|
import { yupResolver as g } from "@hookform/resolvers/yup";
|
|
6
6
|
import { FormControl as C, Typography as p, Select as b, MenuItem as a, Box as E, Button as d } from "@mui/material";
|
|
7
7
|
import u from "prop-types";
|
|
8
|
-
import "./ManageEventConfiguration-
|
|
8
|
+
import "./ManageEventConfiguration-CBi2KMB1.js";
|
|
9
9
|
import { useTranslateProvider as T } from "@/common/languageTranslator/TranslationContext";
|
|
10
10
|
import F from "@/common/config/implementationConfig";
|
|
11
11
|
const I = ({ setType: n, onSubmit: y }) => {
|
|
@@ -114,4 +114,4 @@ I.propTypes = {
|
|
|
114
114
|
export {
|
|
115
115
|
I as default
|
|
116
116
|
};
|
|
117
|
-
//# sourceMappingURL=TypeConfiguration-
|
|
117
|
+
//# sourceMappingURL=TypeConfiguration-Bs5WkIa2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeConfiguration-
|
|
1
|
+
{"version":3,"file":"TypeConfiguration-Bs5WkIa2.js","sources":["../src/views/Events/TypeConfiguration.jsx"],"sourcesContent":["import React from \"react\";\nimport { useForm, Controller } from \"react-hook-form\";\nimport * as Yup from \"yup\";\nimport { yupResolver } from \"@hookform/resolvers/yup\";\nimport {\n FormControl,\n Select,\n MenuItem,\n Button,\n Box,\n Typography,\n} from \"@mui/material\";\nimport PropTypes from \"prop-types\";\nimport \"./Styles/ManageEventConfiguration.scss\";\nimport { useTranslateProvider } from \"@/common/languageTranslator/TranslationContext\";\n\nimport implementationConfig from \"@/common/config/implementationConfig\";\n/**\n * A form component for configuring event types.\n * @module TypeConfigurationForm\n * @param {Object} props - The props for the component.\n * @param {Function} props.setType - Function to set the selected type.\n * @param {Function} props.onSubmit - Function to handle form submission.\n * @returns {JSX.Element} The rendered form component.\n */\nconst TypeConfigurationForm = ({ setType, onSubmit }) => {\n const { translate } = useTranslateProvider();\n const validationSchema = Yup.object().shape({\n type: Yup.string().required(\"Type is Required\"),\n });\n\n const {\n control,\n handleSubmit,\n reset,\n formState: { errors },\n } = useForm({\n resolver: yupResolver(validationSchema),\n mode: \"onChange\",\n });\n\n /**\n * @function onFormSubmit\n * Handles form submission.\n * Calls the onSubmit function and resets the form.\n */\n const onFormSubmit = () => {\n onSubmit();\n reset();\n setType(null);\n };\n\n return (\n <div>\n <FormControl\n fullWidth\n error={!!errors.type}\n className=\"mb-2\"\n data-testid=\"typeconfigurationform-formcontrol-type\"\n >\n <Typography variant=\"body2\" className=\"m-1\">\n {translate(\"Type\")}\n <span className=\"text-red-500 ml-1\">*</span>\n </Typography>\n\n <Controller\n name=\"type\"\n control={control}\n defaultValue=\"\"\n render={({ field }) => (\n <Select\n {...field}\n size=\"small\"\n displayEmpty\n onChange={(e) => {\n field.onChange(e.target.value);\n setType(e.target.value);\n }}\n data-testid=\"typeconfigurationform-select-type\"\n >\n <MenuItem value=\"\">\n <Typography variant=\"body2\">{translate(\"Select\")}</Typography>\n </MenuItem>\n <MenuItem className=\"text-[14px] \" value=\"SMS\">\n {translate(\"SMS Notification\")}\n </MenuItem>\n <MenuItem className=\"text-[14px]\" value=\"EMAIL\">\n {translate(\"Email Notification\")}\n </MenuItem>\n <MenuItem className=\"text-[14px]\" value=\"QUERY\">\n {translate(\"Query\")}\n </MenuItem>\n <MenuItem className=\"text-[14px]\" value=\"MOBILE\">\n {translate(\"Mobile Notification\")}\n </MenuItem>\n <MenuItem className=\"text-[14px]\" value=\"EXCEPTION\">\n {translate(\"Exception\")}\n </MenuItem>\n <MenuItem className=\"text-[14px]\" value=\"SYSTEM_FUNCTION\">\n {translate(\"System Function\")}\n </MenuItem>\n <MenuItem className=\"text-[14px]\" value=\"PUSH_NOTIFICATION\">\n {translate(\"Push Notification\")}\n </MenuItem>\n {implementationConfig.events.kafkaSyncEnabled && (\n <MenuItem className=\"text-[14px]\" value=\"KAFKA_SYNC\">\n {translate(\"Kafka Sync\")}\n </MenuItem>\n )}\n </Select>\n )}\n />\n {errors?.type && (\n <p\n className=\"error-helper\"\n data-testid=\"typeconfigurationform-error-helper-type\"\n >\n {errors?.type?.message}\n </p>\n )}\n </FormControl>\n\n <Box className=\"flex items-center gap-1\">\n <Button\n type=\"button\"\n variant=\"outlined\"\n color=\"secondary\"\n onClick={() => {\n setType(null);\n reset();\n setType(null);\n }} // Clear form\n data-testid=\"typeconfigurationform-button-clear\"\n >\n {translate(\"Clear\")}\n </Button>\n <Button\n variant=\"contained\"\n color=\"primary\"\n onClick={handleSubmit(onFormSubmit)} // Handle submission without form reload\n data-testid=\"typeconfigurationform-button-add\"\n >\n {translate(\"Add\")}\n </Button>\n </Box>\n </div>\n );\n};\n\nexport default TypeConfigurationForm;\n\nTypeConfigurationForm.propTypes = {\n setType: PropTypes.any, // or PropTypes.shape({...}) for specific shape\n onSubmit: PropTypes.any, // or PropTypes.shape({...}) for specific shape\n};\n"],"names":["TypeConfigurationForm","setType","onSubmit","translate","useTranslateProvider","validationSchema","Yup","control","handleSubmit","reset","errors","useForm","yupResolver","onFormSubmit","jsxs","FormControl","Typography","jsx","Controller","field","Select","e","MenuItem","implementationConfig","Box","Button","PropTypes"],"mappings":";;;;;;;;;;AAyBA,MAAMA,IAAwB,CAAC,EAAE,SAAAC,GAAS,UAAAC,QAAe;;AACvD,QAAM,EAAE,WAAAC,EAAA,IAAcC,EAAA,GAChBC,IAAmBC,EAAI,OAAA,EAAS,MAAM;AAAA,IAC1C,MAAMA,EAAI,OAAA,EAAS,SAAS,kBAAkB;AAAA,EAAA,CAC/C,GAEK;AAAA,IACJ,SAAAC;AAAA,IACA,cAAAC;AAAA,IACA,OAAAC;AAAA,IACA,WAAW,EAAE,QAAAC,EAAA;AAAA,EAAO,IAClBC,EAAQ;AAAA,IACV,UAAUC,EAAYP,CAAgB;AAAA,IACtC,MAAM;AAAA,EAAA,CACP,GAOKQ,IAAe,MAAM;AACzB,IAAAX,EAAA,GACAO,EAAA,GACAR,EAAQ,IAAI;AAAA,EACd;AAEA,2BACG,OAAA,EACC,UAAA;AAAA,IAAA,gBAAAa;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,WAAS;AAAA,QACT,OAAO,CAAC,CAACL,EAAO;AAAA,QAChB,WAAU;AAAA,QACV,eAAY;AAAA,QAEZ,UAAA;AAAA,UAAA,gBAAAI,EAACE,GAAA,EAAW,SAAQ,SAAQ,WAAU,OACnC,UAAA;AAAA,YAAAb,EAAU,MAAM;AAAA,YACjB,gBAAAc,EAAC,QAAA,EAAK,WAAU,qBAAoB,UAAA,IAAA,CAAC;AAAA,UAAA,GACvC;AAAA,UAEA,gBAAAA;AAAA,YAACC;AAAA,YAAA;AAAA,cACC,MAAK;AA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,YAEJ;AAAA,UAAA;AAAA,WAGHO,KAAA,gBAAAA,EAAQ,SACP,gBAAAO;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,eAAY;AAAA,cAEX,sCAAQ,2BAAM;AAAA,YAAA;AAAA,UAAA;AAAA,QACjB;AAAA,MAAA;AAAA,IAAA;AAAA,IAIJ,gBAAAH,EAACU,GAAA,EAAI,WAAU,2BACb,UAAA;AAAA,MAAA,gBAAAP;AAAA,QAACQ;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAQ;AAAA,UACR,OAAM;AAAA,UACN,SAAS,MAAM;AACb,YAAAxB,EAAQ,IAAI,GACZQ,EAAA,GACAR,EAAQ,IAAI;AAAA,UACd;AAAA,UACA,eAAY;AAAA,UAEX,YAAU,OAAO;AAAA,QAAA;AAAA,MAAA;AAAA,MAEpB,gBAAAgB;AAAA,QAACQ;AAAA,QAAA;AAAA,UACC,SAAQ;AAAA,UACR,OAAM;AAAA,UACN,SAASjB,EAAaK,CAAY;AAAA,UAClC,eAAY;AAAA,UAEX,YAAU,KAAK;AAAA,QAAA;AAAA,MAAA;AAAA,IAClB,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;AAIAb,EAAsB,YAAY;AAAA,EAChC,SAAS0B,EAAU;AAAA;AAAA,EACnB,UAAUA,EAAU;AAAA;AACtB;"}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { generateUUID as d } from "@/utils/UUIDgenerator";
|
|
2
|
+
import { DASHBOARD_COMPONENT_TYPES as s, DASHBOARD_ROOT_DROP_ZONE as A, DASHBOARD_ALLOWED_CHILDREN as F, DASHBOARD_LAYOUT_STYLE_DEFAULTS as p } from "@/utils/FormConstants";
|
|
3
|
+
const N = (e, t = {}) => ({
|
|
4
|
+
id: `node-${d()}`,
|
|
5
|
+
type: e,
|
|
6
|
+
children: [],
|
|
7
|
+
...p[e] || {},
|
|
8
|
+
...t
|
|
9
|
+
}), K = (e, t) => ({
|
|
10
|
+
id: e.id,
|
|
11
|
+
name: e.name,
|
|
12
|
+
type: s.FEATURE,
|
|
13
|
+
instanceId: `${t || "DASHBOARD"}_${e.id}_${d()}`,
|
|
14
|
+
icon: {
|
|
15
|
+
id: `svg-icon-${e.id}`,
|
|
16
|
+
content: e.icon,
|
|
17
|
+
type: "svg"
|
|
18
|
+
}
|
|
19
|
+
}), b = (e, t) => {
|
|
20
|
+
var n, i;
|
|
21
|
+
return !e || e.type !== s.FEATURE_CARD || !t ? e : {
|
|
22
|
+
...e,
|
|
23
|
+
content: {
|
|
24
|
+
...e.content || {},
|
|
25
|
+
title: t.name || "",
|
|
26
|
+
subTitle: ""
|
|
27
|
+
},
|
|
28
|
+
icon: {
|
|
29
|
+
icon: "",
|
|
30
|
+
iconsvg: ((n = t.icon) == null ? void 0 : n.content) || ((i = t.icon) == null ? void 0 : i.svg) || ""
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}, v = (e) => !e || e.type !== s.FEATURE_CARD ? e : {
|
|
34
|
+
...e,
|
|
35
|
+
content: {
|
|
36
|
+
...e.content || {},
|
|
37
|
+
title: "",
|
|
38
|
+
subTitle: ""
|
|
39
|
+
},
|
|
40
|
+
icon: {
|
|
41
|
+
icon: "",
|
|
42
|
+
iconsvg: ""
|
|
43
|
+
}
|
|
44
|
+
}, Z = (e, t, n = null) => {
|
|
45
|
+
var r;
|
|
46
|
+
return (F[e] || []).includes(t) ? e === s.FEATURE_CARD && t === s.FEATURE && ((r = n == null ? void 0 : n.children) != null && r.some(
|
|
47
|
+
(o) => o.type === s.FEATURE
|
|
48
|
+
)) ? "FEATURE_CARD can contain only one FEATURE." : e === s.ROW && t === s.FEATURE_CARD && ((n == null ? void 0 : n.children) || []).filter(
|
|
49
|
+
(o) => o.type === s.FEATURE_CARD
|
|
50
|
+
).length >= 4 ? "ROW can contain a maximum of 4 FEATURE_CARD components." : e === s.COLUMN && t === s.COLUMN && ((n == null ? void 0 : n.children) || []).filter(
|
|
51
|
+
(o) => o.type === s.COLUMN
|
|
52
|
+
).length >= 4 ? "COLUMN can contain a maximum of 4 COLUMN components." : "" : t === s.SECTION ? "SECTION can only be dropped directly inside Home." : t === s.DIVIDER ? "DIVIDER can only be dropped inside Home, SECTION, ROW, or COLUMN." : t === s.CAROUSEL ? "CAROUSEL can only be dropped directly inside Home." : t === s.SEARCH_BAR ? "SEARCH_BAR can only be dropped directly inside Home." : t === s.FEATURE_CARD ? "FEATURE_CARD can only be dropped inside ROW or COLUMN." : t === s.ROW ? "ROW can only be dropped inside SECTION or COLUMN." : t === s.COLUMN ? "COLUMN can only be dropped inside SECTION or ROW." : t === s.FEATURE ? "FEATURE can only be dropped inside SECTION, COLUMN, or FEATURE_CARD." : t === s.TEXT ? "TEXT can only be dropped inside Home, SECTION, ROW, or COLUMN." : `${t} cannot be dropped inside ${e}.`;
|
|
53
|
+
}, R = (e, t) => {
|
|
54
|
+
for (const n of e || []) {
|
|
55
|
+
if (n.id === t || n.instanceId === t) return n;
|
|
56
|
+
const i = R(n.children, t);
|
|
57
|
+
if (i) return i;
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}, L = (e, t, n = { id: A, type: "HOME", node: null }) => {
|
|
61
|
+
for (const i of e || []) {
|
|
62
|
+
if (i.id === t || i.instanceId === t) return n;
|
|
63
|
+
const r = L(i.children || [], t, {
|
|
64
|
+
id: i.instanceId || i.id,
|
|
65
|
+
type: i.type,
|
|
66
|
+
node: i
|
|
67
|
+
});
|
|
68
|
+
if (r) return r;
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}, m = (e, t) => (e || []).map((n) => {
|
|
72
|
+
const i = t(n);
|
|
73
|
+
return i.children ? {
|
|
74
|
+
...i,
|
|
75
|
+
children: m(i.children, t)
|
|
76
|
+
} : i;
|
|
77
|
+
}), _ = (e, t, n) => t === A ? [...e || [], n] : m(e, (i) => {
|
|
78
|
+
if (i.id === t || i.instanceId === t) {
|
|
79
|
+
let r = {
|
|
80
|
+
...i,
|
|
81
|
+
children: [...i.children || [], n]
|
|
82
|
+
};
|
|
83
|
+
return r.type === s.FEATURE_CARD && n.type === s.FEATURE && (r = b(r, n)), r;
|
|
84
|
+
}
|
|
85
|
+
return i;
|
|
86
|
+
}), I = (e, t) => (e || []).filter((n) => n.id !== t && n.instanceId !== t).map((n) => {
|
|
87
|
+
const i = (n.children || []).some(
|
|
88
|
+
(o) => o.id === t || o.instanceId === t
|
|
89
|
+
);
|
|
90
|
+
let r = n;
|
|
91
|
+
return n.type === s.FEATURE_CARD && i && (r = v(n)), {
|
|
92
|
+
...r,
|
|
93
|
+
children: I(r.children, t)
|
|
94
|
+
};
|
|
95
|
+
}), q = (e, t, n) => m(
|
|
96
|
+
e,
|
|
97
|
+
(i) => i.id === t || i.instanceId === t ? n(i) : i
|
|
98
|
+
), M = (e) => (e == null ? void 0 : e.instanceId) || (e == null ? void 0 : e.id), C = (e, t) => {
|
|
99
|
+
let n = null;
|
|
100
|
+
return { nodes: (e || []).reduce((r, o) => {
|
|
101
|
+
if (o.id === t || o.instanceId === t)
|
|
102
|
+
return n = o, r;
|
|
103
|
+
const l = C(o.children || [], t);
|
|
104
|
+
return l.removedNode ? (n = l.removedNode, r.push({ ...o, children: l.nodes }), r) : (r.push(o), r);
|
|
105
|
+
}, []), removedNode: n };
|
|
106
|
+
}, f = (e, t, n) => {
|
|
107
|
+
let i = !1;
|
|
108
|
+
return { nodes: (e || []).reduce((o, l) => {
|
|
109
|
+
if (l.id === t || l.instanceId === t)
|
|
110
|
+
return o.push(n, l), i = !0, o;
|
|
111
|
+
const a = f(
|
|
112
|
+
l.children || [],
|
|
113
|
+
t,
|
|
114
|
+
n
|
|
115
|
+
);
|
|
116
|
+
return a.didInsert ? (i = !0, o.push({ ...l, children: a.nodes }), o) : (o.push(l), o);
|
|
117
|
+
}, []), didInsert: i };
|
|
118
|
+
}, O = (e, t) => e ? e.id === t || e.instanceId === t ? !0 : (e.children || []).some((n) => O(n, t)) : !1, B = (e, t) => {
|
|
119
|
+
const n = M(t);
|
|
120
|
+
return m(
|
|
121
|
+
e,
|
|
122
|
+
(i) => i.id === n || i.instanceId === n ? t : i
|
|
123
|
+
);
|
|
124
|
+
}, J = (e, t, n) => {
|
|
125
|
+
const i = f(e, t, n);
|
|
126
|
+
return i.didInsert ? i.nodes : e;
|
|
127
|
+
}, Q = (e, t, n) => {
|
|
128
|
+
const { nodes: i, removedNode: r } = C(
|
|
129
|
+
e,
|
|
130
|
+
t
|
|
131
|
+
);
|
|
132
|
+
return !r || n !== A && O(r, n) ? e : _(i, n, r);
|
|
133
|
+
}, tt = (e, t, n) => {
|
|
134
|
+
if (t === n) return e;
|
|
135
|
+
const i = R(e, t), r = R(e, n);
|
|
136
|
+
if (!i || !r || O(i, n))
|
|
137
|
+
return e;
|
|
138
|
+
const { nodes: o, removedNode: l } = C(
|
|
139
|
+
e,
|
|
140
|
+
t
|
|
141
|
+
);
|
|
142
|
+
if (!l) return e;
|
|
143
|
+
const a = f(o, n, l);
|
|
144
|
+
return a.didInsert ? a.nodes : B(o, i);
|
|
145
|
+
}, H = (e, t) => Array.isArray(e) ? e.map((n) => {
|
|
146
|
+
if (n.type === s.SECTION && Array.isArray(n.features)) {
|
|
147
|
+
const r = `node-${d()}`;
|
|
148
|
+
return N(s.SECTION, {
|
|
149
|
+
id: r,
|
|
150
|
+
title: n.title || "Section",
|
|
151
|
+
header: {
|
|
152
|
+
...p[s.SECTION].header,
|
|
153
|
+
title: n.title || "Section"
|
|
154
|
+
},
|
|
155
|
+
children: n.features.map((o) => t(o, r)).filter(Boolean)
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
if (n.type === s.FEATURE)
|
|
159
|
+
return t(n, "DASHBOARD");
|
|
160
|
+
if (!n.type) return null;
|
|
161
|
+
const i = H(
|
|
162
|
+
n.children || [],
|
|
163
|
+
t
|
|
164
|
+
);
|
|
165
|
+
return N(n.type, {
|
|
166
|
+
...n,
|
|
167
|
+
id: n.id || `node-${d()}`,
|
|
168
|
+
children: i
|
|
169
|
+
});
|
|
170
|
+
}).filter(Boolean) : [], W = (e) => ({
|
|
171
|
+
type: s.FEATURE,
|
|
172
|
+
id: e.id,
|
|
173
|
+
menuName: e.name
|
|
174
|
+
}), P = (e) => (e.children || []).find(
|
|
175
|
+
(t) => t.type === s.FEATURE
|
|
176
|
+
), $ = (e, t) => String(t || "").trim() || (e == null ? void 0 : e.name) || (e == null ? void 0 : e.menuName) || "", k = (e, t) => String(t || "").trim() || (e == null ? void 0 : e.subTitle) || (e == null ? void 0 : e.subtitle) || "", x = (e, t) => {
|
|
177
|
+
var o, l, a, u;
|
|
178
|
+
const n = ((o = e.icon) == null ? void 0 : o.icon) || ((l = e.icon) == null ? void 0 : l.iconName) || "", i = ((a = e.icon) == null ? void 0 : a.iconsvg) || ((u = e.icon) == null ? void 0 : u.svg) || "";
|
|
179
|
+
if (n) return { icon: n, iconsvg: "" };
|
|
180
|
+
if (i) return { icon: "", iconsvg: i };
|
|
181
|
+
const r = t == null ? void 0 : t.icon;
|
|
182
|
+
if (typeof r == "string") {
|
|
183
|
+
const c = r.trim();
|
|
184
|
+
return c.startsWith("<svg") ? { icon: "", iconsvg: c } : { icon: c, iconsvg: "" };
|
|
185
|
+
}
|
|
186
|
+
return r != null && r.content || r != null && r.iconsvg || r != null && r.svg ? {
|
|
187
|
+
icon: "",
|
|
188
|
+
iconsvg: r.content || r.iconsvg || r.svg
|
|
189
|
+
} : {
|
|
190
|
+
icon: (r == null ? void 0 : r.icon) || (r == null ? void 0 : r.iconName) || "",
|
|
191
|
+
iconsvg: ""
|
|
192
|
+
};
|
|
193
|
+
}, V = (e) => {
|
|
194
|
+
const t = typeof e == "object" && e !== null ? e.action : e;
|
|
195
|
+
if (t === "" || t === null || t === void 0) return "";
|
|
196
|
+
const n = Number(t);
|
|
197
|
+
return Number.isNaN(n) ? t : n;
|
|
198
|
+
}, D = (e = {}) => {
|
|
199
|
+
const t = { ...e };
|
|
200
|
+
return t.type === "GRADIENT" ? (delete t.solidLightModeColor, delete t.solidDarkModeColor, delete t.solidColor) : (delete t.gradientStartColor, delete t.gradientEndColor, delete t.gradientType, delete t.direction, delete t.gradientStartOpacity, delete t.gradientEndOpacity, delete t.solidColor), t;
|
|
201
|
+
}, z = (e) => (e || []).map((t) => {
|
|
202
|
+
var T, g, y, h, U;
|
|
203
|
+
if (t.type === s.FEATURE)
|
|
204
|
+
return W(t);
|
|
205
|
+
const { id: n, instanceId: i, icon: r, name: o, features: l, title: a, ...u } = t, c = {
|
|
206
|
+
...u,
|
|
207
|
+
children: z(t.children || [])
|
|
208
|
+
};
|
|
209
|
+
if (t.type === s.SECTION && (c.background = D(
|
|
210
|
+
u.background
|
|
211
|
+
), (T = c.header) != null && T.color)) {
|
|
212
|
+
const { color: E, ...S } = c.header;
|
|
213
|
+
c.header = S;
|
|
214
|
+
}
|
|
215
|
+
if (t.type === s.FEATURE_CARD) {
|
|
216
|
+
const E = P(t);
|
|
217
|
+
c.content = {
|
|
218
|
+
...u.content || {},
|
|
219
|
+
title: $(
|
|
220
|
+
E,
|
|
221
|
+
((g = u.content) == null ? void 0 : g.title) || ((y = u.content) == null ? void 0 : y.customTitle)
|
|
222
|
+
),
|
|
223
|
+
subTitle: k(
|
|
224
|
+
E,
|
|
225
|
+
((h = u.content) == null ? void 0 : h.subTitle) || ((U = u.content) == null ? void 0 : U.customSubtitle)
|
|
226
|
+
)
|
|
227
|
+
}, c.icon = x(t, E), c.background = D(
|
|
228
|
+
u.background
|
|
229
|
+
), c.style && delete c.style.flex, delete c.content.customTitle, delete c.content.customSubtitle, delete c.navigation;
|
|
230
|
+
}
|
|
231
|
+
return t.type === s.CAROUSEL && (delete c.children, delete c.navigation, c.images = (t.images || []).map((E) => ({
|
|
232
|
+
...E,
|
|
233
|
+
navigation: V(E.navigation)
|
|
234
|
+
}))), t.type === s.TEXT && delete c.children, [
|
|
235
|
+
s.SEARCH_BAR,
|
|
236
|
+
s.DIVIDER
|
|
237
|
+
].includes(t.type) && delete c.children, t.type === s.DIVIDER && c.style && (delete c.style.color, delete c.style.marginVertical), [
|
|
238
|
+
s.ROW,
|
|
239
|
+
s.COLUMN
|
|
240
|
+
].includes(t.type) && delete c.style, c;
|
|
241
|
+
}), w = (e) => (e || []).flatMap((t) => t.type === s.FEATURE ? t.menuName || t.name ? [t.menuName || t.name] : [] : w(t.children || t.features || [])), Y = /* @__PURE__ */ new Set([
|
|
242
|
+
s.SECTION,
|
|
243
|
+
s.ROW,
|
|
244
|
+
s.COLUMN
|
|
245
|
+
]), X = (e) => (e || []).some((t) => Y.has(t.type) && !(t.children || []).length ? !0 : t.type === s.FEATURE_CARD ? !(t.children || []).some(
|
|
246
|
+
(n) => n.type === s.FEATURE
|
|
247
|
+
) : t.type === s.CAROUSEL ? !(t.images || []).length : X(t.children || []));
|
|
248
|
+
export {
|
|
249
|
+
L as a,
|
|
250
|
+
Q as b,
|
|
251
|
+
w as c,
|
|
252
|
+
J as d,
|
|
253
|
+
K as e,
|
|
254
|
+
R as f,
|
|
255
|
+
Z as g,
|
|
256
|
+
H as h,
|
|
257
|
+
N as i,
|
|
258
|
+
_ as j,
|
|
259
|
+
X as k,
|
|
260
|
+
tt as m,
|
|
261
|
+
I as r,
|
|
262
|
+
z as s,
|
|
263
|
+
q as u
|
|
264
|
+
};
|
|
265
|
+
//# sourceMappingURL=dashboardLayoutUtils-Bt5HA96J.js.map
|