@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.
- package/es/CheckboxGroup/index.d.ts +1 -1
- package/es/CheckboxGroup/index.js +4 -2
- package/es/DialogForm/DrawerForm/Footer.d.ts +4 -0
- package/es/DialogForm/DrawerForm/Footer.js +23 -0
- package/es/DialogForm/DrawerForm/Title.d.ts +4 -0
- package/es/DialogForm/DrawerForm/Title.js +18 -0
- package/es/DialogForm/DrawerForm/index.d.ts +4 -0
- package/es/DialogForm/DrawerForm/index.js +111 -0
- package/es/DialogForm/ModalForm.d.ts +4 -0
- package/es/DialogForm/ModalForm.js +89 -0
- package/es/DialogForm/hooks.d.ts +14 -0
- package/es/DialogForm/hooks.js +124 -0
- package/es/DialogForm/modal.d.ts +25 -0
- package/es/Form/HFormConnect.d.ts +1 -2
- package/es/Form/HFormConnect.js +17 -16
- package/es/Form/InitSet.d.ts +1 -4
- package/es/Form/InitSet.js +2 -3
- package/es/Form/config.d.ts +5 -4
- package/es/Form/config.js +6 -4
- package/es/Form/hooks/index.d.ts +0 -6
- package/es/Form/hooks/index.js +1 -33
- package/es/Form/hooks/useHForm.js +72 -15
- package/es/Form/index.js +46 -15
- package/es/Form/modal.d.ts +20 -8
- package/es/Input/SelectInput.d.ts +2 -2
- package/es/Input/SelectInput.js +8 -5
- package/es/Input/modal.d.ts +2 -0
- package/es/Select/hooks/norHooks.d.ts +1 -1
- package/es/TDPicker/RangePicker.d.ts +1 -1
- package/es/TDPicker/RangePicker.js +4 -2
- package/es/TextArea/index.js +21 -0
- package/es/Upload/UrlUpload/index.d.ts +2 -2
- package/es/Upload/UrlUpload/index.js +3 -3
- package/es/Upload/hooks/customRequest.js +99 -36
- package/es/Upload/index.d.ts +1 -2
- package/es/Upload/index.js +39 -5
- package/es/Upload/modal.d.ts +2 -0
- package/es/config.js +4 -4
- package/es/index.css +1 -1
- package/es/index.d.ts +8 -4
- package/es/index.js +7 -1
- package/lib/CheckboxGroup/index.d.ts +1 -1
- package/lib/CheckboxGroup/index.js +4 -2
- package/lib/DialogForm/DrawerForm/Footer.d.ts +4 -0
- package/lib/DialogForm/DrawerForm/Footer.js +26 -0
- package/lib/DialogForm/DrawerForm/Title.d.ts +4 -0
- package/lib/DialogForm/DrawerForm/Title.js +21 -0
- package/lib/DialogForm/DrawerForm/index.d.ts +4 -0
- package/lib/DialogForm/DrawerForm/index.js +114 -0
- package/lib/DialogForm/ModalForm.d.ts +4 -0
- package/lib/DialogForm/ModalForm.js +92 -0
- package/lib/DialogForm/hooks.d.ts +14 -0
- package/lib/DialogForm/hooks.js +128 -0
- package/lib/DialogForm/modal.d.ts +25 -0
- package/lib/Form/HFormConnect.d.ts +1 -2
- package/lib/Form/HFormConnect.js +17 -16
- package/lib/Form/InitSet.d.ts +1 -4
- package/lib/Form/InitSet.js +2 -3
- package/lib/Form/config.d.ts +5 -4
- package/lib/Form/config.js +3 -1
- package/lib/Form/hooks/index.d.ts +0 -6
- package/lib/Form/hooks/index.js +0 -33
- package/lib/Form/hooks/useHForm.js +72 -15
- package/lib/Form/index.js +53 -22
- package/lib/Form/modal.d.ts +20 -8
- package/lib/Input/SelectInput.d.ts +2 -2
- package/lib/Input/SelectInput.js +8 -5
- package/lib/Input/modal.d.ts +2 -0
- package/lib/Select/hooks/norHooks.d.ts +1 -1
- package/lib/TDPicker/RangePicker.d.ts +1 -1
- package/lib/TDPicker/RangePicker.js +4 -2
- package/lib/TextArea/index.js +24 -0
- package/lib/Upload/UrlUpload/index.d.ts +2 -2
- package/lib/Upload/UrlUpload/index.js +3 -3
- package/lib/Upload/hooks/customRequest.js +99 -36
- package/lib/Upload/index.d.ts +1 -2
- package/lib/Upload/index.js +39 -5
- package/lib/Upload/modal.d.ts +2 -0
- package/lib/config.js +4 -4
- package/lib/index.css +1 -1
- package/lib/index.d.ts +8 -4
- package/lib/index.js +10 -0
- package/package.json +1 -1
- package/src/components/CheckboxGroup/index.tsx +2 -2
- package/src/components/DialogForm/DrawerForm/Footer.tsx +19 -0
- package/src/components/DialogForm/DrawerForm/Title.tsx +12 -0
- package/src/components/DialogForm/DrawerForm/index.tsx +85 -0
- package/src/components/DialogForm/ModalForm.tsx +60 -0
- package/src/components/DialogForm/hooks.ts +87 -0
- package/src/components/DialogForm/modal.ts +27 -0
- package/src/components/Form/FormItem/Helper.tsx +3 -4
- package/src/components/Form/HFormConnect.tsx +26 -8
- package/src/components/Form/InitSet.tsx +3 -5
- package/src/components/Form/config.ts +2 -1
- package/src/components/Form/hooks/index.ts +0 -20
- package/src/components/Form/hooks/useHForm.ts +67 -14
- package/src/components/Form/index.less +1 -1
- package/src/components/Form/index.tsx +25 -7
- package/src/components/Form/modal.ts +22 -10
- package/src/components/Input/SelectInput.tsx +4 -2
- package/src/components/Input/modal.ts +2 -0
- package/src/components/TDPicker/RangePicker.tsx +5 -6
- package/src/components/Upload/UrlUpload/index.tsx +2 -2
- package/src/components/Upload/hooks/customRequest.ts +57 -14
- package/src/components/Upload/index.tsx +39 -7
- package/src/components/Upload/modal.ts +2 -0
- package/src/components/config.ts +4 -4
- package/src/components/index.tsx +6 -0
- package/src/pages/DrawerForm/index.tsx +127 -0
- package/src/pages/Form/index.tsx +3 -0
- package/src/pages/ModalForm/index.tsx +127 -0
- package/src/routes.tsx +12 -0
|
@@ -1,14 +1,90 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
+
import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
|
|
3
|
+
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
|
|
4
|
+
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptor';
|
|
5
|
+
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptors';
|
|
6
|
+
import _Object$defineProperties from '@babel/runtime-corejs3/core-js/object/define-properties';
|
|
7
|
+
import _Object$defineProperty from '@babel/runtime-corejs3/core-js/object/define-property';
|
|
8
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
2
9
|
import _asyncToGenerator from '@babel/runtime-corejs3/helpers/asyncToGenerator';
|
|
3
|
-
import
|
|
10
|
+
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/filter';
|
|
4
11
|
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
|
|
5
12
|
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
|
|
13
|
+
import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
|
6
14
|
import { useMemo, useEffect } from 'react';
|
|
15
|
+
import { message } from 'antd';
|
|
7
16
|
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
17
|
+
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 _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
|
+
var subReq = /*#__PURE__*/function () {
|
|
20
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
21
|
+
var request, file, _yield$request, url;
|
|
22
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
23
|
+
while (1) switch (_context.prev = _context.next) {
|
|
24
|
+
case 0:
|
|
25
|
+
request = _ref.request, file = _ref.file;
|
|
26
|
+
if (request) {
|
|
27
|
+
_context.next = 3;
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
return _context.abrupt("return", {
|
|
31
|
+
url: "",
|
|
32
|
+
status: "done"
|
|
33
|
+
});
|
|
34
|
+
case 3:
|
|
35
|
+
_context.prev = 3;
|
|
36
|
+
_context.next = 6;
|
|
37
|
+
return request(file);
|
|
38
|
+
case 6:
|
|
39
|
+
_yield$request = _context.sent;
|
|
40
|
+
url = _yield$request.url;
|
|
41
|
+
return _context.abrupt("return", {
|
|
42
|
+
url: url,
|
|
43
|
+
status: "done"
|
|
44
|
+
});
|
|
45
|
+
case 11:
|
|
46
|
+
_context.prev = 11;
|
|
47
|
+
_context.t0 = _context["catch"](3);
|
|
48
|
+
message.error(_context.t0.message);
|
|
49
|
+
return _context.abrupt("return", {
|
|
50
|
+
url: "",
|
|
51
|
+
status: "error"
|
|
52
|
+
});
|
|
53
|
+
case 15:
|
|
54
|
+
case "end":
|
|
55
|
+
return _context.stop();
|
|
56
|
+
}
|
|
57
|
+
}, _callee, null, [[3, 11]]);
|
|
58
|
+
}));
|
|
59
|
+
return function subReq(_x) {
|
|
60
|
+
return _ref2.apply(this, arguments);
|
|
61
|
+
};
|
|
62
|
+
}();
|
|
63
|
+
var fileListProvider = function fileListProvider(changeFile, files) {
|
|
64
|
+
var status = changeFile.status,
|
|
65
|
+
url = changeFile.url,
|
|
66
|
+
uid = changeFile.uid;
|
|
67
|
+
if (status === "error") {
|
|
68
|
+
return files === null || files === void 0 ? void 0 : _filterInstanceProperty(files).call(files, function (item) {
|
|
69
|
+
return item.uid !== uid;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return files === null || files === void 0 ? void 0 : _mapInstanceProperty(files).call(files, function (item) {
|
|
73
|
+
var resultUrl = url || item.thumbUrl;
|
|
74
|
+
if (item.uid === uid) {
|
|
75
|
+
item.status = status;
|
|
76
|
+
item.response = {
|
|
77
|
+
url: resultUrl
|
|
78
|
+
};
|
|
79
|
+
return item;
|
|
80
|
+
}
|
|
81
|
+
return item;
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
var useCustomRequest = function useCustomRequest(_ref3) {
|
|
85
|
+
var value = _ref3.value,
|
|
86
|
+
request = _ref3.request,
|
|
87
|
+
onChange = _ref3.onChange;
|
|
12
88
|
var valObj = useMemo(function () {
|
|
13
89
|
return {
|
|
14
90
|
value: value
|
|
@@ -18,44 +94,31 @@ var useCustomRequest = function useCustomRequest(_ref) {
|
|
|
18
94
|
valObj.value = value;
|
|
19
95
|
}, [value]);
|
|
20
96
|
var sendFile = /*#__PURE__*/function () {
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
while (1) switch (_context.prev = _context.next) {
|
|
97
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(file) {
|
|
98
|
+
var uid, result, fileList;
|
|
99
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
100
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
26
101
|
case 0:
|
|
27
102
|
uid = file.uid;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
_context.next = 5;
|
|
34
|
-
return request(file);
|
|
35
|
-
case 5:
|
|
36
|
-
result = _context.sent;
|
|
37
|
-
url = result.url;
|
|
38
|
-
case 7:
|
|
39
|
-
fileList = valObj === null || valObj === void 0 ? void 0 : (_valObj$value = valObj.value) === null || _valObj$value === void 0 ? void 0 : _mapInstanceProperty(_valObj$value).call(_valObj$value, function (item) {
|
|
40
|
-
var resultUrl = url || item.thumbUrl;
|
|
41
|
-
if (item.uid === uid) {
|
|
42
|
-
item.status = "done";
|
|
43
|
-
item.response = {
|
|
44
|
-
url: resultUrl
|
|
45
|
-
};
|
|
46
|
-
return item;
|
|
47
|
-
}
|
|
48
|
-
return item;
|
|
103
|
+
_context2.next = 3;
|
|
104
|
+
return subReq({
|
|
105
|
+
request: request,
|
|
106
|
+
file: file
|
|
49
107
|
});
|
|
108
|
+
case 3:
|
|
109
|
+
result = _context2.sent;
|
|
110
|
+
fileList = fileListProvider(_objectSpread(_objectSpread({}, result), {}, {
|
|
111
|
+
uid: uid
|
|
112
|
+
}), valObj.value);
|
|
50
113
|
onChange === null || onChange === void 0 ? void 0 : onChange(fileList || []);
|
|
51
|
-
case
|
|
114
|
+
case 6:
|
|
52
115
|
case "end":
|
|
53
|
-
return
|
|
116
|
+
return _context2.stop();
|
|
54
117
|
}
|
|
55
|
-
},
|
|
118
|
+
}, _callee2);
|
|
56
119
|
}));
|
|
57
|
-
return function sendFile(
|
|
58
|
-
return
|
|
120
|
+
return function sendFile(_x2) {
|
|
121
|
+
return _ref4.apply(this, arguments);
|
|
59
122
|
};
|
|
60
123
|
}();
|
|
61
124
|
return function (fileList) {
|
package/es/Upload/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<IUpLoadProps & React.RefAttributes<IUploadRefModal>>;
|
|
2
|
+
declare const _default: React.ForwardRefExoticComponent<import("../Form/modal").HFormItemProps & React.RefAttributes<any>>;
|
|
4
3
|
export default _default;
|
package/es/Upload/index.js
CHANGED
|
@@ -11,14 +11,16 @@ import _extends from '@babel/runtime-corejs3/helpers/extends';
|
|
|
11
11
|
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
12
12
|
import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
13
13
|
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
14
|
-
import
|
|
15
|
-
import Btn from './Btn.js';
|
|
14
|
+
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
|
|
16
15
|
import React, { useState, useImperativeHandle, useMemo } from 'react';
|
|
16
|
+
import { useProps } from './hooks/propsMaker.js';
|
|
17
17
|
import Preview from './Preview/index.js';
|
|
18
18
|
import { useChange } from './hooks/change.js';
|
|
19
|
-
import {
|
|
19
|
+
import { Upload } from 'antd';
|
|
20
|
+
import Btn from './Btn.js';
|
|
21
|
+
import HFormConnect from '../Form/HFormConnect.js';
|
|
20
22
|
|
|
21
|
-
var _excluded = ["value", "onChange", "listType", "exFiles", "maxCount", "maxRowNum", "onPreview", "request", "maxSize"];
|
|
23
|
+
var _excluded = ["value", "onChange", "listType", "exFiles", "maxCount", "maxRowNum", "onPreview", "request", "maxSize", "addFormat"];
|
|
22
24
|
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
25
|
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; }
|
|
24
26
|
var Index = function Index(_ref, ref) {
|
|
@@ -35,6 +37,7 @@ var Index = function Index(_ref, ref) {
|
|
|
35
37
|
onPreview = _ref.onPreview,
|
|
36
38
|
request = _ref.request,
|
|
37
39
|
maxSize = _ref.maxSize,
|
|
40
|
+
addFormat = _ref.addFormat,
|
|
38
41
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
39
42
|
var matchProps = useProps({
|
|
40
43
|
request: request,
|
|
@@ -77,6 +80,37 @@ var Index = function Index(_ref, ref) {
|
|
|
77
80
|
var maxNum = maxCount === 1 ? maxCount : Number.MAX_VALUE;
|
|
78
81
|
var visible = previewModal.visible,
|
|
79
82
|
previewFile = previewModal.file;
|
|
83
|
+
addFormat === null || addFormat === void 0 ? void 0 : addFormat({
|
|
84
|
+
"float": {
|
|
85
|
+
inputValue: function inputValue(item, initValue) {
|
|
86
|
+
var _item$name = item.name,
|
|
87
|
+
name = _item$name === void 0 ? "" : _item$name;
|
|
88
|
+
var initFileList = initValue[name] || [];
|
|
89
|
+
var fileList = _mapInstanceProperty(initFileList).call(initFileList, function (url, index) {
|
|
90
|
+
return {
|
|
91
|
+
name: url,
|
|
92
|
+
response: {
|
|
93
|
+
url: url
|
|
94
|
+
},
|
|
95
|
+
status: "done",
|
|
96
|
+
uid: "init-".concat(index),
|
|
97
|
+
thumbUrl: url
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
return _defineProperty({}, name, fileList);
|
|
101
|
+
},
|
|
102
|
+
outputValue: function outputValue(item, _outputValue) {
|
|
103
|
+
var _item$name2 = item.name,
|
|
104
|
+
valueName = _item$name2 === void 0 ? "" : _item$name2;
|
|
105
|
+
var _outputValue$valueNam = _outputValue[valueName],
|
|
106
|
+
itemVal = _outputValue$valueNam === void 0 ? [] : _outputValue$valueNam;
|
|
107
|
+
var urls = _mapInstanceProperty(itemVal).call(itemVal, function (fileItem) {
|
|
108
|
+
return fileItem.response.url;
|
|
109
|
+
});
|
|
110
|
+
return _defineProperty({}, valueName, urls);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
80
114
|
return /*#__PURE__*/React.createElement("div", {
|
|
81
115
|
style: contentStyle
|
|
82
116
|
}, /*#__PURE__*/React.createElement(Upload, _extends({
|
|
@@ -100,7 +134,7 @@ var Index = function Index(_ref, ref) {
|
|
|
100
134
|
}
|
|
101
135
|
}));
|
|
102
136
|
};
|
|
103
|
-
var HUpload = /*#__PURE__*/React.forwardRef(Index);
|
|
137
|
+
var HUpload = HFormConnect( /*#__PURE__*/React.forwardRef(Index));
|
|
104
138
|
|
|
105
139
|
export { HUpload as default };
|
|
106
140
|
// powered by hdj
|
package/es/Upload/modal.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { UploadFile } from "antd/es/upload/interface";
|
|
|
3
3
|
import type { BeforeUploadFileType, RcFile } from "rc-upload/lib/interface";
|
|
4
4
|
import type { UploadChangeParam } from "antd/lib/upload/interface";
|
|
5
5
|
import type { MediaTypeEnum } from "@/components/Upload/enums";
|
|
6
|
+
import type { addFormatItemModal } from "@/components/Form/modal";
|
|
6
7
|
export interface IUpLoadProps extends Omit<UploadProps, "onChange"> {
|
|
7
8
|
exFiles?: string[];
|
|
8
9
|
request?: (file: Exclude<BeforeUploadFileType, File | boolean> | RcFile) => Promise<{
|
|
@@ -13,6 +14,7 @@ export interface IUpLoadProps extends Omit<UploadProps, "onChange"> {
|
|
|
13
14
|
value?: UploadFile[];
|
|
14
15
|
maxRowNum?: number;
|
|
15
16
|
maxSize?: number;
|
|
17
|
+
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
16
18
|
}
|
|
17
19
|
export interface IMediaTypeEleProps {
|
|
18
20
|
file?: UploadFile;
|
package/es/config.js
CHANGED
|
@@ -10,12 +10,12 @@ var baseConfig = {
|
|
|
10
10
|
value: "value"
|
|
11
11
|
},
|
|
12
12
|
valueCheckMap: {
|
|
13
|
-
checked:
|
|
14
|
-
noChecked:
|
|
13
|
+
checked: 1,
|
|
14
|
+
noChecked: 0
|
|
15
15
|
},
|
|
16
16
|
valueSwitchMap: {
|
|
17
|
-
open:
|
|
18
|
-
close:
|
|
17
|
+
open: 1,
|
|
18
|
+
close: 0
|
|
19
19
|
},
|
|
20
20
|
valueRangePickerValueMap: {
|
|
21
21
|
start: function start(name) {
|
package/es/index.css
CHANGED
package/es/index.d.ts
CHANGED
|
@@ -2,19 +2,23 @@
|
|
|
2
2
|
import "./styles/index.less";
|
|
3
3
|
export { default as HForm } from "./Form";
|
|
4
4
|
export { default as useHForm } from "./Form/hooks/useHForm";
|
|
5
|
+
export { useHDialogForm } from "./DialogForm/hooks";
|
|
5
6
|
export declare const HSelect: ({ style, mode, options, modeConfig, value, onChange, fieldNames: propsFieldNames, request, manual, optionLabelProp, filterProvider, optionFilterProp, serviceSearch, onSearch: propsOnSearch, filterOption, showSearch, labelInValue, noMatchItemRender, allSelect, ...props }: import("./Select/modal").HSelectProps) => JSX.Element;
|
|
6
7
|
export declare const HInput: ({ ...props }: import("antd").InputProps) => JSX.Element;
|
|
7
|
-
export declare const HSelectInput: (
|
|
8
|
-
export declare const HUpload: import("react").ForwardRefExoticComponent<import("./
|
|
8
|
+
export declare const HSelectInput: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
9
|
+
export declare const HUpload: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
9
10
|
export declare const HUrlUpload: ({ placeholder, value, onChange, mediaType, ...props }: import("./Upload/modal").IUrlUploadProps) => JSX.Element;
|
|
10
11
|
export declare const HButtonInput: import("react").FC<import("./Input/modal").HButtonInputProps>;
|
|
11
12
|
export declare const HCheckBox: import("react").FC<import("./CheckboxGroup/modal").HCheckboxProps>;
|
|
12
13
|
export declare const HSwitch: import("react").FC<import("./Switch").HSwitchProps>;
|
|
13
|
-
export declare const HCheckboxGroup:
|
|
14
|
+
export declare const HCheckboxGroup: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
14
15
|
export declare const HDatePicker: ({ value, onChange, showTime, format, ...props }: import("./TDPicker/modal").HDatePickerProps) => JSX.Element;
|
|
15
|
-
export declare const HRangePicker: (
|
|
16
|
+
export declare const HRangePicker: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
16
17
|
export declare const HRadioGroup: ({ value, options, onChange, fieldNames: propsFieldNames, ...props }: import("./RadioGroup").HRadioGroupProps) => JSX.Element;
|
|
17
18
|
export declare const HTimePicker: ({ value, format, onChange, ...props }: import("./TDPicker/modal").HTimePickerProps) => JSX.Element;
|
|
18
19
|
export declare const HInputNumber: ({ style, ...props }: import("antd").InputNumberProps<string | number>) => JSX.Element;
|
|
19
20
|
export declare const HPageHandler: import("react").FC<import("./PageHandler/modal").IHPageHandler<any>>;
|
|
20
21
|
export declare const HFormConfigProvider: import("react").FC<import("./Form/modal").IFormConfigContextProps>;
|
|
22
|
+
export declare const HTextArea: ({ autoSize, ...props }: import("antd/es/input").TextAreaProps) => JSX.Element;
|
|
23
|
+
export declare const HModalForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, ...props }: import("./DialogForm/modal").DialogFormProps) => JSX.Element;
|
|
24
|
+
export declare const HDrawerForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, ...props }: import("./DialogForm/modal").DialogFormProps) => JSX.Element;
|
package/es/index.js
CHANGED
|
@@ -3,6 +3,9 @@ import FormConfig from './Form/config.js';
|
|
|
3
3
|
import Index from './PageHandler/index.js';
|
|
4
4
|
export { default as HForm } from './Form/index.js';
|
|
5
5
|
export { default as useHForm } from './Form/hooks/useHForm.js';
|
|
6
|
+
export { useHDialogForm } from './DialogForm/hooks.js';
|
|
7
|
+
import ModalForm from './DialogForm/ModalForm.js';
|
|
8
|
+
import DrawerForm from './DialogForm/DrawerForm/index.js';
|
|
6
9
|
|
|
7
10
|
var HSelect = FormConfig.select;
|
|
8
11
|
var HInput = FormConfig.input;
|
|
@@ -20,6 +23,9 @@ var HTimePicker = FormConfig.timePicker;
|
|
|
20
23
|
var HInputNumber = FormConfig.inputNumber;
|
|
21
24
|
var HPageHandler = Index;
|
|
22
25
|
var HFormConfigProvider = FormConfig.formConfigProvider;
|
|
26
|
+
var HTextArea = FormConfig.textArea;
|
|
27
|
+
var HModalForm = ModalForm;
|
|
28
|
+
var HDrawerForm = DrawerForm;
|
|
23
29
|
|
|
24
|
-
export { HButtonInput, HCheckBox, HCheckboxGroup, HDatePicker, HFormConfigProvider, HInput, HInputNumber, HPageHandler, HRadioGroup, HRangePicker, HSelect, HSelectInput, HSwitch, HTimePicker, HUpload, HUrlUpload };
|
|
30
|
+
export { HButtonInput, HCheckBox, HCheckboxGroup, HDatePicker, HDrawerForm, HFormConfigProvider, HInput, HInputNumber, HModalForm, HPageHandler, HRadioGroup, HRangePicker, HSelect, HSelectInput, HSwitch, HTextArea, HTimePicker, HUpload, HUrlUpload };
|
|
25
31
|
// powered by hdj
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
declare const _default:
|
|
2
|
+
declare const _default: React.ForwardRefExoticComponent<import("../Form/modal").HFormItemProps & React.RefAttributes<any>>;
|
|
3
3
|
export default _default;
|
|
@@ -53,7 +53,8 @@ var Index = function Index(_ref) {
|
|
|
53
53
|
addFormat === null || addFormat === void 0 ? void 0 : addFormat({
|
|
54
54
|
"float": {
|
|
55
55
|
inputValue: function inputValue(item, initValue) {
|
|
56
|
-
var name = item.name
|
|
56
|
+
var _item$name = item.name,
|
|
57
|
+
name = _item$name === void 0 ? "" : _item$name;
|
|
57
58
|
var keys = checkOptions === null || checkOptions === void 0 ? void 0 : _mapInstanceProperty(checkOptions).call(checkOptions, function (optItem) {
|
|
58
59
|
return optItem.value;
|
|
59
60
|
});
|
|
@@ -64,7 +65,8 @@ var Index = function Index(_ref) {
|
|
|
64
65
|
return _defineProperty({}, name, resultObj);
|
|
65
66
|
},
|
|
66
67
|
outputValue: function outputValue(item, _outputValue) {
|
|
67
|
-
var
|
|
68
|
+
var _item$name2 = item.name,
|
|
69
|
+
name = _item$name2 === void 0 ? "" : _item$name2;
|
|
68
70
|
var _outputValue$name = _outputValue[name],
|
|
69
71
|
itemVal = _outputValue$name === void 0 ? {} : _outputValue$name;
|
|
70
72
|
return _objectSpread({}, itemVal);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var antd = require('antd');
|
|
7
|
+
|
|
8
|
+
var Footer = (function (_ref) {
|
|
9
|
+
var onCancel = _ref.onCancel,
|
|
10
|
+
onOk = _ref.onOk,
|
|
11
|
+
confirmLoading = _ref.confirmLoading;
|
|
12
|
+
return /*#__PURE__*/React.createElement(antd.Row, {
|
|
13
|
+
justify: "end"
|
|
14
|
+
}, /*#__PURE__*/React.createElement(antd.Space, {
|
|
15
|
+
size: "middle"
|
|
16
|
+
}, /*#__PURE__*/React.createElement(antd.Button, {
|
|
17
|
+
onClick: onCancel
|
|
18
|
+
}, "\u5173\u95ED"), /*#__PURE__*/React.createElement(antd.Button, {
|
|
19
|
+
type: "primary",
|
|
20
|
+
onClick: onOk,
|
|
21
|
+
loading: confirmLoading
|
|
22
|
+
}, "\u786E\u5B9A")));
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
exports.default = Footer;
|
|
26
|
+
// powered by h
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var antd = require('antd');
|
|
7
|
+
var icons = require('@ant-design/icons');
|
|
8
|
+
|
|
9
|
+
var Title = (function (_ref) {
|
|
10
|
+
var title = _ref.title,
|
|
11
|
+
closable = _ref.closable,
|
|
12
|
+
onCancel = _ref.onCancel;
|
|
13
|
+
return /*#__PURE__*/React.createElement(antd.Row, {
|
|
14
|
+
justify: "space-between"
|
|
15
|
+
}, /*#__PURE__*/React.createElement("div", null, title), closable && /*#__PURE__*/React.createElement(icons.CloseOutlined, {
|
|
16
|
+
onClick: onCancel
|
|
17
|
+
}));
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
exports.default = Title;
|
|
21
|
+
// powered by h
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { DialogFormProps } from "../modal";
|
|
3
|
+
declare const _default: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, ...props }: DialogFormProps) => JSX.Element;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var _extends = require('@babel/runtime-corejs3/helpers/extends');
|
|
7
|
+
var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
|
|
8
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
9
|
+
var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
10
|
+
var antd = require('antd');
|
|
11
|
+
var hooks = require('../hooks.js');
|
|
12
|
+
var index = require('../../Form/index.js');
|
|
13
|
+
var Title = require('./Title.js');
|
|
14
|
+
var Footer = require('./Footer.js');
|
|
15
|
+
|
|
16
|
+
var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "closable", "initialValues", "labelWidth", "onOk", "onFinish", "size", "form", "footer"];
|
|
17
|
+
var DrawerForm = (function (_ref) {
|
|
18
|
+
var visible = _ref.visible,
|
|
19
|
+
title = _ref.title,
|
|
20
|
+
onCancel = _ref.onCancel,
|
|
21
|
+
configData = _ref.configData,
|
|
22
|
+
infoRequest = _ref.infoRequest,
|
|
23
|
+
request = _ref.request;
|
|
24
|
+
_ref.afterClose;
|
|
25
|
+
var dialogForm = _ref.dialogForm,
|
|
26
|
+
_ref$closable = _ref.closable,
|
|
27
|
+
closable = _ref$closable === void 0 ? true : _ref$closable,
|
|
28
|
+
_ref$initialValues = _ref.initialValues,
|
|
29
|
+
initialValues = _ref$initialValues === void 0 ? {} : _ref$initialValues,
|
|
30
|
+
labelWidth = _ref.labelWidth;
|
|
31
|
+
_ref.onOk;
|
|
32
|
+
var onFinish = _ref.onFinish;
|
|
33
|
+
_ref.size;
|
|
34
|
+
_ref.form;
|
|
35
|
+
var footer = _ref.footer,
|
|
36
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
+
var currentForm = hooks.useCurrentForm(dialogForm);
|
|
38
|
+
var _useModifyProps = hooks.useModifyProps({
|
|
39
|
+
configData: configData,
|
|
40
|
+
visible: visible,
|
|
41
|
+
initialValues: initialValues,
|
|
42
|
+
dialogForm: currentForm
|
|
43
|
+
}),
|
|
44
|
+
modalVisible = _useModifyProps.modalVisible,
|
|
45
|
+
modalFormData = _useModifyProps.modalFormData,
|
|
46
|
+
setModalVisible = _useModifyProps.setModalVisible,
|
|
47
|
+
initValue = _useModifyProps.initValue,
|
|
48
|
+
onAfterClose = _useModifyProps.onAfterClose;
|
|
49
|
+
var cancel = function cancel(e) {
|
|
50
|
+
onAfterClose();
|
|
51
|
+
if (onCancel) {
|
|
52
|
+
return onCancel === null || onCancel === void 0 ? void 0 : onCancel(e);
|
|
53
|
+
}
|
|
54
|
+
setModalVisible(false);
|
|
55
|
+
};
|
|
56
|
+
var _useSub = hooks.useSub({
|
|
57
|
+
request: request,
|
|
58
|
+
onFinish: onFinish
|
|
59
|
+
}),
|
|
60
|
+
loading = _useSub.loading,
|
|
61
|
+
run = _useSub.run;
|
|
62
|
+
var footerComponent = function footerComponent() {
|
|
63
|
+
if (footer === null) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
return footer || /*#__PURE__*/React.createElement(Footer.default, {
|
|
67
|
+
onCancel: cancel,
|
|
68
|
+
onOk: currentForm.submit,
|
|
69
|
+
confirmLoading: loading
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
return /*#__PURE__*/React.createElement(antd.Drawer, _extends({
|
|
73
|
+
visible: modalVisible,
|
|
74
|
+
title: /*#__PURE__*/React.createElement(Title.default, {
|
|
75
|
+
title: title,
|
|
76
|
+
closable: closable,
|
|
77
|
+
onCancel: cancel
|
|
78
|
+
})
|
|
79
|
+
}, props, {
|
|
80
|
+
onClose: cancel,
|
|
81
|
+
closable: false,
|
|
82
|
+
destroyOnClose: true,
|
|
83
|
+
footer: footerComponent()
|
|
84
|
+
}), /*#__PURE__*/React.createElement(index.default, _extends({
|
|
85
|
+
configData: modalFormData,
|
|
86
|
+
initialValues: initValue
|
|
87
|
+
}, props, {
|
|
88
|
+
form: currentForm,
|
|
89
|
+
onFinish: /*#__PURE__*/function () {
|
|
90
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values) {
|
|
91
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
92
|
+
while (1) switch (_context.prev = _context.next) {
|
|
93
|
+
case 0:
|
|
94
|
+
_context.next = 2;
|
|
95
|
+
return run(values);
|
|
96
|
+
case 2:
|
|
97
|
+
setModalVisible(false);
|
|
98
|
+
case 3:
|
|
99
|
+
case "end":
|
|
100
|
+
return _context.stop();
|
|
101
|
+
}
|
|
102
|
+
}, _callee);
|
|
103
|
+
}));
|
|
104
|
+
return function (_x) {
|
|
105
|
+
return _ref2.apply(this, arguments);
|
|
106
|
+
};
|
|
107
|
+
}(),
|
|
108
|
+
infoRequest: infoRequest,
|
|
109
|
+
labelWidth: labelWidth
|
|
110
|
+
})));
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
exports.default = DrawerForm;
|
|
114
|
+
// powered by h
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { DialogFormProps } from "./modal";
|
|
3
|
+
declare const _default: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, ...props }: DialogFormProps) => JSX.Element;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var _extends = require('@babel/runtime-corejs3/helpers/extends');
|
|
7
|
+
var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
|
|
8
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
9
|
+
var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
10
|
+
var antd = require('antd');
|
|
11
|
+
var index = require('../Form/index.js');
|
|
12
|
+
var hooks = require('./hooks.js');
|
|
13
|
+
|
|
14
|
+
var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "initialValues", "onFinish"];
|
|
15
|
+
var ModalForm = (function (_ref) {
|
|
16
|
+
var visible = _ref.visible,
|
|
17
|
+
title = _ref.title,
|
|
18
|
+
onCancel = _ref.onCancel,
|
|
19
|
+
configData = _ref.configData,
|
|
20
|
+
infoRequest = _ref.infoRequest,
|
|
21
|
+
request = _ref.request,
|
|
22
|
+
_afterClose = _ref.afterClose,
|
|
23
|
+
dialogForm = _ref.dialogForm,
|
|
24
|
+
_ref$initialValues = _ref.initialValues,
|
|
25
|
+
initialValues = _ref$initialValues === void 0 ? {} : _ref$initialValues,
|
|
26
|
+
onFinish = _ref.onFinish,
|
|
27
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
+
var currentForm = hooks.useCurrentForm(dialogForm);
|
|
29
|
+
var _useModifyProps = hooks.useModifyProps({
|
|
30
|
+
configData: configData,
|
|
31
|
+
visible: visible,
|
|
32
|
+
initialValues: initialValues,
|
|
33
|
+
dialogForm: currentForm
|
|
34
|
+
}),
|
|
35
|
+
modalVisible = _useModifyProps.modalVisible,
|
|
36
|
+
modalFormData = _useModifyProps.modalFormData,
|
|
37
|
+
setModalVisible = _useModifyProps.setModalVisible,
|
|
38
|
+
initValue = _useModifyProps.initValue;
|
|
39
|
+
var cancel = function cancel(e) {
|
|
40
|
+
if (onCancel) {
|
|
41
|
+
return onCancel === null || onCancel === void 0 ? void 0 : onCancel(e);
|
|
42
|
+
}
|
|
43
|
+
setModalVisible(false);
|
|
44
|
+
};
|
|
45
|
+
var _useSub = hooks.useSub({
|
|
46
|
+
request: request,
|
|
47
|
+
onFinish: onFinish
|
|
48
|
+
}),
|
|
49
|
+
loading = _useSub.loading,
|
|
50
|
+
run = _useSub.run;
|
|
51
|
+
return /*#__PURE__*/React.createElement(antd.Modal, _extends({
|
|
52
|
+
title: title,
|
|
53
|
+
visible: modalVisible,
|
|
54
|
+
onCancel: cancel,
|
|
55
|
+
confirmLoading: loading,
|
|
56
|
+
afterClose: function afterClose() {
|
|
57
|
+
currentForm.resetFields();
|
|
58
|
+
_afterClose === null || _afterClose === void 0 ? void 0 : _afterClose();
|
|
59
|
+
}
|
|
60
|
+
}, props, {
|
|
61
|
+
onOk: currentForm.submit,
|
|
62
|
+
destroyOnClose: true
|
|
63
|
+
}), /*#__PURE__*/React.createElement(index.default, _extends({
|
|
64
|
+
configData: modalFormData,
|
|
65
|
+
initialValues: initValue,
|
|
66
|
+
onFinish: /*#__PURE__*/function () {
|
|
67
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values) {
|
|
68
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
69
|
+
while (1) switch (_context.prev = _context.next) {
|
|
70
|
+
case 0:
|
|
71
|
+
_context.next = 2;
|
|
72
|
+
return run(values);
|
|
73
|
+
case 2:
|
|
74
|
+
setModalVisible(false);
|
|
75
|
+
case 3:
|
|
76
|
+
case "end":
|
|
77
|
+
return _context.stop();
|
|
78
|
+
}
|
|
79
|
+
}, _callee);
|
|
80
|
+
}));
|
|
81
|
+
return function (_x) {
|
|
82
|
+
return _ref2.apply(this, arguments);
|
|
83
|
+
};
|
|
84
|
+
}()
|
|
85
|
+
}, props, {
|
|
86
|
+
form: currentForm,
|
|
87
|
+
infoRequest: infoRequest
|
|
88
|
+
})));
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
exports.default = ModalForm;
|
|
92
|
+
// powered by h
|