@hw-component/form 1.9.58 → 1.9.60

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.
@@ -56,10 +56,11 @@ var Index = function Index(_ref) {
56
56
  modalFormData = _useModifyProps.modalFormData,
57
57
  setModalVisible = _useModifyProps.setModalVisible,
58
58
  initValue = _useModifyProps.initValue,
59
- onAfterClose = _useModifyProps.onAfterClose,
60
59
  formParams = _useModifyProps.formParams,
61
- modalTitle = _useModifyProps.title;
60
+ modalTitle = _useModifyProps.title,
61
+ saveOldParams = _useModifyProps.saveOldParams;
62
62
  var cancel = function cancel() {
63
+ saveOldParams();
63
64
  if (onCancel) {
64
65
  return onCancel === null || onCancel === void 0 ? void 0 : onCancel();
65
66
  }
@@ -127,7 +128,8 @@ var Index = function Index(_ref) {
127
128
  onClose: cancel,
128
129
  afterVisibleChange: function afterVisibleChange(changeVisible) {
129
130
  if (!changeVisible) {
130
- onAfterClose();
131
+ dialogForm === null || dialogForm === void 0 || dialogForm.clear();
132
+ afterClose === null || afterClose === void 0 || afterClose();
131
133
  }
132
134
  },
133
135
  closable: false,
@@ -7,9 +7,9 @@ export declare const useModifyProps: ({ visible, configData, initialValues, dial
7
7
  setModalFormData: React.Dispatch<React.SetStateAction<import("../Form/modal").HItemProps[]>>;
8
8
  initValue: Record<string, any> | undefined;
9
9
  setInitValue: React.Dispatch<React.SetStateAction<Record<string, any> | undefined>>;
10
- onAfterClose: () => void;
11
10
  formParams: any;
12
11
  title: string | number | boolean | {} | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactNodeArray | React.ReactPortal | null | undefined;
12
+ saveOldParams: () => void;
13
13
  };
14
14
  export declare const useHDialogForm: () => HDialogFormInstance<any, any>;
15
15
  export declare const useCurrentForm: (hDialogForm?: HDialogFormInstance) => HDialogFormInstance<any, any>;
@@ -45,12 +45,8 @@ var useModifyProps = function useModifyProps(_ref) {
45
45
  old: {}
46
46
  };
47
47
  }, []);
48
- var onAfterClose = function onAfterClose() {
48
+ var saveOldParams = function saveOldParams() {
49
49
  saveOldParamsObj.old = dialogForm.outputValues();
50
- setTimeout(function () {
51
- dialogForm.clear();
52
- afterClose === null || afterClose === void 0 || afterClose();
53
- }, 100);
54
50
  };
55
51
  useEffect(function () {
56
52
  setModalVisible(visible);
@@ -98,9 +94,9 @@ var useModifyProps = function useModifyProps(_ref) {
98
94
  setModalFormData: setModalFormData,
99
95
  initValue: initValue,
100
96
  setInitValue: setInitValue,
101
- onAfterClose: onAfterClose,
102
97
  formParams: formParams,
103
- title: modalTitle
98
+ title: modalTitle,
99
+ saveOldParams: saveOldParams
104
100
  };
105
101
  };
106
102
  var useHDialogForm = function useHDialogForm() {
@@ -1,3 +1,6 @@
1
1
  import type { TextAreaProps } from "antd/es/input";
2
- declare const _default: ({ autoSize, ...props }: TextAreaProps) => JSX.Element;
2
+ interface HTextAreaProps extends TextAreaProps {
3
+ bordered?: boolean;
4
+ }
5
+ declare const _default: ({ autoSize, bordered, className, ...props }: HTextAreaProps) => JSX.Element;
3
6
  export default _default;
@@ -3,8 +3,9 @@ import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
3
3
  import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
4
4
  import { jsx } from 'react/jsx-runtime';
5
5
  import { Input } from 'antd';
6
+ import { useClassName } from '../hooks/index.js';
6
7
 
7
- var _excluded = ["autoSize"];
8
+ var _excluded = ["autoSize", "bordered", "className"];
8
9
  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; }
9
10
  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; }
10
11
  var TextArea = (function (_ref) {
@@ -13,10 +14,18 @@ var TextArea = (function (_ref) {
13
14
  minRows: 4,
14
15
  maxRows: 4
15
16
  } : _ref$autoSize,
17
+ _ref$bordered = _ref.bordered,
18
+ bordered = _ref$bordered === void 0 ? true : _ref$bordered,
19
+ _ref$className = _ref.className,
20
+ className = _ref$className === void 0 ? "" : _ref$className,
16
21
  props = _objectWithoutProperties(_ref, _excluded);
17
- return jsx(Input.TextArea, _objectSpread({
22
+ var noBorderClassName = useClassName("hw-text-area-no-border");
23
+ var borderClassName = !bordered ? noBorderClassName : "";
24
+ return jsx(Input.TextArea, _objectSpread(_objectSpread({
18
25
  autoSize: autoSize
19
- }, props));
26
+ }, props), {}, {
27
+ className: "".concat(borderClassName, " ").concat(className)
28
+ }));
20
29
  });
21
30
 
22
31
  export { TextArea as default };
package/es/index.css CHANGED
@@ -262,6 +262,12 @@
262
262
  .ant-hw-switch .ant-hw-switch-after {
263
263
  margin-left: 4px;
264
264
  }
265
+ .ant-hw-text-area-no-border {
266
+ border: none !important;
267
+ }
268
+ .ant-hw-text-area-no-border:focus {
269
+ box-shadow: none !important;
270
+ }
265
271
  .ant-hw-addon {
266
272
  display: -webkit-box !important;
267
273
  display: -webkit-flex !important;
@@ -59,10 +59,11 @@ var Index = function Index(_ref) {
59
59
  modalFormData = _useModifyProps.modalFormData,
60
60
  setModalVisible = _useModifyProps.setModalVisible,
61
61
  initValue = _useModifyProps.initValue,
62
- onAfterClose = _useModifyProps.onAfterClose,
63
62
  formParams = _useModifyProps.formParams,
64
- modalTitle = _useModifyProps.title;
63
+ modalTitle = _useModifyProps.title,
64
+ saveOldParams = _useModifyProps.saveOldParams;
65
65
  var cancel = function cancel() {
66
+ saveOldParams();
66
67
  if (onCancel) {
67
68
  return onCancel === null || onCancel === void 0 ? void 0 : onCancel();
68
69
  }
@@ -130,7 +131,8 @@ var Index = function Index(_ref) {
130
131
  onClose: cancel,
131
132
  afterVisibleChange: function afterVisibleChange(changeVisible) {
132
133
  if (!changeVisible) {
133
- onAfterClose();
134
+ dialogForm === null || dialogForm === void 0 || dialogForm.clear();
135
+ afterClose === null || afterClose === void 0 || afterClose();
134
136
  }
135
137
  },
136
138
  closable: false,
@@ -7,9 +7,9 @@ export declare const useModifyProps: ({ visible, configData, initialValues, dial
7
7
  setModalFormData: React.Dispatch<React.SetStateAction<import("../Form/modal").HItemProps[]>>;
8
8
  initValue: Record<string, any> | undefined;
9
9
  setInitValue: React.Dispatch<React.SetStateAction<Record<string, any> | undefined>>;
10
- onAfterClose: () => void;
11
10
  formParams: any;
12
11
  title: string | number | boolean | {} | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactNodeArray | React.ReactPortal | null | undefined;
12
+ saveOldParams: () => void;
13
13
  };
14
14
  export declare const useHDialogForm: () => HDialogFormInstance<any, any>;
15
15
  export declare const useCurrentForm: (hDialogForm?: HDialogFormInstance) => HDialogFormInstance<any, any>;
@@ -46,12 +46,8 @@ var useModifyProps = function useModifyProps(_ref) {
46
46
  old: {}
47
47
  };
48
48
  }, []);
49
- var onAfterClose = function onAfterClose() {
49
+ var saveOldParams = function saveOldParams() {
50
50
  saveOldParamsObj.old = dialogForm.outputValues();
51
- setTimeout(function () {
52
- dialogForm.clear();
53
- afterClose === null || afterClose === void 0 || afterClose();
54
- }, 100);
55
51
  };
56
52
  React.useEffect(function () {
57
53
  setModalVisible(visible);
@@ -99,9 +95,9 @@ var useModifyProps = function useModifyProps(_ref) {
99
95
  setModalFormData: setModalFormData,
100
96
  initValue: initValue,
101
97
  setInitValue: setInitValue,
102
- onAfterClose: onAfterClose,
103
98
  formParams: formParams,
104
- title: modalTitle
99
+ title: modalTitle,
100
+ saveOldParams: saveOldParams
105
101
  };
106
102
  };
107
103
  var useHDialogForm = function useHDialogForm() {
@@ -1,3 +1,6 @@
1
1
  import type { TextAreaProps } from "antd/es/input";
2
- declare const _default: ({ autoSize, ...props }: TextAreaProps) => JSX.Element;
2
+ interface HTextAreaProps extends TextAreaProps {
3
+ bordered?: boolean;
4
+ }
5
+ declare const _default: ({ autoSize, bordered, className, ...props }: HTextAreaProps) => JSX.Element;
3
6
  export default _default;
@@ -6,8 +6,9 @@ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
6
6
  var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
7
7
  var jsxRuntime = require('react/jsx-runtime');
8
8
  var antd = require('antd');
9
+ var index = require('../hooks/index.js');
9
10
 
10
- var _excluded = ["autoSize"];
11
+ var _excluded = ["autoSize", "bordered", "className"];
11
12
  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; }
12
13
  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; }
13
14
  var TextArea = (function (_ref) {
@@ -16,10 +17,18 @@ var TextArea = (function (_ref) {
16
17
  minRows: 4,
17
18
  maxRows: 4
18
19
  } : _ref$autoSize,
20
+ _ref$bordered = _ref.bordered,
21
+ bordered = _ref$bordered === void 0 ? true : _ref$bordered,
22
+ _ref$className = _ref.className,
23
+ className = _ref$className === void 0 ? "" : _ref$className,
19
24
  props = _objectWithoutProperties(_ref, _excluded);
20
- return jsxRuntime.jsx(antd.Input.TextArea, _objectSpread({
25
+ var noBorderClassName = index.useClassName("hw-text-area-no-border");
26
+ var borderClassName = !bordered ? noBorderClassName : "";
27
+ return jsxRuntime.jsx(antd.Input.TextArea, _objectSpread(_objectSpread({
21
28
  autoSize: autoSize
22
- }, props));
29
+ }, props), {}, {
30
+ className: "".concat(borderClassName, " ").concat(className)
31
+ }));
23
32
  });
24
33
 
25
34
  exports.default = TextArea;
package/lib/index.css CHANGED
@@ -262,6 +262,12 @@
262
262
  .ant-hw-switch .ant-hw-switch-after {
263
263
  margin-left: 4px;
264
264
  }
265
+ .ant-hw-text-area-no-border {
266
+ border: none !important;
267
+ }
268
+ .ant-hw-text-area-no-border:focus {
269
+ box-shadow: none !important;
270
+ }
265
271
  .ant-hw-addon {
266
272
  display: -webkit-box !important;
267
273
  display: -webkit-flex !important;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "1.9.58",
3
+ "version": "1.9.60",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,6 +46,7 @@ const Index: React.FC<DialogFormProps> = ({
46
46
  initValue,
47
47
  formParams,
48
48
  title: modalTitle,
49
+ saveOldParams
49
50
  } = useModifyProps({
50
51
  configData,
51
52
  visible,
@@ -58,6 +59,7 @@ const Index: React.FC<DialogFormProps> = ({
58
59
  afterClose,
59
60
  });
60
61
  const cancel = () => {
62
+ saveOldParams();
61
63
  if (onCancel) {
62
64
  return onCancel?.();
63
65
  }
@@ -42,7 +42,6 @@ const Index: React.FC<DialogFormProps> = ({
42
42
  initValue,
43
43
  formParams,
44
44
  title: modalTitle,
45
- saveOldParams,
46
45
  } = useModifyProps({
47
46
  configData,
48
47
  visible,
@@ -53,7 +52,6 @@ const Index: React.FC<DialogFormProps> = ({
53
52
  onCancel,
54
53
  });
55
54
  const cancel = () => {
56
- saveOldParams();
57
55
  if (onCancel) {
58
56
  return onCancel?.();
59
57
  }
@@ -0,0 +1,8 @@
1
+ @import "../styles/local.less";
2
+
3
+ .@{ant-prefix}-hw-text-area-no-border{
4
+ border: none !important;
5
+ &:focus{
6
+ box-shadow: none !important;
7
+ }
8
+ }
@@ -1,8 +1,17 @@
1
1
  import { Input } from "antd";
2
2
  import type { TextAreaProps } from "antd/es/input";
3
+ import {useClassName} from "../hooks";
4
+ interface HTextAreaProps extends TextAreaProps{
5
+ bordered?:boolean;
6
+ }
7
+
3
8
  export default ({
4
9
  autoSize = { minRows: 4, maxRows: 4 },
10
+ bordered=true,
11
+ className="",
5
12
  ...props
6
- }: TextAreaProps) => {
7
- return <Input.TextArea autoSize={autoSize} {...props} />;
13
+ }: HTextAreaProps) => {
14
+ const noBorderClassName=useClassName("hw-text-area-no-border") ;
15
+ const borderClassName=!bordered?noBorderClassName:"";
16
+ return <Input.TextArea autoSize={autoSize} {...props} className={`${borderClassName} ${className}`}/>;
8
17
  };
@@ -2,6 +2,7 @@
2
2
  @import "../Form/index.less";
3
3
  @import "../Input/index.less";
4
4
  @import "../Switch/index.less";
5
+ @import "../TextArea/index.less";
5
6
 
6
7
  .@{ant-prefix}-hw-addon {
7
8
  display: flex !important;
@@ -6,6 +6,7 @@ import {
6
6
  HColorInput,
7
7
  HVerificationCodeInput,
8
8
  HInputNumberGroup,
9
+ HTextArea,
9
10
  } from "../../components";
10
11
  import { Space } from "antd";
11
12
  import { useState } from "react";
@@ -36,6 +37,7 @@ export default () => {
36
37
  },
37
38
  ]}
38
39
  />
40
+ <HTextArea />
39
41
  </Space>
40
42
  );
41
43
  };