@hw-component/form 0.0.7-beta-v2 → 0.0.7-beta-v3

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.
@@ -1,3 +1,3 @@
1
1
  import type { HInputProps } from "./modal";
2
- declare const _default: ({ ...props }: HInputProps) => JSX.Element;
2
+ declare const _default: ({ copy, value, addonAfter, ...props }: HInputProps) => JSX.Element;
3
3
  export default _default;
package/es/Input/index.js CHANGED
@@ -1,7 +1,4 @@
1
1
  // welcome to hoo hoo hoo
2
- import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
3
- import _objectDestructuringEmpty from '@babel/runtime-corejs3/helpers/objectDestructuringEmpty';
4
- import 'core-js/modules/es.object.assign.js';
5
2
  import 'core-js/modules/es.object.keys.js';
6
3
  import 'core-js/modules/es.symbol.js';
7
4
  import 'core-js/modules/es.array.filter.js';
@@ -9,14 +6,37 @@ import 'core-js/modules/es.object.to-string.js';
9
6
  import 'core-js/modules/es.object.get-own-property-descriptor.js';
10
7
  import 'core-js/modules/web.dom-collections.for-each.js';
11
8
  import 'core-js/modules/es.object.get-own-property-descriptors.js';
9
+ import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
10
+ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
12
11
  import { jsx } from 'react/jsx-runtime';
13
- import { Input } from 'antd';
12
+ import { Input, message } from 'antd';
13
+ import { CopyOutlined } from '@ant-design/icons';
14
+ import { CopyToClipboard } from 'react-copy-to-clipboard';
14
15
 
16
+ var _excluded = ["copy", "value", "addonAfter"];
15
17
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
16
18
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
- var HInput = (function (_ref) {
18
- var props = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
19
- return jsx(Input, _objectSpread({}, props));
19
+ var CopyDom = function CopyDom(_ref) {
20
+ var value = _ref.value;
21
+ return jsx(CopyToClipboard, {
22
+ text: value,
23
+ onCopy: function onCopy() {
24
+ message.success("复制成功!");
25
+ },
26
+ children: jsx(CopyOutlined, {})
27
+ });
28
+ };
29
+ var HInput = (function (_ref2) {
30
+ var copy = _ref2.copy,
31
+ value = _ref2.value,
32
+ addonAfter = _ref2.addonAfter,
33
+ props = _objectWithoutProperties(_ref2, _excluded);
34
+ return jsx(Input, _objectSpread(_objectSpread({}, props), {}, {
35
+ value: value,
36
+ addonAfter: copy ? jsx(CopyDom, {
37
+ value: value
38
+ }) : addonAfter
39
+ }));
20
40
  });
21
41
 
22
42
  export { HInput as default };
@@ -8,6 +8,7 @@ export interface HInputProps<V = any> extends Omit<InputProps, "onChange" | "val
8
8
  onChange?: (value: V) => void;
9
9
  value?: V;
10
10
  defaultColor?: string;
11
+ copy?: boolean;
11
12
  }
12
13
  interface ValueNameModal {
13
14
  input?: string;
@@ -1,3 +1,3 @@
1
1
  import type { HInputProps } from "./modal";
2
- declare const _default: ({ ...props }: HInputProps) => JSX.Element;
2
+ declare const _default: ({ copy, value, addonAfter, ...props }: HInputProps) => JSX.Element;
3
3
  export default _default;
@@ -2,9 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
6
- var _objectDestructuringEmpty = require('@babel/runtime-corejs3/helpers/objectDestructuringEmpty');
7
- require('core-js/modules/es.object.assign.js');
8
5
  require('core-js/modules/es.object.keys.js');
9
6
  require('core-js/modules/es.symbol.js');
10
7
  require('core-js/modules/es.array.filter.js');
@@ -12,14 +9,37 @@ require('core-js/modules/es.object.to-string.js');
12
9
  require('core-js/modules/es.object.get-own-property-descriptor.js');
13
10
  require('core-js/modules/web.dom-collections.for-each.js');
14
11
  require('core-js/modules/es.object.get-own-property-descriptors.js');
12
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
13
+ var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
15
14
  var jsxRuntime = require('react/jsx-runtime');
16
15
  var antd = require('antd');
16
+ var icons = require('@ant-design/icons');
17
+ var reactCopyToClipboard = require('react-copy-to-clipboard');
17
18
 
19
+ var _excluded = ["copy", "value", "addonAfter"];
18
20
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
19
21
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
20
- var HInput = (function (_ref) {
21
- var props = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
22
- return jsxRuntime.jsx(antd.Input, _objectSpread({}, props));
22
+ var CopyDom = function CopyDom(_ref) {
23
+ var value = _ref.value;
24
+ return jsxRuntime.jsx(reactCopyToClipboard.CopyToClipboard, {
25
+ text: value,
26
+ onCopy: function onCopy() {
27
+ antd.message.success("复制成功!");
28
+ },
29
+ children: jsxRuntime.jsx(icons.CopyOutlined, {})
30
+ });
31
+ };
32
+ var HInput = (function (_ref2) {
33
+ var copy = _ref2.copy,
34
+ value = _ref2.value,
35
+ addonAfter = _ref2.addonAfter,
36
+ props = _objectWithoutProperties(_ref2, _excluded);
37
+ return jsxRuntime.jsx(antd.Input, _objectSpread(_objectSpread({}, props), {}, {
38
+ value: value,
39
+ addonAfter: copy ? jsxRuntime.jsx(CopyDom, {
40
+ value: value
41
+ }) : addonAfter
42
+ }));
23
43
  });
24
44
 
25
45
  exports.default = HInput;
@@ -8,6 +8,7 @@ export interface HInputProps<V = any> extends Omit<InputProps, "onChange" | "val
8
8
  onChange?: (value: V) => void;
9
9
  value?: V;
10
10
  defaultColor?: string;
11
+ copy?: boolean;
11
12
  }
12
13
  interface ValueNameModal {
13
14
  input?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "0.0.7-beta-v2",
3
+ "version": "0.0.7-beta-v3",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,6 +40,7 @@
40
40
  "core-js": "3",
41
41
  "react": "17.0.0",
42
42
  "react-color": "^2.19.3",
43
+ "react-copy-to-clipboard": "^5.1.0",
43
44
  "react-dom": "17.0.2",
44
45
  "react-router-dom": "^6.11.2"
45
46
  },
@@ -1,6 +1,21 @@
1
- import { Input } from "antd";
1
+ import { Input ,message} from "antd";
2
2
  import type { HInputProps } from "./modal";
3
+ import {CopyOutlined} from '@ant-design/icons'
4
+ // @ts-ignore
5
+ import { CopyToClipboard } from 'react-copy-to-clipboard';
6
+ const CopyDom=({value}:HInputProps)=>{
7
+ return <CopyToClipboard
8
+ text={value}
9
+ onCopy={() => {
10
+ message.success("复制成功!");
11
+ }}
12
+ >
13
+ <CopyOutlined/>
14
+ </CopyToClipboard>
15
+ }
16
+ export default ({ copy,value,addonAfter,...props }: HInputProps) => {
3
17
 
4
- export default ({ ...props }: HInputProps) => {
5
- return <Input {...props} />;
18
+ return <Input {...props} value={value}
19
+ addonAfter={copy?<CopyDom value={value}/>:addonAfter}
20
+ />;
6
21
  };
@@ -9,6 +9,7 @@ export interface HInputProps<V = any>
9
9
  onChange?: (value: V) => void;
10
10
  value?: V;
11
11
  defaultColor?: string;
12
+ copy?:boolean;
12
13
  }
13
14
 
14
15
  interface ValueNameModal {