@envisiongroup/porygon 1.0.3 → 1.0.4

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.
Files changed (22) hide show
  1. package/dist/index.js +72 -69
  2. package/dist/react-components/fields/TagPicker/EFWTagPicker.js +130 -126
  3. package/dist/react-components/fields/TagPicker/EFWTagPicker.types.d.ts +11 -6
  4. package/dist/react-components/forms/EFWForm/EFWForm.js +93 -109
  5. package/dist/react-components/forms/EFWForm/EFWForm.utils.d.ts +26 -1
  6. package/dist/react-components/forms/EFWForm/EFWForm.utils.js +94 -65
  7. package/dist/react-components/forms/EFWForm/index.d.ts +4 -3
  8. package/dist/react-components/forms/EFWForm/index.js +10 -7
  9. package/dist/react-components/tables/EFWTable/EFWTable.js +767 -747
  10. package/dist/react-components/tables/EFWTable/EFWTable.types.d.ts +10 -1
  11. package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.js +31 -9
  12. package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.types.d.ts +39 -4
  13. package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.utils.d.ts +8 -3
  14. package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.utils.js +4 -1
  15. package/dist/react-components/tables/EFWTable/hooks/useDefaultAddButton/useDefaultAddButton.d.ts +1 -1
  16. package/dist/react-components/tables/EFWTable/hooks/useDefaultAddButton/useDefaultAddButton.js +47 -15
  17. package/dist/react-components/tables/EFWTable/hooks/useDefaultUpdateButton/useDefaultUpdateButton.js +52 -21
  18. package/dist/react-components/tables/EFWTable/utils/index.d.ts +2 -1
  19. package/dist/react-components/tables/EFWTable/utils/index.js +19 -17
  20. package/dist/react-components/tables/EFWTable/utils/itemCompletion.d.ts +32 -0
  21. package/dist/react-components/tables/EFWTable/utils/itemCompletion.js +23 -0
  22. package/package.json +2 -2
@@ -96,17 +96,17 @@ export interface EFWTagPickerProps extends EFWFieldChildrenProps {
96
96
  * Define la forma visual de las etiquetas: redondeadas o circulares
97
97
  * @default "rounded"
98
98
  */
99
- tagShape?: "rounded" | "circular";
99
+ tagShape?: 'rounded' | 'circular';
100
100
  /**
101
101
  * Define el estilo de apariencia de las etiquetas: relleno, contorno o marca
102
102
  * @default "brand"
103
103
  */
104
- tagAppearance?: "filled" | "outline" | "brand";
104
+ tagAppearance?: 'filled' | 'outline' | 'brand';
105
105
  /**
106
106
  * Define el tamaño visual de las etiquetas seleccionadas
107
107
  * @default "medium"
108
108
  */
109
- tagSize?: "medium" | "large" | 'extra-large';
109
+ tagSize?: 'medium' | 'large' | 'extra-large';
110
110
  /**
111
111
  * Longitud mínima de caracteres requerida antes de ejecutar búsqueda asíncrona
112
112
  * @default 0
@@ -132,10 +132,15 @@ export interface EFWTagPickerProps extends EFWFieldChildrenProps {
132
132
  /** Función para transformar o procesar las opciones antes de renderizarlas */
133
133
  beforeRenderOptions?: (options: EFWTagPickerOption[]) => EFWTagPickerOption[];
134
134
  /**
135
- * Función para renderizar el contenido visual de `media` en cada `TagPickerOption`.
136
- * Si no se define, se usa un Avatar por defecto basado en `option.text`.
135
+ * Contenido visual de `media` para cada `TagPickerOption`.
136
+ *
137
+ * Acepta tres formas:
138
+ * - `undefined` (por defecto): usa un Avatar generado a partir de `option.text`.
139
+ * - Una función `(option) => ReactNode`: media dinámico por opción (ej. foto desde `option.item`).
140
+ * - Un `ReactNode` directo: media estático compartido por todas las opciones
141
+ * (ej. `<Person20Regular />`). Usa `null` o `false` para desactivar el media por completo.
137
142
  */
138
- renderOptionMedia?: EFWTagPickerOptionMediaRenderer;
143
+ renderOptionMedia?: EFWTagPickerOptionMediaRenderer | ReactNode;
139
144
  /**
140
145
  * Indica si el `media` de cada opción también debe renderizarse dentro de la etiqueta
141
146
  * seleccionada que aparece en el input.
@@ -2,10 +2,10 @@ import { jsxs as ze, jsx as L } from "react/jsx-runtime";
2
2
  import { useMemo as D, useRef as o, useState as He, useEffect as ce, useCallback as p } from "react";
3
3
  import { useIsomorphicLayoutEffect as le } from "../../hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";
4
4
  import { makeStyles as wt, mergeClasses as Lt, Subtitle2Stronger as Ye, Text as Je, tokens as Qe } from "@fluentui/react-components";
5
- import { generateGridTemplateColumns as xt, EFWFormFieldWrapper as It } from "./EFWForm.utils.js";
5
+ import { getEmptyValueForFieldType as Z, generateGridTemplateColumns as xt, EFWFormFieldWrapper as It } from "./EFWForm.utils.js";
6
6
  import { EFWMessageBarManager as Pt } from "../EFWMessageBarManager/EFWMessageBarManager.js";
7
7
  import { isFieldEmptyForValidation as Xe } from "../../commons/valueNormalization.js";
8
- import { useFormLocaleText as Nt, PorygonI18nProvider as $t } from "../../i18n/PorygonI18nProvider.js";
8
+ import { useFormLocaleText as $t, PorygonI18nProvider as Nt } from "../../i18n/PorygonI18nProvider.js";
9
9
  const qt = wt({
10
10
  efwFormFieldWrapper: {
11
11
  "&:empty": {
@@ -25,15 +25,15 @@ const qt = wt({
25
25
  'button:not([aria-hidden="true"])'
26
26
  ], Kt = (s) => {
27
27
  for (const S of jt) {
28
- const E = s.querySelector(S);
29
- if (E)
30
- return E;
28
+ const M = s.querySelector(S);
29
+ if (M)
30
+ return M;
31
31
  }
32
32
  return null;
33
33
  }, kt = ({
34
34
  animationDelay: s = 0,
35
35
  animationToken: S,
36
- children: E,
36
+ children: M,
37
37
  className: O
38
38
  }) => {
39
39
  const g = o(null), b = p(
@@ -68,23 +68,7 @@ const qt = wt({
68
68
  },
69
69
  [s, S]
70
70
  );
71
- return /* @__PURE__ */ L("div", { ref: b, className: O, children: E });
72
- }, Z = {
73
- Text: "",
74
- // String vacío para modo controlado
75
- Number: null,
76
- // Default value for Number fields
77
- Note: "",
78
- // String vacío para modo controlado
79
- Choice: [],
80
- // Default value for Choice fields (array for multiple selections)
81
- Date: [],
82
- // Date picker expects arrays even cuando está vacío
83
- Boolean: !1,
84
- // false para modo controlado
85
- Attachments: [],
86
- MultiChoice: []
87
- // Default value for MultiChoice fields (array for multiple selections)
71
+ return /* @__PURE__ */ L("div", { ref: b, className: O, children: M });
88
72
  }, Wt = [
89
73
  "value",
90
74
  "selectedOptions",
@@ -102,7 +86,7 @@ const qt = wt({
102
86
  }, Ve = (s, S) => (
103
87
  // biome-ignore lint/complexity/useObjectHasOwn: el target de tsconfig es < es2022 y Object.hasOwn no está disponible
104
88
  Object.prototype.hasOwnProperty.call(s, S)
105
- ), zt = (s, S, E) => {
89
+ ), zt = (s, S, M) => {
106
90
  const O = { ...S }, g = Gt[s], b = Wt.filter(
107
91
  (y) => y !== g && y in O
108
92
  );
@@ -110,7 +94,7 @@ const qt = wt({
110
94
  for (const y of b)
111
95
  delete O[y];
112
96
  console.warn(
113
- `updateField recibió keys de valor incompatibles para '${E}' (${s}): ${b.join(", ")}. Se ignoraron y solo se permite '${g}'.`
97
+ `updateField recibió keys de valor incompatibles para '${M}' (${s}): ${b.join(", ")}. Se ignoraron y solo se permite '${g}'.`
114
98
  );
115
99
  }
116
100
  return O;
@@ -123,20 +107,20 @@ const qt = wt({
123
107
  case "Note":
124
108
  case "Boolean":
125
109
  case "Number":
126
- return s.value !== void 0 ? s.value : "defaultValue" in s && s.defaultValue !== void 0 ? s.defaultValue : Z[s.typeAsString];
110
+ return s.value !== void 0 ? s.value : "defaultValue" in s && s.defaultValue !== void 0 ? s.defaultValue : Z(s.typeAsString);
127
111
  case "Choice":
128
112
  case "MultiChoice":
129
- return "selectedOptions" in s && s.selectedOptions !== void 0 ? s.selectedOptions : "defaultSelectedOptions" in s && s.defaultSelectedOptions !== void 0 ? s.defaultSelectedOptions : Z[s.typeAsString];
113
+ return "selectedOptions" in s && s.selectedOptions !== void 0 ? s.selectedOptions : "defaultSelectedOptions" in s && s.defaultSelectedOptions !== void 0 ? s.defaultSelectedOptions : Z(s.typeAsString);
130
114
  case "Date":
131
- return "selectedDates" in s && s.selectedDates !== void 0 ? s.selectedDates : "defaultSelectedDates" in s && s.defaultSelectedDates !== void 0 ? s.defaultSelectedDates : Z[s.typeAsString];
115
+ return "selectedDates" in s && s.selectedDates !== void 0 ? s.selectedDates : "defaultSelectedDates" in s && s.defaultSelectedDates !== void 0 ? s.defaultSelectedDates : Z(s.typeAsString);
132
116
  case "Attachments":
133
- return "files" in s && s.files !== void 0 ? s.files : "defaultFiles" in s && s.defaultFiles !== void 0 ? s.defaultFiles : Z[s.typeAsString];
117
+ return "files" in s && s.files !== void 0 ? s.files : "defaultFiles" in s && s.defaultFiles !== void 0 ? s.defaultFiles : Z(s.typeAsString);
134
118
  default: {
135
- const S = s.typeAsString, E = S ? Z[S] : void 0;
136
- return E !== void 0 ? E : void 0;
119
+ const S = s.typeAsString;
120
+ return S ? Z(S) : void 0;
137
121
  }
138
122
  }
139
- }, et = (s, S, E) => {
123
+ }, et = (s, S, M) => {
140
124
  const O = S.current;
141
125
  let g = !1;
142
126
  const b = /* @__PURE__ */ new Set([...Object.keys(O), ...Object.keys(s)]);
@@ -145,11 +129,11 @@ const qt = wt({
145
129
  g = !0;
146
130
  break;
147
131
  }
148
- return g && (E.current += 1, S.current = { ...s }), E.current;
132
+ return g && (M.current += 1, S.current = { ...s }), M.current;
149
133
  }, nr = (s) => {
150
134
  const {
151
135
  title: S,
152
- description: E,
136
+ description: M,
153
137
  hidden: O = !1,
154
138
  editable: g = !0,
155
139
  disabled: b = !1,
@@ -163,20 +147,20 @@ const qt = wt({
163
147
  children: at,
164
148
  gridTemplateColumns: it = 1,
165
149
  gridTemplateGap: ee = 16,
166
- defaultValues: $ = {},
150
+ defaultValues: N = {},
167
151
  values: R,
168
152
  sections: x = [],
169
153
  messages: ot = [],
170
- fieldAnimationConfig: Ae = _t,
154
+ fieldAnimationConfig: Te = _t,
171
155
  onInit: de,
172
156
  formRef: K,
173
- localeText: Te
157
+ localeText: Ae
174
158
  } = s, Ce = D(() => {
175
159
  const {
176
160
  fields: e,
177
161
  buttons: t,
178
162
  ...r
179
- } = Te ?? {}, a = Object.keys(r).length > 0 ? r : void 0, n = e || t ? {
163
+ } = Ae ?? {}, a = Object.keys(r).length > 0 ? r : void 0, n = e || t ? {
180
164
  ...e ? { fields: e } : {},
181
165
  ...t ? { buttons: t } : {}
182
166
  } : void 0;
@@ -184,7 +168,7 @@ const qt = wt({
184
168
  formOverrides: a,
185
169
  i18nProviderLocale: n
186
170
  };
187
- }, [Te]), Y = Nt(Ce.formOverrides), De = Ce.i18nProviderLocale;
171
+ }, [Ae]), Y = $t(Ce.formOverrides), De = Ce.i18nProviderLocale;
188
172
  if (y.length > 0 && x.length > 0)
189
173
  throw console.error(
190
174
  'EFWForm: No se pueden usar "fields" y "sections" al mismo tiempo. Use solo uno de ellos.'
@@ -223,9 +207,9 @@ const qt = wt({
223
207
  }, [c]), Q = D(
224
208
  () => ({
225
209
  ...te,
226
- ...$
210
+ ...N
227
211
  }),
228
- [te, $]
212
+ [te, N]
229
213
  ), q = R !== void 0, dt = D(() => q ? {
230
214
  ...Q,
231
215
  ...R
@@ -277,8 +261,8 @@ const qt = wt({
277
261
  };
278
262
  return;
279
263
  }
280
- const V = m.current[r.internalName];
281
- if (!V) {
264
+ const E = m.current[r.internalName];
265
+ if (!E) {
282
266
  B.current[r.internalName] = {
283
267
  editable: a,
284
268
  disabled: n,
@@ -288,7 +272,7 @@ const qt = wt({
288
272
  return;
289
273
  }
290
274
  (!l || l.editable !== a || l.disabled !== n || l.hidden !== i || l.required !== f) && (m.current[r.internalName] = {
291
- ...V,
275
+ ...E,
292
276
  editable: a,
293
277
  disabled: n,
294
278
  hidden: i,
@@ -315,14 +299,14 @@ const qt = wt({
315
299
  te,
316
300
  mt,
317
301
  vt
318
- ), we = o($), W = o(j), Le = o(de), me = o(Ae), ne = o({}), xe = o(!1);
302
+ ), we = o(N), W = o(j), Le = o(de), me = o(Te), ne = o({}), xe = o(!1);
319
303
  ce(() => {
320
- we.current = $;
321
- }, [$]), W.current = j, Le.current = de, me.current = Ae;
304
+ we.current = N;
305
+ }, [N]), W.current = j, Le.current = de, me.current = Te;
322
306
  const ht = o({
323
- ...$
307
+ ...N
324
308
  }), bt = o(0), ve = et(
325
- $,
309
+ N,
326
310
  ht,
327
311
  bt
328
312
  ), he = `${ge}:${ve}`, be = o(""), G = D(
@@ -356,10 +340,10 @@ const qt = wt({
356
340
  U.current && U.current.removeMessageBar(e);
357
341
  }, []), Pe = p(() => {
358
342
  U.current && U.current.removeAllMessagesBar();
359
- }, []), Ne = o(Me);
360
- Ne.current = Me;
343
+ }, []), $e = o(Me);
344
+ $e.current = Me;
361
345
  const ie = p(() => {
362
- Ne.current?.({ ...u.current });
346
+ $e.current?.({ ...u.current });
363
347
  }, []), X = p(
364
348
  (e, t) => {
365
349
  const r = Fe.current;
@@ -399,7 +383,7 @@ const qt = wt({
399
383
  w.current[e] === t && delete w.current[e];
400
384
  },
401
385
  []
402
- ), A = p(
386
+ ), T = p(
403
387
  (e, t) => {
404
388
  const r = Array.isArray(e) ? e : [e], a = (n) => {
405
389
  const i = w.current[n];
@@ -416,24 +400,24 @@ const qt = wt({
416
400
  );
417
401
  return;
418
402
  }
419
- const l = f.typeAsString, V = zt(
403
+ const l = f.typeAsString, E = zt(
420
404
  l,
421
405
  t,
422
406
  String(n)
423
- ), F = Ht(V);
407
+ ), F = Ht(E);
424
408
  i(F);
425
409
  const {
426
410
  value: v,
427
- selectedOptions: M,
411
+ selectedOptions: V,
428
412
  selectedDates: d,
429
413
  files: h,
430
- ...N
414
+ ...$
431
415
  } = F;
432
- Object.keys(N).length > 0 && (m.current[n] = {
416
+ Object.keys($).length > 0 && (m.current[n] = {
433
417
  ...m.current[n],
434
- ...N
418
+ ...$
435
419
  });
436
- const H = W.current, T = (Dt, Ot, Rt = "change") => {
420
+ const H = W.current, A = (Dt, Ot, Rt = "change") => {
437
421
  const Ge = H?.[n];
438
422
  if (!Ge)
439
423
  return;
@@ -448,7 +432,7 @@ const qt = wt({
448
432
  try {
449
433
  Ge(
450
434
  Dt,
451
- A,
435
+ T,
452
436
  {
453
437
  allValues: u.current,
454
438
  trigger: Rt,
@@ -466,33 +450,33 @@ const qt = wt({
466
450
  case "Number":
467
451
  case "Boolean":
468
452
  case "Note": {
469
- v !== void 0 && (u.current[n] = v, T(v, C));
453
+ v !== void 0 && (u.current[n] = v, A(v, C));
470
454
  break;
471
455
  }
472
456
  case "Choice":
473
457
  case "MultiChoice": {
474
- M !== void 0 && (u.current[n] = M, T(
475
- M,
458
+ V !== void 0 && (u.current[n] = V, A(
459
+ V,
476
460
  C
477
461
  ));
478
462
  break;
479
463
  }
480
464
  case "Date": {
481
- d !== void 0 && (u.current[n] = d, T(
465
+ d !== void 0 && (u.current[n] = d, A(
482
466
  d,
483
467
  C
484
468
  ));
485
469
  break;
486
470
  }
487
471
  case "Attachments": {
488
- h !== void 0 && (u.current[n] = h, T(h, C));
472
+ h !== void 0 && (u.current[n] = h, A(h, C));
489
473
  break;
490
474
  }
491
475
  default:
492
476
  console.warn(`Tipo de campo desconocido: ${l}`);
493
477
  }
494
- const Tt = v !== void 0 || M !== void 0 || d !== void 0 || h !== void 0, Ct = "validationState" in F || "validationMessage" in F;
495
- Tt && !Ct && z(
478
+ const At = v !== void 0 || V !== void 0 || d !== void 0 || h !== void 0, Ct = "validationState" in F || "validationMessage" in F;
479
+ At && !Ct && z(
496
480
  n,
497
481
  u.current[n]
498
482
  );
@@ -504,14 +488,14 @@ const qt = wt({
504
488
  ), Se = D(() => {
505
489
  const e = Array.from(I.editable).sort().join("|"), t = Array.from(I.disabled).sort().join("|");
506
490
  return `${e}::${t}`;
507
- }, [I]), $e = o(
491
+ }, [I]), Ne = o(
508
492
  `${g}::${b}::${Se}`
509
493
  );
510
494
  le(() => {
511
495
  const e = `${g}::${b}::${Se}`;
512
- if ($e.current === e)
496
+ if (Ne.current === e)
513
497
  return;
514
- $e.current = e, (/* @__PURE__ */ new Set([
498
+ Ne.current = e, (/* @__PURE__ */ new Set([
515
499
  ...I.editable,
516
500
  ...I.disabled
517
501
  ])).forEach((r) => {
@@ -531,8 +515,8 @@ const qt = wt({
531
515
  Se,
532
516
  I
533
517
  ]);
534
- const Fe = o(A);
535
- Fe.current = A;
518
+ const Fe = o(T);
519
+ Fe.current = T;
536
520
  const _ = p(
537
521
  (e, t = {}) => {
538
522
  const r = W.current;
@@ -541,26 +525,26 @@ const qt = wt({
541
525
  const a = e && e.length > 0 ? e : Object.keys(r);
542
526
  if (a.length === 0)
543
527
  return;
544
- const n = r, { trigger: i = "change", previousValues: f, allValuesOverride: l } = t, V = l ?? u.current;
528
+ const n = r, { trigger: i = "change", previousValues: f, allValuesOverride: l } = t, E = l ?? u.current;
545
529
  a.forEach((F) => {
546
530
  const v = n[F];
547
531
  if (!v)
548
532
  return;
549
- const M = f?.[F];
533
+ const V = f?.[F];
550
534
  v(
551
- V[F],
552
- A,
535
+ E[F],
536
+ T,
553
537
  {
554
- allValues: V,
538
+ allValues: E,
555
539
  trigger: i,
556
540
  fieldName: F,
557
- previousValue: M,
541
+ previousValue: V,
558
542
  isControlled: q
559
543
  }
560
544
  );
561
545
  });
562
546
  },
563
- [A, q]
547
+ [T, q]
564
548
  ), Vt = p(
565
549
  (e) => W.current?.[e],
566
550
  []
@@ -578,15 +562,15 @@ const qt = wt({
578
562
  triggerFieldLogic: n = !0,
579
563
  overwriteAll: i = !1,
580
564
  force: f = !1
581
- } = t, l = t.animateUpdatedFields ?? r ?? me.current.setValues ?? !1, V = Object.keys(e), F = {}, v = [], M = f ? V : V.filter(
565
+ } = t, l = t.animateUpdatedFields ?? r ?? me.current.setValues ?? !1, E = Object.keys(e), F = {}, v = [], V = f ? E : E.filter(
582
566
  (d) => !Object.is(
583
567
  u.current[d],
584
568
  e[d]
585
569
  )
586
570
  );
587
- if (M.forEach((d) => {
571
+ if (V.forEach((d) => {
588
572
  F[d] = u.current[d];
589
- }), !(M.length === 0 && !i)) {
573
+ }), !(V.length === 0 && !i)) {
590
574
  if (i)
591
575
  u.current = {
592
576
  ...u.current,
@@ -598,46 +582,46 @@ const qt = wt({
598
582
  h in u.current && (d[h] = e[h]);
599
583
  }), u.current = d;
600
584
  }
601
- M.forEach((d) => {
585
+ V.forEach((d) => {
602
586
  const h = w.current[d];
603
587
  if (h) {
604
- const N = G.get(d);
605
- if (N) {
606
- const H = N.typeAsString, T = e[d];
588
+ const $ = G.get(d);
589
+ if ($) {
590
+ const H = $.typeAsString, A = e[d];
607
591
  let C;
608
592
  switch (H) {
609
593
  case "Text":
610
594
  case "Number":
611
595
  case "Boolean":
612
596
  case "Note":
613
- C = { value: T };
597
+ C = { value: A };
614
598
  break;
615
599
  case "Choice":
616
600
  case "MultiChoice":
617
- C = { selectedOptions: T };
601
+ C = { selectedOptions: A };
618
602
  break;
619
603
  case "Date":
620
- C = { selectedDates: T };
604
+ C = { selectedDates: A };
621
605
  break;
622
606
  case "Attachments":
623
- C = { files: T };
607
+ C = { files: A };
624
608
  break;
625
609
  default:
626
610
  console.warn(`Tipo de campo desconocido: ${H}`), C = {};
627
611
  }
628
- h(C), z(d, T), l && !Object.is(F[d], T) && v.push(d);
612
+ h(C), z(d, A), l && !Object.is(F[d], A) && v.push(d);
629
613
  } else
630
614
  console.warn(`No se encontró la definición del campo: ${d}`);
631
615
  }
632
616
  }), v.length > 0 && pt((d) => {
633
617
  const h = { ...d };
634
- return v.forEach((N, H) => {
635
- h[N] = {
618
+ return v.forEach(($, H) => {
619
+ h[$] = {
636
620
  delay: H * Bt,
637
- token: (h[N]?.token ?? 0) + 1
621
+ token: (h[$]?.token ?? 0) + 1
638
622
  };
639
623
  }), h;
640
- }), n && M.length > 0 && _(M, {
624
+ }), n && V.length > 0 && _(V, {
641
625
  previousValues: F
642
626
  }), a && ie();
643
627
  }
@@ -729,10 +713,10 @@ const qt = wt({
729
713
  return;
730
714
  }
731
715
  const f = i.disabled ?? !1;
732
- e !== f && w.current[n] ? (A(n, { disabled: e }), a.push(n)) : w.current[n] || console.warn(`Field ${n} not found in fieldUpdateRefs`);
716
+ e !== f && w.current[n] ? (T(n, { disabled: e }), a.push(n)) : w.current[n] || console.warn(`Field ${n} not found in fieldUpdateRefs`);
733
717
  }), a;
734
718
  },
735
- [c, A]
719
+ [c, T]
736
720
  ), Be = p(
737
721
  (e, t) => {
738
722
  const r = t || c.map((n) => n.internalName), a = [];
@@ -743,10 +727,10 @@ const qt = wt({
743
727
  return;
744
728
  }
745
729
  const f = i.editable ?? !0;
746
- e !== f && w.current[n] ? (A(n, { editable: e }), a.push(n)) : w.current[n] || console.warn(`Field ${n} not found in fieldUpdateRefs`);
730
+ e !== f && w.current[n] ? (T(n, { editable: e }), a.push(n)) : w.current[n] || console.warn(`Field ${n} not found in fieldUpdateRefs`);
747
731
  }), a;
748
732
  },
749
- [c, A]
733
+ [c, T]
750
734
  ), _e = p(() => c.every(
751
735
  (e) => m.current[e.internalName]?.disabled === !0
752
736
  ), [c]), je = p(() => c.every(
@@ -756,11 +740,11 @@ const qt = wt({
756
740
  const t = "validacion__10000001", r = "error", a = Y.requiredFieldError, n = gt.current;
757
741
  let i = !0;
758
742
  return c.forEach((f) => {
759
- const l = f.internalName, V = u.current[l], F = m.current[l], v = k.current[l];
743
+ const l = f.internalName, E = u.current[l], F = m.current[l], v = k.current[l];
760
744
  if (F?.hidden === !0)
761
745
  return;
762
746
  const d = Xe(
763
- V,
747
+ E,
764
748
  f.typeAsString
765
749
  );
766
750
  if (!F?.required && v?.validationState === "error") {
@@ -833,7 +817,7 @@ const qt = wt({
833
817
  addMessageBar: se,
834
818
  removeMessageBar: ae,
835
819
  removeAllMessagesBar: Pe,
836
- updateField: A
820
+ updateField: T
837
821
  }, K && (K.current = Ee.current), () => {
838
822
  K && K.current === Ee.current && (K.current = null);
839
823
  }), [
@@ -849,7 +833,7 @@ const qt = wt({
849
833
  Pe,
850
834
  Be,
851
835
  je,
852
- A
836
+ T
853
837
  ]), ce(() => {
854
838
  if (xe.current)
855
839
  return;
@@ -882,7 +866,7 @@ const qt = wt({
882
866
  getFieldLogicByName: Vt,
883
867
  isControlled: q,
884
868
  getAllValues: ye,
885
- updateFieldProps: A,
869
+ updateFieldProps: T,
886
870
  onValidationChange: St,
887
871
  localeText: Y
888
872
  }
@@ -904,7 +888,7 @@ const qt = wt({
904
888
  children: e.map(Mt)
905
889
  }
906
890
  );
907
- }, At = Lt(rt, "efw-form");
891
+ }, Tt = Lt(rt, "efw-form");
908
892
  if (O) return null;
909
893
  const We = /* @__PURE__ */ ze(
910
894
  "div",
@@ -913,11 +897,11 @@ const qt = wt({
913
897
  ...tt,
914
898
  ...ut ? {} : { visibility: "hidden" }
915
899
  },
916
- className: At,
900
+ className: Tt,
917
901
  children: [
918
902
  nt,
919
903
  S && /* @__PURE__ */ L(Ye, { style: { marginTop: 12 }, block: !0, children: S }),
920
- E && /* @__PURE__ */ L(Je, { block: !0, as: "p", children: E }),
904
+ M && /* @__PURE__ */ L(Je, { block: !0, as: "p", children: M }),
921
905
  x && x.length > 0 ? x.map((e, t) => /* @__PURE__ */ ze("div", { children: [
922
906
  e.title && /* @__PURE__ */ L(
923
907
  Ye,
@@ -956,7 +940,7 @@ const qt = wt({
956
940
  ]
957
941
  }
958
942
  );
959
- return De ? /* @__PURE__ */ L($t, { localeText: De, children: We }) : We;
943
+ return De ? /* @__PURE__ */ L(Nt, { localeText: De, children: We }) : We;
960
944
  };
961
945
  export {
962
946
  nr as EFWForm
@@ -1,8 +1,33 @@
1
- import { EFWFormFieldUpdate, EFWFormFieldProps, GetFieldValue, ExtractFieldNames, EFWFormValues, EFWUpdateFieldFunction, EFWFieldLogicContext, GridTemplateColumnsType } from './EFWForm.types';
1
+ import { EFWFormFieldUpdate, EFWFormFieldProps, GetFieldValue, ExtractFieldNames, EFWFormValues, EFWUpdateFieldFunction, EFWFieldLogicContext, EFWFormFieldType, EFWFormFieldValue, GridTemplateColumnsType } from './EFWForm.types';
2
2
  import { ValidationMessage, ValidationState } from '../../fields/_shared/EFWField/EFWField.types';
3
3
  import { EFWFormLocaleText } from '../../i18n';
4
4
 
5
5
  export declare const generateGridTemplateColumns: (config: GridTemplateColumnsType) => string;
6
+ /**
7
+ * Devuelve un valor "vacío" normalizado FRESCO para un tipo de campo.
8
+ *
9
+ * Es la fuente única de verdad para el valor por defecto de un campo sin valor,
10
+ * compartida entre `EFWForm` (valor inicial de campos) y `EFWTable` (completado
11
+ * de items creados desde un formulario con un subconjunto de fields).
12
+ *
13
+ * Los tipos array (`Choice`, `MultiChoice`, `Date`, `Attachments`) devuelven
14
+ * SIEMPRE un array nuevo, de modo que dos llamadas (y por tanto dos items
15
+ * completados) no compartan la misma referencia. Esto evita que una mutación
16
+ * accidental en un item contamine a los demás.
17
+ *
18
+ * Coherente con `commons/valueNormalization`: texto vacío es `''`, arrays
19
+ * vacíos son `[]`, numérico es `null` y booleano es `false`.
20
+ */
21
+ export declare const getEmptyValueForFieldType: (typeAsString: EFWFormFieldType) => EFWFormFieldValue;
22
+ /**
23
+ * Snapshot congelado de los valores vacíos por tipo, solo de referencia/inspección.
24
+ *
25
+ * Los arrays internos están congelados para que mutarlos falle (modo estricto)
26
+ * o sea no-op (modo sloppy). **No usar este mapa como fuente de valores
27
+ * consumibles**: para obtener valores vacíos sin identidad compartida usar
28
+ * `getEmptyValueForFieldType`, que devuelve arrays frescos en cada llamada.
29
+ */
30
+ export declare const EMPTY_VALUE_BY_FIELD_TYPE: Readonly<Record<EFWFormFieldType, EFWFormFieldValue>>;
6
31
  declare const EFWFormFieldWrapperInner: <T extends readonly EFWFormFieldProps[]>({ field, initialValue, onValueChange, registerUpdateProps, unregisterUpdateProps, getFieldLogicByName, isControlled, getAllValues, updateFieldProps, localeText, onValidationChange, }: {
7
32
  field: T[number];
8
33
  initialValue: GetFieldValue<T, T[number]["internalName"]>;