@hw-component/form 0.0.8-beta-v7 → 0.0.8-beta-v9
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/modal.d.ts +1 -0
- package/es/DialogForm/modal.d.ts +1 -1
- package/es/Form/config.d.ts +7 -5
- package/es/Form/config.js +11 -7
- package/es/Input/TrimInput.d.ts +3 -0
- package/es/Input/TrimInput.js +43 -0
- package/es/Input/VerificationCodeInput.d.ts +3 -3
- package/es/Input/VerificationCodeInput.js +2 -2
- package/es/Input/modal.d.ts +2 -0
- package/es/Submit/components.d.ts +6 -0
- package/es/Submit/components.js +70 -0
- package/es/Submit/hooks.d.ts +5 -0
- package/es/Submit/hooks.js +28 -0
- package/es/Submit/index.d.ts +4 -1
- package/es/Submit/index.js +24 -28
- package/es/Switch/index.d.ts +4 -2
- package/es/Switch/index.js +28 -4
- package/es/TextArea/TrimTextArea.d.ts +3 -0
- package/es/TextArea/TrimTextArea.js +43 -0
- package/es/index.d.ts +8 -6
- package/es/index.js +3 -1
- package/lib/CheckboxGroup/modal.d.ts +1 -0
- package/lib/DialogForm/modal.d.ts +1 -1
- package/lib/Form/config.d.ts +7 -5
- package/lib/Form/config.js +6 -2
- package/lib/Input/TrimInput.d.ts +3 -0
- package/lib/Input/TrimInput.js +46 -0
- package/lib/Input/VerificationCodeInput.d.ts +3 -3
- package/lib/Input/VerificationCodeInput.js +2 -2
- package/lib/Input/modal.d.ts +2 -0
- package/lib/Submit/components.d.ts +6 -0
- package/lib/Submit/components.js +71 -0
- package/lib/Submit/hooks.d.ts +5 -0
- package/lib/Submit/hooks.js +29 -0
- package/lib/Submit/index.d.ts +4 -1
- package/lib/Submit/index.js +22 -26
- package/lib/Switch/index.d.ts +4 -2
- package/lib/Switch/index.js +28 -4
- package/lib/TextArea/TrimTextArea.d.ts +3 -0
- package/lib/TextArea/TrimTextArea.js +46 -0
- package/lib/index.d.ts +8 -6
- package/lib/index.js +4 -0
- package/package.json +1 -1
- package/src/components/CheckboxGroup/modal.ts +1 -0
- package/src/components/DialogForm/DrawerForm/index.tsx +5 -3
- package/src/components/DialogForm/ModalForm.tsx +5 -3
- package/src/components/DialogForm/modal.ts +5 -2
- package/src/components/Form/config.ts +8 -3
- package/src/components/Input/TrimInput.tsx +26 -0
- package/src/components/Input/VerificationCodeInput.tsx +4 -4
- package/src/components/Input/modal.ts +2 -0
- package/src/components/Submit/components.tsx +57 -0
- package/src/components/Submit/hooks.ts +31 -0
- package/src/components/Submit/index.tsx +12 -25
- package/src/components/Switch/index.tsx +27 -1
- package/src/components/TextArea/TrimTextArea.tsx +30 -0
- package/src/components/index.tsx +5 -0
- package/src/pages/Form/index.tsx +70 -0
- package/src/pages/ModalForm/index.tsx +7 -5
|
@@ -10,4 +10,5 @@ export interface HCheckboxProps extends Omit<CheckboxProps, "value" | "onChange"
|
|
|
10
10
|
value?: Record<string, any> | any[];
|
|
11
11
|
onChange?: (value: Record<string, any> | any[]) => void;
|
|
12
12
|
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
13
|
+
subParams?: (formatValue: Record<string, any>, sourceValue: any[]) => any;
|
|
13
14
|
}
|
package/es/DialogForm/modal.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ModalProps } from "antd";
|
|
2
2
|
import type { HFormInstance, HItemProps, HFormProps } from "../Form/modal";
|
|
3
3
|
import type { PromiseFnResult } from "../modal";
|
|
4
|
-
import React from "react";
|
|
4
|
+
import type React from "react";
|
|
5
5
|
type RootProps = HFormProps & ModalProps;
|
|
6
6
|
export interface ModifyPropsModal<P = any> {
|
|
7
7
|
configData: HItemProps[];
|
package/es/Form/config.d.ts
CHANGED
|
@@ -11,21 +11,23 @@ declare const componentConfig: {
|
|
|
11
11
|
checkboxGroup: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
12
12
|
checkBox: import("react").FC<import("../CheckboxGroup/modal").HCheckboxProps>;
|
|
13
13
|
radioGroup: ({ value, options, onChange, fieldNames: propsFieldNames, ...props }: import("../RadioGroup").HRadioGroupProps) => JSX.Element;
|
|
14
|
-
switch: import("react").
|
|
15
|
-
datePicker: import("react").
|
|
14
|
+
switch: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
15
|
+
datePicker: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
16
16
|
rangePicker: {
|
|
17
17
|
Component: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
18
18
|
placeholder: ({ label }: import("./modal").HItemProps) => string[];
|
|
19
19
|
requiredErrMsg: ({ label }: import("./modal").HItemProps) => string;
|
|
20
20
|
};
|
|
21
|
-
timePicker: (
|
|
21
|
+
timePicker: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
22
22
|
input: ({ copy, value, addonAfter, ...props }: import("../Input/modal").HInputProps<any>) => JSX.Element;
|
|
23
23
|
upload: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
24
24
|
urlUpload: ({ placeholder, value, onChange, mediaType, ...props }: import("../Upload/modal").IUrlUploadProps) => JSX.Element;
|
|
25
|
-
submit: ({
|
|
25
|
+
submit: ({ position, reset, extraList, ...props }: import("../Submit").ISubmitProps) => JSX.Element;
|
|
26
26
|
textArea: ({ autoSize, ...props }: import("antd/es/input").TextAreaProps) => JSX.Element;
|
|
27
27
|
colorInput: ({ value, onChange, defaultColor, ...props }: import("../Input/modal").HInputProps<any>) => JSX.Element;
|
|
28
28
|
cascader: ({ request, options, fieldNames: propsFieldNames, ...props }: import("../Cascader").HCascaderProps) => JSX.Element;
|
|
29
|
-
verificationCodeInput: () => JSX.Element;
|
|
29
|
+
verificationCodeInput: ({ value, request, form, onChange, ...props }: import("../Input/VerificationCodeInput").HVerificationCodeInputProps) => JSX.Element;
|
|
30
|
+
trimInput: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
31
|
+
trimTextArea: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
30
32
|
};
|
|
31
33
|
export default componentConfig;
|
package/es/Form/config.js
CHANGED
|
@@ -7,20 +7,22 @@ import Index from '../Input/ButtonInput.js';
|
|
|
7
7
|
import HCheckboxGroup from '../CheckboxGroup/index.js';
|
|
8
8
|
import Index$1 from '../CheckboxGroup/CheckBox/index.js';
|
|
9
9
|
import HRadioGroup from '../RadioGroup/index.js';
|
|
10
|
-
import
|
|
10
|
+
import HSwitch from '../Switch/index.js';
|
|
11
11
|
import HDatePicker from '../TDPicker/index.js';
|
|
12
12
|
import HRangePicker from '../TDPicker/RangePicker.js';
|
|
13
13
|
import HTimePicker from '../TDPicker/TimePicker.js';
|
|
14
14
|
import HUpload from '../Upload/index.js';
|
|
15
|
-
import Index$
|
|
15
|
+
import Index$2 from '../Upload/UrlUpload/index.js';
|
|
16
16
|
import HSubmit from '../Submit/index.js';
|
|
17
17
|
import TextArea from '../TextArea/index.js';
|
|
18
18
|
import ColorInput from '../Input/ColorInput/index.js';
|
|
19
19
|
import Cascader from '../Cascader/index.js';
|
|
20
|
-
import
|
|
20
|
+
import VerificationCodeInput from '../Input/VerificationCodeInput.js';
|
|
21
|
+
import TrimInput from '../Input/TrimInput.js';
|
|
22
|
+
import TrimTextArea from '../TextArea/TrimTextArea.js';
|
|
21
23
|
|
|
22
24
|
var placeholderConfig = {
|
|
23
|
-
inputType: ["input", "inputNumber", "selectInput", "buttonInput", "verificationCodeInput"],
|
|
25
|
+
inputType: ["input", "inputNumber", "selectInput", "buttonInput", "verificationCodeInput", "trimInput", ""],
|
|
24
26
|
selectType: ["select", "datePicker", "timePicker", "colorInput"]
|
|
25
27
|
};
|
|
26
28
|
var componentConfig = {
|
|
@@ -31,18 +33,20 @@ var componentConfig = {
|
|
|
31
33
|
checkboxGroup: HCheckboxGroup,
|
|
32
34
|
checkBox: Index$1,
|
|
33
35
|
radioGroup: HRadioGroup,
|
|
34
|
-
switch:
|
|
36
|
+
switch: HSwitch,
|
|
35
37
|
datePicker: HDatePicker,
|
|
36
38
|
rangePicker: HRangePicker,
|
|
37
39
|
timePicker: HTimePicker,
|
|
38
40
|
input: HInput,
|
|
39
41
|
upload: HUpload,
|
|
40
|
-
urlUpload: Index$
|
|
42
|
+
urlUpload: Index$2,
|
|
41
43
|
submit: HSubmit,
|
|
42
44
|
textArea: TextArea,
|
|
43
45
|
colorInput: ColorInput,
|
|
44
46
|
cascader: Cascader,
|
|
45
|
-
verificationCodeInput:
|
|
47
|
+
verificationCodeInput: VerificationCodeInput,
|
|
48
|
+
trimInput: TrimInput,
|
|
49
|
+
trimTextArea: TrimTextArea
|
|
46
50
|
};
|
|
47
51
|
|
|
48
52
|
export { componentConfig as default, placeholderConfig };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
4
|
+
import 'core-js/modules/es.function.name.js';
|
|
5
|
+
import 'core-js/modules/es.string.trim.js';
|
|
6
|
+
import 'core-js/modules/es.object.keys.js';
|
|
7
|
+
import 'core-js/modules/es.symbol.js';
|
|
8
|
+
import 'core-js/modules/es.array.filter.js';
|
|
9
|
+
import 'core-js/modules/es.object.to-string.js';
|
|
10
|
+
import 'core-js/modules/es.object.get-own-property-descriptor.js';
|
|
11
|
+
import 'core-js/modules/web.dom-collections.for-each.js';
|
|
12
|
+
import 'core-js/modules/es.object.get-own-property-descriptors.js';
|
|
13
|
+
import { jsx } from 'react/jsx-runtime';
|
|
14
|
+
import HInput from './index.js';
|
|
15
|
+
import HFormConnect from '../Form/HFormConnect.js';
|
|
16
|
+
|
|
17
|
+
var _excluded = ["addFormat"];
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
var Index = function Index(_ref) {
|
|
21
|
+
var addFormat = _ref.addFormat,
|
|
22
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
|
+
addFormat === null || addFormat === void 0 || addFormat({
|
|
24
|
+
float: {
|
|
25
|
+
inputValue: function inputValue(item, initValue) {
|
|
26
|
+
var _item$name = item.name,
|
|
27
|
+
valueName = _item$name === void 0 ? "" : _item$name;
|
|
28
|
+
return _defineProperty({}, valueName, initValue[valueName]);
|
|
29
|
+
},
|
|
30
|
+
outputValue: function outputValue(item, _outputValue) {
|
|
31
|
+
var _item$name2 = item.name,
|
|
32
|
+
name = _item$name2 === void 0 ? "" : _item$name2;
|
|
33
|
+
var itemVal = _outputValue[name];
|
|
34
|
+
return _defineProperty({}, name, itemVal === null || itemVal === void 0 ? void 0 : itemVal.trim());
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return jsx(HInput, _objectSpread({}, props));
|
|
39
|
+
};
|
|
40
|
+
var TrimInput = HFormConnect(Index);
|
|
41
|
+
|
|
42
|
+
export { TrimInput as default };
|
|
43
|
+
// powered by hdj
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { HFormInstance } from "
|
|
1
|
+
import type { HFormInstance } from "../Form/modal";
|
|
2
2
|
import type { InputProps } from "antd";
|
|
3
|
-
interface
|
|
3
|
+
export interface HVerificationCodeInputProps extends Omit<InputProps, "form"> {
|
|
4
4
|
request?: (value: any) => Promise<any>;
|
|
5
5
|
form?: HFormInstance;
|
|
6
6
|
}
|
|
7
|
-
declare const _default: ({ value, request, form, onChange, ...props }:
|
|
7
|
+
declare const _default: ({ value, request, form, onChange, ...props }: HVerificationCodeInputProps) => JSX.Element;
|
|
8
8
|
export default _default;
|
|
@@ -20,7 +20,7 @@ import { useRequest } from 'ahooks';
|
|
|
20
20
|
var _excluded = ["value", "request", "form", "onChange"];
|
|
21
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
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; }
|
|
23
|
-
var
|
|
23
|
+
var VerificationCodeInput = (function (_ref) {
|
|
24
24
|
var value = _ref.value,
|
|
25
25
|
request = _ref.request,
|
|
26
26
|
form = _ref.form,
|
|
@@ -106,5 +106,5 @@ var HVerificationCodeInput = (function (_ref) {
|
|
|
106
106
|
}));
|
|
107
107
|
});
|
|
108
108
|
|
|
109
|
-
export {
|
|
109
|
+
export { VerificationCodeInput as default };
|
|
110
110
|
// powered by hdj
|
package/es/Input/modal.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export interface HInputProps<V = any> extends Omit<InputProps, "onChange" | "val
|
|
|
9
9
|
value?: V;
|
|
10
10
|
defaultColor?: string;
|
|
11
11
|
copy?: boolean;
|
|
12
|
+
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
12
13
|
}
|
|
13
14
|
interface ValueNameModal {
|
|
14
15
|
input?: string;
|
|
@@ -21,6 +22,7 @@ export interface HSelectInputProps extends Omit<HInputProps, "value" | "onChange
|
|
|
21
22
|
valueName?: ValueNameModal;
|
|
22
23
|
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
23
24
|
addDispatchListener?: AddDispatchListenerFn;
|
|
25
|
+
subParams?: (formatValue: Record<string, any>) => any;
|
|
24
26
|
}
|
|
25
27
|
export interface HButtonProps extends Omit<ButtonProps, "onClick"> {
|
|
26
28
|
onClick: (value: string | readonly string[] | number | undefined, onChange?: (val: any) => void) => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ISubmitProps, SubmitBarExtraType } from "@/components/Submit/index";
|
|
2
|
+
interface ControlFooterProps extends ISubmitProps {
|
|
3
|
+
action: SubmitBarExtraType;
|
|
4
|
+
}
|
|
5
|
+
export declare const ControlFooter: ({ action, ...props }: ControlFooterProps) => JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import 'core-js/modules/es.object.keys.js';
|
|
3
|
+
import 'core-js/modules/es.symbol.js';
|
|
4
|
+
import 'core-js/modules/es.array.filter.js';
|
|
5
|
+
import 'core-js/modules/es.object.to-string.js';
|
|
6
|
+
import 'core-js/modules/es.object.get-own-property-descriptor.js';
|
|
7
|
+
import 'core-js/modules/web.dom-collections.for-each.js';
|
|
8
|
+
import 'core-js/modules/es.object.get-own-property-descriptors.js';
|
|
9
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
10
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
11
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
12
|
+
import { Button } from 'antd';
|
|
13
|
+
import { useFormContext } from '../Form/Context/index.js';
|
|
14
|
+
import React from 'react';
|
|
15
|
+
|
|
16
|
+
var _excluded = ["form"],
|
|
17
|
+
_excluded2 = ["type", "form", "text", "loading"],
|
|
18
|
+
_excluded3 = ["action"];
|
|
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
|
+
function ResetBtn(_ref) {
|
|
22
|
+
var form = _ref.form,
|
|
23
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
24
|
+
return jsx(Button, _objectSpread(_objectSpread({}, props), {}, {
|
|
25
|
+
onClick: function onClick() {
|
|
26
|
+
form.resetFields();
|
|
27
|
+
},
|
|
28
|
+
children: "\u91CD\u7F6E"
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
function SubBtn(_ref2) {
|
|
32
|
+
var _ref2$type = _ref2.type,
|
|
33
|
+
type = _ref2$type === void 0 ? "primary" : _ref2$type,
|
|
34
|
+
form = _ref2.form,
|
|
35
|
+
_ref2$text = _ref2.text,
|
|
36
|
+
text = _ref2$text === void 0 ? "提交" : _ref2$text,
|
|
37
|
+
loading = _ref2.loading,
|
|
38
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
39
|
+
var _useFormContext = useFormContext(),
|
|
40
|
+
_useFormContext$loadi = _useFormContext.loading,
|
|
41
|
+
formSubLoading = _useFormContext$loadi === void 0 ? loading : _useFormContext$loadi;
|
|
42
|
+
return jsx(Button, _objectSpread(_objectSpread({}, props), {}, {
|
|
43
|
+
type: type,
|
|
44
|
+
onClick: form.submit,
|
|
45
|
+
loading: formSubLoading,
|
|
46
|
+
children: text
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
var ControlFooter = function ControlFooter(_ref3) {
|
|
50
|
+
var action = _ref3.action,
|
|
51
|
+
props = _objectWithoutProperties(_ref3, _excluded3);
|
|
52
|
+
var form = props.form;
|
|
53
|
+
if (action === "reset") {
|
|
54
|
+
return jsx(ResetBtn, _objectSpread({}, props));
|
|
55
|
+
}
|
|
56
|
+
if (action === "submit") {
|
|
57
|
+
return jsx(SubBtn, _objectSpread({}, props));
|
|
58
|
+
}
|
|
59
|
+
if (typeof action === "string") {
|
|
60
|
+
return jsx(Fragment, {
|
|
61
|
+
children: action
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return /*#__PURE__*/React.cloneElement(action, {
|
|
65
|
+
form: form
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export { ControlFooter };
|
|
70
|
+
// powered by hdj
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import 'core-js/modules/es.array.map.js';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
|
|
5
|
+
var getBarComKeyList = function getBarComKeyList(extraList) {
|
|
6
|
+
return extraList.map(function (item, index) {
|
|
7
|
+
return {
|
|
8
|
+
action: item,
|
|
9
|
+
key: "".concat(index)
|
|
10
|
+
};
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var useBarSortList = function useBarSortList(props) {
|
|
14
|
+
var extraList = props.extraList,
|
|
15
|
+
_props$reset = props.reset,
|
|
16
|
+
reset = _props$reset === void 0 ? false : _props$reset;
|
|
17
|
+
var list = useMemo(function () {
|
|
18
|
+
if (!extraList) {
|
|
19
|
+
var defaultList = reset ? ["reset", "submit"] : ["submit"];
|
|
20
|
+
return getBarComKeyList(defaultList);
|
|
21
|
+
}
|
|
22
|
+
return getBarComKeyList(extraList);
|
|
23
|
+
}, [extraList, reset]);
|
|
24
|
+
return list;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { useBarSortList };
|
|
28
|
+
// powered by hdj
|
package/es/Submit/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import type { ButtonProps, FormInstance } from "antd/es";
|
|
3
|
+
export type SubmitBarExtraType = "submit" | "reset" | React.ReactDOM;
|
|
2
4
|
export interface ISubmitProps extends Omit<ButtonProps, "form"> {
|
|
3
5
|
text?: string;
|
|
4
6
|
form: FormInstance;
|
|
5
7
|
reset?: boolean;
|
|
6
8
|
position?: "start" | "end";
|
|
9
|
+
extraList?: SubmitBarExtraType[];
|
|
7
10
|
}
|
|
8
|
-
declare const _default: ({
|
|
11
|
+
declare const _default: ({ position, reset, extraList, ...props }: ISubmitProps) => JSX.Element;
|
|
9
12
|
export default _default;
|
package/es/Submit/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
4
|
+
import 'core-js/modules/es.array.map.js';
|
|
2
5
|
import 'core-js/modules/es.object.keys.js';
|
|
3
6
|
import 'core-js/modules/es.symbol.js';
|
|
4
7
|
import 'core-js/modules/es.array.filter.js';
|
|
@@ -6,46 +9,39 @@ import 'core-js/modules/es.object.to-string.js';
|
|
|
6
9
|
import 'core-js/modules/es.object.get-own-property-descriptor.js';
|
|
7
10
|
import 'core-js/modules/web.dom-collections.for-each.js';
|
|
8
11
|
import 'core-js/modules/es.object.get-own-property-descriptors.js';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
12
|
+
import { jsx } from 'react/jsx-runtime';
|
|
13
|
+
import { createElement } from 'react';
|
|
14
|
+
import { Row, Space } from 'antd';
|
|
15
|
+
import { useBarSortList } from './hooks.js';
|
|
16
|
+
import { ControlFooter } from './components.js';
|
|
14
17
|
|
|
15
|
-
var _excluded = ["
|
|
18
|
+
var _excluded = ["position", "reset", "extraList"];
|
|
16
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; }
|
|
17
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; }
|
|
18
21
|
var HSubmit = (function (_ref) {
|
|
19
|
-
var _ref$
|
|
20
|
-
text = _ref$text === void 0 ? "提交" : _ref$text,
|
|
21
|
-
_ref$type = _ref.type,
|
|
22
|
-
type = _ref$type === void 0 ? "primary" : _ref$type,
|
|
23
|
-
form = _ref.form,
|
|
24
|
-
loading = _ref.loading,
|
|
25
|
-
_ref$position = _ref.position,
|
|
22
|
+
var _ref$position = _ref.position,
|
|
26
23
|
position = _ref$position === void 0 ? "start" : _ref$position,
|
|
27
24
|
reset = _ref.reset,
|
|
25
|
+
extraList = _ref.extraList,
|
|
28
26
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
var barList = useBarSortList({
|
|
28
|
+
reset: reset,
|
|
29
|
+
extraList: extraList
|
|
30
|
+
});
|
|
32
31
|
return jsx(Row, {
|
|
33
32
|
justify: position,
|
|
34
33
|
style: {
|
|
35
34
|
width: "100%"
|
|
36
35
|
},
|
|
37
|
-
children:
|
|
38
|
-
children:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
loading: formSubLoading,
|
|
47
|
-
children: text
|
|
48
|
-
}))]
|
|
36
|
+
children: jsx(Space, {
|
|
37
|
+
children: barList === null || barList === void 0 ? void 0 : barList.map(function (_ref2) {
|
|
38
|
+
var action = _ref2.action,
|
|
39
|
+
key = _ref2.key;
|
|
40
|
+
return /*#__PURE__*/createElement(ControlFooter, _objectSpread(_objectSpread({}, props), {}, {
|
|
41
|
+
key: key,
|
|
42
|
+
action: action
|
|
43
|
+
}));
|
|
44
|
+
})
|
|
49
45
|
})
|
|
50
46
|
});
|
|
51
47
|
});
|
package/es/Switch/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { SwitchProps } from "antd";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import type { ValueSwitchMapModal } from "../modal";
|
|
4
|
+
import type { addFormatItemModal } from "../Form/modal";
|
|
4
5
|
export interface HSwitchProps extends Omit<SwitchProps, "onChange"> {
|
|
5
6
|
valueMap?: ValueSwitchMapModal;
|
|
6
7
|
value?: any;
|
|
7
8
|
onChange?: (val: any) => void;
|
|
8
9
|
beforeText?: React.ReactNode;
|
|
10
|
+
addFormat?: (format: Record<string, addFormatItemModal>) => void;
|
|
9
11
|
}
|
|
10
|
-
declare const
|
|
11
|
-
export default
|
|
12
|
+
declare const _default: React.ForwardRefExoticComponent<import("../Form/modal").HFormItemProps & React.RefAttributes<any>>;
|
|
13
|
+
export default _default;
|
package/es/Switch/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
4
|
+
import 'core-js/modules/es.function.name.js';
|
|
2
5
|
import 'core-js/modules/es.object.keys.js';
|
|
3
6
|
import 'core-js/modules/es.symbol.js';
|
|
4
7
|
import 'core-js/modules/es.array.filter.js';
|
|
@@ -6,14 +9,13 @@ import 'core-js/modules/es.object.to-string.js';
|
|
|
6
9
|
import 'core-js/modules/es.object.get-own-property-descriptor.js';
|
|
7
10
|
import 'core-js/modules/web.dom-collections.for-each.js';
|
|
8
11
|
import 'core-js/modules/es.object.get-own-property-descriptors.js';
|
|
9
|
-
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
10
|
-
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
11
12
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
12
13
|
import { Space, Switch } from 'antd';
|
|
13
14
|
import { useMemo } from 'react';
|
|
14
15
|
import { useMatchConfigProps } from '../hooks/index.js';
|
|
16
|
+
import HFormConnect from '../Form/HFormConnect.js';
|
|
15
17
|
|
|
16
|
-
var _excluded = ["value", "onChange", "valueMap", "children", "unCheckedChildren", "checkedChildren", "beforeText"];
|
|
18
|
+
var _excluded = ["value", "onChange", "valueMap", "children", "unCheckedChildren", "checkedChildren", "beforeText", "addFormat"];
|
|
17
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; }
|
|
18
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; }
|
|
19
21
|
var Index = function Index(_ref) {
|
|
@@ -26,6 +28,7 @@ var Index = function Index(_ref) {
|
|
|
26
28
|
_ref$checkedChildren = _ref.checkedChildren,
|
|
27
29
|
checkedChildren = _ref$checkedChildren === void 0 ? "开启" : _ref$checkedChildren,
|
|
28
30
|
beforeText = _ref.beforeText,
|
|
31
|
+
addFormat = _ref.addFormat,
|
|
29
32
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
30
33
|
var _useMatchConfigProps = useMatchConfigProps({
|
|
31
34
|
valueSwitchMap: propsValueSwitchMap
|
|
@@ -43,6 +46,26 @@ var Index = function Index(_ref) {
|
|
|
43
46
|
}
|
|
44
47
|
onChange === null || onChange === void 0 || onChange(subVal);
|
|
45
48
|
};
|
|
49
|
+
addFormat === null || addFormat === void 0 || addFormat({
|
|
50
|
+
float: {
|
|
51
|
+
inputValue: function inputValue(item, initValue) {
|
|
52
|
+
var close = valueSwitchMap.close;
|
|
53
|
+
var _item$name = item.name,
|
|
54
|
+
valueName = _item$name === void 0 ? "" : _item$name;
|
|
55
|
+
var val = initValue[valueName];
|
|
56
|
+
if (typeof val === "undefined" || val === null) {
|
|
57
|
+
val = close;
|
|
58
|
+
}
|
|
59
|
+
console.log(val, "");
|
|
60
|
+
return _defineProperty({}, valueName, val);
|
|
61
|
+
},
|
|
62
|
+
outputValue: function outputValue(item, _outputValue) {
|
|
63
|
+
var _item$name2 = item.name,
|
|
64
|
+
name = _item$name2 === void 0 ? "" : _item$name2;
|
|
65
|
+
return _defineProperty({}, name, _outputValue[name]);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
46
69
|
return jsxs(Space, {
|
|
47
70
|
children: [beforeText, jsx(Switch, _objectSpread({
|
|
48
71
|
checked: swChecked,
|
|
@@ -54,6 +77,7 @@ var Index = function Index(_ref) {
|
|
|
54
77
|
})]
|
|
55
78
|
});
|
|
56
79
|
};
|
|
80
|
+
var HSwitch = HFormConnect(Index);
|
|
57
81
|
|
|
58
|
-
export {
|
|
82
|
+
export { HSwitch as default };
|
|
59
83
|
// powered by hdj
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
4
|
+
import 'core-js/modules/es.function.name.js';
|
|
5
|
+
import 'core-js/modules/es.string.trim.js';
|
|
6
|
+
import 'core-js/modules/es.object.keys.js';
|
|
7
|
+
import 'core-js/modules/es.symbol.js';
|
|
8
|
+
import 'core-js/modules/es.array.filter.js';
|
|
9
|
+
import 'core-js/modules/es.object.to-string.js';
|
|
10
|
+
import 'core-js/modules/es.object.get-own-property-descriptor.js';
|
|
11
|
+
import 'core-js/modules/web.dom-collections.for-each.js';
|
|
12
|
+
import 'core-js/modules/es.object.get-own-property-descriptors.js';
|
|
13
|
+
import { jsx } from 'react/jsx-runtime';
|
|
14
|
+
import TextArea from './index.js';
|
|
15
|
+
import HFormConnect from '../Form/HFormConnect.js';
|
|
16
|
+
|
|
17
|
+
var _excluded = ["addFormat"];
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
var Index = function Index(_ref) {
|
|
21
|
+
var addFormat = _ref.addFormat,
|
|
22
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
|
+
addFormat === null || addFormat === void 0 || addFormat({
|
|
24
|
+
float: {
|
|
25
|
+
inputValue: function inputValue(item, initValue) {
|
|
26
|
+
var _item$name = item.name,
|
|
27
|
+
valueName = _item$name === void 0 ? "" : _item$name;
|
|
28
|
+
return _defineProperty({}, valueName, initValue[valueName]);
|
|
29
|
+
},
|
|
30
|
+
outputValue: function outputValue(item, _outputValue) {
|
|
31
|
+
var _item$name2 = item.name,
|
|
32
|
+
name = _item$name2 === void 0 ? "" : _item$name2;
|
|
33
|
+
var itemVal = _outputValue[name];
|
|
34
|
+
return _defineProperty({}, name, itemVal === null || itemVal === void 0 ? void 0 : itemVal.trim());
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return jsx(TextArea, _objectSpread({}, props));
|
|
39
|
+
};
|
|
40
|
+
var TrimTextArea = HFormConnect(Index);
|
|
41
|
+
|
|
42
|
+
export { TrimTextArea as default };
|
|
43
|
+
// powered by hdj
|
package/es/index.d.ts
CHANGED
|
@@ -12,17 +12,19 @@ export declare const HUpload: import("react").ForwardRefExoticComponent<import("
|
|
|
12
12
|
export declare const HUrlUpload: ({ placeholder, value, onChange, mediaType, ...props }: import("./Upload/modal").IUrlUploadProps) => JSX.Element;
|
|
13
13
|
export declare const HButtonInput: import("react").FC<import("./Input/modal").HButtonInputProps>;
|
|
14
14
|
export declare const HCheckBox: import("react").FC<import("./CheckboxGroup/modal").HCheckboxProps>;
|
|
15
|
-
export declare const HSwitch: import("react").
|
|
15
|
+
export declare const HSwitch: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
16
16
|
export declare const HCheckboxGroup: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
17
|
-
export declare const HDatePicker: import("react").
|
|
17
|
+
export declare const HDatePicker: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
18
18
|
export declare const HRangePicker: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
19
19
|
export declare const HRadioGroup: ({ value, options, onChange, fieldNames: propsFieldNames, ...props }: import("./RadioGroup").HRadioGroupProps) => JSX.Element;
|
|
20
|
-
export declare const HTimePicker: (
|
|
20
|
+
export declare const HTimePicker: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
21
21
|
export declare const HInputNumber: ({ style, ...props }: import("antd").InputNumberProps<string | number>) => JSX.Element;
|
|
22
22
|
export declare const HPageHandler: import("react").FC<import("./PageHandler/modal").IHPageHandler<any>>;
|
|
23
23
|
export declare const HTextArea: ({ autoSize, ...props }: import("antd/es/input").TextAreaProps) => JSX.Element;
|
|
24
24
|
export declare const HColorInput: ({ value, onChange, defaultColor, ...props }: import("./Input/modal").HInputProps<any>) => JSX.Element;
|
|
25
|
-
export declare const HModalForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, params, onOk, onValuesChange, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
|
|
26
|
-
export declare const HDrawerForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, params, onValuesChange, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
|
|
25
|
+
export declare const HModalForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, params, onOk, onValuesChange, autoClear, contentRender, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
|
|
26
|
+
export declare const HDrawerForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, params, onValuesChange, autoClear, contentRender, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
|
|
27
27
|
export declare const HCascader: ({ request, options, fieldNames: propsFieldNames, ...props }: import("./Cascader").HCascaderProps) => JSX.Element;
|
|
28
|
-
export declare const HVerificationCodeInput: () => JSX.Element;
|
|
28
|
+
export declare const HVerificationCodeInput: ({ value, request, form, onChange, ...props }: import("./Input/VerificationCodeInput").HVerificationCodeInputProps) => JSX.Element;
|
|
29
|
+
export declare const HTrimInput: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
30
|
+
export declare const HTrimTextArea: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
package/es/index.js
CHANGED
|
@@ -30,6 +30,8 @@ var HModalForm = ModalForm;
|
|
|
30
30
|
var HDrawerForm = DrawerForm;
|
|
31
31
|
var HCascader = componentConfig.cascader;
|
|
32
32
|
var HVerificationCodeInput = componentConfig.verificationCodeInput;
|
|
33
|
+
var HTrimInput = componentConfig.trimInput;
|
|
34
|
+
var HTrimTextArea = componentConfig.trimTextArea;
|
|
33
35
|
|
|
34
|
-
export { HButtonInput, HCascader, HCheckBox, HCheckboxGroup, HColorInput, HDatePicker, HDrawerForm, HInput, HInputNumber, HModalForm, HPageHandler, HRadioGroup, HRangePicker, HSelect, HSelectInput, HSwitch, HTextArea, HTimePicker, HUpload, HUrlUpload, HVerificationCodeInput };
|
|
36
|
+
export { HButtonInput, HCascader, HCheckBox, HCheckboxGroup, HColorInput, HDatePicker, HDrawerForm, HInput, HInputNumber, HModalForm, HPageHandler, HRadioGroup, HRangePicker, HSelect, HSelectInput, HSwitch, HTextArea, HTimePicker, HTrimInput, HTrimTextArea, HUpload, HUrlUpload, HVerificationCodeInput };
|
|
35
37
|
// powered by hdj
|
|
@@ -10,4 +10,5 @@ export interface HCheckboxProps extends Omit<CheckboxProps, "value" | "onChange"
|
|
|
10
10
|
value?: Record<string, any> | any[];
|
|
11
11
|
onChange?: (value: Record<string, any> | any[]) => void;
|
|
12
12
|
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
13
|
+
subParams?: (formatValue: Record<string, any>, sourceValue: any[]) => any;
|
|
13
14
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ModalProps } from "antd";
|
|
2
2
|
import type { HFormInstance, HItemProps, HFormProps } from "../Form/modal";
|
|
3
3
|
import type { PromiseFnResult } from "../modal";
|
|
4
|
-
import React from "react";
|
|
4
|
+
import type React from "react";
|
|
5
5
|
type RootProps = HFormProps & ModalProps;
|
|
6
6
|
export interface ModifyPropsModal<P = any> {
|
|
7
7
|
configData: HItemProps[];
|