@hw-component/form 0.0.2-bate → 0.0.2-beta-v1

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.
Files changed (112) hide show
  1. package/es/CheckboxGroup/index.d.ts +1 -1
  2. package/es/CheckboxGroup/index.js +4 -2
  3. package/es/DialogForm/DrawerForm/Footer.d.ts +4 -0
  4. package/es/DialogForm/DrawerForm/Footer.js +23 -0
  5. package/es/DialogForm/DrawerForm/Title.d.ts +4 -0
  6. package/es/DialogForm/DrawerForm/Title.js +18 -0
  7. package/es/DialogForm/DrawerForm/index.d.ts +4 -0
  8. package/es/DialogForm/DrawerForm/index.js +111 -0
  9. package/es/DialogForm/ModalForm.d.ts +4 -0
  10. package/es/DialogForm/ModalForm.js +89 -0
  11. package/es/DialogForm/hooks.d.ts +14 -0
  12. package/es/DialogForm/hooks.js +124 -0
  13. package/es/DialogForm/modal.d.ts +25 -0
  14. package/es/Form/HFormConnect.d.ts +1 -2
  15. package/es/Form/HFormConnect.js +17 -16
  16. package/es/Form/InitSet.d.ts +1 -4
  17. package/es/Form/InitSet.js +2 -3
  18. package/es/Form/config.d.ts +5 -4
  19. package/es/Form/config.js +6 -4
  20. package/es/Form/hooks/index.d.ts +0 -6
  21. package/es/Form/hooks/index.js +1 -33
  22. package/es/Form/hooks/useHForm.js +72 -15
  23. package/es/Form/index.js +46 -15
  24. package/es/Form/modal.d.ts +20 -8
  25. package/es/Input/SelectInput.d.ts +2 -2
  26. package/es/Input/SelectInput.js +8 -5
  27. package/es/Input/modal.d.ts +2 -0
  28. package/es/Select/hooks/norHooks.d.ts +1 -1
  29. package/es/TDPicker/RangePicker.d.ts +1 -1
  30. package/es/TDPicker/RangePicker.js +4 -2
  31. package/es/TextArea/index.js +21 -0
  32. package/es/Upload/UrlUpload/index.d.ts +2 -2
  33. package/es/Upload/UrlUpload/index.js +3 -3
  34. package/es/Upload/hooks/customRequest.js +99 -36
  35. package/es/Upload/index.d.ts +1 -2
  36. package/es/Upload/index.js +39 -5
  37. package/es/Upload/modal.d.ts +2 -0
  38. package/es/config.js +4 -4
  39. package/es/index.css +1 -1
  40. package/es/index.d.ts +8 -4
  41. package/es/index.js +7 -1
  42. package/lib/CheckboxGroup/index.d.ts +1 -1
  43. package/lib/CheckboxGroup/index.js +4 -2
  44. package/lib/DialogForm/DrawerForm/Footer.d.ts +4 -0
  45. package/lib/DialogForm/DrawerForm/Footer.js +26 -0
  46. package/lib/DialogForm/DrawerForm/Title.d.ts +4 -0
  47. package/lib/DialogForm/DrawerForm/Title.js +21 -0
  48. package/lib/DialogForm/DrawerForm/index.d.ts +4 -0
  49. package/lib/DialogForm/DrawerForm/index.js +114 -0
  50. package/lib/DialogForm/ModalForm.d.ts +4 -0
  51. package/lib/DialogForm/ModalForm.js +92 -0
  52. package/lib/DialogForm/hooks.d.ts +14 -0
  53. package/lib/DialogForm/hooks.js +128 -0
  54. package/lib/DialogForm/modal.d.ts +25 -0
  55. package/lib/Form/HFormConnect.d.ts +1 -2
  56. package/lib/Form/HFormConnect.js +17 -16
  57. package/lib/Form/InitSet.d.ts +1 -4
  58. package/lib/Form/InitSet.js +2 -3
  59. package/lib/Form/config.d.ts +5 -4
  60. package/lib/Form/config.js +3 -1
  61. package/lib/Form/hooks/index.d.ts +0 -6
  62. package/lib/Form/hooks/index.js +0 -33
  63. package/lib/Form/hooks/useHForm.js +72 -15
  64. package/lib/Form/index.js +53 -22
  65. package/lib/Form/modal.d.ts +20 -8
  66. package/lib/Input/SelectInput.d.ts +2 -2
  67. package/lib/Input/SelectInput.js +8 -5
  68. package/lib/Input/modal.d.ts +2 -0
  69. package/lib/Select/hooks/norHooks.d.ts +1 -1
  70. package/lib/TDPicker/RangePicker.d.ts +1 -1
  71. package/lib/TDPicker/RangePicker.js +4 -2
  72. package/lib/TextArea/index.js +24 -0
  73. package/lib/Upload/UrlUpload/index.d.ts +2 -2
  74. package/lib/Upload/UrlUpload/index.js +3 -3
  75. package/lib/Upload/hooks/customRequest.js +99 -36
  76. package/lib/Upload/index.d.ts +1 -2
  77. package/lib/Upload/index.js +39 -5
  78. package/lib/Upload/modal.d.ts +2 -0
  79. package/lib/config.js +4 -4
  80. package/lib/index.css +1 -1
  81. package/lib/index.d.ts +8 -4
  82. package/lib/index.js +10 -0
  83. package/package.json +1 -1
  84. package/src/components/CheckboxGroup/index.tsx +2 -2
  85. package/src/components/DialogForm/DrawerForm/Footer.tsx +19 -0
  86. package/src/components/DialogForm/DrawerForm/Title.tsx +12 -0
  87. package/src/components/DialogForm/DrawerForm/index.tsx +85 -0
  88. package/src/components/DialogForm/ModalForm.tsx +60 -0
  89. package/src/components/DialogForm/hooks.ts +87 -0
  90. package/src/components/DialogForm/modal.ts +27 -0
  91. package/src/components/Form/FormItem/Helper.tsx +3 -4
  92. package/src/components/Form/HFormConnect.tsx +26 -8
  93. package/src/components/Form/InitSet.tsx +3 -5
  94. package/src/components/Form/config.ts +2 -1
  95. package/src/components/Form/hooks/index.ts +0 -20
  96. package/src/components/Form/hooks/useHForm.ts +67 -14
  97. package/src/components/Form/index.less +1 -1
  98. package/src/components/Form/index.tsx +25 -7
  99. package/src/components/Form/modal.ts +22 -10
  100. package/src/components/Input/SelectInput.tsx +4 -2
  101. package/src/components/Input/modal.ts +2 -0
  102. package/src/components/TDPicker/RangePicker.tsx +5 -6
  103. package/src/components/Upload/UrlUpload/index.tsx +2 -2
  104. package/src/components/Upload/hooks/customRequest.ts +57 -14
  105. package/src/components/Upload/index.tsx +39 -7
  106. package/src/components/Upload/modal.ts +2 -0
  107. package/src/components/config.ts +4 -4
  108. package/src/components/index.tsx +6 -0
  109. package/src/pages/DrawerForm/index.tsx +127 -0
  110. package/src/pages/Form/index.tsx +3 -0
  111. package/src/pages/ModalForm/index.tsx +127 -0
  112. package/src/routes.tsx +12 -0
@@ -40,38 +40,6 @@ var useSub = function useSub(_ref) {
40
40
  manual: true
41
41
  });
42
42
  };
43
- var useInit = function useInit(_ref3) {
44
- var infoRequest = _ref3.infoRequest,
45
- _ref3$initialValues = _ref3.initialValues,
46
- initialValues = _ref3$initialValues === void 0 ? {} : _ref3$initialValues;
47
- var _useRequest = useRequest( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
48
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
49
- while (1) switch (_context2.prev = _context2.next) {
50
- case 0:
51
- if (!infoRequest) {
52
- _context2.next = 2;
53
- break;
54
- }
55
- return _context2.abrupt("return", infoRequest());
56
- case 2:
57
- return _context2.abrupt("return", initialValues);
58
- case 3:
59
- case "end":
60
- return _context2.stop();
61
- }
62
- }, _callee2);
63
- }))),
64
- infoRun = _useRequest.run,
65
- infoLoading = _useRequest.loading,
66
- infoErr = _useRequest.error,
67
- infoData = _useRequest.data;
68
- return {
69
- infoRun: infoRun,
70
- infoLoading: infoLoading,
71
- infoErr: infoErr,
72
- infoData: infoData
73
- };
74
- };
75
43
 
76
- export { useCurrentForm, useInit, useSub };
44
+ export { useCurrentForm, useSub };
77
45
  // powered by hdj
@@ -5,17 +5,20 @@ import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js/obj
5
5
  import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptors';
6
6
  import _Object$defineProperties from '@babel/runtime-corejs3/core-js/object/define-properties';
7
7
  import _Object$defineProperty from '@babel/runtime-corejs3/core-js/object/define-property';
8
+ import _toConsumableArray from '@babel/runtime-corejs3/helpers/toConsumableArray';
8
9
  import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
9
10
  import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
10
11
  import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
11
12
  import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
12
13
  import _Reflect$deleteProperty from '@babel/runtime-corejs3/core-js/reflect/delete-property';
14
+ import _concatInstanceProperty from '@babel/runtime-corejs3/core-js/instance/concat';
15
+ import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
13
16
  import _Promise from '@babel/runtime-corejs3/core-js/promise';
14
17
  import { useMemo } from 'react';
15
18
  import { Form } from 'antd';
16
19
 
17
20
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
18
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
21
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context5, _context6; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context5 = ownKeys(Object(source), !0)).call(_context5, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context6 = ownKeys(Object(source))).call(_context6, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
19
22
  var useHForm = (function () {
20
23
  var _Form$useForm = Form.useForm(),
21
24
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
@@ -23,7 +26,26 @@ var useHForm = (function () {
23
26
  return useMemo(function () {
24
27
  var formatSourceData = {};
25
28
  var dispatchSourceData = {};
29
+ var cacheValues = {};
30
+ var norAddItemDispatch = function norAddItemDispatch(name, fn) {
31
+ if (!name) {
32
+ return {
33
+ keysFn: {},
34
+ defaultFn: [fn]
35
+ };
36
+ }
37
+ return {
38
+ keysFn: _defineProperty({}, name, fn),
39
+ defaultFn: []
40
+ };
41
+ };
26
42
  return _objectSpread(_objectSpread({
43
+ initValues: function initValues() {
44
+ if (cacheValues) {
45
+ var newValue = this.formatValues(cacheValues);
46
+ form.setFieldsValue(newValue);
47
+ }
48
+ },
27
49
  addFormat: function addFormat(name, format) {
28
50
  if (!format) {
29
51
  return;
@@ -56,42 +78,77 @@ var useHForm = (function () {
56
78
  });
57
79
  return newValue;
58
80
  },
59
- dispatch: function dispatch(key) {
81
+ dispatch: function dispatch(action) {
82
+ var _context2, _context3, _context4;
83
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
84
+ args[_key - 1] = arguments[_key];
85
+ }
86
+ var key = action.key,
87
+ name = action.name;
60
88
  var items = dispatchSourceData[key];
61
89
  if (!items) {
62
90
  return;
63
91
  }
64
- _forEachInstanceProperty(items).call(items, function (fn) {
65
- fn();
92
+ var keysFn = items.keysFn,
93
+ defaultFn = items.defaultFn;
94
+ if (name) {
95
+ var _keysFn$name, _context;
96
+ return (_keysFn$name = keysFn[name]) === null || _keysFn$name === void 0 ? void 0 : _keysFn$name.call.apply(_keysFn$name, _concatInstanceProperty(_context = [keysFn]).call(_context, args));
97
+ }
98
+ var fnArrays = _mapInstanceProperty(_context2 = _Object$keys(keysFn)).call(_context2, function (itemKey) {
99
+ return keysFn[itemKey];
100
+ });
101
+ _forEachInstanceProperty(_context3 = _concatInstanceProperty(_context4 = []).call(_context4, _toConsumableArray(fnArrays), _toConsumableArray(defaultFn))).call(_context3, function (fn) {
102
+ fn.apply(void 0, args);
66
103
  });
67
104
  },
68
- addDispatchListener: function addDispatchListener(key, fn) {
105
+ addDispatchListener: function addDispatchListener(action, fn) {
106
+ var key = action.key,
107
+ name = action.name;
69
108
  var items = dispatchSourceData[key];
70
109
  if (!items) {
71
- dispatchSourceData[key] = [fn];
110
+ dispatchSourceData[key] = norAddItemDispatch(name, fn);
72
111
  return;
73
112
  }
74
- items.push(fn);
75
- dispatchSourceData[key] = items;
113
+ var keysFn = items.keysFn,
114
+ defaultFn = items.defaultFn;
115
+ if (name) {
116
+ keysFn[name] = fn;
117
+ } else {
118
+ defaultFn.push(fn);
119
+ }
120
+ dispatchSourceData[key] = {
121
+ keysFn: keysFn,
122
+ defaultFn: defaultFn
123
+ };
76
124
  },
77
- removeDispatchListener: function removeDispatchListener(key) {
78
- if (!key) {
125
+ removeDispatchListener: function removeDispatchListener(action) {
126
+ if (!action) {
79
127
  dispatchSourceData = {};
80
128
  return;
81
129
  }
130
+ var key = action.key,
131
+ name = action.name;
132
+ var items = dispatchSourceData[key];
133
+ if (!items) {
134
+ return;
135
+ }
136
+ if (name) {
137
+ var keysFn = items.keysFn;
138
+ _Reflect$deleteProperty(keysFn, name);
139
+ items.keysFn = keysFn;
140
+ dispatchSourceData[key] = items;
141
+ return;
142
+ }
82
143
  _Reflect$deleteProperty(dispatchSourceData, key);
83
144
  },
84
- initValues: function initValues() {
85
- var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
86
- var newValue = this.formatValues(value);
87
- form.setFieldsValue(newValue);
88
- },
89
145
  outputValues: function outputValues(value) {
90
146
  return this.formatValues(value, "outputValue");
91
147
  }
92
148
  }, form), {}, {
93
149
  setFieldsValue: function setFieldsValue(values) {
94
150
  var newValue = this.formatValues(values);
151
+ cacheValues = values;
95
152
  form.setFieldsValue(newValue);
96
153
  },
97
154
  validateFields: function validateFields(nameList) {
package/es/Form/index.js CHANGED
@@ -1,18 +1,21 @@
1
1
  // welcome to hoo hoo hoo
2
- import React from 'react';
2
+ import React, { useEffect } from 'react';
3
3
  import _extends from '@babel/runtime-corejs3/helpers/extends';
4
+ import _asyncToGenerator from '@babel/runtime-corejs3/helpers/asyncToGenerator';
4
5
  import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
5
6
  import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
7
+ import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
6
8
  import { Form } from 'antd';
7
9
  import Item from './FormItem/index.js';
8
- import { useCurrentForm, useSub, useInit } from './hooks/index.js';
10
+ import { useCurrentForm, useSub } from './hooks/index.js';
9
11
  import { FormContext } from './Context/index.js';
10
12
  import Index from '../PageHandler/index.js';
11
13
  import useInitConfigData from './hooks/useInitConfigData.js';
14
+ import { useRequest } from 'ahooks';
12
15
  import InitSet from './InitSet.js';
13
16
 
14
17
  var _excluded = ["configData", "labelWidth", "form", "request", "onFinish", "infoRequest", "valueType", "initialValues"];
15
- var index = (function (_ref) {
18
+ var HForm = (function (_ref) {
16
19
  var configData = _ref.configData,
17
20
  labelWidth = _ref.labelWidth,
18
21
  form = _ref.form,
@@ -36,14 +39,44 @@ var index = (function (_ref) {
36
39
  }),
37
40
  run = _useSub.run,
38
41
  loading = _useSub.loading;
39
- var _useInit = useInit({
40
- infoRequest: infoRequest,
41
- initialValues: initialValues
42
- }),
43
- infoRun = _useInit.infoRun,
44
- infoLoading = _useInit.infoLoading,
45
- infoErr = _useInit.infoErr,
46
- infoData = _useInit.infoData;
42
+ var _useRequest = useRequest( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
43
+ var setValue;
44
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
45
+ while (1) switch (_context.prev = _context.next) {
46
+ case 0:
47
+ setValue = initialValues;
48
+ if (!(!initialValues && !infoRequest)) {
49
+ _context.next = 3;
50
+ break;
51
+ }
52
+ return _context.abrupt("return", {});
53
+ case 3:
54
+ if (!infoRequest) {
55
+ _context.next = 7;
56
+ break;
57
+ }
58
+ _context.next = 6;
59
+ return infoRequest();
60
+ case 6:
61
+ setValue = _context.sent;
62
+ case 7:
63
+ hForm.setFieldsValue(setValue);
64
+ return _context.abrupt("return", setValue);
65
+ case 9:
66
+ case "end":
67
+ return _context.stop();
68
+ }
69
+ }, _callee);
70
+ }))),
71
+ infoRun = _useRequest.run,
72
+ infoLoading = _useRequest.loading,
73
+ infoErr = _useRequest.error,
74
+ infoData = _useRequest.data;
75
+ useEffect(function () {
76
+ return function () {
77
+ hForm.removeDispatchListener();
78
+ };
79
+ }, []);
47
80
  return /*#__PURE__*/React.createElement(Index, {
48
81
  loading: infoLoading,
49
82
  error: infoErr,
@@ -64,10 +97,8 @@ var index = (function (_ref) {
64
97
  key: index,
65
98
  labelWidth: itemLabelWidth || labelWidth
66
99
  }));
67
- })), /*#__PURE__*/React.createElement(InitSet, {
68
- initValues: infoData
69
- })));
100
+ }), /*#__PURE__*/React.createElement(InitSet, null))));
70
101
  });
71
102
 
72
- export { index as default };
103
+ export { HForm as default };
73
104
  // powered by hdj
@@ -12,6 +12,7 @@ import type { IUpLoadProps } from "@/components/Upload/modal";
12
12
  import type { SelectProps } from "antd";
13
13
  import type { RangePickerProps } from "antd/es/date-picker";
14
14
  import type { PromiseFnResult, ValueCheckMapModal, ValueSwitchMapModal, DateRangePickerValueMapModal } from "../modal";
15
+ import type { ForwardedRef } from "react";
15
16
  type RenderFun = (props: HItemProps, node: React.ReactNode, form: FormInstance) => void;
16
17
  type ItemPropsType = HCheckboxProps | HInputProps | HSelectInputProps | HButtonProps | HRadioGroupProps | HSelectProps | ButtonProps | HSwitchProps | HDatePickerProps | HRangePickerProps | HTimePickerProps | TextAreaProps | IUpLoadProps;
17
18
  export interface HoverModal {
@@ -20,17 +21,17 @@ export interface HoverModal {
20
21
  }
21
22
  type HelperModal = (form: HFormInstance) => React.ReactNode | string;
22
23
  export type HideModal = (form: HFormInstance) => boolean;
24
+ export type AddDispatchListenerFn = (action: ActionModal, fn: argsFn) => void;
23
25
  export interface HItemProps extends Omit<FormItemProps, "name"> {
24
26
  type?: string;
25
27
  itemProps?: ItemPropsType;
26
28
  render?: RenderFun;
27
- helper?: HelperModal;
29
+ helper?: HelperModal | string;
28
30
  hover?: string | HoverModal;
29
31
  labelWidth?: number;
30
32
  hide?: boolean | HideModal;
31
33
  placeholder?: string | string[];
32
- formatKeys?: string[];
33
- name: string;
34
+ name?: string;
34
35
  }
35
36
  export interface HFormProps<T = any, R = any> extends Omit<FormProps, "form"> {
36
37
  configData: HItemProps[];
@@ -42,10 +43,13 @@ export interface HFormProps<T = any, R = any> extends Omit<FormProps, "form"> {
42
43
  }
43
44
  export interface HFormItemProps extends HItemProps {
44
45
  required?: boolean;
46
+ value?: any;
47
+ onChange?: (val: any, item: any) => void;
45
48
  }
46
49
  export interface FormItemWithRender extends Omit<HFormItemProps, "render"> {
47
50
  render: (form: HFormInstance) => React.ReactNode;
48
51
  }
52
+ export type argsFn = (...args: any[]) => void;
49
53
  export interface FormContextProps {
50
54
  loading?: boolean;
51
55
  form: HFormInstance;
@@ -64,14 +68,18 @@ export interface IFormConfigContextProps {
64
68
  dateRanges?: RangePickerProps["ranges"];
65
69
  uploadProps?: ConfigUploadProps;
66
70
  }
71
+ interface ActionModal {
72
+ key: string;
73
+ name?: string;
74
+ }
67
75
  export interface HFormInstance extends FormInstance {
68
76
  addFormat: (name: string, formats?: FormatItemModal) => void;
69
- initValues: (values?: Record<string, any>) => void;
77
+ initValues: VoidFunction;
70
78
  formatValues: (values?: Record<string, any>, formatKey?: string) => Record<string, any>;
71
- dispatch: (key: string) => void;
79
+ dispatch: (action: ActionModal, ...args: any[]) => void;
72
80
  outputValues: (values?: Record<string, any>) => Record<string, any>;
73
- addDispatchListener: (key: string, fn: VoidFunction) => void;
74
- removeDispatchListener: (key?: string) => void;
81
+ addDispatchListener: AddDispatchListenerFn;
82
+ removeDispatchListener: (action?: ActionModal, fn?: argsFn) => void;
75
83
  }
76
84
  export interface ConnectConfigModal {
77
85
  format?: Record<string, addFormatItemModal>;
@@ -86,7 +94,11 @@ export interface addFormatItemModal {
86
94
  inputValue: addValueFormat;
87
95
  outputValue: addValueFormat;
88
96
  }
89
- export interface ConnectResultProps {
97
+ export interface ConnectResultProps extends HFormItemProps {
90
98
  addFormat?: (format: Record<string, addFormatItemModal>) => void;
99
+ addDispatchListener?: (key: string, fn: argsFn) => void;
100
+ ref?: ForwardedRef<any>;
101
+ value?: any;
102
+ onChange?: (value: any, item?: any) => void;
91
103
  }
92
104
  export {};
@@ -4,6 +4,6 @@ export declare enum SelectInputType {
4
4
  input = 0,
5
5
  select = 1
6
6
  }
7
- export declare const Index: ({ selectProps, value, onChange, valueName, addFormat, ...props }: HSelectInputProps) => JSX.Element;
8
- declare const _default: (props: import("../Form/modal").HFormItemProps) => import("react").ReactElement<import("../Form/modal").ConnectResultProps, string | import("react").JSXElementConstructor<any>>;
7
+ export declare const Index: ({ selectProps, value, onChange, valueName, addFormat, addDispatchListener, ...props }: HSelectInputProps) => JSX.Element;
8
+ declare const _default: import("react").ForwardRefExoticComponent<import("@/components/Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
9
9
  export default _default;
@@ -17,7 +17,7 @@ import HSelect from '../Select/index.js';
17
17
  import { defaultValueName, defaultSelectStyle } from './defaultConfig.js';
18
18
  import HFormConnect from '../Form/HFormConnect.js';
19
19
 
20
- var _excluded = ["selectProps", "value", "onChange", "valueName", "addFormat"],
20
+ var _excluded = ["selectProps", "value", "onChange", "valueName", "addFormat", "addDispatchListener"],
21
21
  _excluded2 = ["style", "placeholder"];
22
22
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, 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 _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -34,8 +34,9 @@ var Index = function Index(_ref) {
34
34
  onChange = _ref.onChange,
35
35
  _ref$valueName = _ref.valueName,
36
36
  valueName = _ref$valueName === void 0 ? defaultValueName : _ref$valueName,
37
- addFormat = _ref.addFormat,
38
- props = _objectWithoutProperties(_ref, _excluded);
37
+ addFormat = _ref.addFormat;
38
+ _ref.addDispatchListener;
39
+ var props = _objectWithoutProperties(_ref, _excluded);
39
40
  var _valueName$input = valueName.input,
40
41
  input = _valueName$input === void 0 ? "" : _valueName$input,
41
42
  _valueName$select = valueName.select,
@@ -57,7 +58,8 @@ var Index = function Index(_ref) {
57
58
  "float": {
58
59
  inputValue: function inputValue(item, initValue) {
59
60
  var _context;
60
- var name = item.name;
61
+ var _item$name = item.name,
62
+ name = _item$name === void 0 ? "" : _item$name;
61
63
  var resultObj = {};
62
64
  _forEachInstanceProperty(_context = _Object$values(valueName)).call(_context, function (key) {
63
65
  resultObj[key] = initValue[key];
@@ -65,7 +67,8 @@ var Index = function Index(_ref) {
65
67
  return _defineProperty({}, name, resultObj);
66
68
  },
67
69
  outputValue: function outputValue(item, _outputValue) {
68
- var name = item.name;
70
+ var _item$name2 = item.name,
71
+ name = _item$name2 === void 0 ? "" : _item$name2;
69
72
  var _outputValue$name = _outputValue[name],
70
73
  itemVal = _outputValue$name === void 0 ? {} : _outputValue$name;
71
74
  var newItemVal = _defineProperty({}, itemVal[select], itemVal[input]);
@@ -3,6 +3,7 @@ import type { HSelectProps } from "../Select/modal";
3
3
  import type { SelectInputType } from "./SelectInput";
4
4
  import type { PromiseFnResult } from "../modal";
5
5
  import type { addFormatItemModal } from "../Form/modal";
6
+ import type { AddDispatchListenerFn } from "../Form/modal";
6
7
  export type HInputProps = InputProps;
7
8
  interface ValueNameModal {
8
9
  input?: string;
@@ -14,6 +15,7 @@ export interface HSelectInputProps extends Omit<HInputProps, "value" | "onChange
14
15
  onChange?: (value: Record<string, any>, type: SelectInputType) => void;
15
16
  valueName?: ValueNameModal;
16
17
  addFormat?: (config: Record<string, addFormatItemModal>) => void;
18
+ addDispatchListener?: AddDispatchListenerFn;
17
19
  }
18
20
  export interface HButtonProps extends Omit<ButtonProps, "onClick"> {
19
21
  onClick: (value: string | readonly string[] | number | undefined, e: HTMLElement) => void;
@@ -1,6 +1,6 @@
1
1
  import type { OptionType, PartialHSelectProps } from "@/components/Select/modal";
2
2
  export declare const useOptionReq: ({ manual, request, options, serviceSearch, showSearch, onSearch: propsOnSearch, }: PartialHSelectProps) => {
3
- run: (params?: any, type?: any) => Promise<any>;
3
+ run: (params?: any, type?: any) => Promise<OptionType[] | undefined>;
4
4
  loading: boolean;
5
5
  error: Error | undefined;
6
6
  data: OptionType[] | undefined;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import type { HItemProps } from "../Form/modal";
3
3
  declare const _default: {
4
- Component: (props: import("../Form/modal").HFormItemProps) => React.ReactElement<import("../Form/modal").ConnectResultProps, string | React.JSXElementConstructor<any>>;
4
+ Component: React.ForwardRefExoticComponent<import("../Form/modal").HFormItemProps & React.RefAttributes<any>>;
5
5
  placeholder: ({ label }: HItemProps) => string[];
6
6
  requiredErrMsg: ({ label }: HItemProps) => string;
7
7
  };
@@ -67,7 +67,8 @@ var HRangePicker = function HRangePicker(_ref) {
67
67
  "float": {
68
68
  inputValue: function inputValue(item, initValue) {
69
69
  var _context;
70
- var valueName = item.name;
70
+ var _item$name = item.name,
71
+ valueName = _item$name === void 0 ? "" : _item$name;
71
72
  var resultObj = {};
72
73
  _forEachInstanceProperty(_context = _Object$values(dateMapKeys)).call(_context, function (key) {
73
74
  if (initValue[key]) {
@@ -78,7 +79,8 @@ var HRangePicker = function HRangePicker(_ref) {
78
79
  return _defineProperty({}, valueName, hasKeys ? resultObj : null);
79
80
  },
80
81
  outputValue: function outputValue(item, _outputValue) {
81
- var valueName = item.name;
82
+ var _item$name2 = item.name,
83
+ valueName = _item$name2 === void 0 ? "" : _item$name2;
82
84
  var _outputValue$valueNam = _outputValue[valueName],
83
85
  itemVal = _outputValue$valueNam === void 0 ? {} : _outputValue$valueNam;
84
86
  return _objectSpread({}, itemVal);
@@ -0,0 +1,21 @@
1
+ // welcome to hoo hoo hoo
2
+ import React from 'react';
3
+ import _extends from '@babel/runtime-corejs3/helpers/extends';
4
+ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
5
+ import { Input } from 'antd';
6
+
7
+ var _excluded = ["autoSize"];
8
+ var TextArea = (function (_ref) {
9
+ var _ref$autoSize = _ref.autoSize,
10
+ autoSize = _ref$autoSize === void 0 ? {
11
+ minRows: 4,
12
+ maxRows: 4
13
+ } : _ref$autoSize,
14
+ props = _objectWithoutProperties(_ref, _excluded);
15
+ return /*#__PURE__*/React.createElement(Input.TextArea, _extends({
16
+ autoSize: autoSize
17
+ }, props));
18
+ });
19
+
20
+ export { TextArea as default };
21
+ // powered by hdj
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import type { IUrlUploadProps } from "../modal";
3
- declare const _default: ({ placeholder, value, onChange, mediaType, ...props }: IUrlUploadProps) => JSX.Element;
4
- export default _default;
3
+ declare const Index: ({ placeholder, value, onChange, mediaType, ...props }: IUrlUploadProps) => JSX.Element;
4
+ export default Index;
@@ -13,7 +13,7 @@ import HUpload from '../index.js';
13
13
  import TypeEle from '../MediaTypeEle/TypeEle.js';
14
14
 
15
15
  var _excluded = ["placeholder", "value", "onChange", "mediaType"];
16
- var HUrlUpload = (function (_ref) {
16
+ var Index = function Index(_ref) {
17
17
  var _ref$placeholder = _ref.placeholder,
18
18
  placeholder = _ref$placeholder === void 0 ? "请输入文件地址" : _ref$placeholder,
19
19
  _ref$value = _ref.value,
@@ -113,7 +113,7 @@ var HUrlUpload = (function (_ref) {
113
113
  onReady: onReady,
114
114
  onError: onError
115
115
  })));
116
- });
116
+ };
117
117
 
118
- export { HUrlUpload as default };
118
+ export { Index as default };
119
119
  // powered by hdj