pixelon 0.5.2 → 0.5.3

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.
@@ -48,6 +48,15 @@ export interface ReactiveCrudField {
48
48
  showInModes?: Array<'create' | 'edit' | 'view'>;
49
49
  required?: boolean;
50
50
  placeholder?: string;
51
+ /** SPEC-137 — con qué nace el campo cuando el formulario se abre desde una fila.
52
+ *
53
+ * Acepta un literal o un `$campo`, que se resuelve contra la fila igual que en `payloadMap`.
54
+ * Es para cuando el sistema YA SABE la respuesta y preguntarla otra vez es hacer teclear lo que
55
+ * está en pantalla: el motivo de un rechazo que el propio sistema acaba de explicar, por
56
+ * ejemplo. Mismo principio que SPEC-095 — el botón ya lo dijo.
57
+ *
58
+ * Sigue siendo editable: es un punto de partida, no una respuesta impuesta. */
59
+ defaultValue?: string;
51
60
  options?: Array<{
52
61
  value: string;
53
62
  label: string;
package/dist/index.esm.js CHANGED
@@ -14606,6 +14606,14 @@ function ActionFormDrawer({ action, row, idField, eventBus, onExecute, onClose }
14606
14606
  }, [eventBus, action.key, normalFields]);
14607
14607
  const { locale } = useChatConfig();
14608
14608
  const separadores = useMemo(() => separadoresDelLocale(locale), [locale]);
14609
+ const defaultValues = useMemo(() => {
14610
+ const out = {};
14611
+ for (const f of normalFields) {
14612
+ if (f.defaultValue === void 0) continue;
14613
+ out[f.name] = typeof f.defaultValue === "string" && f.defaultValue.startsWith("$") ? row[f.defaultValue.slice(1)] : f.defaultValue;
14614
+ }
14615
+ return out;
14616
+ }, [normalFields, row]);
14609
14617
  const fields = useMemo(
14610
14618
  () => normalFields.map((f) => ({
14611
14619
  name: f.name,
@@ -14709,6 +14717,7 @@ function ActionFormDrawer({ action, row, idField, eventBus, onExecute, onClose }
14709
14717
  DynamicForm,
14710
14718
  {
14711
14719
  fields,
14720
+ defaultValues,
14712
14721
  validationSchema,
14713
14722
  onSubmit: (values) => void runSubmit(values),
14714
14723
  onCancel: onClose,
package/dist/index.js CHANGED
@@ -14627,6 +14627,14 @@ function ActionFormDrawer({ action, row, idField, eventBus, onExecute, onClose }
14627
14627
  }, [eventBus, action.key, normalFields]);
14628
14628
  const { locale } = useChatConfig();
14629
14629
  const separadores = React.useMemo(() => separadoresDelLocale(locale), [locale]);
14630
+ const defaultValues = React.useMemo(() => {
14631
+ const out = {};
14632
+ for (const f of normalFields) {
14633
+ if (f.defaultValue === void 0) continue;
14634
+ out[f.name] = typeof f.defaultValue === "string" && f.defaultValue.startsWith("$") ? row[f.defaultValue.slice(1)] : f.defaultValue;
14635
+ }
14636
+ return out;
14637
+ }, [normalFields, row]);
14630
14638
  const fields = React.useMemo(
14631
14639
  () => normalFields.map((f) => ({
14632
14640
  name: f.name,
@@ -14730,6 +14738,7 @@ function ActionFormDrawer({ action, row, idField, eventBus, onExecute, onClose }
14730
14738
  DynamicForm,
14731
14739
  {
14732
14740
  fields,
14741
+ defaultValues,
14733
14742
  validationSchema,
14734
14743
  onSubmit: (values) => void runSubmit(values),
14735
14744
  onCancel: onClose,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixelon",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "Design system de la marca goluti",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",