@@ -30,7 +30,7 @@ import React, {
3030 useState ,
3131 useContext ,
3232} from "react" ;
33- import { arrayStringExposingStateControl } from "comps/controls/codeStateControl" ;
33+ import { arrayStringExposingStateControl , stringExposingStateControl } from "comps/controls/codeStateControl" ;
3434import { BoolControl } from "comps/controls/boolControl" ;
3535import { RefControl } from "comps/controls/refControl" ;
3636import { EditorContext } from "comps/editorState" ;
@@ -120,6 +120,7 @@ const BarcodeScannerComponent = React.lazy(
120120const ScannerTmpComp = ( function ( ) {
121121 const childrenMap = {
122122 data : arrayStringExposingStateControl ( "data" ) ,
123+ value : stringExposingStateControl ( "value" ) ,
123124 text : withDefault ( StringControl , trans ( "scanner.text" ) ) ,
124125 continuous : BoolControl ,
125126 uniqueData : withDefault ( BoolControl , true ) ,
@@ -166,9 +167,11 @@ const ScannerTmpComp = (function () {
166167 const val = props . uniqueData
167168 ? [ ...new Set ( continuousValue . current ) ]
168169 : continuousValue . current ;
170+ props . value . onChange ( scannedText ) ;
169171 props . data . onChange ( val ) ;
170172 props . onEvent ( "success" ) ;
171173 } else {
174+ props . value . onChange ( result . text ) ;
172175 props . data . onChange ( [ result . text ] ) ;
173176 setShowModal ( false ) ;
174177 setSuccess ( true ) ;
@@ -326,6 +329,7 @@ const ScannerTmpComp = (function () {
326329
327330export const ScannerComp = withExposingConfigs ( ScannerTmpComp , [
328331 new NameConfig ( "data" , trans ( "data" ) ) ,
332+ new NameConfig ( "value" , trans ( "value" ) ) ,
329333 new NameConfig ( "text" , trans ( "button.textDesc" ) ) ,
330334 ...CommonNameConfig ,
331335] ) ;
0 commit comments