@scandit/web-datacapture-barcode
Version:
Scandit Data Capture SDK for the Web
1 lines • 1.82 kB
JavaScript
import{defaultSymbologies as e}from"../defaults/DefaultsSymbologies.js";import"../ScanIntention.js";import"../SelectionMode.js";import{defaultSparkScan as t}from"../defaults/DefaultsSparkScan.js";import{NumberWithUnit as n,RadiusLocationSelection as r}from"@scandit/web-datacapture-core";var i=class{constructor(){this.codeDuplicateFilter=t.SparkScanSettings.codeDuplicateFilter,this.enabledCompositeTypes=[],this.scanIntention=`manual`,this.selectionMode=`off`,this.locationSelection=new r(new n(t.SparkScanSettings.locationSelection.radius,t.SparkScanSettings.locationSelection.unit)),this.properties={},this.symbologies={}}get enabledSymbologies(){return Object.keys(this.symbologies).filter(e=>{var t;return(t=this.symbologies[e])==null?void 0:t.isEnabled})}get compositeTypeDescriptions(){return e.CompositeTypeDescriptions.reduce((e,t)=>(e[t.types[0]]=t,e),{})}settingsForSymbology(t){if(!this.symbologies[t]){let n=e.SymbologySettings[t];n._symbology=t,this.symbologies[t]=n}return this.symbologies[t]}setProperty(e,t){this.properties[e]=t}getProperty(e){return this.properties[e]}enableSymbologies(e){for(let t of e)this.enableSymbology(t,!0)}enableSymbology(e,t){this.settingsForSymbology(e).isEnabled=t}enableSymbologiesForCompositeTypes(e){for(let t of e)this.enableSymbologies(this.compositeTypeDescriptions[t].symbologies)}toJSONObject(){let e={},t=Object.keys(this.symbologies);return{codeDuplicateFilter:this.codeDuplicateFilter,enabledCompositeTypes:[...this.enabledCompositeTypes],locationSelection:this.locationSelection.toJSONObject(),properties:{...this.properties},symbologies:t.reduce((e,t)=>{var n;let r=(n=this.symbologies[t])==null?void 0:n.toJSONObject();return r&&(e[t]=r),e},e),scanIntention:this.scanIntention??null,selectionMode:this.selectionMode??null}}};export{i as SparkScanSettings};