@sheinx/base 3.8.9 → 3.8.10-beta.1
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descriptions.d.ts","sourceRoot":"","sources":["descriptions.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAuB,MAAM,qBAAqB,CAAC;AAGlF,QAAA,MAAM,YAAY,UAAW,iBAAiB,
|
|
1
|
+
{"version":3,"file":"descriptions.d.ts","sourceRoot":"","sources":["descriptions.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAuB,MAAM,qBAAqB,CAAC;AAGlF,QAAA,MAAM,YAAY,UAAW,iBAAiB,4CA8I7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -18,7 +18,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
18
18
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
19
19
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
20
20
|
var Descriptions = function Descriptions(props) {
|
|
21
|
-
var _jssStyleProps$descri
|
|
21
|
+
var _jssStyleProps$descri;
|
|
22
22
|
var className = props.className,
|
|
23
23
|
jssStyleProps = props.jssStyle,
|
|
24
24
|
style = props.style,
|
|
@@ -46,6 +46,11 @@ var Descriptions = function Descriptions(props) {
|
|
|
46
46
|
labelStyle: labelStyle
|
|
47
47
|
}),
|
|
48
48
|
renderItem = _useDescriptions.renderItem;
|
|
49
|
+
var longestItem = (0, _react.useMemo)(function () {
|
|
50
|
+
return renderItem.reduce(function (prev, curr) {
|
|
51
|
+
return prev.length >= curr.length ? prev : curr;
|
|
52
|
+
}, []);
|
|
53
|
+
}, [renderItem]);
|
|
49
54
|
var jssStyle = (jssStyleProps === null || jssStyleProps === void 0 || (_jssStyleProps$descri = jssStyleProps.descriptions) === null || _jssStyleProps$descri === void 0 ? void 0 : _jssStyleProps$descri.call(jssStyleProps)) || {};
|
|
50
55
|
var Header = function Header() {
|
|
51
56
|
if (!title && !extra) return null;
|
|
@@ -142,7 +147,7 @@ var Descriptions = function Descriptions(props) {
|
|
|
142
147
|
cellPadding: 0,
|
|
143
148
|
cellSpacing: 0,
|
|
144
149
|
children: [layout === 'inlineHorizontal' && typeof column === 'number' && column > 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)("colgroup", {
|
|
145
|
-
children:
|
|
150
|
+
children: longestItem === null || longestItem === void 0 ? void 0 : longestItem.map(function (_, index, arr) {
|
|
146
151
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("col", {
|
|
147
152
|
style: {
|
|
148
153
|
width: "".concat(1 / arr.length * 100, "%")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descriptions.d.ts","sourceRoot":"","sources":["descriptions.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAuB,MAAM,qBAAqB,CAAC;AAGlF,QAAA,MAAM,YAAY,UAAW,iBAAiB,
|
|
1
|
+
{"version":3,"file":"descriptions.d.ts","sourceRoot":"","sources":["descriptions.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAuB,MAAM,qBAAqB,CAAC;AAGlF,QAAA,MAAM,YAAY,UAAW,iBAAiB,4CA8I7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -4,13 +4,13 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
import React, { Fragment } from 'react';
|
|
7
|
+
import React, { Fragment, useMemo } from 'react';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import { useDescriptions, usePersistFn } from '@sheinx/hooks';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
12
|
var Descriptions = function Descriptions(props) {
|
|
13
|
-
var _jssStyleProps$descri
|
|
13
|
+
var _jssStyleProps$descri;
|
|
14
14
|
var className = props.className,
|
|
15
15
|
jssStyleProps = props.jssStyle,
|
|
16
16
|
style = props.style,
|
|
@@ -38,6 +38,11 @@ var Descriptions = function Descriptions(props) {
|
|
|
38
38
|
labelStyle: labelStyle
|
|
39
39
|
}),
|
|
40
40
|
renderItem = _useDescriptions.renderItem;
|
|
41
|
+
var longestItem = useMemo(function () {
|
|
42
|
+
return renderItem.reduce(function (prev, curr) {
|
|
43
|
+
return prev.length >= curr.length ? prev : curr;
|
|
44
|
+
}, []);
|
|
45
|
+
}, [renderItem]);
|
|
41
46
|
var jssStyle = (jssStyleProps === null || jssStyleProps === void 0 || (_jssStyleProps$descri = jssStyleProps.descriptions) === null || _jssStyleProps$descri === void 0 ? void 0 : _jssStyleProps$descri.call(jssStyleProps)) || {};
|
|
42
47
|
var Header = function Header() {
|
|
43
48
|
if (!title && !extra) return null;
|
|
@@ -134,7 +139,7 @@ var Descriptions = function Descriptions(props) {
|
|
|
134
139
|
cellPadding: 0,
|
|
135
140
|
cellSpacing: 0,
|
|
136
141
|
children: [layout === 'inlineHorizontal' && typeof column === 'number' && column > 1 && /*#__PURE__*/_jsx("colgroup", {
|
|
137
|
-
children:
|
|
142
|
+
children: longestItem === null || longestItem === void 0 ? void 0 : longestItem.map(function (_, index, arr) {
|
|
138
143
|
return /*#__PURE__*/_jsx("col", {
|
|
139
144
|
style: {
|
|
140
145
|
width: "".concat(1 / arr.length * 100, "%")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheinx/base",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.10-beta.1",
|
|
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.8.
|
|
13
|
+
"@sheinx/hooks": "3.8.10-beta.1",
|
|
14
14
|
"immer": "^10.0.0",
|
|
15
15
|
"classnames": "^2.0.0",
|
|
16
16
|
"@shined/reactive": "^0.1.3-alpha.0"
|