@hybridcore/ui 1.5.49 → 1.5.51

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.
@@ -5,7 +5,7 @@ import { DataGrid as fe } from "@mui/x-data-grid";
5
5
  import { useState as G, useEffect as ue } from "react";
6
6
  import h from "lodash";
7
7
  import { d as ye } from "../../ol-lGwSyEIV.js";
8
- import { V as he } from "../../index-OtGK6phq.js";
8
+ import { V as he } from "../../index-CCkupzf4.js";
9
9
  import { RangeSelector as me } from "../range-selector/index.js";
10
10
  const $e = ({
11
11
  open: F,
@@ -0,0 +1,491 @@
1
+ import { jsx as n, jsxs as u, Fragment as _ } from "react/jsx-runtime";
2
+ import { KeyboardArrowUp as R, KeyboardArrowDown as U, Add as J, LockOutlined as Q } from "@mui/icons-material";
3
+ import { Box as M, Typography as s, FormControl as X, FormLabel as Z, FormGroup as z, FormControlLabel as P, Checkbox as y, Button as Y, Chip as O, Dialog as p, DialogTitle as ee, DialogContent as ne, DialogActions as ae, InputAdornment as de, Tooltip as le } from "@mui/material";
4
+ import H from "dayjs";
5
+ import x from "lodash";
6
+ import { useState as E } from "react";
7
+ import ce from "./hooks/useToggle.js";
8
+ import { ConditionalWrapper as o } from "./components/conditional-wrapper/index.js";
9
+ import { DateTimePicker as te } from "./components/date-time-picker/index.js";
10
+ import { GeometryPicker as ie } from "./components/geometry-picker/index.js";
11
+ import { PhoneInput as me } from "./components/phone-input/index.js";
12
+ import W from "./components/instance-form/components/TopLabelWrapper.js";
13
+ import { B as h } from "./Box-SSMZuKnS.js";
14
+ import { T as G } from "./TextField-CdKnj6de.js";
15
+ import { F as he } from "./FormControlLabel-BNT5EI0b.js";
16
+ import { C as ue } from "./Checkbox-B0P8LhCl.js";
17
+ import { F as re, I as oe } from "./InputLabel-ClDXuWBr.js";
18
+ import { S as se } from "./Select-DuyWoyoF.js";
19
+ import { M as Ie } from "./MenuItem-Lcjh1XlV.js";
20
+ import { Container as fe, Values as ge, MiniButton as we } from "./components/instance-form/components/composite-list/styled.js";
21
+ function Ce({
22
+ property: r,
23
+ mapboxAccessToken: e,
24
+ value: l,
25
+ variant: w = "outlined",
26
+ labelPosition: c = "default",
27
+ size: I = "medium",
28
+ onChange: T
29
+ }) {
30
+ var b, k, A;
31
+ const a = ce(!1), [f, v] = E(), [V, S] = E(!1), F = 10, B = (t) => {
32
+ v(x.get(t, r.propertyId));
33
+ }, N = () => {
34
+ T([...l || [], f]), v(""), a.action.close();
35
+ }, $ = (t) => () => {
36
+ if (l) {
37
+ const i = [...l];
38
+ i.splice(t, 1), T(i);
39
+ }
40
+ }, q = (t) => {
41
+ const { value: i, checked: C } = t.target;
42
+ let g = x.isArray(l) ? l : [];
43
+ C ? g.push(i) : g = g.filter((d) => d !== i), T(g);
44
+ };
45
+ if (((k = (b = r.dataTypeInfo) == null ? void 0 : b.innerType) == null ? void 0 : k.type) === "enum") {
46
+ const { enumValues: t } = r.dataTypeInfo.innerType;
47
+ return /* @__PURE__ */ n(
48
+ o,
49
+ {
50
+ condition: c === "left",
51
+ wrapper: (i) => /* @__PURE__ */ u(M, { display: "flex", alignItems: "center", children: [
52
+ /* @__PURE__ */ n(s, { width: "32%", children: r.name }),
53
+ /* @__PURE__ */ n(M, { width: "68%", children: i })
54
+ ] }),
55
+ children: /* @__PURE__ */ u(_, { children: [
56
+ /* @__PURE__ */ u(X, { fullWidth: !0, component: "fieldset", variant: w, children: [
57
+ c === "default" && /* @__PURE__ */ n(Z, { component: "legend", sx: { mb: 1 }, children: r.name }),
58
+ /* @__PURE__ */ n(z, { children: t && t.length > 0 ? t.slice(0, V ? 9999 : F).map((i, C) => /* @__PURE__ */ n(
59
+ P,
60
+ {
61
+ label: i,
62
+ control: /* @__PURE__ */ n(
63
+ y,
64
+ {
65
+ name: r.propertyId,
66
+ value: i,
67
+ size: "small",
68
+ checked: x.isArray(l) ? l.includes(i) : !1,
69
+ onChange: q
70
+ }
71
+ ),
72
+ componentsProps: {
73
+ typography: {
74
+ variant: "body2"
75
+ }
76
+ }
77
+ },
78
+ C
79
+ )) : /* @__PURE__ */ n(s, { variant: "caption", mb: 1, children: "No enum values!" }) })
80
+ ] }),
81
+ x.isArray(t) && t.length > F && /* @__PURE__ */ u(
82
+ Y,
83
+ {
84
+ size: "small",
85
+ sx: { p: 0, textTransform: "none" },
86
+ endIcon: V ? /* @__PURE__ */ n(R, {}) : /* @__PURE__ */ n(U, {}),
87
+ onClick: () => S((i) => !i),
88
+ children: [
89
+ "Show ",
90
+ V ? "Less" : "More"
91
+ ]
92
+ }
93
+ )
94
+ ] })
95
+ }
96
+ );
97
+ }
98
+ return /* @__PURE__ */ u(_, { children: [
99
+ /* @__PURE__ */ n(
100
+ o,
101
+ {
102
+ condition: c === "left",
103
+ wrapper: (t) => /* @__PURE__ */ u(M, { display: "flex", alignItems: "center", children: [
104
+ /* @__PURE__ */ n(s, { width: "32%", children: r.name }),
105
+ /* @__PURE__ */ n(M, { width: "68%", children: t })
106
+ ] }),
107
+ children: /* @__PURE__ */ u(fe, { variant: w, children: [
108
+ c === "default" && /* @__PURE__ */ n(s, { children: r.name }),
109
+ /* @__PURE__ */ n(ge, { children: x.isArray(l) && l.map((t, i) => {
110
+ var C, g;
111
+ return /* @__PURE__ */ n(
112
+ O,
113
+ {
114
+ label: ((g = (C = r.dataTypeInfo) == null ? void 0 : C.innerType) == null ? void 0 : g.type) === "date" ? H(t).format("DD/MM/YYYY HH:mm:ss") : t,
115
+ size: I,
116
+ onDelete: $(i)
117
+ },
118
+ i
119
+ );
120
+ }) }),
121
+ /* @__PURE__ */ n(
122
+ we,
123
+ {
124
+ startIcon: /* @__PURE__ */ n(J, {}),
125
+ variant: "text",
126
+ onClick: a.action.open,
127
+ children: "Add"
128
+ }
129
+ )
130
+ ] })
131
+ }
132
+ ),
133
+ /* @__PURE__ */ u(
134
+ p,
135
+ {
136
+ open: a.state.isOpen,
137
+ onClose: a.action.close,
138
+ maxWidth: "sm",
139
+ fullWidth: !0,
140
+ children: [
141
+ /* @__PURE__ */ n(ee, { children: "Add List Value" }),
142
+ /* @__PURE__ */ n(ne, { children: (A = r.dataTypeInfo) != null && A.innerType ? /* @__PURE__ */ n(
143
+ xe,
144
+ {
145
+ mapboxAccessToken: e,
146
+ property: {
147
+ ...r,
148
+ name: "Value",
149
+ type: r.dataTypeInfo.innerType.type
150
+ },
151
+ value: f,
152
+ onChange: B
153
+ }
154
+ ) : null }),
155
+ /* @__PURE__ */ u(ae, { children: [
156
+ /* @__PURE__ */ n(
157
+ Y,
158
+ {
159
+ variant: "contained",
160
+ color: "inherit",
161
+ onClick: a.action.close,
162
+ children: "Cancel"
163
+ }
164
+ ),
165
+ /* @__PURE__ */ n(Y, { variant: "contained", color: "primary", onClick: N, children: "Ok" })
166
+ ] })
167
+ ]
168
+ }
169
+ )
170
+ ] });
171
+ }
172
+ function xe({
173
+ mapboxAccessToken: r,
174
+ property: e,
175
+ value: l,
176
+ variant: w = "standard",
177
+ labelPosition: c = "default",
178
+ size: I = "medium",
179
+ defaultExtent: T,
180
+ fieldOptions: a,
181
+ // keyAuth,
182
+ onChange: f
183
+ }) {
184
+ var q, b, k, A, t, i, C, g;
185
+ const v = (d) => {
186
+ const D = d.target.value.split(",").map((j) => j.trimStart());
187
+ f({
188
+ [e.propertyId]: D
189
+ });
190
+ }, V = (d) => {
191
+ const { name: m, type: D, checked: j, value: K } = d.target;
192
+ let L = K;
193
+ e.type === "double" && (L = L.replace(",", "."), L = L.replace(/[^\d.-]+/g, "")), f({
194
+ [m]: D === "checkbox" ? j : L
195
+ });
196
+ }, S = (d) => {
197
+ f({
198
+ [e.propertyId]: d
199
+ });
200
+ }, F = (d) => {
201
+ f({
202
+ [e.propertyId]: d.target.value
203
+ });
204
+ }, B = (d) => (m) => {
205
+ f({
206
+ [d]: m
207
+ });
208
+ }, N = (d) => (m) => {
209
+ f({
210
+ [d]: m
211
+ });
212
+ }, $ = (d) => (m) => {
213
+ f({
214
+ [d]: m
215
+ });
216
+ };
217
+ if (a && a[e.propertyId] && a[e.propertyId].component)
218
+ return a[e.propertyId].component;
219
+ if ([
220
+ "string",
221
+ "integer",
222
+ "double",
223
+ "text",
224
+ "long",
225
+ "byte",
226
+ "bank-account"
227
+ ].includes(e.type))
228
+ return /* @__PURE__ */ n(
229
+ o,
230
+ {
231
+ condition: c === "left",
232
+ wrapper: (d) => /* @__PURE__ */ u(h, { display: "flex", alignItems: "center", children: [
233
+ /* @__PURE__ */ n(s, { width: "32%", children: e.name }),
234
+ /* @__PURE__ */ n(h, { width: "68%", children: d })
235
+ ] }),
236
+ children: /* @__PURE__ */ n(
237
+ o,
238
+ {
239
+ condition: c === "top",
240
+ wrapper: W(
241
+ e == null ? void 0 : e.name,
242
+ e == null ? void 0 : e.required,
243
+ (q = a == null ? void 0 : a[e == null ? void 0 : e.propertyId]) == null ? void 0 : q.description
244
+ ),
245
+ children: /* @__PURE__ */ n(
246
+ G,
247
+ {
248
+ label: c === "default" ? e.name : void 0,
249
+ placeholder: ((b = a == null ? void 0 : a[e.propertyId]) == null ? void 0 : b.placeholder) ?? "",
250
+ name: e.propertyId,
251
+ required: e.required,
252
+ value: l ?? e.defaultValue ?? "",
253
+ defaultValue: l,
254
+ onChange: V,
255
+ variant: w,
256
+ type: "text",
257
+ multiline: e.type === "text",
258
+ disabled: !e.editable,
259
+ fullWidth: !0,
260
+ InputProps: {
261
+ size: I,
262
+ ...a && a[e.propertyId] && {
263
+ tabIndex: a[e.propertyId].order
264
+ },
265
+ ...e.privacyPreservationMethod === "ENCRYPTION" ? {
266
+ endAdornment: /* @__PURE__ */ n(de, { position: "end", children: /* @__PURE__ */ n(le, { title: "Encrypted Field", children: /* @__PURE__ */ n(Q, {}) }) })
267
+ } : {}
268
+ }
269
+ }
270
+ )
271
+ }
272
+ )
273
+ }
274
+ );
275
+ if (e.type === "date") {
276
+ const d = l !== void 0 ? H(l).format() : l;
277
+ return /* @__PURE__ */ n(
278
+ o,
279
+ {
280
+ condition: c === "left",
281
+ wrapper: (m) => /* @__PURE__ */ u(h, { display: "flex", alignItems: "center", children: [
282
+ /* @__PURE__ */ n(s, { width: "32%", children: e.name }),
283
+ /* @__PURE__ */ n(h, { width: "68%", children: m })
284
+ ] }),
285
+ children: /* @__PURE__ */ n(
286
+ o,
287
+ {
288
+ condition: c === "top",
289
+ wrapper: W(
290
+ e.name,
291
+ e == null ? void 0 : e.required,
292
+ (k = a == null ? void 0 : a[e == null ? void 0 : e.propertyId]) == null ? void 0 : k.description
293
+ ),
294
+ children: /* @__PURE__ */ n(
295
+ te,
296
+ {
297
+ label: c === "default" ? e.name : void 0,
298
+ value: d,
299
+ variant: w,
300
+ size: I,
301
+ name: e.propertyId,
302
+ onChange: S,
303
+ ...a && a[e.propertyId] && {
304
+ minDate: a[e.propertyId].minDate
305
+ }
306
+ }
307
+ )
308
+ }
309
+ )
310
+ }
311
+ );
312
+ }
313
+ if (e.type === "list") {
314
+ let d = "";
315
+ return e.defaultValue && (d = x.isArray(e.defaultValue) ? l.join(", ") : e.defaultValue), l && (d = x.isArray(l) ? l.join(",") : l), /* @__PURE__ */ n(
316
+ o,
317
+ {
318
+ condition: c === "left",
319
+ wrapper: (m) => /* @__PURE__ */ u(h, { display: "flex", alignItems: "center", children: [
320
+ /* @__PURE__ */ n(s, { width: "32%", children: e.name }),
321
+ /* @__PURE__ */ n(h, { width: "68%", children: m })
322
+ ] }),
323
+ children: /* @__PURE__ */ n(
324
+ o,
325
+ {
326
+ condition: c === "top",
327
+ wrapper: W(
328
+ e.name,
329
+ e == null ? void 0 : e.required,
330
+ (A = a == null ? void 0 : a[e == null ? void 0 : e.propertyId]) == null ? void 0 : A.description
331
+ ),
332
+ children: /* @__PURE__ */ n(
333
+ G,
334
+ {
335
+ label: c === "default" ? e.name : void 0,
336
+ name: e.propertyId,
337
+ value: d,
338
+ onChange: v,
339
+ variant: w,
340
+ disabled: !e.editable,
341
+ required: e.required,
342
+ fullWidth: !0,
343
+ helperText: I === "small" ? null : "Add list values with the comma (,) separated string",
344
+ InputProps: {
345
+ size: I,
346
+ placeholder: I === "small" ? "Add list values with the comma (,) separated string" : "",
347
+ ...a && a[e.propertyId] && {
348
+ tabIndex: a[e.propertyId].order
349
+ }
350
+ }
351
+ }
352
+ )
353
+ }
354
+ )
355
+ }
356
+ );
357
+ }
358
+ if (e.type === "boolean")
359
+ return /* @__PURE__ */ n(
360
+ o,
361
+ {
362
+ condition: c === "left",
363
+ wrapper: (d) => /* @__PURE__ */ u(h, { display: "flex", alignItems: "center", children: [
364
+ /* @__PURE__ */ n(s, { width: "32%", children: e.name }),
365
+ /* @__PURE__ */ n(h, { width: "68%", children: d })
366
+ ] }),
367
+ children: /* @__PURE__ */ n(
368
+ he,
369
+ {
370
+ control: /* @__PURE__ */ n(
371
+ ue,
372
+ {
373
+ name: e.propertyId,
374
+ checked: !!(l ?? e.defaultValue ?? !1),
375
+ onChange: V,
376
+ size: I
377
+ }
378
+ ),
379
+ label: c === "default" ? e.name : void 0
380
+ }
381
+ )
382
+ }
383
+ );
384
+ if (e.type === "enum") {
385
+ let d = [];
386
+ return (t = e.dataTypeInfo) != null && t.enumValues && (d = e.dataTypeInfo.enumValues), (C = (i = e.dataTypeInfo) == null ? void 0 : i.innerType) != null && C.enumValues && (d = e.dataTypeInfo.innerType.enumValues), /* @__PURE__ */ n(
387
+ o,
388
+ {
389
+ condition: c === "left",
390
+ wrapper: (m) => /* @__PURE__ */ u(h, { display: "flex", alignItems: "center", children: [
391
+ /* @__PURE__ */ n(s, { width: "32%", children: e.name }),
392
+ /* @__PURE__ */ n(h, { width: "68%", children: m })
393
+ ] }),
394
+ children: /* @__PURE__ */ n(
395
+ o,
396
+ {
397
+ condition: c === "top",
398
+ wrapper: W(
399
+ e.name,
400
+ e == null ? void 0 : e.required,
401
+ (g = a == null ? void 0 : a[e == null ? void 0 : e.propertyId]) == null ? void 0 : g.description
402
+ ),
403
+ children: /* @__PURE__ */ u(
404
+ re,
405
+ {
406
+ fullWidth: !0,
407
+ variant: w,
408
+ size: I,
409
+ required: e.required,
410
+ children: [
411
+ c === "default" && /* @__PURE__ */ n(oe, { id: `${e.propertyId}-label`, children: e.name }),
412
+ /* @__PURE__ */ n(
413
+ se,
414
+ {
415
+ label: c === "default" ? e.name : void 0,
416
+ name: e.name,
417
+ labelId: `${e.propertyId}-label`,
418
+ id: e.propertyId,
419
+ value: l ?? "",
420
+ onChange: F,
421
+ inputProps: {
422
+ ...a && a[e.propertyId] && {
423
+ tabIndex: a[e.propertyId].order
424
+ }
425
+ },
426
+ children: d.map((m, D) => /* @__PURE__ */ n(Ie, { value: m, children: m }, D))
427
+ }
428
+ )
429
+ ]
430
+ }
431
+ )
432
+ }
433
+ )
434
+ }
435
+ );
436
+ }
437
+ return e.type === "geometry" ? /* @__PURE__ */ n(
438
+ o,
439
+ {
440
+ condition: c === "left",
441
+ wrapper: (d) => /* @__PURE__ */ u(h, { display: "flex", alignItems: "center", children: [
442
+ /* @__PURE__ */ n(s, { width: "32%", children: e.name }),
443
+ /* @__PURE__ */ n(h, { width: "68%", children: d })
444
+ ] }),
445
+ children: /* @__PURE__ */ n(h, { sx: { width: "100%" }, children: /* @__PURE__ */ n(
446
+ ie,
447
+ {
448
+ mapboxAccessToken: r,
449
+ label: c === "default" ? e.name : void 0,
450
+ value: l ?? e.defaultValue ?? "",
451
+ defaultExtent: T,
452
+ variant: w,
453
+ onChange: B(e.propertyId)
454
+ }
455
+ ) })
456
+ }
457
+ ) : e.type === "phone-number" ? /* @__PURE__ */ n(
458
+ o,
459
+ {
460
+ condition: c === "left",
461
+ wrapper: (d) => /* @__PURE__ */ u(h, { display: "flex", alignItems: "center", children: [
462
+ /* @__PURE__ */ n(s, { width: "32%", children: e.name }),
463
+ /* @__PURE__ */ n(h, { width: "68%", children: d })
464
+ ] }),
465
+ children: /* @__PURE__ */ n(h, { sx: { width: "100%" }, children: /* @__PURE__ */ n(
466
+ me,
467
+ {
468
+ label: c === "default" ? e.name : void 0,
469
+ placeholder: "Enter phone number",
470
+ value: l ?? e.defaultValue ?? "",
471
+ onChange: N(e.propertyId)
472
+ }
473
+ ) })
474
+ }
475
+ ) : e.type === "composite-list" ? /* @__PURE__ */ n(h, { sx: { width: "100%" }, children: /* @__PURE__ */ n(
476
+ Ce,
477
+ {
478
+ property: e,
479
+ value: l ?? e.defaultValue ?? "",
480
+ variant: w,
481
+ labelPosition: c,
482
+ size: I,
483
+ mapboxAccessToken: r,
484
+ onChange: $(e.propertyId)
485
+ }
486
+ ) }) : /* @__PURE__ */ n(_, {});
487
+ }
488
+ export {
489
+ Ce as C,
490
+ xe as V
491
+ };
package/dist/main.d.ts CHANGED
@@ -205,7 +205,7 @@ declare interface DisseminationListProps {
205
205
  *
206
206
  */
207
207
  variant?: "standard" | "outlined" | "filled";
208
- labelPosition?: "default" | "left";
208
+ labelPosition?: "default" | "left" | "top";
209
209
  /**
210
210
  *
211
211
  */
@@ -244,6 +244,8 @@ declare interface FieldOptions {
244
244
  disabled?: boolean;
245
245
  minDate?: Dayjs;
246
246
  helperText?: React.ReactNode;
247
+ placeholder?: string;
248
+ description?: string;
247
249
  component?: React.ReactNode;
248
250
  maxChar?: number;
249
251
  [key: string]: string | number | object | boolean;
@@ -314,7 +316,7 @@ K extends
314
316
  */
315
317
  variant?: "inline" | "dialog";
316
318
  inputVariant?: "standard" | "outlined" | "filled";
317
- labelPosition?: "default" | "left";
319
+ labelPosition?: "default" | "left" | "top";
318
320
  /**
319
321
  *
320
322
  */
@@ -338,6 +340,10 @@ K extends
338
340
  *
339
341
  */
340
342
  loading: boolean;
343
+ /**
344
+ *
345
+ */
346
+ customSaveButtons?: React.ReactNode;
341
347
  /**
342
348
  *
343
349
  */
@@ -842,7 +848,7 @@ declare interface SecurityLevelProps {
842
848
  *
843
849
  */
844
850
  variant?: "standard" | "outlined" | "filled";
845
- labelPosition?: "default" | "left";
851
+ labelPosition?: "default" | "left" | "top";
846
852
  /**
847
853
  *
848
854
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hybridcore/ui",
3
3
  "description": "Hybrid Core UI Library",
4
- "version": "1.5.49",
4
+ "version": "1.5.51",
5
5
  "author": "Hybrid Core",
6
6
  "license": "ISC",
7
7
  "type": "module",