bhd-components 0.9.21 → 0.9.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.
@@ -8,6 +8,7 @@ export interface AppViewImageProps {
8
8
  getSrc: (index?: number) => Promise<string>;
9
9
  filename?: string;
10
10
  multiSelect?: string[];
11
+ getContainer?: () => HTMLElement;
11
12
  }
12
13
  export interface AppViewImageRef {
13
14
  updateSrc: () => void;
@@ -43,7 +43,7 @@ class ViewImage extends React.Component {
43
43
  className: `${styles.viewImgAction} ${styles.actionTop}`,
44
44
  children: /*#__PURE__*/ _jsx("span", {
45
45
  // id="actionClose"
46
- // style={{right:`calc(-40px + (-12px * (1 / ${scaleValue / 100}) ))` ,transform: `scale(calc(1 / ${scaleValue / 100}),calc(1 / ${scaleValue / 100}))`,transformOrigin: `top left`}}
46
+ // style={{right:`calc(-40px + (-12px * (1 / ${scaleValue / 100}) ))` ,transform: `scale(calc(1 / ${scaleValue / 100}),calc(1 / ${scaleValue / 100}))`,transformOrigin: `top left`}}
47
47
  className: styles.viewImgActionClose,
48
48
  title: "关闭",
49
49
  onClick: this.close,
@@ -128,15 +128,15 @@ class ViewImage extends React.Component {
128
128
  // this.state.actionCloseFlag===0&&(
129
129
  // <span
130
130
  // id="actionClose"
131
- // style={{right:`calc(-40px + (-12px * (1 / ${scaleValue / 100}) ))` ,transform: `scale(calc(1 / ${scaleValue / 100}),calc(1 / ${scaleValue / 100}))`,transformOrigin: `top left`}}
132
- // className={styles.viewImgActionClose}
133
- // title="关闭"
131
+ // style={{right:`calc(-40px + (-12px * (1 / ${scaleValue / 100}) ))` ,transform: `scale(calc(1 / ${scaleValue / 100}),calc(1 / ${scaleValue / 100}))`,transformOrigin: `top left`}}
132
+ // className={styles.viewImgActionClose}
133
+ // title="关闭"
134
134
  // onClick={this.close}>
135
135
  // <CustomClose />
136
136
  // </span>
137
137
  // )
138
138
  // }
139
- // </div>
139
+ // </div>
140
140
  /*#__PURE__*/ _jsxs(_Fragment, {
141
141
  children: [
142
142
  /*#__PURE__*/ _jsx("img", {
@@ -202,7 +202,7 @@ class ViewImage extends React.Component {
202
202
  curIndex: 0,
203
203
  multiSelect: false,
204
204
  imgError: false,
205
- actionCloseFlag: 0 // 关闭按钮位置 0是跟随图片 1固定右上角
205
+ actionCloseFlag: 0
206
206
  });
207
207
  _define_property(this, "scaleChange", (value)=>{
208
208
  let { maxScale, minScale } = this.state;
@@ -220,17 +220,17 @@ class ViewImage extends React.Component {
220
220
  });
221
221
  _define_property(this, "moveActionClose", ()=>{
222
222
  setTimeout(()=>{
223
- const pic = document.getElementById('viewImgBody_pic');
223
+ const pic = document.getElementById("viewImgBody_pic");
224
224
  if (pic) {
225
225
  const rect = pic.getBoundingClientRect();
226
226
  if (rect.top >= 0 && rect.top <= (window.innerHeight || document.documentElement.clientHeight) - 40 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) - 52) {
227
227
  this.setState({
228
228
  actionCloseFlag: 0
229
229
  }, ()=>{
230
- const actionCloseDom = document.getElementById('actionClose');
230
+ const actionCloseDom = document.getElementById("actionClose");
231
231
  if (actionCloseDom) {
232
- actionCloseDom.style.top = rect.top + 'px';
233
- actionCloseDom.style.left = rect.left + rect.width + 12 + 'px';
232
+ actionCloseDom.style.top = rect.top + "px";
233
+ actionCloseDom.style.left = rect.left + rect.width + 12 + "px";
234
234
  }
235
235
  });
236
236
  } else {
@@ -446,7 +446,7 @@ class ViewImage extends React.Component {
446
446
  }
447
447
  }
448
448
  const AppViewImage = /*#__PURE__*/ forwardRef((props, ref)=>{
449
- let { visible, className } = props;
449
+ let { visible, className, getContainer = ()=>document.body } = props;
450
450
  const viewRef = useRef(null);
451
451
  useImperativeHandle(ref, ()=>({
452
452
  updateSrc: ()=>{
@@ -467,6 +467,7 @@ const AppViewImage = /*#__PURE__*/ forwardRef((props, ref)=>{
467
467
  background: "rgba(0, 0, 0, 0.65)"
468
468
  },
469
469
  wrapClassName: `${styles.AppViewImage} ${className || ""}`,
470
+ getContainer: getContainer,
470
471
  children: visible && /*#__PURE__*/ _jsx(ViewImage, _object_spread_props(_object_spread({}, props), {
471
472
  ref: viewRef
472
473
  }))
@@ -8,6 +8,7 @@ export interface AppViewImageProps {
8
8
  getSrc: (index?: number) => Promise<string>;
9
9
  filename?: string;
10
10
  multiSelect?: string[];
11
+ getContainer?: () => HTMLElement;
11
12
  }
12
13
  export interface AppViewImageRef {
13
14
  updateSrc: () => void;
@@ -37,7 +37,7 @@ var ViewImage = /*#__PURE__*/ function(_React_Component) {
37
37
  curIndex: 0,
38
38
  multiSelect: false,
39
39
  imgError: false,
40
- actionCloseFlag: 0 // 关闭按钮位置 0是跟随图片 1固定右上角
40
+ actionCloseFlag: 0
41
41
  });
42
42
  _define_property(_assert_this_initialized(_this), "scaleChange", function(value) {
43
43
  var _this_state = _this.state, maxScale = _this_state.maxScale, minScale = _this_state.minScale;
@@ -390,7 +390,7 @@ var ViewImage = /*#__PURE__*/ function(_React_Component) {
390
390
  className: "".concat(styles.viewImgAction, " ").concat(styles.actionTop),
391
391
  children: /*#__PURE__*/ _jsx("span", {
392
392
  // id="actionClose"
393
- // style={{right:`calc(-40px + (-12px * (1 / ${scaleValue / 100}) ))` ,transform: `scale(calc(1 / ${scaleValue / 100}),calc(1 / ${scaleValue / 100}))`,transformOrigin: `top left`}}
393
+ // style={{right:`calc(-40px + (-12px * (1 / ${scaleValue / 100}) ))` ,transform: `scale(calc(1 / ${scaleValue / 100}),calc(1 / ${scaleValue / 100}))`,transformOrigin: `top left`}}
394
394
  className: styles.viewImgActionClose,
395
395
  title: "关闭",
396
396
  onClick: this.close,
@@ -475,15 +475,15 @@ var ViewImage = /*#__PURE__*/ function(_React_Component) {
475
475
  // this.state.actionCloseFlag===0&&(
476
476
  // <span
477
477
  // id="actionClose"
478
- // style={{right:`calc(-40px + (-12px * (1 / ${scaleValue / 100}) ))` ,transform: `scale(calc(1 / ${scaleValue / 100}),calc(1 / ${scaleValue / 100}))`,transformOrigin: `top left`}}
479
- // className={styles.viewImgActionClose}
480
- // title="关闭"
478
+ // style={{right:`calc(-40px + (-12px * (1 / ${scaleValue / 100}) ))` ,transform: `scale(calc(1 / ${scaleValue / 100}),calc(1 / ${scaleValue / 100}))`,transformOrigin: `top left`}}
479
+ // className={styles.viewImgActionClose}
480
+ // title="关闭"
481
481
  // onClick={this.close}>
482
482
  // <CustomClose />
483
483
  // </span>
484
484
  // )
485
485
  // }
486
- // </div>
486
+ // </div>
487
487
  /*#__PURE__*/ _jsxs(_Fragment, {
488
488
  children: [
489
489
  /*#__PURE__*/ _jsx("img", {
@@ -540,7 +540,9 @@ var ViewImage = /*#__PURE__*/ function(_React_Component) {
540
540
  return ViewImage;
541
541
  }(React.Component);
542
542
  var AppViewImage = /*#__PURE__*/ forwardRef(function(props, ref) {
543
- var visible = props.visible, className = props.className;
543
+ var visible = props.visible, className = props.className, _props_getContainer = props.getContainer, getContainer = _props_getContainer === void 0 ? function() {
544
+ return document.body;
545
+ } : _props_getContainer;
544
546
  var viewRef = useRef(null);
545
547
  useImperativeHandle(ref, function() {
546
548
  return {
@@ -563,6 +565,7 @@ var AppViewImage = /*#__PURE__*/ forwardRef(function(props, ref) {
563
565
  background: "rgba(0, 0, 0, 0.65)"
564
566
  },
565
567
  wrapClassName: "".concat(styles.AppViewImage, " ").concat(className || ""),
568
+ getContainer: getContainer,
566
569
  children: visible && /*#__PURE__*/ _jsx(ViewImage, _object_spread_props(_object_spread({}, props), {
567
570
  ref: viewRef
568
571
  }))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bhd-components",
3
- "version": "0.9.21",
3
+ "version": "0.9.22",
4
4
  "description": "组件功能描述",
5
5
  "config": {
6
6
  "commitizen": {