@hw-component/form 1.9.86 → 1.9.88
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 +2 -1
- package/es/Form/config.js +3 -1
- package/es/Select/TagSelect/Content.d.ts +7 -0
- package/es/Select/TagSelect/Content.js +90 -0
- package/es/Select/TagSelect/hooks.d.ts +14 -0
- package/es/Select/TagSelect/hooks.js +122 -0
- package/es/Select/TagSelect/index.d.ts +3 -0
- package/es/Select/TagSelect/index.js +110 -0
- package/es/Select/index.js +0 -1
- package/es/Select/modal.d.ts +8 -1
- package/es/index.css +15 -0
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/lib/Form/config.d.ts +2 -1
- package/lib/Form/config.js +3 -1
- package/lib/Select/TagSelect/Content.d.ts +7 -0
- package/lib/Select/TagSelect/Content.js +93 -0
- package/lib/Select/TagSelect/hooks.d.ts +14 -0
- package/lib/Select/TagSelect/hooks.js +125 -0
- package/lib/Select/TagSelect/index.d.ts +3 -0
- package/lib/Select/TagSelect/index.js +113 -0
- package/lib/Select/index.js +0 -1
- package/lib/Select/modal.d.ts +8 -1
- package/lib/index.css +15 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -0
- package/package.json +1 -1
- package/src/components/Form/config.ts +2 -1
- package/src/components/Form/index.less +6 -0
- package/src/components/Select/TagSelect/Content.tsx +50 -0
- package/src/components/Select/TagSelect/hooks.ts +102 -0
- package/src/components/Select/TagSelect/index.tsx +79 -0
- package/src/components/Select/index.less +13 -0
- package/src/components/Select/index.tsx +0 -1
- package/src/components/Select/modal.ts +9 -1
- package/src/components/index.tsx +2 -0
- package/src/pages/Form/index.tsx +149 -132
- package/src/pages/Select/index.tsx +32 -5
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useClassName } from '../../hooks/index.js';
|
|
4
|
+
import { Space, Skeleton, Empty, Row, Tag } from 'antd';
|
|
5
|
+
import { useChangeControl } from './hooks.js';
|
|
6
|
+
import NotFoundContent from '../components/NotFoundContent.js';
|
|
7
|
+
|
|
8
|
+
var ItemOption = function ItemOption(_ref) {
|
|
9
|
+
var options = _ref.options,
|
|
10
|
+
value = _ref.value,
|
|
11
|
+
onChange = _ref.onChange,
|
|
12
|
+
fieldNames = _ref.fieldNames;
|
|
13
|
+
var tagClassName = useClassName("hw-tag-item");
|
|
14
|
+
var _ref2 = fieldNames || {},
|
|
15
|
+
_ref2$label = _ref2.label,
|
|
16
|
+
labelKey = _ref2$label === void 0 ? "label" : _ref2$label,
|
|
17
|
+
_ref2$value = _ref2.value,
|
|
18
|
+
valueKey = _ref2$value === void 0 ? "value" : _ref2$value;
|
|
19
|
+
var _useChangeControl = useChangeControl({
|
|
20
|
+
options: options,
|
|
21
|
+
value: value,
|
|
22
|
+
onChange: onChange,
|
|
23
|
+
fieldNames: fieldNames
|
|
24
|
+
}),
|
|
25
|
+
change = _useChangeControl.change;
|
|
26
|
+
return jsx(Row, {
|
|
27
|
+
gutter: [0, 8],
|
|
28
|
+
children: options === null || options === void 0 ? void 0 : options.map(function (item) {
|
|
29
|
+
var label = item[labelKey],
|
|
30
|
+
itemVal = item[valueKey];
|
|
31
|
+
var index = value === null || value === void 0 ? void 0 : value.indexOf(itemVal);
|
|
32
|
+
var checkedTag = index !== -1;
|
|
33
|
+
return jsx(Tag, {
|
|
34
|
+
color: checkedTag ? "processing" : undefined,
|
|
35
|
+
className: tagClassName,
|
|
36
|
+
onClick: function onClick() {
|
|
37
|
+
change(itemVal);
|
|
38
|
+
},
|
|
39
|
+
children: label
|
|
40
|
+
}, itemVal);
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var Content = (function (_ref3) {
|
|
45
|
+
var loading = _ref3.loading,
|
|
46
|
+
value = _ref3.value,
|
|
47
|
+
options = _ref3.options,
|
|
48
|
+
onChange = _ref3.onChange,
|
|
49
|
+
fieldNames = _ref3.fieldNames,
|
|
50
|
+
error = _ref3.error,
|
|
51
|
+
reload = _ref3.reload;
|
|
52
|
+
var len = (options === null || options === void 0 ? void 0 : options.length) || 0;
|
|
53
|
+
if (loading && len === 0) {
|
|
54
|
+
return jsxs(Space, {
|
|
55
|
+
direction: "vertical",
|
|
56
|
+
style: {
|
|
57
|
+
width: "100%"
|
|
58
|
+
},
|
|
59
|
+
children: [jsx(Skeleton.Button, {
|
|
60
|
+
active: true,
|
|
61
|
+
size: "small",
|
|
62
|
+
block: true
|
|
63
|
+
}), jsx(Skeleton.Button, {
|
|
64
|
+
active: true,
|
|
65
|
+
size: "small",
|
|
66
|
+
block: true
|
|
67
|
+
})]
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (error && len === 0) {
|
|
71
|
+
return jsx(NotFoundContent, {
|
|
72
|
+
error: error,
|
|
73
|
+
reload: reload
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (len === 0) {
|
|
77
|
+
return jsx(Empty, {
|
|
78
|
+
image: Empty.PRESENTED_IMAGE_SIMPLE
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return jsx(ItemOption, {
|
|
82
|
+
options: options,
|
|
83
|
+
value: value,
|
|
84
|
+
onChange: onChange,
|
|
85
|
+
fieldNames: fieldNames
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
export { Content as default };
|
|
90
|
+
// powered by hdj
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HTagSelectProps } from "@/components/Select/modal";
|
|
2
|
+
export declare const useTagControl: ({ value, options, title }: HTagSelectProps) => {
|
|
3
|
+
labelNode: {};
|
|
4
|
+
checked: boolean | undefined;
|
|
5
|
+
indeterminate: boolean | undefined;
|
|
6
|
+
};
|
|
7
|
+
export declare const useChangeControl: ({ options, value, onChange, fieldNames }: HTagSelectProps) => {
|
|
8
|
+
change: (val: any) => void;
|
|
9
|
+
allCheck: (e: any) => void | undefined;
|
|
10
|
+
};
|
|
11
|
+
export declare const useCollapseControl: ({ visible, defaultVisible, onVisibleChange }: HTagSelectProps) => {
|
|
12
|
+
activeKey: string[];
|
|
13
|
+
onChange: (keys: any) => void;
|
|
14
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
3
|
+
import _toConsumableArray from '@babel/runtime-corejs3/helpers/toConsumableArray';
|
|
4
|
+
import { useMemo, useState, useEffect } from 'react';
|
|
5
|
+
|
|
6
|
+
var useTagControl = function useTagControl(_ref) {
|
|
7
|
+
var value = _ref.value,
|
|
8
|
+
options = _ref.options,
|
|
9
|
+
title = _ref.title;
|
|
10
|
+
var _useMemo = useMemo(function () {
|
|
11
|
+
var len = value === null || value === void 0 ? void 0 : value.length;
|
|
12
|
+
var opLen = options === null || options === void 0 ? void 0 : options.length;
|
|
13
|
+
if (!opLen) {
|
|
14
|
+
return {
|
|
15
|
+
checked: false
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
if (len === opLen) {
|
|
19
|
+
return {
|
|
20
|
+
checked: true
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
indeterminate: !!len
|
|
25
|
+
};
|
|
26
|
+
}, [value, options]),
|
|
27
|
+
checked = _useMemo.checked,
|
|
28
|
+
indeterminate = _useMemo.indeterminate;
|
|
29
|
+
var labelNode = useMemo(function () {
|
|
30
|
+
if (title) {
|
|
31
|
+
return title;
|
|
32
|
+
}
|
|
33
|
+
if (checked) {
|
|
34
|
+
return "取消";
|
|
35
|
+
}
|
|
36
|
+
return "全选";
|
|
37
|
+
}, [title, checked, indeterminate]);
|
|
38
|
+
return {
|
|
39
|
+
labelNode: labelNode,
|
|
40
|
+
checked: checked,
|
|
41
|
+
indeterminate: indeterminate
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
var useChangeControl = function useChangeControl(_ref2) {
|
|
45
|
+
var options = _ref2.options,
|
|
46
|
+
value = _ref2.value,
|
|
47
|
+
onChange = _ref2.onChange,
|
|
48
|
+
fieldNames = _ref2.fieldNames;
|
|
49
|
+
var _ref3 = fieldNames || {},
|
|
50
|
+
_ref3$value = _ref3.value,
|
|
51
|
+
valueKey = _ref3$value === void 0 ? "value" : _ref3$value;
|
|
52
|
+
var optsNk = function optsNk(newVal) {
|
|
53
|
+
var newOpts = [];
|
|
54
|
+
newVal === null || newVal === void 0 || newVal.forEach(function (itemVal) {
|
|
55
|
+
var index = options === null || options === void 0 ? void 0 : options.findIndex(function (item) {
|
|
56
|
+
return itemVal === item[valueKey];
|
|
57
|
+
});
|
|
58
|
+
if (typeof index !== "undefined") {
|
|
59
|
+
newOpts.push(options === null || options === void 0 ? void 0 : options[index]);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
return newOpts;
|
|
63
|
+
};
|
|
64
|
+
var checkedVal = function checkedVal(val) {
|
|
65
|
+
var newVal = _toConsumableArray(value);
|
|
66
|
+
newVal.push(val);
|
|
67
|
+
onChange === null || onChange === void 0 || onChange(newVal, optsNk(newVal));
|
|
68
|
+
};
|
|
69
|
+
var removeVal = function removeVal(index) {
|
|
70
|
+
var newVal = _toConsumableArray(value);
|
|
71
|
+
newVal.splice(index, 1);
|
|
72
|
+
onChange === null || onChange === void 0 || onChange(newVal, optsNk(newVal));
|
|
73
|
+
};
|
|
74
|
+
var change = function change(val) {
|
|
75
|
+
var index = value === null || value === void 0 ? void 0 : value.indexOf(val);
|
|
76
|
+
var checked = index === -1;
|
|
77
|
+
if (checked) {
|
|
78
|
+
return checkedVal(val);
|
|
79
|
+
}
|
|
80
|
+
return removeVal(index);
|
|
81
|
+
};
|
|
82
|
+
var allCheck = function allCheck(e) {
|
|
83
|
+
if (!e.target.checked) {
|
|
84
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange([], []);
|
|
85
|
+
}
|
|
86
|
+
var newVal = options === null || options === void 0 ? void 0 : options.map(function (item) {
|
|
87
|
+
return item[valueKey];
|
|
88
|
+
});
|
|
89
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange(newVal, options);
|
|
90
|
+
};
|
|
91
|
+
return {
|
|
92
|
+
change: change,
|
|
93
|
+
allCheck: allCheck
|
|
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
|
+
};
|
|
120
|
+
|
|
121
|
+
export { useChangeControl, useCollapseControl, useTagControl };
|
|
122
|
+
// powered by hdj
|
|
@@ -0,0 +1,110 @@
|
|
|
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 { jsx } from 'react/jsx-runtime';
|
|
5
|
+
import { Collapse, Checkbox } from 'antd';
|
|
6
|
+
import { useClassName, useMatchConfigProps } from '../../hooks/index.js';
|
|
7
|
+
import { useSelectReq } from '../hooks/norHooks.js';
|
|
8
|
+
import Content from './Content.js';
|
|
9
|
+
import { useCollapseControl, useTagControl, useChangeControl } from './hooks.js';
|
|
10
|
+
import HFormConnect from '../../Form/HFormConnect.js';
|
|
11
|
+
|
|
12
|
+
var _excluded = ["children"];
|
|
13
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
var Panel = Collapse.Panel;
|
|
16
|
+
var ItemTitle = function ItemTitle(_ref) {
|
|
17
|
+
var children = _ref.children,
|
|
18
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
+
return jsx("div", {
|
|
20
|
+
onClick: function onClick(event) {
|
|
21
|
+
event.stopPropagation();
|
|
22
|
+
},
|
|
23
|
+
children: jsx(Checkbox, _objectSpread(_objectSpread({}, props), {}, {
|
|
24
|
+
children: children
|
|
25
|
+
}))
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
var Index = function Index(_ref2) {
|
|
29
|
+
var options = _ref2.options,
|
|
30
|
+
_ref2$value = _ref2.value,
|
|
31
|
+
value = _ref2$value === void 0 ? [] : _ref2$value,
|
|
32
|
+
onChange = _ref2.onChange,
|
|
33
|
+
dispatch = _ref2.dispatch,
|
|
34
|
+
propsFieldNames = _ref2.fieldNames,
|
|
35
|
+
request = _ref2.request,
|
|
36
|
+
title = _ref2.title,
|
|
37
|
+
manual = _ref2.manual,
|
|
38
|
+
_ref2$className = _ref2.className,
|
|
39
|
+
className = _ref2$className === void 0 ? "" : _ref2$className,
|
|
40
|
+
visible = _ref2.visible,
|
|
41
|
+
defaultVisible = _ref2.defaultVisible,
|
|
42
|
+
onVisibleChange = _ref2.onVisibleChange,
|
|
43
|
+
addDispatchListener = _ref2.addDispatchListener;
|
|
44
|
+
var collapseClassName = useClassName("hw-tag-select");
|
|
45
|
+
var _useMatchConfigProps = useMatchConfigProps({
|
|
46
|
+
fieldNames: propsFieldNames
|
|
47
|
+
}),
|
|
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;
|
|
56
|
+
var _useSelectReq = useSelectReq({
|
|
57
|
+
options: options,
|
|
58
|
+
manual: manual,
|
|
59
|
+
request: request,
|
|
60
|
+
dispatch: dispatch
|
|
61
|
+
}),
|
|
62
|
+
loading = _useSelectReq.loading,
|
|
63
|
+
resultData = _useSelectReq.data,
|
|
64
|
+
error = _useSelectReq.error,
|
|
65
|
+
reload = _useSelectReq.reload;
|
|
66
|
+
var _useTagControl = useTagControl({
|
|
67
|
+
value: value,
|
|
68
|
+
options: resultData,
|
|
69
|
+
title: title
|
|
70
|
+
}),
|
|
71
|
+
labelNode = _useTagControl.labelNode,
|
|
72
|
+
checked = _useTagControl.checked,
|
|
73
|
+
indeterminate = _useTagControl.indeterminate;
|
|
74
|
+
var _useChangeControl = useChangeControl({
|
|
75
|
+
value: value,
|
|
76
|
+
options: resultData,
|
|
77
|
+
onChange: onChange,
|
|
78
|
+
fieldNames: fieldNames
|
|
79
|
+
}),
|
|
80
|
+
allCheck = _useChangeControl.allCheck;
|
|
81
|
+
addDispatchListener === null || addDispatchListener === void 0 || addDispatchListener("reload", reload);
|
|
82
|
+
return jsx(Collapse, {
|
|
83
|
+
bordered: false,
|
|
84
|
+
ghost: true,
|
|
85
|
+
activeKey: activeKey,
|
|
86
|
+
onChange: colChange,
|
|
87
|
+
className: "".concat(collapseClassName, " ").concat(className),
|
|
88
|
+
children: jsx(Panel, {
|
|
89
|
+
header: jsx(ItemTitle, {
|
|
90
|
+
indeterminate: indeterminate,
|
|
91
|
+
checked: checked,
|
|
92
|
+
onChange: allCheck,
|
|
93
|
+
children: labelNode
|
|
94
|
+
}),
|
|
95
|
+
children: jsx(Content, {
|
|
96
|
+
loading: loading,
|
|
97
|
+
options: resultData,
|
|
98
|
+
value: value,
|
|
99
|
+
error: error,
|
|
100
|
+
onChange: onChange,
|
|
101
|
+
reload: reload,
|
|
102
|
+
fieldNames: fieldNames
|
|
103
|
+
})
|
|
104
|
+
}, "1")
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
var HTagSelect = HFormConnect(Index);
|
|
108
|
+
|
|
109
|
+
export { HTagSelect as default };
|
|
110
|
+
// powered by hdj
|
package/es/Select/index.js
CHANGED
package/es/Select/modal.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export interface OptionsPageResultModal {
|
|
|
21
21
|
total: number;
|
|
22
22
|
}
|
|
23
23
|
export type OptionsDataType = OptionsListType | OptionsPageResultModal;
|
|
24
|
-
export interface HSelectProps extends Omit<SelectProps, "options" | "placeholder"> {
|
|
24
|
+
export interface HSelectProps extends Omit<SelectProps, "options" | "placeholder" | "onChange"> {
|
|
25
25
|
style?: React.CSSProperties;
|
|
26
26
|
request?: PromiseFnResult<any, OptionsDataType>;
|
|
27
27
|
manual?: boolean;
|
|
@@ -38,10 +38,17 @@ export interface HSelectProps extends Omit<SelectProps, "options" | "placeholder
|
|
|
38
38
|
isList?: boolean;
|
|
39
39
|
addonBefore?: React.ReactNode;
|
|
40
40
|
addonAfter?: React.ReactNode;
|
|
41
|
+
onChange?: (value: any, opts?: OptionType[] | OptionType) => void;
|
|
41
42
|
}
|
|
42
43
|
export interface FilterDataModal {
|
|
43
44
|
value: any;
|
|
44
45
|
index: number;
|
|
45
46
|
}
|
|
47
|
+
export interface HTagSelectProps extends HSelectProps {
|
|
48
|
+
title?: React.ReactNode;
|
|
49
|
+
defaultVisible?: boolean;
|
|
50
|
+
visible?: boolean;
|
|
51
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
52
|
+
}
|
|
46
53
|
export type PartialHSelectProps = Partial<HSelectProps>;
|
|
47
54
|
export {};
|
package/es/index.css
CHANGED
|
@@ -42,6 +42,18 @@
|
|
|
42
42
|
border-top-right-radius: 0 !important;
|
|
43
43
|
border-bottom-right-radius: 0 !important;
|
|
44
44
|
}
|
|
45
|
+
.ant-hw-tag-select {
|
|
46
|
+
width: 100%;
|
|
47
|
+
}
|
|
48
|
+
.ant-hw-tag-select .ant-collapse-content-box {
|
|
49
|
+
padding: 0px 40px !important;
|
|
50
|
+
}
|
|
51
|
+
.ant-hw-tag-select .ant-hw-tag-select {
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
.ant-hw-tag-select .ant-collapse-header {
|
|
55
|
+
padding: 5px 16px !important;
|
|
56
|
+
}
|
|
45
57
|
.ant-hw-form-item-colon:after {
|
|
46
58
|
position: relative;
|
|
47
59
|
top: -0.5px;
|
|
@@ -167,6 +179,9 @@
|
|
|
167
179
|
display: -ms-flexbox;
|
|
168
180
|
display: flex;
|
|
169
181
|
}
|
|
182
|
+
.ant-hw-tag-select .ant-hw-tag-item {
|
|
183
|
+
cursor: pointer;
|
|
184
|
+
}
|
|
170
185
|
.ant-hw-input-group .ant-hw-input-group-disabled {
|
|
171
186
|
background-color: #f5f5f5;
|
|
172
187
|
}
|
package/es/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare const HRadioGroup: ({ value, options, onChange, fieldNames: props
|
|
|
22
22
|
export declare const HTimePicker: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
23
23
|
export declare const HInputNumber: ({ style, ...props }: import("antd").InputNumberProps) => JSX.Element;
|
|
24
24
|
export declare const HPageHandler: import("react").FC<import("./PageHandler/modal").IHPageHandler<any>>;
|
|
25
|
-
export declare const HTextArea: ({ autoSize, bordered, className, ...props }: import("./TextArea").HTextAreaProps) => JSX.Element;
|
|
25
|
+
export declare const HTextArea: ({ autoSize, bordered, className, style, ...props }: import("./TextArea").HTextAreaProps) => JSX.Element;
|
|
26
26
|
export declare const HColorInput: ({ value, onChange, defaultColor, ...props }: import("./Input/modal").HInputProps) => JSX.Element;
|
|
27
27
|
export declare const HModalForm: import("react").FC<import("./DialogForm/modal").DialogFormProps<any, any>>;
|
|
28
28
|
export declare const HDrawerForm: import("react").FC<import("./DialogForm/modal").DialogFormProps<any, any>>;
|
|
@@ -31,3 +31,4 @@ export declare const HVerificationCodeInput: import("react").ForwardRefExoticCom
|
|
|
31
31
|
export declare const HTrimInput: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
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
|
+
export declare const HTagSelect: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
package/es/index.js
CHANGED
|
@@ -36,6 +36,7 @@ var HVerificationCodeInput = componentConfig.verificationCodeInput;
|
|
|
36
36
|
var HTrimInput = componentConfig.trimInput;
|
|
37
37
|
var HTrimTextArea = componentConfig.trimTextArea;
|
|
38
38
|
var HInputNumberGroup = componentConfig.inputNumberGroup.Component;
|
|
39
|
+
var HTagSelect = componentConfig.tagSelect;
|
|
39
40
|
|
|
40
|
-
export { HButtonInput, HCascader, HCheckBox, HCheckboxGroup, HColorInput, HDatePicker, HDrawerForm, HInput, HInputNumber, HInputNumberGroup, HModalForm, HPageHandler, HRadioGroup, HRangePicker, HRichEditor, HSelect, HSelectInput, HSwitch, HTextArea, HTimePicker, HTrimInput, HTrimTextArea, HUpload, HUrlUpload, HVerificationCodeInput };
|
|
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 };
|
|
41
42
|
// powered by hdj
|
package/lib/Form/config.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ declare const componentConfig: {
|
|
|
25
25
|
placeholder: ({ label }: import("./modal").HItemProps) => string;
|
|
26
26
|
};
|
|
27
27
|
submit: ({ position, reset, extraList, ...props }: import("../Submit").ISubmitProps) => JSX.Element;
|
|
28
|
-
textArea: ({ autoSize, bordered, className, ...props }: import("../TextArea").HTextAreaProps) => JSX.Element;
|
|
28
|
+
textArea: ({ autoSize, bordered, className, style, ...props }: import("../TextArea").HTextAreaProps) => JSX.Element;
|
|
29
29
|
colorInput: ({ value, onChange, defaultColor, ...props }: import("../Input/modal").HInputProps) => JSX.Element;
|
|
30
30
|
cascader: ({ request, options, fieldNames: propsFieldNames, ...props }: import("../Cascader").HCascaderProps) => JSX.Element;
|
|
31
31
|
verificationCodeInput: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
@@ -38,5 +38,6 @@ declare const componentConfig: {
|
|
|
38
38
|
treeSelect: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }: import("../Select/TreeSelect").HTreeSelectProps) => JSX.Element;
|
|
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
|
+
tagSelect: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
41
42
|
};
|
|
42
43
|
export default componentConfig;
|
package/lib/Form/config.js
CHANGED
|
@@ -27,6 +27,7 @@ var TrimTextArea = require('../TextArea/TrimTextArea.js');
|
|
|
27
27
|
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
|
+
var index$g = require('../Select/TagSelect/index.js');
|
|
30
31
|
|
|
31
32
|
var placeholderConfig = {
|
|
32
33
|
inputType: ["input", "inputNumber", "selectInput", "buttonInput", "verificationCodeInput", "trimInput", "urlUpload", "textArea", "richEditor"],
|
|
@@ -57,7 +58,8 @@ var componentConfig = {
|
|
|
57
58
|
inputNumberGroup: InputNumberGroup.default,
|
|
58
59
|
treeSelect: TreeSelect.default,
|
|
59
60
|
text: index$e.default,
|
|
60
|
-
richEditor: index$f.default
|
|
61
|
+
richEditor: index$f.default,
|
|
62
|
+
tagSelect: index$g.default
|
|
61
63
|
};
|
|
62
64
|
|
|
63
65
|
exports.default = componentConfig;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HTagSelectProps } from "../modal";
|
|
2
|
+
interface IContentProps extends HTagSelectProps {
|
|
3
|
+
error?: Error;
|
|
4
|
+
reload: VoidFunction;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: ({ loading, value, options, onChange, fieldNames, error, reload }: IContentProps) => JSX.Element;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var index = require('../../hooks/index.js');
|
|
7
|
+
var antd = require('antd');
|
|
8
|
+
var hooks = require('./hooks.js');
|
|
9
|
+
var NotFoundContent = require('../components/NotFoundContent.js');
|
|
10
|
+
|
|
11
|
+
var ItemOption = function ItemOption(_ref) {
|
|
12
|
+
var options = _ref.options,
|
|
13
|
+
value = _ref.value,
|
|
14
|
+
onChange = _ref.onChange,
|
|
15
|
+
fieldNames = _ref.fieldNames;
|
|
16
|
+
var tagClassName = index.useClassName("hw-tag-item");
|
|
17
|
+
var _ref2 = fieldNames || {},
|
|
18
|
+
_ref2$label = _ref2.label,
|
|
19
|
+
labelKey = _ref2$label === void 0 ? "label" : _ref2$label,
|
|
20
|
+
_ref2$value = _ref2.value,
|
|
21
|
+
valueKey = _ref2$value === void 0 ? "value" : _ref2$value;
|
|
22
|
+
var _useChangeControl = hooks.useChangeControl({
|
|
23
|
+
options: options,
|
|
24
|
+
value: value,
|
|
25
|
+
onChange: onChange,
|
|
26
|
+
fieldNames: fieldNames
|
|
27
|
+
}),
|
|
28
|
+
change = _useChangeControl.change;
|
|
29
|
+
return jsxRuntime.jsx(antd.Row, {
|
|
30
|
+
gutter: [0, 8],
|
|
31
|
+
children: options === null || options === void 0 ? void 0 : options.map(function (item) {
|
|
32
|
+
var label = item[labelKey],
|
|
33
|
+
itemVal = item[valueKey];
|
|
34
|
+
var index = value === null || value === void 0 ? void 0 : value.indexOf(itemVal);
|
|
35
|
+
var checkedTag = index !== -1;
|
|
36
|
+
return jsxRuntime.jsx(antd.Tag, {
|
|
37
|
+
color: checkedTag ? "processing" : undefined,
|
|
38
|
+
className: tagClassName,
|
|
39
|
+
onClick: function onClick() {
|
|
40
|
+
change(itemVal);
|
|
41
|
+
},
|
|
42
|
+
children: label
|
|
43
|
+
}, itemVal);
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
var Content = (function (_ref3) {
|
|
48
|
+
var loading = _ref3.loading,
|
|
49
|
+
value = _ref3.value,
|
|
50
|
+
options = _ref3.options,
|
|
51
|
+
onChange = _ref3.onChange,
|
|
52
|
+
fieldNames = _ref3.fieldNames,
|
|
53
|
+
error = _ref3.error,
|
|
54
|
+
reload = _ref3.reload;
|
|
55
|
+
var len = (options === null || options === void 0 ? void 0 : options.length) || 0;
|
|
56
|
+
if (loading && len === 0) {
|
|
57
|
+
return jsxRuntime.jsxs(antd.Space, {
|
|
58
|
+
direction: "vertical",
|
|
59
|
+
style: {
|
|
60
|
+
width: "100%"
|
|
61
|
+
},
|
|
62
|
+
children: [jsxRuntime.jsx(antd.Skeleton.Button, {
|
|
63
|
+
active: true,
|
|
64
|
+
size: "small",
|
|
65
|
+
block: true
|
|
66
|
+
}), jsxRuntime.jsx(antd.Skeleton.Button, {
|
|
67
|
+
active: true,
|
|
68
|
+
size: "small",
|
|
69
|
+
block: true
|
|
70
|
+
})]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (error && len === 0) {
|
|
74
|
+
return jsxRuntime.jsx(NotFoundContent.default, {
|
|
75
|
+
error: error,
|
|
76
|
+
reload: reload
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (len === 0) {
|
|
80
|
+
return jsxRuntime.jsx(antd.Empty, {
|
|
81
|
+
image: antd.Empty.PRESENTED_IMAGE_SIMPLE
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return jsxRuntime.jsx(ItemOption, {
|
|
85
|
+
options: options,
|
|
86
|
+
value: value,
|
|
87
|
+
onChange: onChange,
|
|
88
|
+
fieldNames: fieldNames
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
exports.default = Content;
|
|
93
|
+
// powered by h
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HTagSelectProps } from "@/components/Select/modal";
|
|
2
|
+
export declare const useTagControl: ({ value, options, title }: HTagSelectProps) => {
|
|
3
|
+
labelNode: {};
|
|
4
|
+
checked: boolean | undefined;
|
|
5
|
+
indeterminate: boolean | undefined;
|
|
6
|
+
};
|
|
7
|
+
export declare const useChangeControl: ({ options, value, onChange, fieldNames }: HTagSelectProps) => {
|
|
8
|
+
change: (val: any) => void;
|
|
9
|
+
allCheck: (e: any) => void | undefined;
|
|
10
|
+
};
|
|
11
|
+
export declare const useCollapseControl: ({ visible, defaultVisible, onVisibleChange }: HTagSelectProps) => {
|
|
12
|
+
activeKey: string[];
|
|
13
|
+
onChange: (keys: any) => void;
|
|
14
|
+
};
|