shineout 3.10.0-beta.20 → 3.10.0-beta.22

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/cjs/index.js CHANGED
@@ -545,5 +545,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
545
545
  // 此文件由脚本自动生成,请勿直接修改。
546
546
  // This file was generated automatically by a script. Please do not modify it directly.
547
547
  var _default = exports.default = {
548
- version: '3.10.0-beta.20'
548
+ version: '3.10.0-beta.22'
549
549
  };
@@ -1,4 +1,4 @@
1
- export type { UploadProps as Props, Validator } from './upload.type';
1
+ export type { UploadProps as Props, Validator, UploadRef as Ref } from './upload.type';
2
2
  export type { UploadImageProps as ImageProps } from './image.type';
3
3
  export type { UploadDraggerProps as DraggerProps } from './dragger.type';
4
4
  export type { UploadOptions as Options } from '@sheinx/hooks';
@@ -1,6 +1,7 @@
1
- import { UploadProps as UnStyledUploadProps } from '@sheinx/base';
1
+ import { UploadProps as UnStyledUploadProps, UploadRef } from '@sheinx/base';
2
2
  import { GetWithFieldProps } from '../hooks/use-field-common';
3
3
  import type { UploadOptions as _UploadOptions } from '@sheinx/hooks';
4
+ export type { UploadRef };
4
5
  export type BaseUploadProps<T> = Omit<UnStyledUploadProps<T>, 'jssStyle'>;
5
6
  /**
6
7
  * @title Upload
package/dist/shineout.js CHANGED
@@ -13686,7 +13686,7 @@ var handleStyle = function handleStyle(style) {
13686
13686
  };
13687
13687
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
13688
13688
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
13689
- /* harmony default export */ var version = ('3.10.0-beta.20');
13689
+ /* harmony default export */ var version = ('3.10.0-beta.22');
13690
13690
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
13691
13691
 
13692
13692
 
@@ -44760,7 +44760,7 @@ var Cascader = function Cascader(props0) {
44760
44760
  _path = _path || [];
44761
44761
  handlePathChange(lastValue, null, _path);
44762
44762
  } catch (e) {
44763
- console.error(e);
44763
+ devUseWarning.error("".concat(e));
44764
44764
  }
44765
44765
  };
44766
44766
  var handleKeyDown = function handleKeyDown(e) {
@@ -46158,7 +46158,7 @@ var useListSelectMultiple = function useListSelectMultiple(props) {
46158
46158
  if (typeof props.value === 'string') {
46159
46159
  valueArr = (props.value || '').split(props.separator);
46160
46160
  } else {
46161
- console.error('[shineout] use-list-select: separator is string, but value is not string');
46161
+ devUseWarning.error('use-list-select: separator is string, but value is not string');
46162
46162
  valueArr = props.value;
46163
46163
  }
46164
46164
  } else {
@@ -65693,6 +65693,7 @@ var Arrow = /*#__PURE__*/(0,jsx_runtime.jsx)("svg", {
65693
65693
  viewBox: "0 0 40 100",
65694
65694
  xmlns: "http://www.w3.org/2000/svg",
65695
65695
  preserveAspectRatio: "none",
65696
+ "aria-hidden": "true",
65696
65697
  children: /*#__PURE__*/(0,jsx_runtime.jsx)("path", {
65697
65698
  d: "M 0 0 L 40 50 L 0 100",
65698
65699
  fill: "currentColor"
@@ -75962,6 +75963,8 @@ function castImmutable(value) {
75962
75963
 
75963
75964
 
75964
75965
 
75966
+
75967
+
75965
75968
  var Upload = function Upload(props0) {
75966
75969
  var _props$jssStyle, _props$jssStyle$uploa, _props$imageStyle, _props$imageStyle2;
75967
75970
  var props = use_with_form_config(props0);
@@ -75971,6 +75974,8 @@ var Upload = function Upload(props0) {
75971
75974
  showUploadList = _props$showUploadList === void 0 ? true : _props$showUploadList,
75972
75975
  _props$drop = props.drop,
75973
75976
  drop = _props$drop === void 0 ? false : _props$drop,
75977
+ _props$paste = props.paste,
75978
+ paste = _props$paste === void 0 ? false : _props$paste,
75974
75979
  _props$limit = props.limit,
75975
75980
  limit = _props$limit === void 0 ? 100 : _props$limit,
75976
75981
  _props$renderResult = props.renderResult,
@@ -76036,6 +76041,113 @@ var Upload = function Upload(props0) {
76036
76041
  validateHook(uploadValidate);
76037
76042
  }
76038
76043
  }, []);
76044
+
76045
+ // 暴露 getComponentRef
76046
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
76047
+ var getComponentRef = props.getComponentRef;
76048
+ if (!getComponentRef) return;
76049
+ var ref = {
76050
+ addFiles: function addFiles(files) {
76051
+ func.addFiles(files);
76052
+ }
76053
+ };
76054
+ if (isFunc(getComponentRef)) {
76055
+ getComponentRef(ref);
76056
+ } else {
76057
+ getComponentRef.current = ref;
76058
+ }
76059
+ return function () {
76060
+ if (isFunc(getComponentRef)) {
76061
+ getComponentRef(null);
76062
+ } else {
76063
+ getComponentRef.current = null;
76064
+ }
76065
+ };
76066
+ }, [props.getComponentRef]);
76067
+
76068
+ // paste 处理:document 级别监听,因为 Upload 没有可聚焦的空白区域
76069
+ // 仅当粘贴事件来自非可编辑区域时才触发,避免干扰 input/textarea 等正常粘贴行为
76070
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
76071
+ if (!paste) return;
76072
+ var handlePaste = /*#__PURE__*/function () {
76073
+ var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(e) {
76074
+ var target, tagName, files, _e$clipboardData, filtered, toAdd;
76075
+ return regeneratorRuntime_default()().wrap(function _callee$(_context) {
76076
+ while (1) switch (_context.prev = _context.next) {
76077
+ case 0:
76078
+ if (!props.disabled) {
76079
+ _context.next = 2;
76080
+ break;
76081
+ }
76082
+ return _context.abrupt("return");
76083
+ case 2:
76084
+ // 过滤掉来自可编辑元素的粘贴事件,避免与 input/textarea/contentEditable 冲突
76085
+ target = e.target;
76086
+ if (!target) {
76087
+ _context.next = 7;
76088
+ break;
76089
+ }
76090
+ tagName = target.tagName;
76091
+ if (!(tagName === 'INPUT' || tagName === 'TEXTAREA' || target.isContentEditable)) {
76092
+ _context.next = 7;
76093
+ break;
76094
+ }
76095
+ return _context.abrupt("return");
76096
+ case 7:
76097
+ if (!(props.beforePaste && isFunc(props.beforePaste))) {
76098
+ _context.next = 20;
76099
+ break;
76100
+ }
76101
+ _context.prev = 8;
76102
+ _context.next = 11;
76103
+ return props.beforePaste(e);
76104
+ case 11:
76105
+ files = _context.sent;
76106
+ _context.next = 18;
76107
+ break;
76108
+ case 14:
76109
+ _context.prev = 14;
76110
+ _context.t0 = _context["catch"](8);
76111
+ devUseWarning.error("beforePaste callback error: ".concat(_context.t0));
76112
+ return _context.abrupt("return");
76113
+ case 18:
76114
+ _context.next = 21;
76115
+ break;
76116
+ case 20:
76117
+ files = (_e$clipboardData = e.clipboardData) === null || _e$clipboardData === void 0 ? void 0 : _e$clipboardData.files;
76118
+ case 21:
76119
+ if (!(!files || files.length === 0)) {
76120
+ _context.next = 23;
76121
+ break;
76122
+ }
76123
+ return _context.abrupt("return");
76124
+ case 23:
76125
+ filtered = accept ? Array.from(files).filter(function (f) {
76126
+ return attrAccept(f, accept);
76127
+ }) : Array.from(files);
76128
+ if (!(filtered.length === 0)) {
76129
+ _context.next = 26;
76130
+ break;
76131
+ }
76132
+ return _context.abrupt("return");
76133
+ case 26:
76134
+ toAdd = props.multiple || limit > 1 ? filtered : [filtered[0]];
76135
+ func.addFiles(toAdd);
76136
+ case 28:
76137
+ case "end":
76138
+ return _context.stop();
76139
+ }
76140
+ }, _callee, null, [[8, 14]]);
76141
+ }));
76142
+ return function handlePaste(_x) {
76143
+ return _ref2.apply(this, arguments);
76144
+ };
76145
+ }();
76146
+ document.addEventListener('paste', handlePaste);
76147
+ return function () {
76148
+ return document.removeEventListener('paste', handlePaste);
76149
+ };
76150
+ }, [paste, props.disabled, accept, props.multiple, limit, props.beforePaste]);
76039
76151
  var handleReplace = function handleReplace(files, index) {
76040
76152
  onChange(dist_immer_produce(value, function (draft) {
76041
76153
  // 删除原来的位置的数据
@@ -79546,7 +79658,7 @@ var watermark_interface = __webpack_require__(6640);
79546
79658
 
79547
79659
 
79548
79660
  /* harmony default export */ var src_0 = ({
79549
- version: '3.10.0-beta.20'
79661
+ version: '3.10.0-beta.22'
79550
79662
  });
79551
79663
  }();
79552
79664
  /******/ return __webpack_exports__;