@asteby/metacore-runtime-react 29.2.3 → 29.2.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.
- package/CHANGELOG.md +11 -0
- package/dist/dynamic-form.js +9 -2
- package/package.json +1 -1
- package/src/dynamic-form.tsx +9 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @asteby/metacore-runtime-react
|
|
2
2
|
|
|
3
|
+
## 29.2.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 99c22b4: El botón de escaneo por cámara en el form declarativo (auto-CRUD) ahora aparece
|
|
8
|
+
siempre que el campo declara `scan`, igual que el POS, en vez de esconderse
|
|
9
|
+
cuando el navegador no expone `BarcodeDetector`. En escritorio el usuario veía
|
|
10
|
+
el icono en el POS pero no al crear un producto (CÓDIGO/SKU) ni en el renglón de
|
|
11
|
+
compra; ahora es consistente. El BarcodeScanner ya degrada con un mensaje cuando
|
|
12
|
+
no hay soporte de cámara.
|
|
13
|
+
|
|
3
14
|
## 29.2.3
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/dist/dynamic-form.js
CHANGED
|
@@ -8,7 +8,7 @@ import { FieldSection, WizardProgress } from './form-layout-ui';
|
|
|
8
8
|
import { Input, Textarea, Label, Switch, Button, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '@asteby/metacore-ui/primitives';
|
|
9
9
|
import { buildZodSchema, resolveWidget, isLineItemsField, evaluateBalance, applyOptionWhen, getDependsOn, getVisibleWhen, evaluateVisibleWhen, } from './dynamic-form-schema';
|
|
10
10
|
import { ScanLine } from 'lucide-react';
|
|
11
|
-
import { BarcodeScanner
|
|
11
|
+
import { BarcodeScanner } from './barcode-scanner';
|
|
12
12
|
import { useOptionsResolver } from './use-options-resolver';
|
|
13
13
|
import { DynamicLineItems } from './dynamic-line-items';
|
|
14
14
|
import { DynamicSelectField } from './dynamic-select-field';
|
|
@@ -253,7 +253,14 @@ function FieldRenderer({ field, value, onChange, initialValues, effectiveOptions
|
|
|
253
253
|
*/
|
|
254
254
|
function ScannableInput({ field, value, onChange, type, }) {
|
|
255
255
|
const [scanOpen, setScanOpen] = useState(false);
|
|
256
|
-
|
|
256
|
+
// El botón aparece SIEMPRE que el campo declara `scan`, igual que el POS
|
|
257
|
+
// (que gatea por su handler, no por soporte). No lo escondemos por
|
|
258
|
+
// `isCameraScanSupported()`: en un navegador sin `BarcodeDetector` el botón
|
|
259
|
+
// seguía sin verse en escritorio aunque el campo lo pidiera, y el usuario no
|
|
260
|
+
// entendía por qué el POS sí lo mostraba y el form no. El BarcodeScanner ya
|
|
261
|
+
// degrada con un mensaje ("usá un lector físico / escribí a mano") cuando no
|
|
262
|
+
// hay soporte, así que mostrar el botón es seguro y consistente.
|
|
263
|
+
const scanEnabled = !!(field.scan ?? field.scannable);
|
|
257
264
|
const input = (_jsx(Input, { id: field.key, type: type, value: value ?? '', onChange: (e) => onChange(type === 'number' ? e.target.valueAsNumber || '' : e.target.value), placeholder: field.placeholder }));
|
|
258
265
|
if (!scanEnabled)
|
|
259
266
|
return input;
|
package/package.json
CHANGED
package/src/dynamic-form.tsx
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
evaluateVisibleWhen,
|
|
29
29
|
} from './dynamic-form-schema'
|
|
30
30
|
import { ScanLine } from 'lucide-react'
|
|
31
|
-
import { BarcodeScanner
|
|
31
|
+
import { BarcodeScanner } from './barcode-scanner'
|
|
32
32
|
import { useOptionsResolver, type ResolvedOption } from './use-options-resolver'
|
|
33
33
|
import { DynamicLineItems } from './dynamic-line-items'
|
|
34
34
|
import { DynamicSelectField } from './dynamic-select-field'
|
|
@@ -442,7 +442,14 @@ function ScannableInput({
|
|
|
442
442
|
type,
|
|
443
443
|
}: FieldRendererProps & { type: string }) {
|
|
444
444
|
const [scanOpen, setScanOpen] = useState(false)
|
|
445
|
-
|
|
445
|
+
// El botón aparece SIEMPRE que el campo declara `scan`, igual que el POS
|
|
446
|
+
// (que gatea por su handler, no por soporte). No lo escondemos por
|
|
447
|
+
// `isCameraScanSupported()`: en un navegador sin `BarcodeDetector` el botón
|
|
448
|
+
// seguía sin verse en escritorio aunque el campo lo pidiera, y el usuario no
|
|
449
|
+
// entendía por qué el POS sí lo mostraba y el form no. El BarcodeScanner ya
|
|
450
|
+
// degrada con un mensaje ("usá un lector físico / escribí a mano") cuando no
|
|
451
|
+
// hay soporte, así que mostrar el botón es seguro y consistente.
|
|
452
|
+
const scanEnabled = !!(field.scan ?? field.scannable)
|
|
446
453
|
const input = (
|
|
447
454
|
<Input
|
|
448
455
|
id={field.key}
|