@@ -30,7 +30,7 @@ import React, {
30
30
useState ,
31
31
useContext ,
32
32
} from "react" ;
33
- import { arrayStringExposingStateControl } from "comps/controls/codeStateControl" ;
33
+ import { arrayStringExposingStateControl , stringExposingStateControl } from "comps/controls/codeStateControl" ;
34
34
import { BoolControl } from "comps/controls/boolControl" ;
35
35
import { RefControl } from "comps/controls/refControl" ;
36
36
import { EditorContext } from "comps/editorState" ;
@@ -120,6 +120,7 @@ const BarcodeScannerComponent = React.lazy(
120
120
const ScannerTmpComp = ( function ( ) {
121
121
const childrenMap = {
122
122
data : arrayStringExposingStateControl ( "data" ) ,
123
+ value : stringExposingStateControl ( "value" ) ,
123
124
text : withDefault ( StringControl , trans ( "scanner.text" ) ) ,
124
125
continuous : BoolControl ,
125
126
uniqueData : withDefault ( BoolControl , true ) ,
@@ -166,9 +167,11 @@ const ScannerTmpComp = (function () {
166
167
const val = props . uniqueData
167
168
? [ ...new Set ( continuousValue . current ) ]
168
169
: continuousValue . current ;
170
+ props . value . onChange ( scannedText ) ;
169
171
props . data . onChange ( val ) ;
170
172
props . onEvent ( "success" ) ;
171
173
} else {
174
+ props . value . onChange ( result . text ) ;
172
175
props . data . onChange ( [ result . text ] ) ;
173
176
setShowModal ( false ) ;
174
177
setSuccess ( true ) ;
@@ -326,6 +329,7 @@ const ScannerTmpComp = (function () {
326
329
327
330
export const ScannerComp = withExposingConfigs ( ScannerTmpComp , [
328
331
new NameConfig ( "data" , trans ( "data" ) ) ,
332
+ new NameConfig ( "value" , trans ( "value" ) ) ,
329
333
new NameConfig ( "text" , trans ( "button.textDesc" ) ) ,
330
334
...CommonNameConfig ,
331
335
] ) ;
0 commit comments