@cniot/android-pda-components 0.2.29 → 0.2.30

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/es/index.es.js ADDED
@@ -0,0 +1,2198 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ var __publicField = (obj, key, value) => {
33
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
34
+ return value;
35
+ };
36
+ import React, { useState, useEffect, useRef, cloneElement, useCallback } from "react";
37
+ import ReactDOM from "react-dom";
38
+ var global = "";
39
+ var classnames = { exports: {} };
40
+ /*!
41
+ Copyright (c) 2018 Jed Watson.
42
+ Licensed under the MIT License (MIT), see
43
+ http://jedwatson.github.io/classnames
44
+ */
45
+ (function(module) {
46
+ (function() {
47
+ var hasOwn = {}.hasOwnProperty;
48
+ function classNames2() {
49
+ var classes = [];
50
+ for (var i = 0; i < arguments.length; i++) {
51
+ var arg = arguments[i];
52
+ if (!arg)
53
+ continue;
54
+ var argType = typeof arg;
55
+ if (argType === "string" || argType === "number") {
56
+ classes.push(arg);
57
+ } else if (Array.isArray(arg)) {
58
+ if (arg.length) {
59
+ var inner = classNames2.apply(null, arg);
60
+ if (inner) {
61
+ classes.push(inner);
62
+ }
63
+ }
64
+ } else if (argType === "object") {
65
+ if (arg.toString === Object.prototype.toString) {
66
+ for (var key in arg) {
67
+ if (hasOwn.call(arg, key) && arg[key]) {
68
+ classes.push(key);
69
+ }
70
+ }
71
+ } else {
72
+ classes.push(arg.toString());
73
+ }
74
+ }
75
+ }
76
+ return classes.join(" ");
77
+ }
78
+ if (module.exports) {
79
+ classNames2.default = classNames2;
80
+ module.exports = classNames2;
81
+ } else {
82
+ window.classNames = classNames2;
83
+ }
84
+ })();
85
+ })(classnames);
86
+ var classNames = classnames.exports;
87
+ var index$u = "";
88
+ function getTypeClass$2(type) {
89
+ return {
90
+ "center": "op-overlay center",
91
+ "top": "op-overlay top",
92
+ "bottom": "op-overlay bottom"
93
+ }[type] || "op-overlay";
94
+ }
95
+ function Overlay$1(props) {
96
+ const { verticalPosition = "center", visible = true, closable = false, onClosed = () => {
97
+ } } = props;
98
+ const [hidden, setHidden] = useState(!visible);
99
+ useEffect(() => {
100
+ setHidden(!visible);
101
+ }, [visible]);
102
+ const option = {};
103
+ if (closable) {
104
+ option.onClick = (e) => {
105
+ setHidden(true);
106
+ onClosed();
107
+ };
108
+ }
109
+ useEffect(() => {
110
+ setHidden(!visible);
111
+ }, [visible]);
112
+ return !hidden ? /* @__PURE__ */ React.createElement("div", __spreadValues({
113
+ className: getTypeClass$2(verticalPosition)
114
+ }, option), props.children) : null;
115
+ }
116
+ var index$t = "";
117
+ const blankFunc$6 = () => {
118
+ };
119
+ class PdaTitle extends React.Component {
120
+ constructor(props) {
121
+ super(props);
122
+ __publicField(this, "state", {
123
+ showMenu: false
124
+ });
125
+ }
126
+ render() {
127
+ const { className, goBack = true, goBackHandle = blankFunc$6, icon = "scan", title = "\u4EFB\u52A1", menuList = null } = this.props;
128
+ const { showMenu } = this.state;
129
+ return /* @__PURE__ */ React.createElement("div", {
130
+ className: classNames({ [className]: true, "pda-header": true })
131
+ }, /* @__PURE__ */ React.createElement("div", {
132
+ className: "header-click-area",
133
+ onClick: goBack ? goBackHandle : blankFunc$6
134
+ }, goBack && /* @__PURE__ */ React.createElement("div", {
135
+ className: "pda-goback"
136
+ }), icon && /* @__PURE__ */ React.createElement("div", {
137
+ className: classNames({ "pda-header-icon": true, ["pda-header-icon-" + icon]: true })
138
+ })), /* @__PURE__ */ React.createElement("p", {
139
+ className: classNames({ "pda-title-text": true })
140
+ }, title), menuList ? /* @__PURE__ */ React.createElement("div", {
141
+ className: "pda-header-more",
142
+ onClick: (e) => {
143
+ this.setState({ showMenu: true });
144
+ }
145
+ }) : null, /* @__PURE__ */ React.createElement(Overlay$1, {
146
+ visible: showMenu,
147
+ verticalPosition: "bottom",
148
+ closable: true,
149
+ onClosed: (e) => this.setState({ showMenu: false })
150
+ }, /* @__PURE__ */ React.createElement("div", {
151
+ className: "pda-menus"
152
+ }, menuList)));
153
+ }
154
+ }
155
+ var keycode$1 = { exports: {} };
156
+ (function(module, exports) {
157
+ function keyCode(searchInput) {
158
+ if (searchInput && typeof searchInput === "object") {
159
+ var hasKeyCode = searchInput.which || searchInput.keyCode || searchInput.charCode;
160
+ if (hasKeyCode)
161
+ searchInput = hasKeyCode;
162
+ }
163
+ if (typeof searchInput === "number")
164
+ return names[searchInput];
165
+ var search = String(searchInput);
166
+ var foundNamedKey = codes[search.toLowerCase()];
167
+ if (foundNamedKey)
168
+ return foundNamedKey;
169
+ var foundNamedKey = aliases[search.toLowerCase()];
170
+ if (foundNamedKey)
171
+ return foundNamedKey;
172
+ if (search.length === 1)
173
+ return search.charCodeAt(0);
174
+ return void 0;
175
+ }
176
+ keyCode.isEventKey = function isEventKey(event, nameOrCode) {
177
+ if (event && typeof event === "object") {
178
+ var keyCode2 = event.which || event.keyCode || event.charCode;
179
+ if (keyCode2 === null || keyCode2 === void 0) {
180
+ return false;
181
+ }
182
+ if (typeof nameOrCode === "string") {
183
+ var foundNamedKey = codes[nameOrCode.toLowerCase()];
184
+ if (foundNamedKey) {
185
+ return foundNamedKey === keyCode2;
186
+ }
187
+ var foundNamedKey = aliases[nameOrCode.toLowerCase()];
188
+ if (foundNamedKey) {
189
+ return foundNamedKey === keyCode2;
190
+ }
191
+ } else if (typeof nameOrCode === "number") {
192
+ return nameOrCode === keyCode2;
193
+ }
194
+ return false;
195
+ }
196
+ };
197
+ exports = module.exports = keyCode;
198
+ var codes = exports.code = exports.codes = {
199
+ "backspace": 8,
200
+ "tab": 9,
201
+ "enter": 13,
202
+ "shift": 16,
203
+ "ctrl": 17,
204
+ "alt": 18,
205
+ "pause/break": 19,
206
+ "caps lock": 20,
207
+ "esc": 27,
208
+ "space": 32,
209
+ "page up": 33,
210
+ "page down": 34,
211
+ "end": 35,
212
+ "home": 36,
213
+ "left": 37,
214
+ "up": 38,
215
+ "right": 39,
216
+ "down": 40,
217
+ "insert": 45,
218
+ "delete": 46,
219
+ "command": 91,
220
+ "left command": 91,
221
+ "right command": 93,
222
+ "numpad *": 106,
223
+ "numpad +": 107,
224
+ "numpad -": 109,
225
+ "numpad .": 110,
226
+ "numpad /": 111,
227
+ "num lock": 144,
228
+ "scroll lock": 145,
229
+ "my computer": 182,
230
+ "my calculator": 183,
231
+ ";": 186,
232
+ "=": 187,
233
+ ",": 188,
234
+ "-": 189,
235
+ ".": 190,
236
+ "/": 191,
237
+ "`": 192,
238
+ "[": 219,
239
+ "\\": 220,
240
+ "]": 221,
241
+ "'": 222
242
+ };
243
+ var aliases = exports.aliases = {
244
+ "windows": 91,
245
+ "\u21E7": 16,
246
+ "\u2325": 18,
247
+ "\u2303": 17,
248
+ "\u2318": 91,
249
+ "ctl": 17,
250
+ "control": 17,
251
+ "option": 18,
252
+ "pause": 19,
253
+ "break": 19,
254
+ "caps": 20,
255
+ "return": 13,
256
+ "escape": 27,
257
+ "spc": 32,
258
+ "spacebar": 32,
259
+ "pgup": 33,
260
+ "pgdn": 34,
261
+ "ins": 45,
262
+ "del": 46,
263
+ "cmd": 91
264
+ };
265
+ /*!
266
+ * Programatically add the following
267
+ */
268
+ for (i = 97; i < 123; i++)
269
+ codes[String.fromCharCode(i)] = i - 32;
270
+ for (var i = 48; i < 58; i++)
271
+ codes[i - 48] = i;
272
+ for (i = 1; i < 13; i++)
273
+ codes["f" + i] = i + 111;
274
+ for (i = 0; i < 10; i++)
275
+ codes["numpad " + i] = i + 96;
276
+ var names = exports.names = exports.title = {};
277
+ for (i in codes)
278
+ names[codes[i]] = i;
279
+ for (var alias in aliases) {
280
+ codes[alias] = aliases[alias];
281
+ }
282
+ })(keycode$1, keycode$1.exports);
283
+ var keycode = keycode$1.exports;
284
+ var index$s = "";
285
+ function Button(props) {
286
+ const { type = "default", onClick, className = "", tabIndex = 1, dataClick = "" } = props;
287
+ let opt = {};
288
+ if (dataClick) {
289
+ opt["data-click"] = dataClick;
290
+ }
291
+ return /* @__PURE__ */ React.createElement("button", __spreadValues({
292
+ className: `pda-button pda-button-${type} ${className}`,
293
+ onClick,
294
+ tabIndex
295
+ }, opt), props.children);
296
+ }
297
+ function ButtonGroup(props) {
298
+ return /* @__PURE__ */ React.createElement("div", {
299
+ className: "button-group"
300
+ }, props.children);
301
+ }
302
+ Button.Group = ButtonGroup;
303
+ var index$r = "";
304
+ const SPECIAL_KEY_MAP = ["fn"];
305
+ const empty$3 = () => {
306
+ };
307
+ function index$q(props) {
308
+ const {
309
+ onBack,
310
+ icon,
311
+ title,
312
+ menus = [],
313
+ onClickMenuItem = empty$3,
314
+ onScanBarcode,
315
+ cancelMenuText,
316
+ menuShortcutKey,
317
+ backShortcutKey
318
+ } = props;
319
+ const [showMenus, setShowMenus] = React.useState(false);
320
+ React.useEffect(function() {
321
+ if (menuShortcutKey) {
322
+ return bindShortcutKey(getShortcutKeyCodes(menuShortcutKey), function() {
323
+ setShowMenus(true);
324
+ });
325
+ }
326
+ }, [menuShortcutKey]);
327
+ React.useEffect(function() {
328
+ if (backShortcutKey && onBack) {
329
+ return bindShortcutKey(getShortcutKeyCodes(backShortcutKey), function() {
330
+ onBack("back");
331
+ });
332
+ }
333
+ }, [backShortcutKey, onBack]);
334
+ React.useEffect(() => {
335
+ return onKeyBoradBack(function() {
336
+ onBack && onBack("back");
337
+ });
338
+ }, []);
339
+ React.useEffect(() => {
340
+ return addEventListener(document, "BarcodeScan", function(e) {
341
+ onScanBarcode && onScanBarcode(e.param.scanData);
342
+ });
343
+ }, [onScanBarcode]);
344
+ return /* @__PURE__ */ React.createElement("div", {
345
+ className: "pda-header"
346
+ }, /* @__PURE__ */ React.createElement("div", {
347
+ className: "header-click-area"
348
+ }, onBack ? /* @__PURE__ */ React.createElement("div", {
349
+ className: "pda-goback",
350
+ onClick: () => onBack("back")
351
+ }) : null, icon && /* @__PURE__ */ React.createElement("div", {
352
+ className: `pda-header-icon pda-header-icon-${icon}`
353
+ })), /* @__PURE__ */ React.createElement("div", {
354
+ className: "pda-title-text"
355
+ }, title), menus && menus.length ? /* @__PURE__ */ React.createElement("div", {
356
+ className: "pda-header-more",
357
+ onClick: () => setShowMenus(true)
358
+ }) : null, /* @__PURE__ */ React.createElement(Overlay$1, {
359
+ visible: showMenus,
360
+ verticalPosition: "bottom",
361
+ closable: false,
362
+ onClosed: () => setShowMenus(false)
363
+ }, /* @__PURE__ */ React.createElement("div", {
364
+ className: "pda-menus"
365
+ }, menus.map((item, index2) => {
366
+ return /* @__PURE__ */ React.createElement(Button, {
367
+ onClick: () => {
368
+ setShowMenus(false);
369
+ onClickMenuItem(item);
370
+ },
371
+ key: item.key || index2
372
+ }, item.label);
373
+ }), cancelMenuText ? /* @__PURE__ */ React.createElement("div", {
374
+ style: { marginTop: 20 }
375
+ }, /* @__PURE__ */ React.createElement(Button, {
376
+ onClick: () => setShowMenus(false)
377
+ }, cancelMenuText)) : null)));
378
+ }
379
+ function getShortcutKeyCodes(shortcutKey) {
380
+ const shortcutKeys = shortcutKey.indexOf(",") > -1 ? shortcutKey.split(",") : [shortcutKey];
381
+ return shortcutKeys.map((k) => {
382
+ if (SPECIAL_KEY_MAP.indexOf(k.toLowerCase()) > -1) {
383
+ return k.toLowerCase();
384
+ }
385
+ const kc = keycode(k);
386
+ if (kc === void 0) {
387
+ console.warn("OPButton.shortcutKey error key value by:", k);
388
+ }
389
+ return kc;
390
+ }).filter((k) => k !== void 0);
391
+ }
392
+ function bindShortcutKey(keys, callback) {
393
+ function keyUpCallback(event) {
394
+ const key = event.key.toLowerCase();
395
+ const keyCode = SPECIAL_KEY_MAP.indexOf(key) > -1 ? key : event.keyCode;
396
+ if (keys.indexOf(keyCode) > -1) {
397
+ callback && callback(event);
398
+ }
399
+ }
400
+ document.addEventListener("keyup", keyUpCallback);
401
+ return function() {
402
+ document.removeEventListener("keyup", keyUpCallback);
403
+ };
404
+ }
405
+ function onKeyBoradBack(fn) {
406
+ function keyPressed(data) {
407
+ if (data.param.originValue == "back") {
408
+ fn && fn();
409
+ }
410
+ }
411
+ document.addEventListener("keyPressed", keyPressed, false);
412
+ return function() {
413
+ document.removeEventListener("keyPressed", keyPressed);
414
+ };
415
+ }
416
+ function addEventListener(node, eventName, fn) {
417
+ node.addEventListener(eventName, fn, false);
418
+ return function() {
419
+ node.removeEventListener(eventName, fn);
420
+ };
421
+ }
422
+ var index$p = "";
423
+ class PdaInfoCard$2 extends React.Component {
424
+ constructor(props) {
425
+ super(props);
426
+ }
427
+ render() {
428
+ const { className = "", title, highlightInfo, subTitle, subHighlightInfo, subHighlightSubInfo, infoImage, tagText, highlightInfoCN, highlightSubInfo, percentage, highlightSubInfoCN, boldInfo, infoList = [], style = {}, theme = "light" } = this.props;
429
+ return /* @__PURE__ */ React.createElement("div", {
430
+ className: classNames({ [className]: true, "pda-info-card": true, "pda-info-card-dark": theme === "dark" }),
431
+ style
432
+ }, /* @__PURE__ */ React.createElement("div", {
433
+ className: "pda-info-card-title-section"
434
+ }, /* @__PURE__ */ React.createElement("div", {
435
+ className: "pda-info-card-title"
436
+ }, title), tagText ? /* @__PURE__ */ React.createElement("div", {
437
+ className: "pda-info-card-tag"
438
+ }, /* @__PURE__ */ React.createElement("div", {
439
+ className: "pda-info-card-tag-text"
440
+ }, tagText)) : null), /* @__PURE__ */ React.createElement("div", {
441
+ className: "pda-info-card-highlight-section"
442
+ }, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", {
443
+ className: "pda-info-card-highlight"
444
+ }, /* @__PURE__ */ React.createElement("span", {
445
+ className: "pda-info-card-highlight1"
446
+ }, highlightInfo), /* @__PURE__ */ React.createElement("span", {
447
+ className: "pda-info-card-highlight1CN"
448
+ }, highlightInfoCN), /* @__PURE__ */ React.createElement("span", {
449
+ className: "pda-info-card-highlight2"
450
+ }, highlightSubInfo), /* @__PURE__ */ React.createElement("span", {
451
+ className: "pda-info-card-highlight2CN"
452
+ }, highlightSubInfoCN)), subTitle ? /* @__PURE__ */ React.createElement("div", {
453
+ className: "pda-info-card-title"
454
+ }, subTitle) : null, subHighlightInfo ? /* @__PURE__ */ React.createElement("div", {
455
+ className: "pda-info-card-highlight"
456
+ }, /* @__PURE__ */ React.createElement("span", {
457
+ className: "pda-info-card-highlight1"
458
+ }, subHighlightInfo), /* @__PURE__ */ React.createElement("span", {
459
+ className: "pda-info-card-highlight2"
460
+ }, subHighlightSubInfo)) : null), infoImage ? /* @__PURE__ */ React.createElement("img", {
461
+ src: infoImage,
462
+ width: 150,
463
+ height: 150
464
+ }) : null), percentage !== void 0 ? /* @__PURE__ */ React.createElement("div", {
465
+ className: "pda-info-card-progress"
466
+ }, /* @__PURE__ */ React.createElement("div", {
467
+ className: "pda-info-card-progress-inside",
468
+ style: { width: `${percentage * 100}%` }
469
+ })) : null, /* @__PURE__ */ React.createElement("div", {
470
+ className: "pda-info-card-bold"
471
+ }, boldInfo), infoList.map((item, index2) => {
472
+ return /* @__PURE__ */ React.createElement("div", {
473
+ key: index2,
474
+ className: "pda-info-card-list"
475
+ }, /* @__PURE__ */ React.createElement("span", null, item.label || ""), "\xA0\xA0", /* @__PURE__ */ React.createElement("span", null, item.content || ""));
476
+ }));
477
+ }
478
+ }
479
+ PdaInfoCard$2.IMAGE_1 = "https://img.alicdn.com/imgextra/i2/O1CN01qYuxip1ME9zhdL9XG_!!6000000001402-2-tps-150-150.png";
480
+ var index$o = "";
481
+ class PdaListItem extends React.Component {
482
+ constructor(props) {
483
+ super(props);
484
+ }
485
+ render() {
486
+ const { className, header, onClick = () => {
487
+ }, onHeightLightClick = () => {
488
+ }, onIconClick = () => {
489
+ }, highlightText, highlightSubText, stateTextList = [], stateList = [], subInfoList = [], style = {}, icon } = this.props;
490
+ return /* @__PURE__ */ React.createElement("div", {
491
+ className: classNames({ [className]: true, "pda-list-item": true }),
492
+ style,
493
+ onClick
494
+ }, !!header ? /* @__PURE__ */ React.createElement("div", {
495
+ className: "pda-listitem-header"
496
+ }, header) : null, /* @__PURE__ */ React.createElement("div", {
497
+ onClick: onHeightLightClick,
498
+ className: classNames({ "pda-listitem-highlight": true })
499
+ }, /* @__PURE__ */ React.createElement("div", null, highlightText), /* @__PURE__ */ React.createElement("div", null, highlightSubText)), /* @__PURE__ */ React.createElement("div", {
500
+ className: "pda-listitem-state-text"
501
+ }, stateTextList.map((item, index2) => {
502
+ return /* @__PURE__ */ React.createElement("span", {
503
+ key: index2
504
+ }, item.label || "", "\uFF5C");
505
+ })), /* @__PURE__ */ React.createElement("div", {
506
+ className: "pda-listitem-state-block"
507
+ }, stateList.map((item, index2) => {
508
+ const type = item && item.type ? item.type : "default";
509
+ return /* @__PURE__ */ React.createElement("div", {
510
+ key: index2,
511
+ className: type
512
+ }, item.label || "");
513
+ })), icon ? /* @__PURE__ */ React.createElement("div", {
514
+ onClick: onIconClick,
515
+ className: "pda-listitem-icon"
516
+ }, /* @__PURE__ */ React.createElement("div", {
517
+ className: classNames({ "listitem-icon-container": true, ["listitem-icon-" + icon]: true })
518
+ })) : null, subInfoList.map((item, index2) => {
519
+ return /* @__PURE__ */ React.createElement("div", {
520
+ key: index2,
521
+ className: "pda-listitem-subinfo"
522
+ }, /* @__PURE__ */ React.createElement("span", null, item.label || ""), "\xA0\xA0", /* @__PURE__ */ React.createElement("span", null, item.content || ""));
523
+ }));
524
+ }
525
+ }
526
+ var index$n = "";
527
+ function empty$2() {
528
+ }
529
+ function Confirm(props) {
530
+ const { title = "title", message = null, subMessage = [], okText = "okText", cancelText = null, okDataClick = null, cancelDataClick = null, onClick = empty$2, type = "primary", insertButtons = [], appendButtons = [] } = props;
531
+ return /* @__PURE__ */ React.createElement("div", {
532
+ className: classNames({ "confirm-wrap": true, ["confirm-" + type]: true })
533
+ }, /* @__PURE__ */ React.createElement("div", {
534
+ className: "confirm-content"
535
+ }, /* @__PURE__ */ React.createElement("div", {
536
+ className: "confirm-title"
537
+ }, title), message ? /* @__PURE__ */ React.createElement("div", {
538
+ className: "confirm-message"
539
+ }, message) : null, subMessage.length ? /* @__PURE__ */ React.createElement("div", {
540
+ className: "confirm-sub-message"
541
+ }, subMessage.map((item, index2) => {
542
+ const { label, content } = item;
543
+ return /* @__PURE__ */ React.createElement("div", {
544
+ className: "confirm-sub-block",
545
+ key: label ? label : index2
546
+ }, /* @__PURE__ */ React.createElement("p", {
547
+ className: "confirm-sub-label"
548
+ }, label ? label + " : " : ""), /* @__PURE__ */ React.createElement("p", {
549
+ className: "confirm-sub-content"
550
+ }, content || ""));
551
+ })) : null), /* @__PURE__ */ React.createElement("div", {
552
+ className: "confirm-btns"
553
+ }, insertButtons.length > 0 ? /* @__PURE__ */ React.createElement(Button.Group, null, insertButtons.map((item, index2) => /* @__PURE__ */ React.createElement(Button, {
554
+ key: index2,
555
+ onClick: () => onClick(item.value),
556
+ dataClick: item.dataClick
557
+ }, item.label))) : null, /* @__PURE__ */ React.createElement(Button.Group, null, cancelText ? /* @__PURE__ */ React.createElement(Button, {
558
+ className: "confirm-cancel-button",
559
+ onClick: () => onClick(false),
560
+ dataClick: cancelDataClick
561
+ }, cancelText) : null, /* @__PURE__ */ React.createElement(Button, {
562
+ type: "primary",
563
+ onClick: () => onClick(true),
564
+ dataClick: okDataClick
565
+ }, okText)), appendButtons.length > 0 ? /* @__PURE__ */ React.createElement(Button.Group, null, appendButtons.map((item, index2) => /* @__PURE__ */ React.createElement(Button, {
566
+ key: index2,
567
+ onClick: () => onClick(item.value),
568
+ dataClick: item.dataClick
569
+ }, item.label))) : null));
570
+ }
571
+ var index$m = "";
572
+ function WindVaneLog(param) {
573
+ const params = {
574
+ domain: "logger",
575
+ method: "deviceLog",
576
+ params: param
577
+ };
578
+ WindVane.call("WindvanePlugin", "invoke", JSON.stringify(params), function(e) {
579
+ }, function(e) {
580
+ });
581
+ }
582
+ function resolveContainer(getContainer) {
583
+ const container = typeof getContainer === "function" ? getContainer() : getContainer;
584
+ return container || document.body;
585
+ }
586
+ function isUndefined(v) {
587
+ return v === void 0;
588
+ }
589
+ function mergeProps(...items) {
590
+ function customizer(objValue, srcValue) {
591
+ return isUndefined(srcValue) ? objValue : srcValue;
592
+ }
593
+ let ret = Object.assign({}, items[0]);
594
+ for (let i = 1; i < items.length; i++) {
595
+ ret = Object.assign(ret, items[i], customizer);
596
+ }
597
+ return ret;
598
+ }
599
+ function playSound(sound) {
600
+ if (window.WindVane) {
601
+ var params = {
602
+ domain: "audio",
603
+ method: "playSound",
604
+ params: { sound }
605
+ };
606
+ WindVane.call("WindvanePlugin", "invoke", JSON.stringify(params));
607
+ }
608
+ }
609
+ function getTypeClass$1(type) {
610
+ return {
611
+ "success": "toast-wrap success",
612
+ "warning": "toast-wrap warning",
613
+ "error": "toast-wrap error"
614
+ }[type] || "toast-wrap";
615
+ }
616
+ function Toast(props) {
617
+ const { title = "title", message = "message", type = "success", duration = null } = props;
618
+ const [hidden, setHidden] = useState(false);
619
+ useEffect(() => {
620
+ if (window.WindVane) {
621
+ if (type === "warning") {
622
+ playSound("error1");
623
+ window.WindVane.call("WVMotion", "vibrate", { duration: 400 });
624
+ } else if (type === "error") {
625
+ playSound("error2");
626
+ window.WindVane.call("WVMotion", "vibrate", { duration: 200 });
627
+ setTimeout(() => {
628
+ window.WindVane.call("WVMotion", "vibrate", { duration: 300 });
629
+ }, 250);
630
+ }
631
+ }
632
+ }, []);
633
+ if (duration) {
634
+ setTimeout(() => {
635
+ setHidden(true);
636
+ }, duration);
637
+ }
638
+ return !hidden ? /* @__PURE__ */ React.createElement("div", {
639
+ className: getTypeClass$1(type)
640
+ }, /* @__PURE__ */ React.createElement("div", {
641
+ className: "toast-title"
642
+ }, title), /* @__PURE__ */ React.createElement("div", {
643
+ className: "toast-message"
644
+ }, message)) : null;
645
+ }
646
+ const defaultProps$1 = {
647
+ maskClickable: true,
648
+ stopPropagation: ["click"]
649
+ };
650
+ const InternalToast = (p) => {
651
+ const props = mergeProps(defaultProps$1, p);
652
+ const { maskClickable, content, icon, position, title, message, type, visible } = props;
653
+ return /* @__PURE__ */ React.createElement(Overlay$1, {
654
+ visible,
655
+ verticalPosition: "bottom",
656
+ closable: true
657
+ }, /* @__PURE__ */ React.createElement(Toast, {
658
+ title,
659
+ message,
660
+ type
661
+ }));
662
+ };
663
+ const containers = [];
664
+ function unmount(container) {
665
+ const unmountResult = ReactDOM.unmountComponentAtNode(container);
666
+ if (unmountResult && container.parentNode) {
667
+ container.parentNode.removeChild(container);
668
+ }
669
+ }
670
+ const defaultProps = {
671
+ duration: 2e3
672
+ };
673
+ function show(p) {
674
+ const props = mergeProps(defaultProps, p);
675
+ let timer = 0;
676
+ const { getContainer = () => document.body } = props;
677
+ const container = document.createElement("div");
678
+ const bodyContainer = resolveContainer(getContainer);
679
+ bodyContainer.appendChild(container);
680
+ clear();
681
+ containers.push(container);
682
+ function TempToast() {
683
+ const [visible, setVisible] = useState(true);
684
+ useEffect(() => {
685
+ return () => {
686
+ props.afterClose && props.afterClose();
687
+ };
688
+ }, []);
689
+ useEffect(() => {
690
+ if (props.duration === 0) {
691
+ return;
692
+ }
693
+ timer = window.setTimeout(() => {
694
+ setVisible(false);
695
+ }, props.duration);
696
+ return () => {
697
+ window.clearTimeout(timer);
698
+ };
699
+ }, []);
700
+ return /* @__PURE__ */ React.createElement(InternalToast, __spreadProps(__spreadValues({}, props), {
701
+ getContainer: () => container,
702
+ visible,
703
+ afterClose: () => {
704
+ unmount(container);
705
+ }
706
+ }));
707
+ }
708
+ ReactDOM.render(/* @__PURE__ */ React.createElement(TempToast, null), container);
709
+ }
710
+ function clear() {
711
+ while (true) {
712
+ const container = containers.pop();
713
+ if (!container)
714
+ break;
715
+ unmount(container);
716
+ }
717
+ }
718
+ Toast.show = show;
719
+ Toast.clear = clear;
720
+ function Alert(props) {
721
+ const { service, data = {} } = props;
722
+ const onClickCallback = React.useCallback(function() {
723
+ service.onNext(true);
724
+ }, [service]);
725
+ return /* @__PURE__ */ React.createElement(Overlay$1, {
726
+ verticalPosition: "bottom"
727
+ }, /* @__PURE__ */ React.createElement(Confirm, __spreadProps(__spreadValues({}, data), {
728
+ onClick: onClickCallback
729
+ })));
730
+ }
731
+ function Start(props) {
732
+ const { action, appManager, service } = props;
733
+ const onReStart = React.useCallback(function() {
734
+ service.onStart(appManager.config.appId);
735
+ });
736
+ return /* @__PURE__ */ React.createElement("div", {
737
+ style: {
738
+ display: "flex",
739
+ flexDirection: "column",
740
+ justifyContent: "center",
741
+ alignItems: "center",
742
+ width: "100vw",
743
+ height: "100vh"
744
+ }
745
+ }, /* @__PURE__ */ React.createElement(Button, {
746
+ type: "primary",
747
+ onClick: onReStart
748
+ }, "\u5F00\u59CB\u4F5C\u4E1A"), /* @__PURE__ */ React.createElement("br", null), /* @__PURE__ */ React.createElement("div", null, appManager.config.appId), /* @__PURE__ */ React.createElement("div", null, appManager.config.groupId));
749
+ }
750
+ function confirm(props) {
751
+ const { service, data = {} } = props;
752
+ const onClickCallback = React.useCallback(function(v) {
753
+ service.onNext(v);
754
+ }, [service]);
755
+ return /* @__PURE__ */ React.createElement(Overlay$1, {
756
+ verticalPosition: "bottom"
757
+ }, /* @__PURE__ */ React.createElement(Confirm, __spreadProps(__spreadValues({}, data), {
758
+ onClick: onClickCallback
759
+ })));
760
+ }
761
+ var index$l = "";
762
+ function getTypeClass(type) {
763
+ return {
764
+ "center": "op-overlay center",
765
+ "top": "op-overlay top",
766
+ "bottom": "op-overlay bottom"
767
+ }[type] || "op-overlay";
768
+ }
769
+ function Overlay(props) {
770
+ const { verticalPosition = "center", visible = true, closable = false, onClosed = () => {
771
+ } } = props;
772
+ const [hidden, setHidden] = useState(!visible);
773
+ useEffect(() => {
774
+ setHidden(!visible);
775
+ }, [visible]);
776
+ const option = {};
777
+ if (closable) {
778
+ option.onClick = (e) => {
779
+ setHidden(true);
780
+ onClosed();
781
+ };
782
+ }
783
+ useEffect(() => {
784
+ setHidden(!visible);
785
+ }, [visible]);
786
+ return !hidden ? /* @__PURE__ */ React.createElement("div", __spreadValues({
787
+ className: getTypeClass(verticalPosition)
788
+ }, option), props.children) : null;
789
+ }
790
+ var index$k = "";
791
+ function Prompt(props) {
792
+ const inputRef = React.useRef();
793
+ const { data = {}, onNext } = props;
794
+ const { placeholder, defaultValue, title = "\u8BF7\u8F93\u5165", type = "text", okText = "\u786E\u8BA4", cancelText = "\u53D6\u6D88" } = data;
795
+ return /* @__PURE__ */ React.createElement(Overlay, {
796
+ verticalPosition: "center",
797
+ closable: false
798
+ }, /* @__PURE__ */ React.createElement("div", {
799
+ className: "prompt-dialog"
800
+ }, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("h1", {
801
+ className: "prompt-title"
802
+ }, title), /* @__PURE__ */ React.createElement("input", {
803
+ className: "prompt-input",
804
+ autoFocus: true,
805
+ ref: inputRef,
806
+ placeholder,
807
+ type,
808
+ defaultValue,
809
+ onKeyUp: (e) => {
810
+ if (e.keyCode === 13) {
811
+ onNext(getInputValue(inputRef.current));
812
+ }
813
+ }
814
+ }), /* @__PURE__ */ React.createElement("div", {
815
+ className: "prompt-btns"
816
+ }, cancelText ? /* @__PURE__ */ React.createElement(Button, {
817
+ onClick: () => onNext("back")
818
+ }, cancelText) : null, /* @__PURE__ */ React.createElement(Button, {
819
+ type: "primary",
820
+ onClick: () => {
821
+ onNext(getInputValue(inputRef.current));
822
+ }
823
+ }, okText)))));
824
+ }
825
+ function getInputValue(input) {
826
+ const value = input.value || "";
827
+ return String(value).trim();
828
+ }
829
+ function toast(props) {
830
+ const { data = {}, onNext, service } = props;
831
+ const { title, level, message, duration = null } = data;
832
+ const [hidden, setHidden] = useState(false);
833
+ React.useEffect(() => {
834
+ if (data.hasNext === void 0) {
835
+ onNext("");
836
+ }
837
+ let timeout = null;
838
+ if (duration) {
839
+ timeout = setTimeout(() => {
840
+ setHidden(true);
841
+ }, duration);
842
+ }
843
+ return () => {
844
+ clearTimeout(timeout);
845
+ };
846
+ }, [data]);
847
+ return !hidden ? /* @__PURE__ */ React.createElement(Overlay$1, {
848
+ verticalPosition: "bottom"
849
+ }, /* @__PURE__ */ React.createElement("div", {
850
+ style: { width: "90%" }
851
+ }, /* @__PURE__ */ React.createElement(Toast, {
852
+ type: level,
853
+ title,
854
+ message: splitMessage(message)
855
+ }))) : null;
856
+ }
857
+ function splitMessage(message) {
858
+ var msg = String(message).split("by Error:");
859
+ return msg[1] || msg[0];
860
+ }
861
+ var index$j = "";
862
+ function NotFound(props) {
863
+ return /* @__PURE__ */ React.createElement("div", {
864
+ style: { padding: "20%" }
865
+ }, /* @__PURE__ */ React.createElement("h1", null, "404 ", /* @__PURE__ */ React.createElement("small", {
866
+ style: { fontSize: "60%" }
867
+ }, "Not found")), /* @__PURE__ */ React.createElement("div", null, props.action.getPage()));
868
+ }
869
+ function _extends() {
870
+ _extends = Object.assign || function(target) {
871
+ for (var i = 1; i < arguments.length; i++) {
872
+ var source = arguments[i];
873
+ for (var key in source) {
874
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
875
+ target[key] = source[key];
876
+ }
877
+ }
878
+ }
879
+ return target;
880
+ };
881
+ return _extends.apply(this, arguments);
882
+ }
883
+ var r, B = r || (r = {});
884
+ B.Pop = "POP";
885
+ B.Push = "PUSH";
886
+ B.Replace = "REPLACE";
887
+ var C = function(b) {
888
+ return b;
889
+ };
890
+ function E(b) {
891
+ b.preventDefault();
892
+ b.returnValue = "";
893
+ }
894
+ function F() {
895
+ var b = [];
896
+ return { get length() {
897
+ return b.length;
898
+ }, push: function(h) {
899
+ b.push(h);
900
+ return function() {
901
+ b = b.filter(function(k) {
902
+ return k !== h;
903
+ });
904
+ };
905
+ }, call: function(h) {
906
+ b.forEach(function(k) {
907
+ return k && k(h);
908
+ });
909
+ } };
910
+ }
911
+ function H() {
912
+ return Math.random().toString(36).substr(2, 8);
913
+ }
914
+ function I(b) {
915
+ var h = b.pathname, k = b.search;
916
+ b = b.hash;
917
+ return (h === void 0 ? "/" : h) + (k === void 0 ? "" : k) + (b === void 0 ? "" : b);
918
+ }
919
+ function J(b) {
920
+ var h = {};
921
+ if (b) {
922
+ var k = b.indexOf("#");
923
+ 0 <= k && (h.hash = b.substr(k), b = b.substr(0, k));
924
+ k = b.indexOf("?");
925
+ 0 <= k && (h.search = b.substr(k), b = b.substr(0, k));
926
+ b && (h.pathname = b);
927
+ }
928
+ return h;
929
+ }
930
+ function createHashHistory(b) {
931
+ function h() {
932
+ var a = J(m.location.hash.substr(1)), e = a.pathname, l = a.search;
933
+ a = a.hash;
934
+ var g = u.state || {};
935
+ return [g.idx, C({ pathname: e === void 0 ? "/" : e, search: l === void 0 ? "" : l, hash: a === void 0 ? "" : a, state: g.usr || null, key: g.key || "default" })];
936
+ }
937
+ function k() {
938
+ if (t)
939
+ c.call(t), t = null;
940
+ else {
941
+ var a = r.Pop, e = h(), l = e[0];
942
+ e = e[1];
943
+ if (c.length)
944
+ if (l != null) {
945
+ var g = q - l;
946
+ g && (t = { action: a, location: e, retry: function() {
947
+ p(-1 * g);
948
+ } }, p(g));
949
+ } else
950
+ ;
951
+ else
952
+ A(a);
953
+ }
954
+ }
955
+ function x(a) {
956
+ var e = document.querySelector("base"), l = "";
957
+ e && e.getAttribute("href") && (e = m.location.href, l = e.indexOf("#"), l = l === -1 ? e : e.slice(0, l));
958
+ return l + "#" + (typeof a === "string" ? a : I(a));
959
+ }
960
+ function z(a, e) {
961
+ e === void 0 && (e = null);
962
+ return C(_extends({}, d, typeof a === "string" ? J(a) : a, { state: e, key: H() }));
963
+ }
964
+ function A(a) {
965
+ v = a;
966
+ a = h();
967
+ q = a[0];
968
+ d = a[1];
969
+ f.call({ action: v, location: d });
970
+ }
971
+ function y(a, e) {
972
+ function l() {
973
+ y(a, e);
974
+ }
975
+ var g = r.Push, n = z(a, e);
976
+ if (!c.length || (c.call({ action: g, location: n, retry: l }), false)) {
977
+ var G = [{ usr: n.state, key: n.key, idx: q + 1 }, x(n)];
978
+ n = G[0];
979
+ G = G[1];
980
+ try {
981
+ u.pushState(n, "", G);
982
+ } catch (K) {
983
+ m.location.assign(G);
984
+ }
985
+ A(g);
986
+ }
987
+ }
988
+ function w(a, e) {
989
+ function l() {
990
+ w(a, e);
991
+ }
992
+ var g = r.Replace, n = z(a, e);
993
+ c.length && (c.call({
994
+ action: g,
995
+ location: n,
996
+ retry: l
997
+ }), 1) || (n = [{ usr: n.state, key: n.key, idx: q }, x(n)], u.replaceState(n[0], "", n[1]), A(g));
998
+ }
999
+ function p(a) {
1000
+ u.go(a);
1001
+ }
1002
+ b === void 0 && (b = {});
1003
+ b = b.window;
1004
+ var m = b === void 0 ? document.defaultView : b, u = m.history, t = null;
1005
+ m.addEventListener("popstate", k);
1006
+ m.addEventListener("hashchange", function() {
1007
+ var a = h()[1];
1008
+ I(a) !== I(d) && k();
1009
+ });
1010
+ var v = r.Pop;
1011
+ b = h();
1012
+ var q = b[0], d = b[1], f = F(), c = F();
1013
+ q == null && (q = 0, u.replaceState(_extends({}, u.state, { idx: q }), ""));
1014
+ return {
1015
+ get action() {
1016
+ return v;
1017
+ },
1018
+ get location() {
1019
+ return d;
1020
+ },
1021
+ createHref: x,
1022
+ push: y,
1023
+ replace: w,
1024
+ go: p,
1025
+ back: function() {
1026
+ p(-1);
1027
+ },
1028
+ forward: function() {
1029
+ p(1);
1030
+ },
1031
+ listen: function(a) {
1032
+ return f.push(a);
1033
+ },
1034
+ block: function(a) {
1035
+ var e = c.push(a);
1036
+ c.length === 1 && m.addEventListener("beforeunload", E);
1037
+ return function() {
1038
+ e();
1039
+ c.length || m.removeEventListener("beforeunload", E);
1040
+ };
1041
+ }
1042
+ };
1043
+ }
1044
+ var index$i = "";
1045
+ function Debug(props) {
1046
+ const { appManager } = props;
1047
+ const pages = Array.from(appManager.pageManager.keys()).reverse();
1048
+ React.useEffect(function() {
1049
+ const history = createHashHistory();
1050
+ const unListen = history.listen(({ action, location }) => {
1051
+ const pathname = location.pathname;
1052
+ appManager.mockToPage(pathname, {});
1053
+ });
1054
+ return unListen;
1055
+ }, []);
1056
+ return /* @__PURE__ */ React.createElement("div", {
1057
+ className: "local-debug-side"
1058
+ }, /* @__PURE__ */ React.createElement("ul", null, pages.map((pathname) => /* @__PURE__ */ React.createElement("li", {
1059
+ key: pathname
1060
+ }, /* @__PURE__ */ React.createElement("a", {
1061
+ href: `#${pathname}`
1062
+ }, pathname)))));
1063
+ }
1064
+ function Loading$1(props) {
1065
+ const [showLoading, setShowLoading] = React.useState(false);
1066
+ const edgeService = props.edgeService;
1067
+ React.useEffect(function() {
1068
+ let currentLoading = false;
1069
+ const throttleSetShowLoading = function(loading) {
1070
+ currentLoading = loading;
1071
+ if (loading) {
1072
+ setTimeout(function() {
1073
+ if (currentLoading === loading) {
1074
+ setShowLoading(true);
1075
+ }
1076
+ }, 350);
1077
+ } else {
1078
+ setTimeout(function() {
1079
+ if (currentLoading === loading) {
1080
+ setShowLoading(false);
1081
+ }
1082
+ }, 100);
1083
+ }
1084
+ };
1085
+ edgeService.on("IO_STATUS", throttleSetShowLoading);
1086
+ return function() {
1087
+ edgeService.off("IO_STATUS", throttleSetShowLoading);
1088
+ };
1089
+ }, [edgeService]);
1090
+ return showLoading ? /* @__PURE__ */ React.createElement("div", {
1091
+ style: { position: "absolute", left: 0, top: 0, zIndex: 100 }
1092
+ }, "LOADING...") : null;
1093
+ }
1094
+ function PlaySound({ data, service, action }) {
1095
+ const { sound } = data;
1096
+ if (window.WindVane) {
1097
+ var params = {
1098
+ domain: "audio",
1099
+ method: "playSound",
1100
+ params: { sound }
1101
+ };
1102
+ WindVane.call("WindvanePlugin", "invoke", JSON.stringify(params));
1103
+ }
1104
+ service.onNext({});
1105
+ return null;
1106
+ }
1107
+ var index$h = {
1108
+ Alert,
1109
+ Start,
1110
+ Toast: toast,
1111
+ Confirm: confirm,
1112
+ NotFound,
1113
+ Debug,
1114
+ Prompt,
1115
+ Loading: Loading$1,
1116
+ PlaySound
1117
+ };
1118
+ var index$g = "";
1119
+ function Presentation(props) {
1120
+ const {
1121
+ image = Presentation.IMAGE_1,
1122
+ text = "",
1123
+ subText = "",
1124
+ transparent
1125
+ } = props;
1126
+ return /* @__PURE__ */ React.createElement("div", {
1127
+ className: transparent ? "presentation-card transparent" : "presentation-card"
1128
+ }, /* @__PURE__ */ React.createElement("img", {
1129
+ src: image
1130
+ }), text ? /* @__PURE__ */ React.createElement("div", {
1131
+ className: "text"
1132
+ }, text) : null, subText ? /* @__PURE__ */ React.createElement("div", {
1133
+ className: "sub-text"
1134
+ }, subText) : null);
1135
+ }
1136
+ Presentation.IMAGE_1 = "https://img.alicdn.com/imgextra/i3/O1CN019Ivkor1ksy3pMGDsz_!!6000000004740-2-tps-280-322.png";
1137
+ Presentation.IMAGE_2 = "https://img.alicdn.com/imgextra/i1/O1CN01lhSunu1X4VPw1Mlas_!!6000000002870-2-tps-352-158.png";
1138
+ Presentation.IMAGE_3 = "https://img.alicdn.com/imgextra/i1/O1CN01mreYXo1XfbUsQ7hip_!!6000000002951-2-tps-322-144.png";
1139
+ Presentation.IMAGE_4 = "https://img.alicdn.com/imgextra/i3/O1CN017gNM8F1Fmmcfti7Dg_!!6000000000530-1-tps-414-286.gif";
1140
+ var index$f = "";
1141
+ function empty$1() {
1142
+ }
1143
+ function List(props) {
1144
+ const { dataSource = [], onClickItem, onItemClick = empty$1 } = props;
1145
+ return /* @__PURE__ */ React.createElement("div", {
1146
+ className: "android-pda-list"
1147
+ }, dataSource.map((item, index2) => {
1148
+ return /* @__PURE__ */ React.createElement(DefaultItem, {
1149
+ key: item.key || index2,
1150
+ dataSource: item,
1151
+ onClick: onClickItem || onItemClick
1152
+ });
1153
+ }), props.children);
1154
+ }
1155
+ function DefaultItem(props) {
1156
+ const dataSource = props.dataSource || {
1157
+ title: props.title,
1158
+ subTitle: props.subTitle,
1159
+ extra: props.extra,
1160
+ tags: props.tags
1161
+ };
1162
+ const { title, subTitle, extra, tags = [], tabIndex } = dataSource;
1163
+ const { onClick } = props;
1164
+ return /* @__PURE__ */ React.createElement("div", {
1165
+ className: "default-item",
1166
+ onClick: () => {
1167
+ onClick(props.dataSource);
1168
+ },
1169
+ tabIndex
1170
+ }, /* @__PURE__ */ React.createElement("div", {
1171
+ className: "text"
1172
+ }, /* @__PURE__ */ React.createElement("div", null, title), /* @__PURE__ */ React.createElement("div", {
1173
+ className: "sub-text"
1174
+ }, subTitle), /* @__PURE__ */ React.createElement("div", {
1175
+ className: "sub-tags"
1176
+ }, tags.map((text) => {
1177
+ return /* @__PURE__ */ React.createElement("div", {
1178
+ className: "sub-tag-item",
1179
+ key: text
1180
+ }, text);
1181
+ }))), /* @__PURE__ */ React.createElement("div", {
1182
+ className: "extra"
1183
+ }, extra));
1184
+ }
1185
+ List.Item = DefaultItem;
1186
+ var index$e = "";
1187
+ const blankFunc$5 = () => {
1188
+ };
1189
+ class BaseLayoutContainer extends React.Component {
1190
+ constructor(props) {
1191
+ super(props);
1192
+ this.state = {
1193
+ showLoading: false
1194
+ };
1195
+ this._handleKeyUp = (e) => {
1196
+ const { onScan = blankFunc$5, onEnter = blankFunc$5, onEsc = blankFunc$5, onDelete = blankFunc$5, scanMode = null } = this.props;
1197
+ const { code, keyCode, key } = e;
1198
+ if (code === "Enter") {
1199
+ e.preventDefault();
1200
+ onEnter(e);
1201
+ return;
1202
+ }
1203
+ if (code === "Delete") {
1204
+ e.preventDefault();
1205
+ onDelete(e);
1206
+ return;
1207
+ }
1208
+ if (code === "Esc") {
1209
+ e.preventDefault();
1210
+ onEsc(e);
1211
+ return;
1212
+ }
1213
+ };
1214
+ this._handleBeforeUnload = (e) => {
1215
+ e.returnValue = "\u786E\u5B9A\u79BB\u5F00\u5F53\u524D\u9875\u9762\u5417\uFF1F";
1216
+ return true;
1217
+ };
1218
+ this._handleUnload = (e) => {
1219
+ WindVane.call("WindvanePlugin", "invoke", "{'domain': 'rfid', 'method': 'stopRfidScan', 'params':null}", function(e2) {
1220
+ }, function(e2) {
1221
+ });
1222
+ const stopParam = {
1223
+ tag: "stopRfid",
1224
+ level: "d",
1225
+ message: "stop rfid scan!!!"
1226
+ };
1227
+ WindVaneLog(stopParam);
1228
+ WindVaneLog(stopParam);
1229
+ };
1230
+ }
1231
+ componentDidMount() {
1232
+ window.onunload = this._handleUnload;
1233
+ document.addEventListener("keyup", this._handleKeyUp);
1234
+ }
1235
+ componentWillUnmount() {
1236
+ window.onbeforeunload = null;
1237
+ window.onunload = null;
1238
+ document.removeEventListener("keyup", this._handleKeyUp);
1239
+ }
1240
+ shouldComponentUpdate(nextProps, nextState) {
1241
+ if (nextProps.loading && !this.props.loading) {
1242
+ this.setState({
1243
+ showLoading: true
1244
+ });
1245
+ if (nextProps.loadingTimeout) {
1246
+ setTimeout(() => {
1247
+ this.setState({
1248
+ showLoading: false
1249
+ });
1250
+ }, nextProps.loadingTimeout);
1251
+ }
1252
+ }
1253
+ if (!nextProps.loading && this.state.showLoading) {
1254
+ this.setState({
1255
+ showLoading: false
1256
+ });
1257
+ }
1258
+ return true;
1259
+ }
1260
+ render() {
1261
+ const props = this.props;
1262
+ const { style = {}, header, footer, loading } = this.props;
1263
+ return /* @__PURE__ */ React.createElement("div", {
1264
+ className: classNames({ "baselayout-wrapper": true }),
1265
+ style
1266
+ }, header && /* @__PURE__ */ React.createElement("div", {
1267
+ className: classNames({ "baselayout-header": true })
1268
+ }, header), /* @__PURE__ */ React.createElement("div", {
1269
+ className: classNames({ "baselayout-container": true })
1270
+ }, props.children), footer && /* @__PURE__ */ React.createElement("div", {
1271
+ className: classNames({ "baselayout-footer": true })
1272
+ }, footer), this.state.showLoading ? /* @__PURE__ */ React.createElement("div", {
1273
+ className: "loading"
1274
+ }) : null);
1275
+ }
1276
+ }
1277
+ const blankFunc$4 = () => {
1278
+ };
1279
+ class RfidOnce$1 extends React.Component {
1280
+ constructor(props) {
1281
+ super(props);
1282
+ this._rfidBeginScan = false;
1283
+ this._handleRfidScan = (e) => {
1284
+ const { onRfidOnce, onRfidBoxOnce, onRfidPalletOnce } = this.props;
1285
+ const data = e.param;
1286
+ const isBox = data.rfidData.startsWith("0F006");
1287
+ const isPallet = data.rfidData.startsWith("0F011");
1288
+ playSound("single_recog");
1289
+ if (isPallet) {
1290
+ let rfidData = data.rfidData;
1291
+ data.originData = rfidData;
1292
+ data.rfidData = rfidData.substr(5, 12);
1293
+ }
1294
+ if (onRfidBoxOnce && isBox) {
1295
+ this._stopWork();
1296
+ onRfidBoxOnce(data);
1297
+ } else if (onRfidPalletOnce && isPallet) {
1298
+ this._stopWork();
1299
+ onRfidPalletOnce(data);
1300
+ }
1301
+ if (onRfidOnce) {
1302
+ this._stopWork();
1303
+ onRfidOnce(data);
1304
+ }
1305
+ };
1306
+ this._startWork = (e) => {
1307
+ document.addEventListener("ContinuousRfidScan", this._handleRfidScan);
1308
+ WindVane.call("WindvanePlugin", "invoke", "{'domain': 'rfid', 'method': 'startScan', 'params': null}", function(e2) {
1309
+ }, function(e2) {
1310
+ });
1311
+ this._rfidBeginScan = true;
1312
+ };
1313
+ this._stopWork = (e) => {
1314
+ document.removeEventListener("ContinuousRfidScan", this._handleRfidScan);
1315
+ WindVane.call("WindvanePlugin", "invoke", "{'domain': 'rfid', 'method': 'stopRfidScan', 'params':null}", function(e2) {
1316
+ }, function(e2) {
1317
+ });
1318
+ };
1319
+ this._handleKeyDown = (e) => {
1320
+ const { code, keyCode, key } = e;
1321
+ if (code === "F22" || code === "F23" || code === "F24" || code === "F9" || code === "F16") {
1322
+ if (!this._rfidBeginScan) {
1323
+ this._startWork();
1324
+ }
1325
+ }
1326
+ };
1327
+ this._handleKeyUp = (e) => {
1328
+ const { code, keyCode, key } = e;
1329
+ if (code === "F22" || code === "F23" || code === "F24" || code === "F9" || code === "F16") {
1330
+ this._stopWork();
1331
+ this._rfidBeginScan = false;
1332
+ }
1333
+ };
1334
+ }
1335
+ componentDidMount() {
1336
+ document.addEventListener("keydown", this._handleKeyDown);
1337
+ document.addEventListener("keyup", this._handleKeyUp);
1338
+ WindVane.call("WindvanePlugin", "invoke", "{'domain': 'keyboard', 'method': 'changeScanMode', 'params': {'scanMode': 'RFID'}}", function(e) {
1339
+ }, function(e) {
1340
+ });
1341
+ }
1342
+ componentWillUnmount() {
1343
+ document.removeEventListener("keydown", this._handleKeyDown);
1344
+ document.removeEventListener("keyup", this._handleKeyUp);
1345
+ this._stopWork();
1346
+ }
1347
+ render() {
1348
+ const props = this.props;
1349
+ const _a = props, { onRfidOnce = blankFunc$4 } = _a, opts = __objRest(_a, ["onRfidOnce"]);
1350
+ return /* @__PURE__ */ React.createElement(BaseLayoutContainer, __spreadValues({}, opts));
1351
+ }
1352
+ }
1353
+ const blankFunc$3 = () => {
1354
+ };
1355
+ class RfidOnce extends React.Component {
1356
+ constructor(props) {
1357
+ super(props);
1358
+ this._rfidBeginScan = false;
1359
+ this._handleRfidScan = (e) => {
1360
+ const { onRfidScan, onRfidBoxScan, onRfidPalletScan } = this.props;
1361
+ const data = e.param;
1362
+ const isBox = data.rfidData.startsWith("0F006");
1363
+ const isPallet = data.rfidData.startsWith("0F011");
1364
+ if (isPallet) {
1365
+ let rfidData = data.rfidData;
1366
+ data.originData = rfidData;
1367
+ data.rfidData = rfidData.substr(5, 12);
1368
+ }
1369
+ if (isBox && onRfidBoxScan) {
1370
+ onRfidBoxScan(data);
1371
+ } else if (isPallet && onRfidPalletScan) {
1372
+ onRfidPalletScan(data);
1373
+ }
1374
+ if (onRfidScan) {
1375
+ onRfidScan(data);
1376
+ }
1377
+ };
1378
+ this._startWork = (e) => {
1379
+ document.addEventListener("ContinuousRfidScan", this._handleRfidScan);
1380
+ WindVane.call("WindvanePlugin", "invoke", "{'domain': 'rfid', 'method': 'startScan', 'params': null}", function(e2) {
1381
+ }, function(e2) {
1382
+ });
1383
+ this._rfidBeginScan = true;
1384
+ };
1385
+ this._stopWork = (e) => {
1386
+ document.removeEventListener("ContinuousRfidScan", this._handleRfidScan);
1387
+ WindVane.call("WindvanePlugin", "invoke", "{'domain': 'rfid', 'method': 'stopRfidScan', 'params':null}", function(e2) {
1388
+ }, function(e2) {
1389
+ });
1390
+ };
1391
+ this._handleKeyDown = (e) => {
1392
+ const { code, keyCode, key } = e;
1393
+ if (code === "F22" || code === "F23" || code === "F24" || code === "F9" || code === "F16") {
1394
+ if (!this._rfidBeginScan) {
1395
+ this._startWork();
1396
+ }
1397
+ }
1398
+ };
1399
+ this._handleKeyUp = (e) => {
1400
+ const { code, keyCode, key } = e;
1401
+ if (code === "F22" || code === "F23" || code === "F24" || code === "F9" || code === "F16") {
1402
+ this._stopWork();
1403
+ this._rfidBeginScan = false;
1404
+ }
1405
+ };
1406
+ }
1407
+ componentDidMount() {
1408
+ const { autoRfidScan = false, rfidReaderSleep } = this.props;
1409
+ WindVane.call("WindvanePlugin", "invoke", "{'domain': 'keyboard', 'method': 'changeScanMode', 'params': {'scanMode': 'RFID'}}", function(e) {
1410
+ }, function(e) {
1411
+ });
1412
+ if (!autoRfidScan) {
1413
+ document.addEventListener("keydown", this._handleKeyDown);
1414
+ document.addEventListener("keyup", this._handleKeyUp);
1415
+ } else {
1416
+ if (!rfidReaderSleep) {
1417
+ this._startWork();
1418
+ }
1419
+ }
1420
+ }
1421
+ componentWillUnmount() {
1422
+ document.removeEventListener("keydown", this._handleKeyDown);
1423
+ document.removeEventListener("keyup", this._handleKeyUp);
1424
+ this._stopWork();
1425
+ }
1426
+ shouldComponentUpdate(nextProps, nextState) {
1427
+ if (this.props.autoRfidScan && this.props.rfidReaderSleep !== nextProps.rfidReaderSleep) {
1428
+ if (!nextProps.rfidReaderSleep) {
1429
+ this._startWork();
1430
+ } else {
1431
+ this._stopWork();
1432
+ }
1433
+ }
1434
+ return true;
1435
+ }
1436
+ render() {
1437
+ const props = this.props;
1438
+ const _a = props, { onRfidScan = blankFunc$3, autoRfidScan } = _a, opts = __objRest(_a, ["onRfidScan", "autoRfidScan"]);
1439
+ return /* @__PURE__ */ React.createElement(BaseLayoutContainer, __spreadValues({}, opts));
1440
+ }
1441
+ }
1442
+ __publicField(RfidOnce, "defaultProps", {
1443
+ rfidReaderSleep: false
1444
+ });
1445
+ const blankFunc$2 = () => {
1446
+ };
1447
+ class BarcodeScan extends React.Component {
1448
+ constructor(props) {
1449
+ super(props);
1450
+ this._barcodeBeginScan = false;
1451
+ this._handleBarcodeScan = (e) => {
1452
+ const { onBarcodeScan } = this.props;
1453
+ this._stopWork();
1454
+ playSound("scan");
1455
+ onBarcodeScan && onBarcodeScan(e.param);
1456
+ };
1457
+ this._startWork = (e) => {
1458
+ document.addEventListener("BarcodeScan", this._handleBarcodeScan);
1459
+ this._barcodeBeginScan = true;
1460
+ };
1461
+ this._stopWork = (e) => {
1462
+ document.removeEventListener("BarcodeScan", this._handleBarcodeScan);
1463
+ };
1464
+ this._handleKeyDown = (e) => {
1465
+ const { code, keyCode, key } = e;
1466
+ if (code === "F22" || code === "F23" || code === "F24" || code === "F9" || code === "F16") {
1467
+ if (!this._barcodeBeginScan) {
1468
+ this._startWork();
1469
+ }
1470
+ }
1471
+ };
1472
+ this._handleKeyUp = (e) => {
1473
+ const { code, keyCode, key } = e;
1474
+ if (code === "F22" || code === "F23" || code === "F24" || code === "F9" || code === "F16") {
1475
+ this._stopWork();
1476
+ this._barcodeBeginScan = false;
1477
+ }
1478
+ };
1479
+ this.onScanBarcode = this.onScanBarcode.bind(this);
1480
+ }
1481
+ onScanBarcode(e) {
1482
+ this.props.onScanBarcode && this.props.onScanBarcode(e.param);
1483
+ }
1484
+ componentDidMount() {
1485
+ const { onBarcodeScan } = this.props;
1486
+ if (onBarcodeScan) {
1487
+ document.addEventListener("keydown", this._handleKeyDown);
1488
+ document.addEventListener("keyup", this._handleKeyUp);
1489
+ }
1490
+ document.addEventListener("BarcodeScan", this.onScanBarcode);
1491
+ WindVane.call("WindvanePlugin", "invoke", "{'domain': 'keyboard', 'method': 'changeScanMode', 'params': {'scanMode': 'barcode'}}", function(e) {
1492
+ }, function(e) {
1493
+ });
1494
+ }
1495
+ componentWillUnmount() {
1496
+ const { onBarcodeScan } = this.props;
1497
+ if (onBarcodeScan) {
1498
+ document.removeEventListener("keydown", this._handleKeyDown);
1499
+ document.removeEventListener("keyup", this._handleKeyUp);
1500
+ }
1501
+ document.removeEventListener("BarcodeScan", this.onScanBarcode);
1502
+ }
1503
+ render() {
1504
+ const props = this.props;
1505
+ const _a = props, { onBarcodeScan = blankFunc$2 } = _a, opts = __objRest(_a, ["onBarcodeScan"]);
1506
+ return /* @__PURE__ */ React.createElement(BaseLayoutContainer, __spreadValues({}, opts));
1507
+ }
1508
+ }
1509
+ class BaseLayout extends React.Component {
1510
+ constructor(props) {
1511
+ super(props);
1512
+ }
1513
+ render() {
1514
+ const props = this.props;
1515
+ const { onBarcodeScan, onScanBarcode, onRfidOnce, onRfidBoxOnce, onRfidPalletOnce, onRfidScan, onRfidBoxScan, onRfidPalletScan } = props;
1516
+ if (onRfidOnce || onRfidBoxOnce || onRfidPalletOnce) {
1517
+ return /* @__PURE__ */ React.createElement(RfidOnce$1, __spreadValues({}, props));
1518
+ }
1519
+ if (onRfidScan || onRfidBoxScan || onRfidPalletScan) {
1520
+ return /* @__PURE__ */ React.createElement(RfidOnce, __spreadValues({}, props));
1521
+ }
1522
+ if (onBarcodeScan || onScanBarcode) {
1523
+ return /* @__PURE__ */ React.createElement(BarcodeScan, __spreadValues({}, props));
1524
+ }
1525
+ return /* @__PURE__ */ React.createElement(BaseLayoutContainer, __spreadValues({}, props));
1526
+ }
1527
+ }
1528
+ var index$d = "";
1529
+ const blankFunc$1 = () => {
1530
+ };
1531
+ function Keyborard(props) {
1532
+ const { label = "\u67E5\u8BE2", onWakeKeyboard = blankFunc$1, onClick = blankFunc$1, onHidden = blankFunc$1, type = "tel", placeholder = "\u8BF7\u8F93\u5165" } = props;
1533
+ const inputRef = useRef(null);
1534
+ const [visible, setVisible] = useState(true);
1535
+ useEffect(() => {
1536
+ const handleKeyUp = (e) => {
1537
+ const { code, keyCode, key } = e;
1538
+ if (code === "Enter") {
1539
+ e.preventDefault();
1540
+ onClick(inputRef.current.value, e);
1541
+ onHidden(true);
1542
+ setVisible(false);
1543
+ return;
1544
+ }
1545
+ };
1546
+ requestAnimationFrame(() => {
1547
+ inputRef.current.focus();
1548
+ onWakeKeyboard();
1549
+ });
1550
+ document.addEventListener("keyup", handleKeyUp);
1551
+ return () => {
1552
+ document.removeEventListener("keyup", handleKeyUp);
1553
+ };
1554
+ }, []);
1555
+ if (!visible)
1556
+ return null;
1557
+ return /* @__PURE__ */ React.createElement("div", {
1558
+ className: "wakekeyborard-overlay",
1559
+ onClick: (e) => {
1560
+ if (e.target.className && e.target.className.includes("wakekeyborard-overlay")) {
1561
+ onHidden(false);
1562
+ setVisible(false);
1563
+ }
1564
+ }
1565
+ }, /* @__PURE__ */ React.createElement("div", {
1566
+ className: "wakekeyborard-inputbox"
1567
+ }, /* @__PURE__ */ React.createElement("input", {
1568
+ ref: inputRef,
1569
+ type,
1570
+ placeholder
1571
+ }), /* @__PURE__ */ React.createElement(Button, {
1572
+ type: "cutout",
1573
+ onClick: (e) => {
1574
+ onClick(inputRef.current.value, e);
1575
+ onHidden(true);
1576
+ setVisible(false);
1577
+ }
1578
+ }, label)));
1579
+ }
1580
+ const blankFunc = () => {
1581
+ };
1582
+ function WakeKeyborard(props) {
1583
+ const [inputVisible, setInputVisible] = useState(props.autoWakeup || false);
1584
+ const _a = props, { onClick = blankFunc, onHidden = blankFunc } = _a, keyborardProps = __objRest(_a, ["onClick", "onHidden"]);
1585
+ return /* @__PURE__ */ React.createElement("div", {
1586
+ className: "wakekeyborard"
1587
+ }, inputVisible ? /* @__PURE__ */ React.createElement(Keyborard, __spreadValues({
1588
+ onClick: (v, e) => {
1589
+ onClick(v);
1590
+ setInputVisible(!inputVisible);
1591
+ },
1592
+ onHidden: (s) => {
1593
+ setInputVisible(false);
1594
+ onHidden(s);
1595
+ }
1596
+ }, keyborardProps)) : null, !inputVisible ? /* @__PURE__ */ React.createElement("div", {
1597
+ className: "wakekeyborard-icon",
1598
+ onClick: (e) => {
1599
+ setInputVisible(!inputVisible);
1600
+ }
1601
+ }) : null);
1602
+ }
1603
+ WakeKeyborard.Keyborard = Keyborard;
1604
+ var index$c = "";
1605
+ var index$b = "";
1606
+ class PdaInfoCard$1 extends React.Component {
1607
+ constructor(props) {
1608
+ super(props);
1609
+ }
1610
+ render() {
1611
+ const { className, title, isActive, infoList = [], style = {}, index: index2, isLast } = this.props;
1612
+ return /* @__PURE__ */ React.createElement("div", {
1613
+ className: classNames({ [className]: true, "pda-step-card": true }),
1614
+ style
1615
+ }, /* @__PURE__ */ React.createElement("div", {
1616
+ className: "pda-step-indictor"
1617
+ }, /* @__PURE__ */ React.createElement("div", {
1618
+ className: classNames({ "pda-step-indictor-top": true, "pda-step-indictor-top-hidden": index2 === 0 })
1619
+ }), /* @__PURE__ */ React.createElement("div", {
1620
+ className: classNames({ "pda-step-indictor-center": true, "pda-step-indictor-center-active": isActive })
1621
+ }), /* @__PURE__ */ React.createElement("div", {
1622
+ className: classNames({ "pda-step-indictor-bottom": true, "pda-step-indictor-bottom-hidden": isLast })
1623
+ })), /* @__PURE__ */ React.createElement("div", {
1624
+ className: classNames({ "pda-step": true, "pda-step-dark": !isActive })
1625
+ }, /* @__PURE__ */ React.createElement("div", {
1626
+ className: "pda-step-title"
1627
+ }, title), infoList.map((item, index22) => {
1628
+ return /* @__PURE__ */ React.createElement("div", {
1629
+ key: index22,
1630
+ className: "pda-step-list"
1631
+ }, /* @__PURE__ */ React.createElement("span", null, item.label || ""), "\xA0\xA0", /* @__PURE__ */ React.createElement("span", null, item.content || ""));
1632
+ })));
1633
+ }
1634
+ }
1635
+ class PdaInfoCard extends React.Component {
1636
+ constructor(props) {
1637
+ super(props);
1638
+ }
1639
+ render() {
1640
+ const { className, style = {}, theme = "light", current = 0, children } = this.props;
1641
+ return /* @__PURE__ */ React.createElement("div", {
1642
+ className: classNames({ [className]: true }),
1643
+ style
1644
+ }, (children || []).map((child, index2) => {
1645
+ const childProps = __spreadValues({
1646
+ index: index2,
1647
+ isLast: index2 === (children || []).length - 1
1648
+ }, child.props);
1649
+ if (index2 === current) {
1650
+ childProps.isActive = true;
1651
+ } else {
1652
+ childProps.isActive = false;
1653
+ }
1654
+ return cloneElement(child, childProps);
1655
+ }));
1656
+ }
1657
+ }
1658
+ __publicField(PdaInfoCard, "Step", PdaInfoCard$1);
1659
+ var index$a = "";
1660
+ class PdaFinishCard extends React.Component {
1661
+ constructor(props) {
1662
+ super(props);
1663
+ }
1664
+ componentDidMount() {
1665
+ if (this.props.isError) {
1666
+ playSound("success3");
1667
+ } else {
1668
+ playSound("success2");
1669
+ }
1670
+ }
1671
+ render() {
1672
+ const { className, title, infoList = [], isError = false, buttonMultiLines = false, style = {}, onClick = () => {
1673
+ }, okText = "\u8FD4\u56DE\u9996\u9875", cancelText = null } = this.props;
1674
+ const footer = /* @__PURE__ */ React.createElement(Button.Group, null, cancelText ? /* @__PURE__ */ React.createElement(Button, {
1675
+ style: buttonMultiLines ? { height: "auto", lineHeight: "50px" } : {},
1676
+ type: "dark",
1677
+ onClick: () => onClick(false)
1678
+ }, cancelText) : null, /* @__PURE__ */ React.createElement(Button, {
1679
+ type: "primary",
1680
+ style: buttonMultiLines ? { height: "auto", lineHeight: "normal" } : {},
1681
+ onClick: () => onClick(true)
1682
+ }, okText));
1683
+ return /* @__PURE__ */ React.createElement(BaseLayout, {
1684
+ footer
1685
+ }, /* @__PURE__ */ React.createElement("div", {
1686
+ className: "pda-finish-card-top"
1687
+ }, /* @__PURE__ */ React.createElement("img", {
1688
+ className: "pda-finish-card-img",
1689
+ src: isError ? PdaFinishCard.ERROR_SUCCESS : PdaFinishCard.SUCCESS
1690
+ }), /* @__PURE__ */ React.createElement("p", {
1691
+ className: "pda-finish-card-title"
1692
+ }, title), infoList.map((item, index2) => {
1693
+ return /* @__PURE__ */ React.createElement("p", {
1694
+ key: index2,
1695
+ className: "pda-finish-card-list"
1696
+ }, /* @__PURE__ */ React.createElement("span", null, item.label || ""), /* @__PURE__ */ React.createElement("span", null, item.content || ""));
1697
+ })));
1698
+ }
1699
+ }
1700
+ PdaFinishCard.SUCCESS = "https://img.alicdn.com/imgextra/i3/O1CN01OL2UYg24792knbTtC_!!6000000007343-1-tps-506-415.gif";
1701
+ PdaFinishCard.ERROR_SUCCESS = "https://img.alicdn.com/imgextra/i3/O1CN01p5Oc5t1VMFWtBomQc_!!6000000002638-1-tps-600-456.gif";
1702
+ var index$9 = "";
1703
+ class PdaDistanceCard extends React.Component {
1704
+ constructor(props) {
1705
+ super(props);
1706
+ }
1707
+ render() {
1708
+ const { className, title, infoText, percentage = 0, style = {} } = this.props;
1709
+ const distanceImg = "https://img.alicdn.com/imgextra/i3/O1CN01EFksWL1DBZCu0H1JH_!!6000000000178-2-tps-21-30.png";
1710
+ const indictorImg = "https://img.alicdn.com/imgextra/i1/O1CN01YEhCSg1aObe8UZq7K_!!6000000003320-2-tps-379-17.png";
1711
+ return /* @__PURE__ */ React.createElement("div", {
1712
+ className: classNames({ [className]: true, "pda-distance-card": true }),
1713
+ style
1714
+ }, /* @__PURE__ */ React.createElement("p", {
1715
+ className: "pda-distance-card-highlight"
1716
+ }, /* @__PURE__ */ React.createElement("span", {
1717
+ className: "pda-distance-card-highlight1"
1718
+ }, title)), /* @__PURE__ */ React.createElement("div", {
1719
+ className: "pda-distance-indictor"
1720
+ }, /* @__PURE__ */ React.createElement("img", {
1721
+ src: distanceImg,
1722
+ width: 20,
1723
+ height: 29
1724
+ }), /* @__PURE__ */ React.createElement("p", null, infoText)), /* @__PURE__ */ React.createElement("div", {
1725
+ className: "pda-distance-card-progress"
1726
+ }, /* @__PURE__ */ React.createElement("div", {
1727
+ className: "pda-distance-card-progress-inside",
1728
+ style: { width: `${percentage * 100}%` }
1729
+ }), /* @__PURE__ */ React.createElement("img", {
1730
+ className: "pda-distance-card-progress-indictor",
1731
+ src: indictorImg
1732
+ })), /* @__PURE__ */ React.createElement("div", {
1733
+ className: "pda-distance-label"
1734
+ }, /* @__PURE__ */ React.createElement("p", null, "\u8FDC"), /* @__PURE__ */ React.createElement("p", null, "\u8FD1")));
1735
+ }
1736
+ }
1737
+ var index$8 = "";
1738
+ function SubCard(props) {
1739
+ const { title, context, name, tag, attrs = [], style } = props;
1740
+ return /* @__PURE__ */ React.createElement("div", {
1741
+ className: "android-sub-card",
1742
+ style
1743
+ }, /* @__PURE__ */ React.createElement("div", {
1744
+ className: "android-sub-card-title-section"
1745
+ }, /* @__PURE__ */ React.createElement("div", {
1746
+ className: "android-sub-card-title"
1747
+ }, title), tag ? /* @__PURE__ */ React.createElement("div", {
1748
+ className: "android-sub-card-tag"
1749
+ }, /* @__PURE__ */ React.createElement("div", {
1750
+ className: tag.type
1751
+ }, tag.label || "")) : null), /* @__PURE__ */ React.createElement("div", {
1752
+ className: "android-sub-card-context"
1753
+ }, context), name ? /* @__PURE__ */ React.createElement("div", {
1754
+ className: "android-sub-card-name"
1755
+ }, name) : null, /* @__PURE__ */ React.createElement("div", {
1756
+ className: "android-sub-card-attrs"
1757
+ }, attrs.map((text) => {
1758
+ return /* @__PURE__ */ React.createElement("div", {
1759
+ key: text
1760
+ }, text);
1761
+ })));
1762
+ }
1763
+ var index$7 = "";
1764
+ function SelectCard(props) {
1765
+ const { title, label, select = true, onClick = (e) => {
1766
+ } } = props;
1767
+ return /* @__PURE__ */ React.createElement("div", {
1768
+ className: "select-card"
1769
+ }, /* @__PURE__ */ React.createElement("p", null, title), /* @__PURE__ */ React.createElement("div", {
1770
+ className: "select-card-content",
1771
+ onClick
1772
+ }, label, " ", select ? /* @__PURE__ */ React.createElement("span", {
1773
+ className: "select-icon"
1774
+ }) : null, " "));
1775
+ }
1776
+ var index$6 = "";
1777
+ function empty() {
1778
+ }
1779
+ function index$5(props) {
1780
+ const { dataSource = [], onClickItem = empty } = props;
1781
+ let tabIndex = 1;
1782
+ return /* @__PURE__ */ React.createElement("div", {
1783
+ className: "pda-app-list"
1784
+ }, dataSource.map((item) => {
1785
+ return /* @__PURE__ */ React.createElement("div", {
1786
+ className: "pda-app-group",
1787
+ key: item.groupName
1788
+ }, /* @__PURE__ */ React.createElement("h2", {
1789
+ className: "group-name"
1790
+ }, item.groupName), /* @__PURE__ */ React.createElement("div", {
1791
+ className: "group-apps"
1792
+ }, item.list.map((it) => {
1793
+ return /* @__PURE__ */ React.createElement("div", {
1794
+ className: "app-item",
1795
+ key: it.name,
1796
+ autoFocus: tabIndex === 1,
1797
+ tabIndex: tabIndex++,
1798
+ onClick: () => onClickItem(it)
1799
+ }, /* @__PURE__ */ React.createElement("span", {
1800
+ className: "app-name"
1801
+ }, it.name), /* @__PURE__ */ React.createElement("span", {
1802
+ className: "app-subname"
1803
+ }, it.subname));
1804
+ })));
1805
+ }));
1806
+ }
1807
+ var index$4 = "";
1808
+ function usePersistFn(fn) {
1809
+ var fnRef = useRef(fn);
1810
+ fnRef.current = fn;
1811
+ var persistFn = useRef();
1812
+ if (!persistFn.current) {
1813
+ persistFn.current = function() {
1814
+ var args = [];
1815
+ for (var _i = 0; _i < arguments.length; _i++) {
1816
+ args[_i] = arguments[_i];
1817
+ }
1818
+ return fnRef.current.apply(this, args);
1819
+ };
1820
+ }
1821
+ return persistFn.current;
1822
+ }
1823
+ var __awaiter = function(thisArg, _arguments, P, generator) {
1824
+ function adopt(value) {
1825
+ return value instanceof P ? value : new P(function(resolve) {
1826
+ resolve(value);
1827
+ });
1828
+ }
1829
+ return new (P || (P = Promise))(function(resolve, reject) {
1830
+ function fulfilled(value) {
1831
+ try {
1832
+ step(generator.next(value));
1833
+ } catch (e) {
1834
+ reject(e);
1835
+ }
1836
+ }
1837
+ function rejected(value) {
1838
+ try {
1839
+ step(generator["throw"](value));
1840
+ } catch (e) {
1841
+ reject(e);
1842
+ }
1843
+ }
1844
+ function step(result) {
1845
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
1846
+ }
1847
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
1848
+ });
1849
+ };
1850
+ var __generator = function(thisArg, body) {
1851
+ var _ = {
1852
+ label: 0,
1853
+ sent: function sent() {
1854
+ if (t[0] & 1)
1855
+ throw t[1];
1856
+ return t[1];
1857
+ },
1858
+ trys: [],
1859
+ ops: []
1860
+ }, f, y, t, g;
1861
+ return g = {
1862
+ next: verb(0),
1863
+ "throw": verb(1),
1864
+ "return": verb(2)
1865
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
1866
+ return this;
1867
+ }), g;
1868
+ function verb(n) {
1869
+ return function(v) {
1870
+ return step([n, v]);
1871
+ };
1872
+ }
1873
+ function step(op) {
1874
+ if (f)
1875
+ throw new TypeError("Generator is already executing.");
1876
+ while (_) {
1877
+ try {
1878
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
1879
+ return t;
1880
+ if (y = 0, t)
1881
+ op = [op[0] & 2, t.value];
1882
+ switch (op[0]) {
1883
+ case 0:
1884
+ case 1:
1885
+ t = op;
1886
+ break;
1887
+ case 4:
1888
+ _.label++;
1889
+ return {
1890
+ value: op[1],
1891
+ done: false
1892
+ };
1893
+ case 5:
1894
+ _.label++;
1895
+ y = op[1];
1896
+ op = [0];
1897
+ continue;
1898
+ case 7:
1899
+ op = _.ops.pop();
1900
+ _.trys.pop();
1901
+ continue;
1902
+ default:
1903
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
1904
+ _ = 0;
1905
+ continue;
1906
+ }
1907
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
1908
+ _.label = op[1];
1909
+ break;
1910
+ }
1911
+ if (op[0] === 6 && _.label < t[1]) {
1912
+ _.label = t[1];
1913
+ t = op;
1914
+ break;
1915
+ }
1916
+ if (t && _.label < t[2]) {
1917
+ _.label = t[2];
1918
+ _.ops.push(op);
1919
+ break;
1920
+ }
1921
+ if (t[2])
1922
+ _.ops.pop();
1923
+ _.trys.pop();
1924
+ continue;
1925
+ }
1926
+ op = body.call(thisArg, _);
1927
+ } catch (e) {
1928
+ op = [6, e];
1929
+ y = 0;
1930
+ } finally {
1931
+ f = t = 0;
1932
+ }
1933
+ }
1934
+ if (op[0] & 5)
1935
+ throw op[1];
1936
+ return {
1937
+ value: op[0] ? op[1] : void 0,
1938
+ done: true
1939
+ };
1940
+ }
1941
+ };
1942
+ var __read = function(o, n) {
1943
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
1944
+ if (!m)
1945
+ return o;
1946
+ var i = m.call(o), r2, ar = [], e;
1947
+ try {
1948
+ while ((n === void 0 || n-- > 0) && !(r2 = i.next()).done) {
1949
+ ar.push(r2.value);
1950
+ }
1951
+ } catch (error) {
1952
+ e = {
1953
+ error
1954
+ };
1955
+ } finally {
1956
+ try {
1957
+ if (r2 && !r2.done && (m = i["return"]))
1958
+ m.call(i);
1959
+ } finally {
1960
+ if (e)
1961
+ throw e.error;
1962
+ }
1963
+ }
1964
+ return ar;
1965
+ };
1966
+ var __spread = function() {
1967
+ for (var ar = [], i = 0; i < arguments.length; i++) {
1968
+ ar = ar.concat(__read(arguments[i]));
1969
+ }
1970
+ return ar;
1971
+ };
1972
+ function useLockFn(fn) {
1973
+ var _this = this;
1974
+ var lockRef = useRef(false);
1975
+ return useCallback(function() {
1976
+ var args = [];
1977
+ for (var _i = 0; _i < arguments.length; _i++) {
1978
+ args[_i] = arguments[_i];
1979
+ }
1980
+ return __awaiter(_this, void 0, void 0, function() {
1981
+ var ret, e_1;
1982
+ return __generator(this, function(_a) {
1983
+ switch (_a.label) {
1984
+ case 0:
1985
+ if (lockRef.current)
1986
+ return [
1987
+ 2
1988
+ ];
1989
+ lockRef.current = true;
1990
+ _a.label = 1;
1991
+ case 1:
1992
+ _a.trys.push([1, 3, , 4]);
1993
+ return [
1994
+ 4,
1995
+ fn.apply(void 0, __spread(args))
1996
+ ];
1997
+ case 2:
1998
+ ret = _a.sent();
1999
+ lockRef.current = false;
2000
+ return [
2001
+ 2,
2002
+ ret
2003
+ ];
2004
+ case 3:
2005
+ e_1 = _a.sent();
2006
+ lockRef.current = false;
2007
+ throw e_1;
2008
+ case 4:
2009
+ return [
2010
+ 2
2011
+ ];
2012
+ }
2013
+ });
2014
+ });
2015
+ }, [fn]);
2016
+ }
2017
+ const overflowScrollReg = /scroll|auto/i;
2018
+ function isElement(node) {
2019
+ const ELEMENT_NODE_TYPE = 1;
2020
+ return node.tagName !== "HTML" && node.tagName !== "BODY" && node.nodeType === ELEMENT_NODE_TYPE;
2021
+ }
2022
+ function getScrollParent(el, root) {
2023
+ let node = el;
2024
+ while (node && node !== root && isElement(node)) {
2025
+ const { overflowY } = window.getComputedStyle(node);
2026
+ if (overflowScrollReg.test(overflowY)) {
2027
+ return node;
2028
+ }
2029
+ node = node.parentNode;
2030
+ }
2031
+ return root;
2032
+ }
2033
+ function Loading(props) {
2034
+ return /* @__PURE__ */ React.createElement("div", {
2035
+ style: {
2036
+ color: props.color || "#999"
2037
+ }
2038
+ }, /* @__PURE__ */ React.createElement("svg", {
2039
+ height: "1em",
2040
+ viewBox: "0 0 100 40",
2041
+ style: { verticalAlign: "-0.125em" }
2042
+ }, /* @__PURE__ */ React.createElement("g", {
2043
+ stroke: "none",
2044
+ strokeWidth: "1",
2045
+ fill: "none",
2046
+ fillRule: "evenodd"
2047
+ }, /* @__PURE__ */ React.createElement("g", {
2048
+ transform: "translate(-100.000000, -71.000000)"
2049
+ }, /* @__PURE__ */ React.createElement("g", {
2050
+ transform: "translate(95.000000, 71.000000)"
2051
+ }, /* @__PURE__ */ React.createElement("g", {
2052
+ transform: "translate(5.000000, 0.000000)"
2053
+ }, [0, 1, 2].map((i) => /* @__PURE__ */ React.createElement("rect", {
2054
+ key: i,
2055
+ fill: "currentColor",
2056
+ x: 20 + i * 26,
2057
+ y: "16",
2058
+ width: "8",
2059
+ height: "8",
2060
+ rx: "2"
2061
+ }, /* @__PURE__ */ React.createElement("animate", {
2062
+ attributeName: "y",
2063
+ from: "16",
2064
+ to: "16",
2065
+ dur: "2s",
2066
+ begin: `${i * 0.2}s`,
2067
+ repeatCount: "indefinite",
2068
+ values: "16; 6; 26; 16; 16",
2069
+ keyTimes: "0; 0.1; 0.3; 0.4; 1",
2070
+ id: "circ-anim"
2071
+ })))))))));
2072
+ }
2073
+ function isWindow(element) {
2074
+ return element === window;
2075
+ }
2076
+ function InfiniteScroll(props) {
2077
+ const { className, hasMore, loadMore, threshold = 0, style } = props;
2078
+ const doLoadMore = useLockFn(async () => {
2079
+ await loadMore();
2080
+ });
2081
+ const elementRef = useRef(null);
2082
+ const check = usePersistFn(() => {
2083
+ if (!hasMore)
2084
+ return;
2085
+ const element = elementRef.current;
2086
+ if (!element)
2087
+ return;
2088
+ const parent = getScrollParent(element);
2089
+ if (!parent)
2090
+ return;
2091
+ const elementTop = element.getBoundingClientRect().top;
2092
+ const current = isWindow(parent) ? window.innerHeight : parent.getBoundingClientRect().bottom;
2093
+ if (current >= elementTop - threshold) {
2094
+ doLoadMore();
2095
+ }
2096
+ });
2097
+ useEffect(() => {
2098
+ check();
2099
+ });
2100
+ useEffect(() => {
2101
+ const element = elementRef.current;
2102
+ if (!element)
2103
+ return;
2104
+ const parent = getScrollParent(element);
2105
+ if (!parent)
2106
+ return;
2107
+ function onScroll() {
2108
+ check();
2109
+ }
2110
+ parent.addEventListener("scroll", onScroll);
2111
+ return () => {
2112
+ parent.removeEventListener("scroll", onScroll);
2113
+ };
2114
+ }, []);
2115
+ return /* @__PURE__ */ React.createElement("div", {
2116
+ className: classNames({ [className]: true, "pda-infinite-scroll": true }),
2117
+ style,
2118
+ ref: elementRef
2119
+ }, hasMore ? /* @__PURE__ */ React.createElement("div", {
2120
+ className: "pda-infinite-scroll-view"
2121
+ }, /* @__PURE__ */ React.createElement("span", null, "\u52A0\u8F7D\u4E2D"), /* @__PURE__ */ React.createElement(Loading, null)) : /* @__PURE__ */ React.createElement("div", {
2122
+ className: "pda-infinite-scroll-view"
2123
+ }, /* @__PURE__ */ React.createElement("span", null, "\u6CA1\u6709\u66F4\u591A\u4E86~")));
2124
+ }
2125
+ var index$3 = "";
2126
+ function ActionSheet(props) {
2127
+ const { className = "", visible, actions = [], stickyToBottomActions = [], stickyToBottomDirection = "column", infiniteScroll = null } = props;
2128
+ return /* @__PURE__ */ React.createElement("div", {
2129
+ className: classNames({ [className]: true, "action-sheet": true, "show": visible })
2130
+ }, /* @__PURE__ */ React.createElement("div", {
2131
+ className: "action-sheet-container"
2132
+ }, /* @__PURE__ */ React.createElement("div", {
2133
+ className: "action-sheet-body"
2134
+ }, actions.map((item, index2) => {
2135
+ return /* @__PURE__ */ React.createElement("div", {
2136
+ onClick: () => {
2137
+ item.onClick(item.key);
2138
+ },
2139
+ className: "action-sheet-item",
2140
+ key: index2
2141
+ }, item.title);
2142
+ }), infiniteScroll ? /* @__PURE__ */ React.createElement(InfiniteScroll, __spreadValues({}, infiniteScroll)) : null), stickyToBottomActions.length > 0 ? /* @__PURE__ */ React.createElement("div", {
2143
+ className: classNames({ "action-sheet-sticky-bottom": true, ["action-sheet-sticky-bottom-" + stickyToBottomDirection]: true })
2144
+ }, stickyToBottomActions.map((item, index2) => {
2145
+ return /* @__PURE__ */ React.createElement("div", {
2146
+ onClick: () => {
2147
+ item.onClick(item.key);
2148
+ },
2149
+ className: "action-sheet-item",
2150
+ key: index2
2151
+ }, item.title);
2152
+ })) : null));
2153
+ }
2154
+ var index$2 = "";
2155
+ function Tag(props) {
2156
+ const { className = void 0, label = "label", type = "success" } = props;
2157
+ return /* @__PURE__ */ React.createElement("div", {
2158
+ className: classNames({ [className]: true, "pda-tag": true, ["pda-tag-" + type]: true })
2159
+ }, label);
2160
+ }
2161
+ var index$1 = "";
2162
+ function SimpleCard(props) {
2163
+ const { className = void 0, title = "", content = "", type = "default", onClick = () => {
2164
+ } } = props;
2165
+ return title || content ? /* @__PURE__ */ React.createElement("div", {
2166
+ className: classNames({ [className]: true, "simple-card": true, ["simple-card-" + type]: true }),
2167
+ onClick
2168
+ }, /* @__PURE__ */ React.createElement("p", {
2169
+ className: "simple-card-title"
2170
+ }, title), /* @__PURE__ */ React.createElement("p", {
2171
+ className: "simple-card-content"
2172
+ }, content)) : null;
2173
+ }
2174
+ var index = "";
2175
+ function SimpleCardBlock(props) {
2176
+ const { className = void 0, dataSource = [], title = "", tag } = props;
2177
+ return /* @__PURE__ */ React.createElement("div", {
2178
+ className: classNames({ [className]: true, "simple-card-block": true })
2179
+ }, /* @__PURE__ */ React.createElement("div", {
2180
+ className: "simple-card-block-header"
2181
+ }, /* @__PURE__ */ React.createElement("p", {
2182
+ className: "simple-card-block-title"
2183
+ }, title), tag ? /* @__PURE__ */ React.createElement("div", {
2184
+ style: { marginLeft: 12 }
2185
+ }, /* @__PURE__ */ React.createElement(Tag, __spreadValues({}, tag))) : null), dataSource.length > 0 ? /* @__PURE__ */ React.createElement("div", {
2186
+ className: "simple-card-block-content"
2187
+ }, dataSource.map((item, index2) => {
2188
+ return /* @__PURE__ */ React.createElement(SimpleCard, __spreadValues({
2189
+ key: index2
2190
+ }, item));
2191
+ }), /* @__PURE__ */ React.createElement("div", {
2192
+ style: { display: "inline-block", padding: "12px 18px" }
2193
+ }), /* @__PURE__ */ React.createElement("div", {
2194
+ style: { display: "inline-block", padding: "0 18px", margin: 0 }
2195
+ })) : null);
2196
+ }
2197
+ const ListItem = PdaListItem;
2198
+ export { ActionSheet, index$5 as AppList, BaseLayout, Button, Confirm, PdaDistanceCard as DistanceCard, PdaFinishCard as FinishCard, index$q as Header, InfiniteScroll, PdaInfoCard$2 as InfoCard, Keyborard, List, ListItem, Overlay$1 as Overlay, index$h as PageFlowSystemPages, Presentation, SelectCard, SimpleCard, SimpleCardBlock, PdaInfoCard as Steps, SubCard, Tag, PdaListItem as TaskCard, PdaTitle as Title, Toast, WakeKeyborard };