@sapui5/sap.ndc 1.96.2 → 1.98.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapui5/sap.ndc",
3
- "version": "1.96.2",
3
+ "version": "1.98.0",
4
4
  "description": "SAPUI5 Library sap.ndc",
5
5
  "homepage": "https://sap.github.io/ui5-tooling/pages/SAPUI5/",
6
6
  "author": "SAP SE (https://www.sap.com)",
@@ -4,8 +4,8 @@
4
4
  <name>sap.ndc</name>
5
5
  <vendor>SAP SE</vendor>
6
6
  <copyright>SAPUI5
7
- * (c) Copyright 2009-2021 SAP SE. All rights reserved.</copyright>
8
- <version>1.96.2</version>
7
+ * (c) Copyright 2009-2022 SAP SE. All rights reserved.</copyright>
8
+ <version>1.98.0</version>
9
9
 
10
10
  <documentation>SAPUI5 library with controls with native device capabilities.</documentation>
11
11
 
@@ -38,9 +38,15 @@
38
38
  <pattern>sap/ndc/thirdparty/ZXing.js</pattern>
39
39
  </lib>
40
40
  </thirdparty>
41
+ <documentation xmlns="http://www.sap.com/ui5/buildext/documentation"
42
+ indexUrl="../../../test-resources/sap/ndc/demokit/docuindex.json"
43
+ resolve="lib"/>
41
44
  <releasenotes xmlns="http://www.sap.com/ui5/buildext/releasenotes"
42
45
  url="../../../test-resources/sap/ndc/relnotes/changes-{major}.{minor}.json"
43
46
  resolve="lib" />
47
+ <ownership xmlns="http://www.sap.com/ui5/buildext/ownership">
48
+ <component>MOB-SDK-UI5</component><!-- default component for library, embedded text as a shortcut for <name>text</name> -->
49
+ </ownership>
44
50
  </appData>
45
51
 
46
52
  </library>
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * SAPUI5
3
- * (c) Copyright 2009-2021 SAP SE. All rights reserved.
3
+ * (c) Copyright 2009-2022 SAP SE. All rights reserved.
4
4
  */
5
5
 
6
6
 
@@ -78,15 +78,10 @@ sap.ui.define([
78
78
  defaultConstraints = {
79
79
  audio: false,
80
80
  video: {
81
- height: {
82
- min: 480,
83
- ideal: 960,
84
- max: 1440
85
- },
86
- aspectRatio: 1.333333333,
87
81
  facingMode: 'environment'
88
82
  }
89
83
  },
84
+ oPreferFrontCamera,
90
85
 
91
86
  oBarcodeScannerUIContainer = null,
92
87
 
@@ -284,6 +279,11 @@ sap.ui.define([
284
279
  */
285
280
  function openBarcodeScannerDialog() {
286
281
  if (navigator.mediaDevices.getUserMedia) {
282
+ if (oPreferFrontCamera) {
283
+ defaultConstraints.video.facingMode = 'user';
284
+ } else {
285
+ defaultConstraints.video.facingMode = 'environment';
286
+ }
287
287
  navigator.mediaDevices
288
288
  .getUserMedia(defaultConstraints)
289
289
  .then(
@@ -354,6 +354,8 @@ sap.ui.define([
354
354
 
355
355
  if (typeof sTitle === "string" && sTitle != null && sTitle.trim() != "") {
356
356
  oDialogTitle = sTitle;
357
+ } else {
358
+ oDialogTitle = oResourceModel.getProperty("BARCODE_DIALOG_TITLE");
357
359
  }
358
360
 
359
361
  if (!oCordovaScannerAPI && isUserMediaAccessSupported()) {
@@ -389,7 +391,7 @@ sap.ui.define([
389
391
  oBarcodeVideoDOM = oBarcodeScannerUIContainer ? oBarcodeScannerUIContainer.getDomRef('video') : undefined;
390
392
  }
391
393
 
392
- oZXingScannerAPI.decodeFromVideoDevice(null, oBarcodeScannerUIContainer.getId() + '-video', function (result, err) {
394
+ oZXingScannerAPI.decodeFromConstraints(defaultConstraints, oBarcodeScannerUIContainer.getId() + '-video', function (result, err) {
393
395
  oScanFrame();
394
396
  if (result) {
395
397
  var point, scaleX, scaleY;
@@ -549,7 +551,8 @@ sap.ui.define([
549
551
  * function (mParams) {
550
552
  * alert("Value entered: " + mParams.newValue);
551
553
  * },
552
- * "Enter Product Bar Code"
554
+ * "Enter Product Bar Code",
555
+ * true
553
556
  * );
554
557
  * });
555
558
  * </pre>
@@ -558,17 +561,19 @@ sap.ui.define([
558
561
  * @param {function} [fnFail] Function to be called when the scanning is failed
559
562
  * @param {function} [fnLiveUpdate] Function to be called when value of the dialog's input is changed
560
563
  * @param {string} [dialogTitle] Defines the bar code input dialog title. If unset, a predefined title will be used.
564
+ * @param {boolean} [preferFrontCamera] Flag, which defines whether the front or back camera should be used.
561
565
  *
562
566
  * @public
563
567
  * @static
564
568
  */
565
- BarcodeScanner.scan = function (fnSuccess, fnFail, fnLiveUpdate, dialogTitle) {
569
+ BarcodeScanner.scan = function (fnSuccess, fnFail, fnLiveUpdate, dialogTitle, preferFrontCamera) {
566
570
  if (!bReady) {
567
571
  Log.error("Barcode scanning is already in progress.");
568
572
  return;
569
573
  }
570
574
 
571
575
  bReady = false;
576
+ oPreferFrontCamera = preferFrontCamera;
572
577
 
573
578
  if (oStatusModel.getProperty("/available") == true && oCordovaScannerAPI == null && oZXingScannerAPI == null){
574
579
  //in case we do not have feature vectore we still would like to allow the use
@@ -577,6 +582,12 @@ sap.ui.define([
577
582
  }
578
583
 
579
584
  if (oCordovaScannerAPI) {
585
+ var options;
586
+ if (oPreferFrontCamera) {
587
+ options = {
588
+ preferFrontCamera: true
589
+ };
590
+ }
580
591
  oCordovaScannerAPI.scan(
581
592
  function (oResult) {
582
593
  if (oResult.cancelled === "false" || !oResult.cancelled) {
@@ -600,7 +611,8 @@ sap.ui.define([
600
611
  }
601
612
  fnFail(oEvent);
602
613
  }
603
- }
614
+ },
615
+ options
604
616
  );
605
617
  } else {
606
618
  getScanDialog(fnSuccess, fnFail, fnLiveUpdate, dialogTitle);
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * SAPUI5
3
- * (c) Copyright 2009-2021 SAP SE. All rights reserved.
3
+ * (c) Copyright 2009-2022 SAP SE. All rights reserved.
4
4
  */
5
5
 
6
6
  // Provides control sap.ndc.BarcodeScannerButton.
@@ -52,7 +52,12 @@ sap.ui.define(["sap/ui/thirdparty/jquery", './BarcodeScanner', './library', 'sap
52
52
  /**
53
53
  * Defines the bar code input dialog title. If unset, a predefined title will be used.
54
54
  */
55
- dialogTitle : {type: "string", defaultValue: null}
55
+ dialogTitle : {type: "string", defaultValue: null},
56
+
57
+ /**
58
+ * If set to true, the front camera will be used to decode.
59
+ */
60
+ preferFrontCamera : {type : "boolean", defaultValue : false}
56
61
  },
57
62
  aggregations : {
58
63
 
@@ -125,7 +130,8 @@ sap.ui.define(["sap/ui/thirdparty/jquery", './BarcodeScanner', './library', 'sap
125
130
  jQuery.proxy(this._onScanSuccess, this),
126
131
  jQuery.proxy(this._onScanFail, this),
127
132
  jQuery.proxy(this._onInputLiveUpdate, this),
128
- this.getProperty("dialogTitle")
133
+ this.getProperty("dialogTitle"),
134
+ this.getProperty("preferFrontCamera")
129
135
  );
130
136
  };
131
137
 
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * SAPUI5
3
- * (c) Copyright 2009-2021 SAP SE. All rights reserved.
3
+ * (c) Copyright 2009-2022 SAP SE. All rights reserved.
4
4
  */
5
5
  sap.ui.define([],
6
6
  function() {
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * SAPUI5
3
- * (c) Copyright 2009-2021 SAP SE. All rights reserved.
3
+ * (c) Copyright 2009-2022 SAP SE. All rights reserved.
4
4
  */
5
5
 
6
6
  sap.ui.define([
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * SAPUI5
3
- * (c) Copyright 2009-2021 SAP SE. All rights reserved.
3
+ * (c) Copyright 2009-2022 SAP SE. All rights reserved.
4
4
  */
5
5
 
6
6
  /**
@@ -32,7 +32,7 @@ sap.ui.define(['sap/m/library', 'sap/ui/core/library'],
32
32
  ],
33
33
  elements: [],
34
34
  noLibraryCSS: true,
35
- version: "1.96.2"
35
+ version: "1.98.0"
36
36
  });
37
37
 
38
38
  return sap.ndc;
package/ui5.yaml CHANGED
@@ -1,4 +1,4 @@
1
- specVersion: '1.0'
1
+ specVersion: '2.6'
2
2
  type: library
3
3
  metadata:
4
4
  name: sap.ndc
@@ -7,3 +7,7 @@ framework:
7
7
  libraries:
8
8
  - name: sap.ui.core
9
9
  - name: sap.m
10
+ builder:
11
+ minification:
12
+ excludes:
13
+ - "sap/ndc/thirdparty/*.js"