@sheinx/base 3.6.0-beta.8 → 3.6.0-beta.9
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/form/form-field-context.js +2 -1
- package/cjs/form/form-field.d.ts.map +1 -1
- package/cjs/form/form-field.js +8 -1
- package/cjs/input/simple-input.d.ts +4 -1
- package/cjs/input/simple-input.d.ts.map +1 -1
- package/cjs/input/simple-input.js +1 -0
- package/cjs/spin/spin.d.ts.map +1 -1
- package/cjs/spin/spin.js +9 -9
- package/cjs/transfer/transfer-list.js +1 -1
- package/esm/form/form-field-context.js +2 -1
- package/esm/form/form-field.d.ts.map +1 -1
- package/esm/form/form-field.js +9 -2
- package/esm/input/simple-input.d.ts +4 -1
- package/esm/input/simple-input.d.ts.map +1 -1
- package/esm/input/simple-input.js +1 -0
- package/esm/spin/spin.d.ts.map +1 -1
- package/esm/spin/spin.js +9 -9
- package/esm/transfer/transfer-list.js +1 -1
- package/package.json +2 -2
|
@@ -9,4 +9,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
9
9
|
var FormFieldContext = exports.FormFieldContext = /*#__PURE__*/_react.default.createContext({
|
|
10
10
|
fieldId: undefined,
|
|
11
11
|
separator: '__separator__'
|
|
12
|
-
});
|
|
12
|
+
});
|
|
13
|
+
FormFieldContext.displayName = 'FormFieldContext';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-field.d.ts","sourceRoot":"","sources":["form-field.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAqB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGtE,QAAA,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"form-field.d.ts","sourceRoot":"","sources":["form-field.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAqB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGtE,QAAA,MAAM,SAAS,oEAoFd,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/cjs/form/form-field.js
CHANGED
|
@@ -45,6 +45,7 @@ var FormField = function FormField(props) {
|
|
|
45
45
|
var error = (_childrenProps$error = childrenProps.error) !== null && _childrenProps$error !== void 0 ? _childrenProps$error : formControl.error;
|
|
46
46
|
var status = (_childrenProps$status = childrenProps.status) !== null && _childrenProps$status !== void 0 ? _childrenProps$status : formControl.error ? 'error' : undefined;
|
|
47
47
|
var _useContext = (0, _react.useContext)(_formFieldContext.FormFieldContext),
|
|
48
|
+
fieldId = _useContext.fieldId,
|
|
48
49
|
separator = _useContext.separator;
|
|
49
50
|
var formFieldId = (0, _react.useMemo)(function () {
|
|
50
51
|
if (!formConfig.formName) return;
|
|
@@ -56,6 +57,12 @@ var FormField = function FormField(props) {
|
|
|
56
57
|
}
|
|
57
58
|
return _hooks.util.getFieldId(formControl.name, formConfig.formName);
|
|
58
59
|
}, [formControl.name, formConfig.formName, childrenProps.id]);
|
|
60
|
+
var _useContext2 = (0, _react.useContext)(_hooks.FieldsetContext),
|
|
61
|
+
fieldsetPath = _useContext2.path;
|
|
62
|
+
var fieldsetPathId = (0, _react.useMemo)(function () {
|
|
63
|
+
if (!formConfig.formName) return;
|
|
64
|
+
return _hooks.util.getFieldId(fieldsetPath, formConfig.formName);
|
|
65
|
+
}, [fieldsetPath, formConfig.formName]);
|
|
59
66
|
var cloneProps = {
|
|
60
67
|
onChange: handleChange,
|
|
61
68
|
status: status,
|
|
@@ -77,7 +84,7 @@ var FormField = function FormField(props) {
|
|
|
77
84
|
}
|
|
78
85
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_formFieldContext.FormFieldContext.Provider, {
|
|
79
86
|
value: {
|
|
80
|
-
fieldId: formFieldId,
|
|
87
|
+
fieldId: formFieldId || fieldId || fieldsetPathId,
|
|
81
88
|
separator: separator
|
|
82
89
|
},
|
|
83
90
|
children: finalChildren
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SimpleInputProps } from './input.type';
|
|
3
|
-
declare const Input:
|
|
3
|
+
declare const Input: {
|
|
4
|
+
(props: SimpleInputProps): JSX.Element;
|
|
5
|
+
displayName: string;
|
|
6
|
+
};
|
|
4
7
|
export default Input;
|
|
5
8
|
//# sourceMappingURL=simple-input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-input.d.ts","sourceRoot":"","sources":["simple-input.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAIhD,QAAA,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"simple-input.d.ts","sourceRoot":"","sources":["simple-input.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAIhD,QAAA,MAAM,KAAK;YAAW,gBAAgB;;CA+FrC,CAAC;AAGF,eAAe,KAAK,CAAC"}
|
package/cjs/spin/spin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spin.d.ts","sourceRoot":"","sources":["spin.tsx"],"names":[],"mappings":";AACA,OAAO,EAAe,SAAS,EAAE,MAAM,aAAa,CAAC;AAIrD,QAAA,MAAM,IAAI,WAAW,SAAS,
|
|
1
|
+
{"version":3,"file":"spin.d.ts","sourceRoot":"","sources":["spin.tsx"],"names":[],"mappings":";AACA,OAAO,EAAe,SAAS,EAAE,MAAM,aAAa,CAAC;AAIrD,QAAA,MAAM,IAAI,WAAW,SAAS,uBAiI7B,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/cjs/spin/spin.js
CHANGED
|
@@ -70,15 +70,14 @@ var Spin = function Spin() {
|
|
|
70
70
|
var color = colorProps !== null && colorProps !== void 0 ? colorProps : getSpinColor();
|
|
71
71
|
var mode = (_ref2 = modeProps !== null && modeProps !== void 0 ? modeProps : getSpinMode()) !== null && _ref2 !== void 0 ? _ref2 : 'vertical';
|
|
72
72
|
var spinStyle = (jssStyle === null || jssStyle === void 0 || (_jssStyle$spin = jssStyle.spin) === null || _jssStyle$spin === void 0 ? void 0 : _jssStyle$spin.call(jssStyle)) || {};
|
|
73
|
-
var
|
|
74
|
-
var renderSpin = function renderSpin() {
|
|
73
|
+
var renderSpin = function renderSpin(isRoot) {
|
|
75
74
|
var n = name;
|
|
76
75
|
if (_spins.default[n]) {
|
|
77
76
|
var Comp = _spins.default[n];
|
|
78
77
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Comp, _objectSpread(_objectSpread({}, props), {}, {
|
|
79
78
|
color: color,
|
|
80
79
|
style: style,
|
|
81
|
-
className:
|
|
80
|
+
className: isRoot ? className : undefined
|
|
82
81
|
}));
|
|
83
82
|
}
|
|
84
83
|
return null;
|
|
@@ -94,27 +93,28 @@ var Spin = function Spin() {
|
|
|
94
93
|
}) : tip
|
|
95
94
|
});
|
|
96
95
|
};
|
|
97
|
-
var renderContent = function renderContent() {
|
|
96
|
+
var renderContent = function renderContent(isRoot) {
|
|
97
|
+
var contentClass = (0, _classnames.default)(isRoot && className, _defineProperty(_defineProperty(_defineProperty({}, spinStyle.rootClass, isRoot), spinStyle.vertical, mode === 'vertical'), spinStyle.horizontal, mode === 'horizontal'), spinStyle.content);
|
|
98
98
|
if (tip) {
|
|
99
99
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
100
100
|
className: contentClass,
|
|
101
|
-
children: [renderSpin(), tip && renderTip()]
|
|
101
|
+
children: [renderSpin(false), tip && renderTip()]
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
|
-
return renderSpin();
|
|
104
|
+
return renderSpin(isRoot);
|
|
105
105
|
};
|
|
106
106
|
var renderContainer = function renderContainer() {
|
|
107
107
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
108
|
-
className: (0, _classnames.default)(className, spinStyle.container),
|
|
108
|
+
className: (0, _classnames.default)(className, spinStyle.rootClass, spinStyle.container),
|
|
109
109
|
children: [children, loading && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
110
110
|
className: spinStyle.loading,
|
|
111
|
-
children: renderContent()
|
|
111
|
+
children: renderContent(false)
|
|
112
112
|
})]
|
|
113
113
|
});
|
|
114
114
|
};
|
|
115
115
|
if (children) {
|
|
116
116
|
return renderContainer();
|
|
117
117
|
}
|
|
118
|
-
return renderContent();
|
|
118
|
+
return renderContent(true);
|
|
119
119
|
};
|
|
120
120
|
var _default = exports.default = Spin;
|
|
@@ -79,7 +79,7 @@ var TransferList = function TransferList(props) {
|
|
|
79
79
|
var containerBottom = listContainerRef.current.getBoundingClientRect().bottom;
|
|
80
80
|
var listBottom = ($list === null || $list === void 0 ? void 0 : $list.getBoundingClientRect().bottom) || containerBottom;
|
|
81
81
|
if (containerBottom - listBottom > 1) {
|
|
82
|
-
setAddonHeight(containerBottom - listBottom);
|
|
82
|
+
setAddonHeight(containerBottom - listBottom - 1);
|
|
83
83
|
}
|
|
84
84
|
}, []);
|
|
85
85
|
var listHeight = listHeightProp + addonHeight;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-field.d.ts","sourceRoot":"","sources":["form-field.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAqB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGtE,QAAA,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"form-field.d.ts","sourceRoot":"","sources":["form-field.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAqB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGtE,QAAA,MAAM,SAAS,oEAoFd,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/esm/form/form-field.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useContext, useMemo } from 'react';
|
|
2
|
-
import { useFormConfig, useFormControl, usePersistFn, util } from '@sheinx/hooks';
|
|
2
|
+
import { useFormConfig, useFormControl, usePersistFn, util, FieldsetContext } from '@sheinx/hooks';
|
|
3
3
|
import { FormFieldContext } from "./form-field-context";
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
var FormField = function FormField(props) {
|
|
@@ -36,6 +36,7 @@ var FormField = function FormField(props) {
|
|
|
36
36
|
var error = (_childrenProps$error = childrenProps.error) !== null && _childrenProps$error !== void 0 ? _childrenProps$error : formControl.error;
|
|
37
37
|
var status = (_childrenProps$status = childrenProps.status) !== null && _childrenProps$status !== void 0 ? _childrenProps$status : formControl.error ? 'error' : undefined;
|
|
38
38
|
var _useContext = useContext(FormFieldContext),
|
|
39
|
+
fieldId = _useContext.fieldId,
|
|
39
40
|
separator = _useContext.separator;
|
|
40
41
|
var formFieldId = useMemo(function () {
|
|
41
42
|
if (!formConfig.formName) return;
|
|
@@ -47,6 +48,12 @@ var FormField = function FormField(props) {
|
|
|
47
48
|
}
|
|
48
49
|
return util.getFieldId(formControl.name, formConfig.formName);
|
|
49
50
|
}, [formControl.name, formConfig.formName, childrenProps.id]);
|
|
51
|
+
var _useContext2 = useContext(FieldsetContext),
|
|
52
|
+
fieldsetPath = _useContext2.path;
|
|
53
|
+
var fieldsetPathId = useMemo(function () {
|
|
54
|
+
if (!formConfig.formName) return;
|
|
55
|
+
return util.getFieldId(fieldsetPath, formConfig.formName);
|
|
56
|
+
}, [fieldsetPath, formConfig.formName]);
|
|
50
57
|
var cloneProps = {
|
|
51
58
|
onChange: handleChange,
|
|
52
59
|
status: status,
|
|
@@ -68,7 +75,7 @@ var FormField = function FormField(props) {
|
|
|
68
75
|
}
|
|
69
76
|
return /*#__PURE__*/_jsx(FormFieldContext.Provider, {
|
|
70
77
|
value: {
|
|
71
|
-
fieldId: formFieldId,
|
|
78
|
+
fieldId: formFieldId || fieldId || fieldsetPathId,
|
|
72
79
|
separator: separator
|
|
73
80
|
},
|
|
74
81
|
children: finalChildren
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SimpleInputProps } from './input.type';
|
|
3
|
-
declare const Input:
|
|
3
|
+
declare const Input: {
|
|
4
|
+
(props: SimpleInputProps): JSX.Element;
|
|
5
|
+
displayName: string;
|
|
6
|
+
};
|
|
4
7
|
export default Input;
|
|
5
8
|
//# sourceMappingURL=simple-input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-input.d.ts","sourceRoot":"","sources":["simple-input.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAIhD,QAAA,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"simple-input.d.ts","sourceRoot":"","sources":["simple-input.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAIhD,QAAA,MAAM,KAAK;YAAW,gBAAgB;;CA+FrC,CAAC;AAGF,eAAe,KAAK,CAAC"}
|
package/esm/spin/spin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spin.d.ts","sourceRoot":"","sources":["spin.tsx"],"names":[],"mappings":";AACA,OAAO,EAAe,SAAS,EAAE,MAAM,aAAa,CAAC;AAIrD,QAAA,MAAM,IAAI,WAAW,SAAS,
|
|
1
|
+
{"version":3,"file":"spin.d.ts","sourceRoot":"","sources":["spin.tsx"],"names":[],"mappings":";AACA,OAAO,EAAe,SAAS,EAAE,MAAM,aAAa,CAAC;AAIrD,QAAA,MAAM,IAAI,WAAW,SAAS,uBAiI7B,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/esm/spin/spin.js
CHANGED
|
@@ -64,15 +64,14 @@ var Spin = function Spin() {
|
|
|
64
64
|
var color = colorProps !== null && colorProps !== void 0 ? colorProps : getSpinColor();
|
|
65
65
|
var mode = (_ref2 = modeProps !== null && modeProps !== void 0 ? modeProps : getSpinMode()) !== null && _ref2 !== void 0 ? _ref2 : 'vertical';
|
|
66
66
|
var spinStyle = (jssStyle === null || jssStyle === void 0 || (_jssStyle$spin = jssStyle.spin) === null || _jssStyle$spin === void 0 ? void 0 : _jssStyle$spin.call(jssStyle)) || {};
|
|
67
|
-
var
|
|
68
|
-
var renderSpin = function renderSpin() {
|
|
67
|
+
var renderSpin = function renderSpin(isRoot) {
|
|
69
68
|
var n = name;
|
|
70
69
|
if (Spins[n]) {
|
|
71
70
|
var Comp = Spins[n];
|
|
72
71
|
return /*#__PURE__*/_jsx(Comp, _objectSpread(_objectSpread({}, props), {}, {
|
|
73
72
|
color: color,
|
|
74
73
|
style: style,
|
|
75
|
-
className:
|
|
74
|
+
className: isRoot ? className : undefined
|
|
76
75
|
}));
|
|
77
76
|
}
|
|
78
77
|
return null;
|
|
@@ -88,27 +87,28 @@ var Spin = function Spin() {
|
|
|
88
87
|
}) : tip
|
|
89
88
|
});
|
|
90
89
|
};
|
|
91
|
-
var renderContent = function renderContent() {
|
|
90
|
+
var renderContent = function renderContent(isRoot) {
|
|
91
|
+
var contentClass = classNames(isRoot && className, _defineProperty(_defineProperty(_defineProperty({}, spinStyle.rootClass, isRoot), spinStyle.vertical, mode === 'vertical'), spinStyle.horizontal, mode === 'horizontal'), spinStyle.content);
|
|
92
92
|
if (tip) {
|
|
93
93
|
return /*#__PURE__*/_jsxs("div", {
|
|
94
94
|
className: contentClass,
|
|
95
|
-
children: [renderSpin(), tip && renderTip()]
|
|
95
|
+
children: [renderSpin(false), tip && renderTip()]
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
|
-
return renderSpin();
|
|
98
|
+
return renderSpin(isRoot);
|
|
99
99
|
};
|
|
100
100
|
var renderContainer = function renderContainer() {
|
|
101
101
|
return /*#__PURE__*/_jsxs("div", {
|
|
102
|
-
className: classNames(className, spinStyle.container),
|
|
102
|
+
className: classNames(className, spinStyle.rootClass, spinStyle.container),
|
|
103
103
|
children: [children, loading && /*#__PURE__*/_jsx("div", {
|
|
104
104
|
className: spinStyle.loading,
|
|
105
|
-
children: renderContent()
|
|
105
|
+
children: renderContent(false)
|
|
106
106
|
})]
|
|
107
107
|
});
|
|
108
108
|
};
|
|
109
109
|
if (children) {
|
|
110
110
|
return renderContainer();
|
|
111
111
|
}
|
|
112
|
-
return renderContent();
|
|
112
|
+
return renderContent(true);
|
|
113
113
|
};
|
|
114
114
|
export default Spin;
|
|
@@ -73,7 +73,7 @@ var TransferList = function TransferList(props) {
|
|
|
73
73
|
var containerBottom = listContainerRef.current.getBoundingClientRect().bottom;
|
|
74
74
|
var listBottom = ($list === null || $list === void 0 ? void 0 : $list.getBoundingClientRect().bottom) || containerBottom;
|
|
75
75
|
if (containerBottom - listBottom > 1) {
|
|
76
|
-
setAddonHeight(containerBottom - listBottom);
|
|
76
|
+
setAddonHeight(containerBottom - listBottom - 1);
|
|
77
77
|
}
|
|
78
78
|
}, []);
|
|
79
79
|
var listHeight = listHeightProp + addonHeight;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheinx/base",
|
|
3
|
-
"version": "3.6.0-beta.
|
|
3
|
+
"version": "3.6.0-beta.9",
|
|
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.6.0-beta.
|
|
13
|
+
"@sheinx/hooks": "3.6.0-beta.9",
|
|
14
14
|
"immer": "^10.0.0",
|
|
15
15
|
"classnames": "^2.0.0",
|
|
16
16
|
"@shined/reactive": "^0.1.3-alpha.0"
|