@cniot/android-pda-components 0.2.39 → 0.2.42

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 CHANGED
@@ -33,7 +33,7 @@ var __publicField = (obj, key, value) => {
33
33
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
34
34
  return value;
35
35
  };
36
- import React, { useState, useEffect, useRef, cloneElement, useCallback } from "react";
36
+ import React, { useState, useEffect, useRef, Component, cloneElement, useCallback } from "react";
37
37
  import ReactDOM from "react-dom";
38
38
  var global = "";
39
39
  var _classnames_2_3_1_classnames = { exports: {} };
@@ -84,7 +84,7 @@ var _classnames_2_3_1_classnames = { exports: {} };
84
84
  })();
85
85
  })(_classnames_2_3_1_classnames);
86
86
  var classNames = _classnames_2_3_1_classnames.exports;
87
- var index$t = "";
87
+ var index$v = "";
88
88
  function getTypeClass$2(type) {
89
89
  return {
90
90
  "center": "op-overlay center",
@@ -113,7 +113,7 @@ function Overlay$1(props) {
113
113
  className: getTypeClass$2(verticalPosition)
114
114
  }, option), props.children) : null;
115
115
  }
116
- var index$s = "";
116
+ var index$u = "";
117
117
  const blankFunc$6 = () => {
118
118
  };
119
119
  class PdaTitle extends React.Component {
@@ -281,7 +281,7 @@ var _keycode_2_2_1_keycode = { exports: {} };
281
281
  }
282
282
  })(_keycode_2_2_1_keycode, _keycode_2_2_1_keycode.exports);
283
283
  var keycode = _keycode_2_2_1_keycode.exports;
284
- var index$r = "";
284
+ var index$t = "";
285
285
  function Button(props) {
286
286
  const { type = "default", onClick, className = "", tabIndex = 1, dataClick = "" } = props;
287
287
  let opt = {};
@@ -303,7 +303,7 @@ Button.Group = ButtonGroup;
303
303
  const SPECIAL_KEY_MAP = ["fn"];
304
304
  const empty$3 = () => {
305
305
  };
306
- function index$q(props) {
306
+ function index$s(props) {
307
307
  const {
308
308
  onBack,
309
309
  icon,
@@ -422,7 +422,7 @@ function addEventListener(node, eventName, fn) {
422
422
  node.removeEventListener(eventName, fn);
423
423
  };
424
424
  }
425
- var index$p = "";
425
+ var index$r = "";
426
426
  class PdaInfoCard$2 extends React.Component {
427
427
  constructor(props) {
428
428
  super(props);
@@ -480,7 +480,7 @@ class PdaInfoCard$2 extends React.Component {
480
480
  }
481
481
  }
482
482
  PdaInfoCard$2.IMAGE_1 = "https://img.alicdn.com/imgextra/i2/O1CN01qYuxip1ME9zhdL9XG_!!6000000001402-2-tps-150-150.png";
483
- var index$o = "";
483
+ var index$q = "";
484
484
  class PdaListItem extends React.Component {
485
485
  constructor(props) {
486
486
  super(props);
@@ -526,7 +526,7 @@ class PdaListItem extends React.Component {
526
526
  }));
527
527
  }
528
528
  }
529
- var index$n = "";
529
+ var index$p = "";
530
530
  function empty$2() {
531
531
  }
532
532
  function Confirm(props) {
@@ -571,7 +571,7 @@ function Confirm(props) {
571
571
  dataClick: item.dataClick
572
572
  }, item.label))) : null));
573
573
  }
574
- var index$m = "";
574
+ var index$o = "";
575
575
  function WindVaneLog(param) {
576
576
  const params = {
577
577
  domain: "logger",
@@ -755,7 +755,7 @@ function confirm(props) {
755
755
  onClick: onNext
756
756
  })));
757
757
  }
758
- var index$l = "";
758
+ var index$n = "";
759
759
  function getTypeClass(type) {
760
760
  return {
761
761
  "center": "op-overlay center",
@@ -784,7 +784,7 @@ function Overlay(props) {
784
784
  className: getTypeClass(verticalPosition)
785
785
  }, option), props.children) : null;
786
786
  }
787
- var index$k = "";
787
+ var index$m = "";
788
788
  function Prompt(props) {
789
789
  const inputRef = React.useRef();
790
790
  const { data = {}, onNext } = props;
@@ -855,7 +855,7 @@ function splitMessage(message) {
855
855
  var msg = String(message).split("by Error:");
856
856
  return msg[1] || msg[0];
857
857
  }
858
- var index$j = "";
858
+ var index$l = "";
859
859
  function NotFound(props) {
860
860
  return /* @__PURE__ */ React.createElement("div", {
861
861
  style: { padding: "20%" }
@@ -863,199 +863,9 @@ function NotFound(props) {
863
863
  style: { fontSize: "60%" }
864
864
  }, "Not found")), /* @__PURE__ */ React.createElement("div", null, props.action.getPage()));
865
865
  }
866
- function _extends() {
867
- _extends = Object.assign || function(target) {
868
- for (var i = 1; i < arguments.length; i++) {
869
- var source = arguments[i];
870
- for (var key in source) {
871
- if (Object.prototype.hasOwnProperty.call(source, key)) {
872
- target[key] = source[key];
873
- }
874
- }
875
- }
876
- return target;
877
- };
878
- return _extends.apply(this, arguments);
879
- }
880
- var r, B = r || (r = {});
881
- B.Pop = "POP";
882
- B.Push = "PUSH";
883
- B.Replace = "REPLACE";
884
- var C = function(b) {
885
- return b;
886
- };
887
- function E(b) {
888
- b.preventDefault();
889
- b.returnValue = "";
890
- }
891
- function F() {
892
- var b = [];
893
- return { get length() {
894
- return b.length;
895
- }, push: function(h) {
896
- b.push(h);
897
- return function() {
898
- b = b.filter(function(k) {
899
- return k !== h;
900
- });
901
- };
902
- }, call: function(h) {
903
- b.forEach(function(k) {
904
- return k && k(h);
905
- });
906
- } };
907
- }
908
- function H() {
909
- return Math.random().toString(36).substr(2, 8);
910
- }
911
- function I(b) {
912
- var h = b.pathname, k = b.search;
913
- b = b.hash;
914
- return (h === void 0 ? "/" : h) + (k === void 0 ? "" : k) + (b === void 0 ? "" : b);
915
- }
916
- function J(b) {
917
- var h = {};
918
- if (b) {
919
- var k = b.indexOf("#");
920
- 0 <= k && (h.hash = b.substr(k), b = b.substr(0, k));
921
- k = b.indexOf("?");
922
- 0 <= k && (h.search = b.substr(k), b = b.substr(0, k));
923
- b && (h.pathname = b);
924
- }
925
- return h;
926
- }
927
- function createHashHistory(b) {
928
- function h() {
929
- var a = J(m.location.hash.substr(1)), e = a.pathname, l = a.search;
930
- a = a.hash;
931
- var g = u.state || {};
932
- 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" })];
933
- }
934
- function k() {
935
- if (t)
936
- c.call(t), t = null;
937
- else {
938
- var a = r.Pop, e = h(), l = e[0];
939
- e = e[1];
940
- if (c.length)
941
- if (l != null) {
942
- var g = q - l;
943
- g && (t = { action: a, location: e, retry: function() {
944
- p(-1 * g);
945
- } }, p(g));
946
- } else
947
- ;
948
- else
949
- A(a);
950
- }
951
- }
952
- function x(a) {
953
- var e = document.querySelector("base"), l = "";
954
- e && e.getAttribute("href") && (e = m.location.href, l = e.indexOf("#"), l = l === -1 ? e : e.slice(0, l));
955
- return l + "#" + (typeof a === "string" ? a : I(a));
956
- }
957
- function z(a, e) {
958
- e === void 0 && (e = null);
959
- return C(_extends({ pathname: d.pathname, hash: "", search: "" }, typeof a === "string" ? J(a) : a, { state: e, key: H() }));
960
- }
961
- function A(a) {
962
- v = a;
963
- a = h();
964
- q = a[0];
965
- d = a[1];
966
- f.call({ action: v, location: d });
967
- }
968
- function y(a, e) {
969
- function l() {
970
- y(a, e);
971
- }
972
- var g = r.Push, n = z(a, e);
973
- if (!c.length || (c.call({ action: g, location: n, retry: l }), false)) {
974
- var G = [{ usr: n.state, key: n.key, idx: q + 1 }, x(n)];
975
- n = G[0];
976
- G = G[1];
977
- try {
978
- u.pushState(n, "", G);
979
- } catch (K) {
980
- m.location.assign(G);
981
- }
982
- A(g);
983
- }
984
- }
985
- function w(a, e) {
986
- function l() {
987
- w(a, e);
988
- }
989
- var g = r.Replace, n = z(a, e);
990
- c.length && (c.call({ action: g, location: n, retry: l }), 1) || (n = [{ usr: n.state, key: n.key, idx: q }, x(n)], u.replaceState(n[0], "", n[1]), A(g));
991
- }
992
- function p(a) {
993
- u.go(a);
994
- }
995
- b === void 0 && (b = {});
996
- b = b.window;
997
- var m = b === void 0 ? document.defaultView : b, u = m.history, t = null;
998
- m.addEventListener("popstate", k);
999
- m.addEventListener("hashchange", function() {
1000
- var a = h()[1];
1001
- I(a) !== I(d) && k();
1002
- });
1003
- var v = r.Pop;
1004
- b = h();
1005
- var q = b[0], d = b[1], f = F(), c = F();
1006
- q == null && (q = 0, u.replaceState(_extends({}, u.state, { idx: q }), ""));
1007
- return {
1008
- get action() {
1009
- return v;
1010
- },
1011
- get location() {
1012
- return d;
1013
- },
1014
- createHref: x,
1015
- push: y,
1016
- replace: w,
1017
- go: p,
1018
- back: function() {
1019
- p(-1);
1020
- },
1021
- forward: function() {
1022
- p(1);
1023
- },
1024
- listen: function(a) {
1025
- return f.push(a);
1026
- },
1027
- block: function(a) {
1028
- var e = c.push(a);
1029
- c.length === 1 && m.addEventListener("beforeunload", E);
1030
- return function() {
1031
- e();
1032
- c.length || m.removeEventListener("beforeunload", E);
1033
- };
1034
- }
1035
- };
1036
- }
1037
- var index$i = "";
1038
- function Debug(props) {
1039
- const { appManager } = props;
1040
- const pages = Array.from(appManager.pageManager.keys()).reverse();
1041
- React.useEffect(function() {
1042
- const history = createHashHistory();
1043
- const unListen = history.listen(({ action, location }) => {
1044
- const pathname = location.pathname;
1045
- appManager.mockToPage(pathname, {});
1046
- });
1047
- return unListen;
1048
- }, []);
1049
- return /* @__PURE__ */ React.createElement("div", {
1050
- className: "local-debug-side"
1051
- }, /* @__PURE__ */ React.createElement("ul", null, pages.map((pathname) => /* @__PURE__ */ React.createElement("li", {
1052
- key: pathname
1053
- }, /* @__PURE__ */ React.createElement("a", {
1054
- href: `#${pathname}`
1055
- }, pathname)))));
1056
- }
866
+ var index$k = "";
1057
867
  function Loading$1(props) {
1058
- const [showLoading, setShowLoading] = React.useState(false);
868
+ const [showLoading, setShowLoading] = React.useState(props.visible);
1059
869
  const edgeService = props.edgeService;
1060
870
  React.useEffect(function() {
1061
871
  let currentLoading = false;
@@ -1084,8 +894,19 @@ function Loading$1(props) {
1084
894
  };
1085
895
  }, [edgeService]);
1086
896
  return showLoading ? /* @__PURE__ */ React.createElement("div", {
1087
- style: { position: "absolute", left: 0, top: 0, zIndex: 100 }
1088
- }, "LOADING...") : null;
897
+ className: "loading-wrap"
898
+ }, /* @__PURE__ */ React.createElement("div", {
899
+ className: "loading-box"
900
+ }, /* @__PURE__ */ React.createElement("svg", {
901
+ t: "1647243772165",
902
+ viewBox: "0 0 1024 1024",
903
+ version: "1.1",
904
+ xmlns: "http://www.w3.org/2000/svg",
905
+ "p-id": "2178"
906
+ }, /* @__PURE__ */ React.createElement("path", {
907
+ d: "M512 64c247.2 0 448 200.8 448 448h-64c0-212-172-384-384-384V64z m0 832c-212 0-384-172-384-384H64c0 247.2 200.8 448 448 448v-64z",
908
+ "p-id": "2179"
909
+ })), /* @__PURE__ */ React.createElement("div", null, "LOADING..."))) : null;
1089
910
  }
1090
911
  function PlaySound({ data, service, action }) {
1091
912
  const { sound } = data;
@@ -1100,7 +921,11 @@ function PlaySound({ data, service, action }) {
1100
921
  service.onNext({});
1101
922
  return null;
1102
923
  }
1103
- var index$h = {
924
+ function Debug() {
925
+ console.warn('Please stop using "Debug" Components');
926
+ return null;
927
+ }
928
+ var index$j = {
1104
929
  Alert,
1105
930
  Start,
1106
931
  Toast: toast,
@@ -1111,7 +936,7 @@ var index$h = {
1111
936
  Loading: Loading$1,
1112
937
  PlaySound
1113
938
  };
1114
- var index$g = "";
939
+ var index$i = "";
1115
940
  function Presentation(props) {
1116
941
  const {
1117
942
  image = Presentation.IMAGE_1,
@@ -1133,7 +958,7 @@ Presentation.IMAGE_1 = "https://img.alicdn.com/imgextra/i3/O1CN019Ivkor1ksy3pMGD
1133
958
  Presentation.IMAGE_2 = "https://img.alicdn.com/imgextra/i1/O1CN01lhSunu1X4VPw1Mlas_!!6000000002870-2-tps-352-158.png";
1134
959
  Presentation.IMAGE_3 = "https://img.alicdn.com/imgextra/i1/O1CN01mreYXo1XfbUsQ7hip_!!6000000002951-2-tps-322-144.png";
1135
960
  Presentation.IMAGE_4 = "https://img.alicdn.com/imgextra/i3/O1CN017gNM8F1Fmmcfti7Dg_!!6000000000530-1-tps-414-286.gif";
1136
- var index$f = "";
961
+ var index$h = "";
1137
962
  function empty$1() {
1138
963
  }
1139
964
  function List(props) {
@@ -1179,7 +1004,7 @@ function DefaultItem(props) {
1179
1004
  }, extra));
1180
1005
  }
1181
1006
  List.Item = DefaultItem;
1182
- var index$e = "";
1007
+ var index$g = "";
1183
1008
  const blankFunc$5 = () => {
1184
1009
  };
1185
1010
  class BaseLayoutContainer extends React.Component {
@@ -1521,7 +1346,7 @@ class BaseLayout extends React.Component {
1521
1346
  return /* @__PURE__ */ React.createElement(BaseLayoutContainer, __spreadValues({}, props));
1522
1347
  }
1523
1348
  }
1524
- var index$d = "";
1349
+ var index$f = "";
1525
1350
  const blankFunc$1 = () => {
1526
1351
  };
1527
1352
  function Keyborard(props) {
@@ -1597,6 +1422,351 @@ function WakeKeyborard(props) {
1597
1422
  }) : null);
1598
1423
  }
1599
1424
  WakeKeyborard.Keyborard = Keyborard;
1425
+ const classPrefix$3 = "image-uploader";
1426
+ class PreviewItem extends Component {
1427
+ constructor(props) {
1428
+ super(props);
1429
+ this.state = {};
1430
+ }
1431
+ renderDelete() {
1432
+ return /* @__PURE__ */ React.createElement("span", {
1433
+ className: `${classPrefix$3}-cell-delete`,
1434
+ onClick: this.props.onDelete
1435
+ }, /* @__PURE__ */ React.createElement("img", {
1436
+ className: "uploader-delete-icon",
1437
+ alt: "close",
1438
+ src: "https://img.alicdn.com/imgextra/i2/O1CN01MInPNX1FWIOjjrlea_!!6000000000494-2-tps-32-32.png"
1439
+ }));
1440
+ }
1441
+ render() {
1442
+ const { src, deletable, onView, box } = this.props;
1443
+ return /* @__PURE__ */ React.createElement("div", {
1444
+ className: "image-space-item"
1445
+ }, /* @__PURE__ */ React.createElement("div", {
1446
+ className: `${classPrefix$3}-cell`,
1447
+ style: { width: box, height: box }
1448
+ }, /* @__PURE__ */ React.createElement("div", {
1449
+ className: `${classPrefix$3}-cell-image`,
1450
+ style: { width: box, height: box }
1451
+ }, /* @__PURE__ */ React.createElement("img", {
1452
+ className: `${classPrefix$3}-img`,
1453
+ src,
1454
+ fit: "cover",
1455
+ onClick: onView
1456
+ })), deletable && this.renderDelete()));
1457
+ }
1458
+ }
1459
+ const classPrefix$2 = "image-uploader";
1460
+ class UploadeButton extends Component {
1461
+ constructor(props) {
1462
+ super(props);
1463
+ this.state = {};
1464
+ }
1465
+ render() {
1466
+ const { box } = this.props;
1467
+ return /* @__PURE__ */ React.createElement("div", {
1468
+ className: `image-space-item`
1469
+ }, /* @__PURE__ */ React.createElement("div", {
1470
+ className: `${classPrefix$2}-upload-button-wrap`,
1471
+ onClick: this.props.onUpload
1472
+ }, /* @__PURE__ */ React.createElement("span", {
1473
+ className: `${classPrefix$2}-upload-button image-uploader-cell`,
1474
+ style: { width: box, height: box }
1475
+ }, /* @__PURE__ */ React.createElement("img", {
1476
+ className: "uploader-add-icon",
1477
+ alt: "add",
1478
+ src: "https://img.alicdn.com/imgextra/i1/O1CN01RipHZ11yVyprbUP5B_!!6000000006585-2-tps-32-32.png"
1479
+ }))));
1480
+ }
1481
+ }
1482
+ var index$e = "";
1483
+ const classPrefix$1 = "image-viewer";
1484
+ class ImageViewer extends Component {
1485
+ constructor(props) {
1486
+ super(props);
1487
+ __publicField(this, "onShow", (index2 = 0) => {
1488
+ const { props } = this;
1489
+ let newIdx = 0;
1490
+ if (typeof index2 !== "number") {
1491
+ newIdx = 0;
1492
+ } else {
1493
+ newIdx = index2 > props.images.length - 1 ? 0 : index2;
1494
+ }
1495
+ this.setState({
1496
+ visible: true,
1497
+ currentIndex: newIdx,
1498
+ loading: true
1499
+ });
1500
+ });
1501
+ __publicField(this, "onHide", () => {
1502
+ this.setState({
1503
+ visible: false
1504
+ });
1505
+ });
1506
+ __publicField(this, "handleImageLoaded", (e) => {
1507
+ this.setState({
1508
+ loading: false
1509
+ });
1510
+ });
1511
+ __publicField(this, "onClickMask", (e) => {
1512
+ if (e.target.getAttribute("class") !== "image-viewer-image-wrapper" && e.target.getAttribute("class") !== "image-viewer-loading")
1513
+ return;
1514
+ const { afterClose } = this.props;
1515
+ this.setState({
1516
+ visible: false
1517
+ }, () => {
1518
+ afterClose && afterClose();
1519
+ });
1520
+ });
1521
+ __publicField(this, "onClose", () => {
1522
+ const { onDelete, images } = this.props;
1523
+ const { currentIndex } = this.state;
1524
+ if (images.length === 0) {
1525
+ this.setState({
1526
+ visible: false
1527
+ }, () => {
1528
+ onDelete && onDelete(images[currentIndex], currentIndex);
1529
+ });
1530
+ } else {
1531
+ this.setState({
1532
+ currentIndex: 0,
1533
+ visible: false
1534
+ }, () => {
1535
+ onDelete && onDelete(images[currentIndex], currentIndex);
1536
+ });
1537
+ }
1538
+ });
1539
+ __publicField(this, "onPrev", (e) => {
1540
+ e.stopPropagation();
1541
+ const { currentIndex } = this.state;
1542
+ this.setState({
1543
+ currentIndex: currentIndex - 1,
1544
+ loading: true
1545
+ });
1546
+ });
1547
+ __publicField(this, "onNext", (e) => {
1548
+ e.stopPropagation();
1549
+ const { currentIndex } = this.state;
1550
+ this.setState({
1551
+ currentIndex: currentIndex + 1,
1552
+ loading: true
1553
+ });
1554
+ });
1555
+ this.state = {
1556
+ visible: false,
1557
+ currentIndex: 0,
1558
+ loading: false
1559
+ };
1560
+ }
1561
+ render() {
1562
+ const { currentIndex, visible, loading } = this.state;
1563
+ const { images } = this.props;
1564
+ return /* @__PURE__ */ React.createElement("div", null, visible ? /* @__PURE__ */ React.createElement("div", {
1565
+ className: "v-mask",
1566
+ onClick: this.onClickMask
1567
+ }, /* @__PURE__ */ React.createElement("div", {
1568
+ className: `v-mask-content`
1569
+ }, /* @__PURE__ */ React.createElement("div", {
1570
+ className: `${classPrefix$1}-content`
1571
+ }, /* @__PURE__ */ React.createElement("div", {
1572
+ className: `${classPrefix$1}-slides`
1573
+ }, /* @__PURE__ */ React.createElement("div", {
1574
+ className: "image-viewer-indicator"
1575
+ }, currentIndex + 1, " / ", images.length), /* @__PURE__ */ React.createElement("div", {
1576
+ className: "viewer-image-close",
1577
+ onClick: this.onClose
1578
+ }, /* @__PURE__ */ React.createElement("svg", {
1579
+ width: "44",
1580
+ height: "44",
1581
+ viewBox: "0 0 768 768"
1582
+ }, /* @__PURE__ */ React.createElement("path", {
1583
+ fill: "#FFF",
1584
+ d: "M607.5 205.5l-178.5 178.5 178.5 178.5-45 45-178.5-178.5-178.5 178.5-45-45 178.5-178.5-178.5-178.5 45-45 178.5 178.5 178.5-178.5z"
1585
+ }))), /* @__PURE__ */ React.createElement("div", {
1586
+ className: "image-viewer-slides-inner"
1587
+ }, /* @__PURE__ */ React.createElement("div", {
1588
+ className: "image-viewer-image-wrapper"
1589
+ }, /* @__PURE__ */ React.createElement("img", {
1590
+ src: this.props.images[currentIndex].url,
1591
+ style: { width: loading ? 1 : "auto" },
1592
+ onLoad: this.handleImageLoaded
1593
+ }))), images.length > 1 ? /* @__PURE__ */ React.createElement(React.Fragment, null, currentIndex === 0 ? null : /* @__PURE__ */ React.createElement("div", {
1594
+ className: "viewer-image-arrow viewer-prev",
1595
+ onClick: this.onPrev
1596
+ }, /* @__PURE__ */ React.createElement("svg", {
1597
+ width: "44",
1598
+ height: "44",
1599
+ viewBox: "0 0 768 768"
1600
+ }, /* @__PURE__ */ React.createElement("path", {
1601
+ d: "M640.5 352.5v63h-390l178.5 180-45 45-256.5-256.5 256.5-256.5 45 45-178.5 180h390z"
1602
+ }))), currentIndex === images.length - 1 ? null : /* @__PURE__ */ React.createElement("div", {
1603
+ className: "viewer-image-arrow viewer-next",
1604
+ onClick: this.onNext
1605
+ }, /* @__PURE__ */ React.createElement("svg", {
1606
+ width: "44",
1607
+ height: "44",
1608
+ viewBox: "0 0 768 768"
1609
+ }, /* @__PURE__ */ React.createElement("path", {
1610
+ d: "M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"
1611
+ })))) : null))), loading ? /* @__PURE__ */ React.createElement("div", {
1612
+ className: `${classPrefix$1}-loading`,
1613
+ onClick: this.onClose
1614
+ }, /* @__PURE__ */ React.createElement("div", {
1615
+ className: `${classPrefix$1}-loading-reactor`
1616
+ }, /* @__PURE__ */ React.createElement("svg", {
1617
+ viewBox: "0 0 32 32",
1618
+ width: "36",
1619
+ height: "36",
1620
+ fill: "white"
1621
+ }, /* @__PURE__ */ React.createElement("path", {
1622
+ opacity: ".25",
1623
+ d: "M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"
1624
+ }), /* @__PURE__ */ React.createElement("path", {
1625
+ d: "M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"
1626
+ })))) : null) : null);
1627
+ }
1628
+ }
1629
+ const classPrefix = "image-uploader";
1630
+ class ImageUploader extends Component {
1631
+ constructor(props) {
1632
+ super(props);
1633
+ __publicField(this, "onViewImage", (index2) => {
1634
+ this.imgRef.onShow(index2);
1635
+ });
1636
+ __publicField(this, "onClickAdd", () => {
1637
+ const { capture } = this.props;
1638
+ const self = this;
1639
+ const isCameraMode = capture && capture === "camera";
1640
+ const params = {
1641
+ type: "0",
1642
+ mode: isCameraMode ? "camera" : "photo"
1643
+ };
1644
+ const p = {
1645
+ ios: "taobao://",
1646
+ android: "com.taobao.taobao"
1647
+ };
1648
+ window.WindVane.call("Base", "isInstall", p, function() {
1649
+ self.handlerUpload(params);
1650
+ }, function() {
1651
+ self.handlerUploadNavigator();
1652
+ });
1653
+ });
1654
+ __publicField(this, "handlerUploadNavigator", () => {
1655
+ const { beforeUpload } = this.props;
1656
+ const dom = document.querySelector("#inputFile");
1657
+ dom.click();
1658
+ dom.onchange = (e) => {
1659
+ let fileData = e.target.files[0];
1660
+ const reader = new FileReader();
1661
+ reader.readAsDataURL(fileData);
1662
+ reader.onload = (event) => {
1663
+ const base64 = event.target.result;
1664
+ beforeUpload && beforeUpload({
1665
+ data: base64
1666
+ });
1667
+ };
1668
+ const windowURL = window.URL || window.webkitURL;
1669
+ const imgSrc = windowURL.createObjectURL(fileData);
1670
+ const { images } = this.state;
1671
+ const uid = (Math.random() * 1e4).toFixed(0);
1672
+ this.setState({
1673
+ images: [...images, { id: uid, url: imgSrc }]
1674
+ });
1675
+ };
1676
+ });
1677
+ __publicField(this, "handlerUpload", (params) => {
1678
+ const { beforeUpload } = this.props;
1679
+ window.WindVane.call("WVCamera", "takePhoto", params, function(e) {
1680
+ const plugin = {
1681
+ domain: "camera",
1682
+ method: "getBase64",
1683
+ params: {
1684
+ filePath: e.localPath
1685
+ }
1686
+ };
1687
+ window.WindVane.call("WindvanePlugin", "invoke", JSON.stringify(plugin), function(res) {
1688
+ beforeUpload && beforeUpload(res.data);
1689
+ }, function(err) {
1690
+ console.log("failure " + JSON.stringify(err));
1691
+ });
1692
+ }, function(err) {
1693
+ console.log("takePhoto failure: " + JSON.stringify(err));
1694
+ });
1695
+ });
1696
+ __publicField(this, "onDelete", (item, index2) => {
1697
+ const { onDelete } = this.props;
1698
+ onDelete && onDelete(item, index2);
1699
+ });
1700
+ __publicField(this, "_showLoading", () => {
1701
+ this.setState({
1702
+ loading: true
1703
+ });
1704
+ });
1705
+ __publicField(this, "_hideLoading", () => {
1706
+ setTimeout(() => {
1707
+ this.setState({
1708
+ loading: false
1709
+ });
1710
+ }, 10 * 1e3);
1711
+ });
1712
+ this.state = {
1713
+ images: [],
1714
+ loading: false
1715
+ };
1716
+ }
1717
+ componentDidMount() {
1718
+ this.setState({
1719
+ images: this.props.value
1720
+ });
1721
+ }
1722
+ render() {
1723
+ const { value, loading = false } = this.props;
1724
+ const { maxCount = 1, deletable = false, capture = "camera", box = 80 } = this.props;
1725
+ const { images } = this.state;
1726
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
1727
+ className: `${classPrefix}`
1728
+ }, /* @__PURE__ */ React.createElement("input", {
1729
+ type: "file",
1730
+ name: "file",
1731
+ accept: "image/*",
1732
+ id: "inputFile",
1733
+ style: { display: "none" }
1734
+ }), /* @__PURE__ */ React.createElement("div", {
1735
+ className: `${classPrefix}-wrap`
1736
+ }, images && images.map((item, index2) => {
1737
+ return /* @__PURE__ */ React.createElement(PreviewItem, {
1738
+ src: item.url,
1739
+ key: item.url,
1740
+ box,
1741
+ deletable,
1742
+ onDelete: () => this.onDelete(item, index2),
1743
+ onView: () => this.onViewImage(index2)
1744
+ });
1745
+ }), images && images.length < maxCount ? /* @__PURE__ */ React.createElement(UploadeButton, {
1746
+ box,
1747
+ onUpload: this.onClickAdd
1748
+ }) : null)), loading ? /* @__PURE__ */ React.createElement("div", {
1749
+ className: `${classPrefix}-loading`
1750
+ }, /* @__PURE__ */ React.createElement("div", {
1751
+ className: `${classPrefix}-loading-reactor`
1752
+ }, /* @__PURE__ */ React.createElement("svg", {
1753
+ viewBox: "0 0 32 32",
1754
+ width: "36",
1755
+ height: "36",
1756
+ fill: "white"
1757
+ }, /* @__PURE__ */ React.createElement("path", {
1758
+ opacity: ".25",
1759
+ d: "M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"
1760
+ }), /* @__PURE__ */ React.createElement("path", {
1761
+ d: "M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"
1762
+ })))) : null, /* @__PURE__ */ React.createElement(ImageViewer, {
1763
+ ref: (ref) => this.imgRef = ref,
1764
+ images: value,
1765
+ onDelete: this.onDelete
1766
+ }));
1767
+ }
1768
+ }
1769
+ var index$d = "";
1600
1770
  var index$c = "";
1601
1771
  var index$b = "";
1602
1772
  class PdaInfoCard$1 extends React.Component {
@@ -1939,10 +2109,10 @@ var __read = globalThis && globalThis.__read || function(o, n) {
1939
2109
  var m = typeof Symbol === "function" && o[Symbol.iterator];
1940
2110
  if (!m)
1941
2111
  return o;
1942
- var i = m.call(o), r2, ar = [], e;
2112
+ var i = m.call(o), r, ar = [], e;
1943
2113
  try {
1944
- while ((n === void 0 || n-- > 0) && !(r2 = i.next()).done) {
1945
- ar.push(r2.value);
2114
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
2115
+ ar.push(r.value);
1946
2116
  }
1947
2117
  } catch (error) {
1948
2118
  e = {
@@ -1950,7 +2120,7 @@ var __read = globalThis && globalThis.__read || function(o, n) {
1950
2120
  };
1951
2121
  } finally {
1952
2122
  try {
1953
- if (r2 && !r2.done && (m = i["return"]))
2123
+ if (r && !r.done && (m = i["return"]))
1954
2124
  m.call(i);
1955
2125
  } finally {
1956
2126
  if (e)
@@ -2208,4 +2378,4 @@ function SimpleCardBlock(props) {
2208
2378
  })) : null);
2209
2379
  }
2210
2380
  const ListItem = PdaListItem;
2211
- 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 };
2381
+ export { ActionSheet, index$5 as AppList, BaseLayout, Button, Confirm, PdaDistanceCard as DistanceCard, PdaFinishCard as FinishCard, index$s as Header, ImageUploader, ImageViewer, InfiniteScroll, PdaInfoCard$2 as InfoCard, Keyborard, List, ListItem, Overlay$1 as Overlay, index$j as PageFlowSystemPages, Presentation, SelectCard, SimpleCard, SimpleCardBlock, PdaInfoCard as Steps, SubCard, Tag, PdaListItem as TaskCard, PdaTitle as Title, Toast, WakeKeyborard };