@pisell/materials 1.0.662 → 1.0.664

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.
Files changed (53) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +6 -6
  6. package/build/lowcode/preview.js +5 -5
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +14 -14
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +14 -14
  11. package/es/components/dataSourceComponents/dataSourceTable/BaseTable.d.ts +8 -0
  12. package/es/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +1 -0
  13. package/es/components/dataSourceComponents/dataSourceTable/filter/utils.d.ts +1 -0
  14. package/es/components/dataSourceComponents/dataSourceTable/hooks/useColumns.d.ts +11 -0
  15. package/es/components/dataSourceComponents/dataSourceTable/hooks/useFormat.d.ts +48 -0
  16. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +98 -0
  17. package/es/components/dataSourceComponents/fields/Input/WithMode.d.ts +8 -0
  18. package/es/components/dataSourceComponents/fields/Input/WithMode.js +204 -486
  19. package/es/components/dataSourceComponents/fields/Input/index.d.ts +22 -0
  20. package/es/components/dataSourceComponents/fields/Input/index.js +6 -19
  21. package/es/components/dataSourceComponents/fields/Input/type.d.ts +8 -0
  22. package/es/components/dataSourceComponents/fields/index.d.ts +10 -9
  23. package/es/components/dataSourceComponents/hooks/useActions.d.ts +18 -0
  24. package/es/components/pisellScan/index.js +3 -17
  25. package/es/components/productCard/hooks/useOpenNote.d.ts +3 -0
  26. package/es/components/productCard/index.d.ts +5 -0
  27. package/es/index.d.ts +139 -0
  28. package/es/locales/en-US.js +1 -1
  29. package/es/locales/zh-CN.js +2 -2
  30. package/es/locales/zh-TW.js +1 -1
  31. package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.d.ts +8 -0
  32. package/lib/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +1 -0
  33. package/lib/components/dataSourceComponents/dataSourceTable/filter/utils.d.ts +1 -0
  34. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useColumns.d.ts +11 -0
  35. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useFormat.d.ts +48 -0
  36. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +98 -0
  37. package/lib/components/dataSourceComponents/fields/Input/WithMode.d.ts +8 -0
  38. package/lib/components/dataSourceComponents/fields/Input/WithMode.js +101 -333
  39. package/lib/components/dataSourceComponents/fields/Input/index.d.ts +22 -0
  40. package/lib/components/dataSourceComponents/fields/Input/index.js +3 -13
  41. package/lib/components/dataSourceComponents/fields/Input/type.d.ts +8 -0
  42. package/lib/components/dataSourceComponents/fields/index.d.ts +10 -9
  43. package/lib/components/dataSourceComponents/hooks/useActions.d.ts +18 -0
  44. package/lib/components/pisellScan/index.js +3 -9
  45. package/lib/components/productCard/hooks/useOpenNote.d.ts +3 -0
  46. package/lib/components/productCard/index.d.ts +5 -0
  47. package/lib/index.d.ts +139 -0
  48. package/lib/locales/en-US.js +1 -9
  49. package/lib/locales/zh-CN.js +2 -10
  50. package/lib/locales/zh-TW.js +1 -9
  51. package/lowcode/form-item-input/meta.ts +5 -97
  52. package/lowcode/form-item-input/snippets.ts +1 -0
  53. package/package.json +1 -1
@@ -1,525 +1,243 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["allowScan", "scanCodeType", "language"];
2
+ var _excluded = ["enableQRScanner", "onChange", "suffix"];
3
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
8
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
4
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
10
5
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
11
6
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
12
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
13
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
14
7
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
15
8
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
16
9
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
17
10
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
18
11
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
19
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
- // @ts-nocheck
21
- import { Input as AntInput, Button, Upload, message } from 'antd';
22
- import React, { useState, useMemo, useEffect, useRef } from 'react';
23
- import { ScanOutlined, PictureOutlined, ArrowLeftOutlined } from '@ant-design/icons';
24
- import { BrowserMultiFormatReader, BarcodeFormat } from '@zxing/library';
13
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
14
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
15
+ import { Input as AntInput } from 'antd';
16
+ import React, { useRef, useState } from 'react';
17
+ import { QrcodeOutlined } from '@ant-design/icons';
18
+ import { message } from 'antd';
25
19
  import ReadPretty from "./ReadPretty";
26
20
  import { withMode } from "../../dataSourceForm/utils";
27
- import PisellScan from "../../../pisellScan";
28
- import { getText } from "../../../../locales";
29
- import { getCurrentLocale } from "../../../../utils/locale";
30
- import usePisellConfig from "../../../pisell-config-provider/hooks/usePisellConfig";
31
-
32
- // 为原生桥接声明全局类型
21
+ /**
22
+ * 判断当前设备是否为移动设备或平板电脑
23
+ *
24
+ * 使用UserAgent检测方法判断设备类型,在非浏览器环境返回false
25
+ * 仅在移动设备上启用扫码功能,因为PC端通常没有摄像头或扫码需求
26
+ *
27
+ * @returns {boolean} 是否为移动设备
28
+ */
29
+ var isMobileOrTablet = function isMobileOrTablet() {
30
+ if (typeof window === 'undefined') return false;
31
+ return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
32
+ };
33
33
 
34
- // 用于判断是否处于开发环境
35
- var isDevelopEnv = process.env.NODE_ENV === 'development';
34
+ /**
35
+ * 输入框组件,支持扫码功能
36
+ *
37
+ * 在移动设备上,当启用扫码功能时,输入框右侧会显示一个扫码图标
38
+ * 点击图标可以唤起设备的相机进行二维码扫描,将扫描结果自动填入输入框
39
+ *
40
+ * @param {InputProps} props - 组件属性
41
+ */
36
42
  var Input = function Input(props) {
43
+ // 解构属性,提取扫码相关的配置和其他Input属性
44
+ var enableQRScanner = props.enableQRScanner,
45
+ onChange = props.onChange,
46
+ suffix = props.suffix,
47
+ restProps = _objectWithoutProperties(props, _excluded);
48
+ // 用于引用隐藏的文件输入元素
49
+ var fileInputRef = useRef(null);
50
+ // 标记二维码处理状态,防止重复处理
37
51
  var _useState = useState(false),
38
52
  _useState2 = _slicedToArray(_useState, 2),
39
- scanVisible = _useState2[0],
40
- setScanVisible = _useState2[1];
41
- var _usePisellConfig = usePisellConfig(),
42
- _usePisellConfig$plat = _usePisellConfig.platform,
43
- platform = _usePisellConfig$plat === void 0 ? 'pc' : _usePisellConfig$plat;
44
- var isH5 = platform === 'h5';
45
- var scanRef = useRef(null);
46
- var _useState3 = useState(''),
47
- _useState4 = _slicedToArray(_useState3, 2),
48
- debugValue = _useState4[0],
49
- setDebugValue = _useState4[1];
50
- var _useState5 = useState(false),
51
- _useState6 = _slicedToArray(_useState5, 2),
52
- fullScreenMode = _useState6[0],
53
- setFullScreenMode = _useState6[1];
54
- var scanContainerRef = useRef(null);
55
-
56
- // 监控props.value的变化
57
- useEffect(function () {
58
- if (props.value !== undefined) {
59
- if (isDevelopEnv) {
60
- console.log('[Input.WithMode] props.value变化:', props.value);
61
- }
62
- setDebugValue(props.value);
63
- }
64
- }, [props.value]);
65
-
66
- // 包装onChange处理函数
67
- var handleChange = function handleChange(e) {
68
- if (e && e.target) {
69
- setDebugValue(e.target.value);
70
- } else if (e === '' || e === null || e === undefined) {
71
- setDebugValue('');
72
- }
73
- if (props.onChange) {
74
- props.onChange(e);
75
- }
76
- };
77
-
78
- // 从props中获取属性
79
- var _props$allowScan = props.allowScan,
80
- allowScan = _props$allowScan === void 0 ? false : _props$allowScan,
81
- _props$scanCodeType = props.scanCodeType,
82
- scanCodeType = _props$scanCodeType === void 0 ? 'all' : _props$scanCodeType,
83
- _props$language = props.language,
84
- language = _props$language === void 0 ? getCurrentLocale() : _props$language,
85
- restProps = _objectWithoutProperties(props, _excluded);
86
-
87
- // 根据scanCodeType确定扫描的格式
88
- var formatMap = {
89
- all: [BarcodeFormat.QR_CODE, BarcodeFormat.EAN_8, BarcodeFormat.EAN_13, BarcodeFormat.CODE_128, BarcodeFormat.CODE_39, BarcodeFormat.CODE_93],
90
- qrcode: [BarcodeFormat.QR_CODE],
91
- barcode: [BarcodeFormat.EAN_8, BarcodeFormat.EAN_13, BarcodeFormat.CODE_128, BarcodeFormat.CODE_39, BarcodeFormat.CODE_93]
92
- };
93
-
94
- // 获取当前扫码类型对应的格式数组
95
- var formats = useMemo(function () {
96
- if (scanCodeType === 'qrcode') {
97
- return formatMap.qrcode;
98
- } else if (scanCodeType === 'barcode') {
99
- return formatMap.barcode;
100
- } else {
101
- return formatMap.all;
102
- }
103
- }, [scanCodeType]);
104
-
105
- // 获取扫码类型文本
106
- var getScanTypeText = useMemo(function () {
107
- if (isDevelopEnv) {
108
- console.log('[Input.WithMode] 当前扫码类型:', scanCodeType);
109
- }
110
- if (scanCodeType === 'qrcode') {
111
- return getText('scan.qrcode');
112
- } else if (scanCodeType === 'barcode') {
113
- return getText('scan.barcode');
114
- } else {
115
- return getText('scan.all');
116
- }
117
- }, [scanCodeType]);
118
- var getBackText = getText('scan.back');
119
- var getFromAlbumText = getText('scan.fromAlbum');
120
-
121
- // 处理扫码结果
122
- var handleScan = function handleScan(value, barcodeFormat, isValidType) {
123
- var _scanRef$current2;
124
- if (isDevelopEnv) {
125
- console.log('[Input.WithMode] 扫码结果:', value, '码类型:', barcodeFormat, '是否有效类型:', isValidType);
126
- }
127
-
128
- // 确保值有效
129
- if (!value) {
130
- console.warn('[Input.WithMode] 扫码结果为空');
131
- return;
132
- }
133
-
134
- // 验证扫码类型是否符合要求
135
- if (isValidType === false) {
136
- var _scanRef$current;
137
- // 关闭扫码界面
138
- setScanVisible(false);
139
- setFullScreenMode(false);
140
- (_scanRef$current = scanRef.current) === null || _scanRef$current === void 0 || (_scanRef$current = _scanRef$current.codeReader) === null || _scanRef$current === void 0 || _scanRef$current.reset();
141
-
142
- // 显示错误提示
143
- var errorMsg = scanCodeType === 'qrcode' ? getText('scan.qrcodeOnlyError') : getText('scan.barcodeOnlyError');
144
- message.error(errorMsg || "\u4E0D\u7B26\u5408\u5F53\u524D\u626B\u7801\u7C7B\u578B\u8981\u6C42\uFF0C\u8BF7\u626B\u63CF".concat(getScanTypeText));
145
- return;
146
- }
147
-
148
- // 关闭扫码界面
149
- setScanVisible(false);
150
- setFullScreenMode(false);
151
- (_scanRef$current2 = scanRef.current) === null || _scanRef$current2 === void 0 || (_scanRef$current2 = _scanRef$current2.codeReader) === null || _scanRef$current2 === void 0 || _scanRef$current2.reset();
152
-
153
- // 设置扫码结果
154
- handleChange({
155
- target: {
156
- value: value
157
- }
158
- });
159
- };
160
-
161
- // 退出全屏扫码
162
- var exitFullScreenScan = function exitFullScreenScan() {
163
- var _scanRef$current3;
164
- if (document.exitFullscreen) {
165
- document.exitFullscreen().catch(function (err) {
166
- console.error('退出全屏失败:', err);
167
- });
168
- }
169
- setFullScreenMode(false);
170
- setScanVisible(false);
171
- (_scanRef$current3 = scanRef.current) === null || _scanRef$current3 === void 0 || (_scanRef$current3 = _scanRef$current3.codeReader) === null || _scanRef$current3 === void 0 || _scanRef$current3.reset();
172
- };
173
-
174
- // 处理扫码按钮点击事件
175
- var handleScanClick = function handleScanClick() {
176
- if (isDevelopEnv) {
177
- console.log('[Input.WithMode] 点击扫码按钮,当前扫码类型:', scanCodeType, '标题:', getScanTypeText);
178
- }
179
- if (isH5) {
180
- var _window$webkit, _window$nativeBridge;
181
- // 移动设备扫码逻辑 - 直接唤起原生扫码
182
- if ((_window$webkit = window.webkit) !== null && _window$webkit !== void 0 && (_window$webkit = _window$webkit.messageHandlers) !== null && _window$webkit !== void 0 && _window$webkit.nativeScan) {
183
- // iOS 扫码
184
- window.webkit.messageHandlers.nativeScan.postMessage({
185
- scanType: scanCodeType || 'all'
186
- });
187
- } else if ((_window$nativeBridge = window.nativeBridge) !== null && _window$nativeBridge !== void 0 && _window$nativeBridge.scan) {
188
- // Android 扫码
189
- window.nativeBridge.scan(scanCodeType || 'all');
190
- } else {
191
- // H5环境,但没有原生扫码能力,使用全屏H5扫码
192
- setScanVisible(true);
193
- setFullScreenMode(true);
194
-
195
- // 请求全屏
196
- setTimeout(function () {
197
- if (scanContainerRef.current && scanContainerRef.current.requestFullscreen) {
198
- scanContainerRef.current.requestFullscreen().catch(function (err) {
199
- console.error('进入全屏失败:', err);
200
- // 即使全屏失败,也显示扫码界面
201
- });
202
- }
203
- }, 100);
204
- }
205
- }
206
- };
207
-
208
- // 处理从相册选择图片
209
- var handleImageSelect = /*#__PURE__*/function () {
210
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(file) {
211
- var url, img;
212
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
213
- while (1) switch (_context2.prev = _context2.next) {
53
+ isProcessing = _useState2[0],
54
+ setIsProcessing = _useState2[1];
55
+
56
+ // 只有当启用扫码功能且在移动设备上时才显示扫码图标
57
+ var showQRScanner = enableQRScanner && isMobileOrTablet();
58
+
59
+ /**
60
+ * 处理文件选择后的二维码解析
61
+ *
62
+ * 当用户通过相机拍摄或从相册选择图片后,使用zxing库进行二维码解析
63
+ * 整个过程异步进行,避免阻塞UI线程
64
+ *
65
+ * @param {React.ChangeEvent<HTMLInputElement>} e - 文件选择事件
66
+ */
67
+ var handleFileChange = /*#__PURE__*/function () {
68
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
69
+ var _e$target$files;
70
+ var file, zxingLibrary, BinaryBitmap, HybridBinarizer, RGBLuminanceSource, MultiFormatReader, BarcodeFormat, DecodeHintType, img, canvas, ctx, imageData, luminanceSource, binaryBitmap, hints, reader, result, scannedText;
71
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
72
+ while (1) switch (_context.prev = _context.next) {
214
73
  case 0:
215
- if (isDevelopEnv) {
216
- console.log('[handleImageSelect] 选择图片:', file);
74
+ // 获取选择的文件,如果没有文件或已在处理中则直接返回
75
+ file = (_e$target$files = e.target.files) === null || _e$target$files === void 0 ? void 0 : _e$target$files[0];
76
+ if (!(!file || isProcessing)) {
77
+ _context.next = 3;
78
+ break;
217
79
  }
218
-
219
- // 检查文件类型
220
- if (file.type.includes('image/')) {
221
- _context2.next = 4;
80
+ return _context.abrupt("return");
81
+ case 3:
82
+ _context.prev = 3;
83
+ // 设置处理状态,防止重复操作
84
+ setIsProcessing(true);
85
+ // 显示加载提示
86
+ message.loading('正在识别二维码...', 0);
87
+
88
+ // 动态导入zxing库,减少初始加载时的包体积
89
+ // 只有在实际需要时才加载二维码处理库
90
+ _context.next = 8;
91
+ return import('@zxing/library');
92
+ case 8:
93
+ zxingLibrary = _context.sent;
94
+ BinaryBitmap = zxingLibrary.BinaryBitmap, HybridBinarizer = zxingLibrary.HybridBinarizer, RGBLuminanceSource = zxingLibrary.RGBLuminanceSource, MultiFormatReader = zxingLibrary.MultiFormatReader, BarcodeFormat = zxingLibrary.BarcodeFormat, DecodeHintType = zxingLibrary.DecodeHintType; // 加载图片到Image对象
95
+ img = new Image();
96
+ img.src = URL.createObjectURL(file);
97
+
98
+ // 等待图片加载完成
99
+ _context.next = 14;
100
+ return new Promise(function (resolve) {
101
+ img.onload = resolve;
102
+ });
103
+ case 14:
104
+ // 创建Canvas并绘制图片,准备获取像素数据
105
+ canvas = document.createElement('canvas');
106
+ ctx = canvas.getContext('2d');
107
+ if (ctx) {
108
+ _context.next = 18;
222
109
  break;
223
110
  }
224
- message.error('请选择图片文件');
225
- return _context2.abrupt("return", false);
226
- case 4:
227
- try {
228
- message.loading({
229
- content: '正在处理图片...',
230
- key: 'scanLoading',
231
- duration: 0
232
- });
233
-
234
- // 创建图片URL
235
- url = URL.createObjectURL(file); // 创建图片元素
236
- img = new Image(); // 处理图片加载完成
237
- img.onload = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
238
- var canvas, ctx, imageData, hints, reader, _result, barcodeFormat, isValidType, errorMsg;
239
- return _regeneratorRuntime().wrap(function _callee$(_context) {
240
- while (1) switch (_context.prev = _context.next) {
241
- case 0:
242
- _context.prev = 0;
243
- // 创建临时canvas
244
- canvas = document.createElement('canvas');
245
- ctx = canvas.getContext('2d'); // 设置canvas尺寸
246
- canvas.width = img.width;
247
- canvas.height = img.height;
248
-
249
- // 在canvas上绘制图片
250
- ctx === null || ctx === void 0 || ctx.drawImage(img, 0, 0, img.width, img.height);
251
-
252
- // 获取图片数据
253
- imageData = ctx === null || ctx === void 0 ? void 0 : ctx.getImageData(0, 0, canvas.width, canvas.height);
254
- if (!imageData) {
255
- _context.next = 24;
256
- break;
257
- }
258
- // 创建解码器
259
- hints = new Map();
260
- if (formats && formats.length > 0) {
261
- hints.set(2, formats); // 2 对应 DecodeHintType.POSSIBLE_FORMATS
262
- }
263
- reader = new BrowserMultiFormatReader(hints);
264
- _context.prev = 11;
265
- _context.next = 14;
266
- return reader.decodeFromImageData(imageData);
267
- case 14:
268
- _result = _context.sent;
269
- // 获取扫码类型
270
- barcodeFormat = _result.getBarcodeFormat(); // 验证是否符合扫码类型要求
271
- isValidType = !formats || formats.length === 0 || formats.includes(barcodeFormat);
272
- if (!isValidType) {
273
- // 显示错误提示
274
- errorMsg = scanCodeType === 'qrcode' ? getText('scan.qrcodeOnlyError') : getText('scan.barcodeOnlyError');
275
- message.error({
276
- content: errorMsg || "\u4E0D\u7B26\u5408\u5F53\u524D\u626B\u7801\u7C7B\u578B\u8981\u6C42\uFF0C\u8BF7\u626B\u63CF".concat(getScanTypeText),
277
- key: 'scanLoading'
278
- });
279
- } else {
280
- // 关闭loading
281
- message.success({
282
- content: '识别成功',
283
- key: 'scanLoading'
284
- });
285
-
286
- // 处理扫码结果
287
- setScanVisible(false);
288
- setFullScreenMode(false);
289
-
290
- // 设置扫码结果
291
- handleChange({
292
- target: {
293
- value: _result.getText()
294
- }
295
- });
296
- }
297
- _context.next = 24;
298
- break;
299
- case 20:
300
- _context.prev = 20;
301
- _context.t0 = _context["catch"](11);
302
- console.error('[handleImageSelect] 扫描图片失败:', _context.t0);
303
- message.error({
304
- content: '未能识别二维码/条形码',
305
- key: 'scanLoading'
306
- });
307
- case 24:
308
- _context.next = 30;
309
- break;
310
- case 26:
311
- _context.prev = 26;
312
- _context.t1 = _context["catch"](0);
313
- console.error('[handleImageSelect] 扫描图片失败:', _context.t1);
314
- message.error({
315
- content: '未能识别二维码/条形码',
316
- key: 'scanLoading'
317
- });
318
- case 30:
319
- // 释放URL资源
320
- URL.revokeObjectURL(url);
321
- case 31:
322
- case "end":
323
- return _context.stop();
324
- }
325
- }, _callee, null, [[0, 26], [11, 20]]);
326
- }));
327
-
328
- // 处理图片加载失败
329
- img.onerror = function () {
330
- URL.revokeObjectURL(url);
331
- message.error({
332
- content: '图片加载失败',
333
- key: 'scanLoading'
334
- });
335
- };
336
-
337
- // 设置图片源
338
- img.src = url;
339
- } catch (error) {
340
- console.error('[handleImageSelect] 处理图片失败:', error);
341
- message.error({
342
- content: '处理图片失败',
343
- key: 'scanLoading'
111
+ throw new Error('无法创建canvas上下文');
112
+ case 18:
113
+ canvas.width = img.width;
114
+ canvas.height = img.height;
115
+ ctx.drawImage(img, 0, 0);
116
+
117
+ // 获取图像数据并创建亮度源
118
+ imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
119
+ luminanceSource = new RGBLuminanceSource(imageData.data, imageData.width, imageData.height); // 创建二进制位图并设置解码提示
120
+ binaryBitmap = new BinaryBitmap(new HybridBinarizer(luminanceSource));
121
+ hints = new Map(); // 设置解码格式为QR_CODE,提高识别精度
122
+ hints.set(DecodeHintType.POSSIBLE_FORMATS, [BarcodeFormat.QR_CODE]);
123
+
124
+ // 创建多格式读取器并解码
125
+ reader = new MultiFormatReader();
126
+ reader.setHints(hints);
127
+
128
+ // 执行解码操作
129
+ result = reader.decode(binaryBitmap);
130
+ scannedText = result.getText(); // 移除加载提示
131
+ message.destroy();
132
+
133
+ // 将解码结果更新到输入框,触发onChange事件
134
+ if (onChange) {
135
+ // 创建类似于输入事件的对象
136
+ onChange({
137
+ target: {
138
+ value: scannedText
139
+ }
344
140
  });
141
+ message.success('扫码成功');
142
+ }
143
+ _context.next = 39;
144
+ break;
145
+ case 34:
146
+ _context.prev = 34;
147
+ _context.t0 = _context["catch"](3);
148
+ // 错误处理:移除加载提示,显示错误信息
149
+ message.destroy();
150
+ console.error('解码失败:', _context.t0);
151
+ message.error('无法识别二维码,请重试');
152
+ case 39:
153
+ _context.prev = 39;
154
+ // 无论成功或失败,都重置处理状态
155
+ setIsProcessing(false);
156
+
157
+ // 重置文件输入,允许重复选择同一文件
158
+ if (fileInputRef.current) {
159
+ fileInputRef.current.value = '';
345
160
  }
346
- return _context2.abrupt("return", false);
347
- case 6:
161
+ return _context.finish(39);
162
+ case 43:
348
163
  case "end":
349
- return _context2.stop();
164
+ return _context.stop();
350
165
  }
351
- }, _callee2);
166
+ }, _callee, null, [[3, 34, 39, 43]]);
352
167
  }));
353
- return function handleImageSelect(_x) {
168
+ return function handleFileChange(_x) {
354
169
  return _ref.apply(this, arguments);
355
170
  };
356
171
  }();
357
172
 
358
- // 自定义输入框组件,完全控制清空和扫描操作
359
- var CustomInput = function CustomInput() {
360
- return /*#__PURE__*/React.createElement("div", {
361
- style: {
362
- display: 'flex',
363
- width: '100%',
364
- position: 'relative'
365
- }
366
- }, /*#__PURE__*/React.createElement(AntInput, _extends({}, restProps, {
367
- ref: props.innerRef || undefined,
368
- style: _objectSpread(_objectSpread({}, props.style), {}, {
369
- flex: 1
370
- }, allowScan && isH5 ? {
371
- borderTopRightRadius: 0,
372
- borderBottomRightRadius: 0,
373
- borderRight: 0
374
- } : {}),
375
- onChange: handleChange,
376
- value: debugValue,
377
- allowClear: props.allowClear !== false
378
- })), allowScan && isH5 && /*#__PURE__*/React.createElement(Button, {
379
- icon: /*#__PURE__*/React.createElement(ScanOutlined, null),
380
- onClick: handleScanClick,
381
- style: {
382
- borderTopLeftRadius: 0,
383
- borderBottomLeftRadius: 0,
384
- height: 'auto'
385
- }
386
- }));
387
- };
388
-
389
- // 组件挂载时初始化
390
- useEffect(function () {
391
- // 检查当前设备类型,使用 platform 判断
392
- if (isH5) {
393
- // 移动设备初始化逻辑
394
- if (isDevelopEnv) {
395
- console.log('[Input.WithMode] 当前平台: H5');
396
- window.__DEBUG_INPUT_PROPS__ = props;
397
-
398
- // 添加全局测试函数
399
- window.testPisellScan = function () {
400
- console.log('测试扫码功能');
401
- setScanVisible(true);
402
- };
403
-
404
- // 输出所有重要的状态和配置
405
- console.log('组件初始化配置:', {
406
- allowScan: allowScan,
407
- scanCodeType: scanCodeType,
408
- formats: formats
409
- });
410
- }
411
-
412
- // 设置原生扫码回调
413
- window.handleScanCallback = function (result) {
414
- if (isDevelopEnv) {
415
- console.log('接收到原生扫码结果:', result);
416
- }
417
- handleScan(result);
418
- };
419
- } else {
420
- if (isDevelopEnv) {
421
- console.log('[Input.WithMode] 当前平台: PC');
422
- window.__DEBUG_INPUT_PROPS__ = props;
423
- }
173
+ /**
174
+ * 触发扫码操作
175
+ *
176
+ * 点击扫码图标时调用,模拟点击隐藏的文件输入元素
177
+ * 这会唤起设备的相机或文件选择界面
178
+ */
179
+ var triggerScan = function triggerScan() {
180
+ if (fileInputRef.current) {
181
+ fileInputRef.current.click();
424
182
  }
425
- return function () {
426
- // 清理全局函数
427
- window.handleScanCallback = undefined;
428
- window.testPisellScan = undefined;
429
- };
430
- }, [platform, allowScan, scanCodeType, formats]);
431
-
432
- // 监听全屏事件
433
- useEffect(function () {
434
- var handleFullscreenChange = function handleFullscreenChange() {
435
- if (!document.fullscreenElement && fullScreenMode) {
436
- var _scanRef$current4;
437
- // 用户通过其他方式退出了全屏
438
- setFullScreenMode(false);
439
- setScanVisible(false);
440
- (_scanRef$current4 = scanRef.current) === null || _scanRef$current4 === void 0 || (_scanRef$current4 = _scanRef$current4.codeReader) === null || _scanRef$current4 === void 0 || _scanRef$current4.reset();
441
- }
442
- };
443
- document.addEventListener('fullscreenchange', handleFullscreenChange);
444
- return function () {
445
- return document.removeEventListener('fullscreenchange', handleFullscreenChange);
446
- };
447
- }, [fullScreenMode]);
183
+ };
448
184
 
449
- // 扫码类型变化时,更新标题
450
- useEffect(function () {
451
- if (isDevelopEnv) {
452
- console.log('[Input.WithMode] 扫码类型变化:', scanCodeType, '标题文本:', getScanTypeText);
453
- }
454
- }, [scanCodeType, getScanTypeText]);
455
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CustomInput, null), allowScan && isH5 && scanVisible && /*#__PURE__*/React.createElement("div", {
456
- ref: scanContainerRef,
457
- style: {
458
- position: fullScreenMode ? 'fixed' : 'absolute',
459
- top: 0,
460
- left: 0,
461
- right: 0,
462
- bottom: 0,
463
- backgroundColor: '#000',
464
- zIndex: 9999,
465
- display: 'flex',
466
- flexDirection: 'column'
467
- }
468
- }, /*#__PURE__*/React.createElement("div", {
469
- style: {
470
- padding: '10px 15px',
471
- backgroundColor: '#fff',
472
- display: 'flex',
473
- justifyContent: 'space-between',
474
- alignItems: 'center'
475
- }
476
- }, /*#__PURE__*/React.createElement("span", {
477
- style: {
478
- fontSize: '16px',
479
- fontWeight: 'bold'
480
- }
481
- }, getScanTypeText || 'Scan QR Code/Barcode'), /*#__PURE__*/React.createElement("span", {
482
- onClick: exitFullScreenScan,
185
+ /**
186
+ * 创建扫码图标元素
187
+ *
188
+ * 创建一个紫色背景的方块,内部是白色二维码图标
189
+ * 使用span包装以支持点击事件,并提供合适的样式
190
+ */
191
+ var scanIcon = showQRScanner ? /*#__PURE__*/React.createElement("span", {
192
+ onClick: triggerScan,
483
193
  style: {
484
194
  cursor: 'pointer',
485
- fontSize: '24px'
486
- }
487
- }, "\xD7")), /*#__PURE__*/React.createElement("div", {
488
- style: {
489
- flex: 1,
490
- position: 'relative'
491
- }
492
- }, /*#__PURE__*/React.createElement(PisellScan, {
493
- width: "100%",
494
- height: "100%",
495
- onChange: handleScan,
496
- timeBetweenScansMillis: 1000,
497
- ref: scanRef,
498
- formats: formats,
499
- preferFrontCamera: false // 使用后置摄像头
500
- })), /*#__PURE__*/React.createElement("div", {
501
- style: {
502
- padding: '15px',
503
- backgroundColor: '#fff',
504
- display: 'flex',
195
+ display: 'inline-flex',
196
+ alignItems: 'center',
505
197
  justifyContent: 'center',
506
- borderTop: '1px solid #f0f0f0'
507
- }
508
- }, /*#__PURE__*/React.createElement(Upload, {
509
- accept: "image/*",
510
- showUploadList: false,
511
- beforeUpload: handleImageSelect,
198
+ backgroundColor: '#8c5ddd',
199
+ // 紫色背景
200
+ width: '32px',
201
+ height: '28px',
202
+ borderRadius: '4px',
203
+ marginLeft: '8px'
204
+ }
205
+ }, /*#__PURE__*/React.createElement(QrcodeOutlined, {
512
206
  style: {
513
- marginRight: '15px'
514
- }
515
- }, /*#__PURE__*/React.createElement(Button, {
516
- icon: /*#__PURE__*/React.createElement(PictureOutlined, null),
207
+ fontSize: '18px',
208
+ color: 'white' // 白色图标
209
+ }
210
+ })) : null;
211
+
212
+ /**
213
+ * 结合用户传入的suffix和扫码图标
214
+ *
215
+ * 如果启用扫码功能,将用户的suffix和扫码图标组合
216
+ * 否则直接使用用户的suffix
217
+ */
218
+ var combinedSuffix = showQRScanner ? /*#__PURE__*/React.createElement(React.Fragment, null, suffix, scanIcon) : suffix;
219
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(AntInput, _extends({}, restProps, {
220
+ ref: props.innerRef,
221
+ onChange: onChange,
222
+ suffix: combinedSuffix
223
+ })), showQRScanner &&
224
+ /*#__PURE__*/
225
+ // @ts-ignore - 忽略TypeScript对input元素的警告
226
+ React.createElement("input", {
227
+ type: "file",
228
+ accept: "image/*",
229
+ capture: "environment",
230
+ ref: fileInputRef,
231
+ onChange: handleFileChange,
517
232
  style: {
518
- marginRight: '15px'
233
+ display: 'none'
519
234
  }
520
- }, getFromAlbumText || 'From Album')), /*#__PURE__*/React.createElement(Button, {
521
- icon: /*#__PURE__*/React.createElement(ArrowLeftOutlined, null),
522
- onClick: exitFullScreenScan
523
- }, getBackText || 'Back'))));
235
+ }));
524
236
  };
525
- export default withMode(Input, ReadPretty);
237
+
238
+ /**
239
+ * 应用withMode高阶组件,支持不同的展示模式
240
+ * ReadPretty模式用于只读展示
241
+ */
242
+ var InputWithMode = withMode(Input, ReadPretty);
243
+ export default InputWithMode;