@sapui5/sap.ndc 1.106.0 → 1.108.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 +1 -1
- package/src/sap/ndc/.library +2 -8
- package/src/sap/ndc/BarcodeScanner.js +12 -4
- package/src/sap/ndc/BarcodeScannerButton.js +108 -100
- package/src/sap/ndc/BarcodeScannerButtonRenderer.js +8 -12
- package/src/sap/ndc/library.js +8 -4
- package/src/sap/ndc/thirdparty/ZXing.js +2 -15
- package/src/sap/ndc/thirdparty/ZXing-dbg.js +0 -24247
package/package.json
CHANGED
package/src/sap/ndc/.library
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<vendor>SAP SE</vendor>
|
|
6
6
|
<copyright>SAPUI5
|
|
7
7
|
* (c) Copyright 2009-2022 SAP SE. All rights reserved.</copyright>
|
|
8
|
-
<version>1.
|
|
8
|
+
<version>1.108.0</version>
|
|
9
9
|
|
|
10
10
|
<documentation>SAPUI5 library with controls with native device capabilities.</documentation>
|
|
11
11
|
|
|
@@ -33,22 +33,16 @@
|
|
|
33
33
|
<!-- excludes for the default preload files -->
|
|
34
34
|
<packaging xmlns="http://www.sap.com/ui5/buildext/packaging" version="2.0" >
|
|
35
35
|
<all-in-one>
|
|
36
|
-
<!-- ===========================================================================
|
|
37
|
-
!! ATTENTION !!
|
|
38
|
-
The following excludes must be kept in sync with those configured for the
|
|
39
|
-
'preload-and-merge' plugin execution in the pom.xml.
|
|
40
|
-
=========================================================================== -->
|
|
41
36
|
<exclude name="sap/ndc/thirdparty/" />
|
|
42
37
|
</all-in-one>
|
|
43
38
|
</packaging>
|
|
44
39
|
|
|
45
40
|
<!-- Thirdparty references -->
|
|
46
41
|
<thirdparty xmlns="http://www.sap.com/ui5/buildext/thirdparty" >
|
|
47
|
-
<lib name="@zxing/library" displayName="ZXing" version="0.
|
|
42
|
+
<lib name="@zxing/library" displayName="ZXing" npmName="@zxing/library" version="0.17.1" hash="79570fa03328b5b34c67123245d74925" homepage="https://zxing-js.github.io/library/" id="73554900106100054816">
|
|
48
43
|
<license url="https://github.com/zxing-js/library/blob/master/LICENSE" type="MIT" />
|
|
49
44
|
<copyright>2018 ZXing for JS</copyright>
|
|
50
45
|
<pattern>sap/ndc/thirdparty/ZXing.js</pattern>
|
|
51
|
-
<pattern>sap/ndc/thirdparty/ZXing-dbg.js</pattern>
|
|
52
46
|
</lib>
|
|
53
47
|
</thirdparty>
|
|
54
48
|
|
|
@@ -27,9 +27,10 @@ sap.ui.define([
|
|
|
27
27
|
"sap/m/MessageToast",
|
|
28
28
|
'sap/m/library',
|
|
29
29
|
"sap/ui/base/Event",
|
|
30
|
-
"sap/ui/base/EventProvider"
|
|
30
|
+
"sap/ui/base/EventProvider",
|
|
31
|
+
'sap/ui/Device'
|
|
31
32
|
],
|
|
32
|
-
function(Log, JSONModel, ResourceModel, Input, Label, Button, Dialog, includeStylesheet, BarcodeScannerUIContainer, MessageToast, mobileLibrary, Event, EventProvider) {
|
|
33
|
+
function(Log, JSONModel, ResourceModel, Input, Label, Button, Dialog, includeStylesheet, BarcodeScannerUIContainer, MessageToast, mobileLibrary, Event, EventProvider, Device) {
|
|
33
34
|
"use strict";
|
|
34
35
|
|
|
35
36
|
/*global cordova EB*/
|
|
@@ -44,6 +45,8 @@ sap.ui.define([
|
|
|
44
45
|
/**
|
|
45
46
|
* @class
|
|
46
47
|
*
|
|
48
|
+
* Please refer to <a target="_blank" rel="noopener,noreferrer" href="https://launchpad.support.sap.com/#/notes/2402585">SAP Note 2402585</a> for information on barcode scanner support in native iOS and Android browsers.
|
|
49
|
+
*
|
|
47
50
|
* Here is an example of how to trigger the scan function of BarcodeScanner:
|
|
48
51
|
* <pre>
|
|
49
52
|
* sap.ui.require(["sap/ndc/BarcodeScanner"], function(BarcodeScanner) {
|
|
@@ -318,7 +321,7 @@ sap.ui.define([
|
|
|
318
321
|
* @private
|
|
319
322
|
*/
|
|
320
323
|
function openBarcodeScannerDialog() {
|
|
321
|
-
if (navigator.mediaDevices.getUserMedia) {
|
|
324
|
+
if (window.navigator.mediaDevices.getUserMedia) {
|
|
322
325
|
if (oPreferFrontCamera) {
|
|
323
326
|
defaultConstraints.video.facingMode = 'user';
|
|
324
327
|
} else {
|
|
@@ -328,11 +331,16 @@ sap.ui.define([
|
|
|
328
331
|
if (defaultConstraints.video.frameRate !== undefined) {
|
|
329
332
|
delete defaultConstraints.video.frameRate;
|
|
330
333
|
}
|
|
331
|
-
navigator.mediaDevices
|
|
334
|
+
window.navigator.mediaDevices
|
|
332
335
|
.getUserMedia(defaultConstraints)
|
|
333
336
|
.then(
|
|
334
337
|
function(stream) {
|
|
335
338
|
if (oZXingScannerAPI) {
|
|
339
|
+
// When decoding QR-code by iPhone (iOS 16), this stream will clash with another stream from ZXing-js.
|
|
340
|
+
if (Device.os.ios && Device.os.versionStr.split('.')[0] === '16') {
|
|
341
|
+
var videoTrack = stream.getTracks();
|
|
342
|
+
videoTrack[0].stop();
|
|
343
|
+
}
|
|
336
344
|
openBarcodeScannerDialogContains();
|
|
337
345
|
} else {
|
|
338
346
|
oScanDialog.getModel().setProperty("/isNoScanner", true);
|
|
@@ -4,8 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
// Provides control sap.ndc.BarcodeScannerButton.
|
|
7
|
-
sap.ui.define([
|
|
8
|
-
|
|
7
|
+
sap.ui.define([
|
|
8
|
+
'./BarcodeScanner',
|
|
9
|
+
'./BarcodeScannerButtonRenderer',
|
|
10
|
+
'./library',
|
|
11
|
+
'sap/m/Button',
|
|
12
|
+
'sap/ui/core/Control',
|
|
13
|
+
'sap/ui/model/resource/ResourceModel'
|
|
14
|
+
], function(BarcodeScanner, BarcodeScannerButtonRenderer, library, Button, Control, ResourceModel) {
|
|
9
15
|
"use strict";
|
|
10
16
|
|
|
11
17
|
|
|
@@ -27,104 +33,106 @@ sap.ui.define(["sap/ui/thirdparty/jquery", './BarcodeScanner', './library', 'sap
|
|
|
27
33
|
* @constructor
|
|
28
34
|
* @public
|
|
29
35
|
* @alias sap.ndc.BarcodeScannerButton
|
|
30
|
-
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
|
|
31
36
|
*/
|
|
32
|
-
var BarcodeScannerButton = Control.extend("sap.ndc.BarcodeScannerButton", /** @lends sap.ndc.BarcodeScannerButton.prototype */ {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
aggregations : {
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Internal aggregation to hold the inner Button.
|
|
81
|
-
*/
|
|
82
|
-
_btn : {type : "sap.m.Button", multiple : false, visibility : "hidden"}
|
|
83
|
-
},
|
|
84
|
-
events : {
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Event is fired when the scanning is finished or cancelled
|
|
88
|
-
*/
|
|
89
|
-
scanSuccess : {
|
|
90
|
-
parameters : {
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* The the text representation of the bar code data.
|
|
94
|
-
*/
|
|
95
|
-
text : {type : "string"},
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* The type of the bar code detected.
|
|
99
|
-
*/
|
|
100
|
-
format : {type : "string"},
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Indicates whether or not the user cancelled the scan.
|
|
104
|
-
*/
|
|
105
|
-
cancelled : {type : "boolean"}
|
|
106
|
-
}
|
|
37
|
+
var BarcodeScannerButton = Control.extend("sap.ndc.BarcodeScannerButton", /** @lends sap.ndc.BarcodeScannerButton.prototype */ {
|
|
38
|
+
metadata : {
|
|
39
|
+
|
|
40
|
+
library : "sap.ndc",
|
|
41
|
+
properties : {
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* If set to true, the button remains visible if the scanner is not available and triggers a dialog to enter bar code.
|
|
45
|
+
*/
|
|
46
|
+
provideFallback : {type : "boolean", defaultValue : true},
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The invisible bar code scanner button is not rendered regardless of the availability of the native scan feature.
|
|
50
|
+
*/
|
|
51
|
+
visible : {type : "boolean", defaultValue : true},
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Defines the width of the scanner button.
|
|
55
|
+
*/
|
|
56
|
+
width : {type: "sap.ui.core.CSSSize", defaultValue : null},
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Defines the bar code input dialog title. If unset, a predefined title will be used.
|
|
60
|
+
*/
|
|
61
|
+
dialogTitle : {type: "string", defaultValue: null},
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* If set to true, the front camera will be used to decode.
|
|
65
|
+
*/
|
|
66
|
+
preferFrontCamera : {type : "boolean", defaultValue : false},
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Defines the frame rate of the camera.
|
|
70
|
+
*/
|
|
71
|
+
frameRate : {type : "float"},
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Defines the zoom of the camera. This parameter is not supported on iOS.
|
|
75
|
+
*/
|
|
76
|
+
zoom : {type : "float"},
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* If set to true, the camera should be used for scanning in Zebra Enterprise Browser.
|
|
80
|
+
*/
|
|
81
|
+
keepCameraScan : {type : "boolean", defaultValue : false}
|
|
107
82
|
},
|
|
83
|
+
aggregations : {
|
|
108
84
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Internal aggregation to hold the inner Button.
|
|
87
|
+
*/
|
|
88
|
+
_btn : {type : "sap.m.Button", multiple : false, visibility : "hidden"}
|
|
89
|
+
},
|
|
90
|
+
events : {
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Event is fired when the scanning is finished or cancelled
|
|
94
|
+
*/
|
|
95
|
+
scanSuccess : {
|
|
96
|
+
parameters : {
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The the text representation of the bar code data.
|
|
100
|
+
*/
|
|
101
|
+
text : {type : "string"},
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The type of the bar code detected.
|
|
105
|
+
*/
|
|
106
|
+
format : {type : "string"},
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Indicates whether or not the user cancelled the scan.
|
|
110
|
+
*/
|
|
111
|
+
cancelled : {type : "boolean"}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Event is fired when the native scanning process is failed.
|
|
117
|
+
*/
|
|
118
|
+
scanFail : {},
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Event is fired when the text in the dialog's input field is changed.
|
|
122
|
+
*/
|
|
123
|
+
inputLiveUpdate : {
|
|
124
|
+
parameters : {
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The new value of the input field.
|
|
128
|
+
*/
|
|
129
|
+
newValue : {type : "string"}
|
|
130
|
+
}
|
|
124
131
|
}
|
|
125
132
|
}
|
|
126
|
-
}
|
|
127
|
-
|
|
133
|
+
},
|
|
134
|
+
renderer: BarcodeScannerButtonRenderer
|
|
135
|
+
});
|
|
128
136
|
|
|
129
137
|
var oResourceModel;
|
|
130
138
|
|
|
@@ -135,10 +143,10 @@ sap.ui.define(["sap/ui/thirdparty/jquery", './BarcodeScanner', './library', 'sap
|
|
|
135
143
|
bundleName: "sap.ndc.messagebundle"
|
|
136
144
|
});
|
|
137
145
|
|
|
138
|
-
this.setAggregation("_btn", new
|
|
146
|
+
this.setAggregation("_btn", new Button({
|
|
139
147
|
icon: "sap-icon://bar-code",
|
|
140
148
|
tooltip: oResourceModel.getProperty("BARCODE_SCANNER_BUTTON_TOOLTIP"),
|
|
141
|
-
press:
|
|
149
|
+
press: this._onBtnPressed.bind(this),
|
|
142
150
|
width: "100%"
|
|
143
151
|
}));
|
|
144
152
|
|
|
@@ -148,9 +156,9 @@ sap.ui.define(["sap/ui/thirdparty/jquery", './BarcodeScanner', './library', 'sap
|
|
|
148
156
|
|
|
149
157
|
BarcodeScannerButton.prototype._onBtnPressed = function (oEvent) {
|
|
150
158
|
BarcodeScanner.scan(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
159
|
+
this._onScanSuccess.bind(this),
|
|
160
|
+
this._onScanFail.bind(this),
|
|
161
|
+
this._onInputLiveUpdate.bind(this),
|
|
154
162
|
this.getProperty("dialogTitle"),
|
|
155
163
|
this.getProperty("preferFrontCamera"),
|
|
156
164
|
this.getProperty("frameRate"),
|
|
@@ -11,7 +11,9 @@ sap.ui.define([],
|
|
|
11
11
|
* BarcodeScannerButton renderer.
|
|
12
12
|
* @namespace
|
|
13
13
|
*/
|
|
14
|
-
var BarcodeScannerButtonRenderer = {
|
|
14
|
+
var BarcodeScannerButtonRenderer = {
|
|
15
|
+
apiVersion: 2
|
|
16
|
+
};
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* Renders the HTML for the given control, using the provided {@link sap.ui.core.RenderManager}.
|
|
@@ -23,20 +25,14 @@ sap.ui.define([],
|
|
|
23
25
|
*/
|
|
24
26
|
BarcodeScannerButtonRenderer.render = function(oRm, oControl) {
|
|
25
27
|
|
|
26
|
-
if (!oControl.getVisible()) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
28
|
//we need this additional wrapping element to be able to control this button from our controller.
|
|
30
|
-
oRm.
|
|
31
|
-
oRm.writeControlData(oControl);
|
|
29
|
+
oRm.openStart("span", oControl);
|
|
32
30
|
// we need to change the containing span tag's width instead of the button
|
|
33
|
-
oRm.
|
|
34
|
-
oRm.
|
|
35
|
-
oRm.
|
|
36
|
-
oRm.writeClasses();
|
|
37
|
-
oRm.write(">");
|
|
31
|
+
oRm.style("display", "inline-block");
|
|
32
|
+
oRm.style("width", oControl.getWidth());
|
|
33
|
+
oRm.openEnd();
|
|
38
34
|
oRm.renderControl(oControl.getAggregation("_btn"));
|
|
39
|
-
oRm.
|
|
35
|
+
oRm.close("span");
|
|
40
36
|
};
|
|
41
37
|
|
|
42
38
|
|
package/src/sap/ndc/library.js
CHANGED
|
@@ -6,8 +6,11 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* Initialization Code and shared classes of library sap.ndc.
|
|
8
8
|
*/
|
|
9
|
-
sap.ui.define([
|
|
10
|
-
|
|
9
|
+
sap.ui.define([
|
|
10
|
+
'sap/m/library', // library dependency
|
|
11
|
+
'sap/ui/core/Core', // provides sap.ui.getCore()
|
|
12
|
+
'sap/ui/core/library' // library dependency
|
|
13
|
+
], function() {
|
|
11
14
|
"use strict";
|
|
12
15
|
|
|
13
16
|
|
|
@@ -24,11 +27,12 @@ sap.ui.define(['sap/m/library', 'sap/ui/core/library'],
|
|
|
24
27
|
types: [],
|
|
25
28
|
interfaces: [],
|
|
26
29
|
controls: [
|
|
27
|
-
"sap.ndc.BarcodeScannerButton"
|
|
30
|
+
"sap.ndc.BarcodeScannerButton",
|
|
31
|
+
"sap.ndc.BarcodeScannerUIContainer" // private
|
|
28
32
|
],
|
|
29
33
|
elements: [],
|
|
30
34
|
noLibraryCSS: true,
|
|
31
|
-
version: "1.
|
|
35
|
+
version: "1.108.0"
|
|
32
36
|
});
|
|
33
37
|
|
|
34
38
|
return thisLib;
|