@hw-component/form 1.9.87 → 1.9.89
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/.eslintcache +1 -1
- package/es/Form/config.d.ts +5 -0
- package/es/Form/config.js +3 -1
- package/es/Select/TagSelect/Content.d.ts +1 -1
- package/es/Select/TagSelect/hooks.d.ts +5 -1
- package/es/Select/TagSelect/hooks.js +27 -2
- package/es/Select/TagSelect/index.js +16 -6
- package/es/Select/modal.d.ts +3 -2
- package/es/TDPicker/TimeRangePicker.d.ts +8 -0
- package/es/TDPicker/TimeRangePicker.js +74 -0
- package/es/TDPicker/modal.d.ts +9 -0
- package/es/index.css +1 -4
- package/es/index.d.ts +5 -0
- package/es/index.js +2 -1
- package/lib/Form/config.d.ts +5 -0
- package/lib/Form/config.js +3 -1
- package/lib/Select/TagSelect/Content.d.ts +1 -1
- package/lib/Select/TagSelect/hooks.d.ts +5 -1
- package/lib/Select/TagSelect/hooks.js +26 -0
- package/lib/Select/TagSelect/index.js +15 -5
- package/lib/Select/modal.d.ts +3 -2
- package/lib/TDPicker/TimeRangePicker.d.ts +8 -0
- package/lib/TDPicker/TimeRangePicker.js +77 -0
- package/lib/TDPicker/modal.d.ts +9 -0
- package/lib/index.css +1 -4
- package/lib/index.d.ts +5 -0
- package/lib/index.js +2 -0
- package/package.json +1 -1
- package/src/components/Form/config.ts +5 -2
- package/src/components/Form/index.less +0 -6
- package/src/components/Select/TagSelect/Content.tsx +71 -43
- package/src/components/Select/TagSelect/hooks.ts +103 -75
- package/src/components/Select/TagSelect/index.tsx +96 -54
- package/src/components/Select/index.less +3 -4
- package/src/components/Select/modal.ts +8 -6
- package/src/components/TDPicker/TimeRangePicker.tsx +51 -0
- package/src/components/TDPicker/modal.ts +10 -0
- package/src/components/index.tsx +2 -0
- package/src/pages/Form/index.tsx +21 -16
- package/src/pages/Select/index.tsx +34 -26
|
@@ -3,5 +3,5 @@ interface IContentProps extends HTagSelectProps {
|
|
|
3
3
|
error?: Error;
|
|
4
4
|
reload: VoidFunction;
|
|
5
5
|
}
|
|
6
|
-
declare const _default: ({ loading, value, options, onChange, fieldNames, error, reload }: IContentProps) => JSX.Element;
|
|
6
|
+
declare const _default: ({ loading, value, options, onChange, fieldNames, error, reload, }: IContentProps) => JSX.Element;
|
|
7
7
|
export default _default;
|
|
@@ -4,7 +4,11 @@ export declare const useTagControl: ({ value, options, title }: HTagSelectProps)
|
|
|
4
4
|
checked: boolean | undefined;
|
|
5
5
|
indeterminate: boolean | undefined;
|
|
6
6
|
};
|
|
7
|
-
export declare const useChangeControl: ({ options, value, onChange, fieldNames }: HTagSelectProps) => {
|
|
7
|
+
export declare const useChangeControl: ({ options, value, onChange, fieldNames, }: HTagSelectProps) => {
|
|
8
8
|
change: (val: any) => void;
|
|
9
9
|
allCheck: (e: any) => void | undefined;
|
|
10
10
|
};
|
|
11
|
+
export declare const useCollapseControl: ({ visible, defaultVisible, onVisibleChange, }: HTagSelectProps) => {
|
|
12
|
+
activeKey: string[];
|
|
13
|
+
onChange: (keys: any) => void;
|
|
14
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
+
import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
2
3
|
import _toConsumableArray from '@babel/runtime-corejs3/helpers/toConsumableArray';
|
|
3
|
-
import { useMemo } from 'react';
|
|
4
|
+
import { useMemo, useState, useEffect } from 'react';
|
|
4
5
|
|
|
5
6
|
var useTagControl = function useTagControl(_ref) {
|
|
6
7
|
var value = _ref.value,
|
|
@@ -92,6 +93,30 @@ var useChangeControl = function useChangeControl(_ref2) {
|
|
|
92
93
|
allCheck: allCheck
|
|
93
94
|
};
|
|
94
95
|
};
|
|
96
|
+
var useCollapseControl = function useCollapseControl(_ref4) {
|
|
97
|
+
var visible = _ref4.visible,
|
|
98
|
+
defaultVisible = _ref4.defaultVisible,
|
|
99
|
+
onVisibleChange = _ref4.onVisibleChange;
|
|
100
|
+
var _useState = useState(defaultVisible ? ["1"] : []),
|
|
101
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
102
|
+
activeKey = _useState2[0],
|
|
103
|
+
setActiveKey = _useState2[1];
|
|
104
|
+
useEffect(function () {
|
|
105
|
+
if (typeof visible === "undefined") {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
setActiveKey(visible ? ["1"] : []);
|
|
109
|
+
}, [visible]);
|
|
110
|
+
var onChange = function onChange(keys) {
|
|
111
|
+
var len = keys === null || keys === void 0 ? void 0 : keys.length;
|
|
112
|
+
onVisibleChange === null || onVisibleChange === void 0 || onVisibleChange(!!len);
|
|
113
|
+
setActiveKey(keys);
|
|
114
|
+
};
|
|
115
|
+
return {
|
|
116
|
+
activeKey: activeKey,
|
|
117
|
+
onChange: onChange
|
|
118
|
+
};
|
|
119
|
+
};
|
|
95
120
|
|
|
96
|
-
export { useChangeControl, useTagControl };
|
|
121
|
+
export { useChangeControl, useCollapseControl, useTagControl };
|
|
97
122
|
// powered by hdj
|
|
@@ -6,7 +6,7 @@ import { Collapse, Checkbox } from 'antd';
|
|
|
6
6
|
import { useClassName, useMatchConfigProps } from '../../hooks/index.js';
|
|
7
7
|
import { useSelectReq } from '../hooks/norHooks.js';
|
|
8
8
|
import Content from './Content.js';
|
|
9
|
-
import { useTagControl, useChangeControl } from './hooks.js';
|
|
9
|
+
import { useCollapseControl, useTagControl, useChangeControl } from './hooks.js';
|
|
10
10
|
import HFormConnect from '../../Form/HFormConnect.js';
|
|
11
11
|
|
|
12
12
|
var _excluded = ["children"];
|
|
@@ -37,13 +37,22 @@ var Index = function Index(_ref2) {
|
|
|
37
37
|
manual = _ref2.manual,
|
|
38
38
|
_ref2$className = _ref2.className,
|
|
39
39
|
className = _ref2$className === void 0 ? "" : _ref2$className,
|
|
40
|
-
|
|
40
|
+
visible = _ref2.visible,
|
|
41
|
+
defaultVisible = _ref2.defaultVisible,
|
|
42
|
+
onVisibleChange = _ref2.onVisibleChange,
|
|
41
43
|
addDispatchListener = _ref2.addDispatchListener;
|
|
42
44
|
var collapseClassName = useClassName("hw-tag-select");
|
|
43
45
|
var _useMatchConfigProps = useMatchConfigProps({
|
|
44
46
|
fieldNames: propsFieldNames
|
|
45
47
|
}),
|
|
46
48
|
fieldNames = _useMatchConfigProps.fieldNames;
|
|
49
|
+
var _useCollapseControl = useCollapseControl({
|
|
50
|
+
defaultVisible: defaultVisible,
|
|
51
|
+
visible: visible,
|
|
52
|
+
onVisibleChange: onVisibleChange
|
|
53
|
+
}),
|
|
54
|
+
activeKey = _useCollapseControl.activeKey,
|
|
55
|
+
colChange = _useCollapseControl.onChange;
|
|
47
56
|
var _useSelectReq = useSelectReq({
|
|
48
57
|
options: options,
|
|
49
58
|
manual: manual,
|
|
@@ -70,10 +79,11 @@ var Index = function Index(_ref2) {
|
|
|
70
79
|
}),
|
|
71
80
|
allCheck = _useChangeControl.allCheck;
|
|
72
81
|
addDispatchListener === null || addDispatchListener === void 0 || addDispatchListener("reload", reload);
|
|
73
|
-
return jsx(Collapse,
|
|
82
|
+
return jsx(Collapse, {
|
|
74
83
|
bordered: false,
|
|
75
|
-
ghost: true
|
|
76
|
-
|
|
84
|
+
ghost: true,
|
|
85
|
+
activeKey: activeKey,
|
|
86
|
+
onChange: colChange,
|
|
77
87
|
className: "".concat(collapseClassName, " ").concat(className),
|
|
78
88
|
children: jsx(Panel, {
|
|
79
89
|
header: jsx(ItemTitle, {
|
|
@@ -92,7 +102,7 @@ var Index = function Index(_ref2) {
|
|
|
92
102
|
fieldNames: fieldNames
|
|
93
103
|
})
|
|
94
104
|
}, "1")
|
|
95
|
-
})
|
|
105
|
+
});
|
|
96
106
|
};
|
|
97
107
|
var HTagSelect = HFormConnect(Index);
|
|
98
108
|
|
package/es/Select/modal.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type { SelectProps } from "antd";
|
|
|
2
2
|
import type React from "react";
|
|
3
3
|
import type { PromiseFnResult } from "../modal";
|
|
4
4
|
import type { addFormatItemModal, argsFn, DispatchModal } from "../Form/modal";
|
|
5
|
-
import { CollapseProps } from "antd/lib/collapse/Collapse";
|
|
6
5
|
export type OptionType = Record<string, any>;
|
|
7
6
|
export type RenderFn = (data: OptionType) => React.ReactNode;
|
|
8
7
|
interface ModeConfigItem {
|
|
@@ -47,7 +46,9 @@ export interface FilterDataModal {
|
|
|
47
46
|
}
|
|
48
47
|
export interface HTagSelectProps extends HSelectProps {
|
|
49
48
|
title?: React.ReactNode;
|
|
50
|
-
|
|
49
|
+
defaultVisible?: boolean;
|
|
50
|
+
visible?: boolean;
|
|
51
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
51
52
|
}
|
|
52
53
|
export type PartialHSelectProps = Partial<HSelectProps>;
|
|
53
54
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { HItemProps } from "@/components/Form/modal";
|
|
3
|
+
declare const _default: {
|
|
4
|
+
Component: React.ForwardRefExoticComponent<import("@/components/Form/modal").HFormItemProps & React.RefAttributes<any>>;
|
|
5
|
+
placeholder: ({ label }: HItemProps) => string[];
|
|
6
|
+
requiredErrMsg: ({ label }: HItemProps) => string;
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
3
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
4
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
import { TimePicker } from 'antd';
|
|
7
|
+
import HFormConnect from '../Form/HFormConnect.js';
|
|
8
|
+
import moment from 'moment';
|
|
9
|
+
|
|
10
|
+
var _excluded = ["value", "format", "addFormat", "valueMap", "onChange", "order"];
|
|
11
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
|
+
var HTimePicker = function HTimePicker(_ref) {
|
|
14
|
+
var value = _ref.value,
|
|
15
|
+
_ref$format = _ref.format,
|
|
16
|
+
format = _ref$format === void 0 ? "HH:mm:ss" : _ref$format,
|
|
17
|
+
addFormat = _ref.addFormat,
|
|
18
|
+
_ref$valueMap = _ref.valueMap,
|
|
19
|
+
valueMap = _ref$valueMap === void 0 ? {} : _ref$valueMap,
|
|
20
|
+
onChange = _ref.onChange,
|
|
21
|
+
_ref$order = _ref.order,
|
|
22
|
+
order = _ref$order === void 0 ? false : _ref$order,
|
|
23
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
24
|
+
var _valueMap$start = valueMap.start,
|
|
25
|
+
start = _valueMap$start === void 0 ? "startTime" : _valueMap$start,
|
|
26
|
+
_valueMap$end = valueMap.end,
|
|
27
|
+
end = _valueMap$end === void 0 ? "endTime" : _valueMap$end;
|
|
28
|
+
addFormat === null || addFormat === void 0 || addFormat({
|
|
29
|
+
float: {
|
|
30
|
+
inputValue: function inputValue(item, initValue) {
|
|
31
|
+
var initStart = initValue[start],
|
|
32
|
+
initEnd = initValue[end];
|
|
33
|
+
var name = item.name;
|
|
34
|
+
if (initStart && initEnd) {
|
|
35
|
+
return _defineProperty({}, name, [moment(initStart, format), moment(initEnd, format)]);
|
|
36
|
+
}
|
|
37
|
+
return _defineProperty({}, name, []);
|
|
38
|
+
},
|
|
39
|
+
outputValue: function outputValue(item, _outputValue) {
|
|
40
|
+
var _item$name = item.name,
|
|
41
|
+
valueName = _item$name === void 0 ? "" : _item$name;
|
|
42
|
+
var itemVal = _outputValue[valueName];
|
|
43
|
+
var _ref4 = itemVal || [],
|
|
44
|
+
_ref5 = _slicedToArray(_ref4, 2),
|
|
45
|
+
startVal = _ref5[0],
|
|
46
|
+
endVal = _ref5[1];
|
|
47
|
+
return _defineProperty(_defineProperty({}, start, startVal === null || startVal === void 0 ? void 0 : startVal.format(format)), end, endVal === null || endVal === void 0 ? void 0 : endVal.format(format));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return jsx(TimePicker.RangePicker, _objectSpread({
|
|
52
|
+
value: value,
|
|
53
|
+
onChange: onChange,
|
|
54
|
+
order: order,
|
|
55
|
+
style: {
|
|
56
|
+
width: '100%'
|
|
57
|
+
}
|
|
58
|
+
}, props));
|
|
59
|
+
};
|
|
60
|
+
var Index = HFormConnect(HTimePicker);
|
|
61
|
+
var HTimeRangePicker = {
|
|
62
|
+
Component: Index,
|
|
63
|
+
placeholder: function placeholder(_ref7) {
|
|
64
|
+
var label = _ref7.label;
|
|
65
|
+
return ["\u8BF7\u9009\u62E9\u5F00\u59CB".concat(label), "\u8BF7\u9009\u62E9\u7ED3\u675F".concat(label)];
|
|
66
|
+
},
|
|
67
|
+
requiredErrMsg: function requiredErrMsg(_ref8) {
|
|
68
|
+
var label = _ref8.label;
|
|
69
|
+
return "\u8BF7\u9009\u62E9".concat(label);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export { HTimeRangePicker as default };
|
|
74
|
+
// powered by hdj
|
package/es/TDPicker/modal.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { TimePickerProps } from "antd";
|
|
|
6
6
|
import type { DurationInputArg2 } from "moment";
|
|
7
7
|
import type { DateRangePickerValueMapModal } from "../modal";
|
|
8
8
|
import type { addFormatItemModal } from "../Form/modal";
|
|
9
|
+
import { TimeRangePickerProps } from "antd/lib/time-picker";
|
|
9
10
|
interface DisabledDateFnModal<T = Moment | undefined> {
|
|
10
11
|
(currentDate: Moment, value: T): boolean;
|
|
11
12
|
}
|
|
@@ -35,4 +36,12 @@ export interface HTimePickerProps extends Omit<TimePickerProps, "onChange" | "fo
|
|
|
35
36
|
disabledDate?: DisabledDateFnModal;
|
|
36
37
|
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
37
38
|
}
|
|
39
|
+
export interface HTimeRangePickerProps extends Omit<TimeRangePickerProps, "format"> {
|
|
40
|
+
valueMap?: {
|
|
41
|
+
start: string;
|
|
42
|
+
end: string;
|
|
43
|
+
};
|
|
44
|
+
format?: string;
|
|
45
|
+
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
46
|
+
}
|
|
38
47
|
export {};
|
package/es/index.css
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
width: 100%;
|
|
47
47
|
}
|
|
48
48
|
.ant-hw-tag-select .ant-collapse-content-box {
|
|
49
|
-
padding:
|
|
49
|
+
padding: 0 40px !important;
|
|
50
50
|
}
|
|
51
51
|
.ant-hw-tag-select .ant-hw-tag-select {
|
|
52
52
|
cursor: pointer;
|
|
@@ -179,9 +179,6 @@
|
|
|
179
179
|
display: -ms-flexbox;
|
|
180
180
|
display: flex;
|
|
181
181
|
}
|
|
182
|
-
.ant-hw-tag-select .ant-hw-tag-item {
|
|
183
|
-
cursor: pointer;
|
|
184
|
-
}
|
|
185
182
|
.ant-hw-input-group .ant-hw-input-group-disabled {
|
|
186
183
|
background-color: #f5f5f5;
|
|
187
184
|
}
|
package/es/index.d.ts
CHANGED
|
@@ -32,3 +32,8 @@ export declare const HTrimInput: import("react").ForwardRefExoticComponent<impor
|
|
|
32
32
|
export declare const HTrimTextArea: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
33
33
|
export declare const HInputNumberGroup: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
34
34
|
export declare const HTagSelect: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
35
|
+
export declare const HTimeRangePicker: {
|
|
36
|
+
Component: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
37
|
+
placeholder: ({ label }: import("./Form/modal").HItemProps) => string[];
|
|
38
|
+
requiredErrMsg: ({ label }: import("./Form/modal").HItemProps) => string;
|
|
39
|
+
};
|
package/es/index.js
CHANGED
|
@@ -37,6 +37,7 @@ var HTrimInput = componentConfig.trimInput;
|
|
|
37
37
|
var HTrimTextArea = componentConfig.trimTextArea;
|
|
38
38
|
var HInputNumberGroup = componentConfig.inputNumberGroup.Component;
|
|
39
39
|
var HTagSelect = componentConfig.tagSelect;
|
|
40
|
+
var HTimeRangePicker = componentConfig.timeRangePicker;
|
|
40
41
|
|
|
41
|
-
export { HButtonInput, HCascader, HCheckBox, HCheckboxGroup, HColorInput, HDatePicker, HDrawerForm, HInput, HInputNumber, HInputNumberGroup, HModalForm, HPageHandler, HRadioGroup, HRangePicker, HRichEditor, HSelect, HSelectInput, HSwitch, HTagSelect, HTextArea, HTimePicker, HTrimInput, HTrimTextArea, HUpload, HUrlUpload, HVerificationCodeInput };
|
|
42
|
+
export { HButtonInput, HCascader, HCheckBox, HCheckboxGroup, HColorInput, HDatePicker, HDrawerForm, HInput, HInputNumber, HInputNumberGroup, HModalForm, HPageHandler, HRadioGroup, HRangePicker, HRichEditor, HSelect, HSelectInput, HSwitch, HTagSelect, HTextArea, HTimePicker, HTimeRangePicker, HTrimInput, HTrimTextArea, HUpload, HUrlUpload, HVerificationCodeInput };
|
|
42
43
|
// powered by hdj
|
package/lib/Form/config.d.ts
CHANGED
|
@@ -39,5 +39,10 @@ declare const componentConfig: {
|
|
|
39
39
|
text: ({ value, addonBefore, addonAfter, size, ...props }: import("../Text").HFormTextProps) => JSX.Element;
|
|
40
40
|
richEditor: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
41
41
|
tagSelect: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
42
|
+
timeRangePicker: {
|
|
43
|
+
Component: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
44
|
+
placeholder: ({ label }: import("./modal").HItemProps) => string[];
|
|
45
|
+
requiredErrMsg: ({ label }: import("./modal").HItemProps) => string;
|
|
46
|
+
};
|
|
42
47
|
};
|
|
43
48
|
export default componentConfig;
|
package/lib/Form/config.js
CHANGED
|
@@ -28,6 +28,7 @@ var InputNumberGroup = require('../Input/InputNumberGroup.js');
|
|
|
28
28
|
var index$e = require('../Text/index.js');
|
|
29
29
|
var index$f = require('../RichEditor/index.js');
|
|
30
30
|
var index$g = require('../Select/TagSelect/index.js');
|
|
31
|
+
var TimeRangePicker = require('../TDPicker/TimeRangePicker.js');
|
|
31
32
|
|
|
32
33
|
var placeholderConfig = {
|
|
33
34
|
inputType: ["input", "inputNumber", "selectInput", "buttonInput", "verificationCodeInput", "trimInput", "urlUpload", "textArea", "richEditor"],
|
|
@@ -59,7 +60,8 @@ var componentConfig = {
|
|
|
59
60
|
treeSelect: TreeSelect.default,
|
|
60
61
|
text: index$e.default,
|
|
61
62
|
richEditor: index$f.default,
|
|
62
|
-
tagSelect: index$g.default
|
|
63
|
+
tagSelect: index$g.default,
|
|
64
|
+
timeRangePicker: TimeRangePicker.default
|
|
63
65
|
};
|
|
64
66
|
|
|
65
67
|
exports.default = componentConfig;
|
|
@@ -3,5 +3,5 @@ interface IContentProps extends HTagSelectProps {
|
|
|
3
3
|
error?: Error;
|
|
4
4
|
reload: VoidFunction;
|
|
5
5
|
}
|
|
6
|
-
declare const _default: ({ loading, value, options, onChange, fieldNames, error, reload }: IContentProps) => JSX.Element;
|
|
6
|
+
declare const _default: ({ loading, value, options, onChange, fieldNames, error, reload, }: IContentProps) => JSX.Element;
|
|
7
7
|
export default _default;
|
|
@@ -4,7 +4,11 @@ export declare const useTagControl: ({ value, options, title }: HTagSelectProps)
|
|
|
4
4
|
checked: boolean | undefined;
|
|
5
5
|
indeterminate: boolean | undefined;
|
|
6
6
|
};
|
|
7
|
-
export declare const useChangeControl: ({ options, value, onChange, fieldNames }: HTagSelectProps) => {
|
|
7
|
+
export declare const useChangeControl: ({ options, value, onChange, fieldNames, }: HTagSelectProps) => {
|
|
8
8
|
change: (val: any) => void;
|
|
9
9
|
allCheck: (e: any) => void | undefined;
|
|
10
10
|
};
|
|
11
|
+
export declare const useCollapseControl: ({ visible, defaultVisible, onVisibleChange, }: HTagSelectProps) => {
|
|
12
|
+
activeKey: string[];
|
|
13
|
+
onChange: (keys: any) => void;
|
|
14
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
3
4
|
var _toConsumableArray = require('@babel/runtime-corejs3/helpers/toConsumableArray');
|
|
4
5
|
var React = require('react');
|
|
5
6
|
|
|
@@ -93,7 +94,32 @@ var useChangeControl = function useChangeControl(_ref2) {
|
|
|
93
94
|
allCheck: allCheck
|
|
94
95
|
};
|
|
95
96
|
};
|
|
97
|
+
var useCollapseControl = function useCollapseControl(_ref4) {
|
|
98
|
+
var visible = _ref4.visible,
|
|
99
|
+
defaultVisible = _ref4.defaultVisible,
|
|
100
|
+
onVisibleChange = _ref4.onVisibleChange;
|
|
101
|
+
var _useState = React.useState(defaultVisible ? ["1"] : []),
|
|
102
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
103
|
+
activeKey = _useState2[0],
|
|
104
|
+
setActiveKey = _useState2[1];
|
|
105
|
+
React.useEffect(function () {
|
|
106
|
+
if (typeof visible === "undefined") {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
setActiveKey(visible ? ["1"] : []);
|
|
110
|
+
}, [visible]);
|
|
111
|
+
var onChange = function onChange(keys) {
|
|
112
|
+
var len = keys === null || keys === void 0 ? void 0 : keys.length;
|
|
113
|
+
onVisibleChange === null || onVisibleChange === void 0 || onVisibleChange(!!len);
|
|
114
|
+
setActiveKey(keys);
|
|
115
|
+
};
|
|
116
|
+
return {
|
|
117
|
+
activeKey: activeKey,
|
|
118
|
+
onChange: onChange
|
|
119
|
+
};
|
|
120
|
+
};
|
|
96
121
|
|
|
97
122
|
exports.useChangeControl = useChangeControl;
|
|
123
|
+
exports.useCollapseControl = useCollapseControl;
|
|
98
124
|
exports.useTagControl = useTagControl;
|
|
99
125
|
// powered by h
|
|
@@ -40,13 +40,22 @@ var Index = function Index(_ref2) {
|
|
|
40
40
|
manual = _ref2.manual,
|
|
41
41
|
_ref2$className = _ref2.className,
|
|
42
42
|
className = _ref2$className === void 0 ? "" : _ref2$className,
|
|
43
|
-
|
|
43
|
+
visible = _ref2.visible,
|
|
44
|
+
defaultVisible = _ref2.defaultVisible,
|
|
45
|
+
onVisibleChange = _ref2.onVisibleChange,
|
|
44
46
|
addDispatchListener = _ref2.addDispatchListener;
|
|
45
47
|
var collapseClassName = index.useClassName("hw-tag-select");
|
|
46
48
|
var _useMatchConfigProps = index.useMatchConfigProps({
|
|
47
49
|
fieldNames: propsFieldNames
|
|
48
50
|
}),
|
|
49
51
|
fieldNames = _useMatchConfigProps.fieldNames;
|
|
52
|
+
var _useCollapseControl = hooks.useCollapseControl({
|
|
53
|
+
defaultVisible: defaultVisible,
|
|
54
|
+
visible: visible,
|
|
55
|
+
onVisibleChange: onVisibleChange
|
|
56
|
+
}),
|
|
57
|
+
activeKey = _useCollapseControl.activeKey,
|
|
58
|
+
colChange = _useCollapseControl.onChange;
|
|
50
59
|
var _useSelectReq = norHooks.useSelectReq({
|
|
51
60
|
options: options,
|
|
52
61
|
manual: manual,
|
|
@@ -73,10 +82,11 @@ var Index = function Index(_ref2) {
|
|
|
73
82
|
}),
|
|
74
83
|
allCheck = _useChangeControl.allCheck;
|
|
75
84
|
addDispatchListener === null || addDispatchListener === void 0 || addDispatchListener("reload", reload);
|
|
76
|
-
return jsxRuntime.jsx(antd.Collapse,
|
|
85
|
+
return jsxRuntime.jsx(antd.Collapse, {
|
|
77
86
|
bordered: false,
|
|
78
|
-
ghost: true
|
|
79
|
-
|
|
87
|
+
ghost: true,
|
|
88
|
+
activeKey: activeKey,
|
|
89
|
+
onChange: colChange,
|
|
80
90
|
className: "".concat(collapseClassName, " ").concat(className),
|
|
81
91
|
children: jsxRuntime.jsx(Panel, {
|
|
82
92
|
header: jsxRuntime.jsx(ItemTitle, {
|
|
@@ -95,7 +105,7 @@ var Index = function Index(_ref2) {
|
|
|
95
105
|
fieldNames: fieldNames
|
|
96
106
|
})
|
|
97
107
|
}, "1")
|
|
98
|
-
})
|
|
108
|
+
});
|
|
99
109
|
};
|
|
100
110
|
var HTagSelect = HFormConnect.default(Index);
|
|
101
111
|
|
package/lib/Select/modal.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type { SelectProps } from "antd";
|
|
|
2
2
|
import type React from "react";
|
|
3
3
|
import type { PromiseFnResult } from "../modal";
|
|
4
4
|
import type { addFormatItemModal, argsFn, DispatchModal } from "../Form/modal";
|
|
5
|
-
import { CollapseProps } from "antd/lib/collapse/Collapse";
|
|
6
5
|
export type OptionType = Record<string, any>;
|
|
7
6
|
export type RenderFn = (data: OptionType) => React.ReactNode;
|
|
8
7
|
interface ModeConfigItem {
|
|
@@ -47,7 +46,9 @@ export interface FilterDataModal {
|
|
|
47
46
|
}
|
|
48
47
|
export interface HTagSelectProps extends HSelectProps {
|
|
49
48
|
title?: React.ReactNode;
|
|
50
|
-
|
|
49
|
+
defaultVisible?: boolean;
|
|
50
|
+
visible?: boolean;
|
|
51
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
51
52
|
}
|
|
52
53
|
export type PartialHSelectProps = Partial<HSelectProps>;
|
|
53
54
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { HItemProps } from "@/components/Form/modal";
|
|
3
|
+
declare const _default: {
|
|
4
|
+
Component: React.ForwardRefExoticComponent<import("@/components/Form/modal").HFormItemProps & React.RefAttributes<any>>;
|
|
5
|
+
placeholder: ({ label }: HItemProps) => string[];
|
|
6
|
+
requiredErrMsg: ({ label }: HItemProps) => string;
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
6
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
7
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
var antd = require('antd');
|
|
10
|
+
var HFormConnect = require('../Form/HFormConnect.js');
|
|
11
|
+
var moment = require('moment');
|
|
12
|
+
|
|
13
|
+
var _excluded = ["value", "format", "addFormat", "valueMap", "onChange", "order"];
|
|
14
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
|
+
var HTimePicker = function HTimePicker(_ref) {
|
|
17
|
+
var value = _ref.value,
|
|
18
|
+
_ref$format = _ref.format,
|
|
19
|
+
format = _ref$format === void 0 ? "HH:mm:ss" : _ref$format,
|
|
20
|
+
addFormat = _ref.addFormat,
|
|
21
|
+
_ref$valueMap = _ref.valueMap,
|
|
22
|
+
valueMap = _ref$valueMap === void 0 ? {} : _ref$valueMap,
|
|
23
|
+
onChange = _ref.onChange,
|
|
24
|
+
_ref$order = _ref.order,
|
|
25
|
+
order = _ref$order === void 0 ? false : _ref$order,
|
|
26
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
27
|
+
var _valueMap$start = valueMap.start,
|
|
28
|
+
start = _valueMap$start === void 0 ? "startTime" : _valueMap$start,
|
|
29
|
+
_valueMap$end = valueMap.end,
|
|
30
|
+
end = _valueMap$end === void 0 ? "endTime" : _valueMap$end;
|
|
31
|
+
addFormat === null || addFormat === void 0 || addFormat({
|
|
32
|
+
float: {
|
|
33
|
+
inputValue: function inputValue(item, initValue) {
|
|
34
|
+
var initStart = initValue[start],
|
|
35
|
+
initEnd = initValue[end];
|
|
36
|
+
var name = item.name;
|
|
37
|
+
if (initStart && initEnd) {
|
|
38
|
+
return _defineProperty({}, name, [moment(initStart, format), moment(initEnd, format)]);
|
|
39
|
+
}
|
|
40
|
+
return _defineProperty({}, name, []);
|
|
41
|
+
},
|
|
42
|
+
outputValue: function outputValue(item, _outputValue) {
|
|
43
|
+
var _item$name = item.name,
|
|
44
|
+
valueName = _item$name === void 0 ? "" : _item$name;
|
|
45
|
+
var itemVal = _outputValue[valueName];
|
|
46
|
+
var _ref4 = itemVal || [],
|
|
47
|
+
_ref5 = _slicedToArray(_ref4, 2),
|
|
48
|
+
startVal = _ref5[0],
|
|
49
|
+
endVal = _ref5[1];
|
|
50
|
+
return _defineProperty(_defineProperty({}, start, startVal === null || startVal === void 0 ? void 0 : startVal.format(format)), end, endVal === null || endVal === void 0 ? void 0 : endVal.format(format));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return jsxRuntime.jsx(antd.TimePicker.RangePicker, _objectSpread({
|
|
55
|
+
value: value,
|
|
56
|
+
onChange: onChange,
|
|
57
|
+
order: order,
|
|
58
|
+
style: {
|
|
59
|
+
width: '100%'
|
|
60
|
+
}
|
|
61
|
+
}, props));
|
|
62
|
+
};
|
|
63
|
+
var Index = HFormConnect.default(HTimePicker);
|
|
64
|
+
var HTimeRangePicker = {
|
|
65
|
+
Component: Index,
|
|
66
|
+
placeholder: function placeholder(_ref7) {
|
|
67
|
+
var label = _ref7.label;
|
|
68
|
+
return ["\u8BF7\u9009\u62E9\u5F00\u59CB".concat(label), "\u8BF7\u9009\u62E9\u7ED3\u675F".concat(label)];
|
|
69
|
+
},
|
|
70
|
+
requiredErrMsg: function requiredErrMsg(_ref8) {
|
|
71
|
+
var label = _ref8.label;
|
|
72
|
+
return "\u8BF7\u9009\u62E9".concat(label);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
exports.default = HTimeRangePicker;
|
|
77
|
+
// powered by h
|
package/lib/TDPicker/modal.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { TimePickerProps } from "antd";
|
|
|
6
6
|
import type { DurationInputArg2 } from "moment";
|
|
7
7
|
import type { DateRangePickerValueMapModal } from "../modal";
|
|
8
8
|
import type { addFormatItemModal } from "../Form/modal";
|
|
9
|
+
import { TimeRangePickerProps } from "antd/lib/time-picker";
|
|
9
10
|
interface DisabledDateFnModal<T = Moment | undefined> {
|
|
10
11
|
(currentDate: Moment, value: T): boolean;
|
|
11
12
|
}
|
|
@@ -35,4 +36,12 @@ export interface HTimePickerProps extends Omit<TimePickerProps, "onChange" | "fo
|
|
|
35
36
|
disabledDate?: DisabledDateFnModal;
|
|
36
37
|
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
37
38
|
}
|
|
39
|
+
export interface HTimeRangePickerProps extends Omit<TimeRangePickerProps, "format"> {
|
|
40
|
+
valueMap?: {
|
|
41
|
+
start: string;
|
|
42
|
+
end: string;
|
|
43
|
+
};
|
|
44
|
+
format?: string;
|
|
45
|
+
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
46
|
+
}
|
|
38
47
|
export {};
|
package/lib/index.css
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
width: 100%;
|
|
47
47
|
}
|
|
48
48
|
.ant-hw-tag-select .ant-collapse-content-box {
|
|
49
|
-
padding:
|
|
49
|
+
padding: 0 40px !important;
|
|
50
50
|
}
|
|
51
51
|
.ant-hw-tag-select .ant-hw-tag-select {
|
|
52
52
|
cursor: pointer;
|
|
@@ -179,9 +179,6 @@
|
|
|
179
179
|
display: -ms-flexbox;
|
|
180
180
|
display: flex;
|
|
181
181
|
}
|
|
182
|
-
.ant-hw-tag-select .ant-hw-tag-item {
|
|
183
|
-
cursor: pointer;
|
|
184
|
-
}
|
|
185
182
|
.ant-hw-input-group .ant-hw-input-group-disabled {
|
|
186
183
|
background-color: #f5f5f5;
|
|
187
184
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -32,3 +32,8 @@ export declare const HTrimInput: import("react").ForwardRefExoticComponent<impor
|
|
|
32
32
|
export declare const HTrimTextArea: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
33
33
|
export declare const HInputNumberGroup: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
34
34
|
export declare const HTagSelect: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
35
|
+
export declare const HTimeRangePicker: {
|
|
36
|
+
Component: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
37
|
+
placeholder: ({ label }: import("./Form/modal").HItemProps) => string[];
|
|
38
|
+
requiredErrMsg: ({ label }: import("./Form/modal").HItemProps) => string;
|
|
39
|
+
};
|
package/lib/index.js
CHANGED
|
@@ -38,6 +38,7 @@ var HTrimInput = config.default.trimInput;
|
|
|
38
38
|
var HTrimTextArea = config.default.trimTextArea;
|
|
39
39
|
var HInputNumberGroup = config.default.inputNumberGroup.Component;
|
|
40
40
|
var HTagSelect = config.default.tagSelect;
|
|
41
|
+
var HTimeRangePicker = config.default.timeRangePicker;
|
|
41
42
|
|
|
42
43
|
exports.HForm = index.default;
|
|
43
44
|
exports.useHForm = useHForm.default;
|
|
@@ -67,6 +68,7 @@ exports.HSwitch = HSwitch;
|
|
|
67
68
|
exports.HTagSelect = HTagSelect;
|
|
68
69
|
exports.HTextArea = HTextArea;
|
|
69
70
|
exports.HTimePicker = HTimePicker;
|
|
71
|
+
exports.HTimeRangePicker = HTimeRangePicker;
|
|
70
72
|
exports.HTrimInput = HTrimInput;
|
|
71
73
|
exports.HTrimTextArea = HTrimTextArea;
|
|
72
74
|
exports.HUpload = HUpload;
|
package/package.json
CHANGED
|
@@ -23,7 +23,9 @@ import TrimTextArea from "../TextArea/TrimTextArea";
|
|
|
23
23
|
import HInputNumberGroup from "../Input/InputNumberGroup";
|
|
24
24
|
import HText from "../Text";
|
|
25
25
|
import HRichEditor from "../RichEditor";
|
|
26
|
-
import HTagSelect from
|
|
26
|
+
import HTagSelect from "../Select/TagSelect";
|
|
27
|
+
import HTimeRangePicker from "../TDPicker/TimeRangePicker";
|
|
28
|
+
|
|
27
29
|
export const placeholderConfig = {
|
|
28
30
|
inputType: [
|
|
29
31
|
"input",
|
|
@@ -70,7 +72,8 @@ const componentConfig = {
|
|
|
70
72
|
treeSelect: HTreeSelect,
|
|
71
73
|
text: HText,
|
|
72
74
|
richEditor: HRichEditor,
|
|
73
|
-
tagSelect:HTagSelect
|
|
75
|
+
tagSelect: HTagSelect,
|
|
76
|
+
timeRangePicker: HTimeRangePicker,
|
|
74
77
|
};
|
|
75
78
|
|
|
76
79
|
export default componentConfig;
|