@hw-component/form 0.0.5-beta-v1 → 0.0.5-beta-v2
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/es/CheckboxGroup/CheckBox/index.js +1 -1
- package/es/CheckboxGroup/hooks.js +19 -20
- package/es/CheckboxGroup/index.js +17 -16
- package/es/DialogForm/DrawerForm/index.js +14 -14
- package/es/DialogForm/ModalForm.js +15 -15
- package/es/DialogForm/hooks.js +16 -17
- package/es/Form/Context/FormConfigProvider.js +15 -15
- package/es/Form/FormItem/BasicItem.js +12 -12
- package/es/Form/FormItem/RegularFormItem.js +11 -11
- package/es/Form/FormItem/UpFormItem.js +12 -12
- package/es/Form/FormItem/index.js +11 -11
- package/es/Form/HFormConnect.js +15 -14
- package/es/Form/hooks/index.js +19 -19
- package/es/Form/hooks/useDefaultRender.js +12 -12
- package/es/Form/hooks/useHForm.js +32 -32
- package/es/Form/hooks/useInitConfigData.js +21 -21
- package/es/Form/index.js +14 -14
- package/es/Input/ButtonInput.js +16 -16
- package/es/Input/ColorInput/index.js +34 -28
- package/es/Input/InputNumber.js +12 -12
- package/es/Input/SelectInput.js +17 -17
- package/es/Input/index.js +14 -14
- package/es/RadioGroup/index.js +16 -16
- package/es/Select/components/AllSelect.js +3 -5
- package/es/Select/defaultConfig.js +4 -4
- package/es/Select/hooks/changeHooks.js +24 -24
- package/es/Select/hooks/norHooks.js +10 -8
- package/es/Select/index.js +15 -15
- package/es/Select/utils.js +16 -16
- package/es/Submit/index.js +12 -12
- package/es/Switch/index.js +13 -13
- package/es/TDPicker/RangePicker.js +21 -21
- package/es/TDPicker/TimePicker.js +12 -12
- package/es/TDPicker/hooks.js +11 -10
- package/es/TDPicker/index.js +12 -12
- package/es/TextArea/index.js +12 -12
- package/es/Upload/MediaTypeEle/index.js +3 -3
- package/es/Upload/UrlUpload/index.js +29 -23
- package/es/Upload/hooks/change.js +17 -17
- package/es/Upload/hooks/customRequest.js +18 -18
- package/es/Upload/hooks/propsMaker.js +13 -13
- package/es/Upload/index.js +19 -17
- package/es/Upload/util.js +8 -6
- package/es/config.js +2 -2
- package/es/hooks/index.js +25 -29
- package/lib/CheckboxGroup/CheckBox/index.js +1 -1
- package/lib/CheckboxGroup/hooks.js +19 -20
- package/lib/CheckboxGroup/index.js +17 -16
- package/lib/DialogForm/DrawerForm/index.js +14 -14
- package/lib/DialogForm/ModalForm.js +15 -15
- package/lib/DialogForm/hooks.js +16 -17
- package/lib/Form/Context/FormConfigProvider.js +15 -15
- package/lib/Form/FormItem/BasicItem.js +12 -12
- package/lib/Form/FormItem/RegularFormItem.js +11 -11
- package/lib/Form/FormItem/UpFormItem.js +12 -12
- package/lib/Form/FormItem/index.js +11 -11
- package/lib/Form/HFormConnect.js +15 -14
- package/lib/Form/hooks/index.js +19 -19
- package/lib/Form/hooks/useDefaultRender.js +12 -12
- package/lib/Form/hooks/useHForm.js +32 -32
- package/lib/Form/hooks/useInitConfigData.js +21 -21
- package/lib/Form/index.js +14 -14
- package/lib/Input/ButtonInput.js +16 -16
- package/lib/Input/ColorInput/index.js +34 -28
- package/lib/Input/InputNumber.js +12 -12
- package/lib/Input/SelectInput.js +17 -17
- package/lib/Input/index.js +14 -14
- package/lib/RadioGroup/index.js +16 -16
- package/lib/Select/components/AllSelect.js +3 -5
- package/lib/Select/defaultConfig.js +4 -4
- package/lib/Select/hooks/changeHooks.js +24 -24
- package/lib/Select/hooks/norHooks.js +10 -8
- package/lib/Select/index.js +15 -15
- package/lib/Select/utils.js +16 -16
- package/lib/Submit/index.js +12 -12
- package/lib/Switch/index.js +13 -13
- package/lib/TDPicker/RangePicker.js +21 -21
- package/lib/TDPicker/TimePicker.js +12 -12
- package/lib/TDPicker/hooks.js +11 -10
- package/lib/TDPicker/index.js +12 -12
- package/lib/TextArea/index.js +12 -12
- package/lib/Upload/MediaTypeEle/index.js +3 -3
- package/lib/Upload/UrlUpload/index.js +29 -23
- package/lib/Upload/hooks/change.js +17 -17
- package/lib/Upload/hooks/customRequest.js +18 -18
- package/lib/Upload/hooks/propsMaker.js +13 -13
- package/lib/Upload/index.js +19 -17
- package/lib/Upload/util.js +8 -6
- package/lib/config.js +2 -2
- package/lib/hooks/index.js +25 -29
- package/package.json +4 -3
- package/scripts/rollup.config.js +13 -0
- package/src/components/Form/hooks/index.ts +16 -12
package/es/Form/hooks/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import _defineProperty from '@babel/runtime
|
|
9
|
-
import _asyncToGenerator from '@babel/runtime
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import _regeneratorRuntime from '@babel/runtime
|
|
2
|
+
import 'core-js/modules/es6.symbol.js';
|
|
3
|
+
import 'core-js/modules/es6.array.filter.js';
|
|
4
|
+
import 'core-js/modules/es6.object.get-own-property-descriptor.js';
|
|
5
|
+
import 'core-js/modules/es7.object.get-own-property-descriptors.js';
|
|
6
|
+
import 'core-js/modules/es6.object.define-properties.js';
|
|
7
|
+
import 'core-js/modules/es6.object.define-property.js';
|
|
8
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
9
|
+
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
10
|
+
import 'core-js/modules/es6.object.keys.js';
|
|
11
|
+
import 'core-js/modules/es6.array.for-each.js';
|
|
12
|
+
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
13
13
|
import { useRequest } from 'ahooks';
|
|
14
14
|
import useHForm from './useHForm.js';
|
|
15
15
|
import { useMemo, useEffect } from 'react';
|
|
16
16
|
import componentConfig from '../config.js';
|
|
17
17
|
import { useFormConfigContext } from '../Context/FormConfigProvider.js';
|
|
18
18
|
|
|
19
|
-
function ownKeys(object, enumerableOnly) { var keys =
|
|
20
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
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
|
+
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 useCurrentForm = function useCurrentForm(form) {
|
|
22
22
|
var selfForm = useHForm();
|
|
23
23
|
return form || selfForm;
|
|
@@ -49,7 +49,7 @@ var useInfoReq = function useInfoReq(_ref) {
|
|
|
49
49
|
_context.next = 4;
|
|
50
50
|
return request(subVal, reqData.params);
|
|
51
51
|
case 4:
|
|
52
|
-
onFinish === null || onFinish === void 0
|
|
52
|
+
onFinish === null || onFinish === void 0 || onFinish(subVal, reqData.params);
|
|
53
53
|
case 5:
|
|
54
54
|
case "end":
|
|
55
55
|
return _context.stop();
|
|
@@ -87,7 +87,7 @@ var useInfoReq = function useInfoReq(_ref) {
|
|
|
87
87
|
case 8:
|
|
88
88
|
setValue = _context2.sent;
|
|
89
89
|
case 9:
|
|
90
|
-
form === null || form === void 0
|
|
90
|
+
form === null || form === void 0 || form.setFieldsValue(setValue);
|
|
91
91
|
return _context2.abrupt("return", setValue || {});
|
|
92
92
|
case 11:
|
|
93
93
|
case "end":
|
|
@@ -118,8 +118,8 @@ var dispatchControl = function dispatchControl(form, params, dispatch) {
|
|
|
118
118
|
if (!dispatch) {
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
|
-
var dispatchKey =
|
|
122
|
-
|
|
121
|
+
var dispatchKey = Object.keys(dispatch);
|
|
122
|
+
dispatchKey.forEach(function (name) {
|
|
123
123
|
var _dispatch$name = dispatch[name],
|
|
124
124
|
fnKey = _dispatch$name.fnKey,
|
|
125
125
|
reset = _dispatch$name.reset;
|
|
@@ -144,13 +144,13 @@ var useValuesChange = function useValuesChange(_ref4) {
|
|
|
144
144
|
dispatch = _ref4.dispatch,
|
|
145
145
|
form = _ref4.form;
|
|
146
146
|
return function (changedValues, values) {
|
|
147
|
-
var changeKey =
|
|
147
|
+
var changeKey = Object.keys(changedValues)[0];
|
|
148
148
|
var dispatchItem = dispatch[changeKey];
|
|
149
149
|
dispatchControl(form, {
|
|
150
150
|
changedValues: changedValues,
|
|
151
151
|
oldValues: values
|
|
152
152
|
}, dispatchItem);
|
|
153
|
-
onValuesChange === null || onValuesChange === void 0
|
|
153
|
+
onValuesChange === null || onValuesChange === void 0 || onValuesChange(changedValues, values);
|
|
154
154
|
};
|
|
155
155
|
};
|
|
156
156
|
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import _defineProperty from '@babel/runtime
|
|
11
|
-
import _objectWithoutProperties from '@babel/runtime
|
|
2
|
+
import 'core-js/modules/es6.object.keys.js';
|
|
3
|
+
import 'core-js/modules/es6.symbol.js';
|
|
4
|
+
import 'core-js/modules/es6.array.filter.js';
|
|
5
|
+
import 'core-js/modules/es6.object.get-own-property-descriptor.js';
|
|
6
|
+
import 'core-js/modules/es6.array.for-each.js';
|
|
7
|
+
import 'core-js/modules/es7.object.get-own-property-descriptors.js';
|
|
8
|
+
import 'core-js/modules/es6.object.define-properties.js';
|
|
9
|
+
import 'core-js/modules/es6.object.define-property.js';
|
|
10
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
11
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
12
12
|
import { jsx } from 'react/jsx-runtime';
|
|
13
13
|
import componentConfig from '../config.js';
|
|
14
14
|
import React from 'react';
|
|
15
15
|
|
|
16
16
|
var _excluded = ["render", "labelWidth", "colon", "type", "itemProps"];
|
|
17
|
-
function ownKeys(object, enumerableOnly) { var keys =
|
|
18
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
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; }
|
|
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; }
|
|
19
19
|
var useDefaultRender = function useDefaultRender(props, defaultComponents) {
|
|
20
20
|
var render = props.render;
|
|
21
21
|
props.labelWidth;
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import _toConsumableArray from '@babel/runtime
|
|
9
|
-
import _defineProperty from '@babel/runtime
|
|
10
|
-
import _slicedToArray from '@babel/runtime
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
2
|
+
import 'core-js/modules/es6.symbol.js';
|
|
3
|
+
import 'core-js/modules/es6.array.filter.js';
|
|
4
|
+
import 'core-js/modules/es6.object.get-own-property-descriptor.js';
|
|
5
|
+
import 'core-js/modules/es7.object.get-own-property-descriptors.js';
|
|
6
|
+
import 'core-js/modules/es6.object.define-properties.js';
|
|
7
|
+
import 'core-js/modules/es6.object.define-property.js';
|
|
8
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
9
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
10
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
11
|
+
import 'core-js/modules/es6.object.to-string.js';
|
|
12
|
+
import 'core-js/modules/es6.promise.js';
|
|
13
|
+
import 'core-js/modules/es6.object.keys.js';
|
|
14
|
+
import 'core-js/modules/es6.array.for-each.js';
|
|
15
|
+
import 'core-js/modules/es6.reflect.delete-property.js';
|
|
16
|
+
import 'core-js/modules/es6.function.name.js';
|
|
17
|
+
import 'core-js/modules/es6.array.map.js';
|
|
17
18
|
import { useMemo } from 'react';
|
|
18
19
|
import { Form } from 'antd';
|
|
19
20
|
|
|
20
|
-
function ownKeys(object, enumerableOnly) { var keys =
|
|
21
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
22
23
|
var useHForm = (function () {
|
|
23
24
|
var _Form$useForm = Form.useForm(),
|
|
24
25
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
@@ -46,7 +47,7 @@ var useHForm = (function () {
|
|
|
46
47
|
};
|
|
47
48
|
return _objectSpread(_objectSpread({
|
|
48
49
|
reload: function reload(params) {
|
|
49
|
-
return
|
|
50
|
+
return Promise.resolve(params);
|
|
50
51
|
},
|
|
51
52
|
initValues: function initValues() {
|
|
52
53
|
var newValue = {};
|
|
@@ -54,8 +55,8 @@ var useHForm = (function () {
|
|
|
54
55
|
newValue = this.formatValues(cacheValues);
|
|
55
56
|
form.setFieldsValue(newValue);
|
|
56
57
|
}
|
|
57
|
-
var initKeys =
|
|
58
|
-
|
|
58
|
+
var initKeys = Object.keys(initDispatch);
|
|
59
|
+
initKeys.forEach(function (key) {
|
|
59
60
|
initDispatch[key]({
|
|
60
61
|
changedValues: newValue,
|
|
61
62
|
oldValues: newValue
|
|
@@ -77,26 +78,25 @@ var useHForm = (function () {
|
|
|
77
78
|
formatValues: function formatValues() {
|
|
78
79
|
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
79
80
|
var formatKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "inputValue";
|
|
80
|
-
var valKeys =
|
|
81
|
+
var valKeys = Object.keys(value).length;
|
|
81
82
|
if (!valKeys) {
|
|
82
83
|
return {};
|
|
83
84
|
}
|
|
84
85
|
var newValue = _objectSpread({}, value);
|
|
85
|
-
var keys =
|
|
86
|
-
|
|
86
|
+
var keys = Object.keys(formatSourceData);
|
|
87
|
+
keys.forEach(function (key) {
|
|
87
88
|
var _formatSourceData$key;
|
|
88
89
|
var format = (_formatSourceData$key = formatSourceData[key]) === null || _formatSourceData$key === void 0 ? void 0 : _formatSourceData$key[formatKey];
|
|
89
90
|
if (!format) {
|
|
90
91
|
return;
|
|
91
92
|
}
|
|
92
93
|
var resultValue = format(value);
|
|
93
|
-
|
|
94
|
+
Reflect.deleteProperty(newValue, key);
|
|
94
95
|
newValue = _objectSpread(_objectSpread({}, newValue), resultValue);
|
|
95
96
|
});
|
|
96
97
|
return newValue;
|
|
97
98
|
},
|
|
98
99
|
dispatch: function dispatch(action) {
|
|
99
|
-
var _context2, _context3, _context4;
|
|
100
100
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
101
101
|
args[_key - 1] = arguments[_key];
|
|
102
102
|
}
|
|
@@ -109,13 +109,13 @@ var useHForm = (function () {
|
|
|
109
109
|
var keysFn = items.keysFn,
|
|
110
110
|
defaultFn = items.defaultFn;
|
|
111
111
|
if (name) {
|
|
112
|
-
var _keysFn$name
|
|
113
|
-
return (_keysFn$name = keysFn[name]) === null || _keysFn$name === void 0 ? void 0 : _keysFn$name.call.apply(_keysFn$name,
|
|
112
|
+
var _keysFn$name;
|
|
113
|
+
return (_keysFn$name = keysFn[name]) === null || _keysFn$name === void 0 ? void 0 : _keysFn$name.call.apply(_keysFn$name, [keysFn].concat(args));
|
|
114
114
|
}
|
|
115
|
-
var fnArrays =
|
|
115
|
+
var fnArrays = Object.keys(keysFn).map(function (itemKey) {
|
|
116
116
|
return keysFn[itemKey];
|
|
117
117
|
});
|
|
118
|
-
|
|
118
|
+
[].concat(_toConsumableArray(fnArrays), _toConsumableArray(defaultFn)).forEach(function (fn) {
|
|
119
119
|
fn.apply(void 0, args);
|
|
120
120
|
});
|
|
121
121
|
},
|
|
@@ -158,12 +158,12 @@ var useHForm = (function () {
|
|
|
158
158
|
}
|
|
159
159
|
if (name) {
|
|
160
160
|
var keysFn = items.keysFn;
|
|
161
|
-
|
|
161
|
+
Reflect.deleteProperty(keysFn, name);
|
|
162
162
|
items.keysFn = keysFn;
|
|
163
163
|
dispatchSourceData[key] = items;
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
|
-
|
|
166
|
+
Reflect.deleteProperty(dispatchSourceData, key);
|
|
167
167
|
},
|
|
168
168
|
outputValues: function outputValues(value) {
|
|
169
169
|
return this.formatValues(value, "outputValue");
|
|
@@ -179,7 +179,7 @@ var useHForm = (function () {
|
|
|
179
179
|
},
|
|
180
180
|
validateFields: function validateFields(nameList) {
|
|
181
181
|
var _this = this;
|
|
182
|
-
return new
|
|
182
|
+
return new Promise(function (resolve) {
|
|
183
183
|
form.validateFields(nameList).then(function (value) {
|
|
184
184
|
var result = _this.formatValues(value, "outputValue");
|
|
185
185
|
return resolve(result);
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import _objectWithoutProperties from '@babel/runtime
|
|
10
|
-
import _defineProperty from '@babel/runtime
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
2
|
+
import 'core-js/modules/es6.object.keys.js';
|
|
3
|
+
import 'core-js/modules/es6.symbol.js';
|
|
4
|
+
import 'core-js/modules/es6.array.filter.js';
|
|
5
|
+
import 'core-js/modules/es6.object.get-own-property-descriptor.js';
|
|
6
|
+
import 'core-js/modules/es7.object.get-own-property-descriptors.js';
|
|
7
|
+
import 'core-js/modules/es6.object.define-properties.js';
|
|
8
|
+
import 'core-js/modules/es6.object.define-property.js';
|
|
9
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
10
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
11
|
+
import 'core-js/modules/es6.array.map.js';
|
|
12
|
+
import 'core-js/modules/es6.array.index-of.js';
|
|
13
|
+
import 'core-js/modules/es6.function.name.js';
|
|
14
|
+
import 'core-js/modules/es6.array.is-array.js';
|
|
15
|
+
import 'core-js/modules/es6.array.for-each.js';
|
|
15
16
|
import { useMemo } from 'react';
|
|
16
17
|
import { placeholderConfig } from '../config.js';
|
|
17
18
|
import { useDefaultComponents } from './index.js';
|
|
18
19
|
|
|
19
20
|
var _excluded = ["render"];
|
|
20
|
-
function ownKeys(object, enumerableOnly) { var keys =
|
|
21
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
22
23
|
var mathRequired = function mathRequired(configItem, form, defaultComponents) {
|
|
23
24
|
var required = configItem.required,
|
|
24
25
|
placeholder = configItem.placeholder,
|
|
@@ -27,7 +28,7 @@ var mathRequired = function mathRequired(configItem, form, defaultComponents) {
|
|
|
27
28
|
type = _configItem$type === void 0 ? "input" : _configItem$type;
|
|
28
29
|
var resultRequired = false;
|
|
29
30
|
var dom = defaultComponents[type];
|
|
30
|
-
var resultRules = rules === null || rules === void 0 ? void 0 :
|
|
31
|
+
var resultRules = rules === null || rules === void 0 ? void 0 : rules.map(function (item) {
|
|
31
32
|
var eachItem = item;
|
|
32
33
|
if (typeof item === "function") {
|
|
33
34
|
eachItem = item(form);
|
|
@@ -57,7 +58,6 @@ var mathRequired = function mathRequired(configItem, form, defaultComponents) {
|
|
|
57
58
|
};
|
|
58
59
|
};
|
|
59
60
|
var matchDefaultPlaceholder = function matchDefaultPlaceholder(props, defaultComponents) {
|
|
60
|
-
var _context;
|
|
61
61
|
var label = props.label,
|
|
62
62
|
placeholder = props.placeholder,
|
|
63
63
|
_props$type = props.type,
|
|
@@ -70,7 +70,7 @@ var matchDefaultPlaceholder = function matchDefaultPlaceholder(props, defaultCom
|
|
|
70
70
|
if (itemDom !== null && itemDom !== void 0 && itemDom.placeholder) {
|
|
71
71
|
return itemDom.placeholder(props);
|
|
72
72
|
}
|
|
73
|
-
if (
|
|
73
|
+
if (placeholderConfig.inputType.indexOf(type) !== -1) {
|
|
74
74
|
return "\u8BF7\u8F93\u5165".concat(label);
|
|
75
75
|
}
|
|
76
76
|
return "\u8BF7\u9009\u62E9".concat(label);
|
|
@@ -128,9 +128,9 @@ var dispatchProvider = function dispatchProvider(item, dispatchSourceData) {
|
|
|
128
128
|
if (!fnKey) {
|
|
129
129
|
return {};
|
|
130
130
|
}
|
|
131
|
-
if (
|
|
131
|
+
if (Array.isArray(dispatchDependencies)) {
|
|
132
132
|
var allDispatch = _objectSpread({}, dispatchSourceData);
|
|
133
|
-
|
|
133
|
+
dispatchDependencies.forEach(function (key) {
|
|
134
134
|
var itemDispatch = itemDispatchProvider(name, {
|
|
135
135
|
dependencies: key,
|
|
136
136
|
fnKey: fnKey,
|
|
@@ -156,7 +156,7 @@ var useInitConfigData = (function (_ref3) {
|
|
|
156
156
|
return useMemo(function () {
|
|
157
157
|
var newConfigData = [];
|
|
158
158
|
var dispatchSourceData = {};
|
|
159
|
-
|
|
159
|
+
configData.forEach(function (item) {
|
|
160
160
|
var itemDispatch = dispatchProvider(item, dispatchSourceData);
|
|
161
161
|
dispatchSourceData = _objectSpread(_objectSpread({}, dispatchSourceData), itemDispatch);
|
|
162
162
|
newConfigData.push(itemControl(item, form, defaultComponents));
|
package/es/Form/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import _defineProperty from '@babel/runtime
|
|
11
|
-
import _objectWithoutProperties from '@babel/runtime
|
|
12
|
-
import
|
|
2
|
+
import 'core-js/modules/es6.object.keys.js';
|
|
3
|
+
import 'core-js/modules/es6.symbol.js';
|
|
4
|
+
import 'core-js/modules/es6.array.filter.js';
|
|
5
|
+
import 'core-js/modules/es6.object.get-own-property-descriptor.js';
|
|
6
|
+
import 'core-js/modules/es6.array.for-each.js';
|
|
7
|
+
import 'core-js/modules/es7.object.get-own-property-descriptors.js';
|
|
8
|
+
import 'core-js/modules/es6.object.define-properties.js';
|
|
9
|
+
import 'core-js/modules/es6.object.define-property.js';
|
|
10
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
11
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
12
|
+
import 'core-js/modules/es6.array.map.js';
|
|
13
13
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
14
14
|
import { useEffect, createElement } from 'react';
|
|
15
15
|
import { Form } from 'antd';
|
|
@@ -21,8 +21,8 @@ import useInitConfigData from './hooks/useInitConfigData.js';
|
|
|
21
21
|
import InitSet from './InitSet.js';
|
|
22
22
|
|
|
23
23
|
var _excluded = ["configData", "labelWidth", "form", "request", "onFinish", "infoRequest", "valueType", "initialValues", "params", "onValuesChange"];
|
|
24
|
-
function ownKeys(object, enumerableOnly) { var keys =
|
|
25
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
24
|
+
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; }
|
|
25
|
+
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; }
|
|
26
26
|
var HForm = (function (_ref) {
|
|
27
27
|
var configData = _ref.configData,
|
|
28
28
|
labelWidth = _ref.labelWidth,
|
|
@@ -87,7 +87,7 @@ var HForm = (function (_ref) {
|
|
|
87
87
|
onFinish: run,
|
|
88
88
|
onValuesChange: valuesChange
|
|
89
89
|
}, props), {}, {
|
|
90
|
-
children: [
|
|
90
|
+
children: [newConfigData.map(function (itemData, index) {
|
|
91
91
|
var itemLabelWidth = itemData.labelWidth;
|
|
92
92
|
return /*#__PURE__*/createElement(Item, _objectSpread(_objectSpread({}, itemData), {}, {
|
|
93
93
|
key: index,
|
package/es/Input/ButtonInput.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import _defineProperty from '@babel/runtime
|
|
11
|
-
import _asyncToGenerator from '@babel/runtime
|
|
12
|
-
import _objectWithoutProperties from '@babel/runtime
|
|
13
|
-
import _regeneratorRuntime from '@babel/runtime
|
|
2
|
+
import 'core-js/modules/es6.object.keys.js';
|
|
3
|
+
import 'core-js/modules/es6.symbol.js';
|
|
4
|
+
import 'core-js/modules/es6.array.filter.js';
|
|
5
|
+
import 'core-js/modules/es6.object.get-own-property-descriptor.js';
|
|
6
|
+
import 'core-js/modules/es6.array.for-each.js';
|
|
7
|
+
import 'core-js/modules/es7.object.get-own-property-descriptors.js';
|
|
8
|
+
import 'core-js/modules/es6.object.define-properties.js';
|
|
9
|
+
import 'core-js/modules/es6.object.define-property.js';
|
|
10
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
11
|
+
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
12
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
13
|
+
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
14
14
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
15
15
|
import { Input, Button } from 'antd';
|
|
16
16
|
import { useRequest } from 'ahooks';
|
|
17
17
|
|
|
18
18
|
var _excluded = ["buttonProps", "value", "onChange", "children", "request"],
|
|
19
19
|
_excluded2 = ["onClick", "type"];
|
|
20
|
-
function ownKeys(object, enumerableOnly) { var keys =
|
|
21
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
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; }
|
|
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; }
|
|
22
22
|
var Index = function Index(_ref) {
|
|
23
23
|
var _ref$buttonProps = _ref.buttonProps,
|
|
24
24
|
buttonProps = _ref$buttonProps === void 0 ? {} : _ref$buttonProps,
|
|
@@ -39,7 +39,7 @@ var Index = function Index(_ref) {
|
|
|
39
39
|
run = _useRequest.run,
|
|
40
40
|
loading = _useRequest.loading;
|
|
41
41
|
var change = function change(e) {
|
|
42
|
-
onChange === null || onChange === void 0
|
|
42
|
+
onChange === null || onChange === void 0 || onChange(e.target.value);
|
|
43
43
|
};
|
|
44
44
|
var click = /*#__PURE__*/function () {
|
|
45
45
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
@@ -57,7 +57,7 @@ var Index = function Index(_ref) {
|
|
|
57
57
|
case 4:
|
|
58
58
|
result = _context.sent;
|
|
59
59
|
case 5:
|
|
60
|
-
onClick === null || onClick === void 0
|
|
60
|
+
onClick === null || onClick === void 0 || onClick(result, onChange);
|
|
61
61
|
case 6:
|
|
62
62
|
case "end":
|
|
63
63
|
return _context.stop();
|
|
@@ -1,25 +1,32 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
2
|
+
import 'core-js/modules/es6.regexp.constructor.js';
|
|
3
|
+
import 'core-js/modules/es6.weak-map.js';
|
|
4
|
+
import 'core-js/modules/es6.string.iterator.js';
|
|
5
|
+
import 'core-js/modules/es6.object.to-string.js';
|
|
6
|
+
import 'core-js/modules/es6.array.iterator.js';
|
|
7
|
+
import 'core-js/modules/web.dom.iterable.js';
|
|
8
|
+
import 'core-js/modules/es6.array.reduce.js';
|
|
9
|
+
import 'core-js/modules/es6.object.keys.js';
|
|
10
|
+
import 'core-js/modules/es6.object.create.js';
|
|
11
|
+
import 'core-js/modules/es6.symbol.js';
|
|
12
|
+
import 'core-js/modules/es6.regexp.replace.js';
|
|
13
|
+
import 'core-js/modules/es6.array.is-array.js';
|
|
14
|
+
import 'core-js/modules/es6.array.slice.js';
|
|
15
|
+
import 'core-js/modules/es6.array.filter.js';
|
|
16
|
+
import 'core-js/modules/es6.object.get-own-property-descriptor.js';
|
|
17
|
+
import 'core-js/modules/es6.array.for-each.js';
|
|
18
|
+
import 'core-js/modules/es7.object.get-own-property-descriptors.js';
|
|
19
|
+
import 'core-js/modules/es6.object.define-properties.js';
|
|
20
|
+
import 'core-js/modules/es6.object.define-property.js';
|
|
21
|
+
import _typeof from '@babel/runtime/helpers/typeof';
|
|
22
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
23
|
+
import _inherits from '@babel/runtime/helpers/inherits';
|
|
24
|
+
import _setPrototypeOf from '@babel/runtime/helpers/setPrototypeOf';
|
|
25
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
26
|
+
import 'core-js/modules/es6.string.starts-with.js';
|
|
27
|
+
import 'core-js/modules/es6.regexp.match.js';
|
|
28
|
+
import 'core-js/modules/es6.regexp.split.js';
|
|
29
|
+
import 'core-js/modules/es6.number.constructor.js';
|
|
23
30
|
import { jsx } from 'react/jsx-runtime';
|
|
24
31
|
import { Input, Popover } from 'antd';
|
|
25
32
|
import Picker from './Picker.js';
|
|
@@ -27,9 +34,9 @@ import { useMemo } from 'react';
|
|
|
27
34
|
import { useClassName } from '../../hooks/index.js';
|
|
28
35
|
|
|
29
36
|
var _excluded = ["value", "onChange"];
|
|
30
|
-
function ownKeys(object, enumerableOnly) { var keys =
|
|
31
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
32
|
-
function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, void 0, groups); }; var _super = RegExp.prototype, _groups = new
|
|
37
|
+
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; }
|
|
38
|
+
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; }
|
|
39
|
+
function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, void 0, groups); }; var _super = RegExp.prototype, _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = new RegExp(re, flags); return _groups.set(_this, groups || _groups.get(re)), _setPrototypeOf(_this, BabelRegExp.prototype); } function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { var i = g[name]; if ("number" == typeof i) groups[name] = result[i];else { for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) k++; groups[name] = result[i[k]]; } return groups; }, Object.create(null)); } return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); if (result) { result.groups = buildGroups(result, this); var indices = result.indices; indices && (indices.groups = buildGroups(indices, this)); } return result; }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if ("string" == typeof substitution) { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { var group = groups[name]; return "$" + (Array.isArray(group) ? group.join("$") : group); })); } if ("function" == typeof substitution) { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = arguments; return "object" != _typeof(args[args.length - 1]) && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args); }); } return _super[Symbol.replace].call(this, str, substitution); }, _wrapRegExp.apply(this, arguments); }
|
|
33
40
|
var ColorInput = (function (_ref) {
|
|
34
41
|
var value = _ref.value,
|
|
35
42
|
onChange = _ref.onChange,
|
|
@@ -38,7 +45,7 @@ var ColorInput = (function (_ref) {
|
|
|
38
45
|
var pickerValue = useMemo(function () {
|
|
39
46
|
if (typeof value === "string") {
|
|
40
47
|
var _result$groups;
|
|
41
|
-
if (
|
|
48
|
+
if (value.startsWith("#")) {
|
|
42
49
|
return value;
|
|
43
50
|
}
|
|
44
51
|
var rgbaRegular = /*#__PURE__*/_wrapRegExp(/(?<=(rgba\())(.*?)(?=(\)))/, {
|
|
@@ -58,10 +65,9 @@ var ColorInput = (function (_ref) {
|
|
|
58
65
|
return "";
|
|
59
66
|
}, [value]);
|
|
60
67
|
var colorChange = function colorChange(val) {
|
|
61
|
-
var _context, _context2, _context3;
|
|
62
68
|
var rgb = val.rgb;
|
|
63
|
-
var text =
|
|
64
|
-
onChange === null || onChange === void 0
|
|
69
|
+
var text = "rgba(".concat(rgb.r, ",").concat(rgb.g, ",").concat(rgb.b, ",").concat(rgb.a, ")");
|
|
70
|
+
onChange === null || onChange === void 0 || onChange(text);
|
|
65
71
|
};
|
|
66
72
|
return jsx(Input, _objectSpread(_objectSpread({}, props), {}, {
|
|
67
73
|
value: value,
|
package/es/Input/InputNumber.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import _defineProperty from '@babel/runtime
|
|
11
|
-
import _objectWithoutProperties from '@babel/runtime
|
|
2
|
+
import 'core-js/modules/es6.object.keys.js';
|
|
3
|
+
import 'core-js/modules/es6.symbol.js';
|
|
4
|
+
import 'core-js/modules/es6.array.filter.js';
|
|
5
|
+
import 'core-js/modules/es6.object.get-own-property-descriptor.js';
|
|
6
|
+
import 'core-js/modules/es6.array.for-each.js';
|
|
7
|
+
import 'core-js/modules/es7.object.get-own-property-descriptors.js';
|
|
8
|
+
import 'core-js/modules/es6.object.define-properties.js';
|
|
9
|
+
import 'core-js/modules/es6.object.define-property.js';
|
|
10
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
11
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
12
12
|
import { jsx } from 'react/jsx-runtime';
|
|
13
13
|
import { InputNumber } from 'antd';
|
|
14
14
|
|
|
15
15
|
var _excluded = ["style"];
|
|
16
|
-
function ownKeys(object, enumerableOnly) { var keys =
|
|
17
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
16
|
+
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; }
|
|
17
|
+
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; }
|
|
18
18
|
var HInputNumber = (function (_ref) {
|
|
19
19
|
var _ref$style = _ref.style,
|
|
20
20
|
style = _ref$style === void 0 ? {
|