@hw-component/form 1.5.7 → 1.6.0

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.
@@ -11,6 +11,7 @@ import 'core-js/modules/es.promise.js';
11
11
  import 'core-js/modules/es.object.keys.js';
12
12
  import 'core-js/modules/web.dom-collections.for-each.js';
13
13
  import 'core-js/modules/es.reflect.delete-property.js';
14
+ import 'core-js/modules/es.array.slice.js';
14
15
  import 'core-js/modules/es.function.name.js';
15
16
  import 'core-js/modules/es.array.concat.js';
16
17
  import 'core-js/modules/es.array.map.js';
@@ -100,13 +101,14 @@ var useHForm = (function () {
100
101
  });
101
102
  return newValue;
102
103
  },
103
- dispatch: function dispatch(action) {
104
+ dispatch: function dispatch() {
105
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
106
+ args[_key] = arguments[_key];
107
+ }
108
+ var action = args[0],
109
+ dispatchArgs = args.slice(1);
104
110
  var key = action.key,
105
111
  name = action.name;
106
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
107
- args[_key - 1] = arguments[_key];
108
- }
109
- var dispatchArgs = args || [];
110
112
  var items = dispatchSourceData[key];
111
113
  if (!items) {
112
114
  return;
@@ -115,13 +117,13 @@ var useHForm = (function () {
115
117
  defaultFn = items.defaultFn;
116
118
  if (name) {
117
119
  var _keysFn$name;
118
- return (_keysFn$name = keysFn[name]) === null || _keysFn$name === void 0 ? void 0 : _keysFn$name.call.apply(_keysFn$name, [keysFn].concat(dispatchArgs));
120
+ return (_keysFn$name = keysFn[name]) === null || _keysFn$name === void 0 ? void 0 : _keysFn$name.call.apply(_keysFn$name, [keysFn].concat(_toConsumableArray(dispatchArgs)));
119
121
  }
120
122
  var fnArrays = Object.keys(keysFn).map(function (itemKey) {
121
123
  return keysFn[itemKey];
122
124
  });
123
125
  [].concat(_toConsumableArray(fnArrays), _toConsumableArray(defaultFn)).forEach(function (fn) {
124
- fn.apply(void 0, dispatchArgs);
126
+ fn.apply(void 0, _toConsumableArray(dispatchArgs));
125
127
  });
126
128
  },
127
129
  addDispatchListener: function addDispatchListener(action, fn) {
@@ -15,7 +15,7 @@ import { Input, Button } from 'antd';
15
15
  import { useRequest } from 'ahooks';
16
16
 
17
17
  var _excluded = ["buttonProps", "value", "onChange", "children", "request"],
18
- _excluded2 = ["onClick", "type", "loading"];
18
+ _excluded2 = ["onClick", "type", "ghost", "loading"];
19
19
  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; }
20
20
  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; }
21
21
  var Index = function Index(_ref) {
@@ -29,6 +29,8 @@ var Index = function Index(_ref) {
29
29
  var onClick = buttonProps.onClick,
30
30
  _buttonProps$type = buttonProps.type,
31
31
  type = _buttonProps$type === void 0 ? "primary" : _buttonProps$type,
32
+ _buttonProps$ghost = buttonProps.ghost,
33
+ ghost = _buttonProps$ghost === void 0 ? true : _buttonProps$ghost,
32
34
  btnLoading = buttonProps.loading,
33
35
  oProps = _objectWithoutProperties(buttonProps, _excluded2);
34
36
  var _useRequest = useRequest(function (val) {
@@ -79,13 +81,15 @@ var Index = function Index(_ref) {
79
81
  },
80
82
  value: value,
81
83
  onChange: change
82
- })), jsx(Button, _objectSpread(_objectSpread({}, oProps), {}, {
84
+ })), jsx(Button, _objectSpread(_objectSpread({
83
85
  type: type,
84
86
  onClick: click,
85
87
  loading: loading || btnLoading,
86
88
  style: {
87
- marginLeft: 4
89
+ marginLeft: 8
88
90
  },
91
+ ghost: ghost
92
+ }, oProps), {}, {
89
93
  children: children
90
94
  }))]
91
95
  });
@@ -10,7 +10,7 @@ export declare const useOptionReq: ({ manual, request, options, serviceSearch, s
10
10
  data: OptionType[] | undefined;
11
11
  onSearch: ((value: string) => void) | undefined;
12
12
  mathShowSearch: boolean | undefined;
13
- reload: ({ options: changeOpts, params }: ParamsModal) => void | Promise<OptionType[] | undefined>;
13
+ reload: (reloadParams?: ParamsModal) => void | Promise<OptionType[] | undefined>;
14
14
  };
15
15
  export declare const useFilterOption: ({ filterOption, serviceSearch, }: PartialHSelectProps) => boolean | import("rc-select/lib/Select").FilterFunc<import("rc-select/lib/Select").DefaultOptionType> | undefined;
16
16
  export {};
@@ -66,8 +66,9 @@ var useOptionReq = function useOptionReq(_ref) {
66
66
  run = _useRequest.run,
67
67
  loading = _useRequest.loading,
68
68
  error = _useRequest.error;
69
- var reload = function reload(_ref3) {
70
- var changeOpts = _ref3.options,
69
+ var reload = function reload(reloadParams) {
70
+ var _ref3 = reloadParams || {},
71
+ changeOpts = _ref3.options,
71
72
  params = _ref3.params;
72
73
  if (changeOpts) {
73
74
  return setData(changeOpts);
@@ -14,6 +14,7 @@ require('core-js/modules/es.promise.js');
14
14
  require('core-js/modules/es.object.keys.js');
15
15
  require('core-js/modules/web.dom-collections.for-each.js');
16
16
  require('core-js/modules/es.reflect.delete-property.js');
17
+ require('core-js/modules/es.array.slice.js');
17
18
  require('core-js/modules/es.function.name.js');
18
19
  require('core-js/modules/es.array.concat.js');
19
20
  require('core-js/modules/es.array.map.js');
@@ -103,13 +104,14 @@ var useHForm = (function () {
103
104
  });
104
105
  return newValue;
105
106
  },
106
- dispatch: function dispatch(action) {
107
+ dispatch: function dispatch() {
108
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
109
+ args[_key] = arguments[_key];
110
+ }
111
+ var action = args[0],
112
+ dispatchArgs = args.slice(1);
107
113
  var key = action.key,
108
114
  name = action.name;
109
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
110
- args[_key - 1] = arguments[_key];
111
- }
112
- var dispatchArgs = args || [];
113
115
  var items = dispatchSourceData[key];
114
116
  if (!items) {
115
117
  return;
@@ -118,13 +120,13 @@ var useHForm = (function () {
118
120
  defaultFn = items.defaultFn;
119
121
  if (name) {
120
122
  var _keysFn$name;
121
- return (_keysFn$name = keysFn[name]) === null || _keysFn$name === void 0 ? void 0 : _keysFn$name.call.apply(_keysFn$name, [keysFn].concat(dispatchArgs));
123
+ return (_keysFn$name = keysFn[name]) === null || _keysFn$name === void 0 ? void 0 : _keysFn$name.call.apply(_keysFn$name, [keysFn].concat(_toConsumableArray(dispatchArgs)));
122
124
  }
123
125
  var fnArrays = Object.keys(keysFn).map(function (itemKey) {
124
126
  return keysFn[itemKey];
125
127
  });
126
128
  [].concat(_toConsumableArray(fnArrays), _toConsumableArray(defaultFn)).forEach(function (fn) {
127
- fn.apply(void 0, dispatchArgs);
129
+ fn.apply(void 0, _toConsumableArray(dispatchArgs));
128
130
  });
129
131
  },
130
132
  addDispatchListener: function addDispatchListener(action, fn) {
@@ -18,7 +18,7 @@ var antd = require('antd');
18
18
  var ahooks = require('ahooks');
19
19
 
20
20
  var _excluded = ["buttonProps", "value", "onChange", "children", "request"],
21
- _excluded2 = ["onClick", "type", "loading"];
21
+ _excluded2 = ["onClick", "type", "ghost", "loading"];
22
22
  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; }
23
23
  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; }
24
24
  var Index = function Index(_ref) {
@@ -32,6 +32,8 @@ var Index = function Index(_ref) {
32
32
  var onClick = buttonProps.onClick,
33
33
  _buttonProps$type = buttonProps.type,
34
34
  type = _buttonProps$type === void 0 ? "primary" : _buttonProps$type,
35
+ _buttonProps$ghost = buttonProps.ghost,
36
+ ghost = _buttonProps$ghost === void 0 ? true : _buttonProps$ghost,
35
37
  btnLoading = buttonProps.loading,
36
38
  oProps = _objectWithoutProperties(buttonProps, _excluded2);
37
39
  var _useRequest = ahooks.useRequest(function (val) {
@@ -82,13 +84,15 @@ var Index = function Index(_ref) {
82
84
  },
83
85
  value: value,
84
86
  onChange: change
85
- })), jsxRuntime.jsx(antd.Button, _objectSpread(_objectSpread({}, oProps), {}, {
87
+ })), jsxRuntime.jsx(antd.Button, _objectSpread(_objectSpread({
86
88
  type: type,
87
89
  onClick: click,
88
90
  loading: loading || btnLoading,
89
91
  style: {
90
- marginLeft: 4
92
+ marginLeft: 8
91
93
  },
94
+ ghost: ghost
95
+ }, oProps), {}, {
92
96
  children: children
93
97
  }))]
94
98
  });
@@ -10,7 +10,7 @@ export declare const useOptionReq: ({ manual, request, options, serviceSearch, s
10
10
  data: OptionType[] | undefined;
11
11
  onSearch: ((value: string) => void) | undefined;
12
12
  mathShowSearch: boolean | undefined;
13
- reload: ({ options: changeOpts, params }: ParamsModal) => void | Promise<OptionType[] | undefined>;
13
+ reload: (reloadParams?: ParamsModal) => void | Promise<OptionType[] | undefined>;
14
14
  };
15
15
  export declare const useFilterOption: ({ filterOption, serviceSearch, }: PartialHSelectProps) => boolean | import("rc-select/lib/Select").FilterFunc<import("rc-select/lib/Select").DefaultOptionType> | undefined;
16
16
  export {};
@@ -67,8 +67,9 @@ var useOptionReq = function useOptionReq(_ref) {
67
67
  run = _useRequest.run,
68
68
  loading = _useRequest.loading,
69
69
  error = _useRequest.error;
70
- var reload = function reload(_ref3) {
71
- var changeOpts = _ref3.options,
70
+ var reload = function reload(reloadParams) {
71
+ var _ref3 = reloadParams || {},
72
+ changeOpts = _ref3.options,
72
73
  params = _ref3.params;
73
74
  if (changeOpts) {
74
75
  return setData(changeOpts);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "1.5.7",
3
+ "version": "1.6.0",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -85,9 +85,9 @@ export default () => {
85
85
  });
86
86
  return newValue;
87
87
  }, //转化方法
88
- dispatch(action, ...args) {
88
+ dispatch(...args) {
89
+ const [action,...dispatchArgs]=args;
89
90
  const { key, name } = action;
90
- const dispatchArgs=args||[];
91
91
  const items = dispatchSourceData[key];
92
92
  if (!items) {
93
93
  return;
@@ -14,6 +14,7 @@ const Index: React.FC<HButtonInputProps> = ({
14
14
  const {
15
15
  onClick,
16
16
  type = "primary",
17
+ ghost=true,
17
18
  loading: btnLoading,
18
19
  ...oProps
19
20
  } = buttonProps;
@@ -38,11 +39,12 @@ const Index: React.FC<HButtonInputProps> = ({
38
39
  <Input.Group compact style={{ display: "flex" }}>
39
40
  <Input {...props} style={{ flex: 1 }} value={value} onChange={change} />
40
41
  <Button
41
- {...oProps}
42
42
  type={type}
43
43
  onClick={click}
44
44
  loading={loading || btnLoading}
45
- style={{ marginLeft: 4 }}
45
+ style={{ marginLeft: 8 }}
46
+ ghost={ghost}
47
+ {...oProps}
46
48
  >
47
49
  {children}
48
50
  </Button>
@@ -42,7 +42,8 @@ export const useOptionReq = ({
42
42
  },
43
43
  }
44
44
  );
45
- const reload = ({ options: changeOpts, params }: ParamsModal) => {
45
+ const reload = (reloadParams?: ParamsModal) => {
46
+ const { options: changeOpts, params }=reloadParams||{};
46
47
  if (changeOpts) {
47
48
  return setData(changeOpts);
48
49
  }