@sheinx/base 3.3.3-beta.6 → 3.3.3-beta.8
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/cjs/cascader/cascader.type.d.ts +2 -2
- package/cjs/date-picker/date-picker.d.ts.map +1 -1
- package/cjs/date-picker/date-picker.js +11 -2
- package/cjs/date-picker/result.d.ts +6 -0
- package/cjs/date-picker/result.d.ts.map +1 -1
- package/cjs/date-picker/result.js +14 -1
- package/cjs/dropdown/Item.d.ts.map +1 -1
- package/cjs/dropdown/Item.js +7 -2
- package/cjs/select/result.d.ts.map +1 -1
- package/cjs/select/result.js +4 -2
- package/cjs/select/select.type.d.ts +2 -2
- package/cjs/tabs/tab.d.ts.map +1 -1
- package/cjs/tabs/tab.js +27 -21
- package/cjs/tree-select/tree-select.type.d.ts +2 -2
- package/esm/cascader/cascader.type.d.ts +2 -2
- package/esm/date-picker/date-picker.d.ts.map +1 -1
- package/esm/date-picker/date-picker.js +12 -3
- package/esm/date-picker/result.d.ts +6 -0
- package/esm/date-picker/result.d.ts.map +1 -1
- package/esm/date-picker/result.js +14 -1
- package/esm/dropdown/Item.d.ts.map +1 -1
- package/esm/dropdown/Item.js +7 -2
- package/esm/select/result.d.ts.map +1 -1
- package/esm/select/result.js +4 -2
- package/esm/select/select.type.d.ts +2 -2
- package/esm/tabs/tab.d.ts.map +1 -1
- package/esm/tabs/tab.js +28 -21
- package/esm/tree-select/tree-select.type.d.ts +2 -2
- package/package.json +2 -2
|
@@ -121,8 +121,8 @@ export interface CascaderProps<DataItem, Value extends KeygenResult[]> extends P
|
|
|
121
121
|
*/
|
|
122
122
|
open?: boolean;
|
|
123
123
|
/**
|
|
124
|
-
* @en Selected key (controlled)
|
|
125
|
-
* @cn 选中的 key (受控)
|
|
124
|
+
* @en Selected key (controlled). Note: Do not use undefined and null as meaningful option values. When the value type is undefined and null, the component will not process data and rendering
|
|
125
|
+
* @cn 选中的 key (受控)。注意,请勿将 undefined 和 null 作为有意义的选项值,当 value 类型为 undefined 和 null 时,组件将不处理数据和渲染
|
|
126
126
|
*/
|
|
127
127
|
value?: Value;
|
|
128
128
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["date-picker.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAiB1E,QAAA,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["date-picker.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAiB1E,QAAA,MAAM,UAAU,oFA8Rf,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -59,6 +59,9 @@ var DatePicker = function DatePicker(props0) {
|
|
|
59
59
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
60
60
|
activeIndex = _React$useState2[0],
|
|
61
61
|
setActiveIndex = _React$useState2[1];
|
|
62
|
+
var inputRef = (0, _react.useRef)({
|
|
63
|
+
inputRef: null
|
|
64
|
+
});
|
|
62
65
|
var styles = jssStyle === null || jssStyle === void 0 || (_jssStyle$datePicker = jssStyle.datePicker) === null || _jssStyle$datePicker === void 0 ? void 0 : _jssStyle$datePicker.call(jssStyle);
|
|
63
66
|
var isRTL = direction === 'rtl';
|
|
64
67
|
var dfp = isRTL ? 'bottom-right' : 'bottom-left';
|
|
@@ -157,6 +160,11 @@ var DatePicker = function DatePicker(props0) {
|
|
|
157
160
|
setFocused(false);
|
|
158
161
|
(_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 || _props$onBlur.call(props, e);
|
|
159
162
|
});
|
|
163
|
+
var handleClose = function handleClose() {
|
|
164
|
+
var _inputRef$current$inp;
|
|
165
|
+
closePop();
|
|
166
|
+
(_inputRef$current$inp = inputRef.current.inputRef) === null || _inputRef$current$inp === void 0 || _inputRef$current$inp.blur();
|
|
167
|
+
};
|
|
160
168
|
var handleResultClick = (0, _hooks.usePersistFn)(function () {
|
|
161
169
|
if (disabledStatus === 'all') return;
|
|
162
170
|
openPop();
|
|
@@ -169,6 +177,7 @@ var DatePicker = function DatePicker(props0) {
|
|
|
169
177
|
activeIndex: activeIndex,
|
|
170
178
|
type: type,
|
|
171
179
|
range: range,
|
|
180
|
+
onRef: inputRef,
|
|
172
181
|
inputable: props.inputable && !props.formatResult,
|
|
173
182
|
disabledLeft: disabledStatus === 'left',
|
|
174
183
|
disabledRight: disabledStatus === 'right',
|
|
@@ -197,7 +206,7 @@ var DatePicker = function DatePicker(props0) {
|
|
|
197
206
|
onKeyDown: function onKeyDown(e) {
|
|
198
207
|
if (e.key === 'Enter') {
|
|
199
208
|
if (open) {
|
|
200
|
-
|
|
209
|
+
handleClose();
|
|
201
210
|
} else {
|
|
202
211
|
openPop();
|
|
203
212
|
}
|
|
@@ -254,7 +263,7 @@ var DatePicker = function DatePicker(props0) {
|
|
|
254
263
|
options: options,
|
|
255
264
|
disabled: disabled,
|
|
256
265
|
jssStyle: jssStyle,
|
|
257
|
-
closePop:
|
|
266
|
+
closePop: handleClose,
|
|
258
267
|
defaultTime: props.defaultTime,
|
|
259
268
|
min: props.min,
|
|
260
269
|
max: props.max,
|
|
@@ -11,6 +11,9 @@ export declare const Input: (props: {
|
|
|
11
11
|
onMouseDown?: ((e: React.MouseEvent) => void) | undefined;
|
|
12
12
|
open?: boolean | undefined;
|
|
13
13
|
disabled?: boolean | undefined;
|
|
14
|
+
inputRef?: React.MutableRefObject<{
|
|
15
|
+
updateValue?: React.Dispatch<React.SetStateAction<string>> | undefined;
|
|
16
|
+
} | undefined> | undefined;
|
|
14
17
|
onPaste?: ((e: React.ClipboardEvent) => void) | undefined;
|
|
15
18
|
onFocus?: ((e: React.FocusEvent) => void) | undefined;
|
|
16
19
|
onBlur?: ((e: React.FocusEvent) => void) | undefined;
|
|
@@ -25,6 +28,9 @@ interface ResultProps extends Pick<DatePickerProps<string>, 'jssStyle' | 'type'
|
|
|
25
28
|
disabledLeft?: boolean;
|
|
26
29
|
disabledRight?: boolean;
|
|
27
30
|
activeIndex?: number;
|
|
31
|
+
onRef: React.MutableRefObject<{
|
|
32
|
+
inputRef: HTMLInputElement | null;
|
|
33
|
+
}>;
|
|
28
34
|
onFocus?: (e: React.FocusEvent) => void;
|
|
29
35
|
onBlur?: (e: React.FocusEvent) => void;
|
|
30
36
|
onClick?: (e?: React.MouseEvent) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["result.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,eAAO,MAAM,KAAK;;WAET,MAAM;;;;kBAIC,MAAM,KAAK,IAAI;mBACf,gBAAgB,KAAK,IAAI;uBACrB,gBAAgB,KAAK,IAAI
|
|
1
|
+
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["result.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,eAAO,MAAM,KAAK;;WAET,MAAM;;;;kBAIC,MAAM,KAAK,IAAI;mBACf,gBAAgB,KAAK,IAAI;uBACrB,gBAAgB,KAAK,IAAI;;;;;;mBAS7B,oBAAoB,KAAK,IAAI;mBAC7B,gBAAgB,KAAK,IAAI;kBAC1B,gBAAgB,KAAK,IAAI;oBACvB,gBAAgB,KAAK,IAAI;iBAyCzC,CAAC;AACF,UAAU,WACR,SAAQ,IAAI,CACV,eAAe,CAAC,MAAM,CAAC,EACvB,UAAU,GAAG,MAAM,GAAG,WAAW,GAAG,OAAO,GAAG,aAAa,CAC5D;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,eAAe,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC3C,SAAS,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACrC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC,gBAAgB,CAAC;QAC5B,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC;KACnC,CAAC,CAAC;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACxC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CAC1C;AACD,QAAA,MAAM,MAAM,UAAW,WAAW,gBA0JjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -23,6 +23,14 @@ var Input = exports.Input = function Input(props) {
|
|
|
23
23
|
_useState2 = _slicedToArray(_useState, 2),
|
|
24
24
|
value = _useState2[0],
|
|
25
25
|
setValue = _useState2[1];
|
|
26
|
+
var updateValue = function updateValue() {
|
|
27
|
+
setValue(props.value);
|
|
28
|
+
};
|
|
29
|
+
if (props.inputRef) {
|
|
30
|
+
props.inputRef.current = {
|
|
31
|
+
updateValue: updateValue
|
|
32
|
+
};
|
|
33
|
+
}
|
|
26
34
|
(0, _react.useEffect)(function () {
|
|
27
35
|
setValue(props.value);
|
|
28
36
|
}, [props.value, props.open]);
|
|
@@ -61,6 +69,7 @@ var Result = function Result(props) {
|
|
|
61
69
|
range = props.range,
|
|
62
70
|
placeholder = props.placeholder,
|
|
63
71
|
_onChange = props.onChange,
|
|
72
|
+
_onRef = props.onRef,
|
|
64
73
|
disabledLeft = props.disabledLeft,
|
|
65
74
|
disabledRight = props.disabledRight,
|
|
66
75
|
_props$activeIndex = props.activeIndex,
|
|
@@ -74,6 +83,7 @@ var Result = function Result(props) {
|
|
|
74
83
|
clickIndex: 0
|
|
75
84
|
}),
|
|
76
85
|
context = _useRef.current;
|
|
86
|
+
var inputRef = (0, _react.useRef)({});
|
|
77
87
|
(0, _react.useEffect)(function () {
|
|
78
88
|
if (open) {
|
|
79
89
|
if (context.inputRefs[activeIndex]) {
|
|
@@ -126,10 +136,12 @@ var Result = function Result(props) {
|
|
|
126
136
|
className: styles === null || styles === void 0 ? void 0 : styles.resultTextPadding,
|
|
127
137
|
children: info.inputable ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Input, {
|
|
128
138
|
onRef: function onRef(el) {
|
|
139
|
+
_onRef.current.inputRef = el;
|
|
129
140
|
context.inputRefs[info.index] = el;
|
|
130
141
|
},
|
|
131
142
|
disabled: dis,
|
|
132
143
|
open: !!open,
|
|
144
|
+
inputRef: inputRef,
|
|
133
145
|
value: info.target || info.value || '',
|
|
134
146
|
placeholder: info.place,
|
|
135
147
|
onChange: function onChange(s) {
|
|
@@ -139,10 +151,11 @@ var Result = function Result(props) {
|
|
|
139
151
|
context.clickIndex = info.index;
|
|
140
152
|
},
|
|
141
153
|
onBlur: function onBlur(e) {
|
|
142
|
-
var _props$onBlur;
|
|
154
|
+
var _props$onBlur, _inputRef$current$upd, _inputRef$current;
|
|
143
155
|
e.stopPropagation();
|
|
144
156
|
if (e.relatedTarget === context.inputRefs[1 - info.index]) return;
|
|
145
157
|
(_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 || _props$onBlur.call(props, e);
|
|
158
|
+
if (inputRef.current) (_inputRef$current$upd = (_inputRef$current = inputRef.current).updateValue) === null || _inputRef$current$upd === void 0 || _inputRef$current$upd.call(_inputRef$current);
|
|
146
159
|
context.clickIndex = 0;
|
|
147
160
|
},
|
|
148
161
|
onFocus: function onFocus(e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["Item.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAgB,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAuB1D,cAAM,IAAK,SAAQ,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC;IAC/C,MAAM,CAAC,YAAY;;;MAAgB;gBAEvB,KAAK,EAAE,SAAS;IAK5B,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU;IAY/B,MAAM;
|
|
1
|
+
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["Item.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAgB,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAuB1D,cAAM,IAAK,SAAQ,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC;IAC/C,MAAM,CAAC,YAAY;;;MAAgB;gBAEvB,KAAK,EAAE,SAAS;IAK5B,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU;IAY/B,MAAM;CAyCP;AAED,eAAe,IAAI,CAAC"}
|
package/cjs/dropdown/Item.js
CHANGED
|
@@ -10,7 +10,7 @@ var _hooks = require("@sheinx/hooks");
|
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
var _excluded = ["className"],
|
|
13
|
-
_excluded2 = ["className"];
|
|
13
|
+
_excluded2 = ["className", "onClick"];
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -89,10 +89,15 @@ var Item = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
89
89
|
var _ref2 = content.props,
|
|
90
90
|
_ref2$className = _ref2.className,
|
|
91
91
|
contentPropsClassName = _ref2$className === void 0 ? '' : _ref2$className,
|
|
92
|
+
contentPropsOnClick = _ref2.onClick,
|
|
92
93
|
otherContentProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
93
94
|
var className = (0, _classnames.default)(propsClassName, contentPropsClassName);
|
|
94
95
|
return /*#__PURE__*/(0, _react.cloneElement)(content, Object.assign(otherProps, otherContentProps, {
|
|
95
|
-
className: className
|
|
96
|
+
className: className,
|
|
97
|
+
onClick: function onClick(e) {
|
|
98
|
+
if (contentPropsOnClick) contentPropsOnClick(e);
|
|
99
|
+
if (props.onClick) props.onClick(e);
|
|
100
|
+
}
|
|
96
101
|
}));
|
|
97
102
|
}
|
|
98
103
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("a", _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["result.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAQ5C,QAAA,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["result.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAQ5C,QAAA,MAAM,MAAM,uEA0XX,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/cjs/select/result.js
CHANGED
|
@@ -65,7 +65,7 @@ var Result = function Result(props) {
|
|
|
65
65
|
onRemove = props.onRemove,
|
|
66
66
|
onResultItemClick = props.onResultItemClick,
|
|
67
67
|
data = props.data;
|
|
68
|
-
var value = isArray(valueProp) ? valueProp : [valueProp];
|
|
68
|
+
var value = [null, undefined].includes(valueProp) ? [] : Array.isArray(valueProp) ? valueProp : [valueProp];
|
|
69
69
|
var _useState = (0, _react.useState)(-1),
|
|
70
70
|
_useState2 = _slicedToArray(_useState, 2),
|
|
71
71
|
more = _useState2[0],
|
|
@@ -222,7 +222,9 @@ var Result = function Result(props) {
|
|
|
222
222
|
}, 'single');
|
|
223
223
|
};
|
|
224
224
|
var getValueArr = function getValueArr(v) {
|
|
225
|
-
return isArray(v) ? v : [v]
|
|
225
|
+
return (isArray(v) ? v : [v]).filter(function (v) {
|
|
226
|
+
return v !== undefined && v !== null;
|
|
227
|
+
});
|
|
226
228
|
};
|
|
227
229
|
var renderMultipleResult = function renderMultipleResult() {
|
|
228
230
|
if (isEmptyResult()) return renderNbsp();
|
|
@@ -147,8 +147,8 @@ export interface SelectPropsBase<DataItem, Value> extends Omit<BaseSelectProps<D
|
|
|
147
147
|
*/
|
|
148
148
|
keygen: KeygenType<DataItem>;
|
|
149
149
|
/**
|
|
150
|
-
* @en In the Form, the value will be taken over by the form and the value will
|
|
151
|
-
* @cn 在 Form 中,value 会被表单接管,value
|
|
150
|
+
* @en In the Form, the value will be taken over by the form, and the value is invalid. Note: Do not use undefined and null as meaningful option values. When the value type is undefined and null, the component will not process data and rendering
|
|
151
|
+
* @cn 在 Form 中,value 会被表单接管,value 无效。注意,请勿将 undefined 和 null 作为有意义的选项值,当 value 类型为 undefined 和 null 时,组件将不处理数据和渲染
|
|
152
152
|
* @override any
|
|
153
153
|
*/
|
|
154
154
|
value?: Value;
|
package/cjs/tabs/tab.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;;AAyHtC,wBAAqC"}
|
package/cjs/tabs/tab.js
CHANGED
|
@@ -20,7 +20,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
20
20
|
var Tab = function Tab(props, ref) {
|
|
21
21
|
var _jssStyle$tabs;
|
|
22
22
|
var jssStyle = props.jssStyle,
|
|
23
|
-
|
|
23
|
+
propTab = props.tab,
|
|
24
24
|
disabled = props.disabled,
|
|
25
25
|
id = props.id,
|
|
26
26
|
color = props.color;
|
|
@@ -46,13 +46,11 @@ var Tab = function Tab(props, ref) {
|
|
|
46
46
|
};
|
|
47
47
|
var handleClick = function handleClick() {
|
|
48
48
|
if (disabled) return;
|
|
49
|
-
if (_hooks.util.isLink(tab)) {
|
|
50
|
-
if (tab.props.onClick && typeof tab.props.onClick === 'function') {
|
|
51
|
-
tab.props.onClick();
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
49
|
onChange === null || onChange === void 0 || onChange(id);
|
|
55
50
|
};
|
|
51
|
+
var tab = _hooks.util.isLink(propTab) ?
|
|
52
|
+
// 直接返回a标签的内容,不要a标签
|
|
53
|
+
propTab.props.children : propTab;
|
|
56
54
|
var renderCardTab = function renderCardTab() {
|
|
57
55
|
return tab;
|
|
58
56
|
};
|
|
@@ -84,27 +82,35 @@ var Tab = function Tab(props, ref) {
|
|
|
84
82
|
if (shape === 'card') {
|
|
85
83
|
style.color = color;
|
|
86
84
|
}
|
|
87
|
-
|
|
88
|
-
className: tabClass,
|
|
89
|
-
jssStyle: {
|
|
90
|
-
button: buttonStyle
|
|
91
|
-
}
|
|
92
|
-
}, getStateProps()), {}, {
|
|
93
|
-
style: style,
|
|
94
|
-
disabled: disabled,
|
|
95
|
-
type: isActive ? 'primary' : 'secondary',
|
|
96
|
-
onClick: handleClick,
|
|
97
|
-
dir: config.direction,
|
|
98
|
-
children: tab
|
|
99
|
-
}));
|
|
100
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread({
|
|
101
|
-
dir: config.direction,
|
|
85
|
+
var containerProps = _objectSpread(_objectSpread({
|
|
102
86
|
className: tabClass
|
|
103
87
|
}, getStateProps()), {}, {
|
|
104
88
|
style: style,
|
|
105
89
|
onClick: handleClick,
|
|
106
90
|
ref: ref,
|
|
91
|
+
dir: config.direction
|
|
92
|
+
});
|
|
93
|
+
if (shape === 'button') {
|
|
94
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.default, _objectSpread(_objectSpread({
|
|
95
|
+
jssStyle: {
|
|
96
|
+
button: buttonStyle
|
|
97
|
+
},
|
|
98
|
+
disabled: disabled,
|
|
99
|
+
type: isActive ? 'primary' : 'secondary'
|
|
100
|
+
}, containerProps), {}, {
|
|
101
|
+
children: tab
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
var $children = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
107
105
|
children: [shape === 'card' && renderCardTab(), shape === 'line' && renderLineTab(), shape === 'dash' && renderDashTab(), shape === 'fill' && renderFillTab()]
|
|
106
|
+
});
|
|
107
|
+
if (_hooks.util.isLink(propTab)) {
|
|
108
|
+
return /*#__PURE__*/_react.default.cloneElement(propTab, _objectSpread({
|
|
109
|
+
children: $children
|
|
110
|
+
}, containerProps));
|
|
111
|
+
}
|
|
112
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
113
|
+
children: $children
|
|
108
114
|
}));
|
|
109
115
|
};
|
|
110
116
|
var _default = exports.default = /*#__PURE__*/_react.default.forwardRef(Tab);
|
|
@@ -251,8 +251,8 @@ export interface TreeSelectProps<DataItem, Value> extends Pick<CommonType, 'clas
|
|
|
251
251
|
data?: ResultItem<DataItem>[] | ResultItem<DataItem> | null;
|
|
252
252
|
}) => void;
|
|
253
253
|
/**
|
|
254
|
-
* @
|
|
255
|
-
* @
|
|
254
|
+
* @cn 选中的 key (受控),多选时必须为array。注意,请勿将 undefined 和 null 作为有意义的选项值,当 value 类型为 undefined 和 null 时,组件将不处理数据和渲染
|
|
255
|
+
* @en Selected key (controlled), must be an array in multiple selection. Note: Do not use undefined and null as meaningful option values. When the value type is undefined and null, the component will not process data and rendering
|
|
256
256
|
*/
|
|
257
257
|
value?: Value;
|
|
258
258
|
/**
|
|
@@ -121,8 +121,8 @@ export interface CascaderProps<DataItem, Value extends KeygenResult[]> extends P
|
|
|
121
121
|
*/
|
|
122
122
|
open?: boolean;
|
|
123
123
|
/**
|
|
124
|
-
* @en Selected key (controlled)
|
|
125
|
-
* @cn 选中的 key (受控)
|
|
124
|
+
* @en Selected key (controlled). Note: Do not use undefined and null as meaningful option values. When the value type is undefined and null, the component will not process data and rendering
|
|
125
|
+
* @cn 选中的 key (受控)。注意,请勿将 undefined 和 null 作为有意义的选项值,当 value 类型为 undefined 和 null 时,组件将不处理数据和渲染
|
|
126
126
|
*/
|
|
127
127
|
value?: Value;
|
|
128
128
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["date-picker.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAiB1E,QAAA,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["date-picker.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAiB1E,QAAA,MAAM,UAAU,oFA8Rf,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -13,7 +13,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
13
13
|
import { useDatePickerFormat, useInputAble, usePersistFn, usePopup, util } from '@sheinx/hooks';
|
|
14
14
|
import classNames from 'classnames';
|
|
15
15
|
import { AbsoluteList } from "../absolute-list";
|
|
16
|
-
import React, { useEffect } from 'react';
|
|
16
|
+
import React, { useEffect, useRef } from 'react';
|
|
17
17
|
import AnimationList from "../animation-list";
|
|
18
18
|
import Picker from "./picker";
|
|
19
19
|
import { getLocale } from "../config";
|
|
@@ -52,6 +52,9 @@ var DatePicker = function DatePicker(props0) {
|
|
|
52
52
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
53
53
|
activeIndex = _React$useState2[0],
|
|
54
54
|
setActiveIndex = _React$useState2[1];
|
|
55
|
+
var inputRef = useRef({
|
|
56
|
+
inputRef: null
|
|
57
|
+
});
|
|
55
58
|
var styles = jssStyle === null || jssStyle === void 0 || (_jssStyle$datePicker = jssStyle.datePicker) === null || _jssStyle$datePicker === void 0 ? void 0 : _jssStyle$datePicker.call(jssStyle);
|
|
56
59
|
var isRTL = direction === 'rtl';
|
|
57
60
|
var dfp = isRTL ? 'bottom-right' : 'bottom-left';
|
|
@@ -150,6 +153,11 @@ var DatePicker = function DatePicker(props0) {
|
|
|
150
153
|
setFocused(false);
|
|
151
154
|
(_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 || _props$onBlur.call(props, e);
|
|
152
155
|
});
|
|
156
|
+
var handleClose = function handleClose() {
|
|
157
|
+
var _inputRef$current$inp;
|
|
158
|
+
closePop();
|
|
159
|
+
(_inputRef$current$inp = inputRef.current.inputRef) === null || _inputRef$current$inp === void 0 || _inputRef$current$inp.blur();
|
|
160
|
+
};
|
|
153
161
|
var handleResultClick = usePersistFn(function () {
|
|
154
162
|
if (disabledStatus === 'all') return;
|
|
155
163
|
openPop();
|
|
@@ -162,6 +170,7 @@ var DatePicker = function DatePicker(props0) {
|
|
|
162
170
|
activeIndex: activeIndex,
|
|
163
171
|
type: type,
|
|
164
172
|
range: range,
|
|
173
|
+
onRef: inputRef,
|
|
165
174
|
inputable: props.inputable && !props.formatResult,
|
|
166
175
|
disabledLeft: disabledStatus === 'left',
|
|
167
176
|
disabledRight: disabledStatus === 'right',
|
|
@@ -190,7 +199,7 @@ var DatePicker = function DatePicker(props0) {
|
|
|
190
199
|
onKeyDown: function onKeyDown(e) {
|
|
191
200
|
if (e.key === 'Enter') {
|
|
192
201
|
if (open) {
|
|
193
|
-
|
|
202
|
+
handleClose();
|
|
194
203
|
} else {
|
|
195
204
|
openPop();
|
|
196
205
|
}
|
|
@@ -247,7 +256,7 @@ var DatePicker = function DatePicker(props0) {
|
|
|
247
256
|
options: options,
|
|
248
257
|
disabled: disabled,
|
|
249
258
|
jssStyle: jssStyle,
|
|
250
|
-
closePop:
|
|
259
|
+
closePop: handleClose,
|
|
251
260
|
defaultTime: props.defaultTime,
|
|
252
261
|
min: props.min,
|
|
253
262
|
max: props.max,
|
|
@@ -11,6 +11,9 @@ export declare const Input: (props: {
|
|
|
11
11
|
onMouseDown?: ((e: React.MouseEvent) => void) | undefined;
|
|
12
12
|
open?: boolean | undefined;
|
|
13
13
|
disabled?: boolean | undefined;
|
|
14
|
+
inputRef?: React.MutableRefObject<{
|
|
15
|
+
updateValue?: React.Dispatch<React.SetStateAction<string>> | undefined;
|
|
16
|
+
} | undefined> | undefined;
|
|
14
17
|
onPaste?: ((e: React.ClipboardEvent) => void) | undefined;
|
|
15
18
|
onFocus?: ((e: React.FocusEvent) => void) | undefined;
|
|
16
19
|
onBlur?: ((e: React.FocusEvent) => void) | undefined;
|
|
@@ -25,6 +28,9 @@ interface ResultProps extends Pick<DatePickerProps<string>, 'jssStyle' | 'type'
|
|
|
25
28
|
disabledLeft?: boolean;
|
|
26
29
|
disabledRight?: boolean;
|
|
27
30
|
activeIndex?: number;
|
|
31
|
+
onRef: React.MutableRefObject<{
|
|
32
|
+
inputRef: HTMLInputElement | null;
|
|
33
|
+
}>;
|
|
28
34
|
onFocus?: (e: React.FocusEvent) => void;
|
|
29
35
|
onBlur?: (e: React.FocusEvent) => void;
|
|
30
36
|
onClick?: (e?: React.MouseEvent) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["result.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,eAAO,MAAM,KAAK;;WAET,MAAM;;;;kBAIC,MAAM,KAAK,IAAI;mBACf,gBAAgB,KAAK,IAAI;uBACrB,gBAAgB,KAAK,IAAI
|
|
1
|
+
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["result.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,eAAO,MAAM,KAAK;;WAET,MAAM;;;;kBAIC,MAAM,KAAK,IAAI;mBACf,gBAAgB,KAAK,IAAI;uBACrB,gBAAgB,KAAK,IAAI;;;;;;mBAS7B,oBAAoB,KAAK,IAAI;mBAC7B,gBAAgB,KAAK,IAAI;kBAC1B,gBAAgB,KAAK,IAAI;oBACvB,gBAAgB,KAAK,IAAI;iBAyCzC,CAAC;AACF,UAAU,WACR,SAAQ,IAAI,CACV,eAAe,CAAC,MAAM,CAAC,EACvB,UAAU,GAAG,MAAM,GAAG,WAAW,GAAG,OAAO,GAAG,aAAa,CAC5D;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,eAAe,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC3C,SAAS,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACrC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC,gBAAgB,CAAC;QAC5B,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC;KACnC,CAAC,CAAC;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACxC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CAC1C;AACD,QAAA,MAAM,MAAM,UAAW,WAAW,gBA0JjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -14,6 +14,14 @@ export var Input = function Input(props) {
|
|
|
14
14
|
_useState2 = _slicedToArray(_useState, 2),
|
|
15
15
|
value = _useState2[0],
|
|
16
16
|
setValue = _useState2[1];
|
|
17
|
+
var updateValue = function updateValue() {
|
|
18
|
+
setValue(props.value);
|
|
19
|
+
};
|
|
20
|
+
if (props.inputRef) {
|
|
21
|
+
props.inputRef.current = {
|
|
22
|
+
updateValue: updateValue
|
|
23
|
+
};
|
|
24
|
+
}
|
|
17
25
|
useEffect(function () {
|
|
18
26
|
setValue(props.value);
|
|
19
27
|
}, [props.value, props.open]);
|
|
@@ -52,6 +60,7 @@ var Result = function Result(props) {
|
|
|
52
60
|
range = props.range,
|
|
53
61
|
placeholder = props.placeholder,
|
|
54
62
|
_onChange = props.onChange,
|
|
63
|
+
_onRef = props.onRef,
|
|
55
64
|
disabledLeft = props.disabledLeft,
|
|
56
65
|
disabledRight = props.disabledRight,
|
|
57
66
|
_props$activeIndex = props.activeIndex,
|
|
@@ -65,6 +74,7 @@ var Result = function Result(props) {
|
|
|
65
74
|
clickIndex: 0
|
|
66
75
|
}),
|
|
67
76
|
context = _useRef.current;
|
|
77
|
+
var inputRef = useRef({});
|
|
68
78
|
useEffect(function () {
|
|
69
79
|
if (open) {
|
|
70
80
|
if (context.inputRefs[activeIndex]) {
|
|
@@ -117,10 +127,12 @@ var Result = function Result(props) {
|
|
|
117
127
|
className: styles === null || styles === void 0 ? void 0 : styles.resultTextPadding,
|
|
118
128
|
children: info.inputable ? /*#__PURE__*/_jsx(Input, {
|
|
119
129
|
onRef: function onRef(el) {
|
|
130
|
+
_onRef.current.inputRef = el;
|
|
120
131
|
context.inputRefs[info.index] = el;
|
|
121
132
|
},
|
|
122
133
|
disabled: dis,
|
|
123
134
|
open: !!open,
|
|
135
|
+
inputRef: inputRef,
|
|
124
136
|
value: info.target || info.value || '',
|
|
125
137
|
placeholder: info.place,
|
|
126
138
|
onChange: function onChange(s) {
|
|
@@ -130,10 +142,11 @@ var Result = function Result(props) {
|
|
|
130
142
|
context.clickIndex = info.index;
|
|
131
143
|
},
|
|
132
144
|
onBlur: function onBlur(e) {
|
|
133
|
-
var _props$onBlur;
|
|
145
|
+
var _props$onBlur, _inputRef$current$upd, _inputRef$current;
|
|
134
146
|
e.stopPropagation();
|
|
135
147
|
if (e.relatedTarget === context.inputRefs[1 - info.index]) return;
|
|
136
148
|
(_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 || _props$onBlur.call(props, e);
|
|
149
|
+
if (inputRef.current) (_inputRef$current$upd = (_inputRef$current = inputRef.current).updateValue) === null || _inputRef$current$upd === void 0 || _inputRef$current$upd.call(_inputRef$current);
|
|
137
150
|
context.clickIndex = 0;
|
|
138
151
|
},
|
|
139
152
|
onFocus: function onFocus(e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["Item.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAgB,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAuB1D,cAAM,IAAK,SAAQ,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC;IAC/C,MAAM,CAAC,YAAY;;;MAAgB;gBAEvB,KAAK,EAAE,SAAS;IAK5B,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU;IAY/B,MAAM;
|
|
1
|
+
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["Item.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAgB,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAuB1D,cAAM,IAAK,SAAQ,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC;IAC/C,MAAM,CAAC,YAAY;;;MAAgB;gBAEvB,KAAK,EAAE,SAAS;IAK5B,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU;IAY/B,MAAM;CAyCP;AAED,eAAe,IAAI,CAAC"}
|
package/esm/dropdown/Item.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
var _excluded = ["className"],
|
|
4
|
-
_excluded2 = ["className"];
|
|
4
|
+
_excluded2 = ["className", "onClick"];
|
|
5
5
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
6
6
|
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; }
|
|
7
7
|
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; }
|
|
@@ -81,10 +81,15 @@ var Item = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
81
81
|
var _ref2 = content.props,
|
|
82
82
|
_ref2$className = _ref2.className,
|
|
83
83
|
contentPropsClassName = _ref2$className === void 0 ? '' : _ref2$className,
|
|
84
|
+
contentPropsOnClick = _ref2.onClick,
|
|
84
85
|
otherContentProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
85
86
|
var className = classNames(propsClassName, contentPropsClassName);
|
|
86
87
|
return /*#__PURE__*/cloneElement(content, Object.assign(otherProps, otherContentProps, {
|
|
87
|
-
className: className
|
|
88
|
+
className: className,
|
|
89
|
+
onClick: function onClick(e) {
|
|
90
|
+
if (contentPropsOnClick) contentPropsOnClick(e);
|
|
91
|
+
if (props.onClick) props.onClick(e);
|
|
92
|
+
}
|
|
88
93
|
}));
|
|
89
94
|
}
|
|
90
95
|
return /*#__PURE__*/_jsx("a", _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["result.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAQ5C,QAAA,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["result.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAQ5C,QAAA,MAAM,MAAM,uEA0XX,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/esm/select/result.js
CHANGED
|
@@ -57,7 +57,7 @@ var Result = function Result(props) {
|
|
|
57
57
|
onRemove = props.onRemove,
|
|
58
58
|
onResultItemClick = props.onResultItemClick,
|
|
59
59
|
data = props.data;
|
|
60
|
-
var value = isArray(valueProp) ? valueProp : [valueProp];
|
|
60
|
+
var value = [null, undefined].includes(valueProp) ? [] : Array.isArray(valueProp) ? valueProp : [valueProp];
|
|
61
61
|
var _useState = useState(-1),
|
|
62
62
|
_useState2 = _slicedToArray(_useState, 2),
|
|
63
63
|
more = _useState2[0],
|
|
@@ -214,7 +214,9 @@ var Result = function Result(props) {
|
|
|
214
214
|
}, 'single');
|
|
215
215
|
};
|
|
216
216
|
var getValueArr = function getValueArr(v) {
|
|
217
|
-
return isArray(v) ? v : [v]
|
|
217
|
+
return (isArray(v) ? v : [v]).filter(function (v) {
|
|
218
|
+
return v !== undefined && v !== null;
|
|
219
|
+
});
|
|
218
220
|
};
|
|
219
221
|
var renderMultipleResult = function renderMultipleResult() {
|
|
220
222
|
if (isEmptyResult()) return renderNbsp();
|
|
@@ -147,8 +147,8 @@ export interface SelectPropsBase<DataItem, Value> extends Omit<BaseSelectProps<D
|
|
|
147
147
|
*/
|
|
148
148
|
keygen: KeygenType<DataItem>;
|
|
149
149
|
/**
|
|
150
|
-
* @en In the Form, the value will be taken over by the form and the value will
|
|
151
|
-
* @cn 在 Form 中,value 会被表单接管,value
|
|
150
|
+
* @en In the Form, the value will be taken over by the form, and the value is invalid. Note: Do not use undefined and null as meaningful option values. When the value type is undefined and null, the component will not process data and rendering
|
|
151
|
+
* @cn 在 Form 中,value 会被表单接管,value 无效。注意,请勿将 undefined 和 null 作为有意义的选项值,当 value 类型为 undefined 和 null 时,组件将不处理数据和渲染
|
|
152
152
|
* @override any
|
|
153
153
|
*/
|
|
154
154
|
value?: Value;
|
package/esm/tabs/tab.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;;AAyHtC,wBAAqC"}
|
package/esm/tabs/tab.js
CHANGED
|
@@ -10,11 +10,12 @@ import Button from "../button";
|
|
|
10
10
|
import { useConfig } from "../config";
|
|
11
11
|
import { useTabsContext, util } from '@sheinx/hooks';
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
15
|
var Tab = function Tab(props, ref) {
|
|
15
16
|
var _jssStyle$tabs;
|
|
16
17
|
var jssStyle = props.jssStyle,
|
|
17
|
-
|
|
18
|
+
propTab = props.tab,
|
|
18
19
|
disabled = props.disabled,
|
|
19
20
|
id = props.id,
|
|
20
21
|
color = props.color;
|
|
@@ -40,13 +41,11 @@ var Tab = function Tab(props, ref) {
|
|
|
40
41
|
};
|
|
41
42
|
var handleClick = function handleClick() {
|
|
42
43
|
if (disabled) return;
|
|
43
|
-
if (util.isLink(tab)) {
|
|
44
|
-
if (tab.props.onClick && typeof tab.props.onClick === 'function') {
|
|
45
|
-
tab.props.onClick();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
44
|
onChange === null || onChange === void 0 || onChange(id);
|
|
49
45
|
};
|
|
46
|
+
var tab = util.isLink(propTab) ?
|
|
47
|
+
// 直接返回a标签的内容,不要a标签
|
|
48
|
+
propTab.props.children : propTab;
|
|
50
49
|
var renderCardTab = function renderCardTab() {
|
|
51
50
|
return tab;
|
|
52
51
|
};
|
|
@@ -78,27 +77,35 @@ var Tab = function Tab(props, ref) {
|
|
|
78
77
|
if (shape === 'card') {
|
|
79
78
|
style.color = color;
|
|
80
79
|
}
|
|
81
|
-
|
|
82
|
-
className: tabClass,
|
|
83
|
-
jssStyle: {
|
|
84
|
-
button: buttonStyle
|
|
85
|
-
}
|
|
86
|
-
}, getStateProps()), {}, {
|
|
87
|
-
style: style,
|
|
88
|
-
disabled: disabled,
|
|
89
|
-
type: isActive ? 'primary' : 'secondary',
|
|
90
|
-
onClick: handleClick,
|
|
91
|
-
dir: config.direction,
|
|
92
|
-
children: tab
|
|
93
|
-
}));
|
|
94
|
-
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
95
|
-
dir: config.direction,
|
|
80
|
+
var containerProps = _objectSpread(_objectSpread({
|
|
96
81
|
className: tabClass
|
|
97
82
|
}, getStateProps()), {}, {
|
|
98
83
|
style: style,
|
|
99
84
|
onClick: handleClick,
|
|
100
85
|
ref: ref,
|
|
86
|
+
dir: config.direction
|
|
87
|
+
});
|
|
88
|
+
if (shape === 'button') {
|
|
89
|
+
return /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
|
|
90
|
+
jssStyle: {
|
|
91
|
+
button: buttonStyle
|
|
92
|
+
},
|
|
93
|
+
disabled: disabled,
|
|
94
|
+
type: isActive ? 'primary' : 'secondary'
|
|
95
|
+
}, containerProps), {}, {
|
|
96
|
+
children: tab
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
var $children = /*#__PURE__*/_jsxs(_Fragment, {
|
|
101
100
|
children: [shape === 'card' && renderCardTab(), shape === 'line' && renderLineTab(), shape === 'dash' && renderDashTab(), shape === 'fill' && renderFillTab()]
|
|
101
|
+
});
|
|
102
|
+
if (util.isLink(propTab)) {
|
|
103
|
+
return /*#__PURE__*/React.cloneElement(propTab, _objectSpread({
|
|
104
|
+
children: $children
|
|
105
|
+
}, containerProps));
|
|
106
|
+
}
|
|
107
|
+
return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
108
|
+
children: $children
|
|
102
109
|
}));
|
|
103
110
|
};
|
|
104
111
|
export default /*#__PURE__*/React.forwardRef(Tab);
|
|
@@ -251,8 +251,8 @@ export interface TreeSelectProps<DataItem, Value> extends Pick<CommonType, 'clas
|
|
|
251
251
|
data?: ResultItem<DataItem>[] | ResultItem<DataItem> | null;
|
|
252
252
|
}) => void;
|
|
253
253
|
/**
|
|
254
|
-
* @
|
|
255
|
-
* @
|
|
254
|
+
* @cn 选中的 key (受控),多选时必须为array。注意,请勿将 undefined 和 null 作为有意义的选项值,当 value 类型为 undefined 和 null 时,组件将不处理数据和渲染
|
|
255
|
+
* @en Selected key (controlled), must be an array in multiple selection. Note: Do not use undefined and null as meaningful option values. When the value type is undefined and null, the component will not process data and rendering
|
|
256
256
|
*/
|
|
257
257
|
value?: Value;
|
|
258
258
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheinx/base",
|
|
3
|
-
"version": "3.3.3-beta.
|
|
3
|
+
"version": "3.3.3-beta.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"module": "./esm/index.js",
|
|
11
11
|
"typings": "./cjs/index.d.ts",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@sheinx/hooks": "3.3.3-beta.
|
|
13
|
+
"@sheinx/hooks": "3.3.3-beta.8",
|
|
14
14
|
"immer": "^10.0.0",
|
|
15
15
|
"classnames": "^2.0.0",
|
|
16
16
|
"@shined/reactive": "^0.1.3-alpha.0"
|