@pointcloud/pcloud-components 0.1.35 → 0.1.36

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/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![NPM version](https://img.shields.io/npm/v/@pointcloud/pcloud-components.svg?style=flat)](https://npmjs.org/package/@pointcloud/pcloud-components)
4
4
  [![NPM downloads](https://img.shields.io/npm/dm/@pointcloud/pcloud-components.svg?style=flat)](https://npmjs.org/package/@pointcloud/pcloud-components)
5
+ ![Jest Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen?style=flat)
5
6
  [![License](https://img.shields.io/npm/l/@pointcloud/pcloud-components.svg?style=flat)](https://npmjs.org/package/@pointcloud/pcloud-components)
6
7
 
7
8
  一套基于 Ant Design v4.24.16 和 React v17.0.2 开发的业务组件库,包含 30+ 个高质量组件,可帮助您快速构建企业级中后台产品原型。
@@ -1,5 +1,8 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import React, { useRef, useEffect } from 'react';
2
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
+ import React, { useRef, useEffect, useContext } from 'react';
4
+ import classNames from 'classnames';
5
+ import { ConfigContext } from "../ConfigProvider";
3
6
  import { jsx as _jsx } from "react/jsx-runtime";
4
7
  function AspectRatio(_ref) {
5
8
  var _ref$ratio = _ref.ratio,
@@ -9,6 +12,11 @@ function AspectRatio(_ref) {
9
12
  children = _ref.children,
10
13
  style = _ref.style;
11
14
  var ref = useRef(null);
15
+ var _useContext = useContext(ConfigContext),
16
+ prefixCls = _useContext.prefixCls,
17
+ getPrefixCls = _useContext.getPrefixCls;
18
+ var classname = getPrefixCls('aspect-ratio');
19
+ var wrapperClassNames = classNames(_defineProperty({}, "".concat(prefixCls, "-aspect-ratio"), !!prefixCls), classname, className);
12
20
  useEffect(function () {
13
21
  // 兼容旧浏览器:如果不支持 aspect-ratio,则用 padding-top
14
22
  var el = ref.current;
@@ -31,7 +39,7 @@ function AspectRatio(_ref) {
31
39
  }, [ratio]);
32
40
  return /*#__PURE__*/_jsx("div", {
33
41
  ref: ref,
34
- className: className,
42
+ className: wrapperClassNames,
35
43
  style: _objectSpread({
36
44
  aspectRatio: "".concat(ratio),
37
45
  width: '100%',
@@ -31,7 +31,8 @@ function InternalInput(props, ref) {
31
31
  onChange = props.onChange,
32
32
  onCompositionStart = props.onCompositionStart,
33
33
  onCompositionEnd = props.onCompositionEnd,
34
- initValue = props.value,
34
+ _props$value = props.value,
35
+ initValue = _props$value === void 0 ? '' : _props$value,
35
36
  _props$debounce = props.debounce,
36
37
  debounce = _props$debounce === void 0 ? false : _props$debounce,
37
38
  _props$enableCompose = props.enableCompose,
@@ -215,7 +215,7 @@ var IPAddress = function IPAddress(props) {
215
215
  return refs.current[idx] = el;
216
216
  },
217
217
  type: type === 'IPv4' ? 'number' : 'text',
218
- value: item.value || undefined,
218
+ value: item.value,
219
219
  readOnly: readOnly,
220
220
  disabled: disabled,
221
221
  maxLength: type === 'IPv6' ? 4 : 3,
@@ -1,5 +1,8 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
1
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
3
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
+ var _excluded = ["className", "layout", "src", "preview", "imageWidth", "content", "style", "bordered", "hoverable"];
3
6
  /* eslint-disable @typescript-eslint/no-unused-expressions */
4
7
  import React, { useState, useContext } from 'react';
5
8
  import classNames from 'classnames';
@@ -22,7 +25,8 @@ var PictureCard = function PictureCard(props) {
22
25
  _props$bordered = props.bordered,
23
26
  bordered = _props$bordered === void 0 ? true : _props$bordered,
24
27
  _props$hoverable = props.hoverable,
25
- hoverable = _props$hoverable === void 0 ? true : _props$hoverable;
28
+ hoverable = _props$hoverable === void 0 ? true : _props$hoverable,
29
+ restProps = _objectWithoutProperties(props, _excluded);
26
30
  var _useContext = useContext(ConfigContext),
27
31
  prefixCls = _useContext.prefixCls,
28
32
  getPrefixCls = _useContext.getPrefixCls;
@@ -36,18 +40,20 @@ var PictureCard = function PictureCard(props) {
36
40
  className: wrapperClass,
37
41
  style: style,
38
42
  children: [Array.isArray(src) ? /*#__PURE__*/_jsxs(_Fragment, {
39
- children: [/*#__PURE__*/_jsx(Image, {
40
- src: src[0],
41
- preview: preview && {
43
+ children: [/*#__PURE__*/_jsx(Image, _objectSpread(_objectSpread({
44
+ src: src[0]
45
+ }, preview && {
46
+ preview: {
42
47
  visible: false
43
- },
48
+ }
49
+ }), {}, {
44
50
  width: imageWidth,
45
51
  onClick: function onClick(e) {
46
52
  e.stopPropagation();
47
53
  // eslint-disable-next-line no-unused-expressions
48
54
  preview && setVisible(true);
49
55
  }
50
- }), /*#__PURE__*/_jsx("div", {
56
+ }, restProps)), /*#__PURE__*/_jsx("div", {
51
57
  style: {
52
58
  display: 'none'
53
59
  },
@@ -59,17 +65,19 @@ var PictureCard = function PictureCard(props) {
59
65
  }
60
66
  },
61
67
  children: src.map(function (item) {
62
- return /*#__PURE__*/_jsx(Image, {
68
+ return /*#__PURE__*/_jsx(Image, _objectSpread({
63
69
  src: item
64
- }, item);
70
+ }, restProps), item);
65
71
  })
66
72
  })
67
73
  })]
68
- }) : /*#__PURE__*/_jsx(Image, {
69
- src: src,
70
- preview: preview,
74
+ }) : /*#__PURE__*/_jsx(Image, _objectSpread(_objectSpread({
75
+ src: src
76
+ }, preview && {
77
+ preview: {}
78
+ }), {}, {
71
79
  width: imageWidth
72
- }), content && /*#__PURE__*/_jsx("div", {
80
+ }, restProps)), content && /*#__PURE__*/_jsx("div", {
73
81
  className: "info",
74
82
  children: content
75
83
  })]
@@ -1,4 +1,7 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
1
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
+ var _excluded = ["className", "style", "width", "height", "penColor", "penWidth", "backgroundColor", "clearText", "doneText", "showToolbar", "onDone", "defaultValue"];
2
5
  import { useCallback, useContext, useEffect, useRef, forwardRef, useImperativeHandle } from 'react';
3
6
  import classNames from 'classnames';
4
7
  import { ConfigContext } from "../ConfigProvider";
@@ -7,6 +10,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
7
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
8
11
  var SignaturePad = /*#__PURE__*/forwardRef(function (_ref, ref) {
9
12
  var className = _ref.className,
13
+ style = _ref.style,
10
14
  _ref$width = _ref.width,
11
15
  width = _ref$width === void 0 ? 600 : _ref$width,
12
16
  _ref$height = _ref.height,
@@ -24,7 +28,8 @@ var SignaturePad = /*#__PURE__*/forwardRef(function (_ref, ref) {
24
28
  _ref$showToolbar = _ref.showToolbar,
25
29
  showToolbar = _ref$showToolbar === void 0 ? true : _ref$showToolbar,
26
30
  onDone = _ref.onDone,
27
- defaultValue = _ref.defaultValue;
31
+ defaultValue = _ref.defaultValue,
32
+ rest = _objectWithoutProperties(_ref, _excluded);
28
33
  var canvasRef = useRef(null);
29
34
  var isDrawing = useRef(false);
30
35
  var lastX = useRef(0);
@@ -167,8 +172,10 @@ var SignaturePad = /*#__PURE__*/forwardRef(function (_ref, ref) {
167
172
  }
168
173
  };
169
174
  });
170
- return /*#__PURE__*/_jsxs("div", {
175
+ return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
171
176
  className: wrapperClass,
177
+ style: style
178
+ }, rest), {}, {
172
179
  children: [/*#__PURE__*/_jsx("canvas", {
173
180
  ref: canvasRef,
174
181
  className: "".concat(classname, "-canvas"),
@@ -189,6 +196,6 @@ var SignaturePad = /*#__PURE__*/forwardRef(function (_ref, ref) {
189
196
  children: doneText
190
197
  })]
191
198
  })]
192
- });
199
+ }));
193
200
  });
194
201
  export default SignaturePad;